Skip to content

feat: setup openai plugin and fix E2E tests - #172

Merged
BigSimmo merged 22 commits into
mainfrom
codex/openai-plugin-setup
Jul 2, 2026
Merged

feat: setup openai plugin and fix E2E tests#172
BigSimmo merged 22 commits into
mainfrom
codex/openai-plugin-setup

Conversation

@BigSimmo

@BigSimmo BigSimmo commented Jul 2, 2026

Copy link
Copy Markdown
Owner

Summary

This PR sets up the OpenAI plugin, introduces document search mockups, and resolves two critical end-to-end (E2E) test issues in tests/ui-smoke.spec.ts (strict-mode locator violation and tab-transition flakiness).

Verification

  • npm run verify:cheap
  • npm run verify:ui when UI, routing, styling, browser behavior, reduced-motion, or forced-colors behavior changed
  • npm run verify:release before release or handoff confidence claims
  • npm run format:check
  • npm run check:production-readiness when clinical workflow, privacy, environment, Supabase, source governance, or deployment behavior changed
  • npm run check:deployment-readiness when deployment startup, hosting, or rollout behavior changed

Clinical Governance Preflight

Complete this section when the change touches ingestion, answer generation, search/ranking, source rendering, document access, privacy, production env, or clinical output.

  • Source-backed claims still require linked source verification before clinical use
  • No patient-identifiable document workflow was introduced or expanded without explicit governance approval
  • 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
  • Source metadata, review status, and outdated/unknown-source behavior remain conservative
  • Deployment classification/TGA SaMD impact was checked when clinical decision-support behavior changed

Notes

All unit and E2E Chromium tests are now fully green and passing.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@BigSimmo

BigSimmo commented Jul 2, 2026

Copy link
Copy Markdown
Owner Author

@copilot resolve the merge conflicts in this pull request

…etup

# Conflicts:
#	src/app/documents/[id]/page.tsx
#	src/app/page.tsx
#	src/lib/document-naming.ts
#	src/lib/rag.ts
#	src/lib/supabase/admin.ts

Copilot AI commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

@copilot resolve the merge conflicts in this pull request

Resolved. The five conflicting files were merged in commit b3dddcd:

  • src/app/documents/[id]/page.tsx — accepted main's DocumentViewerLazy import
  • src/app/page.tsx — accepted main's ClinicalDashboardLazy import
  • src/lib/supabase/admin.ts — accepted main's singleton + Database-typed client
  • src/lib/document-naming.ts — accepted main's export type DocumentNameSupabase with non-optional message and typed supabase parameter
  • src/lib/rag.ts — accepted main's Database/Json import and typed rag_queries insert

@BigSimmo
BigSimmo enabled auto-merge (squash) July 2, 2026 11:32

@chatgpt-codex-connector chatgpt-codex-connector Bot 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: e5ad93f81c

ℹ️ 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 src/components/ClinicalDashboard.tsx
Comment thread src/components/ClinicalDashboard.tsx
Comment thread src/components/ClinicalDashboard.tsx Outdated
Comment thread src/components/ClinicalDashboard.tsx
Comment thread src/components/ClinicalDashboard.tsx Outdated
@BigSimmo
BigSimmo disabled auto-merge July 2, 2026 11:57
@BigSimmo
BigSimmo enabled auto-merge (squash) July 2, 2026 11:57
BigSimmo and others added 4 commits July 2, 2026 19:57
Adds /mockups/document-search as a review board for the three concepts and
/mockups/document-search/source, which resolves a mock result into the real
document viewer at /documents/{id}?page=...&chunk=... via the documents API.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…sed tesseract.js

- Dynamically import DifferentialsHome, FavouritesHub,
  MedicationPrescribingWorkspace, and ApplicationsLauncherWorkspace with
  ssr disabled in ClinicalDashboard.
- Simplify openClinicalNotes/openEvidence to plain functions and let the
  clinical-notes/evidence sheets open on their own state.
- Memoize markdown table parsing in AccessibleTable.
- Remove tesseract.js (OCR runs via the Python worker and native binary).
- Add a near-sheet-breakpoint (1018px) viewport case to ui-smoke.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…etup

# Conflicts:
#	src/components/clinical-dashboard/master-search-header.tsx

@chatgpt-codex-connector chatgpt-codex-connector Bot 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: d8e2e54251

ℹ️ 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 scripts/audit-source-governance.ts Outdated
Comment thread src/lib/document-label-governance.ts Outdated
Comment thread scripts/backfill-gold-document-labels.ts Outdated
Comment thread src/components/ClinicalDashboard.tsx Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot 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

.upsert(labels, { onConflict: "document_id,label_type,label,source" })

P2 Badge Preserve label review metadata during reclassification

When classify:documents or backfill:smart-v2-labels runs after a reviewer has hidden or approved a generated label, this upsert conflicts on the same (document_id,label_type,label,source) row and writes the freshly generated metadata (review_status: "new" with no hidden flag). That silently turns reviewed/hidden labels back into unreviewed visible labels, undoing curation; preserve existing review_status/hidden metadata on conflict or skip already reviewed rows.

ℹ️ 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 src/components/document-search-live-opener.tsx
Comment thread scripts/backfill-gold-document-labels.ts
@BigSimmo

BigSimmo commented Jul 2, 2026

Copy link
Copy Markdown
Owner Author

@copilot resolve the merge conflicts in this pull request

auto-merge was automatically disabled July 2, 2026 13:15

Head branch was pushed to by a user without write access

Copilot AI commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

@copilot resolve the merge conflicts in this pull request

Resolved in commit 541d8cf. The only conflict was in src/lib/rag.ts — accepted main's RagQueryInsert type (typed Omit<Database[...]["rag_queries"]["Insert"], "metadata">) and updated the insertRagQuery function signature accordingly.

BigSimmo and others added 2 commits July 2, 2026 22:45
…yInsert

- Run prettier --write to clear the format:check gate (20 files: mockup
  components, governance scripts, rag.ts, ui-smoke.spec.ts, etc.). No trap
  files touched (worker/main.ts and database.types.ts stay .prettierignore'd).
- Fix a latent typecheck error the format gate was masking: the main-merge
  kept logRagQuery(row: Record<string, unknown>) while #174 tightened
  insertRagQuery to require RagQueryInsert (mandatory query). Align the
  signature to main's logRagQuery(row: RagQueryInsert).

Local: format:check, typecheck, lint (0 errors), and unit tests (863) all green.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@BigSimmo
BigSimmo enabled auto-merge (squash) July 2, 2026 15:17

@chatgpt-codex-connector chatgpt-codex-connector Bot 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: 1e4e81deb6

ℹ️ 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 src/components/ClinicalDashboard.tsx
Comment thread scripts/audit-source-governance.ts
ESLint flagged a synchronous setState inside a useEffect in
FormsSearchResultsPage (react cascading-render rule), which was blocking
the verify check on PR #172. Replace the query->draft sync effect with the
render-time previous-value adjustment pattern and drop the now-unused
useEffect import. Behaviour is unchanged.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@BigSimmo
BigSimmo disabled auto-merge July 2, 2026 16:05
@BigSimmo
BigSimmo enabled auto-merge (squash) July 2, 2026 16:05
@BigSimmo

BigSimmo commented Jul 2, 2026

Copy link
Copy Markdown
Owner Author

@copilot resolve the merge conflicts in this pull request

auto-merge was automatically disabled July 2, 2026 16:35

Head branch was pushed to by a user without write access

Copilot AI commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

@copilot resolve the merge conflicts in this pull request

Resolved in commit c50c79c by merging origin/main and clearing the current conflicts. I also pushed follow-up fix 19acb38 to correct source-metadata debt acceptance status with test coverage.

@BigSimmo

BigSimmo commented Jul 2, 2026

Copy link
Copy Markdown
Owner Author

Carved the plugin-scaffolding slice out of this PR into #199 (isolated, no app-code coupling, prettier-clean, no package.json/build impact) so it can be reviewed and land independently. Suggested next slices for the remaining pieces here: (1) document-search mockups (src/app/mockups/document-search*, public/mockups/*, document-search-mockups.tsx), (2) source-governance label tooling (scripts/*governance*, document-label-governance.ts), and (3) the ClinicalDashboard changes — which still carry the unresolved P2 threads (dropped answer feedback / governance warnings, hard-coded dose labels) and should be reviewed on their own. This PR is currently CONFLICTING against main.

@BigSimmo
BigSimmo enabled auto-merge July 2, 2026 16:43
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@BigSimmo
BigSimmo merged commit 6f4412d into main Jul 2, 2026
4 checks passed
BigSimmo added a commit that referenced this pull request Jul 2, 2026
feat: add Clinical KB Codex/OpenAI plugin scaffolding (carved from #172)
BigSimmo added a commit that referenced this pull request Jul 2, 2026
feat: add document-search UI mockups (carved from #172)
@BigSimmo
BigSimmo deleted the codex/openai-plugin-setup branch July 5, 2026 11:44
BigSimmo pushed a commit that referenced this pull request Jul 31, 2026
Facet counts were built once against the whole match set and never revised.
Selections AND together, so the moment one was applied every other facet was
still reporting a number for a set the reader was no longer looking at — and
some of those numbers pointed at combinations that return nothing, which reads
as a live option and behaves as a dead end.

`projectSmartTagFacetGroups` re-counts an already-built index against the live
selection. Each count now answers the question the row actually poses: how many
documents you would have if you ticked this as well. A facet that is already
selected reports the current result count, because that is what it is giving
you.

Membership and order are deliberately preserved rather than re-sorted by the
new counts: re-sorting would make rows jump under the pointer while selecting,
and re-slicing to the top N could drop a facet already ticked. A facet whose
count falls to zero stays in place at zero so the caller can disable it —
removing it makes the list jump and hides the reason it went away.

The projection is a no-op returning the same array identity when nothing is
selected, so the unfiltered path is unchanged.

Tests: six cases covering the stale count, the selected-facet count, the
dead-end combination driven to zero, agreement between each count and the
filter it describes, and stability of membership and order. Verified by
mutation — neutering the projection fails three of them.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Akwz3Sdms8uJ5AkDt3CduY
Copilot AI added a commit that referenced this pull request Aug 12, 2026
fix #186 archive

- Restore #156 (read-modify-write race + Update-branch corruption) from
  archive back to the open issues section with its original full text; the
  underlying allocation race is not resolved by the conservative architecture
  decision described in the previous commit.
- Re-add #156 to the recommendations priority table as row 51 (between #101
  and #172, consistent with its original ordering).
- Correct #101 to credit only metadata and memory parallelisation
  (hydrateCandidatesWithMetadataAndMemory) from PR #1474; visual hydration
  (attachPageVisualEvidence) is still called serially after hydration on all
  six call sites and is explicitly listed as a remaining candidate.
- Update #186 archive text to reflect that only metadata+memory were updated
  in #101, not visual hydration.

Co-authored-by: BigSimmo <87357024+BigSimmo@users.noreply.github.com>
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.

2 participants