Repository navigation
fix(web-ui): share one in-flight auth probe between App mount and the router guard - #1294
Merged
Merged
Conversation
… router guard On a hard reload App.vue's onMounted checkAuth() and the router guard's checkAuth() for the initial navigation ran concurrently, each issuing its own /status + /auth/me pair. The guard now joins the run already in flight (one probe per reload) and decides isTeamsEdition / isAuthenticated from a single fully-settled result. The guard is exported as authGuard so a unit test can replay the mount-vs-initial-navigation race on a memory router. Co-Authored-By: Claude Opus 5 <[email protected]>
Cross-review P2: joining the in-flight run is right for the mount/guard
pair but wrong for the recovery path — a probe issued with the stale key
could be reused after the key was repaired. checkAuth({ fresh: true })
queues a new probe behind the in-flight one; loading stays true until the
newest run settles.
Co-Authored-By: Claude Opus 5 <[email protected]>
…h probe wins Cross-review round 2 P2: with a single await, a fresh probe queued behind the run the guard joined left loading=true while the guard routed on the superseded result. Loop on loading so the decision comes from the newest settled probe. Regression test fails under the old `if`. Co-Authored-By: Claude Opus 5 <[email protected]>
Deploying mcpproxy-docs with
|
| Latest commit: |
becb5fb
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://be41421a.mcpproxy-docs.pages.dev |
| Branch Preview URL: | https://fix-router-auth-guard-race.mcpproxy-docs.pages.dev |
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Contributor
📦 Build ArtifactsWorkflow Run: View Run Available Artifacts
How to DownloadOption 1: GitHub Web UI (easiest)
Option 2: GitHub CLI gh run download 35194064292 --repo smart-mcp-proxy/mcpproxy-go
|
Dumbris
added a commit
that referenced
this pull request
Sep 18, 2026
…er probe The merge of origin/main (#1294, shared in-flight auth probe) into 107-b-oidc-front-door (#1292, generic OIDC provider) combined without a conflict, but PR-B's auth store change (probe() now calls authApi.getProvider() instead of api.getStatus() for edition detection, Spec 107 FR-030/FR-041) left the test file's mocks pointed at the old api.getStatus() call, so every test silently no-oped through probe()'s catch block. Repoint the spy at authApi.getProvider() and update the resolved payload shape ({ display_name } instead of { data: { edition } }); the in-flight-probe-sharing behaviour under test is unchanged. Co-Authored-By: Claude Sonnet 5 <[email protected]>
Dumbris
added a commit
that referenced
this pull request
Sep 18, 2026
…ess, telemetry v13 (Spec 107 PR-B) (#1292) * docs(specs): Spec 107 — server edition SSO front door hardened for real IdPs Generic OIDC provider, IdP-group → server allowlist, attributable JSONL audit line, and a freeze/cut of the latent multiuser/credential-injection code, split into four PRs (A freeze/cut, B OIDC + front door + telemetry, C entitlement predicate + tenant session, D audit line). Judge-panel drafted; cross-model reviewed over nine rounds (codex gpt-5.6-sol), ~130 findings resolved. Un-parks roadmap epic sso. * test(spec-107): PR-A red tests, server-tag lint job and release notice Related #1177 * refactor(serveredition): freeze the latent credential-injection chain and normalise removed config keys (Spec 107 PR-A) Related #1177 * fix(storage): enforce the agent-token cap per owner, not per deployment (Spec 107 PR-A) Closes #1177 * fix(spec-107): address adversarial review of PR-A * fix(spec-107): codex round 1 for PR-A * fix(spec-107): codex round 2 for PR-A * fix(spec-107): codex round 3 for PR-A * fix(spec-107): codex round 4 for PR-A * docs(spec-107): PR-A verification and task ticks * docs(roadmap): link PR-A * test(oauthserver): fake OIDC identity provider and server-edition dev rig (Spec 107 PR-B) * test(serveredition): red tests for the generic OIDC provider, subject binding and refusals (Spec 107 PR-B) * feat(serveredition): generic OIDC provider with JWKS-verified ID tokens, groups capture and subject binding (Spec 107 PR-B) Related #1169 * test(serveredition): red tests for trusted proxies, public URL, cookie security and forced MCP auth (Spec 107 PR-B) * feat(serveredition): front door behind an ingress — public URL, trusted proxies, cookie security policy, forced MCP auth, provider probe (Spec 107 PR-B) * feat(config,telemetry): hot-reload clauses, docs and OAS for the PR-B keys; telemetry v13 server-edition fields (Spec 107 PR-B) * fix(spec-107): gate fixes for PR-B * docs(spec-107): PR-B automated-check evidence * fix(spec-107): cross-review round 1 for PR-B * fix(spec-107): cross-review round 2 for PR-B * fix(spec-107): cross-review round 3 for PR-B * fix(spec-107): cross-review round 3 for PR-B * fix(spec-107): cross-review round 4 for PR-B * fix(spec-107): cross-review round 5 for PR-B * fix(spec-107): cross-review round 6 for PR-B * docs(spec-107): PR-B real-instance verification, gate re-run, task ticks T062/T063: real-instance verification of the OIDC front door (happy-path login, groups, /auth/me, agent-token mint + /mcp initialize/tools-list, ErrorMode tamper matrix, cookie Secure matrix behind a simulated trusted vs untrusted proxy) and the telemetry v13 payload (server vs personal). T064: full gate set re-run on HEAD after cross-review round 6 touched the config load path, oauth_handler.go and telemetry.go — all green. T066: tick completed PR-B tasks (T032-T066); ROADMAP.md regenerated. Co-Authored-By: Claude Sonnet 5 <[email protected]> * docs(roadmap): link PR-B Co-Authored-By: Claude Sonnet 5 <[email protected]> * fix(ci): pull forward the Windows heap-corruption + Pass-2 race fix (#1288) This branch diverged from main before #1288 landed, so PR-B's CI hit the exact regression it fixed: handleAddFromRegistry's success path dereferenced a nil cfg, chi's recoverer turned the panic into a bare 500, and the recovered hardware fault corrupted the Go heap on windows/amd64 under Go 1.26 (golang/go#81238) — the internal/httpapi test binary crashed with "found pointer to free object" and took the whole Windows unit-test job (and the binaries job's httpapi/scanner test bundle) down with it. Cherry-picked the same fix main already carries: the nil-config guard with a JSON 500 (and its pinning test), plus the unrelated Pass-2 temp-dir teardown race fix in the scanner test this same upstream commit bundled. Co-Authored-By: Claude Sonnet 5 <[email protected]> * docs(spec-107): record the CI red/fix cycle for PR-B Co-Authored-By: Claude Sonnet 5 <[email protected]> * docs(spec-107): record PR-B CI green Co-Authored-By: Claude Sonnet 5 <[email protected]> * fix(spec-107): cross-review round 7 for PR-B * fix(spec-107): cross-review round 8 for PR-B * fix(web-ui): update hard-reload auth-guard test for the FR-030 provider probe The merge of origin/main (#1294, shared in-flight auth probe) into 107-b-oidc-front-door (#1292, generic OIDC provider) combined without a conflict, but PR-B's auth store change (probe() now calls authApi.getProvider() instead of api.getStatus() for edition detection, Spec 107 FR-030/FR-041) left the test file's mocks pointed at the old api.getStatus() call, so every test silently no-oped through probe()'s catch block. Repoint the spy at authApi.getProvider() and update the resolved payload shape ({ display_name } instead of { data: { edition } }); the in-flight-probe-sharing behaviour under test is unchanged. Co-Authored-By: Claude Sonnet 5 <[email protected]> * fix(test): match TestLoadConfig_ListenFlag to loadConfig's 3-value signature Mirrors main's ce5c2f7 fix for the same loadConfig signature mismatch that broke the Build Binaries CI job on this PR. Co-Authored-By: Claude Sonnet 5 <[email protected]> --------- Co-authored-by: Claude Sonnet 5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Found while verifying Spec 107 PR-C: on a hard reload of a deep server-edition route (
/ui/my/tokens,/ui/servers, …)App.vue's mount-timecheckAuth()and the router guard'scheckAuth()ran concurrently, each issuing its own/status+/auth/mepair, and the guard decidedisTeamsEdition/isAuthenticatedfrom whichever run it happened to await.auth.ts:checkAuth()shares one in-flight probe; concurrent callers join it, so every reader sees a single fully-settled result and a hard reload issues one probe pair instead of two.checkAuth({ fresh: true })queues a new probe behind the in-flight one for callers that must read with the current credentials (reloadAfterAuthafter the API key is repaired);loadingstaystrueuntil the newest run settles.router/index.ts: guard extracted as the exportedauthGuardso a test can mount it on a memory router with stub views; it now loopswhile (loading)so a fresh probe queued behind the run it joined is drained before routing.App.vue:reloadAfterAuthpassesfresh: true.frontend/tests/unit/auth-guard-hard-reload.spec.ts(13 tests): mount-vs-initial-navigation race for/my/tokens,/servers,/activityas tenant and admin (one probe, correct view + title), tenant → admin route → dashboard, signed-out →/login, fresh-probe queueing, and the drain case (fails under the oldif).What did NOT reproduce
The reported symptom — Dashboard/Usage content rendering under a correct target title — did not reproduce on the PR-C branch + this fix's base: 30+ Playwright hard loads (tenant and admin, with and without 300–600 ms injected latency on
/auth/meand on JS chunks), the realserver-edition-tenant.spec.ts, and the in-app browser all rendered the target view every time, before and after this change. Playwright's own failure snapshot in the PR-C worktree showsheading "Agent Tokens"rendered too.The e2e failure at the token-mint step has a different cause, in the spec (PR-C branch, not touched here):
page.locator('input[type="text"]').first()resolves to the hidden Add-Server modal's name input inTopHeader(placeholder="e.g., github-server"), sofill()waits 60 s for visibility. Fix: clickCreate Token, then filldialog.modal-open→getByPlaceholder(/ci-pipeline/).waitForURL(u => !u.pathname.startsWith('/login'))is vacuous under the/ui/base (pathname is/ui/login).assertNoApiKeyLeakageawaitsreq.allHeaders(), which hangs on a fetch aborted by the nextpage.goto;req.headers()is enough for theX-API-Keycheck.With 1–3 patched locally the test proceeds to
assertAll2xx, which then reports real PR-C findings (pre-login 401s tracked from/ui/, tenant 403s on/onboarding/stateand/secrets/config).PR-C's
App.vuealso has areloadAfterAuth → checkAuth()call that should becomecheckAuth({ fresh: true })on rebase.Verification
npx vitest run— 123 files / 1277 tests pass;vue-tsc --noEmitclean.scripts/dev-server-edition.sh --phase c: tenant and admin hard loads of/ui/my/tokens,/ui/servers,/ui/activityrender the target view, and the network log shows exactly one/auth/provider+ one/auth/meper reload (was two of each).opencode, gpt-6-astra): 3 rounds, rounds 1–2 each raised one P2 (both fixed with regression tests), round 3 CLEAN.🤖 Generated with Claude Code