fix(analyzer): path-qualify SERVICE node IDs to break PK collisions#151
Merged
Conversation
ServiceDetector emitted node IDs as `"service:" + name`. When a codebase contains two modules in different directories sharing a service name (e.g. `frontend/widgets/checkbox/` and `backend/components/checkbox/` both with `name = "checkbox"` in pyproject.toml) the IDs collided. Kuzu's BulkLoadNodes COPY aborts the whole batch on duplicate PK, so enrich exited non-zero on real polyglot trees (~/projects/, polyglot-bench). Switch IDs to `service:<dir>:<name>`, falling back to `.` for the root module so the format mirrors the existing FilePath stamping. Edge IDs flip from `edge:service:<label>:contains:...` to `edge:<sn.ID>:contains:...` for consistency — sn.ID is now the path-qualified identifier, sn.Label remains the friendly display name. Adds TestServiceDetectorPathQualifiedIDsBreakCollision which fails on main and passes after this patch. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This was referenced May 13, 2026
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.
Summary
`ServiceDetector` emitted node IDs as `service:`. In real polyglot codebases two modules can share a service name (e.g. `frontend/widgets/checkbox/` and `backend/components/checkbox/` both with `name = "checkbox"` in pyproject.toml) and the IDs collided. Kuzu's `BulkLoadNodes` COPY aborts the whole batch on duplicate PK — `codeiq enrich ~/projects/` exited non-zero with:
```
Copy exception: Found duplicated primary key value service:checkbox
```
Fix
Test plan
🤖 Generated with Claude Code