Skip to content

Import contract C7/C8; scala truth-side fixes take scala recall 51.6 → 93.5 (#3641) - #3666

Merged
squid-protocol merged 2 commits into
mainfrom
claude/festive-fermat-kojuy7
Sep 25, 2026
Merged

squid-protocol merged 2 commits into
mainfrom
claude/festive-fermat-kojuy7

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Part of #3641. Follows #3661. This settles the Scala truth-names-several-files shape that #3661 left open.

Rulings (decided 2026-09-25, docs/import_rule_contract.md)

  • C7 · A whole-package wildcard (import io.circe._, import a.b.*) is an edge to the package's own file, the Scala package object, or to nothing.
    • Never one edge per file of the package: a 40-file package would get 40 edges per importer and tilt PageRank toward big packages.
    • The comparison scores Scala and Kotlin by this rule. Java and Go keep "any file of the package", because nothing there disagrees.
  • C8 · A build-variant copy (scala-2/ vs scala-3/, a symlinked include/ copy) resolves to the importer's own variant. The engine fix is filed as Import resolver: a build-variant copy resolves to the importer's own variant (import contract C8) #3665.

Truth-side bugs in import_graph_accuracy.py (mechanical, so fixed in code)

Applying C7 exposed that most of the 410 were never GitGalaxy's:

  1. Imports indexed as declarations. A top-level Scala import_declaration was indexed as a declaration of its first name. Every file importing cats.x "declared" cats, so every external cats.* / scala.* import resolved to 35–41 in-repo files.
  2. Member imports cut into the package. The drop-names-to-reach-the-object step could cut back into the enclosing-package prefix (munit.FunSuite, retried under io.circe, became package object circe). It could also cut two names down to a lowercase package (io.circe.optics.JsonPath became circe).

Result

scala before after
resolvable imports 1006 521
recall 51.6% 93.5%
precision 99.4% 98.8%

Baseline regenerated. The 16 multi-file misses left are all scala-2/scala-3 pairs (semiauto.scala), validated in the ledger as GitGalaxy misses (#3665).

Verification

  • New tests:
    • C7 package wildcards (package object, or none);
    • an import is not a declaration;
    • member imports never cut into the package, while io.circe.syntax.EncoderOps still reaches syntax/package.scala;
    • one Kotlin expectation updated to C7.
  • 32 tool tests pass.
  • import_graph_accuracy --ci OK (20 languages).
  • Ledger re-merged on top of the post-Graph comparison: imports join the ledger — causes by layer, validated numbers (#3641) #3661 bot refresh: 28 verdicts, nothing stale.
  • ruff audit clean. No engine code changes, so there's no golden or rosetta impact.

🤖 Generated with Claude Code

https://claude.ai/code/session_01YAtpBfGGyBGGovitSVaM5Q


Generated by Claude Code

…-> 93.5 (#3641)

Decided 2026-09-25 (docs/import_rule_contract.md):
- C7: a whole-package wildcard (`import io.circe._`, `import a.b.*`) is an
  edge to the package's own file (a scala `package object`) or to nothing --
  never one edge per file of the package. The comparison scores scala and
  kotlin by it; java/go keep "any file of the package" (nothing disagrees).
- C8: a build-variant copy (scala-2/ vs scala-3/, a symlinked include/ copy)
  resolves to the importer's own variant. Engine fix filed as #3665.

import_graph_accuracy truth side (mechanical, so code):
- a top-level scala `import_declaration` was indexed as a DECLARATION of its
  first name, so every file importing `cats.x` "declared" `cats`, and every
  external `cats.*` / `scala.*` import resolved to 35-41 in-repo files;
- a member import could cut back into the enclosing-package prefix
  (`munit.FunSuite` retried under io.circe -> package object circe) or two
  names down to a lowercase package (`io.circe.optics.JsonPath` -> circe).
Together they were 410 "missed" imports that were never GitGalaxy's.

scala: 1006 -> 521 resolvable imports, recall 51.6 -> 93.5, precision
99.4 -> 98.8 (baseline regenerated). The 16 remaining multi-file misses are
all scala-2/scala-3 pairs: validated as GitGalaxy misses (#3665).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01YAtpBfGGyBGGovitSVaM5Q
)

The full-suite job does not install tree-sitter-language-pack; the scala
tests parse with it, so they skip there, like test_import_graph_accuracy's
own `needs_ts` tests. The ledger/geometry tests still run everywhere.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01YAtpBfGGyBGGovitSVaM5Q
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-protocol
squid-protocol merged commit 916063e into main Sep 25, 2026
30 checks passed
@squid-protocol
squid-protocol deleted the claude/festive-fermat-kojuy7 branch September 25, 2026 18:51
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.

2 participants