Skip to content

Merge codex/RAG_FIX modes (Differentials/Services/Forms/Favourites) restyled to Clinical White theme - #120

Merged
BigSimmo merged 16 commits into
mainfrom
claude/bold-pare-3e568c
Jul 2, 2026
Merged

Merge codex/RAG_FIX modes (Differentials/Services/Forms/Favourites) restyled to Clinical White theme#120
BigSimmo merged 16 commits into
mainfrom
claude/bold-pare-3e568c

Conversation

@BigSimmo

Copy link
Copy Markdown
Owner

Summary

  • Merges the full codex/RAG_FIX content set into main's line: four new app modes (Differentials, Services, Forms, Favourites) with routes, components, mock-data lib modules, 10+ new document filter categories, tests, build scripts, and Supabase governance migration files. Supersedes Refactor clinical KB search and UI flows #111 (recommend closing it once this merges).
  • Resolves the 3 merge conflicts (globals.css, ClinicalSidebar.tsx, master-search-header.tsx) in favour of the current Clinical White / Aegean Graphite theme + de-halo polish; none of the codex branch's stale palette survives.
  • Restyles all incoming UI to the current theme: --command graphite for primary CTAs, --clinical-accent role family for selection/accent/focus, flat surfaces + hairline borders instead of glass/gradients, neutral shadows instead of colored halos, codeText (Geist Mono) for MHA form codes. The 865-line forms search page's hardcoded hex palette was fully tokenized (navy rail → --app-shell, teals → accent family, semantic reds/blues → danger/info tokens) so it now theme-switches correctly.
  • Removes ~240 agent/QA artifact files (.codex-screenshots/, .qa-smoke/, tmp files) and gitignores them.
  • Rides along from the codex branch: webpack production build via guard-next-build.mjs, wrapped test runners, next.config turbopack root.

Verification

  • npm run verify:cheap — lint, typecheck, 726 unit tests pass
  • npm run verify:ui — 54/54 Chromium tests pass (includes new differentials/services/forms suites)
  • npm run verify:release — not run (not a release handoff)
  • npm run format:check
  • npm run check:production-readiness — env-key FAILs are pre-existing worktree conditions (no .env.local in the worktree); identical on main
  • npm run check:deployment-readiness — deployment behavior unchanged beyond the webpack build switch, which npm run build verified locally
  • Browser QA: all four new modes captured at desktop+mobile, light+dark (28 screenshots, zero console errors); mode dropdown lists all 8 modes

Clinical Governance Preflight

  • Source-backed claims still require linked source verification before clinical use
  • No patient-identifiable document workflow was introduced or expanded without explicit governance approval (new modes use static mock/demo data)
  • Supabase target remains Clinical KB Database (sjrfecxgysukkwxsowpy)
  • Service-role keys and private document access remain server-only
  • Demo/synthetic content remains clearly separated from real clinical sources (new mode records are static demo datasets in src/lib/{differentials,services,forms}.ts)
  • Source metadata, review status, and outdated/unknown-source behavior remain conservative
  • Deployment classification/TGA SaMD impact was checked: differentials mode adds structured comparison UI over demo data with "Clinical decision support only. Review before use." notice; no new automated clinical output

Notes

  • The 6 Supabase migration files (audit logs, RAG query retention, label taxonomy v2) are merged as files only — NOT applied to the live project. Applying them is a separate, explicitly-confirmed step.
  • Production build now uses webpack (--webpack + guard script) per the codex branch's deliberate change; builds are slower but verified working.

🤖 Generated with Claude Code

BigSimmoand others added 14 commits July 1, 2026 20:33
…estyled to Clinical White theme
Brings in the full codex/RAG_FIX content set (4 new app modes, document
filter categories, tests, build scripts, Supabase governance migrations)
while keeping the current Clinical White / Aegean Graphite theme as the
styling authority:
- globals.css: kept current token system, glow/de-halo shadows, and flat
header/composer styling; carried over branch-only structural selectors
(desktop-home/document-mobile search pills, forms hero edge) restyled
to the flat recipe; dropped the branch's stale html:not(.dark) glass
override layer and glassy .dark composer overrides
- ClinicalSidebar: kept command/accent styling + theme toggle, added
Services/Forms/Favourites nav items, upgraded collapsed-rail styles to
command/accent role tokens
- master-search-header: took branch structure (mode icons, headerVariant,
utility menu), migrated all clinical-chat-teal refs to command/accent
role tokens (also fixes undefined --clinical-chat-teal-strong)
- removed .codex-screenshots/.qa-smoke/tmp artifacts and gitignored them
Supabase migrations are merged as files only and have NOT been applied
to the live project.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ode UI
- migrate all clinical-chat-teal refs in differentials/services/forms/
favourites components and routes to clinical-accent role tokens
- tokenize forms-search-results-page's hardcoded hex palette (navy rail
-> app-shell, teals -> clinical-accent family, grays -> border/text
tokens, semantic reds/blues -> danger/info tokens)
- flatten glass patterns: gradients -> flat surfaces, colored halo
shadows -> neutral shadow tokens, remove backdrop-blur from sticky
headers and mobile bars
- map off-token Tailwind palette colors (rose/blue/teal/orange/slate)
to danger/info/accent/warning/border tokens with dark-mode variants
removed (tokens flip automatically)
- low-opacity accent borders -> clinical-accent-border; accent-filled
surfaces use clinical-accent-contrast for text (dark-mode correct)
- apply codeText (Geist Mono) to MHA form code badges
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@BigSimmo
BigSimmo enabled auto-merge (squash) July 2, 2026 03:02
Resolves the retrieval-domain conflicts in favour of main's measured
golden-eval work:
- retrieval-selection.ts: taken from main verbatim — drops the codex
flowchart-action boost block and its metadata-conditional weighting,
which violates main's "governance must not reorder selection"
contract (golden doc-recall@5 1.0 -> 0.76 when metadata weights
selection) and was tuned against pre-optimization scoring
- search/route.ts: keeps codex's isSourceLibrarySearchMode() so the new
modes share the document-search result limits, combined with main's
RC7 per-document diversity cap (3)
- retrieval-selection.test.ts: keeps main's relevance-ordering contract
test; removes the two codex-only tests asserting the superseded
metadata-weighted ordering
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@chatgpt-codex-connectorchatgpt-codex-connectorBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit:80df1dcecd

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

Comment thread.github/workflows/ci.yml Outdated
Comment threadsrc/components/forms/forms-search-results-page.tsx
Comment threadsrc/components/clinical-dashboard/differentials-home.tsx Outdated
@BigSimmo
BigSimmo requested a review from CopilotJuly 2, 2026 03:16
@BigSimmo
BigSimmo disabled auto-merge July 2, 2026 03:17
@BigSimmo
BigSimmo enabled auto-merge (squash) July 2, 2026 03:17
@BigSimmo
BigSimmo disabled auto-merge July 2, 2026 03:17
…query, unmask CI smoke secrets
Addresses Codex review on PR #120:
- differentials-home: only render ranked differential results after a
source-backed search returns document matches; show a no-evidence
notice otherwise, and drop the fabricated 2065 reviewed-source
fallback count (P1)
- forms-search-results-page: reset the desktop draft query when the
route query changes so refinements start from the term the results
reflect (P2)
- ci.yml: remove placeholder fallbacks for deployment smoke secrets so
a missing secret fails with the explicit missing-env error instead of
passing against a server without real production env (P2)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
CopilotAI reviewed Jul 2, 2026

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review this pull request because it exceeds the maximum number of lines (20,000). Try reducing the number of changed lines and requesting a review from Copilot again.

@BigSimmo
BigSimmo merged commit 3d089d1 into mainJul 2, 2026
3 checks passed

@chatgpt-codex-connectorchatgpt-codex-connectorBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit:f1f25d7149

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

Comment on lines +6665 to +6669
if (!autoRunSearch || !trimmedQuery || !canRunSearch || loading) return;
const signature = `${searchMode}:${trimmedQuery}`;
if (autoRunSearchSignatureRef.current === signature) return;
autoRunSearchSignatureRef.current = signature;
void ask();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Do not auto-run URL searches twice

When landing on /?mode=answer&q=...&run=1, Home now passes autoRunSearch, but the existing URL-bootstrap effect in this component also calls executeSearch for the same run=1 URL. Both effects run from the initial render where loading is still false, so this path opens two /api/answer/stream requests for the same prompt (document searches are coalesced, answer streams are not), doubling model work and racing the displayed answer; gate this effect when the URL bootstrap handles the run or make only one path responsible.

Useful? React with 👍 / 👎.

Comment on lines +6828 to +6829
const targetMode = appModeCanUseSourceLibraryShortcut(searchMode) ? searchMode : "documents";
void runDocumentSearchShortcut(searchText, nextFilters, true, targetMode);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve runnable URLs for services/forms tag searches

When a tag/facet search is launched while searchMode is services or forms, this now passes that namespace mode into runDocumentSearchShortcut, but the URL writer still calls appModeHomeHref(mode, { query }) without run: true. That leaves /services?q=... or /forms?q=... in the address bar after results are displayed; reloading or sharing that URL does not render the results because the namespace shell only switches to ClinicalDashboard when run=1. Include run: true for these namespaced result URLs so the visible results are reproducible.

Useful? React with 👍 / 👎.

Comment on lines +24 to +26
alter table if exists public.ingestion_job_stages
add constraint ingestion_job_stages_job_id_fkey
foreign key (job_id) references public.ingestion_jobs(id) on delete cascade;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Put the stage FK repair in a forward migration

This adds the ingestion_job_stages.job_id cleanup/FK repair inside 20260625000000_indexing_v3_agent_worker_hardening.sql, which already exists in the base branch. Supabase records applied migration timestamps and subsequent db push skips versions already in schema_migrations (CLI docs), so any live/staging DB that has applied this migration will never run these new lines; the database will still lack the restored cascade FK and orphan cleanup. Move this SQL into a new timestamped migration so existing deployments receive it.

Useful? React with 👍 / 👎.

BigSimmo added a commit that referenced this pull request Jul 2, 2026
docs(rag): track differentials flowchart-action boost deferred from PR #120
BigSimmo pushed a commit that referenced this pull request Jul 30, 2026
Codex review was right: #121 ("Container Playwright browser build lags the
pinned client") already tracks this exact condition — client 1234 versus
container 1194, every browser test failing at launch — so #145 created a second
canonical action for one problem. The row was allocated without first searching
the open table, which is the dedupe step the issues skill requires.
#145 is removed and its distinct content folded into #121: the reproduction on
main at c5c1a86, the fact that the condition has now been misread twice (the
handoff's 13 launch failures, and #120 filed as a gate defect under it), the
detection command to run before trusting a browser gate, and the stop rule
against filing a gate defect from a run whose tests never launched. #121's own
workaround, PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD note and open Next decision are
unchanged.
The id marker rolls back 146 -> 145 because #145 was never used by a live row.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018K7sEKH35KZkWxvCnQcNN2
BigSimmo added a commit that referenced this pull request Jul 30, 2026
…gn (#1455)
* issues: close#122, capture the container Playwright pin mismatch
Three related ledger items, each independently revertible.
Close#122 (`ci/circleci: verify` fails on every branch). Its outcome allowed
either "trustworthy signal again, or it stops reporting"; the second happened.
`.circleci/config.yml` was deleted by 9779828 (PR #1412), and PR #1452's head
reported 21 check runs with none named `ci/circleci: verify`, so the status no
longer reports on new PRs. No operator log read is needed and the quota
hypothesis is retired unproven.
Capture #145: the remote container ships Chromium 1194 while the repo's
Playwright pin wants 1234, so every browser test dies at launch and zero
assertions run while the output reads like product breakage. This has cost time
twice — the 2026-07-30 handoff records 13 launch failures read as a code defect,
and #120 was filed on a gate reading taken under the same condition. The row
gives the start-of-session check and keeps the existing "never run
npx playwright install" stop rule.
Fix a stale rule found while verifying #122: AGENTS.md cited
`ci/circleci: verify` as a check that fails on unformatted files. It cannot
report again, so the rule now names `Static PR checks` and records the CircleCI
failures as history.
The outstanding-issues diff is 4 insertions / 3 deletions ignoring whitespace;
the rest is Prettier re-padding the archive table, because #122's original
summary is wider than that column and was kept verbatim.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018K7sEKH35KZkWxvCnQcNN2
* issues: fold the Playwright pin evidence into #121, drop duplicate #145
Codex review was right: #121 ("Container Playwright browser build lags the
pinned client") already tracks this exact condition — client 1234 versus
container 1194, every browser test failing at launch — so #145 created a second
canonical action for one problem. The row was allocated without first searching
the open table, which is the dedupe step the issues skill requires.
#145 is removed and its distinct content folded into #121: the reproduction on
main at c5c1a86, the fact that the condition has now been misread twice (the
handoff's 13 launch failures, and #120 filed as a gate defect under it), the
detection command to run before trusting a browser gate, and the stop rule
against filing a gate defect from a run whose tests never launched. #121's own
workaround, PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD note and open Next decision are
unchanged.
The id marker rolls back 146 -> 145 because #145 was never used by a live row.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018K7sEKH35KZkWxvCnQcNN2
* issues: record #98 delivery and #130 pre-paint guard design
Sync main, then update two rows against evidence rather than adding new ones.
#98: PR #1450 landed the counting proxy and answer-path budgets while this
branch was open. Verified rather than assumed — the helper counts on execution
not construction, tests/rag-round-trip-budget.test.ts pins two answer-path
scenarios plus three counter self-tests, and it is registered in the offline
contract fixture so it runs there. Ran it: Test Files 1 passed (1), Tests 5
passed (5). The row stays open with its Next narrowed to the two real gaps:
/api/search has no budget, and eval-rag-offline/test-rag-offline were not wired.
Also records the helper's own blind spot — it sees only traffic through the
wrapped client.
#130: already owns the unfiled pre-paint/cold-load guard, so its design goes
there instead of a new row. Records what the guard must test (the pre-paint
reserve seed, sampled before and after hydration rather than once after), why a
zero-inset profile is required for it to be able to fail at all, and that it
must be proven against the broken shape first. Also records the environment
blocker: browser gates cannot launch here per #121, and the symlink bridge
writes under /opt, which the sandbox refuses.
No new ids allocated; both are updates to rows that already own the work.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018K7sEKH35KZkWxvCnQcNN2
---------
Co-authored-by: Claude <noreply@anthropic.com>
BigSimmo added a commit that referenced this pull request Jul 30, 2026
* fix: fail Playwright gates before missing-browser false greens
Root-cause #120: exit-0 with "N failed" came from shell pipelines without
pipefail; Node runners already propagated Playwright status. Add a Chromium
headless-shell preflight before the heavy lock/build, announce phone-chrome
stage failures on stderr, and document the measurement trap.
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
* fix: cover every Playwright browser preflight
* docs: record PR 1432 review
* fix: match Playwright shell layouts
* test: type Playwright preflight fixtures
* docs: update PR 1432 verification
* test: preserve literal Playwright project contracts
* docs: record final Playwright preflight review
* test: settle sheet focus before phone scroll
* docs: record final Playwright preflight review
* fix: honor Playwright config project matrix
* docs: record visual preflight follow-up
* docs: record Playwright preflight review
---------
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 Jul 31, 2026
… rows
CodeRabbit found row #165 claiming its follow-ups "were renumbered again to
#156/#157/#158" — ids that now belong to unrelated rows on main. A reference
that resolves to the wrong row is worse than none in a ledger whose whole
job is to be followable later.
Two fixes:
- Dropped the renumbering trail entirely rather than updating it. It listed
superseded ids that main has since reissued, and it went stale again on
the very next sync; the row now states that renumbering happened and why,
without naming numbers that no longer mean anything.
- Corrected a second stale reference the earlier renumber missed: row #165
pointed at #157 for the privacy sign-off that variant F would need. That
is the answer-mode caveat row, now #166. The earlier pass only rewrote
three known cross-reference phrasings and did not catch this one.
Verified by extracting every backtick id reference from the three rows: #165
and #166 now point at each other and #167 at #120, all live.
check:outstanding-issues: 165 rows (50 open, 115 archived), unique ids,
next-id=168 above the highest, no ids deleted from base 3b4872f.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NPyFcMfn1jMmphr6AqiWBg
Sign up for freeto 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.

3 participants

@BigSimmo