Repository navigation
fix(admission): quarantine records event_id only, not content_hash (#1157) - #1161
Merged
Merged
Conversation
…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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_idfor Quarantine via the same path as Admit, leaving a dangling pointer: future dedup hits would surfaceAdmissionDropReason::Duplicatewith anexisting_engram_idthat 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 forReplayDetected.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_admittedpath.Fix #2: IPC error type doc-TODO
Current handler flattens typed
AdmissionErrorto aformat!()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
3 new tests:
quarantine_chat_origin_records_no_side_effects— chat-origin quarantine is a pure no-op on the side-effect storesquarantine_airc_origin_records_event_id_only_not_content_hash— airc-origin quarantine records event_id BUT NOT content_hashadmit_airc_origin_still_records_both_content_hash_and_event_id— regression-anchor for the refactor: Admit must STILL record bothcargo clippyclean.npm run build:tsclean. Hooks ran without--no-verify.🤖 Generated with Claude Code