Skip to content

fix/issues-70-72-81: Neo4j artifact layer matches the Python and TypeScript analyzers - #83

Merged
rahlk merged 4 commits into
mainfrom
fix/issues-70-72-81-neo4j-artifact-layer
Nov 29, 2026
Merged

rahlk merged 4 commits into
mainfrom
fix/issues-70-72-81-neo4j-artifact-layer

Conversation

@rahlk

@rahlk rahlk commented Nov 29, 2026

Copy link
Copy Markdown
Contributor

Fixes #70. Fixes #72. Fixes #81.

The Neo4j artifact layer now writes the same facts as the Python and TypeScript analyzers, and an --eager push no longer deletes artifacts that those analyzers share.

Motivation and Context

:Artifact, :Package, DECLARES_DEPENDENCY and LOCKS are shared with the sibling analyzers. When they run on the same repository, they write to the same nodes.

  • Neo4j :Artifact node has no source and other key fields that the JSON has #81: :Artifact had only path and format. It now has kind, path, format, roles, size_bytes, sha256, source and extraction, as the siblings write them. Empty values are left out.

  • Neo4j projector builds package and lockfile ids instead of reading them from the JSON #72: the LOCKS edge always came from the root go.sum. A dependency now records locked_in, the go.sum artifact that locked it, and the projector reads it. v2.PackageID is now the one function that builds a package id.

  • LOCKS property: renamed from locked_version to version, the name the siblings use.

  • Neo4j push never removes artifacts and dependencies that are gone #70: an --eager push deleted every artifact node of the app, including the nodes and edges that Python and TypeScript wrote. The eager purge now skips :Artifact. An eager full push reconciles the artifacts, as the siblings do:

    1. It deletes the Go-owned edges on the app's artifacts.
    2. It releases each artifact that the run does not have, and deletes the node only when no analyzer still has a HAS_ARTIFACT edge to it.

    A lazy push and a -t push reconcile nothing, because a lazy push never deletes.

  • --artifact-text: on by default. --no-artifact-text turns it off. These are the siblings' flags and default.

How Has This Been Tested?

  • Unit tests for locked_in, v2.PackageID, the :Artifact properties, LOCKS from a nested tools/go.sum, and the flags. Each one fails on the old code.
  • Fake-DB tests: the reconcile queries are scoped to the app, and they run only on an eager full push, before the first artifact write.
  • Live Neo4j tests (neo4j_it):
    • an eager push removes a deleted file and a removed require;
    • a lazy push keeps them;
    • another analyzer's HAS_ARTIFACT and DECLARES_DEPENDENCY on a shared artifact survive an eager push. This test fails on the old code.
  • All eight integration tests pass. go test ./... and golangci-lint pass.

Breaking Changes

  • The LOCKS property is now version, not locked_version. The SDK Go backend does not read it.
  • --artifact-text is on by default, so analysis.json and the graph have each text file's source. Use --no-artifact-text for the old output. Very large text files use much memory (--artifact-text uses approximately 5 times the file size in memory #80).
  • The JSON gets an additive field: dependencies[].locked_in.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the Codellm-Devkit Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

  • An eager full push already removed stale artifacts before this PR, because it deleted all of them. This PR keeps that result, but it no longer deletes the data of the other analyzers.
  • The graph.cypher snapshot still deletes and rebuilds the app's artifacts, as the Python snapshot does.
  • Spec: docs/design/specs/v2-artifacts.md.

Rahul Krishna and others added 4 commits November 29, 2026 17:17
…72)

A dependency's locked_version came from a go.sum, but the JSON did not say
which one. The Neo4j projector then used the root go.sum for every LOCKS
edge. A dependency of a nested go.mod would get a LOCKS edge from a go.sum
that did not lock it.

The dependency now carries locked_in, the id of the go.sum artifact that gave
locked_version, in the same way declared_in names its go.mod. It is additive
and omitted when the dependency is not locked.

v2.PackageID is now the one function that builds a package id
(pkg:<ecosystem>/<name>), as the sibling analyzers use one purl helper.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s do (#81, #72)

- :Artifact now carries kind, path, format, roles, size_bytes, sha256,
  source and extraction: the JSON artifact's fields. Before, it had only
  path and format, so a consumer of the shared node got the text and hash
  from a Python or TypeScript push and nothing from a Go push. Empty values
  are left out. (#81)
- LOCKS comes from the dependency's locked_in artifact, not the root go.sum,
  and the package id comes from v2.PackageID. (#72)
- The LOCKS property is now version, the name Python and TypeScript use, not
  locked_version. The SDK Go backend does not read it.

The artifacts spec and CLAUDE.md record the decisions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… them wholesale (#70)

The eager whole-app purge deleted every :GoCanNode under the app, and
:Artifact carries :GoCanNode. :Artifact is shared with the Python and
TypeScript analyzers, so an eager Go push deleted their artifact nodes too,
with their edges (DECLARES_DEPENDENCY to pkg:pypi/..., config-key edges).

The purge now skips :Artifact. An eager full push reconciles the app's
artifacts before it upserts them, with the siblings' claim model
(codeanalyzer-python PURGE_ARTIFACT_EDGES, RELEASE_VANISHED_ARTIFACTS):

1. delete the Go-owned edges on the app's artifacts: HAS_ARTIFACT from
   :GoApplication, incoming GO_ edges, and DECLARES_DEPENDENCY / LOCKS to
   pkg:golang/ packages. The push writes them again from this run;
2. for each artifact this run does not have, remove :GoCanNode and delete the
   node only when no analyzer still has a HAS_ARTIFACT edge to it.

A lazy push and a -t push reconcile nothing (a lazy push never deletes), as
in the sibling analyzers. Stale rows stay until the next --eager full push.
The graph.cypher snapshot keeps its whole-app wipe, as Python's does.

Tests: the query scope and the order (reconcile before the first artifact
MERGE, only on eager full runs) on the fake DB; and three live tests
(neo4j_it): an eager push removes a deleted file and a removed require, a
lazy push keeps them, and a sibling's HAS_ARTIFACT and DECLARES_DEPENDENCY on
a shared artifact survive an eager push. The last one fails on the old code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… it off

--artifact-text was off by default, so a Go push wrote :Artifact without
source unless the user asked for it. Python and TypeScript capture the text by
default and offer --no-artifact-text. The Go flags now do the same:
--artifact-text is on by default (still accepted), and --no-artifact-text
keeps the artifact inventory and drops the text.

Cost: each text artifact is read a second time and its text is in the output.
That is small for normal files; very large text files are #80.

Also drops the issue and date tags this branch added to CLAUDE.md (review).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@rahlk
rahlk merged commit eae64e3 into main Nov 29, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant