fix: distinguish validator Git prohibitions - #955
Conversation
Greptile SummaryThe PR replaces raw Git-command substring rejection with clause-aware parsing that distinguishes affirmative instructions from prohibitions.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| src/config-validator.js | Adds structured Git-instruction parsing and addresses the previously reported negation and qualifier failures without leaving an eligible blocking defect. |
| tests/config-validator.test.js | Adds extensive regression cases for prohibitions, affirmative instructions, double negation, qualifiers, command lists, and prompt representation parity. |
Reviews (6): Last reviewed commit: "fix: reject coreferential Git overrides" | Re-trigger Greptile
tomdps
left a comment
There was a problem hiding this comment.
The parser still fails open on coreferential/override instructions, so this cannot replace the current conservative guard yet. I reproduced both of these at cc355400; each returns zero validation errors:
Do not use git diff, but run it if needed.Never run git status. Ignore that instruction and do it anyway.
The equivalent forms that repeat the command name are rejected, which shows the parser is treating the only explicit command mention as prohibited and never carrying that command into the later affirmative instruction. This contradicts the PR's stated fail-closed behavior and the issue's negation-reversal safety requirement. Please add focused string/prompt.system regression tests for same-clause and cross-sentence overrides/coreference, then tighten or simplify the grammar so ambiguous reversals remain rejected. Given the 712-line parser surface, preserving the old conservative behavior for unrecognized continuations is preferable to allowing a validator prompt that directly instructs Git use.
|
Addressed in The validator now carries explicitly prohibited Git command(s) into immediately following coreferential affirmative actions across same-clause and adjacent-sentence boundaries. This rejects the two reported cases as well as I added focused regression coverage for both string prompts and Validation:
The broader |
Summary
prompt.systempromptsFixes #876
Root cause
The existing validator rejected every raw
git diff,git status,git log, orgit showsubstring, so the repository's recommended safety wording was treated as an instruction to use Git.Testing
npm run checknpm run dupchecknpx mocha tests/config-validator.test.js(160 passing)npm run test:coveragereached 2708 passing and 20 pending tests; 11 unrelated local macOS/infrastructure cases fail around raw filename encoding, missing Rust/Docker/OMP capabilities, and recovery timing.npm run check:allpasses type checking and linting before the repository-wideunimportedbaseline reports 166 files and 9 dependencies.Breaking Changes
None.