Skip to content

fix(mocks): mock every endpoint the app calls and keep changes for the session - #337

Merged
MrYuion merged 2 commits into
developfrom
fix/mock-coverage
Nov 10, 2026
Merged

MrYuion merged 2 commits into
developfrom
fix/mock-coverage

Conversation

@MrYuion

@MrYuion MrYuion commented Nov 10, 2026

Copy link
Copy Markdown
Collaborator

In mock mode, many pages had no data or failed to load. Changes made in the UI were also lost after a reload. Ten endpoints had no mock. Several other mocks used paths that ts-client does not call:

  • OAuth applications: the mock used doorkeeper/applications, but ts-client calls oauth_apps.
  • Metadata: ts-client calls /metadata/:id. The mock only had /systems/:id/metadata and similar.
  • System functions, exec and module state used the wrong paths.
  • Clusters: the mock used /clusters, but ts-client calls /cluster.

Metadata, start/stop, system modules and system triggers were not saved at all.

Fix

  • One store in common.mock.ts saves to session storage on every change. Every handler uses it now, so all changes stay after a reload. Seed data is saved the first time it loads, so random seed values stay the same for the session.
  • I added mocks for these endpoints:
    • zone triggers and tags
    • clusters and processes
    • MQTT re-sync
    • staff resource import and directory groups
    • signage plugins, playlists and AI providers
    • build jobs
    • groups/current
    • user revive
    • module load and errors
    • repository branches, files, pull and remote_*
    • admin consent
  • I fixed the wrong paths above, and changed systems/:id/settings so it no longer crashes when a system has no settings.
  • system-control.mock.ts mocks module functions, exec, state and the websocket bindings, so the module "connected" dots and trigger state work.
  • The settings history now shows real changes. Before, it showed random entries on each load.
  • The admin, auth source and staff API mocks now use the shared handlers, which removed about 900 lines of copied CRUD code.
  • A request with no mock now writes [mock] No handler for … to the console.

Two e2e seeds use the new storage keys: api_staff_v1_tenants and api_engine_v2_api_keys.

Testing

  • I visited every route in mock mode and logged each request that had no mock. There are no misses now.
  • The chromium and mobile-chrome e2e suites pass (161 tests).
  • Type-check and lint pass.

Created with Claude Opus 5.5 in Claude Code (T3 Code).

🤖 Generated with Claude Code

…e session

Ten endpoints had no mock, and several mocks used paths that ts-client
does not call (metadata, OAuth apps, system functions and exec, clusters).
Metadata, start and stop, system modules and system triggers were not
saved, so a reload lost them.

All handlers now use one store that saves to session storage on every
change. Requests that have no mock write a warning to the console.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
backoffice Ready Ready Preview Nov 10, 2026 4:48am UTC

CodeQL flagged mock API keys, OAuth secrets and webhook secrets made
with Math.random().

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@MrYuion
MrYuion merged commit 1c5576e into develop Nov 10, 2026
6 of 7 checks passed
@MrYuion
MrYuion deleted the fix/mock-coverage branch November 10, 2026 05:05

This branch was successfully deployed

1 active deployment
Preview — 1178f80c Deployed Nov 10, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants