Repository navigation
fix/issues-73-77-78: Artifact discovery skips what the analysis skips, its own outputs, and links out of the project - #84
Merged
Conversation
…puts, and links out of the project (#73, #77, #78) - #78: discovery had its own skip list (.git, vendor) and checked it only on directories. It now uses utils.IsVendored, the Go analysis's rule, on every entry: vendor/, testdata/ and .git are skipped, also a .git file (a git worktree or submodule), whose gitdir: line holds an absolute host path. - #77: the -o and -c directories are skipped whole when they are inside the project, as in the Python analyzer. One that holds the project root (-o .) is not, because that would empty the inventory; only analysis.json and graph.cypher in it are skipped. With --emit neo4j and no -o, the graph.cypher in the current directory is skipped, so two runs from the project root write the same snapshot. - #73: a symlinked file is followed when its target is a regular file inside the project and not in a skipped path. It is recorded under the link's path, so a symlinked go.mod is the artifact its dependencies name. A link to a directory or to outside the project is still skipped. Tests: a symlinked go.mod, a link to outside the project, testdata and .git files, the whole -o directory and the working-directory graph.cypher, an -o / cache directory that holds the project, and two --emit neo4j runs from the project root. The new behavior tests fail on the old code. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The spec named only the Python types (PyArtifact, PyDependency, PyConfigKey). It now names the Go analyzer model (schema.GoArtifact, schema.GoDependency), the emitted types (v2.Artifact, v2.Dependency), and says there is no config-key type yet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Fixes #73. Fixes #77. Fixes #78.
Artifact discovery now uses the same skip rule as the Go analysis, skips this tool's own output files, and follows a symlinked file only when the target is inside the project.
Motivation and Context
--artifact-textis on by default (#83). So a file that discovery captures by mistake also puts its whole text into the JSON and the graph..git,vendor), and it checked the list only on directories. It now usesutils.IsVendored, the rule of the Go analysis, on every entry:vendor/,testdata/and.gitare skipped. This includes a.gitfile (a git worktree or a submodule), whosegitdir:line has an absolute host path.graph.cypherin the working directory is captured as an artifact #77: the-oand-cdirectories are skipped whole when they are inside the project, as in the Python analyzer. If one of them holds the project root (for example-o .), discovery does not skip it whole, because that would empty the inventory. It skips onlyanalysis.jsonandgraph.cypherin it, and writes a warning. With--emit neo4jand no-o, discovery skips thegraph.cypherin the current directory. Two runs from the project root now write the same snapshot.go.modis the artifact that its dependencies name. A link to a directory, or to outside the project, is still skipped.How Has This Been Tested?
go.mod;testdata/and.gitfiles;-odirectory and the working-directorygraph.cypher;-oor cache directory that holds the project.--emit neo4jtwo times from the project root. The two snapshots are the same.go test ./...and golangci-lint pass.Breaking Changes
testdata/are no longer artifacts. Python and TypeScript keep their test folders; Go follows the Go toolchain, which ignorestestdata/.-odirectory inside the project are no longer artifacts.Types of changes
Checklist
Additional context
docs/design/specs/v2-artifacts.md, "Excluded paths". It also names the Go types now (schema.GoArtifact,schema.GoDependency, emitted asv2.Artifact,v2.Dependency).-o ., each run writes a warning that the output directory holds the project. Python writes the same warning.