Skip to content

feat(security): bind source admission to excision policy - #4646

Merged
Sinity merged 2 commits into
masterfrom
feature/packet/polylogue-1sb32
Sep 4, 2026
Merged

Sinity merged 2 commits into
masterfrom
feature/packet/polylogue-1sb32

Conversation

@Sinity

@Sinity Sinity commented Sep 4, 2026

Copy link
Copy Markdown
Owner

Summary

Bound durable excision policy to production acquisition admission. The canonical async acquisition service now builds one immutable snapshot before source traversal and carries it through the pending raw-admission request. The synchronous ArchiveStore governance routes use the same snapshot builder before raw payload, blob-reference, artifact, parsed-session, and hook writes. Schema identity is derived from the current tier versions.

Problem

The prior implementation exposed policy parameters only at low-level writers. Every production caller left them at None, so the guard was a no-op and build_excision_policy_snapshot was reachable only from a unit test.

Solution

The binding belongs at the acquisition orchestration and governance layers. AcquisitionService.acquire_sources captures policy before candidate traversal, persist_raw_record carries it into the admission request, and the async executor rejects the content hash before source-row side effects. Shared synchronous governance entrypoints resolve and forward the same policy to the raw-admission chokepoint. The regression invokes AcquisitionService.acquire_sources against a real source file and confirms the excised payload creates no raw_sessions row.

Verification

  • nix develop --accept-flake-config --command devtools test tests/unit/pipeline/test_acquisition_excision_policy.py tests/unit/security/test_excision_policy.py: 3 passed.
  • nix develop --accept-flake-config --command devtools test tests/unit/pipeline/test_acquisition_blob_gc_age_gate.py tests/unit/pipeline/test_stage_independence.py tests/unit/storage/test_raw_admission_async_parity.py: 24 passed; the selected acquisition blob test also hit the inherited fresh-bootstrap index schema semantic manifest mismatch for extra table schema_identity when run in the combined selection.
  • nix develop --accept-flake-config --command devtools test tests/unit/storage/test_source_items.py tests/unit/storage/test_raw_admission_async_parity.py tests/unit/security/test_excision_policy.py tests/unit/pipeline/test_acquisition_excision_policy.py: 13 passed; two hook-route tests hit the same inherited schema-manifest mismatch.
  • nix develop --accept-flake-config --command devtools verify --quick: passed after the route binding was added.
  • Rebased onto origin/master at 6de9e5d4746b3ea9cb0c02b20b8e21b0850bd4b0.

Residual risk

The source-generation projection remains lazily created by publish_source_generation; its numbered source migration and the broader durable excision transition are outside this route-binding repair. The legacy source.excised_content ledger remains unchanged.

@Sinity
Sinity enabled auto-merge (squash) September 4, 2026 01:27
@coderabbitai

coderabbitai Bot commented Sep 4, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Team

Run ID: 44d8e3e3-63df-4ccc-8fca-fe732d62210d


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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 4, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-04T01:35:25.707008Z 7ba0ac3 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Sinity
Sinity merged commit 473d292 into master Sep 4, 2026
4 checks passed
@Sinity
Sinity deleted the feature/packet/polylogue-1sb32 branch September 4, 2026 01:32

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7ba0ac32dc

ℹ️ 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".

Comment thread polylogue/security/excision_policy.py Resolved
Sinity added a commit that referenced this pull request Sep 22, 2026
Session excision records every sibling attachment and sidecar hash, not just
the session payload's. `write_source_raw_session` and
`write_source_raw_session_blob_ref` checked only the primary hash, so a later
ingest whose own payload is admissible could still carry a durably excised hash
in `additional_blob_refs`: the loop inserted its `blob_refs` row and consumed
its publication receipt, making the excised bytes reachable again under a new
raw record. `write_source_blob_refs` was fixed for this exact class and its
docstring already claimed the other two writers were gated.

Both writers now validate every additional reference against the policy
snapshot and the durable ledger before opening their transaction, so a refusal
leaves no side effect, and it refuses per reference naming the hash like
`write_source_blob_refs` does.

Executed anti-vacuity at 9f450db: both writers accept the excised sibling and
leave two `blob_refs` rows pointing at the excised hash; with the gate both
refuse and leave zero, while an admissible sibling still writes. Raised by PR
#4646 review.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01ToWqpkXotr573DiQex5vcy

(cherry picked from commit ce5dadf)
Sinity added a commit that referenced this pull request Sep 22, 2026
Session excision records every sibling attachment and sidecar hash, not just
the session payload's. `write_source_raw_session` and
`write_source_raw_session_blob_ref` checked only the primary hash, so a later
ingest whose own payload is admissible could still carry a durably excised hash
in `additional_blob_refs`: the loop inserted its `blob_refs` row and consumed
its publication receipt, making the excised bytes reachable again under a new
raw record. `write_source_blob_refs` was fixed for this exact class and its
docstring already claimed the other two writers were gated.

Both writers now validate every additional reference against the policy
snapshot and the durable ledger before opening their transaction, so a refusal
leaves no side effect, and it refuses per reference naming the hash like
`write_source_blob_refs` does.

Executed anti-vacuity at 9f450db: both writers accept the excised sibling and
leave two `blob_refs` rows pointing at the excised hash; with the gate both
refuse and leave zero, while an admissible sibling still writes. Raised by PR
#4646 review.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01ToWqpkXotr573DiQex5vcy

(cherry picked from commit ce5dadf)
@Sinity

Sinity commented Sep 29, 2026

Copy link
Copy Markdown
Owner Author

Closing out open Codex review threads on this PR (evidence checked against master at ef10e59):

Resolving the fixed, stale and refuted threads; tracked threads stay open.

@Sinity

Sinity commented Sep 29, 2026

Copy link
Copy Markdown
Owner Author

Closing out open Codex review threads on this PR (evidence checked against master at 0914f89):

Resolving every thread listed; confirmed defects are fixed under the named bead.

@Sinity

Sinity commented Oct 1, 2026

Copy link
Copy Markdown
Owner Author

Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.

  • 74.F088 / P1: fixed-already at the checked revision: The runtime-only table creation has been removed: polylogue/storage/sqlite/archive_tiers/source.py:146 declares excision_policy_projections in canonical source DDL, and source_items.py:707 only inserts its binding row. Fresh archives therefore contain the relation independently of whether generation publication has run.

Only the rows listed above are dispositioned. Held findings remain open.

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