Skip to content

fix(admission): quarantine records event_id only, not content_hash (#1157) - #1161

Merged
joelteply merged 1 commit into
canaryfrom
fix/quarantine-no-content-hash-record
May 14, 2026
Merged

joelteply merged 1 commit into
canaryfrom
fix/quarantine-no-content-hash-record

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Summary

Folds two review nits from claude-tab-2 on continuum#1155 (PR-4 of #1121).

Card

continuum#1157.

Fix #1: Quarantine no-content-hash recording (real subtle bug)

v1 has no quarantine store, so a Quarantined engram is dropped on the floor. The original PR-4 code recorded content_hash → engram_id for Quarantine via the same path as Admit, leaving a dangling pointer: future dedup hits would surface AdmissionDropReason::Duplicate with an existing_engram_id that can't be looked up anywhere.

Fix: split record_engram_origin → record_admitted (full: hash + event_id, used by Admit) + record_replay_only (event_id only for AIRC origins, used by Quarantine). Replay protection via event_id stays — it's the load-bearing behaviour for ReplayDetected.

Once PR-5+ adds a real quarantine store, the engram lands somewhere lookup-able and content_hash recording can come back via the same record_admitted path.

Fix #2: IPC error type doc-TODO

Current handler flattens typed AdmissionError to a format!() string, losing the variant info TS callers would pattern-match on. Added inline TODO comment pinning the intent to PR-5+ (return as JSON-discriminant via serde, or via a CommandResult error variant that preserves shape). Caller can still parse the prefix today.

Validation

$ cargo test -p continuum-core --features metal,accelerate persona::admission_state
test result: ok. 9 passed; 0 failed; 0 ignored

3 new tests:

  • quarantine_chat_origin_records_no_side_effects — chat-origin quarantine is a pure no-op on the side-effect stores
  • quarantine_airc_origin_records_event_id_only_not_content_hash — airc-origin quarantine records event_id BUT NOT content_hash
  • admit_airc_origin_still_records_both_content_hash_and_event_id — regression-anchor for the refactor: Admit must STILL record both

cargo clippy clean. npm run build:ts clean. Hooks ran without --no-verify.

🤖 Generated with Claude Code

…1157)

Folds two review nits from claude-tab-2 on continuum#1155:

1. **Quarantine no-content-hash recording (real subtle bug).** v1 has
   no quarantine store, so a Quarantined engram gets dropped on the
   floor. Original PR-4 code recorded `content_hash → engram_id` for
   Quarantine via the same path as Admit, leaving a dangling pointer:
   future dedup hits would surface `AdmissionDropReason::Duplicate`
   with an `existing_engram_id` that can't be looked up anywhere.

   Fix: split `record_engram_origin` → `record_admitted` (full: hash +
   event_id, used by Admit) + `record_replay_only` (event_id only for
   AIRC origins, used by Quarantine). Replay protection via event_id
   stays — it's the load-bearing behaviour for `ReplayDetected`.

   Once PR-5+ adds a real quarantine store, the engram lands somewhere
   lookup-able and content_hash recording can come back via the same
   `record_admitted` path.

2. **IPC error type doc-TODO.** Current handler flattens typed
   `AdmissionError` to a `format!()` string, losing the variant info
   TS callers would pattern-match on. Added inline TODO comment
   pinning the intent to PR-5+ (return as JSON-discriminant via serde,
   or via a CommandResult error variant that preserves shape). Caller
   can still parse the prefix today.

Tests: 9/9 admission_state pass (was 6, +3 new):
- `quarantine_chat_origin_records_no_side_effects` — chat-origin
  quarantine is a pure no-op on the side-effect stores
- `quarantine_airc_origin_records_event_id_only_not_content_hash` —
  airc-origin quarantine records event_id BUT NOT content_hash
- `admit_airc_origin_still_records_both_content_hash_and_event_id` —
  regression-anchor for the refactor: Admit must STILL record both

Card: continuum#1157.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@joelteply
joelteply merged commit f81ec17 into canary May 14, 2026
2 checks passed
@joelteply
joelteply deleted the fix/quarantine-no-content-hash-record branch May 14, 2026 12:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant