Skip to content

docs: reconcile memory ledgers after task review + fix .env.example weak-OR footgun#720

Merged
BigSimmo merged 2 commits into
mainfrom
claude/memory-tasks-review-glmntq
Jul 17, 2026
Merged

docs: reconcile memory ledgers after task review + fix .env.example weak-OR footgun#720
BigSimmo merged 2 commits into
mainfrom
claude/memory-tasks-review-glmntq

Conversation

@BigSimmo

@BigSimmo BigSimmo commented Jul 17, 2026

Copy link
Copy Markdown
Owner

Summary

Follow-through on a review of every ongoing/recommended task tracked in the repo's docs/ ledgers, cross-checked against the current tree. The code side has largely caught up since these ledgers were written, so this updates them to match reality and fixes one config footgun the review surfaced.

  • docs/ingestion-concurrency-fix-workorder.md — mark the last open repo item (deep-memory delete-scoping) RESOLVED. It shipped as the producer-scoped replacement model: migration 20260713030000_producer_scoped_deep_memory.sql (disjoint artifact_generation_id-null vs producer-generation unique indexes on section_index), a service-role commit RPC that removes only same-producer artifacts, and src/lib/deep-memory.ts staging/deleting strictly scoped by producer + artifact_generation_id (cleanupStagedArtifacts), reconciled in fix: reconcile live deep-memory commit function #569. This doc now has no open repository items.
  • docs/operator-backlog.md — close the drift-codify forward-migration (step 1h) row; the forward-codify work-order is complete (applied 2026-07-13). Add a new 🔎 verify row for three committed-but-unapplied migrations (20260713201542, 20260714110000, 20260717120000_corrector_public_titles).
  • docs/audit-remediation-plan-2026-07-14.md — add a dated reconciliation block: which findings are now DONE in code (C1, D1, D5, E1, E2, F4, G1–G4, H6, F5), which remain open (D2, D3, E3, F1, F3, F6, H1–H5), which are in flight (draft PRs Fix frontend a11y/layout audit findings: toggle-group + duplicate padding #708/Add missing storage-bucket creation to the migration chain (drift fix) #710), and which are operator-pending.
  • .env.example (audit finding F5) — advertised RAG_TEXT_WEAK_OR_RELAXATION=true, but src/lib/env.ts defaults it to false because it is a known-regressive opt-in experiment (buries some correct docs after re-ranking). Aligned the example + comment with the safe code default.

No runtime source or schema changed — docs plus one example config default.

Verification

  • npm run verify:pr-local — not run; change is docs + a single .env.example default, no runtime/source/schema surface. src/lib/env.ts already defaults the flag to false, so app behavior is unchanged.
  • prettier --write clean on the three changed markdown files (tables re-aligned).
  • Confirmed against the tree: 20260713030000_producer_scoped_deep_memory.sql present; src/lib/deep-memory.ts cleanupStagedArtifacts scopes deletes by producer + artifact_generation_id; the three repo-ahead migrations exist in supabase/migrations/.
  • eval:retrieval:quality / verify:ui / release gates — N/A; no retrieval, ranking, UI, or answer-generation code changed.

Clinical Governance Preflight

Change is documentation plus one .env.example default; it does not alter ingestion, answer generation, retrieval/ranking, source rendering, document access, or clinical output at runtime.

  • Supabase target remains Clinical KB Database (sjrfecxgysukkwxsowpy) — unchanged
  • Service-role keys and private document access remain server-only — unchanged
  • Source metadata, review status, and outdated/unknown-source behavior remain conservative — unchanged
  • .env.example default now matches the safer src/lib/env.ts default (false); no live env or provider workflow touched
  • No patient-identifiable workflow, demo/real separation, or SaMD classification affected

Notes


Generated by Claude Code

Summary by CodeRabbit

  • Documentation
    • Updated audit and ingestion remediation plans to reflect completed work and current repository status.
    • Added launch-gating guidance for applying and verifying pending migrations.
    • Documented verification commands and linked the relevant operational runbook.
  • Configuration
    • Changed the text-relaxation experiment to be opt-in and disabled by default.

@supabase

supabase Bot commented Jul 17, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project sjrfecxgysukkwxsowpy because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


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

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 876fa194-c985-4222-8deb-f42a7840e2c0

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)

❌ Error committing Unit Tests locally.

  • Create PR with unit tests
  • Commit unit tests in branch claude/memory-tasks-review-glmntq

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

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Note

Unit test generation is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it.


Generating unit tests... This may take up to 20 minutes.

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

✅ Created PR with unit tests: #722

…eak-OR footgun

Follow-through on the memory/task review. Cross-checked every tracked
ongoing/recommended task against the current tree and updated the ledgers to
match reality:

- ingestion-concurrency-fix-workorder: mark deep-memory delete-scoping RESOLVED
  (producer-scoped model — migration 20260713030000 + #569 + deep-memory.ts
  cleanupStagedArtifacts). This doc now has no open repository items.
- operator-backlog: close the drift-codify forward-migration row (step 1h) — the
  forward-codify work-order is complete (applied 2026-07-13). Add a new "apply
  repo-ahead migrations to live" verify row for the three committed-but-unapplied
  migrations (20260713201542, 20260714110000, 20260717120000).
- audit-remediation-plan-2026-07-14: add a dated reconciliation block recording
  which findings are now DONE in code, which remain open (OWNER:CODE), which are
  in flight (PRs #708/#710), and which are operator-pending.

Also fix a config footgun the review surfaced (audit finding F5): .env.example
advertised RAG_TEXT_WEAK_OR_RELAXATION=true, but src/lib/env.ts defaults it to
false because it is a known-regressive opt-in experiment (buries some correct
docs after re-ranking). Align the example with the safe code default.

Docs + one config default only; no runtime code or schema changed.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011Zbpyexer9cLgxhrB61RCU
@BigSimmo
BigSimmo force-pushed the claude/memory-tasks-review-glmntq branch from 79596c5 to d6c26b8 Compare July 17, 2026 16:33
@BigSimmo
BigSimmo marked this pull request as ready for review July 17, 2026 17:27
@BigSimmo
BigSimmo enabled auto-merge July 17, 2026 17:27
@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Note

Unit test generation is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it.


Generating unit tests... This may take up to 20 minutes.

@BigSimmo
BigSimmo merged commit 1b84f84 into main Jul 17, 2026
16 checks passed
@BigSimmo
BigSimmo deleted the claude/memory-tasks-review-glmntq branch July 17, 2026 17:30

@coderabbitai coderabbitai 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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.env.example:
- Around line 102-105: Update the stale golden retrieval threshold comment
associated with RAG_TEXT_WEAK_OR_RELAXATION in src/lib/env.ts to require a 36/36
run, matching .env.example and the runbooks; change only the documented
release-gate value.

In `@docs/operator-backlog.md`:
- Line 24: Update the verify command in the migration backlog row to invoke the
retrieval-quality script as “npm run eval:retrieval:quality” instead of the bare
script name, while preserving the existing drift check and evaluation details.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 6869b7ca-b4fe-49b3-9f2f-d43c17b50f5d

📥 Commits

Reviewing files that changed from the base of the PR and between a185a59 and 3b75bb1.

📒 Files selected for processing (4)
  • .env.example
  • docs/audit-remediation-plan-2026-07-14.md
  • docs/ingestion-concurrency-fix-workorder.md
  • docs/operator-backlog.md

Comment thread .env.example
Comment on lines +102 to +105
# Opt-in experiment ONLY and OFF by default (matches the src/lib/env.ts default): it is known to
# regress the golden retrieval eval (buries some correct docs after re-ranking). Leave false;
# re-enable solely behind a fresh 36/36 golden retrieval run. false = relax-only-on-empty.
RAG_TEXT_WEAK_OR_RELAXATION=false

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
rg -n '34/34|36/36|RAG_TEXT_WEAK_OR_RELAXATION' .env.example src/lib/env.ts docs

Repository: BigSimmo/Database

Length of output: 12310


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n== .env.example ==\n'
sed -n '98,108p' .env.example

printf '\n== src/lib/env.ts ==\n'
sed -n '118,132p' src/lib/env.ts

printf '\n== docs references ==\n'
rg -n '34/34|36/36|RAG_TEXT_WEAK_OR_RELAXATION' docs src/lib/env.ts .env.example

Repository: BigSimmo/Database

Length of output: 14075


Make the golden-run threshold consistent. .env.example and the runbooks say 36/36, but src/lib/env.ts:126 still says 34/34. Update the stale comment so operators see one release gate everywhere.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.env.example around lines 102 - 105, Update the stale golden retrieval
threshold comment associated with RAG_TEXT_WEAK_OR_RELAXATION in src/lib/env.ts
to require a 36/36 run, matching .env.example and the runbooks; change only the
documented release-gate value.

Comment thread docs/operator-backlog.md
| -------------------------------------------------------------------------- | ---------- | ---------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ |
| Apply July-8 migration batch (a–g) to live | ✅ done | — | `SUPABASE_ENVIRONMENT=production npm run check:july8-live-batch` (2026-07-13: 6 live, apply=no-op) | [operator-apply-july8-batch.md](operator-apply-july8-batch.md) |
| Apply drift-codify forward migration (step 1h) | ✅ done | — | Applied and drift/readiness verified 2026-07-13; verify only unless new reviewed drift is found | [database-drift-detection.md](database-drift-detection.md) |
| Apply repo-ahead migrations to live (post-2026-07-13) | 🔎 verify | `20260713201542` · `20260714110000` · `20260717120000` committed, live-apply unconfirmed | `npm run check:drift`; then `eval:retrieval:quality` (36/36) for the corrector | [deploy-corrector-public-titles.md](deploy-corrector-public-titles.md) |

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '--- package.json scripts matching eval:retrieval:quality ---\n'
rg -n '"eval:retrieval:quality"|eval:retrieval:quality' package.json . -g 'package.json' -g '!node_modules' || true

printf '\n--- docs operator-backlog row ---\n'
sed -n '20,28p' docs/operator-backlog.md

Repository: BigSimmo/Database

Length of output: 246


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '--- package.json scripts matching eval:retrieval:quality ---'
rg -n '"eval:retrieval:quality"|eval:retrieval:quality' package.json . -g 'package.json' -g '!node_modules' || true

echo
echo '--- docs operator-backlog row ---'
sed -n '20,28p' docs/operator-backlog.md

Repository: BigSimmo/Database

Length of output: 3992


Make the retrieval-quality check copy-pasteable. eval:retrieval:quality is an npm script, so the verify command should use npm run eval:retrieval:quality.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/operator-backlog.md` at line 24, Update the verify command in the
migration backlog row to invoke the retrieval-quality script as “npm run
eval:retrieval:quality” instead of the bare script name, while preserving the
existing drift check and evaluation details.

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Request timed out after 900000ms (requestId=7b0764ad-d2e9-419e-99c8-cea307c0f3f6)

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