Repository navigation
feat(charts): route Charts and CI cache through TanStack Router - #5553
shepherdjerred wants to merge 2 commits into
Conversation
|
This change is part of the following stack: Change managed by git-spice. |
|
Automatic reviews are disabled for this repository. Configure in Code Review Settings. |
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
|
@codex review Automated re-review request for |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Why Charts and CI cache were the last two consoles reading and writing their route state by hand from window.location and URLSearchParams. The console stack standard is TanStack Router with every URL parameter validated by Zod; both were allowlisted as "missing @tanstack/react-router". What - Each client gets one code-based route created with console-client's kit: zodSearch validates every search parameter the page reads (Charts: q, kind, fixture, expand; CI cache: ns, q, fixture), focusOnNavigate is wired, and the page writes the filter and query back with a replacing navigation. The hand-written parseUrlState, buildSearchSuffix, readInitialSearchState, syncUrlState and parseNamespaceFilter are gone. - The route matches any path (`$`) and keeps it, because both Rust servers answer unknown paths with the page; search values are plain text both ways, so URLs look exactly as before (`?q=1234`, never `?q=%221234%22`). - console-client: zodSearch now names every key of its shape (undefined when absent or invalid). TanStack Router spreads a route's validated search over the raw one, so a key merely dropped let the raw value (say `?kind=bogus`) through to useSearch(). New `searchText` schema turns the decoder's numbers and booleans (`?q=1234`) back into the typed text. - Both clients use createConsoleQueryClient; the per-query options stay. - The charts and ci-cache entries leave the console stack allowlist. - The Rust servers are untouched. Verification - bunx turbo run build typecheck test lint for charts, ci-cache, console-client and golink: 28/28 tasks pass. - New router tests in both clients: an invalid kind/ns, fixture or non-text q is dropped and the page falls back to its default, valid parameters render, unknown paths render the page, and written URLs are plain text. - bun scripts/checks/check-console-stack.ts: OK, Charts and CI cache "on the standard". - bunx lefthook run pre-commit (jscpd ratchet passed), bun run jscpd, bun scripts/checks/check-directory-file-counts.ts. - Not run: live deployment checks (no deploy from this change yet). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…text Why Go link read `?missing=` with a plain string schema, but the router's query-string decoder turns `123` into a number, so an unresolved `go/123` was never offered for creation. Its router also used the default JSON search serialisation, which writes a numeric-looking string back quoted. What - `?missing=` is parsed with console-client's `searchText`, so `go/123` reaches the page as the slug "123". - The router uses the same plain-text `parseSearch`/`stringifySearch` as Charts and CI cache. - New router test: `/?missing=123` offers `go/123`. Verification - The new test fails with the old `z.string()` schema and passes now. - bunx turbo run build typecheck test lint for golink, console-client, charts and ci-cache: 28/28 pass. - bunx lefthook run pre-commit: pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fe9d9b3 to
97d9d50
Compare
|
@codex review Automated re-review request for |
|
Codex Review: Didn't find any major issues. Bravo. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Why
Charts and CI cache were the last two consoles reading and writing route state by hand (
window.location,URLSearchParams,history.replaceState). The console stack standard is TanStack Router with every URL parameter validated by Zod, and both were allowlisted as "missing@tanstack/react-router" inscripts/checks/console-stack-rules.ts.What
client/router.tsx), built with the console-client kit:zodSearchvalidates every search parameter the page reads (Charts:q,kind,fixture,expand; CI cache:ns,q,fixture),focusOnNavigateis wired, and the page writes the filter and query back with a replacing navigation.parseUrlState,buildSearchSuffix,readInitialSearchState,syncUrlStateandparseNamespaceFilterare gone.$) and keeps it, because both Rust servers answer unknown paths with the page. Search values are plain text both ways (parseSearchWith((v) => v), unquoted stringify), so?q=1234stays?q=1234, never?q=%221234%22.zodSearchnow names every key of its shape (undefinedwhen absent or invalid). TanStack Router passes a route{ ...rawSearch, ...validated }, so a key that was just dropped let the raw value through touseSearch(). For example,?kind=bogusreached the page as"bogus".searchTextschema: the router's query-string decoder turns1234ortrueinto a number or boolean, andsearchTextturns them back into the text that was typed.?missing=is parsed withsearchText, so an unresolvedgo/123is offered for creation instead of being dropped. Its router also uses the plain-text parse/stringify, so written-back values are never JSON-quoted. Onlyrouter.tsxandrouter.test.tsxchange.createConsoleQueryClient. Each query keeps its ownretry/staleTimeoptions.chartsandci-cacheare removed from the console stack allowlist. The check reports both as "on the standard".Demo
Before is
main(b41f1cb) and after is this branch. Both are built bundles served with an SPA fallback, like the Rust servers, with?fixture=demodata. All 16 before/after screenshot pairs are byte-identical, so nothing visible changed.Charts at
/?fixture=demo&kind=first-party&expand=delivery1234CI cache at
/?fixture=demo&ns=gradle1234URL handling, driven in a real browser (PinchTab): load an invalid value, then click a sidebar item and type
1234into the filter:kind/nsshows/?fixture=demo&kind=upstream&q=1234/?fixture=demo&kind=upstream&q=1234/?fixture=demo&ns=sccache-pr&q=1234/?fixture=demo&ns=sccache-pr&q=1234Verification
bunx turbo run build typecheck test lint --filter=@shepherdjerred/charts --filter=@shepherdjerred/ci-cache --filter=@shepherdjerred/console-client --filter=@shepherdjerred/golink: 28/28 tasks pass, including the Rustcargo test/clippy/fmtsteps.client/router.test.tsxin both clients:kind/ns,fixtureor non-textqis dropped and the page falls back to its default;zodSearchnaming every key and forsearchText./?missing=123. It fails with the oldz.string()schema and passes now. Go linkrouter.test.tsxexpect(count: 4 → 5.expect(counts:model.test.ts22 → 22, migrated one for one:parseUrlState→validateCatalogSearch,buildSearchSuffix→catalogSearchFor;render.test.tsx28 → 28;render.test.tsx42 → 42 (Appnow also takessearch/onSearchChange);router.test.tsx14;router.test.tsx11;client.test.tsx10 → 16.[]→[], ci-cache[]→[].bun scripts/checks/check-console-stack.ts: OK.bunx lefthook run pre-commit: pass, with the jscpd ratchet.bun run jscpd: pass.bunx turbo run jscpd quality-ratchet knip --filter=//: pass.bun scripts/checks/check-directory-file-counts.ts: pass.bun run verify:extended -- --filter='...[origin/main...HEAD]': 59/59 tasks pass. Thebun.lockchange brings in scout, temporal, homelab and golink extended suites; golink is the one that depends on console-client.bun run e2e:affected:bun.lockchange selects unrelated projects.launch: Failed to launch the browser process. This is a local browser install problem, unrelated to this change.🤖 Generated with Claude Code