Repository navigation
feat(validate): read Python, Rust, PHP and Java dependency files - #10
Merged
Merged
Conversation
The stack check only knew go.mod and package.json, so a Python or Java
project got no findings at all: dependencies() came back empty and Stack
returned before it ever looked for docs/stack.md. Silence is the right
answer for an ecosystem scc cannot read, but it also meant the rule the
whole knowledge base is built on held in exactly two ecosystems.
Five readers, each with a parse that cannot be wrong:
requirements.txt one requirement per line, PEP 508 names; options,
markers, extras and direct URLs all fall out
pyproject.toml PEP 621, PEP 735 and Poetry's own tables
Cargo.toml dependencies, dev-, build-, per-target, workspace,
and the [dependencies.<crate>] long form
composer.json require and require-dev, minus the platform keys
pom.xml project/dependencies/dependency and nothing else,
so dependencyManagement and profiles stay out
The two TOML files share a reader that recognizes exactly two shapes, a
table header and a key = value line, and ignores everything else. It is
not a TOML parser and the comment says so: an array that never closes
yields nothing rather than half a dependency list.
Also: a dependency documented with the other separator now counts. PyPI
treats Flask-SQLAlchemy and flask_sqlalchemy as one project, and an extra
spelling can only remove a finding, never add one.
The readers move to stack_manifests.go. The rule is fixed; the readers
grow whenever somebody uses an ecosystem scc cannot see.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GchWF6iL5PjTdXAT8H3mhb
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.
The
stackcheck knewgo.modandpackage.json. Everything else got zero enforcement:dependencies()came back empty, andStackreturned before it ever looked fordocs/stack.md. Silence is the correct answer for a file scc cannot read — it is why a Python project never failed — but it also meant the rule the knowledge base is built on held in exactly two ecosystems.Five readers
requirements.txt-r,-e,--hash), comments, markers, extras, direct URLs and backslash continuations all fall outpyproject.toml[project] dependencies,optional-dependencies), PEP 735 (dependency-groups), and Poetry's tables including per-groupCargo.tomldependencies,dev-,build-,[target.'cfg(…)'.dependencies],[workspace.dependencies], and the[dependencies.<crate>]long formcomposer.jsonrequireandrequire-dev, minus the platform keys (php,ext-*,lib-*)pom.xmlproject/dependencies/dependencyand nothing else —<dependencyManagement>pins versions rather than adopting, and a<profile>'s dependencies may not applybuild.gradle,Gemfile,mix.exsandPackage.swiftare deliberately absent: those manifests are executable code, and reading one honestly would mean evaluating it.The TOML reader is not a TOML parser
pyproject.tomlandCargo.tomlshare one, and its doc comment says outright that it must not become a parser. It recognizes exactly two shapes — a table header alone on a line, andkey = valueunder it — which is how every dependency table in the wild is written, and ignores everything else. An array that never closes yields nothing rather than half a dependency list.Two behavior changes worth reviewing
Flask-SQLAlchemyandflask_sqlalchemyas one project. Each candidate spelling is now also tried with the separators swapped — and an extra spelling can only remove a finding, never add one, which is what makes the generosity safe.TestAnEcosystemWithNoReaderIsNotCheckeddrops aGemfile, amix.exsand abuild.gradlein a root and requires zero findings. That property was true before this PR by accident of control flow; it is now a test.Structure
The readers move to
internal/validate/stack_manifests.go. The rule is fixed; the readers grow whenever somebody uses an ecosystem scc cannot see, and that difference in tempo is why they no longer share a file. Its header states the three rules every reader obeys — absent is not an error, direct dependencies only, and what cannot be read confidently is not read at all.gofmt,go vet,go test ./...clean.🤖 Generated with Claude Code
https://claude.ai/code/session_01GchWF6iL5PjTdXAT8H3mhb