Repository navigation
feat(repo): push scope pre-filter to the git layer - #76
Merged
Merged
Conversation
Picks up the scope half of the scope/author pushdown split from issue #55 (the author half is already on main: buildLogArgs passes --author). LogOptions gains an optional scope string; when set, GitClient.log composes a coarse conventional-commit scope grep: --all-match ANDs it with the Lore-id pre-filter instead of git's default OR across multiple --grep patterns, --regexp-ignore-case keeps the coarse pass case-insensitive like the parser-level filter, and the scope value is escaped for POSIX ERE so metacharacters in user input stay literal (escaping non-metacharacters is undefined in POSIX, so only those are escaped). findByScope passes its scope through; its exact conventional-commit subject filter stays authoritative, unchanged. The scope grep is a substring over the whole message, deliberately coarser than the subject filter: git skips commits that never mention (scope) at all, and false positives cost only a parse. Documented no-drop boundary: the coarse grep cannot drop an atom whose subject is a single ASCII line (the parser-level filter's matches always carry a literal case-folded (scope) line); wrapped multi-line subjects and non-ASCII case folding (git folds bytes, JavaScript folds Unicode) are the documented residuals, recorded here rather than papered over. Three documented side effects of the global --regexp-ignore-case flag: author patterns passed in args become case-insensitive while scope is set, which matches the parser-level author refinement (regression-tested: a case-variant author in a combined scope+author query can no longer be dropped at the git level); the Lore-id pre-filter itself case-folds while scope is set (over-match only, e.g. LORE-ID lines pass the grep; the trailer parser stays authoritative and rejects them); and callers must not pass their own --grep in args alongside scope (git would AND it under --all-match). All three are recorded on LogOptions.scope. Real-git integration tests cover the AND with mixed case, metacharacter escaping, and the author interplay; unit tests pin that findByScope carries the scope option and that every discovery query stays Lore-only. Lore-id: f089a5ea Constraint: The git-level scope filter stays coarse: case-insensitive substring over the whole message; it cannot drop an atom with an ASCII single-line subject, while wrapped multi-line subjects and non-ASCII case folding are documented residuals. Constraint: Multiple --grep patterns require --all-match; git ORs them by default, which would silently return non-Lore commits. Constraint: POSIX ERE escaping covers metacharacters only; escaping other characters is undefined behaviour in POSIX. Constraint: No caller may pass its own --grep in args alongside LogOptions.scope: --all-match would silently AND it into the query. Constraint: --regexp-ignore-case is global: author patterns in args case-fold while scope is set (aligns with the parser-level author refinement), and the Lore-id pre-filter case-folds too (over-match only; the parser stays authoritative). Tested: npm run typecheck: clean Tested: Full suite on Windows: 509 tests in 34 files, all passing Tested: Real-git integration: scope 'api' returns only Lore atoms mentioning (api), case-insensitively, excluding non-atom and other-scope commits; scope 'a.b' matches (a.b) but not (axb); combined scope+author query with a case-variant author returns the atoms Tested: Unit: findByScope passes { loreOnly: true, scope }; all discovery queries stay Lore-only (toMatchObject) Related: d181468e Confidence: high Scope-risk: narrow Reversibility: clean
This was referenced Nov 3, 2026
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.
Picks up the scope half of the scope/author pushdown split from #55 (the author half is already on main:
buildLogArgspasses--author). Extends theloreOnlyhook as proposed in the split.Design.
LogOptionsgains an optionalscope; when set,GitClient.logprepends--all-match --extended-regexp --regexp-ignore-case --grep=\(<ERE-escaped scope>\).--all-matchANDs it with the Lore-id pre-filter (git ORs multiple--greps by default);-imatches the parser-level filter's case-insensitivity; the scope value is escaped for POSIX ERE so metacharacters stay literal.findByScopepasses its scope through; its exact conventional-commit subject filter stays authoritative, unchanged. The scope grep is a substring over the whole message - deliberately coarse: git skips commits that never mention(scope)at all, false positives cost only a parse.Documented no-drop boundary: the coarse grep cannot drop an atom whose subject is a single ASCII line; wrapped multi-line subjects (git joins
%swith spaces) and non-ASCII case folding (git folds bytes, JS folds Unicode) are the documented residuals.Three documented side effects of the global
--regexp-ignore-case(all recorded onLogOptions.scope):LORE-ID:lines pass the grep; the trailer parser stays authoritative).--grepin args alongsidescope(git would AND it under--all-match).All other log call sites are byte-identical when
scopeis absent.Tests: real-git integration (scope
apireturns only Lore atoms mentioning(api)case-insensitively, excludes other-scope and non-atom commits;a.bmatches(a.b)but not(axb); combined scope+author with a case-variant author returns the atoms); unit pins thatfindByScopecarries{ loreOnly: true, scope }and every discovery query stays Lore-only. Typecheck clean, full suite 509/509 on Windows.