Harden Claude runtime state handling - #136
Closed
minislively wants to merge 3 commits into
Closed
Conversation
Claude hook state should fail closed instead of crashing when local runtime metadata is malformed or unexpected hook events arrive.\n\nThe runtime now no-ops unrecognized Claude hook event names, treats corrupt trust status as disconnected state, swallows trust-status write failures, and cleans empty session-state directories after Stop. Tests cover the corrupt trust file, unknown event, empty-directory cleanup, and repeated-file non-stale trust path.\n\nConstraint: Claude support remains project-local SessionStart/UserPromptSubmit context hooks only; this does not add Claude Read interception or runtime-token savings claims\nRejected: Propagate trust JSON/write failures | hook pipeline should remain non-fatal for local telemetry/state corruption\nConfidence: high\nScope-risk: narrow\nDirective: Keep Claude runtime state failures non-fatal unless a future release explicitly introduces a hard setup gate\nTested: npm test\nTested: npm run release:smoke\nNot-tested: live Claude CLI session outside isolated smoke
Collaborator
…ed file - markClaudeAttachPrepared now returns early when the same file is already attach-prepared, preserving lastAttachPreparedAt. - When attach-prepared changes, lastAttachPreparedAt is initialized only if absent (previous.lastAttachPreparedAt ?? now()), preventing overwrite. - Test baseline fixed: FOOKS_CLAUDE_FIRST_SEEN_INJECT=1 ensures lastAttachPreparedAt is set before the non-stale repeat assertion. Fixes CI failure in PR #136.
ensureFreshClaudeContextForTarget non-stale path test now initializes trust status with initializeClaudeTrustStatus before reading beforeUpdatedAt. This prevents the test from flaking when readClaudeTrustStatus returns a fresh now() because the trust file does not yet exist. Fixes CI failure in PR #136 (Node 20).
Collaborator
|
Superseded by #140; overlapping Claude runtime/test changes already landed there. Closing to avoid duplicate merge churn. |
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
Verification
Claim boundaries