Skip to content

Call-graph validation for C/C++: independent body oracle + family consensus on the DOOM corpus (the Graph Accuracy Audit only covers Python/TS/Java) #5630

Closed

Description

@squid-protocol

Why

Structural extraction is checked against ctags, tree-sitter and libclang; C/C++ call graphs have no independent check (the Graph Accuracy Audit compares against pyan3, the TypeScript checker and scip-java; the C/C++ reference, #3784, is open). A first pass on the DOOM corpus found two engine defects with thousands of edges each (filed alongside this issue) within an hour.

Method (prototype on nyx, /srv/storage_16tb/projects/gitgalaxy/doom-study/)

  1. Independent body oracle: for each engine function, the brace-matched body from source (comments, strings, preprocessor lines stripped), every defined_name( call; compare with calls_out_to restricted to defined names. linuxdoom: 1,597/1,597 calls agree (recall 1.000, precision 1.000 apart from recursion); chocolate-doom 12,132 calls, 3 misses (a call inside --Vars[ReadMapVar(...)]). Use tree-sitter call_expression rather than regex for C++ (regex mistakes std::unique_lock<...> lock( for a call and misses f<T>().
  2. Family consensus: near-identical ports (linuxdoom, doomgeneric, doom-ascii, sdl-doom, PureDOOM, Chocolate, Crispy, doom-wasm, inter-doom) vote on each edge; a port that defines both ends but lacks an edge most siblings have is checked against its source. First pass: 306 holes, 304 real divergences, 2 engine misses (R_PointToAngle -> SlopeDiv passed as a function pointer).
  3. Report per port and per shape (statement, nested argument, condition/return, after cast, after operator, subscript, function pointer, macro), recall/precision, with examples; licensed ports only.
  4. Wire into the DOOM Crucible nightly (DOOM-rosetta: golden-gated CI regression test over the DOOM port corpus (measurements-only golden, zero drift, sharded, nightly oracles) #5619) with thresholds, and a libclang call-reference (Call-graph reference: C/C++ (clang-based) #3784) on the C subset when it lands.

Acceptance

  • Tool in the repo (tests/tools/doom_speedrun/callgraph_oracle.py or the crucible), one command, licensed ports.
  • Baseline published on this issue; every new defect shape gets its own issue.
  • Nightly fails on a recall/precision regression.

Found by the DOOM corpus call-graph consensus check (#5620, #5457): near-identical ports vote on each call edge, and an independent body oracle re-extracts calls from source. Licensed ports only.

🤖 Generated with Claude Code

Activity

  1. added
    enhancement
    testing
    core-engine
    priority: high
    scope:core
    needs:doom-corpus
    on Oct 19, 2026
  2. squid-protocol commented on Oct 19, 2026

    @squid-protocol
    OwnerAuthor

    Extend the tool beyond C/C++: the same oracle on Java/C#/Kotlin (licensed ports, engine 0e2bf4ade) gives managed-doom (C#) recall 1.000 / precision 1.000 over 2,944 calls, mochadoom (Java) 0.998 / 1.000 over 5,176, helion (C#) 0.994 / 0.999 over 21,555, kocoa-doom (Kotlin) 0.969 / 0.999 over 4,834; pairwise consensus mochadoom <-> kocoa-doom (a Kotlin port of mochadoom): 410 differing edges, 405 real code differences, 5 engine misses. Oracle notes for these languages: strip C# verbatim/interpolated and Kotlin/Java raw strings; handle expression bodies (=> expr;, = expr); don't count Kotlin fun name( definitions as calls; report new X(, x.f(, f<T>( and lambda calls as separate shapes. Prototype: /srv/storage_16tb/projects/gitgalaxy/doom-study/study-prototype/callcheck_jvm.py. Defects found so far: #5628 (C# case), and the three issues filed today for C# constructor initializers, Kotlin bodyless extents, and prefix---/Java synchronized call shapes.

    🤖 Generated with Claude Code

  3. squid-protocol commented on Oct 19, 2026

    @squid-protocol
    OwnerAuthor

    Rust/Go baseline (licensed ports, engine 0e2bf4ade): rust-doom recall 0.999 / precision 1.000 (866 calls), room4doom 0.999 / ~0.998 (13,968), gore (Go) 0.999 / 1.000 (1,960). Cross-language consensus gore vs linuxdoom: 625 shared functions, 1,233 shared edges (Jaccard 0.90), 0 engine misses on either side. Oracle notes: Rust nested block comments, raw strings r#"..."#, lifetimes vs char literals, turbofish f::<T>(, macros name!( (not calls); Go backtick strings, F[T]( instantiation, func literals; keep language built-ins (len, default) out of any keyword filter, or the checker undercounts. Defects: #5634.

    🤖 Generated with Claude Code

  4. squid-protocol commented on Oct 19, 2026

    @squid-protocol
    OwnerAuthor

    COBOL/SQL baseline (licensed ports, engine 0e2bf4ade): COBOL PERFORM/GO TO/CALL extraction recall 1.000 on FPS.cob, agentic-cobol-doom-cc, agentic-cobol-doom-codex and mood's COBOL; precision ~1.000 (one false shape, #5637). Oracle note: loc is not a pure line span for COBOL paragraphs, so slice by the next paragraph's start, not start+loc. SQL: sqldoom routines have 109 routine-to-routine calls in source and 0 recorded (#5635); saildoom (Spark SQL port of sqldoom) defines no SQL routines, so no routine-level consensus is possible, and 2 of its 12 SQL files (the monster AI and renderer fragments) are dropped by the aperture (#5636).

    🤖 Generated with Claude Code

  5. squid-protocol commented on Oct 19, 2026

    @squid-protocol
    OwnerAuthor

    Remaining-language baseline (licensed ports, engine 0e2bf4ade). Reliable: PHP (srb2) 0.991/0.995, ZScript (gzdoom) ~0.98-1.00 (oracle misses are native declarations/state actions), Lua (edge-classic) 0.965/0.965, Dart (dartdoom) 0.979/0.962, JavaScript (cssDOOM) 0.949/0.985, x86 asm in woof 1.000. Cross-language consensus vs linuxdoom: doom-scheme Jaccard 0.88 (94 holes: 92 real, 2 engine misses in lambdas), dartdoom 0.82 (66 holes, 0 misses). Gaps: Fortran #5638 (recall 0.47), Objective-C message sends #5639 (0.52-0.86), shell/Scheme-lambda/Lua/Tcl shapes #5640, assembly local labels + no call edges on #5624. Oracle caveats for the tool: Python/JS/Scheme numbers here are dominated by nested-function attribution (the engine attributes an inner function's calls to the outer; decide the convention and make the oracle match), and one-line definitions must not be skipped. Prototypes: study-prototype/callcheck_all.py, consensus_xlang.py.

    🤖 Generated with Claude Code

  6. squid-protocol commented on Oct 20, 2026

    @squid-protocol
    OwnerAuthor

    Per-port / per-shape call-graph baseline at engine 42488957a, from callgraph_oracle.py --only all (20 licensed C/C++ ports; draft PR #5690). Recall and precision are measured against a tree-sitter body oracle. Misses are named by call shape, engine-only edges by how the callee appears in the body.

    Port Recall Precision Oracle calls Misses by shape Engine-only by kind Text fallback
    chocolate-doom 1.0000 1.0000 12132 - - 13
    crispy-doom 1.0000 1.0000 14043 - - 13
    doom-ascii 1.0000 1.0000 1980 - - 0
    doom-wasm 1.0000 1.0000 4069 - - 5
    doom3-bfg 0.9995 0.9772 47954 statement 1, unparsed 21 absent 339, comment/string 1, function-pointer 21, macro 4, type 754 590
    doomgeneric 1.0000 1.0000 2163 - - 0
    doomretro 0.9996 1.0000 6871 statement 3 - 19
    dsda-doom 0.9978 0.9992 10775 assignment-rhs 4, nested-argument 1, statement 19 absent 2, function-pointer 3, type 4 3
    edge-classic 0.9844 0.9747 10702 after-cast 1, after-operator 10, assignment-rhs 27, condition/return 10, nested-argument 6, other 2, statement 48, unparsed 63 absent 144, function-pointer 3, type 127 29
    eternity 0.9982 0.9769 15826 statement 10, unparsed 18 absent 174, comment/string 1, function-pointer 65, type 134 485
    fastdoom 0.9997 0.9997 2885 nested-argument 1 function-pointer 1 0
    gzdoom 0.9865 0.9483 43247 after-cast 1, after-operator 12, assignment-rhs 84, condition/return 39, nested-argument 15, other 5, statement 261, unparsed 165 absent 810, function-pointer 238, type 1280 579
    inter-doom 1.0000 1.0000 13640 - - 8
    linuxdoom 1.0000 1.0000 1597 - - 0
    nugget-doom 1.0000 0.9977 8967 - macro 21 10
    odamex 0.9981 0.9673 20129 after-operator 13, assignment-rhs 6, nested-argument 7, other 2, statement 10 absent 310, comment/string 1, function-pointer 58, macro 9, type 302 288
    prboom-plus 1.0000 0.9993 4603 - absent 2, type 1 1
    puredoom 1.0000 1.0000 3733 - - 0
    sdl-doom 1.0000 1.0000 2083 - - 0
    woof 1.0000 0.9990 8148 - function-pointer 7, macro 1 4

    Family consensus (9 vanilla-lineage ports, quorum 75%): holes 321, engine missed 2 (crispy-doom 1, inter-doom 1; shape function-pointer 2), real divergence 319, false-edge suspects 0.

    Open engine shapes found:

    • a function passed as a pointer is not an edge (R_PointToAngle -> SlopeDiv, crispy-doom and inter-doom);
    • a destructor head is counted as a call to its own class (prboom-plus ~Scanner -> Scanner, also in gzdoom);
    • dsda-doom P_ExecuteZDoomLineSpecial (p_spec.c:5788) is truncated: engine loc is 1427 against 1786 non-blank lines, and the calls after line ~7215 are missed.

    The type column counts C++ classes used as a type that the engine emits as constructor calls. These are reported, not scored as wrong. The baseline file is tests/tools/doom_speedrun/callgraph_baseline.json. The nightly hook is --only all --baseline ... --fail-on-regression, waiting on #5619.

  7. 37 remaining items

  8. squid-protocol commented on Oct 26, 2026

    @squid-protocol
    OwnerAuthor

    Churn run 5630-20261026T2227Z (host nyx) ended without a PR. no-change CI-triage; doom_rosetta re-bless folded into slice 3 brief

  9. squid-protocol commented on Oct 27, 2026

    @squid-protocol
    OwnerAuthor

    Acceptance met: oracle tool in tests/tools/doom_speedrun/, baselines published, nightly (doom-rosetta.yml) gates on recall/precision, and the libclang reference (#6768) plus the clean-file disagreement triage (#6769) are merged. Remaining defect shapes are tracked as sibling gaps filed separately.

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

    claim:nyxcore-engineenhancementneeds:doom-corpuspriority: highscope:coretesting

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions