Repository navigation
fix(storage): copy forward legacy browser NULL identities (#2843) - #2843
Conversation
Problem: a historical browser-capture raw has native_id NULL even though\nits retained bytes normalize to a canonical ChatGPT session. Ordinary\norigin repair correctly refuses that mismatch and must remain strict.\n\nWhat changed: add a separately named legacy-only maintenance actuator\nthat requires the exact NULL identity evidence shape, reproves the full\nsource/blob/parser/census/head/application witnesses, and copy-forwards a\nnew canonical raw. Planned and applied receipts bind the NULL witness and\nparser-derived identity; the original durable evidence remains untouched.\n\nCompatibility: pre-existing ordinary terminal receipts remain readable;\nlegacy receipts use a dedicated schema.\n\nRef polylogue-lkrc.1\n\nCo-Authored-By: Claude <[email protected]>
📝 WalkthroughWalkthroughAdds a maintenance command and storage API for repairing legacy browser-capture records with NULL ChangesLegacy native-id repair
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant Operator
participant MaintenanceCommand
participant RepairEngine
participant SourceDB
participant IndexDB
participant Receipt
Operator->>MaintenanceCommand: Provide raw IDs and apply options
MaintenanceCommand->>RepairEngine: Invoke legacy native-id repair
RepairEngine->>SourceDB: Validate and stage legacy evidence
RepairEngine->>IndexDB: Apply copy-forward repair
RepairEngine->>Receipt: Record planned and terminal states
Receipt-->>MaintenanceCommand: Return repair report
MaintenanceCommand-->>Operator: Render repair result
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
A legacy receipt detail is valid only while the dedicated repair path supplies\na concrete parser-derived native identity. Ordinary origin repair must not\naccept a legacy-shaped detail with a missing identity witness.\n\nRef polylogue-lkrc.1\n\nCo-Authored-By: Claude <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: effe4dccbd
ℹ️ 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".
The dedicated NULL-native browser capture route now rejects competing\ncanonical authority and non-singleton source witnesses. It stages the\ncopy-forward source rows and index transition in one attached-database\ntransaction, leaving the ordinary repair route unchanged.\n\nRegression coverage proves rollback after source staging, receipt state,\nsource-v7 compatibility, and idempotence.\n\nRef polylogue-lkrc.1.\n\nCo-Authored-By: Claude <[email protected]>
|
The independent-review changes are pushed at 6672367. Please re-audit the legacy-only transaction, singleton proof, and rollback invariants. Local verification is recorded in the PR body; no live archive mutation was run. |
Problem: the legacy browser-native-id actuator needs one durable outcome\nacross source.db and index.db even if its process dies mid-repair.\n\nWhat changed: enter a guarded, legacy-only DELETE rollback-journal\nmaintenance window so SQLite uses the attached-database super-journal\nprotocol, then restore normal WAL posture before terminalizing the receipt.\nRecord the protocol and posture evidence in legacy receipts while keeping\nordinary v1 receipt targets compatible.\n\nVerification: focused legacy repair tests exercise subprocess deaths before\nand after commit, recovery, rollback, and ordinary receipt resumption.\n\nCo-Authored-By: Claude <[email protected]>
Summary
Add a dedicated maintenance actuator for the exact historical browser-capture
raw shape whose durable
native_idis NULL. It preserves original evidence andcreates a canonical copy-forward raw with the parser-derived identity.
Problem
The retained browser bytes normalize to one ChatGPT session, but the durable
source raw lacks native identity. The ordinary browser-origin repair correctly
rejects it; relaxing that identity proof would be unsafe. The legacy route also
needs one crash-durable outcome across
source.dbandindex.db.Solution
legacy shape only.
NULL native identity, parser result, source/blob agreement, census, current
head, and application receipt.
rollback-superjournal-v1offline maintenancewindow: idle checkpoint, temporary DELETE journals,
synchronous=EXTRA,BEGIN EXCLUSIVE, index-main/source-attached transaction, then WAL restore.posture in legacy receipts. Existing ordinary v1 receipt targets remain
compatible.
Acceptance criteria
Verification
devtools test tests/unit/storage/test_browser_capture_origin_repair.py -k "legacy_browser_native_id or prelegacy_planned_receipt"— 16 passed, 93 deselected.devtools verify --quick— success; pre-push reran it successfully.same-device condition, super-journal transaction, WAL restoration, and
before/after-commit crash recovery.
Follow-up / live operation
No live archive mutation is included. Before live use: take a fresh full
backup, stop the daemon, run the exact read-only dry-run, apply with a stored
receipt, then verify the postflight census has zero mismatched heads.
Ref polylogue-lkrc.1