Repository navigation
fix(structure): no stdin-piped hashing and no unbounded Git calls in the commit hook - #168
Merged
Merged
Conversation
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.
During a commit on 2026-10-01, the pre-commit hook (
update-structure.js --staged) blocked the commit for 170 s:git hash-object --stdin, called by STR-02c's mirror step to hash the tracked map on disk, sat inread()waiting for stdin to close, whilenodewaited insidespawnSync."mirror": "failed"recorded.Changes (
scripts/structure-commit.js)blobId(bytes, like): Git's blob id computed in process (sha1("blob <len>\0" + bytes), or sha256 when compared with a 64-hex id). It replaces the threehash-object --stdincalls that piped the whole map through Git: the disk-vs-staged check inmirrorToDisk,repairPathspecIndex, andreconcileTrackedMap. No filters applied to--stdinbefore either, so the result is identical.git()call has a 60 s limit (SIGKILL). A stuck call fails the run with reasongit-timeout, the hook's|| truelets the commit through, and the receipt records it, socheck-freshnessreports that the commit kept the previous map.Tests
blobIdequalsgit hash-objectfor empty, JSON and binary/UTF-8 bytes, and follows a SHA-256 id.gitthat sleeps fails within the limit withgit-timeout.npm test: 1111 passing.