Skip to content

Resolve remaining review defects in alerts, PDF extraction and CI (rebuild of #3641) - #3654

Closed
BigSimmo wants to merge 1 commit into
mainfrom
claude/rebuild-3641-20261018
Closed

BigSimmo wants to merge 1 commit into
mainfrom
claude/rebuild-3641-20261018

Conversation

@BigSimmo

@BigSimmo BigSimmo commented Oct 18, 2026 •

Copy link
Copy Markdown
Owner

Requested by Josh · project thread

Clean rebuild of #3641. This PR carries the identical final code of #3641 at df75f1444, merged with current main, as one commit. #3641 could not pass PR policy: qodo-code-review[bot] commits in its history touch Supabase or clinical paths, and history rewrites are banned. The owner chose a rebuild (thread decision, 18 Oct 2026). The bot's changes are included only as they stood at df75f1444, so review them here. Earlier review discussion stays on #3641. Draft until the owner has reviewed it.

Do not merge as it stands. It still contains 20261018100000_fence_document_queue_rollbacks.sql, which the owner asked to drop at 16:17 AWST, and the training-milestone migration as 20261018062800, a duplicate of the rebuilt #3638's 20261018075500. Merge only one of this PR and the rebuilt #3638. Removing those two migrations needs the owner's explicit yes, because it changes the migration seal file.

Summary

Repair the confirmed merged-PR review defects in durable roster alerts, PDF extraction, queue rollback fencing and catalogue integrity. This consolidated successor includes #3638's fixes. Review this PR and do not merge both independently.

  • Queue offer events atomically with open.post; claim them across instances with expiring tokens, drain device pages and acknowledge/retry each device independently. Recheck current eligibility, preferences, quiet nights and subscription ownership before each send. Preserve staff-release controls. Delivery is at least once: a crash after provider acceptance can duplicate that device's alert.
  • Require visible ruled-cell evidence before assigning PDF edge text to clinical table cells. Preserve ambiguous text with geometry/review warnings, complete safety notes and overflowing instructions. Correct later automated changes that removed these protections.
  • Repair queue-enqueue compilation and mutation-identity typings/fixtures. Regenerate the narrowed CET catalogue and lineage fixture; CET remains unverified and excluded, with all 1,081 logical IDs, content hashes, governance and eligibility values preserved.
  • Append only the three specifically approved migration hashes, preserving all 321 existing entries. Commit the genuine pinned-image drift manifest recovered from hosted generation, preserving its exact 857,796 bytes and emitted SHA-256 3555daf05dc0e71d941634714c31d46ce792ffe19243408e3a7ba5db0238a49d. No expected catalogue fields were hand-edited.
  • Later on Resolve remaining review defects in alerts, PDF extraction and CI #3641: keyless open posts now get a server post key so their offer alert is queued; worker shutdown waits a bounded time for an in-flight offer batch; bulk reindex keeps batch totals on failure and waits out its rate limit; the governance runbook requires retrieval evidence before lifting offline mode.

Issue-by-issue evidence and approval scope: docs/audit/2026-10-18-remaining-review-closeout.md and the original resolution audit. Immutable independent review records cover source corrections, seals, fail-closed recovery and generated-manifest integrity.

Areas touched: Knowledge and records, Personal practice, Source intake and indexing, Clinical reference content, Answer engine, Data platform and access, Delivery and assurance, App experience, Prototypes

RAG impact: behaviour change — live canary pair not run; requires separate explicit owner approval. PDF extraction rejects uncertain clinical cell associations while preserving source text; inherited cited-source recovery and metadata admission fixes remain. No relevance comparator changes.

Verification

  • Independent PDF, alert/concurrency, catalogue, seal and recovered-manifest reviews; actionable findings corrected and rechecked. Requested reviewer routing is not independently verified execution telemetry.
  • Owning worker/PDF/roster/catalogue and architecture contracts: 1,805 passed, one skipped across 131 files. Later concurrent-change corrections passed 35 focused TypeScript tests and 60 PDF tests, plus fresh full lint/typecheck. The recovered manifest then passed 66 drift/freshness/immutability/parity-contract tests in four files. These scopes overlap; no combined total is implied.
  • Local assessment/Teaching browser proof: 23 passed, unchanged 2px assertion, Chromium 151; responsive/installed-layout, reduced motion, enlarged text, forced colours and keyboard checks. Physical Safari/PWA and assistive-technology acceptance remain separate.
  • Native PostgreSQL disposable transaction/grant and actual two-session claim/lease/expiry tests passed. No live SQL or push-provider calls ran.
  • Corrected-mirror final hosted freshness and strict parity passed on an earlier head (run39117853586). This rebuild's CI is the evidence for the current head.

Risk and rollout

  • Risk: clinical-source association, roster privacy/delivery and database concurrency. This PR is not merge-ready: the two migrations above, applicable human/device acceptance, live RAG canaries and accountable classification/sign-off remain open. Merge only after specific production database-change approval in an approved window. Merging applies the migrations to the live clinical database automatically.
  • Rollback: revert application/extractor changes before release; a database rollback requires a separately approved forward migration. Preserve applied history. Unruled edge content can lose structured row assignment while retaining source text/geometry for review.
  • Provider or production effects: GitHub branch/PR publication and configured offline CI only. No merge, auto-merge, live SQL, production deployment, provider push, clinical signature or live RAG evaluation was performed.

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
  • Supabase target remains PsychSift Production (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

Clinical/legal/cultural approval remains with accountable humans under docs/clinical-sign-off-how-to.md.


Generated by Claude Code


Summary by cubic

Clean rebuild of #3641 as one commit on current main, fixing the confirmed review defects in roster offer alerts, PDF edge-text extraction, queue rollback fencing, and catalogue/CI integrity. Not merge-ready: the PR still carries 20261018100000_fence_document_queue_rollbacks.sql and the duplicate training-milestone migration, and only one of this PR and the rebuilt #3638 should merge; merging applies the migrations to the live clinical database automatically.

Roster offer alerts

  • Queues the offer alert atomically with open.post and drains it via expiring leases instead of process-local deduplication.
  • Rechecks eligibility, quiet nights and subscription ownership per device before send; keyless posts get a one-use server post key so their alert still queues.
  • Delivery is at-least-once: a crash after push acceptance can duplicate one device's alert, and shutdown waits a bounded time for an in-flight batch.

PDF, queue, catalogue and CI

  • PDF edge text is assigned to table cells only with visible ruled-cell evidence; ambiguous text keeps geometry/review warnings and complete safety notes.
  • Rollback fencing reads the database-assigned mutation_id and the stored timestamp rather than caller stamps, and the bulk reindex waits out its rate limit.
  • Regenerated CET catalogue preserves all 1,081 IDs, content hashes, governance and eligibility values; CET stays unverified and excluded.
  • Drift-manifest freshness failures now print the generated manifest inline for artifact-free recovery; the committed manifest is the genuine 857,796-byte recovery with its emitted SHA-256, and the migration seal appends only the three owner-approved hashes.

Written for commit 0f539fd. Summary will update on new commits.

View guided diff Turn on auto-fix

Clean rebuild of PR #3641 (head df75f14) as one commit on main 1837b0b, with identical
final code (the tree equals merging main into that head). Rebuilt because
qodo-code-review[bot] commits in #3641's history (955e943, bad9ef2, c02f718, 6ad0176) touch protected
paths and fail the bot-authored-sensitive-commits PR policy, and history
rewrites are banned. Those bot changes appear here only as they stood at
df75f14 and need owner review in this PR.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018UBtJDgQZJ3eBsxLWte9r4
@supabase

supabase Bot commented Oct 18, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project sjrfecxgysukkwxsowpy due to reaching the limit of concurrent preview branches.
Go to Project Integrations Settings ↗︎ if you wish to update this limit.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@coderabbitai

coderabbitai Bot commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@gitar-bot

gitar-bot Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor
Code Review ✅ Approved

🔴 High risk · Adding migrations to the live clinical database for training milestones and roster alerts could corrupt persisted records or send private shift notifications incorrectly.

Rebuilds the reviewed alert, PDF extraction, queue rollback and catalogue fixes from #3641 as one commit on current main. No open findings remain; this is a draft with migrations still to drop before any merge.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Approved

For more verification details, comment gitar display:verbose.

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Important

Your trial ends in 3 days — upgrade now to keep code review, CI analysis, auto-apply, custom automations, and more.

Was this helpful? React with 👍 / 👎 | Gitar

@gitar-bot gitar-bot Bot 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.

Gitar has auto-approved this PR (configure)

BigSimmo pushed a commit that referenced this pull request Oct 18, 2026
Owner asked for every fix from both rebuilt PRs in one PR. Brings across the
durable roster offer device outbox (migration 20261018073435, sealed with the
owner's named approval), PDF edge-text ruled-cell evidence, the exact
100,000-row metadata paging fix, the bulk reindex Retry-After wait and the
CI drift-manifest recovery output.

Left out on purpose: the duplicate milestone migration 20261018062800 (this
PR already carries it as 20261018075500), the queue-rollback mutation_id
migration the owner dropped, and the narrowed CET attribution the owner
reverted. Drift manifest is this PR's generated manifest plus the roster
entries from #3654's generated manifest; schema_sha256 matches schema.sql.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018UBtJDgQZJ3eBsxLWte9r4

Copy link
Copy Markdown
Owner Author

Closing as superseded at the owner's request. All of this PR's work is now in #3652 (commit 5e9c34d). Only these were left out deliberately: the duplicate milestone migration 20261018062800 (#3652 carries the same SQL as 20261018075500), the queue-rollback mutation_id migration the owner dropped, and the CET attribution change the owner reverted.


Generated by Claude Code

@BigSimmo BigSimmo closed this Oct 18, 2026
@BigSimmo
BigSimmo deleted the claude/rebuild-3641-20261018 branch October 30, 2026 10:43
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