feat(hooks): post-commit consumption finaliser (#213) - #246
Merged
Conversation
Implement the post-commit hook that finalises pending capture consumption after a successful commit. The hook inspects applied, unconsumed pending transactions and consumes exactly the one whose base_head matches the new commit's first parent, staged_tree_oid matches the committed tree, applied_record_hash matches the canonical trailer block, and every Record-Id is present in the commit message. Also registers the internal post-commit CLI command and adds idempotent post-commit hook installation to commitlore init alongside the existing hooks step. Foreign hooks are preserved per the containment policy. Limit: consumption happens after commit succeeds, exactly once; consuming earlier loses the record on failed commits, consuming twice lets one record attach to two commits Record-Id: r-0ll5sxk0
CommitLore — record lintTrailers: clean — 1 commit in Active constraints for the paths this PR touchesLimits (59)
Ruled out (110)
Warnings (45)
Trailer violations fail this check. Active constraints are informational — they are what the repository already decided, not a verdict on this PR. |
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
Implements T-1018 (#213): the post-commit consumption finaliser for the unified capture pipeline (M5).
Changes
src/hooks/post-commit.ts(new): Post-commit hook that inspects applied pending transactions after a successful commit and consumes exactly the one whosebase_headmatches the first parent,staged_tree_oidmatches the committed tree,applied_record_hashmatches the canonical block hash, and everyRecord-Idis present in the message.src/cli.ts: Registers the internalpost-commitcommand.src/commands/init.ts: Adds idempotent post-commit hook installation to the hooks step. Foreign hooks are preserved/refused per existing containment policy.test/post-commit-capture.test.ts(new): 12 tests covering happy path, all four rejection conditions, idempotency, crash-repair, error tolerance, and 4 mutation oracles.dist/: Rebuilt output.Key Properties
post-commithooks are never overwrittenTesting
tsconfig.jsonandbench/tsconfig.json) exit 0Closes #213