fix: audit P0 RAG cache, synopsis parity, and safety hardening - #278
Closed
BigSimmo wants to merge 7 commits into
Closed
fix: audit P0 RAG cache, synopsis parity, and safety hardening#278BigSimmo wants to merge 7 commits into
BigSimmo wants to merge 7 commits into
Conversation
- Hide footer Evidence/Sources chips on phone hero composers; scope stays in + menu - Suppress bottom-dock composer flash until hero portal slot is ready - Increase composer action/send touch targets to 44px on phones - Update Playwright tests for scope menu, Answer home geometry, and stress fallback
This pull request has been ignored for the connected project Preview Branches by Supabase. |
BigSimmo
marked this pull request as ready for review
July 5, 2026 17:40
Contributor
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
BigSimmo
commented
Jul 5, 2026
OwnerAuthor
Closing as superseded by merged work on \main:
Production is live with these fixes. Any remaining unique commits should be cherry-picked onto a fresh branch from current \main. |
15 tasks
9 tasks
cursorBot
pushed a commit
that referenced
this pull request
Aug 8, 2026
…seline, and add a baseline adopt helper (#1743) * feat(design-system): mask the pinned chrome in the document-viewer baseline, and add a baseline adopt helper Two changes that make refreshing a golden after a deliberate design change cheap and readable, which is what the pixel gate needs in order to be read at all. Mask the viewport-pinned chrome (#278). The document-viewer target clips a ~2900px region against a 900px viewport, and it contains a `sm:sticky sm:top-0` header and a `sm:fixed` composer. Playwright stitches an oversized element capture, so both land partway DOWN the image, overlap whatever content sits behind them at that offset, and move whenever content above them changes height -- so an unrelated edit anywhere on the page redrew two bands of the golden and inflated every diff. Masked rather than clipped away, because both are real chrome that belongs in the frame and narrowing the selector would drop the rail panels this target exists to watch. Their own geometry is covered by the phone-chrome contracts in docs/search-chrome-behaviour.md, not by this pixel gate. Fail loudly when a mask matches nothing. A mask selector that matches no element masks nothing, silently -- the golden keeps comparing the region the mask was meant to exclude while the declaration reads as protection that is not there. Renaming a class is enough to cause it. Every declared mask must now resolve to at least one element before the comparison is trusted. That guard is what makes the mask above safe to rely on rather than merely present. Add scripts/adopt-visual-baselines.mjs (npm run design-system:baselines:adopt). Adopting previously meant hand-copying six PNGs and hand-assembling provenance.json with a SHA-256 and pixel dimensions per candidate, the capture commit, the run id and the reviewer attestation. Doing that by hand on every design change is the friction that makes people skip the refresh and leave a red advisory standing. It resolves candidates from both shapes the artifact can take -- visual-candidates/ when a target was awaiting a baseline, and <id>-actual.png when it compared and differed. It refuses a missing or non-numeric run id, a short or unknown capture commit, and a missing --reviewed-by, because that field records a HUMAN review of the images. It never captures screenshots: baselines are platform-scoped and a developer-machine shot lands where ubuntu CI never reads it. Dry run by default. The document-viewer golden is NOT refreshed here -- masking changes its pixels, so it must be re-shot from a CI run that already contains this mask. That is the refresh loop the helper exists for, and it needs this to land first. Verified: tsc 0 errors; lint exit 0; check:design-system-adoption exit 0; docs:check-inventory current at 232 npm scripts; docs:check-links exit 0; format:check clean. Helper exercised against two real artifacts -- it resolves all six candidates from run 31251091603 and correctly refuses run 31254917796, which was all-green and so contains no candidate images -- and all three input guards were confirmed to reject. Dry run wrote nothing. Refs #278, #118 * fix(design-system): support partial visual baseline refresh adoption When CI changes only some surfaces, passing targets emit no *-actual.png and unchanged images live under tests/__screenshots__/ in the artifact. The adopt helper now resolves candidates from diff output, artifact baselines, or committed goldens, records refresh provenance (including replacedCandidateIds), and validates capture-head AWAITING_BASELINE binding before writing. Also fix git cat-file reachability checks and run mask-selector validation before candidate capture. * chore(design-system): refresh document-viewer baseline after chrome masks Adopt the masked document-viewer capture from visual-baseline-31267928439 (tip ac1d0dd) via the partial-refresh helper. Clears the expected advisory diff introduced when the sticky header and fixed composer were masked. Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com> * fix(design-system): gate retained baselines on junit and uniquify the mask Copilot: retaining screenshots from the artifact without visual-junit proof could bless a stale golden for a target that failed before emitting an actual. Require a passing junit case for every retained id, refuse all-green refreshes, and only treat *-actual.png as a fresh diff. Also mask [data-document-sticky-header] instead of .edge-glass-header so the fail-loud guard cannot pass against the universal search header after a DocumentViewer rename. Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com> * chore(design-system): refresh masked document-viewer baseline after main sync Re-adopt from visual-baseline-31268982766 on the post-#1741 merge tip so the golden includes the unique data-document-sticky-header mask and the viewer rework from main. Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
BigSimmo pushed a commit
that referenced
this pull request
Aug 20, 2026
…emand The document-viewer baseline target masked `.document-viewer-composer` because the composer was always rendered and, being viewport-pinned inside a ~2900px stitched capture, redrew a band of the golden on any unrelated edit (#278). With search now closed by default the composer is not in the DOM at all in the state this target captures, and `assertMaskSelectors` fails a mask that matches nothing — deliberately, so a rename cannot silently stop masking. `classify-visual-baseline-outcome.mjs` scores that as a non-drift failure, so the advisory Visual baselines job would have gone hard red on every main push for a reason unrelated to pixels. The mask is now the sticky header alone; nothing is lost, since a masked region was never compared, and the closed composer's resting layout is now inside the golden. The committed Linux golden drifts with this change (the overview action is "Search document" and the desktop composer clearance is released while closed). That is ordinary pixel drift: advisory, and adopted post-land from the job artifact with `npm run design-system:baselines:adopt`. Also lands the PR #2199 review-ledger record. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HoyoNN7nCUVDLaE84k6e6c
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 freeto 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
Addresses the highest-priority audit findings without changing eval-validated retrieval boost compounding.
RAG cache (P0)
rag-cache-v12|ownerId|...) viaragCacheKeyMatchesOwnerindexingVersionon in-memory search/answer cache entries (parity with sharedrag_response_cache)scoreValue(result)(hybrid-aware) inderiveConfidenceinstead of raw similarityClinical evidence parity (P0)
clinical-evidence-haystack.ts(synopsis, accessible table markdown, table facts, memory cards)Safety hardening (P0/P1)
document_index_unitsdelete fails (no silent swallow)runDocumentSearchShortcut: stale-response guard usingsearchRequestSeqRef(M10 parity)document_uploadrate-limit bucket (12/min)RAG_QUERY_HASH_SECRETin production-like envsVerification follow-up (this commit)
Verification
npm run verify:cheap— lint + typecheck pass; 1069/1072 tests pass full suite (3 time out under parallel load, pass in isolation)npm run eval:retrieval:quality— blocked in this environment (missingNEXT_PUBLIC_SUPABASE_URL/SUPABASE_SERVICE_ROLE_KEY); run locally before mergeClinical Governance Preflight
sjrfecxgysukkwxsowpy)Follow-up (not in this PR)
P2–P3 audit items: CI eval gates, RLS integration tests, monolith splits, lint/format debt, docs cleanup — tracked separately from the July 2026 audit backlog.