Skip to content

fix(network): read imports from the code stream, so comments and docstrings draw no edges (#3600) - #3612

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

@squid-protocol squid-protocol commented Sep 25, 2026 •

Copy link
Copy Markdown
Owner

Summary

Fixes #3600.

galaxyscope ran each language's _dependency_capture over the raw file, comments included, so an import written in documentation became an edge. Examples, all verified against the source:

language example
Dart /// import 'package:http/http.dart'; in base_response.dart
TypeScript fp-ts JSDoc * import * as E from 'fp-ts/Either'
Python fastapi usage docstrings: from fastapi import BackgroundTasks
PL/I DSF's retired /* %INCLUDE R0019912 ... */ lines (dozens of programs)
Ruby Rails # include ActionView::Layouts comment lines
Perl comment words: (no warning will be issued) → the warning typosquat alert
Scala Scaladoc and build.sbt string import io.circe._

Fix. Capture reads PRISM's code stream: comments and Python docstrings removed, string literals (most import paths) kept. The mainframe boundary channel already reads this view for the same reason. Inert formats keep their raw text, since markdown links are their content.

Kotlin, Scala and Java write import paths as identifiers, never strings, so they also blank """ blocks via a new top-level import_capture_blank key. This covers test fixtures and code generators full of example source: kotlinpoet's kotlin("Example.kt", """ import … """), circe's project/Boilerplate.scala, and Gradle integration tests' embedded build scripts.

Measured: import_graph_accuracy.py (precision)

language before after
python 99.1 99.9
typescript 99.6 100
objective-c 99.8 100
dart 99.1 100
kotlin 99.1 100
scala 98.2 99.4

Recall is unchanged everywhere except Scala: 54.5 → 51.6, which is a scoring artifact. A Scaladoc-example edge from Decoder.scala into io/circe/disjunctionCodecs.scala had been crediting 29 wildcard statements whose truth set is the whole 40-file io.circe package. Only 8 Scala edges changed, all comment- or string-borne. Baseline regenerated.

Mainframe (second commit)

The ground-truth workflow's full-corpus step pins each corpus's completeness counts, and DSF's moved. DSF keeps retired %INCLUDEs as comments across dozens of PL/I programs (R0010410, R0011520, R0010620, R0011901, …; every lost include was checked and each is inside /* */). One PL/I main counted as CICS only through such a comment. Read from the code stream, it is the batch main its source says it is:

  • transactions 235/310 → 234/309;
  • batch entry 128 → 129.

test_completeness.py's DSF pin is updated with that explanation. The ground-truth ledger itself, i.e. every answer-key field, is unchanged.

Type of change

  • Bug fix
  • New feature / language support
  • Parsing or engine logic
  • Docs, tooling, or CI only
  • Other

CI checklist

  • ruff-audit and dead-key are clean.
  • python -m pytest tests/: 11,147 passed. New test_worker_reads_imports_from_the_code_stream fails without the change.
  • pytest tests/cobol_mainframe/ against the fetched pinned corpora: 476 passed, 1 skipped.
  • ground_truth_ledger.py check: ledger clean.
  • crucible_check.py: both fixtures pass on the rebased head (reblessed; scope below).
  • import_graph_accuracy.py --regenerate: 20 languages.

Golden-master scope

Zero-dependency fixture: 2,670 differences, 392 of them not coordinate ripple. All changes follow from Extracted Dependencies losing comment-, docstring- or embedded-string-borne tokens:

  • python (19 files), perl (16), php (16), rust (13), livecode (10), groovy (8), typescript (3), and a few each in js/lua/pli/ruby/shell;
  • plus the edges, exposures and popularity that follow.

PHP's losses are fragments of its existing multi-line capture garbage (#3609); LiveCode's are doc prose.

Summary:

  • typosquat_hits 27 → 22. Five false alerts are gone, including Perl warning, react/build.js and bugzilla CGI.pm.
  • firewall.imports_unknown 11162 → 10501.

One junk token appears: agc_assembly/RCS_FAILURE_MONITOR.agc gains COUNT (from COUNT* $$/T4RCS). It resolves to nothing.

Verification

$ pytest tests/core_engine/test_galaxyscope.py -k code_stream   -- passes; fails with galaxyscope.py reverted
$ pytest tests/cobol_mainframe/                               -- 476 passed, 1 skipped (pinned corpora fetched)
$ python tests/tools/ground_truth_ledger.py check             -- Ledger clean.
$ python tests/tools/crucible_check.py                        -- full_precision PASS, zero_dependency PASS
$ python -m pytest tests/ -n auto                             -- 11147 passed

🤖 Generated with Claude Code

https://claude.ai/code/session_01YAtpBfGGyBGGovitSVaM5Q

…tring edges (#3600)

galaxyscope ran each language's `_dependency_capture` over the RAW file, so
an import written in documentation became an edge: Dart `/// import
'package:http/http.dart'`, fp-ts JSDoc `@example` imports, fastapi's usage
docstrings, a commented-out PL/I `%INCLUDE`, Rails `# include` lines, and
Perl comment words (`no warning` -> the `warning` typosquat alert).

Capture now reads PRISM's code stream -- comments and Python docstrings
removed, string literals (most import paths) kept -- the same view the
mainframe boundary channel already reads. Inert formats keep their raw
text (markdown links are their content). Kotlin, Scala and Java, whose
import paths are never strings, also blank `"""` blocks
(`import_capture_blank`): test fixtures and code generators full of
example source (kotlinpoet's `kotlin("X.kt", """ import ... """)`).

import_graph_accuracy precision: python 99.1 -> 99.9, typescript
99.6 -> 100, objective-c 99.8 -> 100, dart 99.1 -> 100, kotlin 99.1 -> 100,
scala 98.2 -> 99.4. Scala recall 54.5 -> 51.6 is a scoring artifact: a
Scaladoc edge into io.circe had been crediting 29 wildcard statements whose
truth set is the whole 40-file package. Baseline regenerated.

Golden masters: typosquat_hits 27 -> 22, firewall imports_unknown
11162 -> 10501; Extracted Dependencies lose comment/docstring/string-borne
tokens across python, perl, php, rust, livecode, groovy, typescript and
more. The mainframe ground-truth ledger stays clean.

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

…s are not includes (#3600)

The ground-truth workflow's full-corpus step pins each corpus's completeness
counts. DSF keeps retired `/* %INCLUDE Rnnnnnnn; ... */` lines as comments
(R0010410, R0011520, R0010620, R0011901, ... -- dozens), which the raw-text
capture read as includes. One PL/I main counted as CICS only through such a
comment; read from the code stream it is a batch main: transactions
235/310 -> 234/309, batch entry 128 -> 129. The ledger itself is unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01YAtpBfGGyBGGovitSVaM5Q
@squid-protocol
squid-protocol merged commit 398c379 into main Sep 25, 2026
36 checks passed
@squid-protocol
squid-protocol deleted the claude/festive-fermat-kojuy7 branch September 25, 2026 14:26
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.

_dependency_capture reads comments and docstrings: example imports become real edges (Dart, Perl, TS, Python)

2 participants