Repository navigation
fix(web): wire API reachability, lenient string search params, sidebar state, chart and cache memoization - #2445
Conversation
…r cookie, boot flags - Reachability: the client's request wrapper now starts the origin's failure run on any transport failure (the 45 s deadline included) and ends it on any response, and the warehouse layer provides ApiReachability from that clock. Nothing provided it before, so a dropped connection inside the 15 s grace window was reported as a WarehouseQueryError instead of WarehouseUnreachableError. - Search params: string params decode through one lenient codec, so a link written by hand with an unquoted number, boolean or null (?userId=12345, ?search=404, ?q=true) opens the page instead of NotFound. String arrays take the same values. It replaces the one-off DigitsParam on the Cloud SQL peek. The search parser keeps a number that does not print back as written (past 2^53, exponent form) as text, so a long numeric id is not rounded. - Sidebar: the sidebar_state cookie written on every toggle is read with the other boot flags, so a collapsed sidebar stays collapsed after a reload. - Flags: the schema carries shell.platform and shell.isSidebarOpen, which a decode of the flags used to strip. - search.ts imports the dashboard variable prefix and the errors hub vocabulary from their owners instead of redeclaring them, and drops comments describing a router this app no longer uses.
…query cache's use-time leak - Charts: bucketBarSeries and seriesDefinitionsOf keep their answer per rows array. Past 12 series the bar chart returned a fresh array on every render, so the spec cache and the encoding cache (both keyed on array identity) missed on every hover tick: all rows were folded again and the whole spec encoded to JSON again. - Maple Local: collecting the query cache now drops the use times of the entries it drops. Relative ranges mint a new key per window, so the use-time map of a tab left open grew without bound and was copied on every lookup. The entries and their use times live in one ref, so they change together.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 1 minute. View limit details
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. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
On the review's one caveat (reachability is keyed on Still to check by hand in a signed-in preview session, as the review lists: a collapsed sidebar staying collapsed after a reload, and |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
# Conflicts: # apps/web/src/route/search.ts
Maple review🟢 Confidence 10/10 · safe to merge. Mechanical, well-tested changes: each new behavior has a test and the cache memoization is a pure function of the rows array. Wires the API reachability clock the HTTP client writes into the warehouse layer, makes string search params accept an unquoted number/boolean/null, reads the sidebar cookie at boot, and memoizes bar-chart rows and cache use times. Safe to merge.
Before merge
|
|
Merged with 1 step from "Before merge" still open. If it is done, tick it on the review comment; if not, now is the time.
|
Stacked on #2444. Part of the audit stack that starts at #2434.
Bugs fixed
WarehouseUnreachableErrorcould never be raised: nothing providedApiReachabilityafter the React app was deleted, and nothing read the reachability clock the HTTP client wrote. The client now marks an origin unreachable on any transport failure and reachable on any response, and the warehouse layer reads that clock./logs?search=404or/replays?userId=12345arrived as a number, a string schema rejected it and the route fell through. String params now accept a number, boolean or null and print it back as text. A number that does not print back as written (20 digits,1e5) stays text, so a long numeric id is not rounded.sidebar_statecookie was written on each toggle and never read. It is read at boot now. Visible change: anyone who last collapsed the sidebar will find it collapsed after this ships.Flagsschema lackedshell.platform, which the flags reader returns. It only worked because fresh flags are not decoded.Efficiency
bucketBarSeriesreturned a fresh array per render, so both spec caches, keyed on array identity, missed. It andseriesDefinitionsOfare now memoized per rows array.Cleanup
route/search.tsredeclared five constants that two other modules already export. It imports them now. 44 comments describing a router this app no longer uses are gone.Verification
apps/web: 29 test files, 237 tests, plus 29 route tests after the last cases were added.packages/viewscharts: 37.apps/local-uidata: 12.packages/web-data: 25. All pass.Flagstest. The route, chart and cache tests were not run against the old code.apps/web,apps/local-uiandpackages/views. Lint and format are clean.Known gaps
?tab=bogusand other strict literal params still land on NotFound. That needs a fallback helper on about 50 fields.1.0no longer decodes, because it does not print back as written.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.