Skip to content

feat(storage): route antigravity acquisition through raw-admission chokepoint - #3688

Merged
Sinity merged 2 commits into
masterfrom
feature/storage/raw-admission-antigravity-callsite
Aug 3, 2026
Merged

Sinity merged 2 commits into
masterfrom
feature/storage/raw-admission-antigravity-callsite

Conversation

@Sinity

@Sinity Sinity commented Aug 3, 2026

Copy link
Copy Markdown
Owner

Summary

Migrates one real production call site (antigravity_conversation_acquisition.py) off the direct write_raw_and_parsed_result() writer onto polylogue-1fijp's raw-admission chokepoint (admit_raw_observation(), mechanism landed in #3668), and audits the bead/PR's own cited call-site list against current source.

Problem

PR #3668 landed admit_raw_observation() with one routed call site (Claude Code fact-artifact admission) and surveyed 11+ other write_source_raw_session call sites as not-yet-migrated. Re-grepping current source for this dispatch found that survey has drifted: codex_title_census.py, context/codex_spawn_edge_correlation.py, context/hermes_delivery_correlation.py, daemon/antigravity_conversation_acquisition.py (as originally listed), sources/hooks.py, storage/repair.py, storage/raw_reconciler.py, and storage/hook_payload_ref_reconciliation.py do not call write_source_raw_session or any raw-write wrapper at all today — they only read/reference the raw_sessions table (SELECT queries, comments). The real remaining direct callers of write_source_raw_session are exclusively the two generic writer primitives inside revision_governance.py itself (write_raw_payload, write_raw_and_parsed_result); production feature code reaches raw writes only through those or sources/live/*.

Solution

  • polylogue/storage/sqlite/archive_tiers/raw_admission.py: widened admit_raw_observation() to accept and forward additional_blob_refs (attachment blob refs) to its four session-content write_source_raw_session calls (BASELINE/APPEND/SUPERSEDE/REFUSED_AMBIGUOUS). The chokepoint previously silently dropped this parameter relative to write_source_raw_session's own capability — migrating any attachment-bearing call site without this fix would have quietly lost attachment blob refs on the raw row.
  • polylogue/storage/sqlite/archive_tiers/revision_governance.py: added admit_raw_and_parsed_result(), a narrower sibling of write_raw_and_parsed_result() that resolves admit_raw_observation()'s typed arms against prior_head=None and raises if the caller's BASELINE-only contract is violated. Wired an ArchiveStore.admit_raw_and_parsed_result wrapper (mirrors the existing admit_raw_artifact_payload shape from feat(storage): add raw-admission chokepoint mechanism + atomic-read contract #3668).
  • polylogue/daemon/antigravity_conversation_acquisition.py: switched acquire_antigravity_conversations_once to the new entrypoint. This call site is structurally BASELINE-only — it pre-filters to .pb cascade ids not already present in raw_sessions, so no prior head ever exists to compare against.
  • docs/plans/layering.yaml: declared the new entrypoint (devtools verify layering's writer-module-entrypoint-inventory check requires it).

Scope / call-site status (acceptance-criteria honesty)

  • Migrated: daemon/antigravity_conversation_acquisition.py (arm: BASELINE only).
  • Reviewed, NOT migrated (documented, not force-fit):
    • sources/live/append_ingest.py / sources/live/batch.py — both resolve real prior-head revision chains (bind_raw_revision/classify_raw_revision_cohort_for_live_watch) that require a parsed session's provider_session_id to derive logical_source_key, i.e. the decision depends on content only available after parsing. admit_raw_observation is a single synchronous pre-parse call — architecturally incompatible. The bead itself calls this family "mostly compliant"; explicitly out of scope per the dispatch.
    • pipeline/services/archive_ingest.py's main session-ingest path (write_pair's write_raw_and_parsed_result call) — uses content-addressed deterministic_raw_session_id + shared_raw_ids in-batch dedup, a different idempotency mechanism than revision-chain byte comparison against a mutable head. Forcing it through the typed arms would be an architecture mismatch, not a mechanical swap, and it's the highest-traffic write path in the system.
    • storage/repair.py's raw_sessions INSERT (browser-origin repair copy_forward) — constructs a synthetic row from already byte-proven evidence during repair, not a fresh acquisition observation; doesn't fit the "compare fresh payload to prior head" model at all.
    • sources/drive/__init__.py / pipeline/services/ingest_batch/_core.py Drive lineage bind — explicitly excluded per dispatch (separate JSON-structural-diff classifier lane, per feat(storage): add raw-admission chokepoint mechanism + atomic-read contract #3668's own scope notes).
    • codex_title_census.py, context/*_correlation.py, sources/hooks.py, storage/raw_reconciler.py, storage/hook_payload_ref_reconciliation.py — verified via grep against current source: no write_source_raw_session/raw-write-wrapper calls exist in these files at all. The bead/PR feat(storage): add raw-admission chokepoint mechanism + atomic-read contract #3668's cited list had drifted; nothing to migrate here.

AC status (polylogue-1fijp)

  • (a) grep proves no raw_sessions INSERT outside the chokepoint module: still partially satisfied — one additional real call site now routed; the batch-import, live-watcher, and repair paths remain direct writers for the architecture-mismatch reasons above, not because they were skipped.

Verification

  • devtools test tests/unit/daemon/test_antigravity_conversation_acquisition.py tests/unit/storage/test_raw_admission.py -> 13 passed
  • devtools test -k "revision_governance or raw_admission or archive_ingest or antigravity" -> 132 passed
  • mypy --strict on raw_admission.py, revision_governance.py, archive.py, antigravity_conversation_acquisition.py -> Success: no issues found in 4 source files
  • devtools verify --quick -> exit_code: 0
  • devtools verify layering -> No layering violations found (306 pre-existing baselined-import violations / 2 stale-baseline entries unchanged from before this PR, unrelated)

Ref polylogue-1fijp

Sinity and others added 2 commits August 3, 2026 22:20
…okepoint

Problem: polylogue-1fijp's admit_raw_observation() chokepoint had one real
production call site (Claude Code fact-artifact admission, PR #3668).
antigravity_conversation_acquisition.py's acquire_antigravity_conversations_once
still wrote raw_sessions rows via write_raw_and_parsed_result(), which always
persists a bare FULL/revision=None row -- the nullable "figure it out later"
limbo the chokepoint exists to eliminate. This call site is structurally
BASELINE-only: it pre-filters to .pb cascade ids not already present in
raw_sessions, so no prior head ever exists to compare against.

Solution: added admit_raw_and_parsed_result() to revision_governance.py, a
narrower sibling of write_raw_and_parsed_result() that resolves
admit_raw_observation()'s typed arms against prior_head=None and raises if
the caller's BASELINE-only contract is violated (any other arm would mean a
prior head existed and the caller under-filtered). Wired an ArchiveStore
wrapper method (mirroring admit_raw_artifact_payload's existing shape) and
switched the antigravity call site to it. Also widened admit_raw_observation
itself to accept and forward additional_blob_refs (attachment blob refs) to
its four session-content write_source_raw_session calls -- the original
chokepoint silently dropped this parameter, which write_raw_and_parsed_result
had always forwarded; without this widening, migrating any attachment-bearing
call site would have quietly lost attachment blob refs on the raw row.

Not migrated (documented, not force-fit): sources/live/append_ingest.py
and sources/live/batch.py both resolve real prior-head revision chains
(bind_raw_revision/classify_raw_revision_cohort_for_live_watch) that require
a parsed session's provider_session_id to derive logical_source_key --
architecturally incompatible with admit_raw_observation's single-call,
pre-parse model. archive_ingest.py's main batch-import path uses
content-addressed deterministic_raw_session_id + shared_raw_ids dedup, a
different idempotency mechanism than revision-chain byte comparison.
storage/repair.py's raw_sessions INSERT is a browser-origin repair
copy-forward of already-proven evidence into a synthetic row, not a fresh
acquisition. codex_title_census.py, context/*_correlation.py, hooks.py,
storage/raw_reconciler.py, storage/hook_payload_ref_reconciliation.py were
verified via grep against current source: none of them call
write_source_raw_session or any raw-write wrapper at all (read-only queries
or comments referencing the raw_sessions table) -- the bead/PR #3668's
cited call-site list had drifted from current source.

Verification:
- devtools test tests/unit/daemon/test_antigravity_conversation_acquisition.py tests/unit/storage/test_raw_admission.py -> 13 passed
- mypy --strict on raw_admission.py, revision_governance.py, archive.py, antigravity_conversation_acquisition.py -> Success: no issues found in 4 source files

Ref polylogue-1fijp

Co-Authored-By: Claude <[email protected]>
…ypoint

devtools verify layering's writer-module-entrypoint-inventory check flagged
the new revision_governance.py function added for polylogue-1fijp (a
directly-detected mutating entrypoint via its admit_raw_observation/
_index_parsed_for_retained_raw calls). Add it to docs/plans/layering.yaml's
declared entrypoint list for that module, matching its sibling writer
functions.

Verification: devtools verify layering -> No layering violations found
(pre-existing 306 baselined-import-violation / 2 stale-baseline-entry counts
unrelated to this change, unchanged from before it).

Ref polylogue-1fijp

Co-Authored-By: Claude <[email protected]>
@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@Sinity, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 37 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 9aff78d5-2481-44d3-a5fa-451ea55b005e

📥 Commits

Reviewing files that changed from the base of the PR and between d080927 and b393780.

📒 Files selected for processing (5)
  • docs/plans/layering.yaml
  • polylogue/daemon/antigravity_conversation_acquisition.py
  • polylogue/storage/sqlite/archive_tiers/archive.py
  • polylogue/storage/sqlite/archive_tiers/raw_admission.py
  • polylogue/storage/sqlite/archive_tiers/revision_governance.py

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.

❤️ Share

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

@Sinity
Sinity merged commit 08fe312 into master Aug 3, 2026
3 checks passed
@Sinity
Sinity deleted the feature/storage/raw-admission-antigravity-callsite branch August 3, 2026 20:33
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.

1 participant