Skip to content

feat(java): TrackerV2-compatible HashUID identity for Java nodes - #2429

Open
yvshu-123 wants to merge 2 commits into
DeusData:mainfrom
yvshu-123:dev_zzc
Open

yvshu-123 wants to merge 2 commits into
DeusData:mainfrom
yvshu-123:dev_zzc

Conversation

@yvshu-123

Copy link
Copy Markdown

Java nodes now carry the identity TrackerV2 computes: the eight fields name|signature|path|condition|logical_module|type_id|language_type_id|duplicate_fingerprint MD5-hashed into a hashuid property, with a unique expression index.

Two commits:

  1. feat(java): make the parameter type list part of a member identity — overloads become separate nodes instead of collapsing onto one (class, name) key, in the extractor, the unified call walk and the Java LSP; every name-based lookup that assumed Class.method learns the same rule.
  2. feat(java): stamp a TrackerV2-compatible HashUID on Java nodes — MD5, the predump pass, the extraction-time inputs it needs, anonymous-class members as real scopes, and docs/JAVA-HASHUID.md.

Verified against the TrackerV2 scanner on the same revision (649 Java files, commit b6016d94): 3,223 identities on both sides (class 584 / interface 103 / enum 24 / method 2,350 / constructor 162), 3,221 hashed inputs byte-identical. The two remaining differences are TrackerV2s own spread-parameter bug, where an int[]... parameter is dropped by its signature extractor.

Known deliberate differences, both documented:

  • Body-less declarations (interface / abstract / native) are stamped too; TrackerV2 stops at declarations with a body. They are one filter away (hasBody:false).
  • int[]... varargs keep the parameter that TrackerV2 drops.

CALLS edge quality does not regress: 9,428 -> 9,733 edges on the reference corpus, high-confidence share 50.0% -> 54.0%. Affected suites (extraction, parallel, java_lsp, repro, store) pass.

A Java member's qualified name now carries its parameter type list, so overloads are separate nodes instead of collapsing onto one (class, name) key -- in the extractor, the unified call walk, and the Java LSP, which each used to spell the QN themselves.

Every name-based lookup that assumed 'Class.method' learns the same rule: the registry's by_name index key, the same-module and import-map probes, qualified-tail matching, the LSP leaf/tail joins, the reference matcher, and the four tests whose assertions encoded the old spelling.
Java Class, Interface, Enum, Method and Constructor nodes now carry the identity TrackerV2 computes: the eight fields name|signature|path|condition|logical_module|type_id|language_type_id|duplicate_fingerprint joined by '|' and MD5-hashed, written as the hashuid property next to hashInput, canonicalSignature, logicalModule, typeId and languageTypeId, with a unique expression index enforcing it.

Contents:
  - src/foundation/md5.{c,h}: RFC 1321, byte-compatible with hashlib.md5. Used only to reproduce this digest.
  - src/pipeline/pass_hashuid.c: a predump pass that walks the container chain for logical_module, groups declarations by their seven-field key within a file, assigns TrackerV2's duplicate_fingerprint (sha256 of the declaration text plus the group index, ordered by start/end line), and stamps the result. Overloads, fields and the container chain are resolved by QN lookup, so it runs after every file is extracted.
  - Extraction records what the identity needs and the graph cannot recover later: hasBody, javaMemberKind for constructors, javaTypeKind for records/annotations/anonymous scopes, and declHash (sha256 of the declaration's source text).
  - Anonymous classes become real scopes: their members are extracted as nodes under a \<Type>@<byte offset> scope (the offset keeps several same-type anonymous classes apart, while the scope NAME stays \<Type> so logical_module is unaffected), and the unified call walk plus the Java LSP push the same scope so calls inside the body attribute to the member instead of falling back to the File node.
  - docs/JAVA-HASHUID.md documents the field, the coverage, the rules, the queries and the deliberate differences.

Body-less declarations (interface/abstract/native) are stamped too: TrackerV2 stops at declarations that have a body, cbm tracks the declaration itself, so this is a deliberate superset -- identifiable by hasBody:false.

Verified against the TrackerV2 scanner on the same revision (649 Java files, b6016d94): 3,223 identities on both sides, 3,221 hashed inputs byte-identical, the two remaining differences being TrackerV2's own spread-parameter bug (an int[]... parameter is dropped by its extractor).
@yvshu-123
yvshu-123 requested a review from DeusData as a code owner September 29, 2026 07:28
@github-actions

Copy link
Copy Markdown

Thanks for opening this — it has been seen, and it is queued.

This note is automated, but it is not a brush-off: it exists so you know where your PR stands instead of having to guess from silence.

Current review status: working through a backlog. 0.9.1-rc.1 is out, so the release freeze that held reviews is over — but it left a large queue of open pull requests behind it, and we are reading through them oldest-first. The background is in discussion #1144.

What that means for this PR, concretely:

  • It will not be closed for inactivity. No stale bot touches pull requests here.
  • It may still sit a while before a human reads it. That is on us, not on you.
  • Older PRs are read first, so a recent one is not being skipped — it is behind a queue.

Things that will genuinely speed it up whenever review does happen:

  • Keep it rebased on main — the tree is moving quickly right now, and a conflicting branch cannot be reviewed as the diff you intended.
  • Get CI green, or say which failures you believe are pre-existing.
  • Keep the change to one claim. Bundled features and refactors get split before they get merged, which costs you a round trip.
  • Every commit needs a sign-off (git commit -s) — CI enforces DCO.

If this fixes a bug, a reproduction we can run is worth more than a description of the symptom.

Thanks for contributing, and sorry in advance for the wait.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant