Skip to content

feat(charts): route Charts and CI cache through TanStack Router - #5553

Open
shepherdjerred wants to merge 2 commits into
mainfrom
charts-ci-cache-router
Open

shepherdjerred wants to merge 2 commits into
mainfrom
charts-ci-cache-router

Conversation

@shepherdjerred

@shepherdjerred shepherdjerred commented Dec 3, 2026 •

Copy link
Copy Markdown
Owner

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" in scripts/checks/console-stack-rules.ts.

What

  • One code-based route per client (client/router.tsx), built with the console-client 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. parseUrlState, buildSearchSuffix, readInitialSearchState, syncUrlState and parseNamespaceFilter are gone.
  • URLs behave exactly as before. 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 (parseSearchWith((v) => v), unquoted stringify), so ?q=1234 stays ?q=1234, never ?q=%221234%22.
  • console-client fixes:
    • zodSearch now names every key of its shape (undefined when absent or invalid). TanStack Router passes a route { ...rawSearch, ...validated }, so a key that was just dropped let the raw value through to useSearch(). For example, ?kind=bogus reached the page as "bogus".
    • New searchText schema: the router's query-string decoder turns 1234 or true into a number or boolean, and searchText turns them back into the text that was typed.
  • Go link uses the same search handling. ?missing= is parsed with searchText, so an unresolved go/123 is offered for creation instead of being dropped. Its router also uses the plain-text parse/stringify, so written-back values are never JSON-quoted. Only router.tsx and router.test.tsx change.
  • Both clients now use createConsoleQueryClient. Each query keeps its own retry/staleTime options.
  • charts and ci-cache are removed from the console stack allowlist. The check reports both as "on the standard".
  • The Rust servers are untouched.

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=demo data. All 16 before/after screenshot pairs are byte-identical, so nothing visible changed.

Charts at /?fixture=demo&kind=first-party&expand=delivery

View Before (main) After (this PR)
Light, 1280px charts before light charts after light
Dark, 1280px charts before dark charts after dark
Light, 375px phone charts before phone charts after phone
After sidebar click + typing 1234 charts before interaction charts after interaction

CI cache at /?fixture=demo&ns=gradle

View Before (main) After (this PR)
Light, 1280px ci-cache before light ci-cache after light
Dark, 1280px ci-cache before dark ci-cache after dark
Light, 375px phone ci-cache before phone ci-cache after phone
After sidebar click + typing 1234 ci-cache before interaction ci-cache after interaction

URL handling, driven in a real browser (PinchTab): load an invalid value, then click a sidebar item and type 1234 into the filter:

Console Invalid kind/ns shows URL after click + typing (before) URL after click + typing (after)
Charts All (before and after) /?fixture=demo&kind=upstream&q=1234 /?fixture=demo&kind=upstream&q=1234
CI cache Overview (before and after) /?fixture=demo&ns=sccache-pr&q=1234 /?fixture=demo&ns=sccache-pr&q=1234

Verification

  • 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 Rust cargo test/clippy/fmt steps.
  • New client/router.test.tsx 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 the page they describe;
    • an unknown path renders the page;
    • written URLs are plain text.
  • New console-client tests for zodSearch naming every key and for searchText.
  • New Go link router test for /?missing=123. It fails with the old z.string() schema and passes now. Go link router.test.tsx expect( count: 4 → 5.
  • expect( counts:
    • charts model.test.ts 22 → 22, migrated one for one: parseUrlState → validateCatalogSearch, buildSearchSuffix → catalogSearchFor;
    • charts render.test.tsx 28 → 28;
    • ci-cache render.test.tsx 42 → 42 (App now also takes search/onSearchChange);
    • new charts router.test.tsx 14;
    • new ci-cache router.test.tsx 11;
    • console-client client.test.tsx 10 → 16.
  • Conformance allowlists unchanged: charts [] → [], 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. The bun.lock change brings in scout, temporal, homelab and golink extended suites; golink is the one that depends on console-client.
  • bun run e2e:affected:
    • no Playwright project covers charts, ci-cache, console-client or golink. The bun.lock change selects unrelated projects.
    • docs-wiki passes, and media and tasknotes-web chromium pass.
    • tasknotes-web firefox fails locally with launch: Failed to launch the browser process. This is a local browser install problem, unrelated to this change.
  • Not run: deployment and live checks, which come after merge through Delivery.

🤖 Generated with Claude Code

@shepherdjerred

Copy link
Copy Markdown
Owner Author

This change is part of the following stack:

Change managed by git-spice.

@greptile-apps

greptile-apps Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

Automatic reviews are disabled for this repository. Configure in Code Review Settings.

@coderabbitai

coderabbitai Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@shepherdjerred
shepherdjerred marked this pull request as ready for review December 3, 2026 06:48
@shepherdjerred

Copy link
Copy Markdown
Owner Author

@codex review

Automated re-review request for fe9d9b3 from the CI review gate.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 3, 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-12-03T06:55:48.213573Z 97d9d50 Manual request
ℹ️ 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.

shepherdjerred and others added 2 commits December 2, 2026 22:49
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>
@shepherdjerred

Copy link
Copy Markdown
Owner Author

@codex review

Automated re-review request for 97d9d50 from the CI review gate.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: fe9d9b3efe

ℹ️ 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".

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".

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: 97d9d50127

ℹ️ 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".

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".

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.

1 participant