Skip to content

feat(desk): serve switch targets from account options - #1101

Merged
Pigbibi merged 1 commit into
mainfrom
feat/desk-switch-targets
Nov 9, 2026
Merged

Pigbibi merged 1 commit into
mainfrom
feat/desk-switch-targets

Conversation

@Pigbibi

@Pigbibi Pigbibi commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

AI assistance

Claude (WorkBuddy agent) wrote the change, ran the local checks and prepared this description. A human owner reviews and merges.

What changed

GET /api/desk/switch/targets returned 404, so the Meridian strategies page rendered api/fixtures/switchTargets.ts: six invented accounts with known live modes, strategy names and masked suffixes. This projects the console's configured account options into qsl.desk.switch_targets.v1 and flips DESK_SOURCES.switchTargets to live.

  • application/desk/switch_targets.js (new): switchTargetsFromConfig() reuses readbackTargets() — the same target identity the readback routes use — and deskSwitchTargetsResponse() gates the route with deskAuth.
  • worker.js: dispatch GET /api/desk/switch/targets before the readback branch.
  • frontend/src/desk/api/endpoints.ts: switchTargets: "mock" → "live".
  • v2_asset_map.js: regenerated after the source flip.
  • tests/desk_switch_targets_validation.mjs (new): every payload validated against schemas/desk/switch-targets.json; covers masking, declared domains/modes, config failures, auth, method and store errors.
  • tests/console_desk_mock_validation.mjs: source map, live fetch and forced-mock assertions updated.
  • package.json: the new suite joins test:operations.

Deliberate honesty. The console has no desk read that observes a target's live mode or its currently deployed strategy. Both are unknown / never_read. default_execution_mode and default_strategy_profile are configured defaults, not observations, so they are never presented as the current value. What is known is configuration only: target id, platform, declared supported_domains, declared default execution mode (only when it is in the contract vocabulary), and a masked suffix derived from a real account_selector. Switching is not connected in this build, so every row is switchable: {allowed: false, reason_code: "switch_not_connected"}; no stop/resume capability is claimed without evidence.

How verified

Local, on a branch from origin/main at 9f2fc61:

node tests/desk_switch_targets_validation.mjs              -> PASS
node tests/desk_contract_validation.mjs                    -> 24 responses, 63 fixtures, 569 closed objects
node tests/desk_helpers_validation.mjs / desk_readback...  -> PASS
node tests/console_desk_mock_validation.mjs                 -> PASS
console_desk_{format,shell,pages,p1_acceptance,phase8,overview,loading_retry} -> PASS
node tests/console_v2_assets_validation.mjs                 -> PASS
npx tsc --noEmit                                            -> clean
npm run build (vite + size budget)                          -> Size budget OK
npm run test:operations --prefix web/strategy-switch-console -> exit 0 (36 PASS lines)

Not verified: I still cannot sign in to the live console (readSession uses an HMAC cookie signed with a Worker secret I do not hold), so the rendered strategies page needs one signed-in look after a release. The real account_options payload is also not visible here; the projection is tested against synthetic configurations that follow normalizeAccountOption(), including options without an account_selector.

Why

The desk is a staged build: DESK_SOURCES defaults to fixtures until a backend route lands. #1099 proved the pattern with credentials; this is the second endpoint and the first whose data is a list of configured targets. Replacing six invented accounts with the configured list — while leaving everything unobservable visibly unknown — removes synthetic strategy names and live-mode claims from a page an operator uses to plan a switch.

Risk

R1 — read-only, no new store, no auth change, no write path. One new authenticated route (GET only, Cache-Control: no-store via deskResponse); a configuration read failure is 502 read_failed, never an empty healthy list. Affected: web/strategy-switch-console/** plus two test files.

  • The strategies page will now show unknown mode/strategy instead of the fixture's confident values. That is intentional; strategyText()/modeText() already render unknown reads.
  • The asset map changes, so the next console release must pin this head; the deploy workflow's exact-source allowlist rejects a stale pin by design.
  • No behaviour change for any existing route; switchStrategies and the later switch steps remain mock until their backends land.

The Meridian strategies page read api/fixtures/switchTargets.ts: six invented
accounts with known live modes, strategy labels and masked suffixes. Project the
configured account options into qsl.desk.switch_targets.v1 instead.

The console has no desk read for a target's live mode or deployed strategy, so
both are unknown/never_read. A configured default_execution_mode or
default_strategy_profile is a default, not an observation, and is never shown as
the current value. Domains and the declared default execution mode come from
configuration; the account suffix is masked and only emitted when a real account
selector exists. Switching is not connected, so every row is
switchable:false / switch_not_connected, and no stop/resume capability is
claimed.

Flips DESK_SOURCES.switchTargets to live; session, credentials and this endpoint
are now the three live desk reads.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-09T16:22:25.893324Z 95fc775 PR opened
🔒 Security Review ✅ Completed 2026-11-09T16:24:55.617779Z 95fc775 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Pigbibi Pigbibi added agent-approved An agent cleared this high-risk change on the current head; not an owner confirmation and removed agent-approved An agent cleared this high-risk change on the current head; not an owner confirmation labels Nov 9, 2026
@Pigbibi
Pigbibi merged commit b9fcb65 into main Nov 9, 2026
22 of 25 checks passed
@Pigbibi
Pigbibi deleted the feat/desk-switch-targets branch November 9, 2026 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-approved An agent cleared this high-risk change on the current head; not an owner confirmation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant