Skip to content

D270 — pr-scope leaves out what .gitattributes marks linguist-generated (#497) - #500

Merged
napkinstack-agent[bot] merged 2 commits into
mainfrom
d270-pr-scope-linguist-generated
Nov 23, 2026
Merged

napkinstack-agent[bot] merged 2 commits into
mainfrom
d270-pr-scope-linguist-generated

Conversation

@napkinstack-agent

Copy link
Copy Markdown
Contributor

Workstream

D270, from #497. Its row is in docs/governance/workstreams.md.

What it changes

05-workflow.md §4 leaves generated files out of the review budget (P2), but pr-scope recognised them only by a fixed name pattern. Downstream, a project commits the licence notices that cargo-about writes. P2 counted those 238 lines of HTML: the pull request came to 591/400 lines, against 353/400 without them. Every pull request that added a dependency merged as over-budget for that reason alone (four so far).

Now pr-scope also leaves out every changed path that HEAD's .gitattributes marks linguist-generated. GitHub uses this convention to fold such files in its diffs, and the skeleton already applies it to the skills. The attribute is read the way GitHub reads it:

  • any value except false marks a path generated, linguist-generated=1 included;
  • =false and -linguist-generated keep a path counted;
  • the attributes come from HEAD, the commit being measured, through git check-attr --source HEAD. A git older than 2.40 falls back to the working tree;
  • paths outside ASCII are read unquoted (core.quotepath=off).

P2 stays a warning. Declaring a file generated takes a line in .gitattributes, and a reviewer sees that line.

Not taken: guessing generated files from their content or a header.

Left as they were:

  • A file renamed into a declared folder is still counted, as it already is under the name pattern. --no-renames would count a moved file twice, which would turn green results red.
  • A name that holds a tab or a quote stays quoted.

Fresh verifier

Findings fixed in the second commit:

  • the attributes were read from the working tree, not from the commit measured;
  • linguist-generated=1, which GitHub treats as generated, was counted.

What a project receives

The engine (fitness/pr_scope.py) and 05-workflow.md §4. Nothing that was green turns red. A budget inflated by declared generated files goes down.

Definition of Done

  • The behaviour is covered by a test that failed before: a declared notice of 500 lines counted, 811/400. It is now 16/400. The same test covers =true, a bare attribute, =false, =1, -linguist-generated, and an uncommitted edit of .gitattributes.
  • Every failure names the rule, the place and the action (P6)
  • uv run bash platform/tests/run.sh green, on a committed tree
  • uv run nstack fitness green
  • Affected documentation updated
  • The workstream's row updated in the register
  • No private project named, no path of a workstation, no link into an assistant's session

🤖 Generated with Claude Code

napkinstack-agent Bot and others added 2 commits November 23, 2026 09:05
…ed (#497)

The review budget knew generated files only by a fixed name pattern; a
tool's output a project declares linguist-generated (cargo-about's licence
notices) was counted. pr-scope now asks git check-attr for every changed
path and leaves out those set or true; =false keeps a path counted.
05-workflow.md §4 says it.

Agent-Session: napkinstack-os-77
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ads them

check-attr read the working tree's .gitattributes while the numstat measures
HEAD; it now reads --source HEAD (a git before 2.40 falls back to the working
tree). Any value but false is generated, as Linguist reads it, so
linguist-generated=1 is left out too.

Agent-Session: napkinstack-os-77
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@napkinstack-agent
napkinstack-agent Bot requested a review from a team as a code owner November 23, 2026 08:09
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.

1 participant