Skip to content

fix(web): gate Sync All settings hop on uiMode=dev (PR #488 follow-up)#489

Merged
memtomem merged 2 commits intomainfrom
fix/web-context-gateway-prod-settings-gate
Apr 26, 2026
Merged

fix(web): gate Sync All settings hop on uiMode=dev (PR #488 follow-up)#489
memtomem merged 2 commits intomainfrom
fix/web-context-gateway-prod-settings-gate

Conversation

@memtomem
Copy link
Copy Markdown
Owner

Summary

Regression caught during functional testing of #488. The Context Gateway tabs ship in the prod surface now, but two code paths in context-gateway.js reach into the still-dev-only settings_sync router:

  1. Sync All button (context-gateway.js:124) — after fanning out skills/commands/agents successfully, it POSTs /api/context/settings/sync. That endpoint lives on the dev-only router, so prod returns 404 and the button toasts "Settings sync failed" even though the artifact fanout already completed. The user sees a red error after a successful sync.
  2. Overview's 4th card — labelled "Settings", links into the hooks-sync section. hooks-sync is hidden in prod (still dev-only by design), so clicking the card navigates to a tab that isn't rendered.

Both paths now self-gate on STATE.uiMode === 'dev', matching the established pattern in app.js:657-690 for the Home dashboard's namespaces/sessions/scratch fetches. Prod users get a clean 3-card overview (skills/commands/agents) and a Sync All button that completes silently against the artifacts they have a UI for.

Test plan

  • uv run ruff check packages/memtomem/src + ruff format --check — clean
  • uv run pytest packages/memtomem/tests/test_web_mode.py — 31 passed, including new pin
  • Pin test added: test_app_js_pins_ui_mode_default_and_toast_copy now also asserts context-gateway.js contains the STATE.uiMode === 'dev' gate. Same source-grep style as the existing app.js pins (no JS runtime in CI).
  • End-to-end via Playwright against isolated mm web (HOME override + fixture project under /tmp):
    • Prod overview renders 3 cards (skills, commands, agents); no settings card.
    • Sync All in prod: toasts "동기화 완료" / "Sync completed" — no Settings sync failed error.
    • Filesystem outcome verified: .claude/skills/, .claude/commands/, .claude/agents/, .codex/agents/*.toml (project-scope per feat(context)!: codex_agents project-scope default #483), .gemini/agents/. No HOME pollution.

Related

  • Caught in functional review of feat(web): graduate context gateway tabs to prod tier #488 — the PR's smoke test verified routes mount, but didn't drive the Sync All workflow that crosses into the dev-only sibling router.
  • Memory feedback_tier2_web_gating_deferred.md keeps settings_sync in _DEV_ONLY_ROUTERS intentionally; this fix is the cheap UX patch rather than promoting another router.

🤖 Generated with Claude Code

pandas-studio and others added 2 commits April 26, 2026 12:23
…Mode=dev

Follow-up to #488 (graduating the Context Gateway tabs to prod). The
"Sync All" button on the Artifact Sync overview also fans out to
``/api/context/settings/sync`` (settings-hook merge), and that
endpoint lives on the ``settings_sync`` router which intentionally
stays dev-only. In prod the sync hop returned 404 and the whole
button toasted "Settings sync failed" *after* successfully syncing
skills/commands/agents — making the prod surface look broken even
though the artifact fanout completed.

Same shape on the overview's 4th card: it labels Settings and links
into the ``hooks-sync`` section, which is hidden in prod, so the card
navigated to a dead tab.

Both code paths now self-gate on ``STATE.uiMode === 'dev'`` (matching
the Home dashboard pattern in app.js:657-690): the settings card and
the settings sync hop only appear/run when the user is in dev mode.
Prod users get a clean 3-card overview and a Sync All that completes
silently for the artifacts they actually have a UI for.

Pin test added so the gate doesn't silently disappear in a future JS
refactor — same source-grep style as the existing app.js pins.

Verified end-to-end via Playwright + isolated ``mm web`` (HOME
override, fixture project under /tmp): overview renders 3 cards in
prod / 4 in dev; Sync All toasts "동기화 완료" with no error in prod;
filesystem outcome correct (``.claude/``, ``.codex/agents/*.toml``
project-scope per #483, ``.gemini/``); no HOME pollution.

Co-Authored-By: Claude <[email protected]>
Per review feedback on #489: the original ``STATE.uiMode === 'dev'``
substring assertion would still pass if a future refactor removed one
of the two gates (overview-card push, Sync All settings hop) while
leaving the other. Switch to a count >= 2 assertion so both call
sites must survive together. Comment names the two sites for the
person who hits the failure later.

Co-Authored-By: Claude <[email protected]>
@memtomem memtomem merged commit dd8d625 into main Apr 26, 2026
7 checks passed
@memtomem memtomem deleted the fix/web-context-gateway-prod-settings-gate branch April 26, 2026 03:36
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 26, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants