Repository navigation
Import graph (Kotlin): an import of a top-level property resolves to the file that declares it - #3749
Merged
Merged
Conversation
…its file (#3660) #3596 resolves `import a.b.name` to the file declaring `name`, but indexed only functions and classes, so kotlinpoet's imports of extension properties (`internal val KmConstructor.isPrimary`) resolved to nothing. - kotlin `_declaration_capture` (a registered helper key): unindented top-level `val`/`var` names, any receiver (`KmType?.`, `<T> List<T>.`), annotations (incl. `@get:`) and modifiers first, never `private`. Bounded. - galaxyscope runs it over the code stream into the file's `declared_names`; the resolver indexes them beside functions and classes. - file_data.declared_names (JSON, NULL when none) + the rehydrator, so a delta scan resolves the same edges (the #3220 raw_imports precedent). import_graph_accuracy (kotlin): recall 95.2% -> 99.2% (FN 18 -> 3), precision 100%. No other language moved; golden masters unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01GCpfMCUMpco98QGbsuv2sr
Contributor
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
Fixes #3660: its Kotlin shape, the last one left after #3743. Part of #3641.
#3596 resolves a Kotlin
import a.b.nameto the file that declaresnameunder a directory matchinga/b. Its declaration index held only functions and classes, so imports of top-level properties resolved to nothing. On square/kotlinpoet that's 17 imports, such asimport com.squareup.kotlinpoet.metadata.isPrimaryforinternal val KmConstructor.isPrimary: Booleaninmetadata/util.kt.Changes:
kotlin_declaration_capture, a helper key registered insignal_contracts.HELPER_KEYS. It matches unindented top-levelval/varnames (members of a class or object are indented), and allows:KmType?.,<T> List<T>.;@get:JvmName("x");private, which no other file can import and which would only add false ambiguity.Group 1 is the name, and every quantifier is bounded.
The scan worker runs it over prism's code stream, so commented-out code is never indexed, and records the matches as the file's
declared_names.The resolver (
_build_resolution_map) indexesdeclared_namesbeside functions and classes for declaration-import languages.Persistence:
file_data.declared_namesstores a JSON list, NULL when the file declares none. It's added to the CREATE statement, the upgrade guard for existing databases, and the INSERT, and the rehydrator restores it. An unchanged file's properties therefore still resolve imports on a delta scan, following the Delta scan (--incremental) is broken: silent full-scan fallback masks partial persistence + signal drift #3220raw_importsprecedent. A test round-trips it.docs/signal_contracts.mdis re-rendered for the new helper key.Type of change
gitgalaxy/core/detector.py,language_standards.py,prism.py, or a per-language rule)CI checklist
python tests/tools/audit_check.pypasses (bundles the ruff/mypy/dead-key baseline-gated audits +ruff format --check)python -m pytest tests/passespython tests/tools/crucible_check.pypasses: no drift in either modepython tests/tools/tree_sitter_accuracy_audit.py --all --cipassesfile_datacolumn (SQLite) with an upgrade guard for existing databases; no JSON output changes.Measurements
import_graph_accuracy.py, all 20 languages:No other language moved; the baseline is regenerated.
Three misses remain:
Taggable.kt. I haven't looked into that shape; it isn't a property.Golden masters: no drift in either mode. The crucible's Kotlin samples don't import top-level properties.
keyword-rosetta: 51 languages, 0 regressions. X-Ray: 0 anomalies, checked locally this time before pushing.
Differential Scan target
The import-graph corpus: square/kotlinpoet.
Verification
The new test file covers:
objectmember);declared_names;🤖 Generated with Claude Code
https://claude.ai/code/session_01GCpfMCUMpco98QGbsuv2sr
Generated by Claude Code