Repository navigation
Let Git hooks allow an exact path past the local preflight - #143
Open
ammartahamohamedy wants to merge 2 commits into
Open
ammartahamohamedy wants to merge 2 commits into
ammartahamohamedy wants to merge 2 commits into
Conversation
This branch has not been deployed
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.
Fixes #142
Problem
A pre-commit patch starts at the upstream merge-base, so it carries every unpushed commit. Once one of them holds a file the preflight refuses (a committed
.env.exampleis enough), each later commit gets the same refusal until the push. The refusal says to pass--allow-path, but that's areviewflag:hooks::readypasses no allowed paths, and there's no hook setting. UnderonIncomplete=block, every later commit is blocked, and--no-verifyis the only way through.Fix
proofline.hook.<hook>.allowPath, multi-valued (git config --add), read with the other hook settings (git::config_all,--get-all -z) and passed topreflight::check. Same exact-path rules as--allow-path(preflight::exact_path, shared). A bad value is refused by its key before anything is read or sent, likefailOnandtimeout. That includes a value that isn't UTF-8: it is refused rather than read lossily, since two different non-UTF-8 paths can read the same lossy way.preflight::Allowedcarries the paths and anAllowance:Flagkeepsreview's text byte for byte;Hook(name)names the setting.The pre-commit hook, at a later commit:
Overlap with #132: it also edits
hooks::ready(it addscheck_refused). The two changes are independent; I'll rebase on whichever lands first.Overlap with #140: it turns
\into/in--allow-pathinsidelib.rs, so hook values wouldn't get that rule; thepreflight::checkcall it sits next to changes shape here. Either order is a small rebase.Tests (written first; the new test failed on
mainwith the--allow-pathrefusal above)allow_path_lets_later_commits_past_a_refusal_in_unpushed_history(new,tests/hooks.rs).env.example, then a GitHub token inconfig.rs) and a stagedorders.rs, withonIncomplete=block. Each refusal namesproofline.hook.pre-commit.allowPath, not--allow-path, and never prints the token. Nothing is uploaded until both paths are allowed. Then the commit is reviewed (exit 0) and the patch holds both the history and the staged change./config.rs,./config.rs,src//config.rs, an empty value, and a value with a0xFFbyte written straight into.git/configare each refused by key, with no uploadMutation checks, each of which makes the test fail:
readyignoring the setting (passing&[]), skipping the value check insettings, andconfig_alldecoding values lossily again.End to end with the built binary (Git Bash, a bare local remote): the issue's steps name the setting at each commit; after
git config --add proofline.hook.pre-commit.allowPath .env.examplethe hook moves past the preflight to the next step.review --stagedstill prints--allow-path, unchanged.Checks
cargo fmt --check: ✅cargo clippy --locked -- -D warnings: clean on the lib, the bins and every integration test.--all-targetsstops at the 2 errorsmainalready has on Windows (src/agent/tests.rs).cargo test --locked: the new test passes. On Windows, 12 tests outside this change fail, the same as onmain(mcp, agent install, update, a file name Windows forbids, a Windows push URL).cargo deny check: no dependency changes.checkandwindowsgreen on ammar-taha-dev/proofline-cli#3 (commit88c929b).Proofline review log
Fork review PR: ammar-taha-dev/proofline-cli#3. Rounds capped at 2.
config_allinsrc/git.rspromises arbitrary-byte values but decodes Git output lossily as UTF-8. Recommended: document that values keep whitespace and newlines, replace invalid UTF-8 and are split on NULallowPathconfig_allkeeps, and the test covers it (written first, failed before the change)The prompts below are the ones that drove this implementation; the investigation, reproduction and fix scope were done before them and aren't included.