Skip to content

feat(declared-literal): --exempt-prefix DIR/ per rule, self-expiring (v1.96.0) - #246

Merged
mjdevaccount merged 1 commit into
mainfrom
claude/declared-literal-exempt-prefix
Dec 4, 2026
Merged

mjdevaccount merged 1 commit into
mainfrom
claude/declared-literal-exempt-prefix

Conversation

@mjdevaccount

Copy link
Copy Markdown
Owner

A consumer is importing a whole repository into a subdirectory (edge-host stack/, the trade-infra
fold). The imported tree carries 71 copies of a path the importing repo's rule forbids; they are
real debt, repointed at a later flip, and the import must stay byte-identical to its source until
then. Declaring each file would also excuse any NEW copy in it; there was no other way to scope.

--exempt-prefix DIR/ attaches to one rule (like --declared) and excuses that rule only, under
that directory only. It is debt, so it is built to end:

  • the files under it are still read, and the summary names the excused line and file counts;
  • a prefix holding no tracked file (wrong path) or no live match any more (debt paid) is exit 2
    until the flag is deleted;
  • a prefix that is not a repo-relative directory ending '/' is exit 2 (a bare vendor would also
    excuse vendored.sh).

Selftest: 8 new cases both directions. Must-fire: dropping the prefix filter from findings_in, or
the "excuses nothing any more" check, each turns the selftest red.

Test plan: ci-declared-literal --selftest OK; pytest tests/test_declared_literal_*.py 122 passed; ruff clean; two mutations verified red.

🤖 Generated with Claude Code

…(v1.96.0)

A consumer is importing a whole repository into a subdirectory (edge-host stack/, the trade-infra
fold). The imported tree carries 71 copies of a path the importing repo's rule forbids; they are
real debt, repointed at a later flip, and the import must stay byte-identical to its source until
then. Declaring each file would also excuse any NEW copy in it; there was no other way to scope.

`--exempt-prefix DIR/` attaches to one rule (like --declared) and excuses that rule only, under
that directory only. It is debt, so it is built to end:
- the files under it are still read, and the summary names the excused line and file counts;
- a prefix holding no tracked file (wrong path) or no live match any more (debt paid) is exit 2
  until the flag is deleted;
- a prefix that is not a repo-relative directory ending '/' is exit 2 (a bare `vendor` would also
  excuse vendored.sh).

Selftest: 8 new cases both directions. Must-fire: dropping the prefix filter from findings_in, or
the "excuses nothing any more" check, each turns the selftest red.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mjdevaccount
mjdevaccount enabled auto-merge (squash) December 4, 2026 14:41
@mjdevaccount
mjdevaccount merged commit aa50ce1 into main Dec 4, 2026
10 checks passed
@mjdevaccount
mjdevaccount deleted the claude/declared-literal-exempt-prefix branch December 4, 2026 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants