Skip to content

fortran USE targets resolve case-sensitively in the dependency DAG (uppercase legacy style loses the whole import graph) #2540

Closed

Description

@squid-protocol

Summary

Found by the #1096 control corpus (fortran reference folder): fortran USE targets are
resolved case-sensitively in the dependency DAG, but fortran itself is case-insensitive.

Evidence (verified 2026-08-31, end-to-end scans)

Corpus layout: main.f90 → a.f90 → b.f90 → c.f90 via USE statements.

  • With USE A / USE B / USE C (uppercase, classic legacy style): a/b/c record
    popularity = 0, orphaned_logic stays raw (3 each), and the Contextual Baseline Fix
    never fires — the import chain is invisible to network_risk_sensor.py.
  • After changing only the case (USE a / USE b / USE c): the chain resolves,
    orphan→api conversion fires on all three files (api 3 → 6), exactly matching the
    behavior of the python/javascript/cobol/abap/assembly corpus folders.

_dependency_capture itself captures the name fine either way — the loss is in the
suffix-hash-map lookup that maps the captured module name to a file.

Why it matters

Uppercase USE MODULENAME is the dominant style in exactly the legacy FORTRAN 77/90 code
GitGalaxy targets — those repos silently lose their dependency graph, PageRank blast
radius, and orphan reclassification. COBOL COPY resolution may warrant the same check
(the corpus's COPY a. happened to be lowercase; untested with COPY A.).

Fix shape

Case-fold the lookup key for case-insensitive languages (fortran, cobol at minimum) when
building/querying the suffix hash map — or fold both sides unconditionally and let exact
matches win first.

References

Activity

  1. added
    core-engine
    on Aug 31, 2026
  2. squid-protocol commented on Aug 31, 2026

    @squid-protocol
    OwnerAuthor

    Family addendum from the #1096 corpus (23 languages now scanned): haskell's import chain also never resolves — import A (haskell modules are necessarily capitalized) against a.hs finds nothing, so haskell joins uppercase-fortran in losing its DAG to case-sensitive lookup. Real-world haskell files usually match module case exactly, so the wild impact is smaller than fortran's — but the same case-folding fix would cover both (and cobol COPY A. remains untested). Also related but distinct: swift loses its chain to a minimum-length quirk instead (filed separately).

  3. added 2 commits that reference this issue on Sep 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    core-engine

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions