Agent guide: abicheck/buildsource/ full module map¶
Moved verbatim out of
abicheck/buildsource/CLAUDE.md(progressive disclosure: that file loads whenever an agent works in its tree; this full table loads only when its pointer fires).abicheck/buildsource/CLAUDE.mdkeeps a one-line row per entry and remains the primary contract.
Module map¶
Phase 6 rename off the scan identity (docs/contribute/plans/one-comparison-product.md
§3 #34, Phase 6): crosscheck.py, crosscheck_base.py, and crosscheck_coherence.py
were renamed to cross_source_checks.py/cross_source_checks_base.py/
cross_source_checks_coherence.py — they run automatically inside compare()'s
pipeline via workflows/cross_source_hygiene.py, not just from scan, so
logically this is a compare-shaped responsibility per ADR-061's task-routing
table (and architecture/modules.yaml classifies cross_source_checks_base.py/
cross_source_checks_coherence.py as compare while physically flat here, the
same pattern source_graph_build.py below already uses). The main
cross_source_checks.py file stays classified workflows and physically here
rather than under abicheck/compare/, deliberately: it imports from
export_accounting.py (extract-classified) and source_graph_query.py
(unclassified) which compare/'s own may_import: [model] restriction forbids
— physically relocating it would need those two modules reclassified/moved
first, out of scope for a pure rename (see architecture/modules.yaml's own
entry for the full reasoning). scan_levels.py moved to
abicheck/model/evidence_depth_levels.py (it defines value types —
EvidenceDepth/SourceMethod/SourceScope — consumed at least as
widely by compare's own evidence-depth resolution as by scan, and has no
buildsource-specific dependency at all). Both moves are pure rename/re-home
with no behavior change; see those packages' own module maps. poi.py and
risk.py were also named in the plan's Phase 6 prose as surviving engine
primitives, but a call-site audit found neither had a real compare-side
caller — both were deleted (not renamed) when scan itself was deleted
(ADR-068 Phase 6).
| Module | Role | ADR |
|---|---|---|
model.py |
BuildSourceManifest, BuildSourceRef, LayerCoverage, BuildSourceEntity, DataLayer/LayerConfidence/CoverageStatus enums |
028 D1/D5/D7/D8 |
pack.py |
BuildSourcePack — the 5-field dataclass, inline embedding (to_embedded_dict/from_embedded_dict), empty(). model-classified; carries no I/O (ADR-061 Phase 5's residual: see the ADR's own writeup) |
028 D1/D4, 061 Phase 5 |
pack_io.py |
BuildSourcePack persistence — load/write, content addressing (content_hash), to_ref(), verify_integrity(). storage-classified (imports model); split out of pack.py because model cannot import storage. frontends-layer callers (cli_*.py) that cannot import storage directly reach load/content_hash/to_ref through workflows/extraction.py's load_pack_or_raise/pack_content_hash/pack_to_ref re-exports instead of importing this module themselves — a workflows-owned indirection, not an unclassified facade (a first attempt at the latter was a real frontends -> storage layering bypass, caught in review) |
028 D1/D4, 061 Phase 5 |
inputs_pack.py |
Flow-2 build-emitted facts protocol (ingest side): InputsManifest + is_inputs_pack()/load_inputs_manifest()/read_source_facts() and ingest_inputs_pack() — fold a build-dropped abicheck_inputs/ dir (normalized source_facts/*.jsonl → L4, build/compile_commands.json → L3, L5 graph) into an embeddable BuildSourcePack without re-running a frontend (pure parsing). Guards third-party packs: pack-root path constraint (_safe_pack_path, symlink-escape + non-regular-file safe), per-record skip-with-diagnostic. raw_ast//pp//deps/ are forensic only, never ingested |
035 D5 (G19.4) |
inputs_emit.py |
Flow-2 producer side (inverse of inputs_pack): init_inputs_pack()/append_source_facts() (incremental per-TU) write a conformant abicheck_inputs/ pack that round-trips through ingest_inputs_pack. Pure I/O. Used by the abicheck-cc wrapper (../cc_wrapper.py) and the Clang plugin (contrib/abicheck-clang-plugin/) |
035 D5 (G19.4) |
inline.py |
Source-tree-centric inline collection for dump --sources/--build-info: collect_inline_pack() (resolve compile DB → L3, replay → L4, fold → L5), is_pack_dir(). Compile-DB resolution (_resolve_compile_db) ends in the zero-config inferred query (no --allow-build-query flag): explicit --build-info → trusted --config/--build-query command → build.compile_db glob → auto-discovered compile_commands.json → inferred build-system query (build_query.py), threading BuildConfig.targets (P0.2's build.targets: — root target(s) scoping a Bazel query, overridable only via embed_build_source's own build_targets param — the typed-API InputSpec.build_targets field — since the dump --build-target CLI flag that originally exposed this was removed) through as bazel_targets. An arbitrary build.query from an auto-discovered (untrusted) .abicheck.yml is still never auto-run (needs explicit --config). Re-exports BuildConfig/load_build_config()/discover_build_config() from build_config.py (below) for back-compat; call/type-graph folding lives in inline_graph_fold.py |
028–033 amendment, 032 (amended) |
build_config.py |
BuildConfig/load_build_config()/discover_build_config()/KNOWN_TOP_LEVEL_KEYS — the .abicheck.yml project-config schema (build:/sources:/severity:/scope:/suppression:/source:/compile:/debug:/version: blocks — exit_code_scheme: was a top-level key here too until CLI cleanup phase two PR G2 deleted it along with --exit-code-scheme, ADR-064) and its strict-schema validation (ADR-043: an unknown key or wrong-typed value is a hard ValueError, not a warning). Split out of inline.py (G38 Phase 15 file-split prerequisite — that file was within a couple of lines of the AI-readiness 2000-line hard cap, and the config schema has no dependency on inline.py's own collection pipeline, confirmed by a full-file grep before the split) — a mechanical extraction (unchanged function/method bodies), not a redesign, mirroring build_config_schema.py/build_config_io.py's own earlier splits for the identical reason. BuildConfig's strict-schema subkey-type tables live in build_config_schema.py; the digest-capturing load_build_config_with_digest() lives in build_config_io.py |
028 amendment D4, 037 D4, 043 |
build_config_io.py |
load_build_config_with_digest() — load_build_config() plus the sha256 of the exact bytes it parsed, from one read. What an ADR-049 D6 receipt needs before it may claim a .abicheck.yml supplied an effective-configuration field: naming the file is not proving which revision of it. One-directional dependency on build_config.BuildConfig (never imported back), so no cycle |
049 |
inline_graph_fold.py |
fold_call_graph()/fold_type_graph()/fold_override_graph()/fold_template_graph()/fold_include_graph() — the per-family graph folds. The clang-backed ones read one shared L5AstRun (l5_ast_pass.run_l5_ast_pass, one dump per TU for every family) and are run in order by l5_ast_pass.fold_semantic_graphs(); fold_include_graph() runs its own clang -MM pass. Plus fold_archive_graph() — split out of inline.py to keep that file under its line-count cap. Shared _scope_narrowed_target() picks the scoping precedence (changed_paths → scoped_units → broad), computed once per run by run_l5_ast_pass,, and stamps extractor_passes/narrowed_passes+narrowed_scope/degraded_passes on the resulting SourceGraphSummary per the coverage-honesty chain (ADR-041 P0, eleventh–sixteenth Codex reviews). ROLE_COVERAGE_MATRIX/_mark_role_coverage() (ADR-046 D3) additionally stamp per-(kind,role) keys (e.g. "type_graph:DECL_HAS_TYPE:param") alongside a confirmed family flag in fold_type_graph. fold_override_graph() (ADR-041 P2 item 1) and fold_template_graph() (G29 Phase 5 item 1) each mirror fold_type_graph() exactly; see override_graph.py/template_graph.py. fold_archive_graph() (G29 Phase 5 item 6) is the odd one out among the clang-backed passes — it needs no clang/_scope_narrowed_target scoping at all, so it runs unconditionally (not gated on with_call_graph) whenever the graph carries a static_library node; see archive_graph.py. fold_virtual_dispatch_graph() (G29 Phase 5 item 3) is a second, differently-shaped odd one out: it takes no merged/clang_bin/extractors/scoping arguments at all and shells out to no compiler either, since it's a pure transform over call_graph/type_graph/override_graph state those three passes already folded — called right after fold_override_graph in fold_semantic_graphs; see virtual_dispatch_graph.py. fold_callback_graph() (G29 Phase 5 item 4) mirrors fold_macro_graph()'s scoping/degradation shape but internally combines both of callback_graph.py's parts in one call (Part B's new clang pass, then Part A's pure join over what Part B just folded) rather than splitting into two fold_* functions the way fold_virtual_dispatch_graph() did — Part A here needs Part B's edges already present in the graph before it can join, unlike fold_virtual_dispatch_graph's clang-free pair, so there is no benefit to a second function; called after fold_macro_graph in fold_semantic_graphs, since its own Part A reads call_graph's already-folded function-pointer-kind DECL_CALLS_DECL edges. Its own coverage stamp (Codex review, fresh evidence) additionally propagates call_graph's own coverage state (worst-wins against this pass's own extractor-run state, same full/narrowed/degraded ranking fold_virtual_dispatch_graph uses) — a degraded or never-run call_graph pass means a real CALLBACK_MAY_INVOKE dispatch target can be silently absent even when this pass's own clang run examined the whole compile DB cleanly; see tests/test_callback_graph.py's TestFoldCallbackGraphPropagatesCallGraphCoverage. fold_virtual_dispatch_graph()'s own coverage stamping is mutually exclusive across extractor_passes/narrowed_passes/degraded_passes (Codex review, fresh evidence, four rounds) — the first fix propagated the narrowed/degraded state from its three prerequisite passes but left the prior unconditional full-coverage stamp in place alongside it; the second fix converted it to an if narrowed: ... elif not-narrowed-and-not-degraded: ... shape, but "not narrowed and not degraded" is not the same claim as "fully covered" — when clang isn't on PATH at all, each prerequisite returns early setting none of the three coverage dicts, which the second fix's checks both read as False; the third fix required every prerequisite to carry its own extractor_passes entry before claiming full coverage here too, folding that "missing entirely" case into the degraded fallback; the fourth fix reordered the checks so degraded (or missing) is checked before narrowed — a version that checked narrowed first stamped only the narrowed key when one prerequisite narrowed cleanly and another independently degraded, silently dropping the untracked gap from the failed TUs, contrary to SourceGraphSummary.degraded_passes's own documented precedence |
041 P0, 046 D3 |
archive_graph.py |
ar-index introspection (G29 Phase 5 item 6, G29.6): reads (through extract/ar_archive.py's parse_ar_archive/read_archive, moved there for ADR-086) an archive's own linker-written symbol index — GNU ///SYM64/ and BSD/Mach-O __.SYMDEF/__.SYMDEF_64, both plain and thin (ar rcT) archive flavors, both the COFF second-linker-member and macOS's BSD-extended-name symdef encodings — plus augment_graph_with_archives(), which fills in archive_member nodes and the previously schema-only ARCHIVE_CONTAINS_OBJECT/OBJECT_DEFINES_SYMBOL edges onto every static_library node source_graph._fold_link_provenance already created. OBJECT_DEFINES_SYMBOL only ever joins onto a binary_symbol node the graph already carries (ADR-057 D1's join-by-shared-node-id rule, reapplied, with a Mach-O leading-underscore fallback), so an archive's internal-only symbols mint no node. A relative archive label resolving to more than one distinct file across the search roots is a diagnostic, never a guess. defining_members() is the localization read view ("cache_dispatch.o in libinternal_dispatch.a"). Degrades to a diagnostic, never an exception, per-archive (missing/unreadable/malformed/no-index/truncated) — ADR-028 D3; every diagnostic embedding a resolved path is re-redacted first (ADR-032 D7) |
041 P1 #2 (G29 Phase 5) |
template_graph.py |
Template-instantiation parsing (G29 Phase 5 item 1, G29.6's first-priority open graph family): a pure parser (parse_clang_ast_templates) over clang -ast-dump=json, empirically verified against real clang output (see the module's own docstring for the exact AST-shape findings — the explicit-instantiation detachment quirk, the BSD/typedef-alias resolution, member-symbol emission). The graph-folding half (augment_graph_with_templates()) moved to template_graph_fold.py (ADR-061 Phase 5 item 2, below) — this module now owns only parsing (parse_clang_ast_templates, the TemplateInstantiation/TemplateArgUse dataclasses, _merge_template_instantiations cross-TU merge) plus merge_template_instantiations (the cross-TU merge the L5 AST pass applies). TEMPLATE_USES_DECL is also populated now (follow-up to item 1): a pointer-to-function/variable or reference NTTP argument (e.g. Callback<&ns::handler>) gets an edge onto the same source_decl node call_graph.py/type_graph.py would themselves mint for the identical declaration, scoped to free functions/namespace-scope variables only (a class-member NTTP target is a known, left-open gap) — see template_graph_value_decls.py. INSTANTIATION_MAPS_TO_EXPORT/DECL_USES_DEFAULT_TEMPLATE_ARG/CONSTRAINT_DEPENDS_ON_DECL remain reserved, unpopulated vocabulary (graph_facts.TEMPLATE_EDGE_KINDS) — see the module docstring for why each is deferred |
041 (G29 Phase 5 item 1), 061 Phase 5 item 2 |
template_graph_fold.py |
augment_graph_with_templates() — the graph-folding half split out of template_graph.py (that module was sitting exactly at the repository's absolute 2000-line hard cap, leaving no line budget to fix its own last facade import in place; ADR-061 Phase 5 item 2 named this as one of the four remaining internal-caller exceptions for exactly that reason). Mints template_decl/template_instantiation nodes and DECL_INSTANTIATES_TEMPLATE/TEMPLATE_USES_TYPE/TEMPLATE_USES_DECL/INSTANTIATION_EMITS_SYMBOL edges from already-parsed TemplateInstantiation records — closes the "public template → concrete instantiation → internal specialization → emitted exported symbol" chain the pre-existing type_graph/call_graph passes can't (they only see the template pattern, not a specific instantiation's arguments). Also owns template_decl_node_id()/template_instantiation_node_id() (the node-id constructors) and the EDGE_/NODE_TEMPLATE_/TEMPLATE_GRAPH_PROVENANCE vocabulary, all moved with it since they're used only here. Its facade import is now fixed as part of the same move: _decl_node_id/_type_node_id import from model/graph_identity.py and _symbol_node_id from model/source_graph.py directly, rather than through the buildsource/source_graph.py back-compat facade — this closes template_graph.py's entry in ADR-061 Phase 5 item 2's "four remain" list |
041 (G29 Phase 5 item 1), 061 Phase 5 item 2 |
template_graph_value_decls.py |
index_value_decls()/arg_label_spelling() — split out of template_graph.py (its own 2000-line hard cap) for the TEMPLATE_USES_DECL follow-up above. Deliberately a leaf module with no import of template_graph.py at all, not even under TYPE_CHECKING — the AI-readiness import-cycle-growth gate's static AST walk counts a TYPE_CHECKING-guarded or function-local import the same as a module-level one, so even a type-only back-reference would register as a real cycle; the caller passes its own _RECORD_DECL_KINDS/_VALUE_DECL_KINDS/_normalize_mangled in instead |
041 (G29 Phase 5 item 1) |
macro_graph.py |
Macro/config-dependency graph extraction (G29 Phase 5 item 2, G29.6's second open graph family): a Clang AST pass (parse_clang_ast_decl_ranges, Pass A — indexes every top-level/namespace/class-member declaration's identity and (file, begin_line, end_line) span, empirically verified against real clang output for a load-bearing AST-dump quirk — a declaration's range.begin/range.end share one sticky whole-document (file, line) cursor with every other node's loc, not just file-only sibling tracking) plus a pure raw-text scan (scan_conditional_regions/find_decl_macro_uses, Pass B — clang's AST carries no representation of preprocessor conditionals at all). augment_graph_with_macro_dependencies() joins the two into MACRO_CONTROLS_DECL/DECL_USES_MACRO edges — a declaration compiled only under a simple #ifdef/#ifndef/#if defined/#if !defined guard, and a declaration's own text referencing a macro defined earlier in the same file (textual heuristic, CONF_REDUCED). No new node kind — both edges join onto the existing macro/source_decl nodes only (join-only-onto-an-existing-node, same ADR-057 D1 rule archive_graph.py reapplies). MACRO_EXPANDS_TO_VALUE/MACRO_EXPANDS_TO_TYPE/MACRO_CONTROLS_EDGE remain reserved, unpopulated vocabulary (graph_facts.MACRO_DEP_EDGE_KINDS) — see the module docstring for why each is deferred. _IF_RE (the unmodeled-conditional fallback) also matches #ifdef/#ifndef, not just bare/compound #if (Codex review, fresh evidence) — a malformed-but-compiler-accepted directive with trailing tokens (#ifdef FEATURE_X extra) matched none of the four simple patterns nor the #if-only fallback, so no frame was pushed and the matching #endif popped the enclosing guard's frame instead, truncating it early. _lines_starting_inside_block_comment() also tracks ordinary "..."/'...' string/char-literal state, not just /* */ nesting (Codex review, fresh evidence, second round) — a /* inside a string literal (const char *token = "/*";) previously opened block-comment state for real, silently swallowing every following line including a real #ifdef/#endif pair, with no diagnostic to signal the desync; a raw string literal (R"(...)") stays unhandled (its arbitrary delimiter is a materially different problem, no empirical evidence this shape occurs in practice). _strip_leading_inline_comment() (Codex review, fresh evidence, third round) strips a same-line-CLOSED leading /* ... */ before every directive-family regex is tried — a real compiler treats a comment as whitespace, so /* note */ #ifdef X is a live directive the previous ^\s*#-anchored regexes couldn't see at all; besides the missed macro edge, a nested instance left no stack frame, so its own #endif popped the enclosing guard's frame instead (the same desync shape the #ifdef/#ifndef fallback fix closed for a differently-shaped input). Applied identically in _macro_definition_lines() so /* note */ #define X 1 is recognized too. _line_after_carryover_comment_closes() (Codex review, fresh evidence, fourth round) closes the sibling gap: a MULTI-line-opened comment that closes mid-line before a real directive (/* opening\n*/ #ifdef X) was previously skipped wholesale — the per-line in_comment flag only ever gated "skip the whole line or don't," never "resume scanning after this specific carried-over comment ends." Finding the first "*/" from a line already known to start in_block=True is unambiguously that comment's own close (nothing inside an open block comment carries special meaning), and the live remainder after it is fed through the same _strip_leading_inline_comment() path both callers already use. _ELIF_RE also matches C++23's #elifdef/#elifndef, not just bare #elif (Codex review, fresh evidence) — the identical \b-after-"elif" gap the _IF_RE fix already closed for #ifdef/#ifndef; unrecognized, #elifdef B left the ORIGINAL #if's frame open across it, wrongly attributing the #elifdef branch's declarations to the first branch's own macro (a wrong high-confidence edge, not merely a missing one). Investigated, deliberately NOT fixed: a block comment appearing MID-directive (#/**/ifdef X) — every directive regex only tolerates plain whitespace at those positions, and fixing it needs a systematic rewrite replacing every \s*/\s+ gap across the whole pattern set; mid-token block comments inside a directive are exceedingly rare, deliberately obfuscated styling, unlike the realistic comment placements already fixed. Pinned by a dedicated regression test (module docstring's "fourth accepted limitation"). _IF_DEFINED_RE/_IF_NOT_DEFINED_RE also accept defined X/!defined X without parentheses, not just defined(X)/!defined(X) (Codex review, fresh evidence) — both are equally valid, real-compiler-accepted preprocessor syntax; the unparenthesized form previously fell through to the unmodeled _IF_RE fallback with no diagnostic to signal the miss. Written as a proper alternation (not \(?/\)? made independently optional) so a malformed, mismatched operand (defined(X or defined X)) still falls through rather than being accepted as either valid form. The macro family's AstPass (l5_ast_pass.L5_AST_PASSES) also catches TypeError, not just ValueError/RecursionError (CodeRabbit review, fresh evidence) — _LocationCursor.advance()'s int(loc["line"]) has no type check, so a malformed line value (adversarial/corrupted AST JSON) previously escaped as an uncaught exception instead of degrading to a diagnostic like every other malformed-input case here. Investigated, deliberately NOT fixed (Codex review, fresh evidence, fifth round): backslash-newline line splicing before a // comment (// comment continues \ + a following physical line makes that whole next line part of the same comment, per a real preprocessor) is unmodeled — this scanner has no notion of splicing at all, so a directive-looking line spliced INTO a // comment this way is read as live, the same truncation shape the four comment-tracking fixes above close for a different mechanism each. Not attempted this pass: correctly handling it means propagating a genuinely different per-line carry-over state than in_block, threaded through every line-number-keyed caller without disturbing their existing physical-line-number contract (clang's own AST ranges are physical-line-based too) — a narrower fix risks getting that fidelity subtly wrong, worse than the current, honest, pinned gap (see the module's own docstring, "a third accepted, documented limitation") |
041 (G29 Phase 5 item 2) |
build_query.py |
Zero-config build-system inference (ADR-032 amended): detect_build_system() (CMakeLists.txt/MODULE.bazel/makefile markers) + inferred_query_command() (the fixed, abicheck-authored cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON / bazel aquery / make -B -n -k -w argv — never taken from the tree) + run_inferred_build_query() (runs it and merges CMake compile DB, Bazel aquery, or reduced-confidence Make transcript evidence into BuildEvidence). So --sources alone yields L3 with no flag and no manual compile DB step. Make evidence is transcript-scraped, so prefer a real compile DB when available. Pure detection/command-construction; only the runner touches subprocess. |
032 (amended) |
cross_source_checks.py |
Intra-version cross-source validation (renamed from crosscheck.py, Phase 6 rename off the scan identity — ADR-068 §3 #34 / docs/contribute/plans/one-comparison-product.md): run_crosschecks(snapshot, config) diffs ONE merged AbiSnapshot's evidence sources against each other → eleven ChangeKinds. D4 cross-source (6): exported_not_public/public_not_exported/private_header_leak/public_to_internal_dependency = RISK, header_build_context_mismatch/odr_type_variant = API_BREAK. D8 single-release hygiene (3): unversioned_exported_symbol, rtti_for_internal_type, identity_collision_detected = RISK. Evidence-coherence (2): compile_context_conflict, source_surface_dso_mismatch = RISK. Reached automatically inside every compare() call (workflows/cross_source_hygiene.py), not just scan --audit. The two evidence-coherence checks live in cross_source_checks_coherence.py and the shared finding/coverage plumbing in the leaf cross_source_checks_base.py |
035 D4/D8 (G19.2/G19.6), 041 P1 #5 |
cross_source_checks_base.py |
Leaf plumbing for the cross-check engine + its check modules (renamed from crosscheck_base.py, same Phase 6 rename): the _CheckOutput result, _change/_exported_symbol_names helpers, and the PROVIDER_* provider-agreement constants. Dependency-free of cross_source_checks so any split-out check module can share it without forming an import cycle (CLAUDE.md "M1-3") |
035 D4 |
cross_source_checks_coherence.py |
The two AC-008/AC-009 evidence-coherence checks (renamed from crosscheck_coherence.py, same Phase 6 rename), split out of cross_source_checks.py to stay under the 2000-line cap. Imports only cross_source_checks_base (never the engine); cross_source_checks.run_crosschecks imports these two runners — a one-directional edge |
035 D4 |
unversioned_base_exports.py |
The two-sided half of unversioned_exported_symbol: introduced_base_bound_exports(old, new) returns NEW exports GNU ld bound to the base version (ElfVersionBinding.BASE) that OLD did not export under any binding. The one-sided check skips BASE because a base-bound export is normally pre-script API; one side cannot tell a new base-bound export from such a symbol, the comparison can. Folded in by workflows/cross_source_hygiene.compute_cross_source_evolution for that check only, when both sides were evaluated, so it reads INTRODUCED |
035 D8 |
pattern_facts.py |
Compiler-free lexical ABI-risk pre-scan (renamed from pattern_scan.py, Phase 6 rename off the scan identity — ADR-068 §3 #34 / docs/contribute/plans/one-comparison-product.md): scan_text()/find_pattern_facts() (pure stdlib-regex over the D2 construct list), PatternFact/PatternFactsResult (advisory facts + per-kind EscalationTriggers feeding D7 POI focusing); never authoritative. Reached automatically from compare()'s pipeline (workflows/pattern_preprocessor_scan.py), not just scan |
035 D2 (G19.1) |
pattern_facts_files.py |
The discovery half of the lexical pre-scan, split out of pattern_facts.py: this scanner's walk policy (suffix allowlist, extensionless-header heuristic, pruned dirs), resolve_expected_source_inputs(), and the live-extraction licence its direct-root entry points run under. pattern_facts.py re-exports SOURCE_SUFFIXES |
035 D2 |
source_inputs.py |
The expected-input-set model every filesystem-reading pre-scan resolves its inputs through, plus the SourceReadLicence that decides whether the filesystem may be read at all. Owns the contract a path recorded in a snapshot is provenance, not a licence to re-read the current filesystem for historical facts: SourceInputDisposition (scanned/missing/unreadable/unsupported/excluded/not-licensed), SourceInputSet.sufficient (an absence claim needs every expected input accounted for — a missing root is never "fully covered"), SourceInputSet.merged (two sources with independent provenance folded into one account, order-independently under DISPOSITION_PRECEDENCE), build_evidence_collected_live (only an inline collection performed in this run is live; any pre-captured contribution makes the merged pack historical), resolve_source_inputs(). Deny-by-default, and resolved per evidence source — a snapshot-wide licence let a live header dump license re-reading a pre-captured pack's recorded compile units |
035 D2 |
preprocessor_facts.py |
S2 conditional pre-scan (ADR-035 D2; renamed from preprocessor_scan.py, same Phase 6 rename as pattern_facts.py): collect_preprocessor_facts(build, public_headers) runs only when L3 build evidence + a preprocessor (clang -E) are present (else returns ran=False + a skipped_reason coverage row — never clean). Pure core (parse_defined_macros, select_abi_macros/is_abi_macro, find_macro_divergence, classify_include/find_private_header_leaks) + live ClangPreprocessorExtractor (-E -dM macro capture, -M per-header include capture; integration-only). Emits advisory ABI-macro-value-divergence + private/generated-header-leak facts feeding D3/D4; never a verdict. Reached automatically from compare()'s pipeline, not just scan |
035 D2 (G19.1) |
providers.py |
ADR-035 D10 per-level provider contract: LayerProvider Protocol (capabilities/estimate/run(ctx, poi)) + ScanContext (shared read-only inputs), LayerFacts, ProviderCapabilities, ProviderCostEstimate. Orphaned, not live (see docs/contribute/architecture-deepening-plan.md's C12 section): zero production implementers, and its would-be driver (scan_engine.run_scan_core(), itself deleted along with the rest of scan in ADR-068 Phase 6) never imported it — the module's own PointsOfInterest type is now an Any stand-in for the same reason. Free of compiler/service imports so it stays a pure contract, but nothing currently wires it up; C12's keep-vs-delete decision is still open. |
035 D10 (G19.7) |
~~poi.py~~ |
Deleted (ADR-068 Phase 6). Evidence-directed focusing — the D7 points-of-interest work-list. A call-site audit found its only production callers were scan-only (scan_engine.py; workflows/extraction.py re-exported two names but called neither), so it went with scan rather than being renamed |
035 D7 (G19.5), removed |
~~risk.py~~ |
Deleted (ADR-068 Phase 6). Path-glob risk scoring for the scan orchestrator. Every production caller (scan_engine.py, service_scan.py, cli_scan*.py, workflows/scan_config.py) was scan-only, so it went with scan rather than being renamed |
035 D3 (G19.3), removed |
build_evidence.py |
BuildEvidence normalized model: Target, CompileUnit, LinkUnit, Toolchain, Generator, BuildOption, TargetScope (P0.2 root-target-scoping request/resolution accounting — requested/resolved/transitive_count), plus l3_coverage_fields() (the shared implementation inline.build_inline_coverage calls for the L3_build report row's P0.2 fields) |
029 D1/D2 |
build_diff.py |
diff_build_evidence() → build-flag/toolchain drift findings |
029 D9 |
source_abi.py |
SourceAbiTu (per-TU dump) + SourceAbiSurface (linked source_abi.json) schemas, SourceEntity/SourceLocation, L4_SOURCE_ABI boundary |
030 D4/D5/D10 |
source_link.py |
link_source_abi() — fold per-TU dumps into a per-library surface; map decls→exported symbols; ODR detection |
030 D5 |
source_diff.py |
diff_source_abi() → the 9 source-replay findings (macros/default-args/inline/template/constexpr/…); never BREAKING |
030 D6 |
source_graph.py |
Back-compat re-export facade only (ADR-061 Phase 5 item 2, 1352 → 140 lines) — SourceGraphSummary/GraphSummaryDiff/node-id constructors/schema vocabulary live in abicheck.model.source_graph, GraphNode/GraphEdge in abicheck.model.graph_facts; construction, comparison, and the shared classification predicates below all live in their own sibling modules now. Still re-exports diff_source_graph_findings from source_graph_findings.py via a lazy __getattr__ shim (avoids a static import cycle, same pattern as cli_buildsource.py's back-compat shim) |
031 D2/D6/D7, 046 D1/D2/D3, 061 Phase 5 item 2 |
source_graph_build.py |
ADR-061 Phase 5 item 2's construction slice, Phase 2: build_source_graph(build, source_abi=…) (folds BuildEvidence → target/source/header/option/link graph), project_source_files(), _conf_from_build(). Classified extract in architecture/modules.yaml while staying physically flat in this package (the same flat-classification pattern crosscheck_base.py already uses for compare) |
031 D2, 061 Phase 5 item 2 |
source_graph_build_source_abi.py |
ADR-061 Phase 5 item 2's construction slice, Phases 3-4: _augment_with_source_abi() (an optional SourceAbiSurface → decl/type/macro + source↔binary edges), fold_source_edges() (the ADR-038 C.9 source_edges fold), mark_source_edges_extractor_coverage(), _file_in_project(). Split from source_graph_build.py purely to stay under the new-file line-count cap; classified extract |
031 D2, 038 C.9, 061 Phase 5 item 2 |
source_graph_compare.py |
ADR-061 Phase 5 item 2's comparison slice: diff_source_graph() (structural delta), localize_symbol() (graph explain); uses label_map()/kind_map() from abicheck.model.source_graph_query. Classified compare |
031 D6/D8, 061 Phase 5 item 2 |
source_graph_query.py |
Back-compat re-export facade only (ADR-061 Phase 5 item 2 closure) — the shared node/edge-classification predicates neither the construction nor comparison half owns exclusively (is_public_dependency_node(), is_internal_dependency_node(), is_consumer_compiled_node()/is_consumer_compiled_public_entry(), looks_like_system_name(), decl_declaring_files(), and the PUBLIC_VISIBILITIES/DECL_NODE_KINDS-family constants) now live in abicheck.model.source_graph_query (unclassified here, no longer compare) — read by crosscheck.py, graph_reconcile.py, compare/internal_leak.py, impact/*, surface.py, post_processing_reachability.py, and (the reason for the move) poi.py (extract-classified, which may not import compare). These are read-only structural classifications of an already-built graph — "match/identify a raw change" was compare's own task-routing fit while the module lived there, not policy's "decide relevance/suppression/severity" one — but the module's own imports are (and always were) only model.graph_facts/model.source_graph, which is the fact that actually unblocks extract: every layer may import model |
041 P0, 061 Phase 5 item 2 |
~~graph_facts.py~~ |
Deleted (ADR-063 Phase 10). The L5 node/edge schema and ADR-046 fact-merge machinery live in abicheck/model/graph_facts.py (identity helpers in model/graph_identity.py, vocabulary in model/graph_vocabulary.py); this back-compat facade had no remaining purpose once every caller imported the owner. |
— |
source_graph_findings.py |
diff_source_graph_findings() → the D6 secondary risk findings (phase 5/6: SOURCE_TO_BINARY_MAPPING_CHANGED, PUBLIC_REACHABILITY_CHANGED, GENERATED_HEADER_REACHES_PUBLIC_API, CALL_GRAPH_PUBLIC_ENTRY_REACHABILITY_CHANGED, INCLUDE_GRAPH_PUBLIC_HEADER_DRIFT, BUILD_OPTION_REACHES_PUBLIC_SYMBOL, PUBLIC_API_INTERNAL_DEPENDENCY_ADDED, TARGET_DEPENDENCY_ADDED, EXPORTED_SYMBOL_SOURCE_OWNER_CHANGED) and their per-family helpers — split out of source_graph.py to keep that module under its line-count cap |
031 D6 |
clang_ast_run.py |
The one bounded clang -ast-dump=json run per translation unit: dump_tu_ast() returns a TuAstDump, and dump_compile_unit() builds its argv through the one builder (clang_command.build_clang_command). L4 replay and the L5 AST passes both read it, so a TU that both tiers read is dumped once. The L5 cap (120 s) is folded against --budget; each failure point degrades to a stage. |
031 D4 (phase 6); plan l4-l2-extraction-convergence Phase 2 |
abi_flags.py |
Leaf: the ABI-affecting flag prefixes (ABI_RELEVANT_FLAG_PREFIXES), the split-operand encoding (split_operand_survivor), and drop_code_loading_options(), the deny rule the shared replay argv applies to -fplugin= and -Xclang -load. |
029 D9, 030 D2 |
source_replay_shared.py |
The shared L4/L5 run: run_shared_dumps() dumps each TU of the L4 cache misses and of the L5 scope once. L4 reads the raw tree, the L5 hook then materializes it, and only after both is it released. |
031 D4 |
l5_ast_pass.py |
The one clang AST pass every clang-backed L5 graph family reads. run_l5_ast_pass scopes the compile DB once (inline_graph_fold._scope_narrowed_target's precedence), run_ast_passes sizes one worker pool, dumps each TU once, applies every family's AstPass (L5_AST_PASSES: per-TU parser + cross-TU merge + the exceptions that degrade a TU for that family) and folds results/diagnostics in input order. fold_semantic_graphs is the only entry point — the inline dump --sources path and the out-of-band collect path both call it, so their pass lists cannot drift. Replaced six Clang*GraphExtractor classes that each re-ran the same dump and the same loop; a new clang-backed family adds one AstPass here and one fold_* that reads run.outcomes[name]. See docs/contribute/plans/l4-l2-extraction-convergence.md |
031 D4, 041 |
l5_ast_run.py |
Leaf holding L5AstRun (the run's scope + per-family outcomes) and AstPassOutcome (result, diagnostics, jobs, elapsed) — the shapes the inline_graph_fold.fold_* functions read, split out so inline_graph_fold can name them without importing l5_ast_pass (which imports it) |
031 D4 |
semantic_fact_folds.py |
The one owner of the override, template and callback fact families: parse_semantic_facts/SemanticFactStream (whole tree / streamed), merge_semantic_facts, and the fold_*_facts graph folds both the L5 folds (inline_graph_fold) and the default L2 header pass (header_graph_ast_projection.seed_ast_graph) call, so the two producers derive the same facts from the same AST. |
041 (G29 Phase 5) |
call_graph.py |
parse_clang_ast_calls() (pure clang -ast-dump=json → CallEdges, unit-tested), merge_call_edges() (cross-TU dedup), the replay argv/worker-sizing helpers the L5 AST pass uses, augment_graph_with_calls() → DECL_CALLS_DECL edges labelled with call_kind/resolution. _find_referenced_decl()'s member_index (G29 Phase 5 item 3 Codex review, fresh evidence) resolves a MemberExpr's referencedMemberDecl — a bare node-id string in real clang output, not the nested dict an earlier version only recognized — back to the real CXXMethodDecl/... node via a clang-id-keyed index built alongside id_index; without it, every p->f()-shaped virtual/member call silently fell through to the receiver's own reference and misclassified as call_kind="function_pointer". Only covers _FUNCTION_DECL_KINDS nodes — a FieldDecl-typed callback slot invoked via w->cb(x) still resolves to no edge (see callback_graph.py's own documented gap). Two further Codex-review fixes (fresh evidence, both empirically verified against real Clang 17 output): _index_member_decls() is a whole-AST pre-pass (id -> node, no scope tracking, run once before _walk_calls) so a call to a member declared later in the same class body still resolves — the previous incremental-only population left it unindexed at the moment of resolution; and _ref_is_virtual() recognizes an override/final method as virtual even when clang omits "virtual": true from the override's own declaration (only the slot's original declaring ancestor carries it), by checking the resolved node's own OverrideAttr/FinalAttr child instead — kept local to this module rather than importing override_graph.py's own hierarchy-derived virtual-identity set, since that direction would form a real import cycle the AI-readiness import-cycle-growth gate rejects (override_graph.py already function-locally imports from this module). A further Codex-review round (same push) found _ref_is_virtual alone over-fires: _member_expr_is_qualified() now also detects an explicitly-qualified call (obj.Base::f(), or the common B::f() base-chaining call from inside an override) via source-range arithmetic — clang's JSON AST carries no qualifier field at all, unlike its text dump — and suppresses the virtual classification for it, since C++ qualification suppresses dynamic dispatch regardless of the target's own virtuality. Known, documented, deliberately-unfixed false positive: legal whitespace/comments between the receiver and member (obj . f()) also widen the same gap arithmetic, so it misfires the same way real qualification does — closing this needs actual source text this pure-AST-dict function doesn't have access to (unlike macro_graph.py's own Pass B); pinned by a dedicated regression test rather than patched with an unsound threshold. Known, documented, deliberately-unfixed false negative (Codex review, fresh evidence): a derived method redeclaring a virtual signature with NEITHER override/final NOR a repeated "virtual": true carries neither of _ref_is_virtual's two signals, so the call classifies direct/exact instead of virtual/overapprox — the same import-cycle reasoning above blocks closing it locally; pinned in tests/test_call_graph_extra.py (a sibling split of test_call_graph.py, which sits at its own 2000-line hard cap) alongside the sibling working case (an OverrideAttr-marked override with no "virtual": true). _classify_call() also treats a virtual CXXOperatorCallExpr (a virtual overloaded operator invoked through a base reference/pointer, B &b; b();) the same way it already treats CXXMemberCallExpr (Codex review, fresh evidence) — its callee is a plain DeclRefExpr, not a MemberExpr, so it was previously classified direct/exact regardless of the resolved method's own virtuality. Closing this needed a deeper fix in _find_referenced_decl() itself: a DeclRefExpr's compact referencedDecl stub is now upgraded to the FULL declaration node via member_index (by the stub's own id) when one is already indexed — mirroring the resolution the string-shaped referencedMemberDecl path already had, but a DeclRefExpr's dict-shaped stub never went through it, so _ref_is_virtual read a stub with neither virtual nor inner populated. Falls back to the stub itself when nothing is indexed (a forward reference, or a non-function-decl-kind ref like VarDecl/ParmVarDecl/FieldDecl, never added to member_index at all), preserving the existing _POINTER_DECL_KINDS function-pointer-call classification |
031 D4 (phase 6) |
type_graph.py |
TypeEdge, the EDGE_* kinds, merge_type_edges() (role-aware cross-TU merge), augment_graph_with_types() → TYPE_INHERITS/TYPE_HAS_FIELD_TYPE/DECL_HAS_TYPE/DECL_REFERENCES_DECL edges — the non-call decl/type dependencies crosscheck.py's public_to_internal_dependency already read but nothing populated before this module. Folded alongside the call graph (inline._fold_type_graph, same scoping). The pure per-TU walk parse_clang_ast_types() and the _emit_*/_templated_entity_src() walkers now live in type_graph_walk.py; index_declared_type_files(ast) lives in type_graph_index.py (the split moved them out of this module, and type_graph.py re-exports nothing); _resolve_nested_type_names lives in type_graph_names.py. index_declared_type_files(ast) is a small additive public wrapper (qualified type name → declaring file) factored out of the same first-indexing pass, for header_graph.py's type-node visibility classification. G29 Phase 5 item 5 brought the emitted role set to the parity that item asked for, adding three roles with no prior producer: _emit_enum_underlying_edge() (enum_underlying — an EnumDecl carries no type key at all, so the shared typedef path it already took read an empty spelling and enum class Color : detail::Handle emitted nothing; reads fixedUnderlyingType.qualType, the as-written spelling, never the sibling desugaredQualType that has already lost the identity the edge names) and _emit_template_parameter_edges() (template_param/default_template_arg — a non-type template parameter's own type and a parameter's default type argument). The load-bearing property of the latter is _templated_entity_src(): a template wrapper is not a node in this graph and its parameters are direct children of the wrapper while the templated entity is a sibling child, so the identity is re-derived exactly the way the walk does for that child's own kind (record/alias → record_type, hence TYPE_HAS_FIELD_TYPE; function/variable → source_decl, hence DECL_HAS_TYPE) — a function template's pattern FunctionDecl carries no mangledName, so both sides must fall through the same qualified-name+signature-hash identity or the constraint lands on an orphan node nothing else reaches. A non-type parameter's default value and a template template parameter's default are deliberately unemitted: clang dumps them as {"kind": "TemplateArgument", "isExpr": true} and a bare {"kind": "TemplateArgument"} respectively, carrying no type to resolve (ADR-028 D3), both pinned by integration tests against the compiler itself. Five further roles that item names needed no producer at all — typedef target and alias-template target both reach _emit_alias_edge's alias role (clang nests the real TypeAliasDecl inside the TypeAliasTemplateDecl, and the walk recurses into a template wrapper with the unchanged scope), variable type is _emit_var_decl_edge's var, and member-pointer type/function-pointer signature are reached by _resolve_nested_type_names's existing pointer-to-member/declarator handling under the enclosing declaration's own role. Concept/constraint dependency is the one role left open — a ConceptSpecializationExpr names no concept at all in clang's JSON (only an ImplicitConceptSpecializationDecl loc.offset join back to the ConceptDecl is available), and a concept is a declaration that is not a type, so it needs a new node kind and its own scoped decision; see the G29 plan's Phase 5 item 5. _emit_template_parm_list_edges() (Codex review, fresh evidence) recurses into a TemplateTemplateParmDecl child's own nested parameter list, not just the outer template's direct children — template <template <detail::Handle H> class C> struct Outer nests H inside C's own node, and the original single-level loop never descended into it; recursion (not one extra unrolled level) since C++ permits an arbitrarily deep chain of template-template parameters, every level still attributing its edge to the same outermost src/edge_kind |
041 P0 (+ addendum), G29 Phase 5 item 5 |
type_graph_names.py |
Textual type spelling for the type graph: _base_type_name() and the declarator/template/signature stripping, _decl_type_name()/_decl_return_type_name(). Pure string work, a leaf module (split out of type_graph.py, same behaviour). |
041 P0 |
type_graph_index.py |
Declaration indexes and name resolution for the type graph: _AstIndexes, _index_declared_entities(), _resolve_type_name()/_resolve_ref_identity(), the per-AST ast_derived_scope(), and the index_declared_type_files()/index_declared_entity_files() projections. |
041 P0 |
type_graph_walk.py |
The AST walkers that emit the type/reference edges: parse_clang_ast_types() (the pure per-TU entry point) and the _walk_*/_emit_* family, deduplicated. Split out of type_graph.py. |
041 P0 |
header_graph_ast_stream.py |
Projects a clang AST from disk, one top-level declaration at a time, so the document and the tree are never resident together — which is where a cold header-graph attach's whole peak was (document + tree inside json.load, not tree + graph). project_header_graph_ast_file(path) must agree exactly with header_graph_ast_projection.project_header_graph_ast, and does not reimplement any reader: the same four run over the same nodes in the same order. Two pieces of order-dependent state clang's format carries across sibling top-level declarations are threaded explicitly, because a whole-tree walk got them from sibling recursion — the sticky loc.file, and an anonymous tag and its declarator falling either side of an element boundary (type_graph_walk._walk_child_sequence exists for the second). Measured on a 262.8 MiB AST: 698.9 → 298.4 MiB peak at 2.9x the parse's wall time; end to end on a cold cache with the castxml backend, the attach's peak goes 605.5 → 210.8 MiB. Unchanged under --ast-frontend clang, where the primary dump's in-process memo means the attach never parsed twice in the first place. Full account: docs/contribute/measurements/header-graph-attach-memory.md § Follow-up 3 |
perf (#1338/#1339 follow-up) |
call_decl_record.py |
What call_graph's member_index retains: the exhaustive set of fields such an entry is ever read through, and nothing else. Indexing the node itself also pins each function's whole body for the life of the parse, which on a real AST is most of the tree (+168 MiB vs +44 MiB, measured on 14,539 declarations) and is what would otherwise pin every top-level element a streaming reader had already released. A retention contract rather than a call-graph detail, which is why it states its own read set |
perf |
override_graph.py |
ADR-041 P2 item 1: parse_clang_ast_overrides() (pure clang -ast-dump=json → OverrideEdges, unit-tested — reuses type_graph.parse_clang_ast_types()'s resolved TYPE_INHERITS edges for the class hierarchy rather than re-deriving base-name resolution), parse_clang_ast_override_facts()/merge_override_facts() (the family's per-TU parser — edges plus the two identity sets — and its cross-TU merge), augment_graph_with_overrides() → METHOD_POSSIBLE_OVERRIDE edges (resolution in attrs, either override_confirmed — clang's own OverrideAttr, i.e. the override keyword was written — or the weaker override_signature_match, a (name, type.qualType) match against an already-virtual base slot with no compiler confirmation). Closes the loop call_graph.py's CALL_KIND_VIRTUAL/RESOLUTION_OVERAPPROX opened: which declarations are the actual override candidates for a virtual slot. Only CXXMethodDecl/CXXConversionDecl participate for override-EDGE matching (constructors/destructors and class-template specializations are deliberately out of scope for this first slice — see the module's own docstring); a derived method matching more than one nearest declaring ancestor (multiple inheritance, reached past a non-redeclaring intermediate class where applicable) emits an edge to EACH such ancestor whose own slot is independently virtual; a covariant-return override is a documented false negative, not a false positive (its type.qualType genuinely differs from its base's). parse_clang_ast_virtual_destructor_owners() (Codex review, fresh evidence) is a separate, narrower pure function answering just "does this class directly declare its own virtual destructor" — no override-EDGE matching, sidestepping the Itanium D1/D2 dual-mangling concern that keeps destructors out of _OVERRIDE_CANDIDATE_KINDS — feeding virtual_dispatch_graph.py's third vtable-presence seed (a class whose only virtual member is its destructor was invisible to both existing seeds) |
041 P2 |
virtual_dispatch_graph.py |
G29 Phase 5 item 3: augment_graph_with_virtual_call_targets() (VIRTUAL_CALL_MAY_DISPATCH_TO — joins a virtual DECL_CALLS_DECL edge against every METHOD_POSSIBLE_OVERRIDE edge naming its base method, re-pointing from the caller to each override candidate; resolution always overapprox, never exact; a leaf virtual method with no override candidates emits no edge, not a self-edge) + augment_graph_with_vtable_presence() (TYPE_HAS_VTABLE — the one new node kind this Phase 5 family introduces, vtable, minted at most once per polymorphic record_type; owner recovery via diff_cxx_rules.itanium_scope_components/msvc_scope_components, exact-match only; closed transitively over TYPE_INHERITS). Unlike every sibling module in this family, shells out to no compiler — both are pure transforms over already-folded call_graph/type_graph/override_graph state, driven by inline_graph_fold.fold_virtual_dispatch_graph right after fold_override_graph. DECL_OVERRIDES_DECL is registered but has no producer — already satisfied by override_graph.py's own METHOD_POSSIBLE_OVERRIDE edges with resolution == "override_confirmed"; VTABLE_SLOT_MAPS_TO_DECL stays reserved (needs a real per-slot Itanium layout model). augment_graph_with_vtable_presence()'s third seed (Codex review, fresh evidence) reads the has_virtual_destructor fact override_graph.py's parse_clang_ast_virtual_destructor_owners() stamps directly on the owning class's own record_type node — closing the gap where a class whose only virtual member is its destructor was invisible to the override-edge seed (destructors excluded from edge matching) and the leaf-virtual-method seed (a bare, uncalled destructor typically has no decl:// node). Same join-only-onto-an-existing-node discipline as the other two: an isolated class with no TYPE_INHERITS/override edge minting its bare record_type node has nothing to stamp the fact onto either (verified empirically: type_graph.py's own CXXRecordDecl walk mints only the class's injected-class-name identity, e.g. record::Base::Base, for a fully isolated class — not the bare Base this seed's owner identities use) |
041 P2 (G29 Phase 5 item 3) |
callback_graph.py |
G29 Phase 5 item 4: parse_clang_ast_callbacks() (pure clang -ast-dump=json → CallbackEdges, unit-tested — a new AST pass finding every place a function's address flows into a function-pointer-typed slot, explicit &func or implicit function-to-pointer decay), merge_callback_edges(), augment_graph_with_callback_registrations() (DECL_REGISTERS_CALLBACK — a direct call argument at a function-pointer-typed parameter position, CONF_HIGH; DECL_TAKES_ADDRESS_OF — a broader assignment/initializer catch-all, CONF_REDUCED; join-only-onto-an-existing-node, also stamps a function_pointer_signature node-level fact for FUNCTION_POINTER_HAS_SIGNATURE) + augment_graph_with_callback_invocations() (CALLBACK_MAY_INVOKE — a pure join, no new clang pass, over call_graph.py's already-folded function-pointer-kind DECL_CALLS_DECL edges against whatever DECL_REGISTERS_CALLBACK/DECL_TAKES_ADDRESS_OF edges name the same slot; resolution always overapprox). The identity design (why Part A's join actually connects) deliberately mirrors call_graph.py's own pre-existing weak, unqualified slot identity (a VarDecl/ParmVarDecl/FieldDecl is never in call_graph's own id_index) rather than inventing a stronger one that would simply never match; a struct-field-typed slot invoked via w->cb(x) member-call syntax is a documented, inherited join gap in call_graph.py itself — referencedMemberDecl is a bare id string, not a dict; a later same-PR fix taught _find_referenced_decl to resolve that string via a new member_index, but only for _FUNCTION_DECL_KINDS nodes (the fix's own motivating case, a virtual method call), so a FieldDecl (what a callback slot always is) still isn't indexed — the call now resolves to no edge at all rather than the wrong receiver-attributed edge found originally, an improvement but not a close — see the module's own docstring for the full empirical grounding and what's deliberately deferred (extending member_index to also cover FieldDecl, CXXMemberCallExpr registration detection). _address_taken_function() also unwraps an explicit cast (CStyleCastExpr/CXXStaticCastExpr/CXXReinterpretCastExpr/CXXConstCastExpr/CXXFunctionalCastExpr/CXXDynamicCastExpr) around a &func/decay shape (Codex review, fresh evidence) — an earlier version only unwrapped ParenExpr, silently omitting a registration whose callback argument is explicitly cast to its target function-pointer type ((handler_t)handler/static_cast<handler_t>(handler)). _FUNCTION_POINTER_TYPE_RE also accepts a top-level const/volatile between * and ) (Codex review, fresh evidence) — an earlier version only allowed whitespace there, rejecting the desugared spelling of a cv-qualified typedef'd parameter (void (*const)(int)) outright. _index_walk()'s per-parameter identity falls back to f"{callee_identity}#param{position}" when call_graph._identity() reads an unnamed ParmVarDecl as "" (Codex review, fresh evidence) — a common prototype-only registration-API shape (void reg(void (*)(int));) previously collapsed every unnamed callback slot in the whole codebase onto the same decl:// node; an unnamed parameter can never be referenced by name from within its own function body, so the fallback only needs to be stably unique per callee, not to match anything else. _address_taken_function() also unwraps a single-element InitListExpr (Codex review, fresh evidence) — C++ list-initialization of a function-pointer-typed variable (handler_t slot{my_handler};) wraps the identical ImplicitCastExpr/FunctionToPointerDecay inside an InitListExpr, verified against real Clang 18 output; only ever unwraps a single-element list, since a scalar type type-checks to exactly one initializer in valid C++. _index_walk() also indexes an unnamed record's own direct FieldDecl children into field_by_id (CodeRabbit review, fresh evidence) — gating that indexing on the record's own name being truthy previously skipped an anonymous struct/union's fields entirely (union { handler_t cb; };), so a callback slot inside one could never resolve; its scope only extends with a name when it has one. augment_graph_with_callback_invocations() also stamps a role (the joined slot id) alongside slot in CALLBACK_MAY_INVOKE's attrs (CodeRabbit review, fresh evidence) — without a role discriminator, the same caller reaching the same registered function through two DIFFERENT slots produced two edges sharing the identical (src, dst, kind) relation key (ADR-046 D1), so SourceGraphSummary.add_edge's dedup silently collapsed one real dispatch path (and its own slot fact) into the other |
041 (G29 Phase 5 item 4) |
header_graph.py |
build_header_only_graph(snapshot, ast_projection=..., ...) — a header-only (L2), no-build alternative to the L4/L5 graph: seeds source_decl/type nodes straight from an AbiSnapshot + a header-aggregate clang -ast-dump=json tree, projected first by header_graph_ast_projection.project_header_graph_ast (reusing type_graph.parse_clang_ast_types()/call_graph.parse_clang_ast_calls() unmodified — both are pure over a bare AST dict), so TYPE_INHERITS/TYPE_HAS_FIELD_TYPE/DECL_HAS_TYPE/SOURCE_DECLARES are available with zero build integration; DECL_CALLS_DECL/DECL_REFERENCES_DECL only for in-header bodies (inline/template). Uses its own extractor_passes names ("header_call_graph"/"header_type_graph") so a header-only pass is never conflated with a build-integrated one. G31 Phase A: always attempted whenever headers are parsed (compare's implicit-dump path, the PE/Mach-O dump path via the shared dump executor, and the ELF dump path via cli_dump_helpers.perform_elf_dump calling service._attach_header_graph directly as a post-processing step on the snapshot dumper.dump() already built, so dumper.py itself needed no change — it sits at its 2000-line hard cap) — no longer gated behind --header-graph/--header-graph-includes (those hidden, inert deprecated no-op shims have since been removed entirely, along with cli_options.header_graph_options; CLI cleanup H1). cli_buildsource.embed_build_source backfills a pre-attached header-only source_graph into its --build-info/--sources merged pack when that merge collected none of its own, so a --build-info embed no longer silently drops the graph. Not yet on scan; not yet built for directory/package (set-input) compare (see docs/contribute/plans/g31-header-graph-default-on-followup.md) |
041 addendum, G31 |
include_graph.py |
parse_depfile() (pure clang -MM parser, unit-tested), ClangIncludeExtractor (live clang, integration-only), augment_graph_with_includes() → COMPILE_UNIT_INCLUDES_FILE edges . ClangIncludeExtractor.extract_from_build is plan/run/fold: it plans one DepfileProbe per compile unit, hands them to include_graph_workers.run_probes, then folds the returned outcomes back in planned order — so the include map, the diagnostics and their order are independent of worker completion order |
031 D3 |
include_graph_workers.py |
The scheduling half of the depfile pass: resolve_jobs() (ABICHECK_INCLUDE_MAP_JOBS / shared process_resources CPU+RAM sizing), run_probes() (bounded thread pool, deadline re-establishment into workers, per-probe timeout + aggregate-budget accounting), and one process-wide gate on concurrently spawned clang -M children so two sides resolving at once cannot oversubscribe the host. State-free apart from that semaphore: every probe reports its result as a ProbeOutcome rather than mutating anything |
031 D3 |
graph_backends.py |
ingest_kythe_entries() / ingest_codeql_call_results() — fold pre-captured Kythe/CodeQL exports into the graph (non-executing), recording the store in external_graph_refs |
031 D5 (phase 7) |
source_extractors/ |
SourceAbiExtractor interface + castxml (phase 2), clang (phase 5, body fingerprints), Android adapter (phase 6) |
030 D3 |
source_replay.py |
select_compile_units() (D7 scopes), SourceAbiCache (D8 per-TU cache, hit/miss instrumented, per-pass dep-digest memo), run_source_replay() driver (P06 parallel extract — thread pool by default, ProcessPoolExecutor opt-in via ABICHECK_L4_EXECUTOR=process to parallelize the GIL-bound AST post-processing, serial fallback), scope_for_ci_mode()/collection_for_ci_mode(), recommend_collect_mode() (ADR-033 D3 PR-diff localizer). Env knobs: ABICHECK_L4_JOBS (clamped to max(8, 2×cpu) and to available/ABICHECK_L4_JOB_MEM_GIB — a single template-heavy TU's clang JSON AST can be multi-GiB, so the worker count is RAM-aware to avoid OOM-killing the replay; "available" is min(/proc/meminfo MemAvailable, cgroup v2/v1 memory headroom) so containers honour their cgroup limit, not host RAM; default budget 3.0 GiB/worker, Linux only; the per-TU peak is also cut by spilling clang's AST to a temp file + json.load instead of buffering it in a str, see source_extractors/clang.py), ABICHECK_L4_EXECUTOR, ABICHECK_L4_CACHE_DIR (persist the per-TU cache; wired through inline.collect_inline_pack). See docs/contribute/performance.md § L4. |
030 D7/D8, 033 D2/D3 |
build_cache.py |
BuildEvidenceCache + compute_build_cache_key() — content-addressed L3 cache (false-miss-preferring), optional in collect_inline_pack(build_cache_dir=…) |
033 D5 |
extractor.py |
DataExtractor protocol (discover/collect/normalize/validate), CollectionContext, ExtractorCapabilities, CollectionAction/CollectionMode, resolve_allowed_actions()/require_action() — the plugin interface + security model |
032 D1/D2/D4/D5/D9 |
extractor_manifest.py |
ExtractorManifest + load_extractor_manifest() (trusted-by-operator YAML), render_command(), ExternalCliExtractor + run_external_extractor() — external CLI extractors over a subprocess boundary (no shell, sanitized env, action ceiling) |
032 D3/D8/D10 |
redaction.py |
RedactionPolicy — strip secrets/abs paths from command lines |
032 D7 |
evidence_policy.py |
ADR-033 D7/D9 pure helpers split from cli_buildsource.py: apply_evidence_policy() (category verdict modulation via Change.effective_verdict), require_evidence_findings() (EVIDENCE_REQUIRED_MISSING gate), evidence_coverage_metrics()/echo_evidence_metrics() (D9 metrics) |
033 D7/D9 |
adapters/compile_db.py |
compile_commands.json → CompileUnits (reuses build_context.py) |
029 D3 |
adapters/cmake_file_api.py |
CMake File API reply → targets/toolchains/fileSets | 029 D4 |
adapters/ninja.py |
Ninja -t compdb/graph (live or pre-captured) |
029 D5 |
adapters/bazel.py |
Bazel cquery/aquery jsonproto → targets/compile+link units (live or pre-captured). bazel_deps_expression() (P0.2) builds the deps(...) query-language scope — //... (workspace-wide) when no root targets given, else the bare target or a set(...) union of several — shared by this adapter's own live-query path (BazelAdapter(targets=...)) and build_query.py's zero-config inferred-query path so the two can't independently drift. BazelAdapter.collect() stamps BuildEvidence.target_scope (requested vs. resolved roots + transitive count) whenever targets/target is given |
029 D6 |
adapters/make.py |
Make -n/--trace dry-run transcript → reduced-confidence compile units |
029 D7 |
compiler_record.py |
ELF .GCC.command.line + DWARF DW_AT_producer → toolchain/options (advisory) |
029 D8 |