Repository navigation
feat(storage): preserve raw AISTUDIO capture mode (#2794) - #2794
Conversation
Problem: GEMINI exports and live Drive captures share the public\naistudio-drive origin, which previously lost their acquisition-time\nprovider once raw evidence was persisted.\n\nWhat changed: source.db v8 adds nullable raw_sessions.capture_mode,\nwith an additive durable migration. All raw writers persist the known\nprovider and raw reads use it to disambiguate the existing origin fiber.\nHistorical captures remain NULL/unknown.\n\nRef polylogue-2ilz\n\nCo-Authored-By: Claude <[email protected]>
|
Warning Review limit reached
Next review available in: 57 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (19)
✨ Finishing Touches🧪 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 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f8243ba0f7
ℹ️ 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".
Review fixes: backfill capture_mode only when the duplicate legacy row has NULL, and carry capture mode through the blob-backed parsed-session write route. Verified: 3 focused tests passed. Co-Authored-By: Claude <[email protected]>
Keep the first non-null raw capture mode when an async writer refreshes\nthe same raw ID. A later canonical fallback must not overwrite durable\nlive-Drive evidence.\n\nRef polylogue-2ilz\n\nCo-Authored-By: Claude <[email protected]>
Thread capture_mode through planning-state reads, raw revision replay, and\nthe public raw-artifact route so every source-tier reader preserves the\nDrive/GEMINI fiber member.\n\nRef polylogue-2ilz\n\nCo-Authored-By: Claude <[email protected]>
|
Adversarial iteration 1 summary: Findings and fixes:
What survived scrutiny: durable v8 migration, fresh DDL, known-provider persistence, legacy NULL preservation, and source-tier recovery for unambiguous raw identities. Verification: focused route suite 6 passed; local and pre-push quick gates passed. GitHub Actions initialization failures remain the known account-billing infrastructure pattern. |
Problem: hydrated pre-v8 raw rows expose a canonical provider for compatibility, but both raw writers treated that projection as acquisition evidence and wrote it back to the nullable durable field. What changed: acquisition constructors now explicitly stamp capture mode; raw writers persist only that explicit field and preserve legacy NULLs on a read-save round trip. The compact source envelope exposes the durable mode, and provider-origin documentation records the source/index boundary. Compatibility: existing historical NULL rows remain unknown. New acquisition records carry their known provider before origin collapse. Ref polylogue-2ilz
|
Adversarial iteration 2 summary: Findings and fixes:
What survived scrutiny: source v8 remains additive and durable-only; unambiguous fresh captures recover GEMINI versus DRIVE; historical provenance stays unknown rather than guessed; the explicit multi-acquisition limitation remains tracked by Verification: |
Problem: live acquisition used the shape-detected parser provider for the new capture field. A configured Drive source with a chunked-prompt payload is correctly parsed as GEMINI, but must retain DRIVE as acquisition provenance. What changed: archive raw-write APIs accept an explicit capture mode; the full live-batch route passes the configured source mode independently from its parser provider. Static record construction likewise favors a configured mode before a payload hint. Ref polylogue-2ilz
|
Adversarial iteration 3 summary: Finding and fix:
Verification:
What survived scrutiny: durable v8 migration, historical NULL handling, unambiguous source-tier recovery, and no index-tier bump. |
|
Adversarial iteration 4 summary — zero new legitimate findings. Scrutiny covered the full branch diff,
No code change was needed this iteration. GitHub Actions init-only failures remain the known billing infrastructure condition. |
|
Final
Anti-vacuity: the relevant tests exercise production acquisition construction, full live batch → archive source writes, real SQLite writers/readers, and durable migration behavior. Removing explicit capture-mode propagation, restoring writer fallback inference, or dropping reader hints changes a real persisted/retrieved provider and fails them. Ref polylogue-2ilz |
…800,2781 2ilz (origin-interop, PR #2794), 3v1.1 (capture-hardening, PR #2785), and qqyg (hooks-capture, PR #2781) fully satisfied — closed. 9e5.16 (api-parity, PR #2782), 57rp/5k5l (capture-hardening, PR #2785), and 7fj (beads-ingest, PR #2800) partially satisfied — noted with disposition, left open. Co-Authored-By: Claude <[email protected]>
…2810) ## Summary Repairs 3 failing source-tier durable migration tests on `master`, introduced by an incomplete fix-forward during merge-conductor rebase work on PR #2800. ## Problem PR #2794 (origin-interop) claimed source-tier migration slot `008` for `capture_mode`. PR #2800 (beads-ingest) also numbered its own migration `008`, requiring a rebase to renumber it to `009` (and preserve the `capture_mode` column through the copy-forward rebuild it performs). The test-file edits accompanying that rebase were made to the working tree *after* the rebase commit but never actually `git add`ed/committed, so PR #2800 merged without them. `master` currently fails: - `test_source_tier_v2_migrates_to_v3_dropping_pending_blob_refs` - `test_source_tier_v3_adds_publication_reservations_with_verified_backup_receipt` - `test_source_tier_v7_expands_origin_checks_with_verified_backup` ## Solution - Updated the two `applied_versions`/`to_version` literal assertions to include migration `9` (was pinned to the old 8-step chain). - `test_source_tier_v7_expands_origin_checks_with_verified_backup` relied on the `workspace_env` fixture's `ArchiveStore` pre-creating `source.db` at the *current* schema (already including `capture_mode`, since `CREATE TABLE IF NOT EXISTS` silently no-ops against it) before the test's own stripped-down "v7" DDL ever ran. Under a forced `PRAGMA user_version=7` stamp, migration 8's `ALTER TABLE ADD COLUMN capture_mode` then hit a real `duplicate column name` error. Added `db_path.unlink(missing_ok=True)` before the `executescript`, matching the pattern `_create_source_v1` already uses in the same file for the same fixture. ## Verification - `devtools test tests/unit/storage/test_durable_migrations.py` — 33 passed. - `devtools verify --quick` — 15/15 checks green. Co-authored-by: Claude <[email protected]>
|
Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.
Only the rows listed above are dispositioned. Held findings remain open. |
Summary
Persist the acquisition-time provider for raw captures that share the public
aistudio-driveorigin.Problem
GEMINI exports and live Google Drive captures are structurally identical after parsing and both collapse to
aistudio-drive; the existing raw tier retained only that origin, making their provider fiber irrecoverable on source-tier reads.Solution
source.dbchange, v7 to v8;raw_sessions.capture_modeis nullable so historic captures remain explicitly unknown.008_raw_session_capture_mode.sql. Acquisition constructors preserve configured capture mode separately from the shape-detected parser provider.ArchiveStore; a configured Drive source therefore persists DRIVE even when its chunked-prompt bytes select GEMINI for parsing.Provider.DRIVEfor live Drive rather than the GEMINI canonical fallback.source.dbrather than duplicated into rebuildable index state.polylogue-buns; this PR does not claim to solve that many-to-one case.Verification
env POLYLOGUE_PYTEST_BASETEMP_ROOT=/realm/tmp/polylogue-pytest nix develop --command devtools test tests/unit/core -k 'source or origin'— 114 passed.env POLYLOGUE_PYTEST_BASETEMP_ROOT=/realm/tmp/polylogue-pytest nix develop --command devtools test tests/unit/pipeline/test_hermes_raw_identity.py tests/unit/sources/test_live_batch_support.py -k 'drive_acquisition or full_drive_capture or raw_identity'— 4 passed.env POLYLOGUE_PYTEST_BASETEMP_ROOT=/realm/tmp/polylogue-pytest nix develop --command devtools test tests/unit/storage/test_raw.py tests/unit/storage/test_raw_revision_authority.py tests/unit/api/test_facade_contracts.py -k 'capture_mode or raw_revision_material or raw_artifact'— 8 passed.devtools verify --quickcompleted before pushing2ce500267.Anti-vacuity: the regressions exercise the real acquisition-record constructor, full live-batch →
ArchiveStoresource write, both SQLite source-tier writers, and source-tier readers. Removing configured-mode threading causes the Drive fixture to persist GEMINI; reintroducing fallback inference in either writer, or ignoring persisted capture mode, changes the real retrieved provider or turns a historical NULL into GEMINI and fails the tests.Acceptance criteria
capture_mode; legacy provider compatibility projections retain their existing canonical fallback.polylogue-buns.Adversarial review notes
1338306be,d259fbdc8,12a965b7c). Identified the content-identical multi-acquisition limitation and filedpolylogue-buns.2176e3ec0). Updated the stale storage-boundary documentation.2ce500267).Ref polylogue-2ilz