Skip to content

sfs: subway maps (call graphs by subsystem on a reference's layout) - #17

Merged
squid-protocol merged 1 commit into
mainfrom
sfs-subway-maps
Oct 21, 2026
Merged

squid-protocol merged 1 commit into
mainfrom
sfs-subway-maps

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Builds the DOOM study's subway-map prototype (doom-study/study-prototype/callmaps.py) into structural-fingerprint-scanner as a general feature. Stacked on #16 (the gradient colours); merge #16 first.

What

  • sfs subway INPUTS --reference R [--taxonomy subsystems.json] writes subway.html, subway.json and subway.csv. sfs compare … --subway-reference R adds the same section to report.html.
  • Each repository's resolved call graph is collapsed to subsystems and drawn on the reference's fixed, seeded layout. Stations are sized by function count, lines by call share, and station colour shows the share of the reference's subsystem that structurally survives (on the Universal gradient).
  • Functions are placed by structural twin first (name-blind), then by name, then by path rules. Without a taxonomy, subsystems are the reference's top-level directories, so it works on any codebase.
  • Metrics: wiring similarity (cosine of subsystem call matrices) and calls kept (reference calls still made between counterparts), plus a structure-vs-wiring scatter.
  • No new dependencies: the prototype's networkx and matplotlib are replaced by a small seeded force layout and direct SVG.
  • Fingerprints now store resolved call edges; older .sfp.npz files still load.

DOOM findings (in examples/doom/README.md)

  • Translations rewrite every measurement, so the descent tree can't see them, but they keep the wiring: gore (Go) keeps 77% of linuxdoom's calls, doom-scheme 49%, dartdoom 41%.
  • doom3-bfg ships DOOM Classic converted to C++. Twin matching fails on it, but 83% of the calls survive.
  • Station colours show playsim and renderer surviving in Chocolate and Crispy while platform code is replaced.

Tests

42 pass (8 new), including real-scan parity; ruff is clean. The full 44-port DOOM report with subway maps was regenerated and checked.

🤖 Generated with Claude Code

Builds the DOOM-study subway-map prototype into the scanner, generalised:
- sfs subway / compare --subway-reference: each repository's resolved call
  graph collapsed to subsystems (taxonomy JSON, or the reference's top-level
  directories) and drawn on the reference's fixed, seeded layout
- functions placed by structural twin first (name-blind), then name, then
  path rules; stations sized by functions, lines by call share, coloured by
  per-subsystem survival on the Universal gradient
- wiring similarity (cosine of subsystem call matrices) and calls kept
  (reference calls still made between counterparts); a structure-vs-wiring
  scatter; subway.json/csv
- fingerprints now store resolved call edges (.sfp.npz 'edges'; older files load)
- DOOM taxonomy in examples/doom/subsystems.json; results in the DOOM README:
  translations keep linuxdoom's wiring (gore 77% of calls) where descent sees
  nothing, and doom3-bfg's embedded DOOM Classic keeps 83%
- 8 new tests (42 total)

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
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