Repository navigation
🌱 Add a package-manager table and AGENTS.md - #5428
Merged
justaugustus merged 3 commits intoNov 6, 2026
Merged
Conversation
Agents asked to simplify Scorecard code need rules that generic refactoring guidance lacks: output and scores must not change, exported API is never removed or deprecated (Hyrum's Law), and thin coverage gets characterization tests before any change. CONTRIBUTING.md already covers the contribution process, so AGENTS.md points there instead of repeating it. - Track the root AGENTS.md; nested ones stay ignored as personal tooling files. - Route AGENTS.md to scorecard-maintainers. Without its own entry, *.md sends it to doc maintainers, but the file holds code rules. Assisted-by: LLM Signed-off-by: Stephen Augustus <foo@auggie.dev>
Existing tests count unpinned shell downloads but never check the dependency type for Go or npm commands, or the remediation text attached to unpinned NuGet commands. Pin the full dependency each package manager produces, pinned and unpinned, so a refactor of `collectUnpinnedPackageManagerDownload` can be checked without changing tests. Assisted-by: LLM Signed-off-by: Stephen Augustus <foo@auggie.dev>
`collectUnpinnedPackageManagerDownload` repeated the same dependency construction five times, once per package manager, so adding a package manager meant copying a 20-line branch. A table of detector, pinned test, dependency type, and remediation text now drives one loop, checked in the original order with first match winning. Each unpinned NuGet dependency still gets its own `Remediation`, because NuGet post-processing appends to its text in place. Results are unchanged: the tests added in the previous commit pass without modification. The function drops from 125 to 47 lines, gocognit 10 to 9, and the file's one `dupl` clone group is gone. Assisted-by: LLM Signed-off-by: Stephen Augustus <foo@auggie.dev>
justaugustus
requested review from
spencerschrock
and removed request for
a team
November 6, 2026 11:38
justaugustus
temporarily deployed
to
integration-test
November 6, 2026 11:38 — with
GitHub Actions
Inactive
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5428 +/- ##
===========================================
+ Coverage 66.80% 79.59% +12.79%
===========================================
Files 230 264 +34
Lines 16602 14838 -1764
===========================================
+ Hits 11091 11811 +720
+ Misses 4808 3026 -1782
+ Partials 703 1 -702 🚀 New features to boost your workflow:
|
justaugustus
enabled auto-merge (rebase)
November 6, 2026 11:48
justaugustus
disabled auto-merge
November 6, 2026 11:50
This branch was previously 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.
What kind of change does this PR introduce?
Agent guidance for simplifying code, plus one simplification that follows it (infra/tests/other). No change to
scores, findings, or output.
What is the current behavior?
Scorecard has no agent guidance;
.gitignoreexcludesAGENTS.md. An agent asked to simplify code here falls back ongeneric refactoring advice, which allows deleting "unused" exported functions and editing tests until they pass.
In pinning detection,
collectUnpinnedPackageManagerDownloadbuilds the same dependency five times, once per packagemanager, so adding one means copying a 20-line branch. Its tests never check the dependency type for Go or npm
commands, or the remediation text on unpinned NuGet commands.
What is the new behavior (if this is a feature change)?
Behavior is unchanged. This PR has three commits:
AGENTS.mdwith a simplification section: scope to one target, add characterization tests first wherecoverage is thin, never change tests in the simplification itself, and a list of what a simplification must not
touch (output, scores, flags, exported API, error and token handling). It points to
CONTRIBUTING.mdfor thecontribution process rather than repeating it.
.gitignorenow tracks the rootAGENTS.mdand still ignoresnested ones.
CODEOWNERSsends it to@ossf/scorecard-maintainers, since*.mdwould otherwise route code rulesto doc review.
TestCollectUnpinnedPackageManagerDownload: the full dependency for a pinned and anunpinned command per package manager, plus a command that isn't one.
kept, and the first match still wins. The function goes from 125 lines to 47, and the file's duplicated block is
gone.
Which issue(s) this PR fixes
NONE
Special notes for your reviewer
Main question: are these the rules you want agents to follow? The
AGENTS.mdlist is the part that outlives thisPR. Two rules are stricter than common refactoring advice: exported API is never removed, renamed, or deprecated as
part of a simplification, even with no callers found, and existing tests never change in the same commit.
In the refactor, each unpinned NuGet dependency still gets its own
finding.Remediation. Sharing one pointer from thetable would be shorter, but
collectPostProcessNugetCPMDependenciesappends toRemediation.Textin place, so thesuffix would leak across dependencies. The tests don't cover that path; a comment marks it.
Out of scope: the
is*Downloadandis*Unpinneddetectors, which carry most of this file's bug-fix history. Thecontribution and review sections of
AGENTS.md, andCODEOWNERSfor other agent config files, are separate work.Verification beyond CI: with the new test in place, I changed the npm dependency type and one word of the NuGet text,
and 3 cases failed.
Rollback: each commit reverts on its own; please rebase-merge.
Does this PR introduce a user-facing change?