From 494ae2dc7cbe44bec92e548890f87abc91756b5e Mon Sep 17 00:00:00 2001 From: joyful-ii-V-I <210578314+joyful-ii-V-I@users.noreply.github.com> Date: Wed, 18 Nov 2026 23:53:08 -0500 Subject: [PATCH 01/35] IMPORT-PROVED-SPLITS: the shared pathOwners hook (Rust unchanged) ReceiverEvidence::rustPathOwners becomes the Rust arm of pathOwners( r, cand, canonical, classOf ): same-named classes in two or more files give a call one candidate per class, and what the call writes may name one of them. Rust keeps its own resolver (rustQualifierClass) at the canonical tier, byte for byte. The new import arm reads a receiver rule's answer for `C.m()` (Rule 2c, FE-B narrow) and keeps the members of the ONE class the file's import of C proves (classOf, graph.h ImportProvedClass); it only narrows, to a non-empty strict subset, never a class of the caller's own file. The enum is now PathOwners. No resolver is wired yet (ImportProvedClass answers kNoNode): output unchanged. rustqualcheck ALL PASS. Co-Authored-By: Claude Opus 5.5 --- src/graph.h | 27 ++++++++++++++----- src/receiverevidence.h | 60 ++++++++++++++++++++++++++++++++++-------- 2 files changed, 70 insertions(+), 17 deletions(-) diff --git a/src/graph.h b/src/graph.h index 1256f4304..933790746 100644 --- a/src/graph.h +++ b/src/graph.h @@ -10542,6 +10542,18 @@ inline bool callArityCannotTake( const Reference& ref, const Symbol& cs, std::ui { return ref.argCountKnown && ( ( cs.arityExact != 0 && ref.argCount > cs.params ) || ref.argCount < paramsMin ); } +// IMPORT-PROVED-SPLITS: ReceiverEvidence::pathOwners' per-language resolver — the ONE in-tree class `name` names where `r` is +// written, through the caller file's own import of the name; kNoNode for none, several, or a language with no resolver here. +struct ImportProvedClass +{ + NodeId operator()( const Reference& r, std::string_view name ) const + { + static_cast( r ); + static_cast( name ); + return kNoNode; + } +}; + inline bool pythonScopePinAt( const PythonLexicalScopes& scopes, const IngestResult& ing, const ExternalVetoTables& veto, const Reference& r, std::vector& cand ) { const auto moduleUnread = [ & ] @@ -11036,6 +11048,7 @@ inline Graph buildGraph( const IngestResult& ing, const ScipOverlay* scip = null } } ReceiverEvidence recvEv( ing, chaUp, classNames ); + const ImportProvedClass importClass{}; // IMPORT-PROVED-SPLITS: recvEv.pathOwners' per-language resolver HashMap qualifierVerdicts = buildQualifierVerdicts( ing, extVeto, falseEdges ); // h1-annot { PROFILE_SCOPE_DESCRIBE( "buildGraph/2i: receiver-evidence tables" ); @@ -12437,22 +12450,22 @@ inline Graph buildGraph( const IngestResult& ing, const ScipOverlay* scip = null [ & ]( NodeId c ) { return langCompatible( symLang[ c ], r.lang ) && sameRoot( c, r.fileId ); } ); canonical = !cand.empty(); } - // RUST-PATH-OWNER (receiverevidence.h rustPathOwners): the tier matched a Rust path's scope NAME; the type the path resolves to + // RUST-PATH-OWNER (receiverevidence.h pathOwners, the Rust arm rustPathOwners): the tier matched a Rust path's scope NAME; the type the path resolves to // where it is written decides among same-named types — the one it names, external=, a decline, a hedge over every candidate // (nameOnly below), or the ladder's own split that no locality tie-break narrows - const ReceiverEvidence::RustPathOwners rustPath = recvEv.rustPathOwners( r, cand, canonical ); - if( rustPath == ReceiverEvidence::RustPathOwners::External ) + const ReceiverEvidence::PathOwners rustPath = recvEv.pathOwners( r, cand, canonical, importClass ); + if( rustPath == ReceiverEvidence::PathOwners::External ) { disposition = vetoExternal( r ); continue; } - if( rustPath == ReceiverEvidence::RustPathOwners::Decline ) + if( rustPath == ReceiverEvidence::PathOwners::Decline ) { recordDecline( r, cand, DeclinedSiteKind::Ladder ); disposition = CallDisposition::Declined; continue; } - const bool rustPathHedge = rustPath == ReceiverEvidence::RustPathOwners::Hedge; + const bool rustPathHedge = rustPath == ReceiverEvidence::PathOwners::Hedge; // ── L3 fn-pointer/callback binding resolve — BEFORE Rule 1, because a local variable shadows a // same-named class member or global in real C++ name lookup. A bare call `fn()` whose name has ANY // var→function binding visible at this call site is a call THROUGH THE VARIABLE: it resolves via @@ -12766,6 +12779,7 @@ inline Graph buildGraph( const IngestResult& ing, const ScipOverlay* scip = null && recvEv.types.jvmHides( r.fileId, r.startByte, std::string_view( r.recvVar ).substr( 0, std::min( r.recvVar.str().find( '.' ), r.recvVar.size() ) ) ) ) ) { narrowed = narrowTo( narrower.rule2cClassNameRecv( r, ing.symbols[ r.fromSymbol ].scope, { classNames, fieldNarrow.localNameSet, memberFields }, chaUp ), r, cand ); + recvEv.pathOwners( r, cand, canonical, importClass ); // IMPORT-PROVED-SPLITS: `C.m()` over same-named classes keeps the one C's import proves } // P2-D Rule 2b (receiver-FIELD type, W1-P1-12): a named-receiver call `f.m()` / `f->m()` whose receiver names a FIELD of the caller's // enclosing class — or of the one base declaring it, when the class declares none — resolves to the method on the field's DECLARED @@ -12794,6 +12808,7 @@ inline Graph buildGraph( const IngestResult& ing, const ScipOverlay* scip = null cand.push_back( c ); } } + recvEv.pathOwners( r, cand, canonical, importClass ); // IMPORT-PROVED-SPLITS, as after Rule 2c narrowed = !cand.empty() && !kotlinScopeUndo(); } // lane L6 (ifacedispatch.h): the receiver's recorded type is an interface, a trait or a class declaring the callee with @@ -13756,7 +13771,7 @@ inline Graph buildGraph( const IngestResult& ing, const ScipOverlay* scip = null if( !scipPinned && !bindingPinned && r.lang != Lang::Elixir && tier.size() > 1 && !ing.symbols[ r.fromSymbol ].scope.empty() && r.recv != RecvKind::FieldOfThis && r.recv != RecvKind::FieldOfVar && r.recv != RecvKind::SuperObj && !identityClaim && !isJsTsLitRecv( r.recv ) && r.recv != RecvKind::JavaTypeCandidate && !nameOnly // FE-B: a name-only call keeps every candidate - && rustPath != ReceiverEvidence::RustPathOwners::Split ) // RUST-PATH-OWNER: same-named types the path cannot tell apart are a genuine split (#74) + && rustPath != ReceiverEvidence::PathOwners::Split ) // RUST-PATH-OWNER: same-named types the path cannot tell apart are a genuine split (#74) { const std::string& callerCanon = g.localityKeyAt( r.fromSymbol ); // == canonId here (the caller is scoped) const std::size_t localityCap = receiverLocalityCap( r, receiverTypeNarrowed, ing.files[ ing.symbols[ r.fromSymbol ].fileId ] ); diff --git a/src/receiverevidence.h b/src/receiverevidence.h index 751704867..6b87db218 100644 --- a/src/receiverevidence.h +++ b/src/receiverevidence.h @@ -4615,16 +4615,16 @@ struct ReceiverEvidence // caller's own crate, or a member there it cannot place beside another, split: every candidate stays (rustLadderSplit: // the ladder's own split when locality would keep them all, else hedged) — never a locality pick. One there, a crate the layout cannot // place, or a module's item among the candidates (`util::tool()`: the module path decides it) keeps the tier as before. - enum class RustPathOwners : std::uint8_t { Keep, Hedge, Split, External, Decline }; + enum class PathOwners : std::uint8_t { Keep, Hedge, Split, External, Decline }; static constexpr NodeId kRustOwnerUnread = kNoNode - 1; // rustPathOwnerMemo: not read yet static constexpr NodeId kRustOwnerOutside = kNoNode - 2; // an owner: the impl's own type name leads out of the tree where the impl is written static constexpr NodeId kRustOwnerInTree = kNoNode - 3; // an owner: no indexed class, but the impl's type name is a `use` into the tree mutable std::vector rustPathOwnerMemo; // per symbol: its owner as rustPathOwners reads it (sized on first use) - RustPathOwners rustPathOwners( const Reference& r, std::vector& cand, bool canonical ) const + PathOwners rustPathOwners( const Reference& r, std::vector& cand, bool canonical ) const { if( !canonical || callResultFamilyOf( r.lang ) != CallResultFamily::Rust || r.qualifier.empty() || cand.empty() ) { - return RustPathOwners::Keep; + return PathOwners::Keep; } const std::string_view written = rustWrittenQualifierOf( r ); const NodeId cls = rustQualifierClass( r, written ); @@ -4667,10 +4667,10 @@ struct ReceiverEvidence } if( !any ) { - return RustPathOwners::Decline; // cand untouched: the declined site lists the namesakes it refused + return PathOwners::Decline; // cand untouched: the declined site lists the namesakes it refused } keepWhere( mine ); - return RustPathOwners::Keep; + return PathOwners::Keep; } if( rustPathHeadLeavesTree( r.fileId, r.startByte, written ) ) { @@ -4684,19 +4684,19 @@ struct ReceiverEvidence forEachBase( ownerClass[ cand[ i ] ], [ & ]( std::string_view b ) { implementsTail = implementsTail || CallResultTypes::splitLast( b, "::" ).second == tail; } ); return owners[ i ] == kRustOwnerOutside || owners[ i ] == kNoNode || implementsTail; } ); - return cand.empty() ? RustPathOwners::External : RustPathOwners::Hedge; + return cand.empty() ? PathOwners::External : PathOwners::Hedge; } // a module's item among them (`util::tool()`, an inline mod's fn) is the module path's question, not a type's: the tier as before if( cand.size() < 2 || std::ranges::any_of( cand, [ & ]( NodeId c ) { return ownerClass[ c ].empty(); } ) ) { - return RustPathOwners::Keep; + return PathOwners::Keep; } // the types a path no `use` chooses may mean are the caller's own crate's (another crate's needs a `use` or its name); a crate the // layout cannot place, or one of them in it, leaves the tier as before const std::uint32_t crate = types.rustCrateOfFile( r.fileId ); if( crate == CallResultTypes::kNoCrate ) { - return RustPathOwners::Keep; + return PathOwners::Keep; } std::size_t inCrate = 0; NodeId first = kNoNode; @@ -4711,12 +4711,12 @@ struct ReceiverEvidence differ = differ || owners[ i ] != first || owners[ i ] == kNoNode || owners[ i ] == kRustOwnerOutside || owners[ i ] == kRustOwnerInTree; ++inCrate; } - return inCrate >= 2 && differ ? rustLadderSplit( r, cand ) : RustPathOwners::Keep; + return inCrate >= 2 && differ ? rustLadderSplit( r, cand ) : PathOwners::Keep; } // RUST-PATH-OWNER: how the ladder keeps a Split's candidates. Tier 1 or 2 holding all of them or none (tier 3's canonical rescue) // is its own split (Split: no locality tie-break narrows it); a strict subset there would be a locality pick among types the path // cannot tell apart, so every candidate is hedged instead (Hedge) - RustPathOwners rustLadderSplit( const Reference& r, const std::vector& cand ) const + PathOwners rustLadderSplit( const Reference& r, const std::vector& cand ) const { const std::string_view dir = includerDir( ing.files[ r.fileId ] ); std::size_t inFile = 0; @@ -4728,7 +4728,45 @@ struct ReceiverEvidence inDir += includerDir( ing.files[ f ] ) == dir ? 1u : 0u; } const bool subset = inFile != 0 ? inFile < cand.size() : inDir != 0 && inDir < cand.size(); - return subset ? RustPathOwners::Hedge : RustPathOwners::Split; + return subset ? PathOwners::Hedge : PathOwners::Split; + } + // IMPORT-PROVED-SPLITS: the shared hook. Same-named classes in two or more files give a call one candidate per class, and what + // the call WRITES may name one of them: a Rust path's type (rustPathOwners, when the canonical tier answered), or a receiver + // spelled as the class, `C.m()`, whose C the caller file's import binds (importPathOwners, when a receiver rule answered). + // `classOf( r, name )` is the per-language resolver: the ONE in-tree class `name` names where `r` is written, through the + // caller file's own import of it; kNoNode for none, several, an outside class or a name something else binds there + // (graph.h ImportProvedClass). Rust reads its own (rustQualifierClass). + template + PathOwners pathOwners( const Reference& r, std::vector& cand, bool canonical, const ClassOf& classOf ) const + { + return callResultFamilyOf( r.lang ) == CallResultFamily::Rust ? rustPathOwners( r, cand, canonical ) : importPathOwners( r, cand, canonical, classOf ); + } + // IMPORT-PROVED-SPLITS: a receiver rule's answer for `C.m()` (the receiver chain is the one name C: not `this`/`self`/`cls`/ + // `super`, no field path, no construction) that holds members of two or more classes keeps the members of the ONE class the + // file's import of C proves (`classOf`). Only ever narrows, and only to a non-empty strict subset: a class the import names + // that owns none of them (an inherited member, a re-export the resolver cannot follow), a class of the caller's own file (its + // scoping is not an import's), or no proof at all leaves `cand` as the rule left it. Always Keep. + template + PathOwners importPathOwners( const Reference& r, std::vector& cand, bool canonical, const ClassOf& classOf ) const + { + const Chain ch = chainOf( r ); + if( canonical || cand.size() < 2 || !r.qualifier.empty() || !ch.valid || ch.root.empty() || !ch.path.empty() || !ch.ctor.empty() + || isThisRoot( ch.root ) || isSuperRoot( r, ch.root ) || ch.root == "cls" ) + { + return PathOwners::Keep; + } + const NodeId cls = classOf( r, ch.root ); + if( cls == kNoNode || ing.symbols[ cls ].fileId == r.fileId ) + { + return PathOwners::Keep; + } + const auto owned = [ & ]( NodeId c ) { return ing.symbols[ c ].fileId == ing.symbols[ cls ].fileId && types.classHolding( ing.symbols[ c ].fileId, ing.symbols[ c ].sigStartByte ) == cls; }; + const std::size_t kept = std::size_t( std::ranges::count_if( cand, owned ) ); + if( kept != 0 && kept != cand.size() ) + { + std::erase_if( cand, [ & ]( NodeId c ) { return !owned( c ); } ); + } + return PathOwners::Keep; } // rust-receivers: the ONE class `self` names inside `from` (or the method enclosing it): the in-tree class of the method's // owner name that owns the method (memberOwnerRuleOf — Rust: its own file and item scope, or the only class of the name); From 4838f6bf32875584760e899ef67dfbe678455022 Mon Sep 17 00:00:00 2001 From: joyful-ii-V-I <210578314+joyful-ii-V-I@users.noreply.github.com> Date: Thu, 19 Nov 2026 00:07:34 -0500 Subject: [PATCH 02/35] IMPORT-PROVED-SPLITS: a TS `C.m()` binds the class the file's ES import of C pins The TS resolver for the shared hook (graph.h ImportProvedClass::jsClass): the class an ES named import of the receiver's name pins in the caller's file (buildJsImportTables: Pinned through the module's export table, renamed or not), unless a local declaration shadows the import or a write rebinds the name at the call's byte. ReceiverEvidence::pathOwners then keeps that class's members of the receiver rule's answer. Before: `import { URI } from './a/uri'; URI.file()` beside a b/uri.ts twin was a split of both files' `file`; with a third, unexported URI in the caller's directory the receiver rule bound that one alone, unhedged (wrong). Gate test/importprovedsplitscheck.sh (fixtures written at test time): 5 positive arms RED on 496765d8e (4 split, 1 wrong unhedged), GREEN here; 7 negative arms (no import, a re-export the resolver does not follow, a parameter shadowing the import, the caller file's own class, a renamed bare import, two declined loose receivers) unchanged and counted (7 rows read). Co-Authored-By: Claude Opus 5.5 --- src/graph.h | 27 +++++- test/importprovedsplitscheck.sh | 150 ++++++++++++++++++++++++++++++++ test/regression.sh | 1 + 3 files changed, 174 insertions(+), 4 deletions(-) create mode 100644 test/importprovedsplitscheck.sh diff --git a/src/graph.h b/src/graph.h index 933790746..2a15ac65a 100644 --- a/src/graph.h +++ b/src/graph.h @@ -10546,11 +10546,30 @@ inline bool callArityCannotTake( const Reference& ref, const Symbol& cs, std::ui // written, through the caller file's own import of the name; kNoNode for none, several, or a language with no resolver here. struct ImportProvedClass { + const JsImportTables& jsImports; + const IngestResult& ing; + NodeId operator()( const Reference& r, std::string_view name ) const { - static_cast( r ); - static_cast( name ); - return kNoNode; + return r.lang == Lang::TypeScript || r.lang == Lang::JavaScript ? jsClass( r, name ) : kNoNode; + } + // TS/JS: the class an ES named import of `name` (renamed or not) pins in r's file (buildJsImportTables: Pinned, the module's export + // table names it) — not where a local declaration shadows the import or a write rebinds the name (FC3) at r's byte + NodeId jsClass( const Reference& r, std::string_view name ) const + { + const std::string key = jsImportKey( r.fileId, name ); + const auto pin = jsImports.targets.find( key ); + if( pin == jsImports.targets.end() || pin->second.outcome != JsImportOutcome::Pinned || pin->second.node == kNoNode + || !ReceiverEvidence::classLike( ing.symbols[ pin->second.node ].kind ) ) + { + return kNoNode; + } + const auto covers = [ & ]( const HashMap>& spans ) + { + const auto it = spans.find( key ); + return it != spans.end() && std::ranges::any_of( it->second, [ & ]( const VarSpan& s ) { return r.startByte >= s.startByte && r.startByte < s.endByte; } ); + }; + return covers( jsImports.shadows ) || covers( jsImports.rebinds ) ? kNoNode : pin->second.node; } }; @@ -11048,7 +11067,7 @@ inline Graph buildGraph( const IngestResult& ing, const ScipOverlay* scip = null } } ReceiverEvidence recvEv( ing, chaUp, classNames ); - const ImportProvedClass importClass{}; // IMPORT-PROVED-SPLITS: recvEv.pathOwners' per-language resolver + const ImportProvedClass importClass{ jsImports, ing }; // IMPORT-PROVED-SPLITS: recvEv.pathOwners' per-language resolver HashMap qualifierVerdicts = buildQualifierVerdicts( ing, extVeto, falseEdges ); // h1-annot { PROFILE_SCOPE_DESCRIBE( "buildGraph/2i: receiver-evidence tables" ); diff --git a/test/importprovedsplitscheck.sh b/test/importprovedsplitscheck.sh new file mode 100644 index 000000000..a97a1db1a --- /dev/null +++ b/test/importprovedsplitscheck.sh @@ -0,0 +1,150 @@ +#!/usr/bin/env bash +# importprovedsplitscheck.sh — IMPORT-PROVED-SPLITS: a call on same-named classes in two or more files, written with the class as +# its receiver (`C.m()`), binds the ONE class the caller file's import of C proves (src/receiverevidence.h pathOwners, the shared +# hook; its per-language resolver src/graph.h ImportProvedClass). Before: the receiver rule kept every same-named class's member, +# a split (or, with a third namesake in the caller's directory, that namesake alone). +# +# The fixtures are written at test time (no committed tree a whole-repo run would index). Rows are read from --pin-census. +# TypeScript (fixture ts/): a/uri.ts and b/uri.ts each `export class URI { static file(); static parse() }` +# POSITIVE app.ts import { URI } from './a/uri'; URI.file() → a/uri.ts::file only +# both.ts import { URI } from a + { URI as URI2 } from b; URI.file(); URI2.parse() → a's file, b's parse +# shadow.ts a closure inside the importing function: URI.parse() → a's parse +# tslocal/ app.ts as above beside a THIRD, unexported URI in local.ts → a's file (base: local.ts's, unhedged) +# NEGATIVE neither.ts no import of URI → still the split of both +# viabarrel.ts import { URI } from './reexp' (export { URI } from './a/uri') → still the split (a re-export is not followed) +# loose.ts this.u.file() / v.file() on untyped receivers → still declined (dc rows), never bound +# shadow.ts a parameter named URI: URI.file() → unchanged (no class-name reading) +# tslocal/local.ts the class of the caller's own file → its own file's file, unchanged +# ren.ts import { helper as h }; h() → the renamed import still pins (mech import) +# Every negative arm counts the rows it read and fails when it read none (a vacuous arm proves nothing). +# +# Usage: bash test/importprovedsplitscheck.sh [BIN] (default build/ripwire; exits non-zero on any failure) +set -u +ROOT="$( cd "$( dirname "$0" )/.." && pwd )" +. "$ROOT/test/lib/clean-env.sh" +BIN="${1:-${RIPWIRE_BIN:-$ROOT/build/ripwire}}" +[ "${BIN#/}" = "$BIN" ] && BIN="$ROOT/$BIN" +TMP="$( mktemp -d )"; trap 'rm -rf "$TMP"' EXIT +fail=0 +ok(){ printf ' PASS %s\n' "$*"; } +no(){ printf ' FAIL %s\n' "$*"; fail=1; } + +[ -x "$BIN" ] || { echo "FAIL: no binary at $BIN"; exit 1; } +echo "importprovedsplitscheck: $( "$BIN" --version 2>/dev/null )" + +# ── fixtures ── +TS="$TMP/ts"; mkdir -p "$TS/a" "$TS/b" "$TS/c" +cat >"$TS/a/uri.ts" <<'EOF' +export class URI { + static file( p: string ): URI { return new URI(); } + static parse( p: string ): URI { return new URI(); } +} +EOF +cp "$TS/a/uri.ts" "$TS/b/uri.ts" +printf 'export function helper(): number { return 1; }\n' >"$TS/c/other.ts" +printf "export { URI } from './a/uri';\n" >"$TS/reexp.ts" +cat >"$TS/app.ts" <<'EOF' +import { URI } from './a/uri'; +export function open(): URI { + return URI.file( 'x' ); +} +EOF +cat >"$TS/both.ts" <<'EOF' +import { URI } from './a/uri'; +import { URI as URI2 } from './b/uri'; +export function twice(): number { + URI.file( 'x' ); + return URI2.parse( 'y' ) ? 1 : 0; +} +EOF +cat >"$TS/shadow.ts" <<'EOF' +import { URI } from './a/uri'; +export function shadowed( URI: any ): number { + return URI.file( 's' ) ? 1 : 0; +} +export function inner(): number { + const run = () => URI.parse( 'i' ); + return run() ? 1 : 0; +} +EOF +cat >"$TS/neither.ts" <<'EOF' +import { helper } from './c/other'; +export function none(): number { + helper(); + return URI.file( 'z' ) ? 1 : 0; +} +EOF +cat >"$TS/viabarrel.ts" <<'EOF' +import { URI } from './reexp'; +export function fromBarrel(): number { + return URI.file( 'rb' ) ? 1 : 0; +} +EOF +cat >"$TS/loose.ts" <<'EOF' +import { URI } from './a/uri'; +import { URI as U2 } from './b/uri'; +class Holder { + private u = pick(); + run(): void { + this.u.file( 'q' ); + const v = pick(); + v.file( 'r' ); + } +} +function pick() { return Math.random() > 0.5 ? URI : U2; } +EOF +cat >"$TS/ren.ts" <<'EOF' +import { helper as h } from './c/other'; +export function viaRen(): number { + return h(); +} +EOF +TL="$TMP/tslocal"; mkdir -p "$TL/a" "$TL/b" +cp "$TS/a/uri.ts" "$TL/a/"; cp "$TS/b/uri.ts" "$TL/b/"; cp "$TS/app.ts" "$TL/" +cat >"$TL/local.ts" <<'EOF' +class URI { + static file( p: string ): URI { return new URI(); } +} +export function same(): URI { + return URI.file( 'l' ); +} +EOF + +# census DIR → $TMP/.census (rc checked: a failed run would make every arm below vacuous) +census(){ ( cd "$1" && "$BIN" . --no-cache --pin-census="$TMP/$2.census" >/dev/null 2>"$TMP/$2.err" ); local rc=$? + [ "$rc" -eq 0 ] || { no "$2: the --pin-census run failed (rc=$rc)"; return 1; }; return 0; } +# row NAME CALLER_FILE CALLEE LINE → "mechtargets" of the one C row (empty when none); the row count goes to $TMP/rows +row(){ awk -F'\t' -v f="$2" -v c="$3" -v l="$4" '$1=="C" && index($6,f"::")==1 && $7==c && $9==l { print $2"\t"$8; n++ } END { print n+0 > "'"$TMP"'/rows" }' "$TMP/$1.census"; } +targets(){ printf '%s' "$1" | cut -f2 | tr '|' '\n' | sed 's/#[0-9]*$//' | sort | tr '\n' ' ' | sed 's/ $//'; } +seen=0 # rows the negative arms read +# expect NAME FILE CALLEE LINE WANT_TARGETS [MECH] — the site's one row has exactly these targets (and this mechanism) +expect(){ local r; r=$( row "$1" "$2" "$3" "$4" ); local n; n=$( cat "$TMP/rows" ); local t; t=$( targets "$r" ) + if [ "$n" = 1 ] && [ "$t" = "$5" ] && { [ -z "${6:-}" ] || [ "$( printf '%s' "$r" | cut -f1 )" = "$6" ]; }; then ok "$1 $2:$4 $3 -> $5${6:+ ($6)}" + else no "$1 $2:$4 $3: want $5${6:+ ($6)}, got rows=$n [$r]"; fi; } + +census "$TS" ts || exit 1 +census "$TL" tslocal || exit 1 + +echo "── TypeScript: the import proves one class ──" +expect ts app.ts file 3 "a/uri.ts::file" +expect ts both.ts file 4 "a/uri.ts::file" +expect ts both.ts parse 5 "b/uri.ts::parse" +expect ts shadow.ts parse 6 "a/uri.ts::parse" +expect tslocal app.ts file 3 "a/uri.ts::file" + +echo "── TypeScript: nothing proves one class, or the receiver is not the class ──" +neg(){ expect "$@"; seen=$(( seen + $( cat "$TMP/rows" ) )); } +neg ts neither.ts file 4 "a/uri.ts::file b/uri.ts::file" split +neg ts viabarrel.ts file 3 "a/uri.ts::file b/uri.ts::file" split +neg ts shadow.ts file 3 "a/uri.ts::file" +neg tslocal local.ts file 5 "local.ts::file" +neg ts ren.ts h 3 "c/other.ts::helper" import +( cd "$TS" && "$BIN" . --no-cache --callers=file --legend=compact ) >"$TMP/loose.callers" 2>/dev/null || no "loose: the --callers=file run failed" +ndc=$( grep -o ']*p="loose.ts:[68]"[^>]*>' "$TMP/loose.callers" | grep -c 'via="declined"' ) +if [ "$ndc" -eq 2 ] && ! grep -q ']*p="loose.ts:[68]"' "$TMP/loose.callers"; then ok "loose.ts:6/8 this.u.file() / v.file() stay declined (2 dc rows, no caller row)" +else no "loose.ts: want 2 declined sites and no caller row, got $ndc"; sed 's///; s/^/ | /' "$TMP/loose.callers" | head -5; fi +seen=$(( seen + ndc )) +if [ "$seen" -ge 7 ]; then ok "the negative arms read $seen rows (premise: none vacuous)"; else no "the negative arms read only $seen rows (want >= 7)"; fi + +[ "$fail" -eq 0 ] && echo "ALL PASS" || echo "SOME FAILED" +exit "$fail" diff --git a/test/regression.sh b/test/regression.sh index e26dd67c8..562983d7f 100755 --- a/test/regression.sh +++ b/test/regression.sh @@ -665,6 +665,7 @@ for _g in \ impacttypecheck \ importcapcheck \ importnarrowcheck \ + importprovedsplitscheck \ importspellingcheck \ includeanglecheck \ includeprecisecheck \ From 45edcb31ecb738bb1930b0727f1f7f66a8416074 Mon Sep 17 00:00:00 2001 From: joyful-ii-V-I <210578314+joyful-ii-V-I@users.noreply.github.com> Date: Thu, 19 Nov 2026 00:20:47 -0500 Subject: [PATCH 03/35] IMPORT-PROVED-SPLITS: a Python `C.m()` / `C()` binds the class `from m import C` names The Python resolver for the shared hook (graph.h ImportProvedClass): pythonRenamedImportPin, now asked for any name (the receiver's as well as the callee's), reads a plain module-scope `from m import C` too when C names Python classes in two or more files (PythonRenamedImports::plainClasses, pythonMultiFileClassNames), and pins such a C only to a class. The same checks as for a renamed import decide it: no local, parameter, enclosing def or comprehension binds C at the call, no module rebinding or star import in the caller file, m resolves to ONE file whose module scope binds C only by its class (addPythonLookupNames now reads those names' bindings). So: - `C.m()`: ReceiverEvidence::pathOwners keeps the members of that class of Rule 2c's / FE-B's answer (a renamed `from m import C as B; B.m()` too); - a bare `C( .. )`: the import pin binds the class (prov import), as a renamed import's call already did. Before: textual's `Timer( .. )` in message_pump.py was a split of events.Timer and timer.Timer; a third same-named class in the caller's directory took the receiver rule's bind alone, unhedged (wrong). A plain import of a function still keeps the ladder. Gate test/importprovedsplitscheck.sh, Python section: 4 positive arms RED on 496765d8e (3 split, 1 wrong unhedged), GREEN here; 10 negative arms (no import, two star imports, a module import, a target module that rebinds the class, a parameter shadowing it, loose receivers, a plain function import, a renamed bare import, the caller file's own class) unchanged; 17 negative rows read in all. Co-Authored-By: Claude Opus 5.5 --- src/graph.h | 112 +++++++++++++++++++++++++------- test/importprovedsplitscheck.sh | 58 ++++++++++++++++- 2 files changed, 144 insertions(+), 26 deletions(-) diff --git a/src/graph.h b/src/graph.h index 2a15ac65a..24b82e9c4 100644 --- a/src/graph.h +++ b/src/graph.h @@ -2940,6 +2940,30 @@ inline HashMap buildPythonModuleRebindVetoes( const IngestRes return pythonModuleRebind; } +// IMPORT-PROVED-SPLITS: every name Python classes carry in two or more files — the names a plain `from m import C` may tell apart +inline HashMap pythonMultiFileClassNames( const IngestResult& ing ) +{ + HashMap firstFile; // name → the first file defining a class of it; UINT32_MAX once a second file does + for( const Symbol& s : ing.symbols ) + { + if( s.lang != Lang::Python || s.kind != SymKind::Class ) + { + continue; + } + const auto [ it, fresh ] = firstFile.try_emplace( s.name, s.fileId ); + it->second = !fresh && it->second != s.fileId ? UINT32_MAX : it->second; + } + HashMap multi; + for( const auto& [ name, file ] : firstFile ) + { + if( file == UINT32_MAX ) + { + multi.try_emplace( name, '\0' ); + } + } + return multi; +} + // is `path` a Python source file (.py / .pyi)? inline bool isPythonSourcePath( std::string_view path ) noexcept { @@ -2993,8 +3017,18 @@ inline HashMap pythonBaseClauseNames( const IngestResult& ing // pkg's __init__ may bind). pythonReexportChain and pythonImportedBases read the bindings of exactly these (a renamed hop, a package // that binds the submodule's name). PY-IMPORT-ALIAS-CALL adds the member of EVERY renamed // member import (`from m import f as g`: f), whose bindings in m pythonRenamedImportPin reads (pythonEndpointBindsOnlyByClass). +// IMPORT-PROVED-SPLITS adds the name of every plain module-scope `from m import C` whose C names Python classes in two or more files +// (pythonMultiFileClassNames): pythonRenamedImportPin reads m's own bindings of it too. inline void addPythonLookupNames( const IngestResult& ing, HashMap& names ) { + const HashMap multi = pythonMultiFileClassNames( ing ); + for( const Binding& b : ing.bindings ) + { + if( b.kind == LocalBindKind::Import && b.importedName.empty() && multi.contains( b.var ) ) + { + names.try_emplace( b.var, '\0' ); + } + } for( const Reference& r : ing.references ) { if( r.isInherit && !r.memberRoot.empty() && r.fileId < ing.files.size() && isPythonSourcePath( rootRelPath( ing, r.fileId ) ) ) @@ -9307,40 +9341,55 @@ struct PythonAliasShadow VarSpan span; // [startByte, endByte): where the name is the comprehension target or lambda parameter }; +// IMPORT-PROVED-SPLITS: `plainClasses`: "#C" for every Python file where EVERY import of C is one module-scope plain `from m +// import C` and C names Python classes in two or more files (pythonMultiFileClassNames): pythonRenamedImportPin pins such a C only +// to a class. struct PythonRenamedImports { HashMap renamed; + HashMap plainClasses; std::vector shadows; - [[nodiscard]] bool empty() const noexcept { return renamed.empty(); } + [[nodiscard]] bool empty() const noexcept { return renamed.empty() && plainClasses.empty(); } }; inline PythonRenamedImports buildPythonRenamedImports( const IngestResult& ing ) { - PythonRenamedImports out; - std::string key; + PythonRenamedImports out; + std::string key; + const HashMap multi = pythonMultiFileClassNames( ing ); for( const Binding& b : ing.bindings ) { if( b.kind != LocalBindKind::Import || b.var.empty() || b.fileId >= ing.files.size() || !isPythonSourcePath( rootRelPath( ing, b.fileId ) ) ) { continue; } - const bool renamed = b.importedName.str().starts_with( kPythonFromMemberMark ) && pythonBindScope( ing, b ) == kNoNode; - const std::string member = renamed ? b.importedName.substr( kPythonFromMemberMark.size() ) : std::string{}; + const bool moduleScope = pythonBindScope( ing, b ) == kNoNode; + const bool renamed = b.importedName.str().starts_with( kPythonFromMemberMark ) && moduleScope; + const bool plain = b.importedName.empty() && moduleScope && multi.contains( b.var ); // IMPORT-PROVED-SPLITS: member == the name + const std::string member = renamed ? b.importedName.substr( kPythonFromMemberMark.size() ) : plain ? std::string( b.var ) : std::string{}; const auto [ it, fresh ] = out.renamed.try_emplace( fileNameKey( key, b.fileId, b.var ), member ); if( !fresh && it->second != member ) { it->second.clear(); // two imports of one name that disagree: never decided } } - std::erase_if( out.renamed, []( const auto& kv ) { return kv.second.empty(); } ); - if( out.renamed.empty() ) + std::erase_if( out.renamed, [ & ]( const auto& kv ) + { + const bool plain = !kv.second.empty() && kv.first.ends_with( kv.second ) && kv.first.size() > kv.second.size() && kv.first[ kv.first.size() - kv.second.size() - 1 ] == '#'; + if( plain ) + { + out.plainClasses.try_emplace( kv.first, '\0' ); + } + return kv.second.empty() || plain; + } ); + if( out.empty() ) { return out; } for( const Binding& b : ing.bindings ) { if( b.kind == LocalBindKind::RecvType && b.fromSymbol != kNoNode && !b.var.empty() && b.fileId < ing.files.size() - && out.renamed.contains( fileNameKey( key, b.fileId, b.var ) ) ) + && ( out.renamed.contains( fileNameKey( key, b.fileId, b.var ) ) || out.plainClasses.contains( key ) ) ) { out.shadows.push_back( PythonAliasShadow{ b.fromSymbol, b.var, VarSpan{ b.spanStart, b.spanEnd } } ); } @@ -9356,15 +9405,18 @@ inline PythonRenamedImports buildPythonRenamedImports( const IngestResult& ing ) // re-exports x defines none there: no decision, the call falls to the unchanged ladder (a floor, not a guess). A comprehension target or lambda parameter // named y that covers the call byte is a binding too (PythonRenamedImports::shadows: the site-spanned records localNameSet skips). inline NodeId pythonRenamedImportPin( const IngestResult& ing, const PythonRenamedImports& imports, const ExternalVetoTables& v, - const ExternalVeto& veto, const HashMap>& byName, const Reference& r ) + const ExternalVeto& veto, const HashMap>& byName, const Reference& r, + std::string_view name ) { std::string key; - const auto rit = imports.renamed.find( fileNameKey( key, r.fileId, r.calleeName ) ); - if( rit == imports.renamed.end() || r.fromSymbol == kNoNode || r.fromSymbol >= ing.symbols.size() + const auto rit = imports.renamed.find( fileNameKey( key, r.fileId, name ) ); + const bool plain = rit == imports.renamed.end() && imports.plainClasses.contains( key ); // IMPORT-PROVED-SPLITS: `from m import C`, C's own name + const std::string_view member = plain ? name : rit == imports.renamed.end() ? std::string_view{} : std::string_view( rit->second ); + if( member.empty() || r.fromSymbol == kNoNode || r.fromSymbol >= ing.symbols.size() || v.pythonModuleRebind.contains( key ) || v.pythonModuleRebind.contains( fileNameKey( key, r.fileId, kPythonDynamicWrite ) ) - || ( r.fileId < v.pythonScopes.starTargets.size() && !v.pythonScopes.starTargets[ r.fileId ].empty() ) || veto.hasLocal( r, r.calleeName ) - || std::ranges::any_of( imports.shadows, [ &r ]( const PythonAliasShadow& s ) - { return s.sym == r.fromSymbol && s.var == r.calleeName && r.startByte >= s.span.startByte && r.startByte < s.span.endByte; } ) ) + || ( r.fileId < v.pythonScopes.starTargets.size() && !v.pythonScopes.starTargets[ r.fileId ].empty() ) || veto.hasLocal( r, name ) + || std::ranges::any_of( imports.shadows, [ &r, name ]( const PythonAliasShadow& s ) + { return s.sym == r.fromSymbol && s.var == name && r.startByte >= s.span.startByte && r.startByte < s.span.endByte; } ) ) { return kNoNode; } @@ -9372,13 +9424,13 @@ inline NodeId pythonRenamedImportPin( const IngestResult& ing, const PythonRenam { Reference at = r; at.fromSymbol = outer; - if( veto.hasLocal( at, r.calleeName ) ) + if( veto.hasLocal( at, name ) ) { return kNoNode; // an enclosing def binds the name: a closure reads that, not the import } } - const auto mf = v.memberImportFile.find( fileNameKey( key, r.fileId, r.calleeName ) ); - const auto dit = byName.find( rit->second ); + const auto mf = v.memberImportFile.find( fileNameKey( key, r.fileId, name ) ); + const auto dit = byName.find( std::string( member ) ); if( mf == v.memberImportFile.end() || mf->second == kNoFile || dit == byName.end() ) { return kNoNode; @@ -9404,13 +9456,13 @@ inline NodeId pythonRenamedImportPin( const IngestResult& ing, const PythonRenam // namespace write (`globals()[...]`, `setattr(...)`) may bind it too. A module `__getattr__` (PEP 562) answers only a name m does not // bind, so it withholds only when x's def sits inside an `if`/`try`/`with`/loop at module scope (kPythonCondDefPrefix: it may not run) if( only != kNoNode - && ( !pythonEndpointBindsOnlyByClass( v, mf->second, rit->second ) || v.pythonModuleRebind.contains( fileNameKey( key, mf->second, kPythonDynamicWrite ) ) + && ( !pythonEndpointBindsOnlyByClass( v, mf->second, member ) || v.pythonModuleRebind.contains( fileNameKey( key, mf->second, kPythonDynamicWrite ) ) || ( v.pythonModuleRebind.contains( fileNameKey( key, mf->second, kPythonDynamicBind ) ) - && v.pythonModuleRebind.contains( fileNameKey( key, mf->second, std::string{ kPythonCondDefPrefix }.append( rit->second ) ) ) ) ) ) + && v.pythonModuleRebind.contains( fileNameKey( key, mf->second, std::string{ kPythonCondDefPrefix }.append( member ) ) ) ) ) ) { return kNoNode; } - return only; + return plain && only != kNoNode && ing.symbols[ only ].kind != SymKind::Class ? kNoNode : only; // a plain import pins only a class } // tier 2, JS/TS: a bare name an ES named import pins, or a CommonJS `const { Node } = require('./a')` (a ModuleAlias, not @@ -10546,11 +10598,20 @@ inline bool callArityCannotTake( const Reference& ref, const Symbol& cs, std::ui // written, through the caller file's own import of the name; kNoNode for none, several, or a language with no resolver here. struct ImportProvedClass { - const JsImportTables& jsImports; - const IngestResult& ing; + const JsImportTables& jsImports; + const IngestResult& ing; + const PythonRenamedImports& pyImports; + const ExternalVetoTables& extVeto; + const ExternalVeto& externalVeto; + const HashMap>& byName; NodeId operator()( const Reference& r, std::string_view name ) const { + if( r.lang == Lang::Python ) + { + const NodeId pin = pythonRenamedImportPin( ing, pyImports, extVeto, externalVeto, byName, r, name ); + return pin != kNoNode && ing.symbols[ pin ].kind == SymKind::Class ? pin : kNoNode; // Python: a plain or renamed member import of a class + } return r.lang == Lang::TypeScript || r.lang == Lang::JavaScript ? jsClass( r, name ) : kNoNode; } // TS/JS: the class an ES named import of `name` (renamed or not) pins in r's file (buildJsImportTables: Pinned, the module's export @@ -11067,7 +11128,7 @@ inline Graph buildGraph( const IngestResult& ing, const ScipOverlay* scip = null } } ReceiverEvidence recvEv( ing, chaUp, classNames ); - const ImportProvedClass importClass{ jsImports, ing }; // IMPORT-PROVED-SPLITS: recvEv.pathOwners' per-language resolver + const ImportProvedClass importClass{ jsImports, ing, pyRenamedImports, extVeto, externalVeto, byName }; // IMPORT-PROVED-SPLITS: recvEv.pathOwners' per-language resolver HashMap qualifierVerdicts = buildQualifierVerdicts( ing, extVeto, falseEdges ); // h1-annot { PROFILE_SCOPE_DESCRIBE( "buildGraph/2i: receiver-evidence tables" ); @@ -12572,11 +12633,12 @@ inline Graph buildGraph( const IngestResult& ing, const ScipOverlay* scip = null const JsWrittenRoot writtenRoot = !scipPinned && !jsImports.rebinds.empty() && langFacts( r.lang ).writtenBindingUndecided ? jsMemberRootWritten( jsImports, r ) : JsWrittenRoot::None; // PY-IMPORT-ALIAS-CALL: `from m import x as y; y()` — the Python twin for a RENAMED member import (pythonRenamedImportPin - // states when it decides). A plain `from m import x` keeps the ladder: the call's own spelling already names x. + // states when it decides). A plain `from m import x` keeps the ladder (the call's own spelling already names x), unless x is a + // class other files define too (IMPORT-PROVED-SPLITS: `Timer( .. )` binds the imported Timer, not every Timer). if( !scipPinned && !canonical && !narrowed && !pyRenamedImports.empty() && r.role == RefRole::Call && r.recv == RecvKind::None && r.qualifier.empty() && !r.memberCall && r.lang == Lang::Python ) { - if( const NodeId pin = pythonRenamedImportPin( ing, pyRenamedImports, extVeto, externalVeto, byName, r ); pin != kNoNode ) + if( const NodeId pin = pythonRenamedImportPin( ing, pyRenamedImports, extVeto, externalVeto, byName, r, r.calleeName ); pin != kNoNode ) { cand.push_back( pin ); narrowed = true; diff --git a/test/importprovedsplitscheck.sh b/test/importprovedsplitscheck.sh index a97a1db1a..64e0e5bb2 100644 --- a/test/importprovedsplitscheck.sh +++ b/test/importprovedsplitscheck.sh @@ -16,6 +16,20 @@ # shadow.ts a parameter named URI: URI.file() → unchanged (no class-name reading) # tslocal/local.ts the class of the caller's own file → its own file's file, unchanged # ren.ts import { helper as h }; h() → the renamed import still pins (mech import) +# Python (fixture py/): pa/client.py and pb/client.py each `class Client: @staticmethod make()`; pk/timer.py and pk/events.py each `class Timer` +# POSITIVE app.py from pa.client import Client; Client.make(1) → pa's make +# renamed.py from pb.client import Client as BClient; BClient.make(6) → pb's make +# pk/pump.py from pk.timer import Timer (events.py imported too); Timer(..) → pk/timer.py's Timer (prov import; base: split) +# pylocal/ app.py as above beside a THIRD Client in local.py → pa's make (base: local.py's, unhedged) +# NEGATIVE neither.py no import of Client → still the split +# star.py `from pa.client import *` and `from pb.client import *` → still the split +# pk/nopump.py `from pk import timer` (a module, not the class): Timer(..) → still the split +# pk/repump.py from pk.retimer import Timer, where retimer.py rebinds Timer → still the split (m's binding is not only the class) +# shadow.py def shadowed(Client): Client.make(10) → unchanged (base: unique pa) +# loose.py self.c.make() / v.make() → unchanged (base: unique pa) +# fn.py from pc.other import helper; helper() → unchanged (a plain import pins only a class) +# renamed.py from pc.other import helper as h; h() → the renamed import still pins (mech import) +# pylocal/local.py the class of the caller's own file → its own make, unchanged # Every negative arm counts the rows it read and fails when it read none (a vacuous arm proves nothing). # # Usage: bash test/importprovedsplitscheck.sh [BIN] (default build/ripwire; exits non-zero on any failure) @@ -110,6 +124,27 @@ export function same(): URI { } EOF +PY="$TMP/py"; mkdir -p "$PY/pa" "$PY/pb" "$PY/pc" "$PY/pk" +touch "$PY/pa/__init__.py" "$PY/pb/__init__.py" "$PY/pc/__init__.py" "$PY/pk/__init__.py" +printf 'class Client:\n @staticmethod\n def make(n):\n return Client()\n\n def run(self):\n return 1\n' >"$PY/pa/client.py" +cp "$PY/pa/client.py" "$PY/pb/client.py" +printf 'def helper():\n return 1\n' >"$PY/pc/other.py" +printf 'from pa.client import Client\n\n\ndef open_one():\n return Client.make(1)\n' >"$PY/app.py" +printf 'from pb.client import Client as BClient\nfrom pc.other import helper as h\n\n\ndef ren():\n h()\n return BClient.make(6)\n' >"$PY/renamed.py" +printf 'from pc.other import helper\n\n\ndef none():\n helper()\n return Client.make(2)\n' >"$PY/neither.py" +printf 'from pa.client import *\nfrom pb.client import *\n\n\ndef starred():\n return Client.make(3)\n' >"$PY/star.py" +printf 'from pa.client import Client\n\n\ndef shadowed(Client):\n return Client.make(10)\n' >"$PY/shadow.py" +printf 'from pc.other import helper\n\n\ndef plain_fn():\n return helper()\n' >"$PY/fn.py" +printf 'from pa.client import Client\nfrom pb import client as bmod\n\n\nclass Holder:\n def __init__(self, c):\n self.c = c\n\n def go(self, v):\n self.c.make(4)\n v.make(5)\n return Client, bmod\n' >"$PY/loose.py" +printf 'class Timer:\n def __init__(self, owner, delay):\n self.owner = owner\n self.delay = delay\n' >"$PY/pk/timer.py" +cp "$PY/pk/timer.py" "$PY/pk/events.py"; printf '\n\nclass Event:\n pass\n' >>"$PY/pk/events.py" +cp "$PY/pk/timer.py" "$PY/pk/retimer.py"; printf '\n\nTimer = type("Timer", (Timer,), {})\n' >>"$PY/pk/retimer.py" +printf 'from pk import events\nfrom pk.events import Event\nfrom pk.timer import Timer\n\n\nclass Pump:\n def set_timer(self, delay):\n return Timer(self, delay), events, Event\n' >"$PY/pk/pump.py" +printf 'from pk import events\nfrom pk import timer\n\n\nclass NoPump:\n def set_timer(self, delay):\n return Timer(self, delay), events, timer\n' >"$PY/pk/nopump.py" +printf 'from pk import events\nfrom pk.events import Event\nfrom pk.retimer import Timer\n\n\nclass RePump:\n def set_timer(self, delay):\n return Timer(self, delay), events, Event\n' >"$PY/pk/repump.py" +PL="$TMP/pylocal"; mkdir -p "$PL"; cp -R "$PY/pa" "$PY/pb" "$PY/app.py" "$PL/" +printf 'class Client:\n @staticmethod\n def make(n):\n return Client()\n\n\ndef same():\n return Client.make(7)\n' >"$PL/local.py" + # census DIR → $TMP/.census (rc checked: a failed run would make every arm below vacuous) census(){ ( cd "$1" && "$BIN" . --no-cache --pin-census="$TMP/$2.census" >/dev/null 2>"$TMP/$2.err" ); local rc=$? [ "$rc" -eq 0 ] || { no "$2: the --pin-census run failed (rc=$rc)"; return 1; }; return 0; } @@ -124,6 +159,8 @@ expect(){ local r; r=$( row "$1" "$2" "$3" "$4" ); local n; n=$( cat "$TMP/rows" census "$TS" ts || exit 1 census "$TL" tslocal || exit 1 +census "$PY" py || exit 1 +census "$PL" pylocal || exit 1 echo "── TypeScript: the import proves one class ──" expect ts app.ts file 3 "a/uri.ts::file" @@ -144,7 +181,26 @@ ndc=$( grep -o ']*p="loose.ts:[68]"[^>]*>' "$TMP/loose.callers" | grep -c if [ "$ndc" -eq 2 ] && ! grep -q ']*p="loose.ts:[68]"' "$TMP/loose.callers"; then ok "loose.ts:6/8 this.u.file() / v.file() stay declined (2 dc rows, no caller row)" else no "loose.ts: want 2 declined sites and no caller row, got $ndc"; sed 's///; s/^/ | /' "$TMP/loose.callers" | head -5; fi seen=$(( seen + ndc )) -if [ "$seen" -ge 7 ]; then ok "the negative arms read $seen rows (premise: none vacuous)"; else no "the negative arms read only $seen rows (want >= 7)"; fi + +echo "── Python: the import proves one class ──" +expect py app.py make 5 "pa/client.py::Client::make" +expect py renamed.py make 7 "pb/client.py::Client::make" +expect py pk/pump.py Timer 8 "pk/timer.py::Timer::Timer" import +expect pylocal app.py make 5 "pa/client.py::Client::make" + +echo "── Python: nothing proves one class, or the receiver is not the class ──" +neg py neither.py make 6 "pa/client.py::Client::make pb/client.py::Client::make" split +neg py star.py make 6 "pa/client.py::Client::make pb/client.py::Client::make" split +neg py pk/nopump.py Timer 7 "pk/events.py::Timer::Timer pk/retimer.py::Timer::Timer pk/timer.py::Timer::Timer" split +neg py pk/repump.py Timer 8 "pk/events.py::Timer::Timer pk/retimer.py::Timer::Timer" split +neg py shadow.py make 5 "pa/client.py::Client::make" unique +neg py loose.py make 10 "pa/client.py::Client::make" unique +neg py loose.py make 11 "pa/client.py::Client::make" unique +neg py fn.py helper 5 "pc/other.py::helper" unique +neg py renamed.py h 6 "pc/other.py::helper" import +neg pylocal local.py make 8 "local.py::Client::make" + +if [ "$seen" -ge 17 ]; then ok "the negative arms read $seen rows (premise: none vacuous)"; else no "the negative arms read only $seen rows (want >= 17)"; fi [ "$fail" -eq 0 ] && echo "ALL PASS" || echo "SOME FAILED" exit "$fail" From 72558a445268947e54c98d3616b8350497e16003 Mon Sep 17 00:00:00 2001 From: joyful-ii-V-I <210578314+joyful-ii-V-I@users.noreply.github.com> Date: Thu, 19 Nov 2026 00:28:02 -0500 Subject: [PATCH 04/35] refactor(graph): the Python import pin's member lookup and local-binding test leave their callers (quality-delta) quality-delta gated buildPythonRenamedImports (15 -> 24) and pythonRenamedImportPin (21 -> 27) on the previous commit. The member a binding names moves to pythonImportMember, the plain-import partition to PythonRenamedImports::splitPlain / memberOf / binds, and "is the name bound where the call runs" (a local, an enclosing def's, a comprehension or lambda span) to pythonNameBoundLocally; a plain import admits only a class where the pin chooses its one definition. Output unchanged: the py fixtures' --pin-census is byte-identical, importprovedsplitscheck and pyaliascallcheck ALL PASS. Co-Authored-By: Claude Opus 5.5 --- src/graph.h | 99 ++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 68 insertions(+), 31 deletions(-) diff --git a/src/graph.h b/src/graph.h index 24b82e9c4..4a67f2291 100644 --- a/src/graph.h +++ b/src/graph.h @@ -9350,8 +9350,51 @@ struct PythonRenamedImports HashMap plainClasses; std::vector shadows; [[nodiscard]] bool empty() const noexcept { return renamed.empty() && plainClasses.empty(); } + [[nodiscard]] bool binds( const std::string& key ) const { return renamed.contains( key ) || plainClasses.contains( key ); } + // the member `key` ("#name") imports and whether it is a plain import of a class (the member is the name itself); "" for none + struct Member + { + std::string_view name; + bool plain = false; + }; + [[nodiscard]] Member memberOf( const std::string& key, std::string_view name ) const + { + if( const auto it = renamed.find( key ); it != renamed.end() ) + { + return { it->second, false }; + } + return plainClasses.contains( key ) ? Member{ name, true } : Member{}; + } + // moves every entry whose member is its own local name (a plain import) from `renamed` to `plainClasses`, and drops the poisoned ones + void splitPlain() + { + std::erase_if( renamed, [ & ]( const auto& kv ) + { + const bool plain = !kv.second.empty() && std::string_view( kv.first ).substr( kv.first.find( '#' ) + 1 ) == kv.second; + if( plain ) + { + plainClasses.try_emplace( kv.first, '\0' ); + } + return kv.second.empty() || plain; + } ); + } }; +// the member a Python import binding names under its local name, at module scope only: x for `from m import x as y`, and for a plain +// `from m import x` when x names classes in two or more files (`multi`: IMPORT-PROVED-SPLITS); "" for any other import (it poisons the name) +inline std::string pythonImportMember( const IngestResult& ing, const Binding& b, const HashMap& multi ) +{ + if( pythonBindScope( ing, b ) != kNoNode ) + { + return {}; + } + if( b.importedName.str().starts_with( kPythonFromMemberMark ) ) + { + return b.importedName.substr( kPythonFromMemberMark.size() ); + } + return b.importedName.empty() && multi.contains( b.var ) ? std::string( b.var ) : std::string{}; +} + inline PythonRenamedImports buildPythonRenamedImports( const IngestResult& ing ) { PythonRenamedImports out; @@ -9363,25 +9406,14 @@ inline PythonRenamedImports buildPythonRenamedImports( const IngestResult& ing ) { continue; } - const bool moduleScope = pythonBindScope( ing, b ) == kNoNode; - const bool renamed = b.importedName.str().starts_with( kPythonFromMemberMark ) && moduleScope; - const bool plain = b.importedName.empty() && moduleScope && multi.contains( b.var ); // IMPORT-PROVED-SPLITS: member == the name - const std::string member = renamed ? b.importedName.substr( kPythonFromMemberMark.size() ) : plain ? std::string( b.var ) : std::string{}; + const std::string member = pythonImportMember( ing, b, multi ); const auto [ it, fresh ] = out.renamed.try_emplace( fileNameKey( key, b.fileId, b.var ), member ); if( !fresh && it->second != member ) { it->second.clear(); // two imports of one name that disagree: never decided } } - std::erase_if( out.renamed, [ & ]( const auto& kv ) - { - const bool plain = !kv.second.empty() && kv.first.ends_with( kv.second ) && kv.first.size() > kv.second.size() && kv.first[ kv.first.size() - kv.second.size() - 1 ] == '#'; - if( plain ) - { - out.plainClasses.try_emplace( kv.first, '\0' ); - } - return kv.second.empty() || plain; - } ); + out.splitPlain(); if( out.empty() ) { return out; @@ -9389,7 +9421,7 @@ inline PythonRenamedImports buildPythonRenamedImports( const IngestResult& ing ) for( const Binding& b : ing.bindings ) { if( b.kind == LocalBindKind::RecvType && b.fromSymbol != kNoNode && !b.var.empty() && b.fileId < ing.files.size() - && ( out.renamed.contains( fileNameKey( key, b.fileId, b.var ) ) || out.plainClasses.contains( key ) ) ) + && out.binds( fileNameKey( key, b.fileId, b.var ) ) ) { out.shadows.push_back( PythonAliasShadow{ b.fromSymbol, b.var, VarSpan{ b.spanStart, b.spanEnd } } ); } @@ -9397,6 +9429,24 @@ inline PythonRenamedImports buildPythonRenamedImports( const IngestResult& ing ) return out; } +// PY-IMPORT-ALIAS-CALL: is `name` bound where `r` runs by something other than the file's module-scope import of it — a local or parameter +// of the caller (localNameSet, which also holds a def-scoped import), of a def enclosing it (a closure reads that), or a comprehension +// target / lambda parameter whose span covers the call (PythonRenamedImports::shadows: the site-spanned records localNameSet skips) +inline bool pythonNameBoundLocally( const IngestResult& ing, const PythonRenamedImports& imports, const ExternalVeto& veto, const Reference& r, std::string_view name ) +{ + if( veto.hasLocal( r, name ) || std::ranges::any_of( imports.shadows, [ &r, name ]( const PythonAliasShadow& s ) + { return s.sym == r.fromSymbol && s.var == name && r.startByte >= s.span.startByte && r.startByte < s.span.endByte; } ) ) + { + return true; + } + return std::ranges::any_of( pythonClassScopeChain( ing, r.fromSymbol ), [ & ]( NodeId outer ) + { + Reference at = r; + at.fromSymbol = outer; + return veto.hasLocal( at, name ); + } ); +} + // PY-IMPORT-ALIAS-CALL: the ONE definition a bare Python call `y()` reaches through `from m import x as y`, else kNoNode. Decided only // when y's renamed import is its one binding where the call runs: no local or parameter of y in the caller or any def enclosing it // (localNameSet, which also holds a def-scoped import of y), no module-scope rebinding (`y = …`, `def y`, a `global y`, a dynamic @@ -9409,26 +9459,13 @@ inline NodeId pythonRenamedImportPin( const IngestResult& ing, const PythonRenam std::string_view name ) { std::string key; - const auto rit = imports.renamed.find( fileNameKey( key, r.fileId, name ) ); - const bool plain = rit == imports.renamed.end() && imports.plainClasses.contains( key ); // IMPORT-PROVED-SPLITS: `from m import C`, C's own name - const std::string_view member = plain ? name : rit == imports.renamed.end() ? std::string_view{} : std::string_view( rit->second ); + const auto [ member, plain ] = imports.memberOf( fileNameKey( key, r.fileId, name ), name ); // plain: IMPORT-PROVED-SPLITS' `from m import C` if( member.empty() || r.fromSymbol == kNoNode || r.fromSymbol >= ing.symbols.size() || v.pythonModuleRebind.contains( key ) || v.pythonModuleRebind.contains( fileNameKey( key, r.fileId, kPythonDynamicWrite ) ) - || ( r.fileId < v.pythonScopes.starTargets.size() && !v.pythonScopes.starTargets[ r.fileId ].empty() ) || veto.hasLocal( r, name ) - || std::ranges::any_of( imports.shadows, [ &r, name ]( const PythonAliasShadow& s ) - { return s.sym == r.fromSymbol && s.var == name && r.startByte >= s.span.startByte && r.startByte < s.span.endByte; } ) ) + || ( r.fileId < v.pythonScopes.starTargets.size() && !v.pythonScopes.starTargets[ r.fileId ].empty() ) || pythonNameBoundLocally( ing, imports, veto, r, name ) ) { return kNoNode; } - for( NodeId outer : pythonClassScopeChain( ing, r.fromSymbol ) ) - { - Reference at = r; - at.fromSymbol = outer; - if( veto.hasLocal( at, name ) ) - { - return kNoNode; // an enclosing def binds the name: a closure reads that, not the import - } - } const auto mf = v.memberImportFile.find( fileNameKey( key, r.fileId, name ) ); const auto dit = byName.find( std::string( member ) ); if( mf == v.memberImportFile.end() || mf->second == kNoFile || dit == byName.end() ) @@ -9440,7 +9477,7 @@ inline NodeId pythonRenamedImportPin( const IngestResult& ing, const PythonRenam { const Symbol& s = ing.symbols[ c ]; // module scope = no enclosing def or class by span (a Python class's Symbol::scope is its own name, so scope.empty() cannot say it) - if( s.fileId == mf->second && s.lang == Lang::Python && ( s.kind == SymKind::Function || s.kind == SymKind::Class ) + if( s.fileId == mf->second && s.lang == Lang::Python && ( s.kind == SymKind::Class || ( s.kind == SymKind::Function && !plain ) ) // a plain import pins only a class && pythonClassScopeChain( ing, c ).empty() ) { if( only != kNoNode ) @@ -9462,7 +9499,7 @@ inline NodeId pythonRenamedImportPin( const IngestResult& ing, const PythonRenam { return kNoNode; } - return plain && only != kNoNode && ing.symbols[ only ].kind != SymKind::Class ? kNoNode : only; // a plain import pins only a class + return only; } // tier 2, JS/TS: a bare name an ES named import pins, or a CommonJS `const { Node } = require('./a')` (a ModuleAlias, not From 6eec961c155a2ad7830aa0467b1e50a4a94f63fb Mon Sep 17 00:00:00 2001 From: joyful-ii-V-I <210578314+joyful-ii-V-I@users.noreply.github.com> Date: Thu, 19 Nov 2026 01:26:25 -0500 Subject: [PATCH 05/35] IMPORT-PROVED-SPLITS: language tests read the LangFacts import column; the gate checks every write and run The import-proved resolver and the Python multi-file class census chose the language with `== Lang::` compares (langidentity ratchet: 3 new shared-file predicates over the ceiling). They now read langFacts( lang ).baseImportEvidence (PythonImport / JsImport), the column that already names which import grammar a language speaks; the same languages pass, byte-identical. importprovedsplitscheck: ok() records a failed PASS write (gateexitcheck G1); the loose --callers run and the banner --version call state their exit status (prereview CI10). Co-Authored-By: Claude Opus 5.5 --- src/graph.h | 7 ++++--- test/importprovedsplitscheck.sh | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/graph.h b/src/graph.h index 4a67f2291..3eaec5b17 100644 --- a/src/graph.h +++ b/src/graph.h @@ -2946,7 +2946,7 @@ inline HashMap pythonMultiFileClassNames( const IngestResult& HashMap firstFile; // name → the first file defining a class of it; UINT32_MAX once a second file does for( const Symbol& s : ing.symbols ) { - if( s.lang != Lang::Python || s.kind != SymKind::Class ) + if( langFacts( s.lang ).baseImportEvidence != BaseImportEvidence::PythonImport || s.kind != SymKind::Class ) // Python's import grammar { continue; } @@ -10644,12 +10644,13 @@ struct ImportProvedClass NodeId operator()( const Reference& r, std::string_view name ) const { - if( r.lang == Lang::Python ) + const BaseImportEvidence grammar = langFacts( r.lang ).baseImportEvidence; // which import tables can name the class + if( grammar == BaseImportEvidence::PythonImport ) { const NodeId pin = pythonRenamedImportPin( ing, pyImports, extVeto, externalVeto, byName, r, name ); return pin != kNoNode && ing.symbols[ pin ].kind == SymKind::Class ? pin : kNoNode; // Python: a plain or renamed member import of a class } - return r.lang == Lang::TypeScript || r.lang == Lang::JavaScript ? jsClass( r, name ) : kNoNode; + return grammar == BaseImportEvidence::JsImport ? jsClass( r, name ) : kNoNode; } // TS/JS: the class an ES named import of `name` (renamed or not) pins in r's file (buildJsImportTables: Pinned, the module's export // table names it) — not where a local declaration shadows the import or a write rebinds the name (FC3) at r's byte diff --git a/test/importprovedsplitscheck.sh b/test/importprovedsplitscheck.sh index 64e0e5bb2..76be40901 100644 --- a/test/importprovedsplitscheck.sh +++ b/test/importprovedsplitscheck.sh @@ -40,11 +40,11 @@ BIN="${1:-${RIPWIRE_BIN:-$ROOT/build/ripwire}}" [ "${BIN#/}" = "$BIN" ] && BIN="$ROOT/$BIN" TMP="$( mktemp -d )"; trap 'rm -rf "$TMP"' EXIT fail=0 -ok(){ printf ' PASS %s\n' "$*"; } +ok(){ printf ' PASS %s\n' "$*" || { fail=1; printf ' FAIL could not write the PASS line for: %s\n' "$*"; }; return 0; } no(){ printf ' FAIL %s\n' "$*"; fail=1; } [ -x "$BIN" ] || { echo "FAIL: no binary at $BIN"; exit 1; } -echo "importprovedsplitscheck: $( "$BIN" --version 2>/dev/null )" +echo "importprovedsplitscheck: $( "$BIN" --version 2>/dev/null )" # status: banner only; every arm below checks its own run # ── fixtures ── TS="$TMP/ts"; mkdir -p "$TS/a" "$TS/b" "$TS/c" @@ -176,7 +176,8 @@ neg ts viabarrel.ts file 3 "a/uri.ts::file b/uri.ts::file" split neg ts shadow.ts file 3 "a/uri.ts::file" neg tslocal local.ts file 5 "local.ts::file" neg ts ren.ts h 3 "c/other.ts::helper" import -( cd "$TS" && "$BIN" . --no-cache --callers=file --legend=compact ) >"$TMP/loose.callers" 2>/dev/null || no "loose: the --callers=file run failed" +( cd "$TS" && "$BIN" . --no-cache --callers=file --legend=compact ) >"$TMP/loose.callers" 2>/dev/null; rc=$? +[ "$rc" -eq 0 ] || no "loose: the --callers=file run failed (rc=$rc)" ndc=$( grep -o ']*p="loose.ts:[68]"[^>]*>' "$TMP/loose.callers" | grep -c 'via="declined"' ) if [ "$ndc" -eq 2 ] && ! grep -q ']*p="loose.ts:[68]"' "$TMP/loose.callers"; then ok "loose.ts:6/8 this.u.file() / v.file() stay declined (2 dc rows, no caller row)" else no "loose.ts: want 2 declined sites and no caller row, got $ndc"; sed 's///; s/^/ | /' "$TMP/loose.callers" | head -5; fi From 279fb08154db44704f6be20d490680d146c49c3b Mon Sep 17 00:00:00 2001 From: joyful-ii-V-I <210578314+joyful-ii-V-I@users.noreply.github.com> Date: Thu, 19 Nov 2026 01:57:53 -0500 Subject: [PATCH 06/35] importprovedsplitscheck: the loose --callers run tests its exit status (prereview CI10) Co-Authored-By: Claude Opus 5.5 --- test/importprovedsplitscheck.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/importprovedsplitscheck.sh b/test/importprovedsplitscheck.sh index 76be40901..6d2b495c9 100644 --- a/test/importprovedsplitscheck.sh +++ b/test/importprovedsplitscheck.sh @@ -176,8 +176,7 @@ neg ts viabarrel.ts file 3 "a/uri.ts::file b/uri.ts::file" split neg ts shadow.ts file 3 "a/uri.ts::file" neg tslocal local.ts file 5 "local.ts::file" neg ts ren.ts h 3 "c/other.ts::helper" import -( cd "$TS" && "$BIN" . --no-cache --callers=file --legend=compact ) >"$TMP/loose.callers" 2>/dev/null; rc=$? -[ "$rc" -eq 0 ] || no "loose: the --callers=file run failed (rc=$rc)" +"$BIN" "$TS" --no-cache --callers=file --legend=compact >"$TMP/loose.callers" 2>/dev/null || no "loose: the --callers=file run failed" ndc=$( grep -o ']*p="loose.ts:[68]"[^>]*>' "$TMP/loose.callers" | grep -c 'via="declined"' ) if [ "$ndc" -eq 2 ] && ! grep -q ']*p="loose.ts:[68]"' "$TMP/loose.callers"; then ok "loose.ts:6/8 this.u.file() / v.file() stay declined (2 dc rows, no caller row)" else no "loose.ts: want 2 declined sites and no caller row, got $ndc"; sed 's///; s/^/ | /' "$TMP/loose.callers" | head -5; fi From ab48e410ac87600f00fd204721f3298664dacde3 Mon Sep 17 00:00:00 2001 From: joyful-ii-V-I <210578314+joyful-ii-V-I@users.noreply.github.com> Date: Thu, 19 Nov 2026 02:51:35 -0500 Subject: [PATCH 07/35] perf(graph): the import-proved-class hooks skip a file with no import before building a key importPathOwners tests canonical / candidate count / qualifier before it reads the receiver chain. The TS resolver (jsClass) and pythonRenamedImportPin leave a file with no ES or module-scope member import before building their "#name" key (JsImportTables / PythonRenamedImports::importsIn). pythonMultiFileClassNames is built once per run (ExternalVetoTables::pythonMultiFileClasses) instead of again in buildPythonRenamedImports. No output change. Co-Authored-By: Claude Opus 5.5 --- src/forselfhook.h | 2 +- src/graph.h | 42 ++++++++++++++++++++++++++++++++---------- src/receiverevidence.h | 7 +++++-- 3 files changed, 38 insertions(+), 13 deletions(-) diff --git a/src/forselfhook.h b/src/forselfhook.h index ff26fdb04..1d715c0e1 100644 --- a/src/forselfhook.h +++ b/src/forselfhook.h @@ -720,8 +720,8 @@ inline void addRenamedImportBases( const IngestResult& ing, std::vector> classes; for( NodeId c = 0; c < ing.symbols.size(); ++c ) diff --git a/src/graph.h b/src/graph.h index 3eaec5b17..6b99022df 100644 --- a/src/graph.h +++ b/src/graph.h @@ -2826,6 +2826,7 @@ struct ExternalVetoTables HashMap scopedImportBindFile; HashMap scopedSubmoduleBindFile; HashMap scopedImportNames; // "#y": some def or class in the file imports y (pythonEnclosingDefBinds' pre-test) + HashMap pythonMultiFileClasses; // IMPORT-PROVED-SPLITS: pythonMultiFileClassNames, built once per run }; // the ONE module file `import X [as y]` binds y to (Step-A's `resolved`, else the root-scoped suffix match of an absolute spec), kNoFile when @@ -3019,9 +3020,8 @@ inline HashMap pythonBaseClauseNames( const IngestResult& ing // member import (`from m import f as g`: f), whose bindings in m pythonRenamedImportPin reads (pythonEndpointBindsOnlyByClass). // IMPORT-PROVED-SPLITS adds the name of every plain module-scope `from m import C` whose C names Python classes in two or more files // (pythonMultiFileClassNames): pythonRenamedImportPin reads m's own bindings of it too. -inline void addPythonLookupNames( const IngestResult& ing, HashMap& names ) +inline void addPythonLookupNames( const IngestResult& ing, HashMap& names, const HashMap& multi ) { - const HashMap multi = pythonMultiFileClassNames( ing ); for( const Binding& b : ing.bindings ) { if( b.kind == LocalBindKind::Import && b.importedName.empty() && multi.contains( b.var ) ) @@ -3065,14 +3065,15 @@ inline NodeId pythonBindScope( const IngestResult& ing, const Binding& b ) noexc // PythonScopeFacts::nameBinds: every binding of a name a Python class's base clause starts with (the bare base, else its // qualifier) or is looked up under (addPythonLookupNames), per file and scope. buildPythonModuleRebindVetoes keeps only the module-scope facts; the base-name rule (pythonBaseNameProven) // needs the scoped ones too, because a class statement resolves its base in ITS lexical scope chain, not the module's. -inline HashMap> buildPythonNameBinds( const IngestResult& ing, HashMap wanted = {} ) +inline HashMap> buildPythonNameBinds( const IngestResult& ing, HashMap wanted, + const HashMap& multi ) { HashMap> binds; for( auto& [ name, c ] : pythonBaseClauseNames( ing ) ) { wanted.try_emplace( name, c ); } - addPythonLookupNames( ing, wanted ); + addPythonLookupNames( ing, wanted, multi ); std::string key; for( const Binding& b : ing.bindings ) { @@ -3116,6 +3117,7 @@ struct PythonImportVetoes HashMap memberImportFile; std::vector> importFiles; PythonScopeFacts scopes; + HashMap multiFileClasses; // pythonMultiFileClassNames (ExternalVetoTables::pythonMultiFileClasses) }; // FE-A: resolvePythonModuleSuffix scans every indexed path, and FE-A asks it about every UNRESOLVED absolute import (the @@ -3615,7 +3617,8 @@ inline PythonImportVetoes buildPythonImportVetoes( const IngestResult& ing, cons t.scopes = buildPythonStarTargets( ing, fileIndex, memo ); HashMap callees = pythonSubmoduleCalleeNames( ing, t.submodules ); addScopedSubmoduleCalleeNames( ing, t.scopedSubmodules, callees ); - t.scopes.nameBinds = buildPythonNameBinds( ing, std::move( callees ) ); + t.multiFileClasses = pythonMultiFileClassNames( ing ); + t.scopes.nameBinds = buildPythonNameBinds( ing, std::move( callees ), t.multiFileClasses ); return t; } @@ -3687,6 +3690,7 @@ inline ExternalVetoTables buildExternalVetoTables( const IngestResult& ing ) t.memberImportFile = std::move( iv.memberImportFile ); t.importFiles = std::move( iv.importFiles ); t.pythonScopes = std::move( iv.scopes ); + t.pythonMultiFileClasses = std::move( iv.multiFileClasses ); finalizePythonSubmoduleBinds( iv.submodules, t ); finalizePythonScopedBinds( ing, iv, t ); } @@ -3926,6 +3930,9 @@ struct JsImportTables HashMap> shadows; HashMap> rebinds; // FC3: "#name" → JsRebind spans (model.h): a call there is undecided HashMap> pinnedRebinds; // FC3: the rebinds whose declaration already bound a value: a MEMBER call through the name has no receiver at all there (jsMemberRootWritten) + std::vector importingFiles; // per fileId: 1 when the file has an ES import binding (a `targets` key) + // can `targets` hold a key of file `f`? (no "#name" key is built for a file with no ES import) + [[nodiscard]] bool importsIn( std::uint32_t f ) const noexcept { return f < importingFiles.size() && importingFiles[ f ] != 0; } }; // FC3: is this BARE call made through a name WRITTEN after its declaration, at a byte that declaration's scope holds @@ -4186,6 +4193,7 @@ inline JsImportTables buildJsImportTables( const IngestResult& ing, const WsIncl return tables; } tables.targets.reserve( bindCounts.allOf( LocalBindKind::JsImport ) ); + tables.importingFiles.assign( ing.files.size(), 0 ); JsExportTables ex = buildJsExportTablesSized( ing, bindCounts ); for( const Binding& b : ing.bindings ) { @@ -4194,6 +4202,7 @@ inline JsImportTables buildJsImportTables( const IngestResult& ing, const WsIncl // the name it binds is T's, so a field or local written `T` finds T's module (an interface's: receiverevidence.h importedTypeClass) JsImportTarget target = pinJsImport( ing, ex, workspace, b.fileId, b.typeName, b.isFromAssignment ? std::string_view( b.var ) : std::string_view( b.importedName ) ); target.renamed = b.importedName != b.var && !b.isFromAssignment; + tables.importingFiles[ b.fileId ] = 1; const auto [ found, inserted ] = tables.targets.try_emplace( jsImportKey( b.fileId, b.var ), target ); if( !inserted ) { @@ -9349,7 +9358,10 @@ struct PythonRenamedImports HashMap renamed; HashMap plainClasses; std::vector shadows; + std::vector importingFiles; // per fileId: 1 when some module-scope import there named a member (a superset of the keyed files) [[nodiscard]] bool empty() const noexcept { return renamed.empty() && plainClasses.empty(); } + // can `renamed` / `plainClasses` hold a key of file `f`? (no "#name" key is built for a file with none) + [[nodiscard]] bool importsIn( std::uint32_t f ) const noexcept { return f < importingFiles.size() && importingFiles[ f ] != 0; } [[nodiscard]] bool binds( const std::string& key ) const { return renamed.contains( key ) || plainClasses.contains( key ); } // the member `key` ("#name") imports and whether it is a plain import of a class (the member is the name itself); "" for none struct Member @@ -9395,11 +9407,12 @@ inline std::string pythonImportMember( const IngestResult& ing, const Binding& b return b.importedName.empty() && multi.contains( b.var ) ? std::string( b.var ) : std::string{}; } -inline PythonRenamedImports buildPythonRenamedImports( const IngestResult& ing ) +// `multi`: ExternalVetoTables::pythonMultiFileClasses (pythonMultiFileClassNames) +inline PythonRenamedImports buildPythonRenamedImports( const IngestResult& ing, const HashMap& multi ) { - PythonRenamedImports out; - std::string key; - const HashMap multi = pythonMultiFileClassNames( ing ); + PythonRenamedImports out; + std::string key; + out.importingFiles.assign( ing.files.size(), 0 ); for( const Binding& b : ing.bindings ) { if( b.kind != LocalBindKind::Import || b.var.empty() || b.fileId >= ing.files.size() || !isPythonSourcePath( rootRelPath( ing, b.fileId ) ) ) @@ -9407,6 +9420,7 @@ inline PythonRenamedImports buildPythonRenamedImports( const IngestResult& ing ) continue; } const std::string member = pythonImportMember( ing, b, multi ); + out.importingFiles[ b.fileId ] = member.empty() ? out.importingFiles[ b.fileId ] : char( 1 ); const auto [ it, fresh ] = out.renamed.try_emplace( fileNameKey( key, b.fileId, b.var ), member ); if( !fresh && it->second != member ) { @@ -9458,6 +9472,10 @@ inline NodeId pythonRenamedImportPin( const IngestResult& ing, const PythonRenam const ExternalVeto& veto, const HashMap>& byName, const Reference& r, std::string_view name ) { + if( !imports.importsIn( r.fileId ) ) + { + return kNoNode; // no module-scope member import in r's file: no key to build + } std::string key; const auto [ member, plain ] = imports.memberOf( fileNameKey( key, r.fileId, name ), name ); // plain: IMPORT-PROVED-SPLITS' `from m import C` if( member.empty() || r.fromSymbol == kNoNode || r.fromSymbol >= ing.symbols.size() @@ -10656,6 +10674,10 @@ struct ImportProvedClass // table names it) — not where a local declaration shadows the import or a write rebinds the name (FC3) at r's byte NodeId jsClass( const Reference& r, std::string_view name ) const { + if( !jsImports.importsIn( r.fileId ) ) + { + return kNoNode; // no ES import in r's file: no key to build + } const std::string key = jsImportKey( r.fileId, name ); const auto pin = jsImports.targets.find( key ); if( pin == jsImports.targets.end() || pin->second.outcome != JsImportOutcome::Pinned || pin->second.node == kNoNode @@ -11022,7 +11044,7 @@ inline Graph buildGraph( const IngestResult& ing, const ScipOverlay* scip = null // ExternalVeto above buildGraph; `vetoExternal` is the refusal: no edge, one header count, one `C external` // census row with no target. const ExternalVeto externalVeto{ ing, canonByName, fieldNarrow.localNameSet, extVeto }; - const PythonRenamedImports pyRenamedImports = buildPythonRenamedImports( ing ); // PY-IMPORT-ALIAS-CALL (pythonRenamedImportPin) + const PythonRenamedImports pyRenamedImports = buildPythonRenamedImports( ing, extVeto.pythonMultiFileClasses ); // PY-IMPORT-ALIAS-CALL (pythonRenamedImportPin) const PythonLexicalScopes pyScopes = buildPythonLexicalScopes( ing, byName ); // PY-CLASS-SPRAY (pythonLexicalScopePin) // The builtin-method name gate (BuiltinMethodGate above): decides, in Rule 3's place, the calls whose name is a // method of the caller language's builtin map/list/set/string type. Inert (active=false) on a corpus with no diff --git a/src/receiverevidence.h b/src/receiverevidence.h index 6b87db218..f377d4f5f 100644 --- a/src/receiverevidence.h +++ b/src/receiverevidence.h @@ -4749,9 +4749,12 @@ struct ReceiverEvidence template PathOwners importPathOwners( const Reference& r, std::vector& cand, bool canonical, const ClassOf& classOf ) const { + if( canonical || cand.size() < 2 || !r.qualifier.empty() ) // the cheap tests first: chainOf below reads the receiver chain + { + return PathOwners::Keep; + } const Chain ch = chainOf( r ); - if( canonical || cand.size() < 2 || !r.qualifier.empty() || !ch.valid || ch.root.empty() || !ch.path.empty() || !ch.ctor.empty() - || isThisRoot( ch.root ) || isSuperRoot( r, ch.root ) || ch.root == "cls" ) + if( !ch.valid || ch.root.empty() || !ch.path.empty() || !ch.ctor.empty() || isThisRoot( ch.root ) || isSuperRoot( r, ch.root ) || ch.root == "cls" ) { return PathOwners::Keep; } From a8026c8d2432dc0074cc7950ef0698c06adf4887 Mon Sep 17 00:00:00 2001 From: joyful-ii-V-I <210578314+joyful-ii-V-I@users.noreply.github.com> Date: Thu, 19 Nov 2026 02:51:52 -0500 Subject: [PATCH 08/35] refactor(graph): one span-cover helper for the JS import tables' span lookups jsCallThroughWrittenBinding, jsMemberRootWritten and ImportProvedClass::jsClass each carried their own copy of the "a span of this key covers the call byte" lookup; spanCoversAt is the one copy. No output change. Co-Authored-By: Claude Opus 5.5 --- src/graph.h | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/src/graph.h b/src/graph.h index 6b99022df..cb751ef39 100644 --- a/src/graph.h +++ b/src/graph.h @@ -3935,14 +3935,19 @@ struct JsImportTables [[nodiscard]] bool importsIn( std::uint32_t f ) const noexcept { return f < importingFiles.size() && importingFiles[ f ] != 0; } }; +// does a "#name"-keyed span table hold a span of `key` that covers byte `at`? (JsImportTables' shadows / rebinds / pinnedRebinds) +inline bool spanCoversAt( const HashMap>& spans, const std::string& key, std::uint32_t at ) +{ + const auto it = spans.find( key ); + return it != spans.end() && std::ranges::any_of( it->second, [ at ]( const VarSpan& s ) { return at >= s.startByte && at < s.endByte; } ); +} + // FC3: is this BARE call made through a name WRITTEN after its declaration, at a byte that declaration's scope holds // (`Eng = Foo; new Eng()`)? Such a call is undecided: the name no longer names what it was declared as. inline bool jsCallThroughWrittenBinding( const JsImportTables& tables, const Reference& r ) { if( r.role != RefRole::Call || r.memberCall || r.recv != RecvKind::None || !r.qualifier.empty() ) { return false; } - const auto spans = tables.rebinds.find( jsImportKey( r.fileId, r.calleeName ) ); - return spans != tables.rebinds.end() - && std::any_of( spans->second.begin(), spans->second.end(), [ & ]( const VarSpan& span ) { return r.startByte >= span.startByte && r.startByte < span.endByte; } ); + return spanCoversAt( tables.rebinds, jsImportKey( r.fileId, r.calleeName ), r.startByte ); } // FC3: what a MEMBER call's ROOT name (`tank` of `tank.spill()`, `Eng` of `Eng.make()`) holds at the call's byte. A root WRITTEN @@ -3956,13 +3961,9 @@ enum class JsWrittenRoot : std::uint8_t { None, Unpinned, Pinned }; inline JsWrittenRoot jsMemberRootWritten( const JsImportTables& tables, const Reference& r ) { if( r.role != RefRole::Call || !r.memberCall || r.memberRoot.empty() ) { return JsWrittenRoot::None; } - const auto holds = [ & ]( const HashMap>& byName ) - { - const auto spans = byName.find( jsImportKey( r.fileId, r.memberRoot ) ); - return spans != byName.end() - && std::any_of( spans->second.begin(), spans->second.end(), [ & ]( const VarSpan& span ) { return r.startByte >= span.startByte && r.startByte < span.endByte; } ); - }; - return holds( tables.pinnedRebinds ) ? JsWrittenRoot::Pinned : holds( tables.rebinds ) ? JsWrittenRoot::Unpinned : JsWrittenRoot::None; + const std::string key = jsImportKey( r.fileId, r.memberRoot ); + return spanCoversAt( tables.pinnedRebinds, key, r.startByte ) ? JsWrittenRoot::Pinned + : spanCoversAt( tables.rebinds, key, r.startByte ) ? JsWrittenRoot::Unpinned : JsWrittenRoot::None; } // `utils.ts` and `utils` name the same module, so the vocabulary probe below has to compare stems. @@ -10685,12 +10686,7 @@ struct ImportProvedClass { return kNoNode; } - const auto covers = [ & ]( const HashMap>& spans ) - { - const auto it = spans.find( key ); - return it != spans.end() && std::ranges::any_of( it->second, [ & ]( const VarSpan& s ) { return r.startByte >= s.startByte && r.startByte < s.endByte; } ); - }; - return covers( jsImports.shadows ) || covers( jsImports.rebinds ) ? kNoNode : pin->second.node; + return spanCoversAt( jsImports.shadows, key, r.startByte ) || spanCoversAt( jsImports.rebinds, key, r.startByte ) ? kNoNode : pin->second.node; } }; From 73224617dd2a40bf4d640c5cb3b164add683d30c Mon Sep 17 00:00:00 2001 From: joyful-ii-V-I <210578314+joyful-ii-V-I@users.noreply.github.com> Date: Thu, 19 Nov 2026 02:52:48 -0500 Subject: [PATCH 09/35] refactor(graph): PythonRenamedImports becomes PythonImportPins (it holds plain class imports too) The table pythonRenamedImportPin reads holds the renamed member imports and, since IMPORT-PROVED-SPLITS, the plain `from m import C` of a class other files define too; its name, its builder's and buildGraph's local now say so. pythonRenamedImportPin's doc states what `name` is for a bare call and for a member call's receiver. No output change. Co-Authored-By: Claude Opus 5.5 --- src/forselfhook.h | 6 +++--- src/graph.h | 36 ++++++++++++++++++++---------------- 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/src/forselfhook.h b/src/forselfhook.h index 1d715c0e1..8b98eac16 100644 --- a/src/forselfhook.h +++ b/src/forselfhook.h @@ -23,7 +23,7 @@ // // BASES. The proven implementors edges, plus the edge buildGraph never draws: a base clause spelled with a RENAMED import // (`from m import Command as RunserverCommand`; class Command(RunserverCommand)), where no class has the written name so the map holds -// nothing. That one is read here, for this element only, under the resolver's own rule for a renamed import (buildPythonRenamedImports, +// nothing. That one is read here, for this element only, under the resolver's own rule for a renamed import (buildPythonImportPins, // the module-scope rebind table, the star-import and dynamic-namespace marks, the endpoint's one binding: the tables pythonRenamedImportPin // reads) and a full module path; it enters no graph table (--lego keeps its answer). // @@ -720,8 +720,8 @@ inline void addRenamedImportBases( const IngestResult& ing, std::vector> classes; for( NodeId c = 0; c < ing.symbols.size(); ++c ) diff --git a/src/graph.h b/src/graph.h index cb751ef39..2e5259005 100644 --- a/src/graph.h +++ b/src/graph.h @@ -9351,10 +9351,11 @@ struct PythonAliasShadow VarSpan span; // [startByte, endByte): where the name is the comprehension target or lambda parameter }; -// IMPORT-PROVED-SPLITS: `plainClasses`: "#C" for every Python file where EVERY import of C is one module-scope plain `from m -// import C` and C names Python classes in two or more files (pythonMultiFileClassNames): pythonRenamedImportPin pins such a C only -// to a class. -struct PythonRenamedImports +// the module-scope member imports pythonRenamedImportPin may pin through, per "#name". `renamed`: `from m import x as y` (PY-IMPORT- +// ALIAS-CALL: y → x). IMPORT-PROVED-SPLITS `plainClasses`: "#C" for every Python file where EVERY import of C is one module-scope +// plain `from m import C` and C names Python classes in two or more files (pythonMultiFileClassNames): pythonRenamedImportPin pins such a +// C only to a class. +struct PythonImportPins { HashMap renamed; HashMap plainClasses; @@ -9409,10 +9410,10 @@ inline std::string pythonImportMember( const IngestResult& ing, const Binding& b } // `multi`: ExternalVetoTables::pythonMultiFileClasses (pythonMultiFileClassNames) -inline PythonRenamedImports buildPythonRenamedImports( const IngestResult& ing, const HashMap& multi ) +inline PythonImportPins buildPythonImportPins( const IngestResult& ing, const HashMap& multi ) { - PythonRenamedImports out; - std::string key; + PythonImportPins out; + std::string key; out.importingFiles.assign( ing.files.size(), 0 ); for( const Binding& b : ing.bindings ) { @@ -9446,8 +9447,8 @@ inline PythonRenamedImports buildPythonRenamedImports( const IngestResult& ing, // PY-IMPORT-ALIAS-CALL: is `name` bound where `r` runs by something other than the file's module-scope import of it — a local or parameter // of the caller (localNameSet, which also holds a def-scoped import), of a def enclosing it (a closure reads that), or a comprehension -// target / lambda parameter whose span covers the call (PythonRenamedImports::shadows: the site-spanned records localNameSet skips) -inline bool pythonNameBoundLocally( const IngestResult& ing, const PythonRenamedImports& imports, const ExternalVeto& veto, const Reference& r, std::string_view name ) +// target / lambda parameter whose span covers the call (PythonImportPins::shadows: the site-spanned records localNameSet skips) +inline bool pythonNameBoundLocally( const IngestResult& ing, const PythonImportPins& imports, const ExternalVeto& veto, const Reference& r, std::string_view name ) { if( veto.hasLocal( r, name ) || std::ranges::any_of( imports.shadows, [ &r, name ]( const PythonAliasShadow& s ) { return s.sym == r.fromSymbol && s.var == name && r.startByte >= s.span.startByte && r.startByte < s.span.endByte; } ) ) @@ -9468,8 +9469,11 @@ inline bool pythonNameBoundLocally( const IngestResult& ing, const PythonRenamed // namespace write: pythonModuleRebind; the caller file's own `__getattr__` is never consulted for a name it binds), and no star import in the file (it may bind y after the rename); and only when m resolves to ONE // indexed file (memberImportFile) whose module scope binds x ONLY by that one function or class (pythonEndpointBindsOnlyByClass). A package that // re-exports x defines none there: no decision, the call falls to the unchanged ladder (a floor, not a guess). A comprehension target or lambda parameter -// named y that covers the call byte is a binding too (PythonRenamedImports::shadows: the site-spanned records localNameSet skips). -inline NodeId pythonRenamedImportPin( const IngestResult& ing, const PythonRenamedImports& imports, const ExternalVetoTables& v, +// named y that covers the call byte is a binding too (PythonImportPins::shadows: the site-spanned records localNameSet skips). +// `name` is the local name the call is written through: r.calleeName for the bare call `y()`, or, for IMPORT-PROVED-SPLITS +// (ImportProvedClass), the receiver root C of a member call `C.m()` / the class of `C()`; there a plain `from m import C` (PythonImportPins:: +// plainClasses) pins too, but only to a class. +inline NodeId pythonRenamedImportPin( const IngestResult& ing, const PythonImportPins& imports, const ExternalVetoTables& v, const ExternalVeto& veto, const HashMap>& byName, const Reference& r, std::string_view name ) { @@ -10656,7 +10660,7 @@ struct ImportProvedClass { const JsImportTables& jsImports; const IngestResult& ing; - const PythonRenamedImports& pyImports; + const PythonImportPins& pyImports; const ExternalVetoTables& extVeto; const ExternalVeto& externalVeto; const HashMap>& byName; @@ -11040,7 +11044,7 @@ inline Graph buildGraph( const IngestResult& ing, const ScipOverlay* scip = null // ExternalVeto above buildGraph; `vetoExternal` is the refusal: no edge, one header count, one `C external` // census row with no target. const ExternalVeto externalVeto{ ing, canonByName, fieldNarrow.localNameSet, extVeto }; - const PythonRenamedImports pyRenamedImports = buildPythonRenamedImports( ing, extVeto.pythonMultiFileClasses ); // PY-IMPORT-ALIAS-CALL (pythonRenamedImportPin) + const PythonImportPins pyImportPins = buildPythonImportPins( ing, extVeto.pythonMultiFileClasses ); // PY-IMPORT-ALIAS-CALL (pythonRenamedImportPin) const PythonLexicalScopes pyScopes = buildPythonLexicalScopes( ing, byName ); // PY-CLASS-SPRAY (pythonLexicalScopePin) // The builtin-method name gate (BuiltinMethodGate above): decides, in Rule 3's place, the calls whose name is a // method of the caller language's builtin map/list/set/string type. Inert (active=false) on a corpus with no @@ -11184,7 +11188,7 @@ inline Graph buildGraph( const IngestResult& ing, const ScipOverlay* scip = null } } ReceiverEvidence recvEv( ing, chaUp, classNames ); - const ImportProvedClass importClass{ jsImports, ing, pyRenamedImports, extVeto, externalVeto, byName }; // IMPORT-PROVED-SPLITS: recvEv.pathOwners' per-language resolver + const ImportProvedClass importClass{ jsImports, ing, pyImportPins, extVeto, externalVeto, byName }; // IMPORT-PROVED-SPLITS: recvEv.pathOwners' per-language resolver HashMap qualifierVerdicts = buildQualifierVerdicts( ing, extVeto, falseEdges ); // h1-annot { PROFILE_SCOPE_DESCRIBE( "buildGraph/2i: receiver-evidence tables" ); @@ -12691,10 +12695,10 @@ inline Graph buildGraph( const IngestResult& ing, const ScipOverlay* scip = null // PY-IMPORT-ALIAS-CALL: `from m import x as y; y()` — the Python twin for a RENAMED member import (pythonRenamedImportPin // states when it decides). A plain `from m import x` keeps the ladder (the call's own spelling already names x), unless x is a // class other files define too (IMPORT-PROVED-SPLITS: `Timer( .. )` binds the imported Timer, not every Timer). - if( !scipPinned && !canonical && !narrowed && !pyRenamedImports.empty() && r.role == RefRole::Call && r.recv == RecvKind::None + if( !scipPinned && !canonical && !narrowed && !pyImportPins.empty() && r.role == RefRole::Call && r.recv == RecvKind::None && r.qualifier.empty() && !r.memberCall && r.lang == Lang::Python ) { - if( const NodeId pin = pythonRenamedImportPin( ing, pyRenamedImports, extVeto, externalVeto, byName, r, r.calleeName ); pin != kNoNode ) + if( const NodeId pin = pythonRenamedImportPin( ing, pyImportPins, extVeto, externalVeto, byName, r, r.calleeName ); pin != kNoNode ) { cand.push_back( pin ); narrowed = true; From 3e76be5367ea058ccc7fc806d819bb76fe12fa7b Mon Sep 17 00:00:00 2001 From: joyful-ii-V-I <210578314+joyful-ii-V-I@users.noreply.github.com> Date: Thu, 19 Nov 2026 02:52:59 -0500 Subject: [PATCH 10/35] refactor(graph): addPythonLookupNames reads only Python files' plain imports of a multi-file class Co-Authored-By: Claude Opus 5.5 --- src/graph.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/graph.h b/src/graph.h index 2e5259005..aff744fe6 100644 --- a/src/graph.h +++ b/src/graph.h @@ -3024,7 +3024,8 @@ inline void addPythonLookupNames( const IngestResult& ing, HashMap Date: Thu, 19 Nov 2026 02:53:31 -0500 Subject: [PATCH 11/35] refactor(receiverevidence): the import arm of pathOwners is narrowImportProved, which returns nothing It only ever narrowed and answered Keep; pathOwners now says so itself. No output change. Co-Authored-By: Claude Opus 5.5 --- src/receiverevidence.h | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/receiverevidence.h b/src/receiverevidence.h index f377d4f5f..05641a2f0 100644 --- a/src/receiverevidence.h +++ b/src/receiverevidence.h @@ -4732,36 +4732,41 @@ struct ReceiverEvidence } // IMPORT-PROVED-SPLITS: the shared hook. Same-named classes in two or more files give a call one candidate per class, and what // the call WRITES may name one of them: a Rust path's type (rustPathOwners, when the canonical tier answered), or a receiver - // spelled as the class, `C.m()`, whose C the caller file's import binds (importPathOwners, when a receiver rule answered). + // spelled as the class, `C.m()`, whose C the caller file's import binds (narrowImportProved, when a receiver rule answered: Keep). // `classOf( r, name )` is the per-language resolver: the ONE in-tree class `name` names where `r` is written, through the // caller file's own import of it; kNoNode for none, several, an outside class or a name something else binds there // (graph.h ImportProvedClass). Rust reads its own (rustQualifierClass). template PathOwners pathOwners( const Reference& r, std::vector& cand, bool canonical, const ClassOf& classOf ) const { - return callResultFamilyOf( r.lang ) == CallResultFamily::Rust ? rustPathOwners( r, cand, canonical ) : importPathOwners( r, cand, canonical, classOf ); + if( callResultFamilyOf( r.lang ) == CallResultFamily::Rust ) + { + return rustPathOwners( r, cand, canonical ); + } + narrowImportProved( r, cand, canonical, classOf ); + return PathOwners::Keep; } // IMPORT-PROVED-SPLITS: a receiver rule's answer for `C.m()` (the receiver chain is the one name C: not `this`/`self`/`cls`/ // `super`, no field path, no construction) that holds members of two or more classes keeps the members of the ONE class the // file's import of C proves (`classOf`). Only ever narrows, and only to a non-empty strict subset: a class the import names // that owns none of them (an inherited member, a re-export the resolver cannot follow), a class of the caller's own file (its - // scoping is not an import's), or no proof at all leaves `cand` as the rule left it. Always Keep. + // scoping is not an import's), or no proof at all leaves `cand` as the rule left it. template - PathOwners importPathOwners( const Reference& r, std::vector& cand, bool canonical, const ClassOf& classOf ) const + void narrowImportProved( const Reference& r, std::vector& cand, bool canonical, const ClassOf& classOf ) const { if( canonical || cand.size() < 2 || !r.qualifier.empty() ) // the cheap tests first: chainOf below reads the receiver chain { - return PathOwners::Keep; + return; } const Chain ch = chainOf( r ); if( !ch.valid || ch.root.empty() || !ch.path.empty() || !ch.ctor.empty() || isThisRoot( ch.root ) || isSuperRoot( r, ch.root ) || ch.root == "cls" ) { - return PathOwners::Keep; + return; } const NodeId cls = classOf( r, ch.root ); if( cls == kNoNode || ing.symbols[ cls ].fileId == r.fileId ) { - return PathOwners::Keep; + return; } const auto owned = [ & ]( NodeId c ) { return ing.symbols[ c ].fileId == ing.symbols[ cls ].fileId && types.classHolding( ing.symbols[ c ].fileId, ing.symbols[ c ].sigStartByte ) == cls; }; const std::size_t kept = std::size_t( std::ranges::count_if( cand, owned ) ); @@ -4769,7 +4774,6 @@ struct ReceiverEvidence { std::erase_if( cand, [ & ]( NodeId c ) { return !owned( c ); } ); } - return PathOwners::Keep; } // rust-receivers: the ONE class `self` names inside `from` (or the method enclosing it): the in-tree class of the method's // owner name that owns the method (memberOwnerRuleOf — Rust: its own file and item scope, or the only class of the name); From 9cc28162fba7cfbdcd64efae96837bfcbf408805 Mon Sep 17 00:00:00 2001 From: joyful-ii-V-I <210578314+joyful-ii-V-I@users.noreply.github.com> Date: Thu, 19 Nov 2026 03:13:24 -0500 Subject: [PATCH 12/35] importprovedsplitscheck: negative arms that a missing guard would turn red, and the arms the gate lacked Every shadow/rebind negative now imports BOTH same-named classes (a's / pa's and b's / pb's under a second name), so a pin to one of them shows: TS namespace `const URI` and class-expression `class URI`, Python comprehension target and lambda parameter, a module-scope `Client = BClient`, the caller's own `class Client`, and a plain `from m import Timer` whose Timer is a def there. Each turned red against a build with its guard removed. A parameter, `this.x` / `v` / `C.inner` receiver and an untyped call result are declined before the hook: those arms check one declined site and no census row. New positives: the call-result cascade (`const u = URI.file(); u.toString()` binds a's) and a renamed `BClient.make()` beside the caller's own Client; new negatives: try/except and if/else imports of two modules' Client stay split. Co-Authored-By: Claude Opus 5.5 --- test/importprovedsplitscheck.sh | 128 +++++++++++++++++++++++++++----- 1 file changed, 110 insertions(+), 18 deletions(-) diff --git a/test/importprovedsplitscheck.sh b/test/importprovedsplitscheck.sh index 6d2b495c9..b7bd1633b 100644 --- a/test/importprovedsplitscheck.sh +++ b/test/importprovedsplitscheck.sh @@ -10,10 +10,15 @@ # both.ts import { URI } from a + { URI as URI2 } from b; URI.file(); URI2.parse() → a's file, b's parse # shadow.ts a closure inside the importing function: URI.parse() → a's parse # tslocal/ app.ts as above beside a THIRD, unexported URI in local.ts → a's file (base: local.ts's, unhedged) +# tscascade/ const u = URI.file( 'x' ) (annotated `: URI`); u.toString() → a's toString (base: no row); URI.file / URI.plain → a's # NEGATIVE neither.ts no import of URI → still the split of both # viabarrel.ts import { URI } from './reexp' (export { URI } from './a/uri') → still the split (a re-export is not followed) -# loose.ts this.u.file() / v.file() on untyped receivers → still declined (dc rows), never bound -# shadow.ts a parameter named URI: URI.file() → unchanged (no class-name reading) +# (each arm below imports a's URI AND b's as U2, so a pin to a's would show) +# shadow.ts namespace N { const URI: any = U2; URI.file() } → still the split (FC3 shadow span; guard off: a's) +# tsshadow/ const X = class URI { static go() { URI.file() } } → still the split (guard off: a's) +# shadow.ts a parameter named URI: URI.file() → declined (dc row), never bound +# loose.ts this.u.file() / v.file() / URI.inner.file() → declined (dc rows), never bound +# tscascade/ const w = URI.plain( 'y' ) (no return annotation); w.toString() → declined (dc row): nothing types w # tslocal/local.ts the class of the caller's own file → its own file's file, unchanged # ren.ts import { helper as h }; h() → the renamed import still pins (mech import) # Python (fixture py/): pa/client.py and pb/client.py each `class Client: @staticmethod make()`; pk/timer.py and pk/events.py each `class Timer` @@ -21,16 +26,25 @@ # renamed.py from pb.client import Client as BClient; BClient.make(6) → pb's make # pk/pump.py from pk.timer import Timer (events.py imported too); Timer(..) → pk/timer.py's Timer (prov import; base: split) # pylocal/ app.py as above beside a THIRD Client in local.py → pa's make (base: local.py's, unhedged) +# pyown/ BClient.make() beside the file's own class Client → pb's make (base: the own class's, a locality pick) # NEGATIVE neither.py no import of Client → still the split # star.py `from pa.client import *` and `from pb.client import *` → still the split # pk/nopump.py `from pk import timer` (a module, not the class): Timer(..) → still the split # pk/repump.py from pk.retimer import Timer, where retimer.py rebinds Timer → still the split (m's binding is not only the class) -# shadow.py def shadowed(Client): Client.make(10) → unchanged (base: unique pa) -# loose.py self.c.make() / v.make() → unchanged (base: unique pa) +# (each arm below imports pa's Client AND pb's as BClient, so a pin to pa's would show) +# shadow.py [Client.make() for Client in xs] / lambda Client: Client.make() → still the split (guard off: pa's) +# shadow.py def shadowed(Client): Client.make() → declined (dc row), never bound +# loose.py self.c.make() / v.make() / Client.inner.make() → declined (dc rows), never bound +# pyalt/ try/except or if/else imports of pa's and pb's Client → still the split (two modules bind the name) +# pyassign/ module-scope `Client = BClient` after the import → still the split (guard off: pa's) +# pyown/ the caller file's own module-level `class Client` → its own make (guard off: pa's) +# pyfn/ from pk.ftimer import Timer, a def there (a class in 2 other files) → unchanged receiver-rule (guard off: mech import) # fn.py from pc.other import helper; helper() → unchanged (a plain import pins only a class) # renamed.py from pc.other import helper as h; h() → the renamed import still pins (mech import) # pylocal/local.py the class of the caller's own file → its own make, unchanged -# Every negative arm counts the rows it read and fails when it read none (a vacuous arm proves nothing). +# Every negative arm counts the rows it read and fails when it read none (a vacuous arm proves nothing). The "guard off" arms were +# checked red against a build with the arm's guard removed (the shadow / local-binding test, the module-scope rebind test, the +# own-file test, the class-only test of a plain import); the declined arms never reach the import hook (a pin would add a caller row). # # Usage: bash test/importprovedsplitscheck.sh [BIN] (default build/ripwire; exits non-zero on any failure) set -u @@ -73,6 +87,7 @@ export function twice(): number { EOF cat >"$TS/shadow.ts" <<'EOF' import { URI } from './a/uri'; +import { URI as U2 } from './b/uri'; export function shadowed( URI: any ): number { return URI.file( 's' ) ? 1 : 0; } @@ -80,6 +95,20 @@ export function inner(): number { const run = () => URI.parse( 'i' ); return run() ? 1 : 0; } +export namespace N { + const URI: any = U2; + export function go(): number { return URI.file( 'nv' ); } +} +EOF +TH="$TMP/tsshadow"; mkdir -p "$TH/a" "$TH/b" +cp "$TS/a/uri.ts" "$TH/a/"; cp "$TS/b/uri.ts" "$TH/b/" +cat >"$TH/classexpr.ts" <<'EOF' +import { URI } from './a/uri'; +import { URI as U2 } from './b/uri'; +export const X = class URI { + static file( p: string ): number { return 1; } + static go(): number { U2.parse( 'y' ); return URI.file( 'ce' ); } +}; EOF cat >"$TS/neither.ts" <<'EOF' import { helper } from './c/other'; @@ -106,6 +135,9 @@ class Holder { } } function pick() { return Math.random() > 0.5 ? URI : U2; } +export function deep(): number { + return URI.inner.file( 'd' ) ? 1 : 0; +} EOF cat >"$TS/ren.ts" <<'EOF' import { helper as h } from './c/other'; @@ -133,9 +165,9 @@ printf 'from pa.client import Client\n\n\ndef open_one():\n return Client.mak printf 'from pb.client import Client as BClient\nfrom pc.other import helper as h\n\n\ndef ren():\n h()\n return BClient.make(6)\n' >"$PY/renamed.py" printf 'from pc.other import helper\n\n\ndef none():\n helper()\n return Client.make(2)\n' >"$PY/neither.py" printf 'from pa.client import *\nfrom pb.client import *\n\n\ndef starred():\n return Client.make(3)\n' >"$PY/star.py" -printf 'from pa.client import Client\n\n\ndef shadowed(Client):\n return Client.make(10)\n' >"$PY/shadow.py" +printf 'from pa.client import Client\nfrom pb.client import Client as BClient\n\n\ndef shadowed(Client):\n return Client.make(10)\n\n\ndef comp(xs):\n return [Client.make(11) for Client in xs]\n\n\ndef lam():\n g = lambda Client: Client.make(12)\n return g, BClient\n' >"$PY/shadow.py" printf 'from pc.other import helper\n\n\ndef plain_fn():\n return helper()\n' >"$PY/fn.py" -printf 'from pa.client import Client\nfrom pb import client as bmod\n\n\nclass Holder:\n def __init__(self, c):\n self.c = c\n\n def go(self, v):\n self.c.make(4)\n v.make(5)\n return Client, bmod\n' >"$PY/loose.py" +printf 'from pa.client import Client\nfrom pb.client import Client as BClient\n\n\nclass Holder:\n def __init__(self, c):\n self.c = c\n\n def go(self, v):\n self.c.make(4)\n v.make(5)\n Client.inner.make(12)\n return BClient\n' >"$PY/loose.py" printf 'class Timer:\n def __init__(self, owner, delay):\n self.owner = owner\n self.delay = delay\n' >"$PY/pk/timer.py" cp "$PY/pk/timer.py" "$PY/pk/events.py"; printf '\n\nclass Event:\n pass\n' >>"$PY/pk/events.py" cp "$PY/pk/timer.py" "$PY/pk/retimer.py"; printf '\n\nTimer = type("Timer", (Timer,), {})\n' >>"$PY/pk/retimer.py" @@ -145,6 +177,41 @@ printf 'from pk import events\nfrom pk.events import Event\nfrom pk.retimer impo PL="$TMP/pylocal"; mkdir -p "$PL"; cp -R "$PY/pa" "$PY/pb" "$PY/app.py" "$PL/" printf 'class Client:\n @staticmethod\n def make(n):\n return Client()\n\n\ndef same():\n return Client.make(7)\n' >"$PL/local.py" +# (a) the call-result typing cascade: `const u = URI.file( 'x' )` types u by file's return annotation, so u.toString() binds a's +TC="$TMP/tscascade"; mkdir -p "$TC/a" "$TC/b" +cat >"$TC/a/uri.ts" <<'EOF' +export class URI { + static file( p: string ): URI { return new URI(); } + static plain( p: string ) { return new URI(); } + toString(): string { return 'u'; } +} +EOF +cp "$TC/a/uri.ts" "$TC/b/uri.ts" +cat >"$TC/app.ts" <<'EOF' +import { URI } from './a/uri'; +import { URI as U2 } from './b/uri'; +export function cascade(): number { + const u = URI.file( 'x' ); + const w = URI.plain( 'y' ); + const n = u.toString(); + const m = w.toString(); + return n.length + m.length + ( U2 ? 1 : 0 ); +} +EOF +# (b) (c) two modules' Client under one name, or the caller's own module-scope binding of it +PA="$TMP/pyalt"; mkdir -p "$PA"; cp -R "$PY/pa" "$PY/pb" "$PA/" +printf 'try:\n from pa.client import Client\nexcept ImportError:\n from pb.client import Client\n\n\ndef f():\n return Client.make(1)\n' >"$PA/viatry.py" +printf 'import sys\nif sys.version_info > (3,):\n from pa.client import Client\nelse:\n from pb.client import Client\n\n\ndef f():\n return Client.make(2)\n' >"$PA/viaif.py" +PS="$TMP/pyassign"; mkdir -p "$PS"; cp -R "$PY/pa" "$PY/pb" "$PS/" +printf 'from pa.client import Client\nfrom pb.client import Client as BClient\n\nClient = BClient\n\n\ndef f():\n return Client.make(3)\n' >"$PS/assign.py" +PO="$TMP/pyown"; mkdir -p "$PO"; cp -R "$PY/pa" "$PY/pb" "$PO/" +printf 'from pa.client import Client\nfrom pb.client import Client as BClient\n\n\nclass Client:\n @staticmethod\n def make(n):\n return n\n\n\ndef f():\n BClient.make(5)\n return Client.make(4)\n' >"$PO/owncls.py" +# (d) Timer is a class in two files, but the module the caller imports it from defines it as a def +PF="$TMP/pyfn"; mkdir -p "$PF/pk"; touch "$PF/pk/__init__.py" +cp "$PY/pk/timer.py" "$PY/pk/events.py" "$PF/pk/" +printf 'def Timer(owner, delay):\n return (owner, delay)\n' >"$PF/pk/ftimer.py" +printf 'from pk.ftimer import Timer\n\n\ndef go():\n return Timer(None, 1)\n' >"$PF/pk/fpump.py" + # census DIR → $TMP/.census (rc checked: a failed run would make every arm below vacuous) census(){ ( cd "$1" && "$BIN" . --no-cache --pin-census="$TMP/$2.census" >/dev/null 2>"$TMP/$2.err" ); local rc=$? [ "$rc" -eq 0 ] || { no "$2: the --pin-census run failed (rc=$rc)"; return 1; }; return 0; } @@ -161,46 +228,71 @@ census "$TS" ts || exit 1 census "$TL" tslocal || exit 1 census "$PY" py || exit 1 census "$PL" pylocal || exit 1 +census "$TC" tscascade || exit 1 +census "$PA" pyalt || exit 1 +census "$PF" pyfn || exit 1 +census "$PS" pyassign || exit 1 +census "$PO" pyown || exit 1 +census "$TH" tsshadow || exit 1 +# declined NAME DIR CALLEE FILE:LINE... — each site is a declined call (one `` row of --callers) and has no census C +# row (a pin would add one; --callers' sites_at= lists a declined site too, so the census is what says "never bound") +declined(){ local nm="$1" d="$2" c="$3"; shift 3; local out="$TMP/declined.$c.$nm" + "$BIN" "$d" --no-cache --callers="$c" --legend=compact >"$out" 2>/dev/null || { no "declined: the --callers=$c run on $nm failed"; return 0; } + local p n + for p in "$@"; do + n=$( grep -o "]*p=\"$p\"[^>]*>" "$out" | grep -c 'via="declined"' ) + row "$nm" "${p%%:*}" "$c" "${p##*:}" >/dev/null + if [ "$n" -eq 1 ] && [ "$( cat "$TMP/rows" )" = 0 ]; then ok "$nm $p $c stays declined (1 dc row, no C row)" + else no "$nm $p $c: want 1 declined site and no C row, got $n dc rows, $( cat "$TMP/rows" ) C rows"; fi + seen=$(( seen + n )) + done; } echo "── TypeScript: the import proves one class ──" expect ts app.ts file 3 "a/uri.ts::file" expect ts both.ts file 4 "a/uri.ts::file" expect ts both.ts parse 5 "b/uri.ts::parse" -expect ts shadow.ts parse 6 "a/uri.ts::parse" +expect ts shadow.ts parse 7 "a/uri.ts::parse" receiver-rule expect tslocal app.ts file 3 "a/uri.ts::file" +expect tscascade app.ts file 4 "a/uri.ts::file" receiver-rule +expect tscascade app.ts plain 5 "a/uri.ts::plain" receiver-rule +expect tscascade app.ts toString 6 "a/uri.ts::toString" receiver-rule echo "── TypeScript: nothing proves one class, or the receiver is not the class ──" neg(){ expect "$@"; seen=$(( seen + $( cat "$TMP/rows" ) )); } neg ts neither.ts file 4 "a/uri.ts::file b/uri.ts::file" split neg ts viabarrel.ts file 3 "a/uri.ts::file b/uri.ts::file" split -neg ts shadow.ts file 3 "a/uri.ts::file" +neg ts shadow.ts file 12 "a/uri.ts::file b/uri.ts::file" split +neg tsshadow classexpr.ts file 5 "a/uri.ts::file b/uri.ts::file" split neg tslocal local.ts file 5 "local.ts::file" neg ts ren.ts h 3 "c/other.ts::helper" import -"$BIN" "$TS" --no-cache --callers=file --legend=compact >"$TMP/loose.callers" 2>/dev/null || no "loose: the --callers=file run failed" -ndc=$( grep -o ']*p="loose.ts:[68]"[^>]*>' "$TMP/loose.callers" | grep -c 'via="declined"' ) -if [ "$ndc" -eq 2 ] && ! grep -q ']*p="loose.ts:[68]"' "$TMP/loose.callers"; then ok "loose.ts:6/8 this.u.file() / v.file() stay declined (2 dc rows, no caller row)" -else no "loose.ts: want 2 declined sites and no caller row, got $ndc"; sed 's///; s/^/ | /' "$TMP/loose.callers" | head -5; fi -seen=$(( seen + ndc )) +declined ts "$TS" file shadow.ts:4 loose.ts:6 loose.ts:8 loose.ts:13 +declined tscascade "$TC" toString app.ts:7 echo "── Python: the import proves one class ──" expect py app.py make 5 "pa/client.py::Client::make" expect py renamed.py make 7 "pb/client.py::Client::make" expect py pk/pump.py Timer 8 "pk/timer.py::Timer::Timer" import expect pylocal app.py make 5 "pa/client.py::Client::make" +expect pyown owncls.py make 12 "pb/client.py::Client::make" receiver-rule echo "── Python: nothing proves one class, or the receiver is not the class ──" neg py neither.py make 6 "pa/client.py::Client::make pb/client.py::Client::make" split neg py star.py make 6 "pa/client.py::Client::make pb/client.py::Client::make" split neg py pk/nopump.py Timer 7 "pk/events.py::Timer::Timer pk/retimer.py::Timer::Timer pk/timer.py::Timer::Timer" split neg py pk/repump.py Timer 8 "pk/events.py::Timer::Timer pk/retimer.py::Timer::Timer" split -neg py shadow.py make 5 "pa/client.py::Client::make" unique -neg py loose.py make 10 "pa/client.py::Client::make" unique -neg py loose.py make 11 "pa/client.py::Client::make" unique +neg py shadow.py make 10 "pa/client.py::Client::make pb/client.py::Client::make" split +neg py shadow.py make 14 "pa/client.py::Client::make pb/client.py::Client::make" split +declined py "$PY" make shadow.py:6 loose.py:10 loose.py:11 loose.py:12 +neg pyalt viatry.py make 8 "pa/client.py::Client::make pb/client.py::Client::make" split +neg pyalt viaif.py make 9 "pa/client.py::Client::make pb/client.py::Client::make" split +neg pyassign assign.py make 8 "pa/client.py::Client::make pb/client.py::Client::make" split +neg pyown owncls.py make 13 "owncls.py::Client::make" receiver-rule +neg pyfn pk/fpump.py Timer 5 "pk/ftimer.py::Timer" receiver-rule neg py fn.py helper 5 "pc/other.py::helper" unique neg py renamed.py h 6 "pc/other.py::helper" import neg pylocal local.py make 8 "local.py::Client::make" -if [ "$seen" -ge 17 ]; then ok "the negative arms read $seen rows (premise: none vacuous)"; else no "the negative arms read only $seen rows (want >= 17)"; fi +if [ "$seen" -ge 29 ]; then ok "the negative arms read $seen rows (premise: none vacuous)"; else no "the negative arms read only $seen rows (want >= 29)"; fi [ "$fail" -eq 0 ] && echo "ALL PASS" || echo "SOME FAILED" exit "$fail" From ce3b76ea867b578717ecb280f3e7cf65ccddeb74 Mon Sep 17 00:00:00 2001 From: joyful-ii-V-I <210578314+joyful-ii-V-I@users.noreply.github.com> Date: Thu, 19 Nov 2026 03:35:35 -0500 Subject: [PATCH 13/35] refactor(graph): the multi-file class import names join the wanted set in buildPythonImportVetoes (quality-delta) addPythonLookupNames and buildPythonNameBinds keep their signatures: addPythonMultiFileImportNames adds the names to the callee set buildPythonImportVetoes already hands buildPythonNameBinds. FalseEdgeRules::shadowedAt reads its span table through spanCoversAt. No output change. Co-Authored-By: Claude Opus 5.5 --- src/graph.h | 51 ++++++++++++++++++++++++++++++++------------------- 1 file changed, 32 insertions(+), 19 deletions(-) diff --git a/src/graph.h b/src/graph.h index aff744fe6..ef22229c2 100644 --- a/src/graph.h +++ b/src/graph.h @@ -3018,18 +3018,8 @@ inline HashMap pythonBaseClauseNames( const IngestResult& ing // pkg's __init__ may bind). pythonReexportChain and pythonImportedBases read the bindings of exactly these (a renamed hop, a package // that binds the submodule's name). PY-IMPORT-ALIAS-CALL adds the member of EVERY renamed // member import (`from m import f as g`: f), whose bindings in m pythonRenamedImportPin reads (pythonEndpointBindsOnlyByClass). -// IMPORT-PROVED-SPLITS adds the name of every plain module-scope `from m import C` whose C names Python classes in two or more files -// (pythonMultiFileClassNames): pythonRenamedImportPin reads m's own bindings of it too. -inline void addPythonLookupNames( const IngestResult& ing, HashMap& names, const HashMap& multi ) +inline void addPythonLookupNames( const IngestResult& ing, HashMap& names ) { - for( const Binding& b : ing.bindings ) - { - if( b.kind == LocalBindKind::Import && b.importedName.empty() && multi.contains( b.var ) && b.fileId < ing.files.size() - && isPythonSourcePath( rootRelPath( ing, b.fileId ) ) ) // a Python file's import (another language's names no Python binding) - { - names.try_emplace( b.var, '\0' ); - } - } for( const Reference& r : ing.references ) { if( r.isInherit && !r.memberRoot.empty() && r.fileId < ing.files.size() && isPythonSourcePath( rootRelPath( ing, r.fileId ) ) ) @@ -3051,6 +3041,20 @@ inline void addPythonLookupNames( const IngestResult& ing, HashMap& multi, HashMap& names ) +{ + for( const Binding& b : ing.bindings ) + { + if( b.kind == LocalBindKind::Import && b.importedName.empty() && multi.contains( b.var ) && b.fileId < ing.files.size() + && isPythonSourcePath( rootRelPath( ing, b.fileId ) ) ) // a Python file's import (another language's names no Python binding) + { + names.try_emplace( b.var, '\0' ); + } + } +} + // the scope a Python binding sits in: its enclosing def or class, kNoNode for module scope (including every binding at byte 0 — // pythonBindAtFileStart: a `global Base` rebinding inside a def that starts the file, and that def's own name). inline NodeId pythonBindScope( const IngestResult& ing, const Binding& b ) noexcept @@ -3066,15 +3070,14 @@ inline NodeId pythonBindScope( const IngestResult& ing, const Binding& b ) noexc // PythonScopeFacts::nameBinds: every binding of a name a Python class's base clause starts with (the bare base, else its // qualifier) or is looked up under (addPythonLookupNames), per file and scope. buildPythonModuleRebindVetoes keeps only the module-scope facts; the base-name rule (pythonBaseNameProven) // needs the scoped ones too, because a class statement resolves its base in ITS lexical scope chain, not the module's. -inline HashMap> buildPythonNameBinds( const IngestResult& ing, HashMap wanted, - const HashMap& multi ) +inline HashMap> buildPythonNameBinds( const IngestResult& ing, HashMap wanted = {} ) { HashMap> binds; for( auto& [ name, c ] : pythonBaseClauseNames( ing ) ) { wanted.try_emplace( name, c ); } - addPythonLookupNames( ing, wanted, multi ); + addPythonLookupNames( ing, wanted ); std::string key; for( const Binding& b : ing.bindings ) { @@ -3619,7 +3622,8 @@ inline PythonImportVetoes buildPythonImportVetoes( const IngestResult& ing, cons HashMap callees = pythonSubmoduleCalleeNames( ing, t.submodules ); addScopedSubmoduleCalleeNames( ing, t.scopedSubmodules, callees ); t.multiFileClasses = pythonMultiFileClassNames( ing ); - t.scopes.nameBinds = buildPythonNameBinds( ing, std::move( callees ), t.multiFileClasses ); + addPythonMultiFileImportNames( ing, t.multiFileClasses, callees ); + t.scopes.nameBinds = buildPythonNameBinds( ing, std::move( callees ) ); return t; } @@ -3940,7 +3944,18 @@ struct JsImportTables inline bool spanCoversAt( const HashMap>& spans, const std::string& key, std::uint32_t at ) { const auto it = spans.find( key ); - return it != spans.end() && std::ranges::any_of( it->second, [ at ]( const VarSpan& s ) { return at >= s.startByte && at < s.endByte; } ); + if( it == spans.end() ) + { + return false; + } + for( const VarSpan& s : it->second ) + { + if( at >= s.startByte && at < s.endByte ) + { + return true; + } + } + return false; } // FC3: is this BARE call made through a name WRITTEN after its declaration, at a byte that declaration's scope holds @@ -6985,9 +7000,7 @@ struct FalseEdgeRules } bool shadowedAt( const Reference& r, std::string_view name ) const { - const auto it = shadows.find( fileNameKey( key, r.fileId, name ) ); - return it != shadows.end() - && std::any_of( it->second.begin(), it->second.end(), [ & ]( const VarSpan& s ) { return r.startByte >= s.startByte && r.startByte < s.endByte; } ); + return spanCoversAt( shadows, fileNameKey( key, r.fileId, name ), r.startByte ); } // the file binds `name` at this site: an import or alias of it, or a declaration whose scope holds the site bool jsFileBinds( const Reference& r, std::string_view name ) const From 15d5e6b86f23e6181a8d6cfde3c782b7129d7017 Mon Sep 17 00:00:00 2001 From: joyful-ii-V-I <210578314+joyful-ii-V-I@users.noreply.github.com> Date: Thu, 19 Nov 2026 17:25:34 -0500 Subject: [PATCH 14/35] fix(resolve): a qualified C++ call binds the namespace its qualifier names `hashutil::fnv1a64( s )` bound arch.h's same-named `rw::fnv1a64`: a call's qualifier is its immediate segment ("hashutil", ingest's H4 re-split), but the canonical tier keyed a definition by its scope's written text, and the C++17 nested namespace `namespace rw::hashutil {` writes "rw::hashutil". The key missed, the call fell to the bare-name ladder, and Rule 3 picked the namesake an included file defines. The same miss hit ripwire's own `os::X` calls (rw::os). - resolve.h indexCanonicalScope also keys a C-family scope with a top-level `::` by its last segment (indexCanonicalScopeText); namesplit::lastTopLevelScopeSep moved to infra/namesplit.h. - A namespace alias in force (`namespace h = rw::hashutil;`) names the scope of a qualified call, and a using-declaration in force (`using rw::hashutil::f;`) names the scope of a bare one (receiverevidence.h CallResultTypes::cppScopeNamedAt; graph.h keys the canonical tier by it, unless the caller's own scope or its bases declare the name). An included header's row counts only at file scope: no C++ Namespace row is recorded, so its namespace path is not read. - ingest_binds.h kCppCallScopeFacts records those two C++ facts while the C++ call-result family stays off; no Namespace row, so that family's readers see what they saw. kParserVer 335 (placeholder; the train renumbers), quality.h mirror, qschemetrip re-pinned. - test/qualnscallcheck.sh: 9 positive arms (red on the base), 13 counted negative arms (directive, late alias, another body's using, own-scope namesake, header namespace-scope using, inline-elided, nested, class-static, template, ADL, macro). Co-Authored-By: Claude Opus 5.5 --- src/graph.h | 21 +++- src/infra/namesplit.h | 35 +++++++ src/ingest_binds.h | 22 +++- src/ingest_cache.h | 5 +- src/ingest_names.h | 40 +------- src/quality.h | 3 +- src/receiverevidence.h | 58 +++++++++++ src/resolve.h | 63 ++++++++---- test/qschemetrip.hash | 2 +- test/qschemetripcheck.sh | 3 + test/qualnscallcheck.sh | 213 +++++++++++++++++++++++++++++++++++++++ test/regression.sh | 1 + 12 files changed, 402 insertions(+), 64 deletions(-) create mode 100755 test/qualnscallcheck.sh diff --git a/src/graph.h b/src/graph.h index ef22229c2..dc20fd11c 100644 --- a/src/graph.h +++ b/src/graph.h @@ -11126,6 +11126,13 @@ inline Graph buildGraph( const IngestResult& ing, const ScipOverlay* scip = null // for `class C(A, B)` Python's MRO puts A's chain before B's, so when both A and B define `m`, `super().m()` // in C names A::m. chaUp is sorted for its membership uses and cannot say which base came first. HashMap> chaUpDeclared; + // QUAL-NS-CALL-BIND: does the caller's own scope — its class or a base of it, or its namespace — define the callee's name? C++ + // lookup finds that one before a namespace-scope using-declaration of the name, so the declaration does not decide the call. + const auto callerScopeDeclares = [ & ]( const Reference& r ) -> bool + { + const std::string_view scope = r.fromSymbol < ing.symbols.size() ? std::string_view( ing.symbols[ r.fromSymbol ].scope ) : std::string_view{}; + return !scope.empty() && narrower.methodOnTypeOrBases( scope, r, chaUp ) != nullptr; + }; // Ruby bases, SCOPED by Ruby's own constant lookup (resolve.h::RubyBaseScope; test/rubyinheritcheck.sh floor // (c)). Read here — a base the tree never opens (`< ActiveRecord::Base`) adds no CHA edge, so its class's walk // cannot reach an unrelated in-tree `Base` — and by the implementor pass below. Empty on a Ruby-free corpus. @@ -12598,9 +12605,17 @@ inline Graph buildGraph( const IngestResult& ing, const ScipOverlay* scip = null // * with nothing visible from the primary, only a split of two or more specializations answers. // No answer leaves `cand` empty, so the bare-name ladder decides exactly as it did before the family fallback, // and no family answer ever reaches a same-named definition outside the template. - if( !scipPinned && r.lang != Lang::Elixir && !r.qualifier.empty() ) - { - appendCanonicalCandidates( cand, qkey, r, CanonicalScopes { canonByName, canonFamilyByName, specializationsWithBases, narrower, chaUp, ing.symbols }, + // QUAL-NS-CALL-BIND: a C++ call whose scope a declaration in force names (CallResultTypes::cppScopeNamedAt) is keyed by that + // scope instead — an alias shadows the qualifier it spells (`namespace h = rw::hashutil;` makes `h::f()` hashutil's), and a + // using-declaration (`using rw::hashutil::f;`) gives a bare `f()` its scope unless the caller's own scope or a base declares + // the name (found first by C++ lookup). No such declaration, or two that disagree: the written qualifier, as before. + const std::string declScope = !scipPinned && r.role == RefRole::Call && langFacts( r.lang ).qualifierNamesScope && !isMemberCallRef( r ) + ? recvEv.types.cppScopeNamedAt( r ) : std::string(); + const bool declNames = !declScope.empty() && ( !r.qualifier.empty() || !callerScopeDeclares( r ) ); + const std::string_view canonQualifier = declNames ? std::string_view( declScope ) : std::string_view( r.qualifier ); + if( !scipPinned && r.lang != Lang::Elixir && !canonQualifier.empty() ) + { + appendCanonicalCandidates( cand, qkey, canonQualifier, r, CanonicalScopes { canonByName, canonFamilyByName, specializationsWithBases, narrower, chaUp, ing.symbols }, [ & ]( NodeId c ) { return langCompatible( symLang[ c ], r.lang ) && sameRoot( c, r.fileId ); } ); canonical = !cand.empty(); } diff --git a/src/infra/namesplit.h b/src/infra/namesplit.h index bd540802e..a2e242a4f 100644 --- a/src/infra/namesplit.h +++ b/src/infra/namesplit.h @@ -150,6 +150,41 @@ inline std::string_view stripQuotePair( std::string_view text ) noexcept return text; } +// Index of the last `::` in `text` that sits at TEMPLATE-ARGUMENT DEPTH ZERO, or npos when there is none. +// Scanned in reverse (the LAST top-level separator is the one that splits name from scope), tracking `<`/`>` +// nesting so a `::` inside template arguments never splits: `tmplFn` has NO top-level separator, while +// `numeric_limits::max` has exactly one — at the `::` before `max`. +// PRECONDITION: `text` carries no trailing operator name. Depth is clamped at zero, which makes an +// operator spelling merely IGNORED rather than balanced — that is enough for `operator<<` and NOT enough for +// the `>` family, whose unmatched `>` would leave the depth pinned above zero and hide every separator. The +// caller checks operatorNameStart() first; do not weaken that ordering. +// Moved from ingest_names.h (QUAL-NS-CALL-BIND): resolve.h's canonical index splits a C-family scope by it too. +// The loop counts a 1-based CURSOR down to zero rather than the classic `for( i = n; i-- > 0; )`: that idiom +// wraps `i` to SIZE_MAX on its final test, which `-fsanitize=integer` reports as an unsigned-integer +// overflow (observed on this very function before this shape — the G1 build caught it on the fixture). +inline std::size_t lastTopLevelScopeSep( std::string_view text ) noexcept +{ + std::size_t angleDepth = 0; + for( std::size_t cursor = text.size(); cursor > 0; --cursor ) + { + const std::size_t charIndex = cursor - 1; + const char c = text[ charIndex ]; + if( c == '>' ) + { + ++angleDepth; + } + else if( c == '<' && angleDepth > 0 ) + { + --angleDepth; + } + else if( c == ':' && angleDepth == 0 && charIndex > 0 && text[ charIndex - 1 ] == ':' ) + { + return charIndex - 1; // index of the FIRST ':' of the pair + } + } + return std::string_view::npos; +} + /// The text after the LAST `sep`, or all of `text` when `sep` does not occur — the ONE "base name" cut, for a path /// (`sep` "/": `a/b/c.h` -> `c.h`) and for a qualified name (`sep` "::": `ns::Foo::bar` -> `bar`). mention.h's /// baseNameOf, ingest_names.h's immediateScope, skillscan.h's NetFlowScan::noteRead and layout.h's lastSegment each diff --git a/src/ingest_binds.h b/src/ingest_binds.h index 87122183c..4df8e464d 100644 --- a/src/ingest_binds.h +++ b/src/ingest_binds.h @@ -4612,6 +4612,22 @@ inline const ScopeFactNode* scopeFactRow( Lang lang, const char* t ) const auto row = std::ranges::find_if( kScopeFactNodes, [ & ]( const ScopeFactNode& r ) { return r.family == callResultFamilyOf( lang ) && r.kind == t; } ); return row == std::end( kScopeFactNodes ) ? nullptr : &*row; } +// QUAL-NS-CALL-BIND (kParserVer 335): the two C++ scope facts a CALL's binding reads (receiverevidence.h +// CallResultTypes::cppScopeNamedAt), recorded even while the C++ call-result family is off (model.h callResultFamilyOf): a +// using-declaration `using a::b::f;` (a TypeImport over its scope) and a namespace alias `namespace h = a::b;` (a TypeAlias over +// its scope). Neither types a call result, and no Namespace row is recorded, so the family's readers see what they saw. +inline constexpr ScopeFactNode kCppCallScopeFacts[] = { + { CallResultFamily::Cpp, "using_declaration", ScopeFactRole::Scope }, { CallResultFamily::Cpp, "namespace_alias_definition", ScopeFactRole::Alias }, +}; +inline const ScopeFactNode* cppCallScopeFactRow( Lang lang, const char* t ) +{ + if( ( lang != Lang::Cpp && lang != Lang::ObjC ) || callResultFamilyOf( lang ) == CallResultFamily::Cpp ) + { + return nullptr; // not C++, or the family's own rows (kScopeFactNodes) already record them + } + const auto row = std::ranges::find_if( kCppCallScopeFacts, [ & ]( const ScopeFactNode& r ) { return r.kind == t; } ); + return row == std::end( kCppCallScopeFacts ) ? nullptr : &*row; +} // the C++ scope a declaration `n` is in force over: a namespace body, a class body (only when `classScope` admits one), a // function body (fix round 4: a local class's member result is declared inside it), or the whole file (0 .. 0xFFFFFFFF) @@ -4649,7 +4665,7 @@ inline void captureTypeAlias( BindCtx& cx, TSNode n, const char* t ) { std::uint32_t spanStart = 0; std::uint32_t spanEnd = 0; - if( callResultFamilyOf( cx.lang ) == CallResultFamily::Cpp ) + if( cx.lang == Lang::Cpp || cx.lang == Lang::ObjC ) // the family's rows, and kCppCallScopeFacts' while the family is off { std::tie( spanStart, spanEnd ) = cppDeclScope( n, true ); if( spanEnd == 0 ) @@ -7902,7 +7918,9 @@ void bindsVisitNode( BindCtx& cx, TSNode n, const char* t ) } // (L) fix round 2: a namespace body, a C++ using-directive / using-declaration — the scope a bare result type resolves in // (fix round 3) an alias, (fix round 4) a declaration the index keeps no class for, or a region it cannot read - if( const ScopeFactNode* row = scopeFactRow( lang, t ) ) + const ScopeFactNode* row = scopeFactRow( lang, t ); + row = row != nullptr ? row : cppCallScopeFactRow( lang, t ); + if( row != nullptr ) { switch( row->role ) { diff --git a/src/ingest_cache.h b/src/ingest_cache.h index 1e6d80fd4..4a548bf41 100644 --- a/src/ingest_cache.h +++ b/src/ingest_cache.h @@ -382,7 +382,10 @@ constexpr std::uint32_t kCacheVersion = 53; // 53: lane rust-self-chai // (Py `pkg.mod`, TS `./x`, Rust `crate::a::b`/`mod:x`) — // a target FORMAT change → old caches must be rejected. // 4: Include gained a `bool isAngle` (quote/angle) field -constexpr std::uint32_t kParserVer = 333; // bump on any grammar/.scm/extraction change +constexpr std::uint32_t kParserVer = 335; // bump on any grammar/.scm/extraction change + // 335 = lane qual-ns-call-bind (placeholder above the 333/334 pair; the train renumbers): C++ / ObjC + // using-declarations and namespace aliases are recorded while the call-result family is off + // (ingest_binds.h kCppCallScopeFacts), read by receiverevidence.h CallResultTypes::cppScopeNamedAt. // 333 = 2026-11-18 (train 1117d2, stacked on train 1117d1's 331/332; above the members' placeholders): rich file tag 334. // The members' extraction changes (each lane's number was a placeholder): // std-namesake (placeholder 317): a Rust local, parameter or field written as a standard type that names no class (`Option`, diff --git a/src/ingest_names.h b/src/ingest_names.h index c9b85ee06..0cd72f7ad 100644 --- a/src/ingest_names.h +++ b/src/ingest_names.h @@ -210,39 +210,7 @@ inline std::size_t operatorNameStart( std::string_view text ) noexcept return punctEnd == text.size() ? op : std::string_view::npos; } -// Index of the last `::` in `text` that sits at TEMPLATE-ARGUMENT DEPTH ZERO, or npos when there is none. -// Scanned in reverse (the LAST top-level separator is the one that splits name from scope), tracking `<`/`>` -// nesting so a `::` inside template arguments never splits: `tmplFn` has NO top-level separator, while -// `numeric_limits::max` has exactly one — at the `::` before `max`. -// PRECONDITION: `text` carries no trailing operator name. Depth is clamped at zero, which makes an -// operator spelling merely IGNORED rather than balanced — that is enough for `operator<<` and NOT enough for -// the `>` family, whose unmatched `>` would leave the depth pinned above zero and hide every separator. The -// caller checks operatorNameStart() first; do not weaken that ordering. -// The loop counts a 1-based CURSOR down to zero rather than the classic `for( i = n; i-- > 0; )`: that idiom -// wraps `i` to SIZE_MAX on its final test, which `-fsanitize=integer` reports as an unsigned-integer -// overflow (observed on this very function before this shape — the G1 build caught it on the fixture). -inline std::size_t lastTopLevelScopeSep( std::string_view text ) noexcept -{ - std::size_t angleDepth = 0; - for( std::size_t cursor = text.size(); cursor > 0; --cursor ) - { - const std::size_t charIndex = cursor - 1; - const char c = text[ charIndex ]; - if( c == '>' ) - { - ++angleDepth; - } - else if( c == '<' && angleDepth > 0 ) - { - --angleDepth; - } - else if( c == ':' && angleDepth == 0 && charIndex > 0 && text[ charIndex - 1 ] == ':' ) - { - return charIndex - 1; // index of the FIRST ':' of the pair - } - } - return std::string_view::npos; -} +// lastTopLevelScopeSep: infra/namesplit.h (moved there so graph-side readers split a scope by the same rule). // True when a qualified_identifier's `::` separator is a MISSING node — a zero-width token tree-sitter // INSERTED during error recovery, not one that is written in the source. Recovery reaches for this shape @@ -838,7 +806,7 @@ inline bool cppDefinitionRootsStd( TSNode nameNode, std::string_view src ) // part BEFORE the name's separator, and an operator never names a scope. inline std::string cppRefQualifierText( std::string_view scopeText ) { - const std::size_t sep = lastTopLevelScopeSep( scopeText ); + const std::size_t sep = namesplit::lastTopLevelScopeSep( scopeText ); const std::string_view last = skipTemplateDisambiguator( sep == std::string_view::npos ? scopeText : scopeText.substr( sep + 2 ) ); return last.ends_with( '>' ) ? canonicalTemplateIdText( last ) : immediateScope( last ); } @@ -875,7 +843,7 @@ inline void cppResplitRefName( RawRef& r, std::string_view nameTxt ) { return; } - const std::size_t sep = lastTopLevelScopeSep( nameTxt ); + const std::size_t sep = namesplit::lastTopLevelScopeSep( nameTxt ); const bool hasSep = sep != std::string_view::npos; const std::string_view tail = hasSep ? nameTxt.substr( sep + 2 ) : nameTxt; const std::string_view bare = skipTemplateDisambiguator( tail ); @@ -935,7 +903,7 @@ inline std::string rustPathSegment( std::string_view pathText ) noexcept { // the turbofish `::<` separator text.remove_suffix( 2 ); } - const std::size_t sep = lastTopLevelScopeSep( text ); + const std::size_t sep = namesplit::lastTopLevelScopeSep( text ); const std::string_view seg = ( sep == std::string_view::npos ) ? text : text.substr( sep + 2 ); return isRustIdentifier( seg ) ? std::string( seg ) : std::string{}; } diff --git a/src/quality.h b/src/quality.h index 0e533faf9..f783c96f0 100644 --- a/src/quality.h +++ b/src/quality.h @@ -3145,7 +3145,8 @@ inline std::string cacheRootKeyHex( const std::string& root ) // not include this header; it relies on ingest.cpp including quality.h (line 13) before ingest_cache.h, and a reorder // that broke that fails the build on the undeclared name rather than passing. constexpr std::uint32_t kIngestCacheVersionMirror = 53; // MUST equal ingest.cpp's kCacheVersion (gated); 53 = lane rust-self-chain placeholder (LocalBindKind RecvCall), 52 = lane failure-default (construct-hit failure-default tag), 51 = lane qd-constructs (FILE record construct-hit family), 50 = lane clones-persist (Function/Method def record clone key), 49 = lane warm-direct (FILE record head family counts), 48 = train 42b (alias-import LocalBindKind ReExport; its placeholder 47), 46 = train 40 (js-def-naming JsObjectLiteral; its placeholder 45), 44 = train 37b (rust-degraded FileHealth::useBoundsBlanked; its placeholder 42), 43 = train 36 (#155 trailingLambda ref byte; above main 40, #438's placeholder 41, rust-degraded's 42), 40 = train 34 (fc3-js-rebind JsRebind; above main 39), 39 = train 33 (above main 36 and l6-iface 38), 38 = train 32 lane l6-iface fix round 1: LocalBindKind ImplBlock (train renumbers), 37 = train 32 lane l6-iface: LocalBindKind DispatchType (train renumbers), 36 = train 30 (above call-result-typing's and fcall-forward's 33, name-template-dispatch's 35, main's 34), 34 = train 29 (above lane arity-min's and call-result-typing's 33), 33 = train 29 lane arity-min: def record paramsMin (the train renumbers), 33 = lane call-result-typing: RawBind resultIndex + unwrapDepth, 33 = lane fcall-forward: ref `forwarded` byte, 35 = lane name-template-dispatch: RefRole Pattern 11, 32 = train 28: RefRole Subscript 9 + Inert 10, 31 = train 27: lego-transitive's inherit-ref baseBind (the lane's 30), 29 = FE-B ref memberPath/memberCtor + 4 bind kinds, 28 = FE-A ref memberCall/memberRoot, 27 = corrected fnScope values, 26 = function-local def scope span (25 = #157 + #150) -constexpr std::uint32_t kIngestParserVerMirror = 333; // MUST equal ingest.cpp's kParserVer (gated) +constexpr std::uint32_t kIngestParserVerMirror = 335; // MUST equal ingest.cpp's kParserVer (gated) + // 335 = lane qual-ns-call-bind placeholder (C++ using-declarations + namespace aliases recorded) // 333 = 2026-11-18 (train 1117d2 on train 1117d1, rich 334; members below, each was a placeholder) // std-namesake (placeholder 317): a Rust binding written as a standard type keeps its spine on the tombstone // rust-self-chain (placeholder 319; kCacheVersion 53): Rust RecvCall records for member calls on a call's result, async ReturnType bit diff --git a/src/receiverevidence.h b/src/receiverevidence.h index 05641a2f0..e9c296651 100644 --- a/src/receiverevidence.h +++ b/src/receiverevidence.h @@ -254,6 +254,7 @@ struct CallResultTypes std::vector filePackage; HashMap> packageFiles; HashMap> aliasesByName; + HashMap cppUsingDeclared; // QUAL-NS-CALL-BIND: every name a C++ using-declaration binds (cppScopeNamedAt's gate) HashMap> goReceiverWitness; // GO-CALLRESULT-LOCAL: Go receiver type name → one method per package directory (goDeclLessType) // RULE3-MEMBER-GUARD: the package directory of a Rust source path (`crates/settings/src/file.rs` → `crates/settings`), empty for a path outside src/, tests/, benches/, examples/ static std::string_view rustPackageDirOf( std::string_view path ) @@ -284,6 +285,7 @@ struct CallResultTypes mutable std::string aliasKey; // importPathOf's / the TS pin lookup's mutable std::vector usingPath; // forEachCppUsing's per-row namespace path mutable std::string moduleKey; // rustModuleKey's buffer + mutable std::string scopeKey; // cppScopeNamedAt's gate lookup buffer mutable bool pathCut = false; // fc1 fix 3: a rustPathOutside walk hit its depth cap — its false then means "cut", not "stays in the tree" explicit CallResultTypes( const IngestResult& i ) : ing( i ) {} @@ -319,6 +321,10 @@ struct CallResultTypes { cppUsingFiles.push_back( b.fileId ); } + if( b.kind == LocalBindKind::TypeImport && isCppScopeRow( b ) && b.var != "*" ) + { + cppUsingDeclared.try_emplace( b.var, char( 1 ) ); + } } } // a C++ using-directive / using-declaration, or (fix round 3) a C++ alias: the rows that carry their scope's span (model.h) @@ -2311,6 +2317,58 @@ struct CallResultTypes return aliased; } + // QUAL-NS-CALL-BIND: the scope a C++ call names through a declaration IN FORCE at its site, spelled as the one segment the + // canonical tier keys (a call qualifier's own shape, ingest's H4 re-split) — "" when no declaration says, or two disagree: + // * a qualified call `h::f()` under a namespace alias `namespace h = rw::hashutil;` (or a type alias `using h = X;`) + // names the alias's target: "hashutil"; + // * a bare call `f()` under a using-declaration `using rw::hashutil::f;` names the declaration's scope: "hashutil". + // A using-directive (`using namespace a;`) names no one scope and is not read here. + // In force is forEachCppUsing's rule: the call's own file's rows declared before it in a scope that holds it, and the + // namespace- or file-scope rows of an in-tree header it includes whose namespace leads the call's. A name no alias or + // using-declaration in the tree binds never walks (the two name sets are built once, in noteImport). + std::string cppScopeNamedAt( const Reference& r ) const + { + const bool qualified = !r.qualifier.empty(); + const std::string_view name = qualified ? std::string_view( r.qualifier ) : std::string_view( r.calleeName ); + scopeKey.assign( name ); + if( qualified ? !aliasesByName.contains( scopeKey ) : !cppUsingDeclared.contains( scopeKey ) ) + { + return {}; + } + std::vector calleePath; + namespacePathAt( r.fileId, r.startByte, calleePath ); + std::string_view named; + bool agree = true; + forEachCppUsing( r.fileId, r.startByte, calleePath, [ & ]( const Binding& b ) + { + const bool fits = qualified ? b.kind == LocalBindKind::TypeAlias && !bindsWithoutTarget( b ) + : b.kind == LocalBindKind::TypeImport && b.var != "*"; + // an included header's row only at file scope: no C++ Namespace row is recorded while the family is off, so its + // namespace path is not read and a header's `namespace a { using x::f; }` might not lead to the call's + const bool fileScope = b.fileId == r.fileId || ( b.spanStart == 0 && b.spanEnd == 0xFFFFFFFFu ); + if( !fits || !fileScope || b.var != name ) + { + return; + } + const std::string_view scope = qualified ? lastScopeSegment( b.importedName ) : lastScopeSegment( scopeHalf( b.importedName ) ); + agree = agree && !scope.empty() && ( named.empty() || named == scope ); + named = scope; + } ); + return agree ? std::string( named ) : std::string(); + } + // `a::b::f` → `a::b` (the part before the last top-level `::`), "" when there is none + static std::string_view scopeHalf( std::string_view written ) noexcept + { + const std::size_t sep = namesplit::lastTopLevelScopeSep( written ); + return sep == std::string_view::npos ? std::string_view{} : written.substr( 0, sep ); + } + // `::a::b` → `b`, `a::B` → `B`: the last top-level segment + static std::string_view lastScopeSegment( std::string_view written ) noexcept + { + const std::size_t sep = namesplit::lastTopLevelScopeSep( written ); + return sep == std::string_view::npos ? written : written.substr( sep + 2 ); + } + // the class a ReturnType record's written type resolves to in its own (the callee's) file — kNoNode for none or several NodeId resultClassOf( const Binding& rt, Lang lang ) const { diff --git a/src/resolve.h b/src/resolve.h index 0a2bef26f..7da94d07f 100644 --- a/src/resolve.h +++ b/src/resolve.h @@ -6136,7 +6136,7 @@ struct FlatRecvType // as a member alias when the member sits in a class (a base class may supply it). // FLOORS (the base reading is kept, never a wrong row): a using-directive is not followed (`using namespace sc;`); a using-declaration // (`using extlib::Socket;`), a forward declaration or an enum of the alias's name in a NEARER scope than the alias is not seen -// (the C++ call-result bindings that record them are off, model.h callResultFamilyOf), so an in-tree alias further out would be +// (no binding row is read here: the C++ call-result bindings are off, model.h callResultFamilyOf), so an in-tree alias further out would be // read there; the same-named class-like symbol guard below is the one global check. // NO READING (the member keeps its base reading) when: the reachable aliases disagree (two same-scope aliases of one name with // different pointees: a tie is refused, never picked); the pointee was written in `std` (`std::shared_ptr`); the chain @@ -9680,31 +9680,51 @@ struct Rule3FileMemo // a declaration too — also marks that specialization as EXISTING, under the scope text prefixed with '\x01' (a byte // no scope or family key can hold): a call through an existing specialization that does not itself define the name // must never fall back to its siblings. -inline void indexCanonicalScope( HashMap>& byScope, HashMap>& byFamily, - std::string& key, const Symbol& s ) -{ - if( s.scope.empty() ) - { - return; - } - if( s.scope.back() == '>' ) - { - key.assign( 1, '\x01' ).append( s.scope ); +// QUAL-NS-CALL-BIND: a C-family scope WRITTEN with `::` — the C++17 nested namespace `namespace rw::hashutil { … }`, an +// out-of-line nested class `struct Tree::Leaf { … }` — is indexed under its LAST segment as well, because that is the +// one segment a call's qualifier keeps (ingest's H4 re-split): `hashutil::fnv1a64( s )`, `rw::hashutil::fnv1a64( s )` and +// `::rw::hashutil::fnv1a64( s )` all arrive with qualifier "hashutil", which the whole-scope key "rw::hashutil::fnv1a64" +// never matched — the call fell to the bare-name ladder and bound arch.h's same-named `rw::fnv1a64` (QUAL-NS-CALL-BIND +// Stage 0, test/qualnscallcheck.sh). The classic nesting `namespace rw { namespace hashutil { … } }` already scopes its +// members "hashutil", so both spellings of one namespace now key alike. Only the C family: another language's scope text +// is not a `::` path a qualifier re-splits. +inline void indexCanonicalScopeText( HashMap>& byScope, HashMap>& byFamily, + std::string& key, std::string_view scope, const Symbol& s, bool definition ) +{ + if( scope.back() == '>' ) + { + key.assign( 1, '\x01' ).append( scope ); byFamily[ key ]; } - if( !isDefinitionNotDeclaration( s ) ) + if( !definition ) { return; } key.clear(); - key.append( s.scope ).append( "::" ).append( s.name ); + key.append( scope ).append( "::" ).append( s.name ); byScope[ key ].push_back( s.id ); - if( appendTemplateFamilyKey( key, s.scope, s.name ) ) + if( appendTemplateFamilyKey( key, scope, s.name ) ) { byFamily[ key ].push_back( s.id ); } } +inline void indexCanonicalScope( HashMap>& byScope, HashMap>& byFamily, + std::string& key, const Symbol& s ) +{ + if( s.scope.empty() ) + { + return; + } + const bool definition = isDefinitionNotDeclaration( s ); + indexCanonicalScopeText( byScope, byFamily, key, s.scope, s, definition ); + const std::size_t sep = langFacts( s.lang ).transitiveIncludes ? namesplit::lastTopLevelScopeSep( s.scope ) : std::string_view::npos; + if( sep != std::string_view::npos && sep + 2 < s.scope.size() ) + { + indexCanonicalScopeText( byScope, byFamily, key, std::string_view( s.scope ).substr( sep + 2 ), s, definition ); + } +} + // The template-id class names chaUp holds — specializations with a base clause — byte-sorted, so the specializations // of one template are one contiguous range (specializationsOf). inline std::vector sortedSpecializationNames( const HashMap>& chaUp ) @@ -9804,23 +9824,26 @@ inline void widenToTemplateFamilies( CandidateSink& sink, std::string& ke // "No answer" leaves `cand` untouched, so the bare-name ladder decides exactly as it did before this fallback existed. // More than one candidate is a split the caller discloses with amb=; a call through a template-id never lands on a // same-named definition outside the template. `key` is the caller's reused buffer. +// `qualifier` is the call's written one, or the scope a declaration in force names for it (QUAL-NS-CALL-BIND: graph.h, from +// CallResultTypes::cppScopeNamedAt). template< class Admit > -inline void appendCanonicalCandidates( std::vector& cand, std::string& key, const Reference& r, const CanonicalScopes& scopes, Admit&& admit ) +inline void appendCanonicalCandidates( std::vector& cand, std::string& key, std::string_view qualifier, const Reference& r, const CanonicalScopes& scopes, + Admit&& admit ) { CandidateSink sink { cand, cand.size(), admit }; key.clear(); - key.append( r.qualifier ).append( "::" ).append( r.calleeName ); + key.append( qualifier ).append( "::" ).append( r.calleeName ); if( const auto it = scopes.byScope.find( key ); it != scopes.byScope.end() ) { sink.add( &it->second ); } - if( cand.size() != sink.before || !appendTemplateFamilyKey( key, r.qualifier, r.calleeName ) ) + if( cand.size() != sink.before || !appendTemplateFamilyKey( key, qualifier, r.calleeName ) ) { return; } - key.assign( 1, '\x01' ).append( r.qualifier ); - const bool existingSpecialization = scopes.byFamily.find( key ) != scopes.byFamily.end() || scopes.chaUp.find( r.qualifier ) != scopes.chaUp.end(); - const std::string_view family = existingSpecialization ? std::string_view( r.qualifier ) : namesplit::stripTemplateArgs( r.qualifier ); + key.assign( 1, '\x01' ).append( qualifier ); + const bool existingSpecialization = scopes.byFamily.find( key ) != scopes.byFamily.end() || scopes.chaUp.find( std::string( qualifier ) ) != scopes.chaUp.end(); + const std::string_view family = existingSpecialization ? qualifier : namesplit::stripTemplateArgs( qualifier ); sink.add( scopes.narrower.methodOnTypeOrBases( family, r, scopes.chaUp, /*skipSelf=*/existingSpecialization, /*unionOnMulti=*/true ) ); const bool primarySupplies = cand.size() != sink.before; if( existingSpecialization && !primarySupplies ) diff --git a/test/qschemetrip.hash b/test/qschemetrip.hash index f5313bdb1..f78ea91e4 100644 --- a/test/qschemetrip.hash +++ b/test/qschemetrip.hash @@ -1 +1 @@ -14b63d98888bc82c1bcc3cf9d27a7362a99ab0fa5e42fe4dde0354dfad246329 +10d4e73d093fe5f818c949baf5f4ce7d4f47d623a4f120b9fe8a60aa02d22b70 diff --git a/test/qschemetripcheck.sh b/test/qschemetripcheck.sh index cfaeeb816..d1820956f 100755 --- a/test/qschemetripcheck.sh +++ b/test/qschemetripcheck.sh @@ -34,6 +34,9 @@ SRC="$ROOT/src/quality.h" ING="$ROOT/src/ingest_cache.h" # extraction-identity constants moved here (2026-08-29 ingest.cpp section split); the hashed CONCAT label keeps its historical spelling so the pin holds PIN="$ROOT/test/qschemetrip.hash" # RE-PIN LOG (the pin is a bare hash, so its justification has to live here). +# 2026-11-19, lane qual-ns-call-bind (stacked on lane/import-proved-splits 4787d1ed0): RE-PINNED with UPDATE_GOLDEN=1. kParserVer +# 335 PLACEHOLDER (C++ using-declarations + namespace aliases recorded, ingest_binds.h kCppCallScopeFacts; mirrored in quality.h); +# the train renumbers and re-pins. kCacheVersion and kQSnapCacheScheme unchanged. # 2026-11-20, train 1117d2-s (std-namesake, rust-reexport, rust-modalias-glob, rust-self-chain, rust-macro-args, # rust-path-unhedged, redact-touch, qd-swap, qd-similar-default, py-class-spray; rebased onto main ee8d1a50e, #705 = train 1117d1): # RE-PINNED ONCE with UPDATE_GOLDEN=1 from the rebased build (hash 14b63d9888…d246329). kParserVer 333 (rich 334) replaces the diff --git a/test/qualnscallcheck.sh b/test/qualnscallcheck.sh new file mode 100755 index 000000000..e395a95bb --- /dev/null +++ b/test/qualnscallcheck.sh @@ -0,0 +1,213 @@ +#!/usr/bin/env bash +# qualnscallcheck.sh — QUAL-NS-CALL-BIND: a C++ call written with a namespace qualifier binds the namespace the qualifier names. +# +# THE BUG (GE5, 2026-11-19). ripwire's own `hashutil::fnv1a64( … )` calls all bound arch.h's same-named `rw::fnv1a64`. A call's +# qualifier is its IMMEDIATE segment (ingest's H4 re-split: `rw::hashutil::f` arrives as "hashutil"), but the canonical tier keyed a +# definition by its scope's WRITTEN text, and the C++17 nested namespace `namespace rw::hashutil { … }` writes "rw::hashutil". The +# key "hashutil::fnv1a64" missed, the call fell to the bare-name ladder, and Rule 3 picked the namesake an included file defines. +# THE FIX. resolve.h indexCanonicalScope keys a C-family `::` scope by its last segment too; graph.h keys a call by the scope a +# namespace alias (`namespace h = rw::hashutil;`) or a using-declaration (`using rw::hashutil::fnv1a64;`) in force at the call +# names (receiverevidence.h CallResultTypes::cppScopeNamedAt). +# +# Fixture (written at test time, no committed tree a whole-repo run would index): src/hashutil.h `namespace rw::hashutil` with +# fnv1a64, `namespace detail { mixer }`, `inline namespace v2 { widen }`, and an out-of-line nested class `struct Box::Leaf`; +# src/arch.h `namespace rw` with a SAME-SIGNATURE decoy of each (arity cannot tell them apart). Rows are read from --pin-census. +# POSITIVE hashutil::fnv1a64( s ) / rw::hashutil:: / ::rw::hashutil:: → hashutil.h only (base: a split with arch.h's) +# h::fnv1a64 under `namespace h = hashutil;` (same namespace) → hashutil.h only (base: split) +# hu::fnv1a64 under `namespace hu = rw::hashutil;` (another namespace) → hashutil.h only (base: split) +# fnv1a64( s ) under a block-scope `using rw::hashutil::fnv1a64;` → hashutil.h only (base: split) +# Leaf::grow() — the out-of-line nested class `struct Box::Leaf` → hashutil.h's (base: split with arch.h's Leaf-less grow) +# rw::fnv1a64( s ) itself calls hashutil::fnv1a64( s ) → hashutil.h (base: no edge, the "recursion" was a namesake) +# fnv1a64( s ) under an included header's FILE-scope `using rw::hashutil::fnv1a64;` → hashutil.h only (base: split) +# NEGATIVE (each counted; a build with the named guard removed turns its arm red — the lane's guard-off proof) +# fnv1a64( s ) / rw::fnv1a64( s ) in namespace rw → arch.h only, unchanged +# hashutil::detail::mixer( x ) (classic nesting already keyed) → hashutil.h only, unchanged +# hashutil::widen( x ) — the inline namespace v2 elided → still the split (inline-ness is not recorded: card) +# fnv1a64( s ) under `using namespace rw::hashutil;` (a directive) → still the split +# fnv1a64( s ) in namespace rw, whose own scope defines fnv1a64, under `using hashutil::fnv1a64;` → arch.h's +# (guard: graph.h callerScopeDeclares) +# a using-declaration of the name in ANOTHER function's body → still the split (not in force there) +# an alias `namespace late = …;` declared AFTER the call → still the split (not yet in force) +# an included header's `namespace q { using rw::hashutil::fnv1a64; }` → still the split: no C++ Namespace row is +# recorded, so a header row's namespace path is not read (guard: cppScopeNamedAt fileScope) +# mix( v ) — ADL through an argument of class type rw::hashutil::Val → unchanged (ADL is not modelled; the base row) +# Klass::make() — a class-static call, scope is a class → Klass's only, unchanged +# Holder::make() — a template-qualified call → Holder's, unchanged +# CALL_FNV( s ) — a macro that expands to ::rw::hashutil::fnv1a64 → the macro row, unchanged +# The fix keys rows the base left split or bound to the namesake; it never turns a hedged row into a proven one without a +# declaration that names the scope (an unknown qualifier keeps the base reading). +# Every negative arm counts the rows it read and the batch fails when they read none (a vacuous arm proves nothing). +# +# Usage: bash test/qualnscallcheck.sh [BIN] (default build/ripwire; exits non-zero on any failure) +set -u +ROOT="$( cd "$( dirname "$0" )/.." && pwd )" +. "$ROOT/test/lib/clean-env.sh" +BIN="${1:-${RIPWIRE_BIN:-$ROOT/build/ripwire}}" +[ "${BIN#/}" = "$BIN" ] && BIN="$ROOT/$BIN" +TMP="$( mktemp -d )"; trap 'rm -rf "$TMP"' EXIT +fail=0 +ok(){ printf ' PASS %s\n' "$*" || { fail=1; printf ' FAIL could not write the PASS line for: %s\n' "$*"; }; return 0; } +no(){ printf ' FAIL %s\n' "$*"; fail=1; } + +[ -x "$BIN" ] || { echo "FAIL: no binary at $BIN"; exit 1; } +echo "qualnscallcheck: $( "$BIN" --version 2>/dev/null )" # status: banner only; every arm below checks its own run + +# ── fixture ── +FX="$TMP/fx"; mkdir -p "$FX/src" +cat >"$FX/src/hashutil.h" <<'EOF' +#pragma once +#include +namespace rw::hashutil +{ +inline unsigned long fnv1a64( std::string_view s, unsigned long seed = 1 ) { return s.size() + seed; } +namespace detail +{ +inline unsigned long mixer( unsigned long x ) { return x * 3; } +} +inline namespace v2 +{ +inline unsigned long widen( unsigned long x ) { return x + 7; } +} +struct Val { unsigned long v = 0; }; +inline unsigned long mix( Val v ) { return v.v + 1; } +struct Box { struct Leaf; }; +struct Box::Leaf { static unsigned long grow( unsigned long x ) { return x + 2; } }; +} +EOF +cat >"$FX/src/arch.h" <<'EOF' +#pragma once +#include "hashutil.h" +namespace rw +{ +inline unsigned long fnv1a64( std::string_view s, unsigned long seed = 2 ) { return hashutil::fnv1a64( s, seed ); } +inline unsigned long mixer( unsigned long x ) { return x * 5; } +inline unsigned long widen( unsigned long x ) { return x + 9; } +inline unsigned long mix( unsigned long v ) { return v + 3; } +inline unsigned long grow( unsigned long x ) { return x + 4; } +struct Klass { static int make() { return 1; } }; +template struct Holder { static T make() { return T(); } }; +} +namespace other +{ +inline int make() { return 2; } +} +#define CALL_FNV( s ) ::rw::hashutil::fnv1a64( s ) +EOF +cat >"$FX/src/users.cpp" <<'EOF' +#include "arch.h" +namespace rw +{ +unsigned long callQualified( std::string_view s ) { return hashutil::fnv1a64( s ); } +unsigned long callFullyQualified( std::string_view s ) { return rw::hashutil::fnv1a64( s ); } +unsigned long callRootQualified( std::string_view s ) { return ::rw::hashutil::fnv1a64( s ); } +unsigned long callArch( std::string_view s ) { return fnv1a64( s ); } +unsigned long callArchQualified( std::string_view s ) { return rw::fnv1a64( s ); } +unsigned long callNested( unsigned long x ) { return hashutil::detail::mixer( x ); } +unsigned long callInlineElided( unsigned long x ) { return hashutil::widen( x ); } +unsigned long callLateAlias( std::string_view s ) { return late::fnv1a64( s ); } +namespace late = hashutil; +namespace h = hashutil; +unsigned long callAlias( std::string_view s ) { return h::fnv1a64( s ); } +unsigned long callLeaf( unsigned long x ) { return hashutil::Box::Leaf::grow( x ); } +unsigned long callAdl( hashutil::Val v ) { return mix( v ); } +int callStatic() { return Klass::make(); } +int callTemplate() { return Holder::make(); } +unsigned long callMacro( std::string_view s ) { return CALL_FNV( s ); } +} +namespace other +{ +namespace hu = rw::hashutil; +unsigned long callAlias2( std::string_view s ) { return hu::fnv1a64( s ); } +unsigned long callUsingDecl( std::string_view s ) +{ + using rw::hashutil::fnv1a64; + return fnv1a64( s ); +} +unsigned long callNoUsing( std::string_view s ) { return fnv1a64( s ); } +unsigned long callUsingDirective( std::string_view s ) +{ + using namespace rw::hashutil; + return fnv1a64( s ); +} +} +namespace rw +{ +using hashutil::fnv1a64; +unsigned long callOwnScope( std::string_view s ) { return fnv1a64( s ); } +} +EOF + +cat >"$FX/src/fileuse.h" <<'EOF' +#pragma once +#include "arch.h" +using rw::hashutil::fnv1a64; +EOF +cat >"$FX/src/more.cpp" <<'EOF' +#include "fileuse.h" +unsigned long callHeaderUsing( std::string_view s ) { return fnv1a64( s ); } +EOF +cat >"$FX/src/nsuse.h" <<'EOF' +#pragma once +#include "arch.h" +namespace q +{ +using rw::hashutil::fnv1a64; +} +EOF +cat >"$FX/src/nsmore.cpp" <<'EOF' +#include "nsuse.h" +namespace q +{ +unsigned long callHeaderNsUsing( std::string_view s ) { return fnv1a64( s ); } +} +EOF + +# census DIR → $TMP/.census (rc checked: a failed run would make every arm below vacuous) +census(){ ( cd "$1" && "$BIN" . --no-cache --pin-census="$TMP/$2.census" >/dev/null 2>"$TMP/$2.err" ); local rc=$? + [ "$rc" -eq 0 ] || { no "$2: the --pin-census run failed (rc=$rc)"; return 1; }; return 0; } +# row NAME CALLER_FILE CALLEE LINE → "mechtargets" of the one C row (empty when none); the row count goes to $TMP/rows +row(){ awk -F'\t' -v f="$2" -v c="$3" -v l="$4" '$1=="C" && index($6,f"::")==1 && $7==c && $9==l { print $2"\t"$8; n++ } END { print n+0 > "'"$TMP"'/rows" }' "$TMP/$1.census"; } +targets(){ printf '%s' "$1" | cut -f2 | tr '|' '\n' | sed 's/#[0-9]*$//' | sort | tr '\n' ' ' | sed 's/ $//'; } +seen=0 # rows the negative arms read +# expect NAME FILE CALLEE LINE WANT_TARGETS [MECH] — the site's one row has exactly these targets (and this mechanism) +expect(){ local r; r=$( row "$1" "$2" "$3" "$4" ); local n; n=$( cat "$TMP/rows" ); local t; t=$( targets "$r" ) + if [ "$n" = 1 ] && [ "$t" = "$5" ] && { [ -z "${6:-}" ] || [ "$( printf '%s' "$r" | cut -f1 )" = "$6" ]; }; then ok "$1 $2:$4 $3 -> $5${6:+ ($6)}" + else no "$1 $2:$4 $3: want $5${6:+ ($6)}, got rows=$n [$r]"; fi; } +neg(){ expect "$@"; seen=$(( seen + $( cat "$TMP/rows" ) )); } + +census "$FX" fx || exit 1 +H=src/hashutil.h; A=src/arch.h; U=src/users.cpp +HF="$H::rw::hashutil::fnv1a64"; AF="$A::rw::fnv1a64" + +echo "── the qualifier names the namespace (base: a split with arch.h's namesake) ──" +expect fx "$U" fnv1a64 4 "$HF" qualified +expect fx "$U" fnv1a64 5 "$HF" qualified +expect fx "$U" fnv1a64 6 "$HF" qualified +expect fx "$A" fnv1a64 5 "$HF" qualified # rw::fnv1a64's own body (base: no row) +expect fx "$U" grow 15 "$H::Box::Leaf::grow" qualified # the out-of-line nested class struct Box::Leaf + +echo "── a namespace alias or a using-declaration in force names it ──" +expect fx "$U" fnv1a64 14 "$HF" qualified # namespace h = hashutil; +expect fx "$U" fnv1a64 24 "$HF" qualified # namespace hu = rw::hashutil; (in namespace other) +expect fx "$U" fnv1a64 28 "$HF" qualified # block-scope using rw::hashutil::fnv1a64; +expect fx src/more.cpp fnv1a64 2 "$HF" qualified # an included header's file-scope using-declaration + +echo "── unchanged: nothing names another scope, or the declaration is not proved in force ──" +neg fx "$U" fnv1a64 7 "$AF" # bare, in namespace rw +neg fx "$U" fnv1a64 8 "$AF" qualified # rw::fnv1a64 +neg fx "$U" mixer 9 "$H::detail::mixer" qualified # classic nesting (already keyed) +neg fx "$U" widen 10 "$A::rw::widen $H::v2::widen" split # inline namespace elided: not recorded (card) +neg fx "$U" fnv1a64 11 "$AF $HF" split # alias declared after the call +neg fx "$U" fnv1a64 30 "$AF $HF" split # the using-declaration is in another function's body +neg fx "$U" fnv1a64 34 "$AF $HF" split # using-directive +neg fx "$U" fnv1a64 40 "$AF" # the caller's own scope defines the name (callerScopeDeclares) +neg fx src/nsmore.cpp fnv1a64 4 "$AF $HF" split # a header's namespace-scope using (fileScope guard) +neg fx "$U" make 17 "$A::Klass::make" qualified # class-static +neg fx "$U" make 18 "$A::Holder::make" qualified # template-qualified +neg fx "$U" mix 16 "$A::rw::mix" # ADL is not modelled: the base row +neg fx "$U" CALL_FNV 19 "$A::CALL_FNV" # the macro call itself + +if [ "$seen" -eq 13 ]; then ok "the 13 negative arms read $seen rows (premise: none vacuous)"; else no "the 13 negative arms read $seen rows (want 13, one each)"; fi + +[ "$fail" -eq 0 ] && echo "ALL PASS" || echo "SOME FAILED" +exit "$fail" diff --git a/test/regression.sh b/test/regression.sh index 562983d7f..241991421 100755 --- a/test/regression.sh +++ b/test/regression.sh @@ -931,6 +931,7 @@ for _g in \ qualitysymcheck \ qualnamecheck \ qualnewcheck \ + qualnscallcheck \ querycheck \ queryfilescancheck \ queuehopcheck \ From 6723946987d31626d61182389b336a8d6194c48e Mon Sep 17 00:00:00 2001 From: joyful-ii-V-I <210578314+joyful-ii-V-I@users.noreply.github.com> Date: Thu, 19 Nov 2026 17:32:36 -0500 Subject: [PATCH 15/35] refactor(graph): the canonical call qualifier is a named step outside buildGraph (quality-delta) canonicalCallQualifier holds the declaration-in-force keying and the caller-scope check; CallResultTypes::noteCppScopeRow takes noteImport's C++ rows; cppScopeNamedAt returns a view into the deciding row (no copy per call), C++ / ObjC only, and splits the path inline. Co-Authored-By: Claude Opus 5.5 --- src/graph.h | 38 +++++++++++++++++----------- src/receiverevidence.h | 55 ++++++++++++++++++++++++----------------- test/qualnscallcheck.sh | 4 +-- 3 files changed, 57 insertions(+), 40 deletions(-) diff --git a/src/graph.h b/src/graph.h index dc20fd11c..87a6b8d7a 100644 --- a/src/graph.h +++ b/src/graph.h @@ -10719,6 +10719,27 @@ inline bool pythonScopePinAt( const PythonLexicalScopes& scopes, const IngestRes return cand.empty() && !scopes.empty() && isPythonBareCall( r ) && pythonLexicalScopePin( scopes, ing, r, moduleUnread, cand ); } +// QUAL-NS-CALL-BIND: the qualifier the canonical tier keys call `r` by. A C++ call whose scope a declaration in force names +// (CallResultTypes::cppScopeNamedAt) is keyed by that scope: an alias shadows the qualifier it spells (`namespace h = rw::hashutil;` +// makes `h::f()` hashutil's), and a using-declaration (`using rw::hashutil::f;`) gives a bare `f()` its scope unless the caller's +// own scope or a base declares the name (C++ lookup finds that one first). No such declaration, two that +// disagree, a member call or a non-call: the written qualifier, as before. +inline std::string_view canonicalCallQualifier( const Reference& r, const CallResultTypes& types, const IngestResult& ing, const Narrower& narrower, const ChaUpNames& chaUp ) +{ + if( r.role != RefRole::Call || isMemberCallRef( r ) ) + { + return r.qualifier; + } + const std::string_view declScope = types.cppScopeNamedAt( r ); + if( declScope.empty() || !r.qualifier.empty() ) + { + return declScope.empty() ? std::string_view( r.qualifier ) : declScope; + } + // the caller's own scope (its class or a base, its namespace) declares the name: C++ lookup finds that one first + const std::string_view callerScope = r.fromSymbol < ing.symbols.size() ? std::string_view( ing.symbols[ r.fromSymbol ].scope ) : std::string_view{}; + return !callerScope.empty() && narrower.methodOnTypeOrBases( callerScope, r, chaUp ) != nullptr ? std::string_view( r.qualifier ) : declScope; +} + inline Graph buildGraph( const IngestResult& ing, const ScipOverlay* scip = nullptr, bool census = false ) { PROFILE_SCOPE_DESCRIBE( "buildGraph: resolve refs + build CSR" ); @@ -11126,13 +11147,6 @@ inline Graph buildGraph( const IngestResult& ing, const ScipOverlay* scip = null // for `class C(A, B)` Python's MRO puts A's chain before B's, so when both A and B define `m`, `super().m()` // in C names A::m. chaUp is sorted for its membership uses and cannot say which base came first. HashMap> chaUpDeclared; - // QUAL-NS-CALL-BIND: does the caller's own scope — its class or a base of it, or its namespace — define the callee's name? C++ - // lookup finds that one before a namespace-scope using-declaration of the name, so the declaration does not decide the call. - const auto callerScopeDeclares = [ & ]( const Reference& r ) -> bool - { - const std::string_view scope = r.fromSymbol < ing.symbols.size() ? std::string_view( ing.symbols[ r.fromSymbol ].scope ) : std::string_view{}; - return !scope.empty() && narrower.methodOnTypeOrBases( scope, r, chaUp ) != nullptr; - }; // Ruby bases, SCOPED by Ruby's own constant lookup (resolve.h::RubyBaseScope; test/rubyinheritcheck.sh floor // (c)). Read here — a base the tree never opens (`< ActiveRecord::Base`) adds no CHA edge, so its class's walk // cannot reach an unrelated in-tree `Base` — and by the implementor pass below. Empty on a Ruby-free corpus. @@ -12605,14 +12619,8 @@ inline Graph buildGraph( const IngestResult& ing, const ScipOverlay* scip = null // * with nothing visible from the primary, only a split of two or more specializations answers. // No answer leaves `cand` empty, so the bare-name ladder decides exactly as it did before the family fallback, // and no family answer ever reaches a same-named definition outside the template. - // QUAL-NS-CALL-BIND: a C++ call whose scope a declaration in force names (CallResultTypes::cppScopeNamedAt) is keyed by that - // scope instead — an alias shadows the qualifier it spells (`namespace h = rw::hashutil;` makes `h::f()` hashutil's), and a - // using-declaration (`using rw::hashutil::f;`) gives a bare `f()` its scope unless the caller's own scope or a base declares - // the name (found first by C++ lookup). No such declaration, or two that disagree: the written qualifier, as before. - const std::string declScope = !scipPinned && r.role == RefRole::Call && langFacts( r.lang ).qualifierNamesScope && !isMemberCallRef( r ) - ? recvEv.types.cppScopeNamedAt( r ) : std::string(); - const bool declNames = !declScope.empty() && ( !r.qualifier.empty() || !callerScopeDeclares( r ) ); - const std::string_view canonQualifier = declNames ? std::string_view( declScope ) : std::string_view( r.qualifier ); + // QUAL-NS-CALL-BIND: a C++ declaration in force may name the call's scope (canonicalCallQualifier) + const std::string_view canonQualifier = scipPinned ? std::string_view( r.qualifier ) : canonicalCallQualifier( r, recvEv.types, ing, narrower, chaUp ); if( !scipPinned && r.lang != Lang::Elixir && !canonQualifier.empty() ) { appendCanonicalCandidates( cand, qkey, canonQualifier, r, CanonicalScopes { canonByName, canonFamilyByName, specializationsWithBases, narrower, chaUp, ing.symbols }, diff --git a/src/receiverevidence.h b/src/receiverevidence.h index e9c296651..7ff5afd19 100644 --- a/src/receiverevidence.h +++ b/src/receiverevidence.h @@ -317,14 +317,24 @@ struct CallResultTypes { aliasesByName[ b.var ].push_back( &b ); } - if( isCppScopeRow( b ) && ( cppUsingFiles.empty() || cppUsingFiles.back() != b.fileId ) ) - { - cppUsingFiles.push_back( b.fileId ); - } - if( b.kind == LocalBindKind::TypeImport && isCppScopeRow( b ) && b.var != "*" ) - { - cppUsingDeclared.try_emplace( b.var, char( 1 ) ); - } + noteCppScopeRow( b ); + } + } + // a C++ row that carries its scope's span: its file joins cppUsingFiles (bindings arrive sorted by file), and a + // using-declaration's name joins cppUsingDeclared (QUAL-NS-CALL-BIND, cppScopeNamedAt's gate) + void noteCppScopeRow( const Binding& b ) + { + if( !isCppScopeRow( b ) ) + { + return; + } + if( cppUsingFiles.empty() || cppUsingFiles.back() != b.fileId ) + { + cppUsingFiles.push_back( b.fileId ); + } + if( b.kind == LocalBindKind::TypeImport && b.var != "*" ) + { + cppUsingDeclared.try_emplace( b.var, char( 1 ) ); } } // a C++ using-directive / using-declaration, or (fix round 3) a C++ alias: the rows that carry their scope's span (model.h) @@ -2326,8 +2336,13 @@ struct CallResultTypes // In force is forEachCppUsing's rule: the call's own file's rows declared before it in a scope that holds it, and the // namespace- or file-scope rows of an in-tree header it includes whose namespace leads the call's. A name no alias or // using-declaration in the tree binds never walks (the two name sets are built once, in noteImport). - std::string cppScopeNamedAt( const Reference& r ) const + // The view points into the deciding row's importedName (the ingest result's storage), never into a scratch buffer. + std::string_view cppScopeNamedAt( const Reference& r ) const { + if( r.lang != Lang::Cpp && r.lang != Lang::ObjC ) + { + return {}; + } const bool qualified = !r.qualifier.empty(); const std::string_view name = qualified ? std::string_view( r.qualifier ) : std::string_view( r.calleeName ); scopeKey.assign( name ); @@ -2350,23 +2365,17 @@ struct CallResultTypes { return; } - const std::string_view scope = qualified ? lastScopeSegment( b.importedName ) : lastScopeSegment( scopeHalf( b.importedName ) ); + // the scope's path: an alias's target (`rw::hashutil`), a using-declaration's name less its last segment + // (`rw::hashutil::f` → `rw::hashutil`); keyed by its last top-level segment (`hashutil`, `B`) + std::string_view path = b.importedName; + const std::size_t cut = qualified ? std::string_view::npos : namesplit::lastTopLevelScopeSep( path ); + path = qualified ? path : cut == std::string_view::npos ? std::string_view{} : path.substr( 0, cut ); + const std::size_t sep = namesplit::lastTopLevelScopeSep( path ); + const std::string_view scope = sep == std::string_view::npos ? path : path.substr( sep + 2 ); agree = agree && !scope.empty() && ( named.empty() || named == scope ); named = scope; } ); - return agree ? std::string( named ) : std::string(); - } - // `a::b::f` → `a::b` (the part before the last top-level `::`), "" when there is none - static std::string_view scopeHalf( std::string_view written ) noexcept - { - const std::size_t sep = namesplit::lastTopLevelScopeSep( written ); - return sep == std::string_view::npos ? std::string_view{} : written.substr( 0, sep ); - } - // `::a::b` → `b`, `a::B` → `B`: the last top-level segment - static std::string_view lastScopeSegment( std::string_view written ) noexcept - { - const std::size_t sep = namesplit::lastTopLevelScopeSep( written ); - return sep == std::string_view::npos ? written : written.substr( sep + 2 ); + return agree ? named : std::string_view{}; } // the class a ReturnType record's written type resolves to in its own (the callee's) file — kNoNode for none or several diff --git a/test/qualnscallcheck.sh b/test/qualnscallcheck.sh index e395a95bb..8e7cd85aa 100755 --- a/test/qualnscallcheck.sh +++ b/test/qualnscallcheck.sh @@ -25,7 +25,7 @@ # hashutil::widen( x ) — the inline namespace v2 elided → still the split (inline-ness is not recorded: card) # fnv1a64( s ) under `using namespace rw::hashutil;` (a directive) → still the split # fnv1a64( s ) in namespace rw, whose own scope defines fnv1a64, under `using hashutil::fnv1a64;` → arch.h's -# (guard: graph.h callerScopeDeclares) +# (guard: graph.h canonicalCallQualifier's caller-scope check) # a using-declaration of the name in ANOTHER function's body → still the split (not in force there) # an alias `namespace late = …;` declared AFTER the call → still the split (not yet in force) # an included header's `namespace q { using rw::hashutil::fnv1a64; }` → still the split: no C++ Namespace row is @@ -200,7 +200,7 @@ neg fx "$U" widen 10 "$A::rw::widen $H::v2::widen" split # inline namespace elid neg fx "$U" fnv1a64 11 "$AF $HF" split # alias declared after the call neg fx "$U" fnv1a64 30 "$AF $HF" split # the using-declaration is in another function's body neg fx "$U" fnv1a64 34 "$AF $HF" split # using-directive -neg fx "$U" fnv1a64 40 "$AF" # the caller's own scope defines the name (callerScopeDeclares) +neg fx "$U" fnv1a64 40 "$AF" # the caller's own scope defines the name (caller-scope check) neg fx src/nsmore.cpp fnv1a64 4 "$AF $HF" split # a header's namespace-scope using (fileScope guard) neg fx "$U" make 17 "$A::Klass::make" qualified # class-static neg fx "$U" make 18 "$A::Holder::make" qualified # template-qualified From 34b5cbf47259c4c2dec4a1c7ba5b0bb8d8e43d00 Mon Sep 17 00:00:00 2001 From: joyful-ii-V-I <210578314+joyful-ii-V-I@users.noreply.github.com> Date: Thu, 19 Nov 2026 19:11:19 -0500 Subject: [PATCH 16/35] style: the C++ scope-fact checks read langFacts qualifierNamesScope; namesplit clang-format The three new Lang predicates (captureTypeAlias's span, cppCallScopeFactRow, cppScopeNamedAt) read the existing qualifierNamesScope column (C++ / ObjC), whose comment now names the declarations that also name a call's scope; lastTopLevelScopeSep formatted by clang-format 22. Co-Authored-By: Claude Opus 5.5 --- src/infra/namesplit.h | 6 +++--- src/ingest_binds.h | 4 ++-- src/langfacts.h | 4 +++- src/receiverevidence.h | 2 +- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/infra/namesplit.h b/src/infra/namesplit.h index a2e242a4f..ee6c61bc7 100644 --- a/src/infra/namesplit.h +++ b/src/infra/namesplit.h @@ -168,7 +168,7 @@ inline std::size_t lastTopLevelScopeSep( std::string_view text ) noexcept for( std::size_t cursor = text.size(); cursor > 0; --cursor ) { const std::size_t charIndex = cursor - 1; - const char c = text[ charIndex ]; + const char c = text[charIndex]; if( c == '>' ) { ++angleDepth; @@ -177,9 +177,9 @@ inline std::size_t lastTopLevelScopeSep( std::string_view text ) noexcept { --angleDepth; } - else if( c == ':' && angleDepth == 0 && charIndex > 0 && text[ charIndex - 1 ] == ':' ) + else if( c == ':' && angleDepth == 0 && charIndex > 0 && text[charIndex - 1] == ':' ) { - return charIndex - 1; // index of the FIRST ':' of the pair + return charIndex - 1; // index of the FIRST ':' of the pair } } return std::string_view::npos; diff --git a/src/ingest_binds.h b/src/ingest_binds.h index 4df8e464d..0e0bac825 100644 --- a/src/ingest_binds.h +++ b/src/ingest_binds.h @@ -4621,7 +4621,7 @@ inline constexpr ScopeFactNode kCppCallScopeFacts[] = { }; inline const ScopeFactNode* cppCallScopeFactRow( Lang lang, const char* t ) { - if( ( lang != Lang::Cpp && lang != Lang::ObjC ) || callResultFamilyOf( lang ) == CallResultFamily::Cpp ) + if( !langFacts( lang ).qualifierNamesScope || callResultFamilyOf( lang ) == CallResultFamily::Cpp ) { return nullptr; // not C++, or the family's own rows (kScopeFactNodes) already record them } @@ -4665,7 +4665,7 @@ inline void captureTypeAlias( BindCtx& cx, TSNode n, const char* t ) { std::uint32_t spanStart = 0; std::uint32_t spanEnd = 0; - if( cx.lang == Lang::Cpp || cx.lang == Lang::ObjC ) // the family's rows, and kCppCallScopeFacts' while the family is off + if( langFacts( cx.lang ).qualifierNamesScope ) // C++ / ObjC: the family's rows, and kCppCallScopeFacts' while the family is off { std::tie( spanStart, spanEnd ) = cppDeclScope( n, true ); if( spanEnd == 0 ) diff --git a/src/langfacts.h b/src/langfacts.h index e2e21feae..5002809f2 100644 --- a/src/langfacts.h +++ b/src/langfacts.h @@ -419,7 +419,9 @@ struct LangFacts bool localBraceNotData = false; /// C++, Objective-C: a call's `Q::` qualifier names a namespace or class some definition holds, so an included file's namesake - /// proves nothing about `Q::f()` when the tree defines no Q (graph.h CppQualifierScopes, CPP-EXTQUAL-VETO). + /// proves nothing about `Q::f()` when the tree defines no Q (graph.h CppQualifierScopes, CPP-EXTQUAL-VETO). The same scope can + /// be named by a declaration in force instead — a namespace alias (`namespace h = a::b;`) or a using-declaration (`using a::b::f;`): + /// ingest records both (ingest_binds.h kCppCallScopeFacts) and graph.h keys the call by it (CallResultTypes::cppScopeNamedAt). bool qualifierNamesScope = false; /// C, C++: a file-scope const object of a struct type is how a family registers its members (htop `const MeterClass diff --git a/src/receiverevidence.h b/src/receiverevidence.h index 7ff5afd19..8f5a6ec2c 100644 --- a/src/receiverevidence.h +++ b/src/receiverevidence.h @@ -2339,7 +2339,7 @@ struct CallResultTypes // The view points into the deciding row's importedName (the ingest result's storage), never into a scratch buffer. std::string_view cppScopeNamedAt( const Reference& r ) const { - if( r.lang != Lang::Cpp && r.lang != Lang::ObjC ) + if( !langFacts( r.lang ).qualifierNamesScope ) // C++ / ObjC { return {}; } From ef8a35f02cce650d48ddfde69bcd15ef9eaa0a10 Mon Sep 17 00:00:00 2001 From: joyful-ii-V-I <210578314+joyful-ii-V-I@users.noreply.github.com> Date: Thu, 19 Nov 2026 20:43:54 -0500 Subject: [PATCH 17/35] fix(graph): a C++ declaration in force names a call's scope only where C++ lookup reaches it first Review round 1 of QUAL-NS-CALL-BIND (F1-F6): - F1: a using-declaration outside the caller's body no longer beats a namesake C++ lookup may find first. graph.h callerScopesMayDeclare walks the caller's class chain (ClassIdentity ownerClass / enclosingClass, each level with its bases and bodiless declarations); the namespace chain is not recorded while the C++ family is off (card CPP-HDR-NS-USING), so a caller that may sit in a namespace beside an in-tree namespace-scope namesake keeps the base split. A block-scope using-declaration in the caller's own body still binds. - F2: an alias no longer rewrites `h::f()` when a scope spelled `h` holds `f` itself (a nested namespace `gamma::h`, a nested class `S::h`): the one-segment Reference cannot tell them apart, so the base reading stands. - F3: a local the caller declares (a lambda, a parameter) shadows a using-declared name. - F4: a template family's answer that includes its primary skips the S6-C locality tie-break (appendCanonicalCandidates returns it): envoy's dependent `Traits::getFieldType()` keeps the primary beside the out-of-line specializations instead of dropping it on scope-text overlap. - F6: the header half of cppScopeNamedAt is memoized per (file, name, kind); the per-call namespace-path vector and the per-call std::string for the chaUp probe are gone; the gate set is C++-only (cppScopeNames), so another language's alias spelling never starts a walk. - F5: qualnscallcheck gains fixture fx2 (F1-F4 arms red on the first lane head, the member-call, two-scope and Rust arms), and labels the arms that cannot fail (base pins, a known-gap pin, a known floor, report-only Rust). Co-Authored-By: Claude Opus 5.5 --- src/graph.h | 121 ++++++++++++++++++++++++---- src/receiverevidence.h | 154 ++++++++++++++++++++++++++--------- src/resolve.h | 16 ++-- test/qualnscallcheck.sh | 174 +++++++++++++++++++++++++++++++++++++++- 4 files changed, 404 insertions(+), 61 deletions(-) diff --git a/src/graph.h b/src/graph.h index 87a6b8d7a..061d96db1 100644 --- a/src/graph.h +++ b/src/graph.h @@ -10719,25 +10719,112 @@ inline bool pythonScopePinAt( const PythonLexicalScopes& scopes, const IngestRes return cand.empty() && !scopes.empty() && isPythonBareCall( r ) && pythonLexicalScopePin( scopes, ing, r, moduleUnread, cand ); } +// QUAL-NS-CALL-BIND: what canonicalCallQualifier reads beyond the call — built once, before the resolve loop +struct CallScopeLookup +{ + const CallResultTypes& types; // cppScopeNamedAt: the declaration in force at the site + const std::vector& symbols; + const CanonicalScopes& canon; // byScope: what a scope spelled `q` holds; narrower + chaUp: the CHA walk + const ClassIdentity& classIds; // the caller's class chain; a bodiless member's "Scope::name" + const FalseEdgeRules& falseEdges; // a local the caller declares + const HashMap>& byName; // the callee's in-tree namesakes + mutable std::string key; // "Scope::name" buffer +}; + +// a scope spelled `scope` holds `name` itself: a definition (byScope) or a bodiless member declaration (ClassIdentity::declared) +inline bool scopeHoldsName( const CallScopeLookup& at, std::string_view scope, std::string_view name ) +{ + at.key.assign( scope ).append( "::" ).append( name ); + return at.canon.byScope.contains( at.key ) || at.classIds.declared.contains( at.key ); +} + +// C++ unqualified lookup walks outward from the call — the caller's class (with its bases), each enclosing class, then the +// enclosing namespaces — and stops at the first scope that declares the name, so a using-declaration OUTSIDE the caller's +// body is found only when none of them does. True when one does, or MAY: the class chain is read (ClassIdentity), but no +// namespace path is recorded while the C++ family is off (card CPP-HDR-NS-USING), so a caller that may sit in a namespace, +// beside an in-tree namespace-scope namesake the declaration does not name, keeps the base reading (a hedge, never a guess). +// A namesake at global scope competes only with a file-scope declaration (one scope: an overload set C++ resolves). +inline bool callerScopesMayDeclare( const Reference& r, const CallResultTypes::CppNamedScope& named, const CallScopeLookup& at ) +{ + const Narrower& narrower = at.canon.narrower; + const bool hasCaller = r.fromSymbol < at.symbols.size(); + const std::string_view own = hasCaller ? std::string_view( at.symbols[ r.fromSymbol ].scope ) : std::string_view{}; + if( !own.empty() && ( narrower.methodOnTypeOrBases( own, r, at.canon.chaUp ) != nullptr || scopeHoldsName( at, own, r.calleeName ) ) ) + { + return true; // the caller's own scope: its class or a base, its namespace + } + const auto ownerOf = [ & ]( NodeId id ) { return id < at.classIds.ownerClass.size() ? at.classIds.ownerClass[ id ] : kNoNode; }; + NodeId cls = hasCaller ? ownerOf( r.fromSymbol ) : kNoNode; + const bool member = cls != kNoNode; + for( int depth = 0; cls != kNoNode; ++depth ) + { + const std::string& name = at.symbols[ cls ].name; + if( depth == 16 || narrower.methodOnTypeOrBases( name, r, at.canon.chaUp ) != nullptr || scopeHoldsName( at, name, r.calleeName ) ) + { + return true; // an enclosing class (or its base) declares it — or the chain is deeper than read + } + cls = cls < at.classIds.enclosingClass.size() ? at.classIds.enclosingClass[ cls ] : kNoNode; + } + const bool mayBeInNamespace = member || !own.empty(); // a class's namespace is not recorded either + const auto namesakes = at.byName.find( r.calleeName ); + if( namesakes == at.byName.end() ) + { + return false; + } + for( NodeId c : namesakes->second ) + { + const Symbol& s = at.symbols[ c ]; + if( !langCompatible( s.lang, r.lang ) || s.kind == SymKind::Method || ownerOf( c ) != kNoNode ) + { + continue; // another language's, or a member of a class the walk above did not reach: unqualified lookup never finds it + } + const std::size_t sep = namesplit::lastTopLevelScopeSep( s.scope ); + const std::string_view last = sep == std::string_view::npos ? std::string_view( s.scope ) : std::string_view( s.scope ).substr( sep + 2 ); + if( !s.scope.empty() && last == named.scope ) + { + continue; // what the declaration names + } + if( s.scope.empty() ? named.fileScope() : mayBeInNamespace ) + { + return true; + } + } + return false; +} + // QUAL-NS-CALL-BIND: the qualifier the canonical tier keys call `r` by. A C++ call whose scope a declaration in force names -// (CallResultTypes::cppScopeNamedAt) is keyed by that scope: an alias shadows the qualifier it spells (`namespace h = rw::hashutil;` -// makes `h::f()` hashutil's), and a using-declaration (`using rw::hashutil::f;`) gives a bare `f()` its scope unless the caller's -// own scope or a base declares the name (C++ lookup finds that one first). No such declaration, two that -// disagree, a member call or a non-call: the written qualifier, as before. -inline std::string_view canonicalCallQualifier( const Reference& r, const CallResultTypes& types, const IngestResult& ing, const Narrower& narrower, const ChaUpNames& chaUp ) +// (CallResultTypes::cppScopeNamedAt) is keyed by that scope, unless C++ lookup may find something else first — then the +// written qualifier, the base reading: +// * an alias shadows the qualifier it spells (`namespace h = rw::hashutil;` makes `h::f()` hashutil's), unless a scope +// spelled `h` holds an `f` itself: the Reference keeps one segment, so `gamma::h::f()` or a nested class `S::h` may be +// the one the call writes; +// * a using-declaration (`using rw::hashutil::f;`) gives a bare `f()` its scope, unless the caller declares a local `f` +// (a lambda, a parameter), or — for a declaration outside the caller's own body — a scope between them may declare `f` +// (callerScopesMayDeclare). A block-scope declaration in the caller's body is found before any class or namespace. +// No such declaration, two that disagree, a member call or a non-call: the written qualifier, as before. +inline std::string_view canonicalCallQualifier( const Reference& r, const CallScopeLookup& at ) { if( r.role != RefRole::Call || isMemberCallRef( r ) ) { return r.qualifier; } - const std::string_view declScope = types.cppScopeNamedAt( r ); - if( declScope.empty() || !r.qualifier.empty() ) + const CallResultTypes::CppNamedScope named = at.types.cppScopeNamedAt( r ); + if( named.scope.empty() ) + { + return r.qualifier; + } + if( !r.qualifier.empty() ) + { + return scopeHoldsName( at, r.qualifier, r.calleeName ) ? std::string_view( r.qualifier ) : named.scope; + } + if( ( at.falseEdges.localEvidenceOfCaller( r ) & kLocalNameDeclared ) != 0 ) { - return declScope.empty() ? std::string_view( r.qualifier ) : declScope; + return r.qualifier; } - // the caller's own scope (its class or a base, its namespace) declares the name: C++ lookup finds that one first - const std::string_view callerScope = r.fromSymbol < ing.symbols.size() ? std::string_view( ing.symbols[ r.fromSymbol ].scope ) : std::string_view{}; - return !callerScope.empty() && narrower.methodOnTypeOrBases( callerScope, r, chaUp ) != nullptr ? std::string_view( r.qualifier ) : declScope; + const bool hasCaller = r.fromSymbol < at.symbols.size(); + const bool inCallerBody = hasCaller && !named.fileScope() && at.symbols[ r.fromSymbol ].sigStartByte <= named.spanStart + && named.spanEnd <= at.symbols[ r.fromSymbol ].endByte; + return inCallerBody || !callerScopesMayDeclare( r, named, at ) ? named.scope : std::string_view( r.qualifier ); } inline Graph buildGraph( const IngestResult& ing, const ScipOverlay* scip = nullptr, bool census = false ) @@ -12327,6 +12414,8 @@ inline Graph buildGraph( const IngestResult& ing, const ScipOverlay* scip = null } { PROFILE_SCOPE_DESCRIBE( "buildGraph/3: resolve loop (per reference)" ); + const CanonicalScopes canonScopes { canonByName, canonFamilyByName, specializationsWithBases, narrower, chaUp, ing.symbols }; + const CallScopeLookup callScopes { recvEv.types, ing.symbols, canonScopes, classIds, falseEdges, byName, {} }; // QUAL-NS-CALL-BIND const MdLinkPins mdLinks = bindMarkdownLinks( ing ); // empty unless the tree holds a cross-file markdown link const std::vector& mdLinkPin = mdLinks.pin; const std::vector& mdSlugMiss = mdLinks.slugMiss; @@ -12620,11 +12709,12 @@ inline Graph buildGraph( const IngestResult& ing, const ScipOverlay* scip = null // No answer leaves `cand` empty, so the bare-name ladder decides exactly as it did before the family fallback, // and no family answer ever reaches a same-named definition outside the template. // QUAL-NS-CALL-BIND: a C++ declaration in force may name the call's scope (canonicalCallQualifier) - const std::string_view canonQualifier = scipPinned ? std::string_view( r.qualifier ) : canonicalCallQualifier( r, recvEv.types, ing, narrower, chaUp ); + const std::string_view canonQualifier = scipPinned ? std::string_view( r.qualifier ) : canonicalCallQualifier( r, callScopes ); + bool templateFamily = false; // F4: the tier answered from a template family, its primary included if( !scipPinned && r.lang != Lang::Elixir && !canonQualifier.empty() ) { - appendCanonicalCandidates( cand, qkey, canonQualifier, r, CanonicalScopes { canonByName, canonFamilyByName, specializationsWithBases, narrower, chaUp, ing.symbols }, - [ & ]( NodeId c ) { return langCompatible( symLang[ c ], r.lang ) && sameRoot( c, r.fileId ); } ); + templateFamily = appendCanonicalCandidates( cand, qkey, canonQualifier, r, canonScopes, + [ & ]( NodeId c ) { return langCompatible( symLang[ c ], r.lang ) && sameRoot( c, r.fileId ); } ); canonical = !cand.empty(); } // RUST-PATH-OWNER (receiverevidence.h pathOwners, the Rust arm rustPathOwners): the tier matched a Rust path's scope NAME; the type the path resolves to @@ -13949,7 +14039,8 @@ inline Graph buildGraph( const IngestResult& ing, const ScipOverlay* scip = null if( !scipPinned && !bindingPinned && r.lang != Lang::Elixir && tier.size() > 1 && !ing.symbols[ r.fromSymbol ].scope.empty() && r.recv != RecvKind::FieldOfThis && r.recv != RecvKind::FieldOfVar && r.recv != RecvKind::SuperObj && !identityClaim && !isJsTsLitRecv( r.recv ) && r.recv != RecvKind::JavaTypeCandidate && !nameOnly // FE-B: a name-only call keeps every candidate - && rustPath != ReceiverEvidence::PathOwners::Split ) // RUST-PATH-OWNER: same-named types the path cannot tell apart are a genuine split (#74) + && rustPath != ReceiverEvidence::PathOwners::Split // RUST-PATH-OWNER: same-named types the path cannot tell apart are a genuine split (#74) + && !templateFamily ) // QUAL-NS-CALL-BIND F4: which member of a template family a dependent `Traits::f()` reaches is T's to say, not locality's { const std::string& callerCanon = g.localityKeyAt( r.fromSymbol ); // == canonId here (the caller is scoped) const std::size_t localityCap = receiverLocalityCap( r, receiverTypeNarrowed, ing.files[ ing.symbols[ r.fromSymbol ].fileId ] ); diff --git a/src/receiverevidence.h b/src/receiverevidence.h index 8f5a6ec2c..abfdb9ec7 100644 --- a/src/receiverevidence.h +++ b/src/receiverevidence.h @@ -254,7 +254,11 @@ struct CallResultTypes std::vector filePackage; HashMap> packageFiles; HashMap> aliasesByName; - HashMap cppUsingDeclared; // QUAL-NS-CALL-BIND: every name a C++ using-declaration binds (cppScopeNamedAt's gate) + // QUAL-NS-CALL-BIND: every name a C++ using-declaration (kCppScopeUsingDeclared) or a spanned C++ alias (kCppScopeAliased) + // binds — cppScopeNamedAt's gate, so a TS / Rust / Kotlin alias of the same spelling never starts a C++ walk + HashMap cppScopeNames; + static constexpr char kCppScopeUsingDeclared = 1; + static constexpr char kCppScopeAliased = 2; HashMap> goReceiverWitness; // GO-CALLRESULT-LOCAL: Go receiver type name → one method per package directory (goDeclLessType) // RULE3-MEMBER-GUARD: the package directory of a Rust source path (`crates/settings/src/file.rs` → `crates/settings`), empty for a path outside src/, tests/, benches/, examples/ static std::string_view rustPackageDirOf( std::string_view path ) @@ -285,7 +289,31 @@ struct CallResultTypes mutable std::string aliasKey; // importPathOf's / the TS pin lookup's mutable std::vector usingPath; // forEachCppUsing's per-row namespace path mutable std::string moduleKey; // rustModuleKey's buffer - mutable std::string scopeKey; // cppScopeNamedAt's gate lookup buffer + mutable std::string scopeKey; // cppScopeNamedAt's gate and memo lookup buffer + // QUAL-NS-CALL-BIND: what the in-tree headers a file includes declare, at file scope, for one name — the header half of + // cppScopeNamedAt, which depends on (file, name, alias-or-using) only: "#" → the fold of those rows + struct CppScopeFold + { + std::string_view named; // the scope the rows name ("" none) + bool agree = true; // false: two rows name different scopes, or one names none (`using ::f;`) + bool any = false; + void add( std::string_view scope ) + { + agree = agree && !scope.empty() && ( named.empty() || named == scope ); + named = scope; + any = true; + } + void join( const CppScopeFold& o ) + { + if( o.any ) + { + agree = agree && o.agree && ( named.empty() || named == o.named ); + named = o.named; + any = true; + } + } + }; + mutable HashMap cppHeaderScopeMemo; mutable bool pathCut = false; // fc1 fix 3: a rustPathOutside walk hit its depth cap — its false then means "cut", not "stays in the tree" explicit CallResultTypes( const IngestResult& i ) : ing( i ) {} @@ -320,8 +348,8 @@ struct CallResultTypes noteCppScopeRow( b ); } } - // a C++ row that carries its scope's span: its file joins cppUsingFiles (bindings arrive sorted by file), and a - // using-declaration's name joins cppUsingDeclared (QUAL-NS-CALL-BIND, cppScopeNamedAt's gate) + // a C++ row that carries its scope's span: its file joins cppUsingFiles (bindings arrive sorted by file), and the name a + // using-declaration or an alias binds joins cppScopeNames (QUAL-NS-CALL-BIND, cppScopeNamedAt's gate) void noteCppScopeRow( const Binding& b ) { if( !isCppScopeRow( b ) ) @@ -332,9 +360,10 @@ struct CallResultTypes { cppUsingFiles.push_back( b.fileId ); } - if( b.kind == LocalBindKind::TypeImport && b.var != "*" ) + const char bit = b.kind == LocalBindKind::TypeAlias ? kCppScopeAliased : b.var != "*" ? kCppScopeUsingDeclared : char( 0 ); + if( bit != 0 ) { - cppUsingDeclared.try_emplace( b.var, char( 1 ) ); + cppScopeNames[ b.var ] |= bit; } } // a C++ using-directive / using-declaration, or (fix round 3) a C++ alias: the rows that carry their scope's span (model.h) @@ -2170,6 +2199,12 @@ struct CallResultTypes } }; rowsOf( f, true ); + forEachIncludedCppScopeFile( f, [ & ]( std::uint32_t h ) { rowsOf( h, false ); } ); + } + // every in-tree file `f` includes (transitively) that holds a C++ scope row (cppUsingFiles), walked from the smaller side + template + void forEachIncludedCppScopeFile( std::uint32_t f, Fn&& fn ) const + { if( fileIncludes == nullptr ) { return; @@ -2180,7 +2215,7 @@ struct CallResultTypes { if( std::binary_search( cppUsingFiles.begin(), cppUsingFiles.end(), h ) ) { - rowsOf( h, false ); + fn( h ); } } ); return; @@ -2189,7 +2224,7 @@ struct CallResultTypes { if( fileIncludes->contains( f, h ) ) { - rowsOf( h, false ); + fn( h ); } } } @@ -2328,16 +2363,26 @@ struct CallResultTypes } // QUAL-NS-CALL-BIND: the scope a C++ call names through a declaration IN FORCE at its site, spelled as the one segment the - // canonical tier keys (a call qualifier's own shape, ingest's H4 re-split) — "" when no declaration says, or two disagree: + // canonical tier keys (a call qualifier's own shape, ingest's H4 re-split) — `scope` "" when no declaration says, or two disagree: // * a qualified call `h::f()` under a namespace alias `namespace h = rw::hashutil;` (or a type alias `using h = X;`) // names the alias's target: "hashutil"; // * a bare call `f()` under a using-declaration `using rw::hashutil::f;` names the declaration's scope: "hashutil". // A using-directive (`using namespace a;`) names no one scope and is not read here. - // In force is forEachCppUsing's rule: the call's own file's rows declared before it in a scope that holds it, and the - // namespace- or file-scope rows of an in-tree header it includes whose namespace leads the call's. A name no alias or - // using-declaration in the tree binds never walks (the two name sets are built once, in noteImport). + // In force: the call's own file's rows declared before it in a scope that holds it (forEachCppUsing's own-file rule), and + // the FILE-scope rows of every in-tree header it includes — a header's `namespace a { using x::f; }` is not read, because no + // C++ Namespace row is recorded while the family is off, so its namespace path is unknown (card CPP-HDR-NS-USING). The + // header half depends on (file, name) only and is memoized (cppHeaderScopeMemo). A name no alias or using-declaration in the + // tree binds never walks. `spanStart`/`spanEnd` are the innermost deciding row's span: the scope C++ lookup finds it in, which + // the caller (graph.h canonicalCallQualifier) compares with the scopes between it and the call. // The view points into the deciding row's importedName (the ingest result's storage), never into a scratch buffer. - std::string_view cppScopeNamedAt( const Reference& r ) const + struct CppNamedScope + { + std::string_view scope; + std::uint32_t spanStart = 0; + std::uint32_t spanEnd = 0xFFFFFFFFu; + bool fileScope() const noexcept { return spanStart == 0 && spanEnd == 0xFFFFFFFFu; } + }; + CppNamedScope cppScopeNamedAt( const Reference& r ) const { if( !langFacts( r.lang ).qualifierNamesScope ) // C++ / ObjC { @@ -2346,36 +2391,71 @@ struct CallResultTypes const bool qualified = !r.qualifier.empty(); const std::string_view name = qualified ? std::string_view( r.qualifier ) : std::string_view( r.calleeName ); scopeKey.assign( name ); - if( qualified ? !aliasesByName.contains( scopeKey ) : !cppUsingDeclared.contains( scopeKey ) ) + const auto gate = cppScopeNames.find( scopeKey ); + if( gate == cppScopeNames.end() || ( gate->second & ( qualified ? kCppScopeAliased : kCppScopeUsingDeclared ) ) == 0 ) { return {}; } - std::vector calleePath; - namespacePathAt( r.fileId, r.startByte, calleePath ); - std::string_view named; - bool agree = true; - forEachCppUsing( r.fileId, r.startByte, calleePath, [ & ]( const Binding& b ) - { - const bool fits = qualified ? b.kind == LocalBindKind::TypeAlias && !bindsWithoutTarget( b ) - : b.kind == LocalBindKind::TypeImport && b.var != "*"; - // an included header's row only at file scope: no C++ Namespace row is recorded while the family is off, so its - // namespace path is not read and a header's `namespace a { using x::f; }` might not lead to the call's - const bool fileScope = b.fileId == r.fileId || ( b.spanStart == 0 && b.spanEnd == 0xFFFFFFFFu ); - if( !fits || !fileScope || b.var != name ) + CppScopeFold fold; + CppNamedScope out; + for( const Binding* b : r.fileId < importsByFile.size() ? std::span( importsByFile[ r.fileId ] ) : std::span{} ) + { + const std::uint32_t at = r.startByte; + if( isCppScopeRow( *b ) && b->startByte < at && b->spanStart <= at && at < b->spanEnd && cppScopeRowFits( *b, qualified, name ) ) { - return; + fold.add( cppScopeOfRow( *b, qualified ) ); + if( b->spanEnd - b->spanStart <= out.spanEnd - out.spanStart ) + { + out.spanStart = b->spanStart; + out.spanEnd = b->spanEnd; + } + } + } + fold.join( cppHeaderScopeOf( r.fileId, name, qualified ) ); + out.scope = fold.agree ? fold.named : std::string_view{}; + return out; + } + // a row that binds `name` the way the call reads it: an alias with a target for a qualified call, a using-declaration (not + // a directive) for a bare one + static bool cppScopeRowFits( const Binding& b, bool qualified, std::string_view name ) + { + const bool fits = qualified ? b.kind == LocalBindKind::TypeAlias && !bindsWithoutTarget( b ) : b.kind == LocalBindKind::TypeImport && b.var != "*"; + return fits && b.var == name; + } + // the scope's path: an alias's target (`rw::hashutil`), a using-declaration's name less its last segment + // (`rw::hashutil::f` → `rw::hashutil`); keyed by its last top-level segment (`hashutil`, `B`) + static std::string_view cppScopeOfRow( const Binding& b, bool qualified ) + { + std::string_view path = b.importedName; + const std::size_t cut = qualified ? std::string_view::npos : namesplit::lastTopLevelScopeSep( path ); + path = qualified ? path : cut == std::string_view::npos ? std::string_view{} : path.substr( 0, cut ); + const std::size_t sep = namesplit::lastTopLevelScopeSep( path ); + return sep == std::string_view::npos ? path : path.substr( sep + 2 ); + } + // the header half of cppScopeNamedAt: the file-scope rows of the in-tree headers `f` includes, memoized per (f, name, kind) + CppScopeFold cppHeaderScopeOf( std::uint32_t f, std::string_view name, bool qualified ) const + { + scopeKey.clear(); + scopeKey.append( std::to_string( f ) ).push_back( '#' ); + scopeKey.push_back( qualified ? 'a' : 'u' ); + scopeKey.append( name ); + if( const auto hit = cppHeaderScopeMemo.find( scopeKey ); hit != cppHeaderScopeMemo.end() ) + { + return hit->second; + } + CppScopeFold fold; + forEachIncludedCppScopeFile( f, [ & ]( std::uint32_t h ) + { + for( const Binding* b : h < importsByFile.size() ? std::span( importsByFile[ h ] ) : std::span{} ) + { + if( isCppScopeRow( *b ) && b->spanStart == 0 && b->spanEnd == 0xFFFFFFFFu && cppScopeRowFits( *b, qualified, name ) ) + { + fold.add( cppScopeOfRow( *b, qualified ) ); + } } - // the scope's path: an alias's target (`rw::hashutil`), a using-declaration's name less its last segment - // (`rw::hashutil::f` → `rw::hashutil`); keyed by its last top-level segment (`hashutil`, `B`) - std::string_view path = b.importedName; - const std::size_t cut = qualified ? std::string_view::npos : namesplit::lastTopLevelScopeSep( path ); - path = qualified ? path : cut == std::string_view::npos ? std::string_view{} : path.substr( 0, cut ); - const std::size_t sep = namesplit::lastTopLevelScopeSep( path ); - const std::string_view scope = sep == std::string_view::npos ? path : path.substr( sep + 2 ); - agree = agree && !scope.empty() && ( named.empty() || named == scope ); - named = scope; } ); - return agree ? named : std::string_view{}; + cppHeaderScopeMemo.emplace( scopeKey, fold ); + return fold; } // the class a ReturnType record's written type resolves to in its own (the callee's) file — kNoNode for none or several diff --git a/src/resolve.h b/src/resolve.h index 7da94d07f..deb07e921 100644 --- a/src/resolve.h +++ b/src/resolve.h @@ -9826,8 +9826,11 @@ inline void widenToTemplateFamilies( CandidateSink& sink, std::string& ke // same-named definition outside the template. `key` is the caller's reused buffer. // `qualifier` is the call's written one, or the scope a declaration in force names for it (QUAL-NS-CALL-BIND: graph.h, from // CallResultTypes::cppScopeNamedAt). +// Returns true when the answer is a template family's with its primary among the candidates (QUAL-NS-CALL-BIND F4): the +// caller keeps that split whole — the S6-C locality tie-break must not drop the primary, whose nested-class scope text +// (`Traits`) shares less with the caller than an out-of-line specialization's (`ThriftValue::Traits`) does. template< class Admit > -inline void appendCanonicalCandidates( std::vector& cand, std::string& key, std::string_view qualifier, const Reference& r, const CanonicalScopes& scopes, +inline bool appendCanonicalCandidates( std::vector& cand, std::string& key, std::string_view qualifier, const Reference& r, const CanonicalScopes& scopes, Admit&& admit ) { CandidateSink sink { cand, cand.size(), admit }; @@ -9839,16 +9842,18 @@ inline void appendCanonicalCandidates( std::vector& cand, std::string& k } if( cand.size() != sink.before || !appendTemplateFamilyKey( key, qualifier, r.calleeName ) ) { - return; + return false; } key.assign( 1, '\x01' ).append( qualifier ); - const bool existingSpecialization = scopes.byFamily.find( key ) != scopes.byFamily.end() || scopes.chaUp.find( std::string( qualifier ) ) != scopes.chaUp.end(); + bool existingSpecialization = scopes.byFamily.find( key ) != scopes.byFamily.end(); + key.assign( qualifier ); // chaUp is not a transparent map: the reused buffer, not a per-call std::string + existingSpecialization = existingSpecialization || scopes.chaUp.find( key ) != scopes.chaUp.end(); const std::string_view family = existingSpecialization ? qualifier : namesplit::stripTemplateArgs( qualifier ); sink.add( scopes.narrower.methodOnTypeOrBases( family, r, scopes.chaUp, /*skipSelf=*/existingSpecialization, /*unionOnMulti=*/true ) ); const bool primarySupplies = cand.size() != sink.before; if( existingSpecialization && !primarySupplies ) { - return; + return false; } if( !existingSpecialization ) { @@ -9857,9 +9862,10 @@ inline void appendCanonicalCandidates( std::vector& cand, std::string& k if( !primarySupplies && cand.size() < sink.before + 2 ) { cand.resize( sink.before ); // a lone specialization with no visible primary member is no answer (see above) - return; + return false; } widenToTemplateFamilies( sink, key, r, scopes ); + return primarySupplies && cand.size() > sink.before + 1; } } // namespace rw diff --git a/test/qualnscallcheck.sh b/test/qualnscallcheck.sh index 8e7cd85aa..1dbf8d082 100755 --- a/test/qualnscallcheck.sh +++ b/test/qualnscallcheck.sh @@ -30,10 +30,32 @@ # an alias `namespace late = …;` declared AFTER the call → still the split (not yet in force) # an included header's `namespace q { using rw::hashutil::fnv1a64; }` → still the split: no C++ Namespace row is # recorded, so a header row's namespace path is not read (guard: cppScopeNamedAt fileScope) -# mix( v ) — ADL through an argument of class type rw::hashutil::Val → unchanged (ADL is not modelled; the base row) # Klass::make() — a class-static call, scope is a class → Klass's only, unchanged # Holder::make() — a template-qualified call → Holder's, unchanged -# CALL_FNV( s ) — a macro that expands to ::rw::hashutil::fnv1a64 → the macro row, unchanged +# BASE PINS (no change to the new code can turn these red — the name is neither aliased nor using-declared, so +# cppScopeNamedAt returns at its gate; or `b.var != name` already rejects a directive row): mix( v ) by ADL (not +# modelled), CALL_FNV( s ) (the macro row), the using-directive arm. KNOWN-GAP PIN (fails on an IMPROVEMENT, not a +# regression): hashutil::widen with the inline namespace elided (card CPP-INLINE-NS). +# Fix round 1 (review F1-F5), fixture fx2 (src/a.h alpha::util + beta + gamma::h, src/rw.h rw::g, file-scope `using alpha::util::g;` +# and `namespace h = alpha::util;`): +# POSITIVE glob() at global scope: g( x ) under the file-scope using → alpha::util::g (base: a split) +# Value::typed's dependent Traits::fieldType() → the primary AND both out-of-line specializations (F4: the base +# had the primary alone, the first lane head the specializations alone — the S6-C locality tie-break dropped the +# primary, whose nested-class scope text shares less with the caller) +# NEGATIVE F1 rw::S::m / rw::inner::c / third::c2 (a namespace-scope DECLARATION third::g): g( x ) under the file-scope using, +# but C++ lookup may find rw::g / third::g first → the base split (guard: callerScopesMayDeclare) +# F2 gamma::h::f( x ) and T::m's h::k( x ) (a nested class `h`) beside the alias `h` → the base's own scope +# (guard: canonicalCallQualifier's scopeHoldsName check) +# F3 lam(): `auto g = []( int y ) { … }; g( x );` → no row, as base (guard: the caller's declared-local veto) +# w.g( x ) — a member call on a using-declared name → W::g (guard: the isMemberCallRef early return) +# both(): `using alpha::util::g; using beta::g;` → the base split (guard: cppScopeNamedAt's agree) +# Rust b::Bar::make() / a::inner::Bar::make() → each its own impl's, unchanged (the transitiveIncludes language gate on +# the last-segment key: REPORT-ONLY — no Rust scope text holds `::` today, an impl's scope is its last segment, so +# the gate is defensive and this arm cannot go red) +# KNOWN FLOOR viaAlias(): h::f( x ) at global scope under the alias, beside gamma::h::f → gamma's, as base (truth alpha::util::f; +# the one-segment Reference cannot tell `h::f` from `gamma::h::f`, so the base reading stands). The alias's +# !bindsWithoutTarget filter has NO arm: while the C++ family is off a target-less TypeAlias row carries no span, +# so it is never a scope row (ingest_binds.h captureShadowDecl) — the filter is for the family-on path. # The fix keys rows the base left split or bound to the namesake; it never turns a hedged row into a proven one without a # declaration that names the scope (an unknown qualifier keeps the base reading). # Every negative arm counts the rows it read and the batch fails when they read none (a vacuous arm proves nothing). @@ -204,10 +226,154 @@ neg fx "$U" fnv1a64 40 "$AF" # the caller's own scop neg fx src/nsmore.cpp fnv1a64 4 "$AF $HF" split # a header's namespace-scope using (fileScope guard) neg fx "$U" make 17 "$A::Klass::make" qualified # class-static neg fx "$U" make 18 "$A::Holder::make" qualified # template-qualified -neg fx "$U" mix 16 "$A::rw::mix" # ADL is not modelled: the base row -neg fx "$U" CALL_FNV 19 "$A::CALL_FNV" # the macro call itself +neg fx "$U" mix 16 "$A::rw::mix" # BASE PIN: ADL is not modelled +neg fx "$U" CALL_FNV 19 "$A::CALL_FNV" # BASE PIN: the macro call itself if [ "$seen" -eq 13 ]; then ok "the 13 negative arms read $seen rows (premise: none vacuous)"; else no "the 13 negative arms read $seen rows (want 13, one each)"; fi +# ── fix round 1 (review F1-F5): fixture fx2 ── +F2="$TMP/fx2"; mkdir -p "$F2/src" +cat >"$F2/src/a.h" <<'EOF' +#pragma once +namespace alpha::util +{ +inline int g( int x ) { return x + 2; } +inline int f( int x ) { return x + 1; } +inline int k( int x ) { return x + 3; } +} +namespace beta +{ +inline int g( long x ) { return int( x ) + 5; } +} +namespace gamma +{ +namespace h +{ +inline int f( int x ) { return x + 4; } +} +} +EOF +cat >"$F2/src/rw.h" <<'EOF' +#pragma once +namespace rw +{ +inline int g( int x ) { return x + 9; } +} +EOF +cat >"$F2/src/users.cpp" <<'EOF' +#include "a.h" +#include "rw.h" +using alpha::util::g; +namespace h = alpha::util; +namespace rw +{ +struct S +{ + int m( int x ) { return g( x ); } +}; +namespace inner +{ +int c( int x ) { return g( x ); } +} +} +int glob( int x ) { return g( x ); } +int viaGamma( int x ) { return gamma::h::f( x ); } +struct T +{ + struct h { static int k( int x ) { return x; } }; + int m( int x ) { return h::k( x ); } +}; +int lam( int x ) +{ + auto g = []( int y ) { return y; }; + return g( x ); +} +struct W { int g( int x ) { return x; } }; +int viaMember( W& w, int x ) { return w.g( x ); } +namespace third +{ +int g( int x ); +int c2( int x ) { return g( x ); } +} +int viaAlias( int x ) { return h::f( x ); } +EOF +cat >"$F2/src/both.cpp" <<'EOF' +#include "a.h" +using alpha::util::g; +using beta::g; +int both( int x ) { return g( x ); } +EOF +cat >"$F2/src/traits.h" <<'EOF' +#pragma once +enum class FieldType { Bool, Str }; +class Value +{ +public: + template FieldType typed() const { return Traits::fieldType(); } +private: + template class Traits + { + public: + static FieldType fieldType() { return T::fieldType(); } + }; +}; +template <> class Value::Traits +{ +public: + static FieldType fieldType() { return FieldType::Bool; } +}; +template <> class Value::Traits +{ +public: + static FieldType fieldType() { return FieldType::Str; } +}; +EOF +printf '[package]\nname = "fxrs"\nversion = "0.1.0"\n' >"$F2/Cargo.toml" +cat >"$F2/src/lib.rs" <<'EOF' +pub mod a { + pub mod inner { + pub struct Bar; + } +} +pub mod b { + pub struct Bar; + impl Bar { + pub fn make() -> u32 { 2 } + } +} +impl a::inner::Bar { + pub fn make() -> u32 { 1 } +} +pub fn call_b() -> u32 { b::Bar::make() } +pub fn call_inner() -> u32 { a::inner::Bar::make() } +EOF +census "$F2" fx2 || exit 1 +U2=src/users.cpp; AG="src/a.h::alpha::util::g"; BG="src/a.h::beta::g"; RG="src/rw.h::rw::g" +# none NAME FILE CALLER CALLEE LINE — the caller exists (its S row: the premise) and the site has no C row +none(){ local s; s=$( awk -F'\t' -v id="$2::$3" '$1=="S" && index($2,id"#")==1' "$TMP/$1.census" | wc -l | tr -d ' ' ); row "$1" "$2" "$4" "$5" >/dev/null + local n; n=$( cat "$TMP/rows" ) + if [ "$s" = 1 ] && [ "$n" = 0 ]; then ok "$1 $2:$5 $4 -> no row (caller $3 seen)"; else no "$1 $2:$5 $4: want no row beside caller $3, got caller rows=$s call rows=$n"; fi + seen2=$(( seen2 + s )); } +seen2=0 +neg2(){ expect "$@"; seen2=$(( seen2 + $( cat "$TMP/rows" ) )); } + +echo "── round 1 positive: the using-declaration is the first declaration C++ lookup finds; a template family keeps its primary ──" +expect fx2 "$U2" g 16 "$AG" qualified # glob(): global caller, file-scope using +expect fx2 src/traits.h fieldType 6 "src/traits.h::Traits::fieldType src/traits.h::Value::Traits::fieldType src/traits.h::Value::Traits::fieldType" split # F4 + +echo "── round 1 negative: something C++ lookup may find first keeps the base reading ──" +neg2 fx2 "$U2" g 9 "$AG $BG $RG" split # F1 rw::S::m: the class chain ends in namespace rw +neg2 fx2 "$U2" g 13 "$AG $BG $RG" split # F1 rw::inner::c: the namespace chain is not recorded +neg2 fx2 "$U2" g 33 "$AG $BG $RG" split # F1 third::c2 beside the declaration third::g +neg2 fx2 "$U2" f 17 "src/a.h::h::f" qualified # F2 gamma::h::f beside the alias h +neg2 fx2 "$U2" k 21 "$U2::h::k" qualified # F2 a nested class h beside the alias h +none fx2 "$U2" lam g 26 # F3 a local lambda g +neg2 fx2 "$U2" g 29 "$U2::W::g" receiver-rule # a member call on a using-declared name +neg2 fx2 src/both.cpp g 4 "$AG $BG" split # two using-declarations name different scopes +neg2 fx2 src/lib.rs make 15 "src/lib.rs::Bar::make" # REPORT-ONLY Rust: b::Bar's impl +neg2 fx2 src/lib.rs make 16 "src/lib.rs::Bar::make" # REPORT-ONLY Rust: a::inner::Bar's impl +neg2 fx2 "$U2" f 35 "src/a.h::h::f" qualified # KNOWN FLOOR: h::f under the alias beside gamma::h::f +if [ "$seen2" -eq 11 ]; then ok "the 11 round-1 negative arms read $seen2 rows (premise: none vacuous)"; else no "the 11 round-1 negative arms read $seen2 rows (want 11, one each)"; fi + [ "$fail" -eq 0 ] && echo "ALL PASS" || echo "SOME FAILED" exit "$fail" From 243c994c9915936be351a60c2ef1d420c4d3247b Mon Sep 17 00:00:00 2001 From: joyful-ii-V-I <210578314+joyful-ii-V-I@users.noreply.github.com> Date: Thu, 19 Nov 2026 20:53:04 -0500 Subject: [PATCH 18/35] refactor(graph): callerScopesMayDeclare is the class-chain walk plus the namesake check (quality-delta) Co-Authored-By: Claude Opus 5.5 --- src/graph.h | 85 ++++++++++++++++++++++++++++++----------------------- 1 file changed, 49 insertions(+), 36 deletions(-) diff --git a/src/graph.h b/src/graph.h index 061d96db1..9bc2701a5 100644 --- a/src/graph.h +++ b/src/graph.h @@ -10738,58 +10738,71 @@ inline bool scopeHoldsName( const CallScopeLookup& at, std::string_view scope, s return at.canon.byScope.contains( at.key ) || at.classIds.declared.contains( at.key ); } -// C++ unqualified lookup walks outward from the call — the caller's class (with its bases), each enclosing class, then the -// enclosing namespaces — and stops at the first scope that declares the name, so a using-declaration OUTSIDE the caller's -// body is found only when none of them does. True when one does, or MAY: the class chain is read (ClassIdentity), but no -// namespace path is recorded while the C++ family is off (card CPP-HDR-NS-USING), so a caller that may sit in a namespace, -// beside an in-tree namespace-scope namesake the declaration does not name, keeps the base reading (a hedge, never a guess). -// A namesake at global scope competes only with a file-scope declaration (one scope: an overload set C++ resolves). -inline bool callerScopesMayDeclare( const Reference& r, const CallResultTypes::CppNamedScope& named, const CallScopeLookup& at ) +// What the caller's class scopes say about `r.calleeName` (C++ unqualified lookup's first steps): whether the caller's own +// scope, its class or an enclosing class — each with its bases and bodiless declarations — declares it (or the chain is +// deeper than read), and whether the caller may sit in a namespace (a non-empty scope, or a class: a class's namespace is +// not recorded either). +struct CallerClassChain +{ + bool declares = false; + bool mayBeInNamespace = false; +}; +inline CallerClassChain callerClassChain( const Reference& r, const CallScopeLookup& at ) { const Narrower& narrower = at.canon.narrower; const bool hasCaller = r.fromSymbol < at.symbols.size(); const std::string_view own = hasCaller ? std::string_view( at.symbols[ r.fromSymbol ].scope ) : std::string_view{}; - if( !own.empty() && ( narrower.methodOnTypeOrBases( own, r, at.canon.chaUp ) != nullptr || scopeHoldsName( at, own, r.calleeName ) ) ) + const auto declaredIn = [ & ]( std::string_view scope ) { - return true; // the caller's own scope: its class or a base, its namespace - } - const auto ownerOf = [ & ]( NodeId id ) { return id < at.classIds.ownerClass.size() ? at.classIds.ownerClass[ id ] : kNoNode; }; - NodeId cls = hasCaller ? ownerOf( r.fromSymbol ) : kNoNode; - const bool member = cls != kNoNode; - for( int depth = 0; cls != kNoNode; ++depth ) + return narrower.methodOnTypeOrBases( scope, r, at.canon.chaUp ) != nullptr || scopeHoldsName( at, scope, r.calleeName ); + }; + NodeId cls = hasCaller && r.fromSymbol < at.classIds.ownerClass.size() ? at.classIds.ownerClass[ r.fromSymbol ] : kNoNode; + CallerClassChain out { !own.empty() && declaredIn( own ), cls != kNoNode || !own.empty() }; + for( int depth = 0; cls != kNoNode && !out.declares; ++depth ) { - const std::string& name = at.symbols[ cls ].name; - if( depth == 16 || narrower.methodOnTypeOrBases( name, r, at.canon.chaUp ) != nullptr || scopeHoldsName( at, name, r.calleeName ) ) - { - return true; // an enclosing class (or its base) declares it — or the chain is deeper than read - } - cls = cls < at.classIds.enclosingClass.size() ? at.classIds.enclosingClass[ cls ] : kNoNode; + out.declares = depth == 16 || declaredIn( at.symbols[ cls ].name ); + cls = cls < at.classIds.enclosingClass.size() ? at.classIds.enclosingClass[ cls ] : kNoNode; } - const bool mayBeInNamespace = member || !own.empty(); // a class's namespace is not recorded either - const auto namesakes = at.byName.find( r.calleeName ); + return out; +} + +// An in-tree namesake of `r.calleeName` that C++ lookup may find before the declaration `named`: a namespace-scope one when +// the caller may sit in a namespace — no namespace path is recorded while the C++ family is off (card CPP-HDR-NS-USING), so +// which namespaces lie between the caller and the declaration is unknown — or a global one beside a file-scope declaration +// (one scope: an overload set C++ resolves). What the declaration names, a member of a class the chain did not reach and +// another language's namesake never compete. +inline bool namesakeMayCompete( const Reference& r, const CallResultTypes::CppNamedScope& named, const CallScopeLookup& at, bool mayBeInNamespace ) +{ + const auto namesakes = at.byName.find( r.calleeName ); if( namesakes == at.byName.end() ) { return false; } - for( NodeId c : namesakes->second ) + return std::ranges::any_of( namesakes->second, [ & ]( NodeId c ) { - const Symbol& s = at.symbols[ c ]; - if( !langCompatible( s.lang, r.lang ) || s.kind == SymKind::Method || ownerOf( c ) != kNoNode ) + const Symbol& s = at.symbols[ c ]; + const bool member = s.kind == SymKind::Method || ( c < at.classIds.ownerClass.size() && at.classIds.ownerClass[ c ] != kNoNode ); + if( !langCompatible( s.lang, r.lang ) || member ) { - continue; // another language's, or a member of a class the walk above did not reach: unqualified lookup never finds it - } - const std::size_t sep = namesplit::lastTopLevelScopeSep( s.scope ); - const std::string_view last = sep == std::string_view::npos ? std::string_view( s.scope ) : std::string_view( s.scope ).substr( sep + 2 ); - if( !s.scope.empty() && last == named.scope ) - { - continue; // what the declaration names + return false; } - if( s.scope.empty() ? named.fileScope() : mayBeInNamespace ) + const std::size_t sep = namesplit::lastTopLevelScopeSep( s.scope ); + if( s.scope.empty() ) { - return true; + return named.fileScope(); } - } - return false; + return mayBeInNamespace && std::string_view( s.scope ).substr( sep == std::string_view::npos ? 0 : sep + 2 ) != named.scope; + } ); +} + +// C++ unqualified lookup walks outward from the call — the caller's class (with its bases), each enclosing class, then the +// enclosing namespaces — and stops at the first scope that declares the name, so a using-declaration OUTSIDE the caller's +// body is found only when none of them does. True when one does, or MAY (namesakeMayCompete): the base reading then stands, +// a hedge, never a guess. +inline bool callerScopesMayDeclare( const Reference& r, const CallResultTypes::CppNamedScope& named, const CallScopeLookup& at ) +{ + const CallerClassChain chain = callerClassChain( r, at ); + return chain.declares || namesakeMayCompete( r, named, at, chain.mayBeInNamespace ); } // QUAL-NS-CALL-BIND: the qualifier the canonical tier keys call `r` by. A C++ call whose scope a declaration in force names From 6f92324148c6c178f1bb2ca6fa4bb15ece592779 Mon Sep 17 00:00:00 2001 From: joyful-ii-V-I <210578314+joyful-ii-V-I@users.noreply.github.com> Date: Fri, 20 Nov 2026 06:25:05 -0500 Subject: [PATCH 19/35] argtypepick: a const inside a template argument list is the type's, never the parameter's own argTypeShapeOf erased every `const` token, so `Box&` compared equal to `Box` and the pick split innerConstArg's h.hold( b ) onto both Holder::hold overloads. Only a const at template depth 0 is the parameter's top-level const now; an inner one stays in the core. Arm: aritycheck argtype innerConstArg (RED on ee8d1a50e: { buf.cc:21 buf.cc:22 }). CodeRabbit #705. Co-Authored-By: Claude Opus 5.5 --- src/argtypepick.h | 8 +++++++- test/aritycheck.sh | 1 + test/arityfix/argtype/buf.cc | 5 +++++ test/arityfix/argtype/buf.h | 12 ++++++++++++ test/arityfix/argtype/watermark.cc | 7 +++++++ 5 files changed, 32 insertions(+), 1 deletion(-) diff --git a/src/argtypepick.h b/src/argtypepick.h index 03e14ceb0..28dbaba6d 100644 --- a/src/argtypepick.h +++ b/src/argtypepick.h @@ -126,7 +126,13 @@ inline ArgTypeShape argTypeShapeOf( std::vector toks ) } else { - shape.topConst = std::erase( toks, std::string( "const" ) ) != 0; // `const T` / `T const`: one type, either order + // `const T` / `T const`: one type, either order. Only a const outside every template argument list is the + // parameter's own; `Box` keeps its inner const in the core, so it never compares equal to `Box`. + int depth = 0; + shape.topConst = std::erase_if( toks, [ &depth ]( const std::string& t ) { + depth += t == "<" ? 1 : t == ">" ? -1 : 0; + return depth == 0 && t == "const"; + } ) != 0; } if( toks.empty() || std::ranges::find( toks, std::string( "&" ) ) != toks.end() ) { diff --git a/test/aritycheck.sh b/test/aritycheck.sh index a59183e06..fac7c0f89 100755 --- a/test/aritycheck.sh +++ b/test/aritycheck.sh @@ -228,6 +228,7 @@ argtype ptrArg "buf.cc:12 buf.cc:13" split "[N] an Instance* argtype constArg "buf.cc:14 buf.cc:15" split "[N] a const Instance& cannot bind cref( Instance& )" argtype Watermark::shadowed "buf.cc:4 buf.cc:5" split "[N] the View parameter is hidden by a block-scope Instance& of the same name" argtype farCaller "buf.cc:4 buf.cc:5" split "[N] far::View spelled View in another namespace is not lib::View" +argtype innerConstArg "buf.cc:22" bound "[P] Box& → Holder::hold( Box& ) alone: a const inside <...> is the type's (CR #705; split on ee8d1a50e)" # receiver guards (regression arms, green on main too): a qualified call naming a class outside the tree (ext::Base::wrap) and a # NAME-ONLY call through a field of an unindexed type (real_.relay) keep exactly today's edge onto the namesake sibling — the pick # never runs on a tier no lookup tied to the call (the envoy hand check found both shapes: context.h Buffer::set, FailingSignUtility) diff --git a/test/arityfix/argtype/buf.cc b/test/arityfix/argtype/buf.cc index e90ebcc54..5070e5189 100644 --- a/test/arityfix/argtype/buf.cc +++ b/test/arityfix/argtype/buf.cc @@ -16,3 +16,8 @@ void Owned::cref( Other o ) { (void)o; } void Owned::pair( Instance& a, View b ) { (void)a; (void)b; } void Owned::pair( View a, Instance& b ) { (void)a; (void)b; } } +namespace lib +{ +void Holder::hold( Box b ) { (void)b; } +void Holder::hold( Box& b ) { (void)b; } +} diff --git a/test/arityfix/argtype/buf.h b/test/arityfix/argtype/buf.h index 5658aad3a..0185a2ab1 100644 --- a/test/arityfix/argtype/buf.h +++ b/test/arityfix/argtype/buf.h @@ -27,3 +27,15 @@ class Owned void pair( View a, Instance& b ); }; } + +// CR #705 (argtypepick): a const INSIDE a template argument list is part of the type, never the parameter's own const +namespace lib +{ +template class Box { public: T value; }; +class Holder +{ +public: + void hold( Box b ); + void hold( Box& b ); +}; +} diff --git a/test/arityfix/argtype/watermark.cc b/test/arityfix/argtype/watermark.cc index b7277bd48..583613e77 100644 --- a/test/arityfix/argtype/watermark.cc +++ b/test/arityfix/argtype/watermark.cc @@ -70,3 +70,10 @@ class Relay ext::Real real_; }; } + +namespace lib +{ +// POSITIVE: Box& is exactly hold( Box& )'s type; Box by value is another type (the inner const is +// the type's, not the parameter's) +void innerConstArg( Holder& h, Box& b ) { h.hold( b ); } +} From e8f95aa4de876bacd1291c558c1bfe6aeccb37bb Mon Sep 17 00:00:00 2001 From: joyful-ii-V-I <210578314+joyful-ii-V-I@users.noreply.github.com> Date: Fri, 20 Nov 2026 06:25:05 -0500 Subject: [PATCH 20/35] receiverevidence: an ambiguous Go declaration is never replaced by a declaration-less witness goDeclLessType accepted a methods-only directory's witness when the import path admitted two directories that DECLARE the type (ambiguous): the final check looked for a declaration in the witness's own directory only. Any kept directory that declares the name now decides. Arm: receiverevidencecheck go8 (RED on ee8d1a50e: lib/x/pb IsSet proven). CodeRabbit #705. Co-Authored-By: Claude Opus 5.5 --- src/receiverevidence.h | 6 +++--- test/receiverevidencecheck.sh | 3 +++ test/receiverevidencefix/callresult.txt | 25 +++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/src/receiverevidence.h b/src/receiverevidence.h index abfdb9ec7..5ec2cb4b8 100644 --- a/src/receiverevidence.h +++ b/src/receiverevidence.h @@ -981,9 +981,9 @@ struct CallResultTypes { return kNoNode; } - const std::string_view dir = dirOf( ing.symbols[ witness ].fileId ); - NodeId declared = kNoNode; - return classesNamed( cls, CallResultFamily::Go, [ & ]( NodeId c ) { return dirOf( ing.symbols[ c ].fileId ) == dir; }, declared ) == 0 ? witness : kNoNode; + // any kept directory that DECLARES the name decides (an ambiguous declaration stays ambiguous), not just the witness's + NodeId declared = kNoNode; + return classesNamed( cls, CallResultFamily::Go, [ & ]( NodeId c ) { return keep( ing.symbols[ c ].fileId ); }, declared ) == 0 ? witness : kNoNode; } // the build, after every noteClass: `method` has the Go receiver type `recvType` — kept once per package directory (binding // order), and only where that directory declares no class of the name, so a tree that holds its declarations keeps no row diff --git a/test/receiverevidencecheck.sh b/test/receiverevidencecheck.sh index c923cc5d8..6ee526459 100755 --- a/test/receiverevidencecheck.sh +++ b/test/receiverevidencecheck.sh @@ -1614,6 +1614,9 @@ proven $CR/go6 callees src/app/app.go:NearPosition "fn FromContext src/pb/ten notproven $CR/go6 callees src/app/app.go:NearPosition "String src/pb/tenant.go:6" "String src/pb2/tenant.go:6" # [N] the second result is a bool, never a GenID proven $CR/go6 callees src/app/app.go:NearLocalDecl "fn Make src/decl/tenant.go:6" # premise notproven $CR/go6 callees src/app/app.go:NearLocalDecl "IsSet src/pb/tenant.go:5" "IsSet src/pb2/tenant.go:5" # [N] decl's GenID never names another package's +# go8 (CR #705): the import path lib/x/pb admits pb/, x/pb/ and lib/x/pb/; the first two DECLARE GenID (ambiguous), the third +# holds only methods. The ambiguous declaration decides: no declaration-less witness stands in (ee8d1a50e proved lib/x/pb's IsSet) +notproven $CR/go8 callees app/app.go:UseAmbiguous "IsSet lib/x/pb/t.go:5" "IsSet pb/t.go:5" "IsSet x/pb/t.go:5" # [N] # [N] an AMBIGUOUS import: go7 has no go.mod and two directories end in `gen`, each with its own F, G and result types. The # call binds no one F, so nothing is typed — a declared result (RA / RB) and a declaration-less one (Less) alike. for f in AmbF AmbG AmbParam; do diff --git a/test/receiverevidencefix/callresult.txt b/test/receiverevidencefix/callresult.txt index fb5dfce8c..4c38653a5 100644 --- a/test/receiverevidencefix/callresult.txt +++ b/test/receiverevidencefix/callresult.txt @@ -2768,3 +2768,28 @@ func AmbG() int { func AmbParam(p gen.Less) int { return p.M() } +@@@ go8/pb/t.go +package pb + +type GenID struct{ v int } + +func (t GenID) IsSet() bool { return t.v != 0 } +@@@ go8/x/pb/t.go +package pb + +type GenID struct{ v int } + +func (t GenID) IsSet() bool { return t.v == 1 } +@@@ go8/lib/x/pb/t.go +package pb + +// GenID is declared in a generated file the tree leaves out; only its methods are here + +func (t GenID) IsSet() bool { return false } +@@@ go8/app/app.go +package app + +import "lib/x/pb" + +// the import path admits three directories: pb/ and x/pb/ DECLARE GenID (ambiguous), lib/x/pb/ only has its methods +func UseAmbiguous(id pb.GenID) bool { return id.IsSet() } From d0e613533d134f037b721ba03e67640e77b869e1 Mon Sep 17 00:00:00 2001 From: joyful-ii-V-I <210578314+joyful-ii-V-I@users.noreply.github.com> Date: Fri, 20 Nov 2026 06:25:27 -0500 Subject: [PATCH 21/35] graph: a recursive call's own proven target is kept as a proven site noteProvenSite skipped a target equal to the caller (no graph edge), so a proven recursive call left no ProvenSite and its name test counted it for every namesake: Node::walk's walk( d - 1 ) was listed under Leaf::walk's row (sites_at="4 7"). The self target is noted like any other; rivalledProvenSites still keeps it only when the caller has an edge to another definition. Arm: callerscheck SP5 (RED on ee8d1a50e: sites_at="4 7"). CodeRabbit #705. Co-Authored-By: Claude Opus 5.5 --- src/graph.h | 12 +++++------- test/callerscheck.sh | 10 ++++++++++ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/graph.h b/src/graph.h index 9bc2701a5..07e6595d2 100644 --- a/src/graph.h +++ b/src/graph.h @@ -1369,8 +1369,9 @@ inline void keepRustTraitImplementors( ChaConeMemo& chaCones, const IngestResult // PROVEN-SITE-KEEPS-NAMESAKES: a PROVEN call site's targets, appended to Graph::provenSites in reference order, while the name has // more than one definition (`namesakes`) — a name with one cannot be misplaced. rivalledProvenSites prunes the list once every -// edge exists. A via=name site appends nothing: it counts for every row of its name, as before. -inline void noteProvenSite( std::vector& out, bool proven, std::size_t namesakes, std::uint32_t ref, NodeId from, std::span tier ) +// edge exists. A via=name site appends nothing: it counts for every row of its name, as before. A recursive call's own target is +// kept too (it is no graph edge): when `A::f` also calls `B::f`, B::f's site test must still read its `f()` self-call as A::f's. +inline void noteProvenSite( std::vector& out, bool proven, std::size_t namesakes, std::uint32_t ref, std::span tier ) { if( !proven || namesakes < 2 ) { @@ -1378,10 +1379,7 @@ inline void noteProvenSite( std::vector& out, bool proven, std::size } for( const NodeId to : tier ) { - if( to != from ) - { - out.push_back( { ref, to } ); - } + out.push_back( { ref, to } ); } } @@ -14433,7 +14431,7 @@ inline Graph buildGraph( const IngestResult& ing, const ScipOverlay* scip = null } } } - noteProvenSite( g.provenSites, !nameOnly, it == byName.end() ? 0u : it->second.size(), std::uint32_t( siteIndex ), r.fromSymbol, tier ); + noteProvenSite( g.provenSites, !nameOnly, it == byName.end() ? 0u : it->second.size(), std::uint32_t( siteIndex ), tier ); if( r.forwarded ) { g.keptForwards.push_back( std::uint32_t( siteIndex ) ); // ascending: the loop walks the references in order diff --git a/test/callerscheck.sh b/test/callerscheck.sh index 5db435a6f..0f61a9b64 100755 --- a/test/callerscheck.sh +++ b/test/callerscheck.sh @@ -404,5 +404,15 @@ SP_AON="$( row "$SP_A" Mgr::onClose )" { ! printf '%s' "$SP_AON" | grep -q 'via=' && sat "$SP_AON" | tr ' ' '\n' | grep -qx '10' && sat "$SP_AON" | tr ' ' '\n' | grep -qx '16'; } \ && ok "SP4: NEGATIVE: the proven Action::closeSocket row keeps both proven lines (10, 16)" \ || no "SP4: onClose row under Action::closeSocket: $SP_AON" +# SP5 (CR #705): a RECURSIVE call is proven to the caller itself (no graph edge). When that caller also calls a namesake, the +# namesake's row must not list the self-call's line: Node::walk calls walk(d - 1) (line 4, itself) and l.walk(d) (line 7, Leaf). +# RED on ee8d1a50e: sites_at="4 7". +mkdir -p "$SA/sp/rec" +printf '#pragma once\nstruct Leaf {\n void walk(int d) {}\n};\nstruct Node {\n void walk(int d);\n};\n' > "$SA/sp/rec/tree.h" +printf '#include "sp/rec/tree.h"\nvoid Node::walk(int d) {\n if (d) {\n walk(d - 1);\n }\n Leaf l;\n l.walk(d);\n}\n' > "$SA/sp/rec/tree.cc" +SP_R="$( row "$( sa --callers=sp/rec/tree.h:Leaf::walk )" Node::walk )" +{ printf '%s' "$SP_R" | grep -q ' p="sp/rec/tree.cc:2"' && [ "$( sat "$SP_R" )" = "7" ]; } \ + && ok "SP5: the Leaf::walk row lists l.walk(d) only (line 7), never Node::walk's own recursive walk(d - 1)" \ + || no "SP5: Node::walk row under Leaf::walk: $SP_R" [ "$fail" = 0 ] && echo "ALL PASS" || echo "FAILURES ABOVE" exit $fail From ef8f5f306e383e1ce1b654d0dbd0a1f0b24f9fc7 Mon Sep 17 00:00:00 2001 From: joyful-ii-V-I <210578314+joyful-ii-V-I@users.noreply.github.com> Date: Fri, 20 Nov 2026 06:25:27 -0500 Subject: [PATCH 22/35] graph: rivalledProvenSites never std::moves a group onto itself When every site so far was kept (kept == at), std::move's destination started inside its source range, which the algorithm does not allow. The group is already in place then; skip the move. No output change (ProvenSite is trivially copyable); hygiene from CodeRabbit #705. Co-Authored-By: Claude Opus 5.5 --- src/graph.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/graph.h b/src/graph.h index 07e6595d2..7089f1da7 100644 --- a/src/graph.h +++ b/src/graph.h @@ -1408,7 +1408,10 @@ inline void rivalledProvenSites( const IngestResult& ing, const Graph& g, std::v if( rival ) { std::sort( sites.begin() + std::ptrdiff_t( at ), sites.begin() + std::ptrdiff_t( end ) ); - std::move( sites.begin() + std::ptrdiff_t( at ), sites.begin() + std::ptrdiff_t( end ), sites.begin() + std::ptrdiff_t( kept ) ); + if( kept != at ) // std::move's destination may not start inside its source range + { + std::move( sites.begin() + std::ptrdiff_t( at ), sites.begin() + std::ptrdiff_t( end ), sites.begin() + std::ptrdiff_t( kept ) ); + } kept += end - at; } at = end; From 545a9c08f11ced7b1a9913427f3eedbf6c2277a9 Mon Sep 17 00:00:00 2001 From: joyful-ii-V-I <210578314+joyful-ii-V-I@users.noreply.github.com> Date: Fri, 20 Nov 2026 06:34:54 -0500 Subject: [PATCH 23/35] graph: a self-only proven tier notes its site before the recursion exit c8de3c1aa kept the caller in a noted tier, but a call whose tier holds ONLY the caller leaves the resolve loop at the `nReal == 0` recursion exit, before noteProvenSite runs, so SP5 stayed red (Node::walk's walk( d - 1 ) still listed under Leaf::walk, sites_at="4 7"). The exit notes the proven site first; the nReal count is one count_if (buildGraph stays shorter than on main). Arm: callerscheck SP5 (RED on ee8d1a50e and on c8de3c1aa; green here). Co-Authored-By: Claude Opus 5.5 --- src/graph.h | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/graph.h b/src/graph.h index 7089f1da7..54e032962 100644 --- a/src/graph.h +++ b/src/graph.h @@ -14322,16 +14322,11 @@ inline Graph buildGraph( const IngestResult& ing, const ScipOverlay* scip = null // drop self-loops BEFORE the split so the confidence mass is conserved over real targets. // A markdown link whose target is the section that contains the link is dropped here on purpose. - std::size_t nReal = 0; - for( NodeId c : tier ) - { - if( c != r.fromSymbol ) - { - ++nReal; - } - } + const std::size_t nReal = std::size_t( std::ranges::count_if( tier, [ & ]( NodeId c ) { return c != r.fromSymbol; } ) ); if( nReal == 0 ) { + // a recursion, not an edge — but a PROVEN one is still a site of the caller alone, never of its namesakes + noteProvenSite( g.provenSites, !nameOnly, it == byName.end() ? 0u : it->second.size(), std::uint32_t( siteIndex ), tier ); disposition = CallDisposition::Self; // the tier held only the caller itself: a recursion, not an edge continue; } From 0b919705600ea3cf545b6219879933e25bee3662 Mon Sep 17 00:00:00 2001 From: joyful-ii-V-I <210578314+joyful-ii-V-I@users.noreply.github.com> Date: Fri, 20 Nov 2026 07:06:42 -0500 Subject: [PATCH 24/35] argtypepick: the top-level const eraser is its own helper (eraseTopLevelConst) qd gated argTypeShapeOf at complexity 19 (was 11, bar 15) after the template-depth lambda landed inline. The depth walk moves to eraseTopLevelConst; same tokens erased, same answer. Co-Authored-By: Claude Opus 5.5 --- src/argtypepick.h | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/argtypepick.h b/src/argtypepick.h index 28dbaba6d..73390528c 100644 --- a/src/argtypepick.h +++ b/src/argtypepick.h @@ -96,6 +96,17 @@ struct ArgTypeShape bool known = false; }; +// Erase the parameter's OWN const tokens: only a const outside every template argument list is the parameter's; +// `Box` keeps its inner const in the core, so it never compares equal to `Box` (a `>>` is two `>` tokens). +inline bool eraseTopLevelConst( std::vector& toks ) +{ + int depth = 0; + return std::erase_if( toks, [ &depth ]( const std::string& t ) { + depth += t == "<" ? 1 : t == ">" ? -1 : 0; + return depth == 0 && t == "const"; + } ) != 0; +} + // `toks`: one parameter's type tokens (editCheckTypeTokens: the declarator name already dropped) inline ArgTypeShape argTypeShapeOf( std::vector toks ) { @@ -126,13 +137,7 @@ inline ArgTypeShape argTypeShapeOf( std::vector toks ) } else { - // `const T` / `T const`: one type, either order. Only a const outside every template argument list is the - // parameter's own; `Box` keeps its inner const in the core, so it never compares equal to `Box`. - int depth = 0; - shape.topConst = std::erase_if( toks, [ &depth ]( const std::string& t ) { - depth += t == "<" ? 1 : t == ">" ? -1 : 0; - return depth == 0 && t == "const"; - } ) != 0; + shape.topConst = eraseTopLevelConst( toks ); // `const T` / `T const`: one type, either order } if( toks.empty() || std::ranges::find( toks, std::string( "&" ) ) != toks.end() ) { From 932c401c062efa537d8383e57a9be6cecab0ae1d Mon Sep 17 00:00:00 2001 From: joyful-ii-V-I <210578314+joyful-ii-V-I@users.noreply.github.com> Date: Fri, 20 Nov 2026 07:08:11 -0500 Subject: [PATCH 25/35] docs(changelog): the proven-site and overload-split notes say what CodeRabbit #705 refined A proven recursion counts for its caller only (163 cockroach startExec rows); a const inside a template argument is the type's. Co-Authored-By: Claude Opus 5.5 --- changelog.d/overload-split.md | 2 +- changelog.d/proven-site-keeps-namesakes.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/changelog.d/overload-split.md b/changelog.d/overload-split.md index c07303865..04d8e4eee 100644 --- a/changelog.d/overload-split.md +++ b/changelog.d/overload-split.md @@ -1,5 +1,5 @@ ### Fixed — a C++ call whose argument types pick one overload, and a Go call through a generic field, no longer split -A C++ call to one class's same-arity overloads was split onto every overload (`prov="split"`), even when the arguments' declared types pick one of them. Now, when every argument is one of the calling function's own parameters and exactly one non-template overload takes each argument as its exact declared type, that overload is the edge, bound alone. Otherwise the split stays: no overload takes every argument by identity (one reachable only by a conversion), or a guard stops the pick: a template overload, a const or pointer mismatch, a shadowed parameter, a different namespace, a receiver no lookup proved, or a qualifier naming another class. On envoy, `WatermarkBuffer::prepend( absl::string_view data )` now calls only `OwnedImpl::prepend( absl::string_view )`. 41 envoy call sites move from split to one edge. +A C++ call to one class's same-arity overloads was split onto every overload (`prov="split"`), even when the arguments' declared types pick one of them. Now, when every argument is one of the calling function's own parameters and exactly one non-template overload takes each argument as its exact declared type, that overload is the edge, bound alone. Otherwise the split stays: no overload takes every argument by identity (one reachable only by a conversion), or a guard stops the pick: a template overload, a const or pointer mismatch (a `const` inside a template argument, `Box`, belongs to the type), a shadowed parameter, a different namespace, a receiver no lookup proved, or a qualifier naming another class. On envoy, `WatermarkBuffer::prepend( absl::string_view data )` now calls only `OwnedImpl::prepend( absl::string_view )`. 41 envoy call sites move from split to one edge. A Go call through a struct field whose type is a qualified generic instantiation (`suppressedModules addrs.Set[addrs.Module]`) now reaches that package's type (`addrs.Set.Add`), not every type named `Set`. Other qualified field types also bind to their own package's type when it defines the method. Interfaces and embedded types keep their previous answer. New gate arms in `test/aritycheck.sh` (section 3d) and `test/receiverevidencecheck.sh` (G). diff --git a/changelog.d/proven-site-keeps-namesakes.md b/changelog.d/proven-site-keeps-namesakes.md index f15896d33..8f545c138 100644 --- a/changelog.d/proven-site-keeps-namesakes.md +++ b/changelog.d/proven-site-keeps-namesakes.md @@ -1,5 +1,5 @@ ### Fixed — a call a rule proved is no longer listed as a call site of a same-named method -A caller row's `sites_at=` (the callers verb, `--safe-delete`, the `--for` callers hop and its site pick, `--edit-check`'s sites) matched call sites by the callee's leaf name, so a caller with edges to two definitions of one name listed every call of that name under both rows. envoy's `FilterManagerImpl::onConnectionClose` showed its proven `close_action.closeSocket()` lines (145, 154) under the by-name `ConnectionImpl::closeSocket` and `RawBufferSocket::closeSocket` rows, which read as a proven site keeping by-name namesake edges; only line 153 (`latched_close_action_->closeSocket()`, through a `std::optional`) is matched by name. A call a rule proved now counts as a site of its own targets only, and a file- or scope-qualified `--uses` drops it the same way. A call matched by name keeps the name test, and a caller with no proven call of the name keeps its row and sites. The `sites_at=` legend reading says so in the same number of bytes. +A caller row's `sites_at=` (the callers verb, `--safe-delete`, the `--for` callers hop and its site pick, `--edit-check`'s sites) matched call sites by the callee's leaf name, so a caller with edges to two definitions of one name listed every call of that name under both rows. envoy's `FilterManagerImpl::onConnectionClose` showed its proven `close_action.closeSocket()` lines (145, 154) under the by-name `ConnectionImpl::closeSocket` and `RawBufferSocket::closeSocket` rows, which read as a proven site keeping by-name namesake edges; only line 153 (`latched_close_action_->closeSocket()`, through a `std::optional`) is matched by name. A call a rule proved now counts as a site of its own targets only, and a file- or scope-qualified `--uses` drops it the same way. A call matched by name keeps the name test, and a caller with no proven call of the name keeps its row and sites. A proven recursive call is a site of its own caller only: cockroach's free function `startExec` no longer lists its `startExec(params, child)` recursion (`pkg/sql/plan.go:557`) under the 163 `startExec` method rows it also calls through `plan.startExec(params)`. The `sites_at=` legend reading says so in the same number of bytes. Versions: the session legend dictionary moves to `dictv=7138c98f32671fec entries=1167` (the `sites_at=` reading); docs/COMMANDS.md and the 2026-11-19 showcase capture record the new pair. From d3a73cd6ecd4ca6fbd16e4a246f4b7f3745c44ba Mon Sep 17 00:00:00 2001 From: joyful-ii-V-I <210578314+joyful-ii-V-I@users.noreply.github.com> Date: Fri, 20 Nov 2026 18:08:13 -0500 Subject: [PATCH 26/35] kParserVer 335 is train 1118a's number for qual-ns-call-bind, no longer a placeholder Co-Authored-By: Claude Opus 5.5 --- src/ingest_cache.h | 2 +- src/quality.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ingest_cache.h b/src/ingest_cache.h index 4a548bf41..e3b30441e 100644 --- a/src/ingest_cache.h +++ b/src/ingest_cache.h @@ -383,7 +383,7 @@ constexpr std::uint32_t kCacheVersion = 53; // 53: lane rust-self-chai // a target FORMAT change → old caches must be rejected. // 4: Include gained a `bool isAngle` (quote/angle) field constexpr std::uint32_t kParserVer = 335; // bump on any grammar/.scm/extraction change - // 335 = lane qual-ns-call-bind (placeholder above the 333/334 pair; the train renumbers): C++ / ObjC + // 335 = 2026-11-20 (train 1118a, lane qual-ns-call-bind; above train 1117d2's 333/334, rich 336): C++ / ObjC // using-declarations and namespace aliases are recorded while the call-result family is off // (ingest_binds.h kCppCallScopeFacts), read by receiverevidence.h CallResultTypes::cppScopeNamedAt. // 333 = 2026-11-18 (train 1117d2, stacked on train 1117d1's 331/332; above the members' placeholders): rich file tag 334. diff --git a/src/quality.h b/src/quality.h index f783c96f0..d05d178a7 100644 --- a/src/quality.h +++ b/src/quality.h @@ -3146,7 +3146,7 @@ inline std::string cacheRootKeyHex( const std::string& root ) // that broke that fails the build on the undeclared name rather than passing. constexpr std::uint32_t kIngestCacheVersionMirror = 53; // MUST equal ingest.cpp's kCacheVersion (gated); 53 = lane rust-self-chain placeholder (LocalBindKind RecvCall), 52 = lane failure-default (construct-hit failure-default tag), 51 = lane qd-constructs (FILE record construct-hit family), 50 = lane clones-persist (Function/Method def record clone key), 49 = lane warm-direct (FILE record head family counts), 48 = train 42b (alias-import LocalBindKind ReExport; its placeholder 47), 46 = train 40 (js-def-naming JsObjectLiteral; its placeholder 45), 44 = train 37b (rust-degraded FileHealth::useBoundsBlanked; its placeholder 42), 43 = train 36 (#155 trailingLambda ref byte; above main 40, #438's placeholder 41, rust-degraded's 42), 40 = train 34 (fc3-js-rebind JsRebind; above main 39), 39 = train 33 (above main 36 and l6-iface 38), 38 = train 32 lane l6-iface fix round 1: LocalBindKind ImplBlock (train renumbers), 37 = train 32 lane l6-iface: LocalBindKind DispatchType (train renumbers), 36 = train 30 (above call-result-typing's and fcall-forward's 33, name-template-dispatch's 35, main's 34), 34 = train 29 (above lane arity-min's and call-result-typing's 33), 33 = train 29 lane arity-min: def record paramsMin (the train renumbers), 33 = lane call-result-typing: RawBind resultIndex + unwrapDepth, 33 = lane fcall-forward: ref `forwarded` byte, 35 = lane name-template-dispatch: RefRole Pattern 11, 32 = train 28: RefRole Subscript 9 + Inert 10, 31 = train 27: lego-transitive's inherit-ref baseBind (the lane's 30), 29 = FE-B ref memberPath/memberCtor + 4 bind kinds, 28 = FE-A ref memberCall/memberRoot, 27 = corrected fnScope values, 26 = function-local def scope span (25 = #157 + #150) constexpr std::uint32_t kIngestParserVerMirror = 335; // MUST equal ingest.cpp's kParserVer (gated) - // 335 = lane qual-ns-call-bind placeholder (C++ using-declarations + namespace aliases recorded) + // 335 = 2026-11-20 (train 1118a, lane qual-ns-call-bind, rich 336): C++ using-declarations + namespace aliases recorded // 333 = 2026-11-18 (train 1117d2 on train 1117d1, rich 334; members below, each was a placeholder) // std-namesake (placeholder 317): a Rust binding written as a standard type keeps its spine on the tombstone // rust-self-chain (placeholder 319; kCacheVersion 53): Rust RecvCall records for member calls on a call's result, async ReturnType bit From 423275977dabc395878096a3271edf5cbf773f4e Mon Sep 17 00:00:00 2001 From: joyful-ii-V-I <210578314+joyful-ii-V-I@users.noreply.github.com> Date: Fri, 20 Nov 2026 18:37:14 -0500 Subject: [PATCH 27/35] Re-record the showcase once after rebasing train 1118a onto main f79a94e21 (#706) Recorded from the composed build (built_from=d3a73cd6e) on a clean tree: - docs/captures/COMMANDS_showcase_2026-11-20.md: showcase re-recorded once (266 commands, 1323 s); the rankGraphTeleport seed now reads src/graph.h:14921 (the members moved graph.h lines). - docs/COMMANDS.md: rebuilt from the 2026-11-20 capture. - test/qschemetripcheck.sh: RE-PIN LOG entry; the re-derived hash equals qual-ns-call-bind's lane pin. gatecount, LIMITS.md, capsweep, the printf parity golden and the legend pair are unchanged (their --check passes). Co-Authored-By: Claude Opus 5.5 --- docs/COMMANDS.md | 704 +++--- docs/captures/COMMANDS_showcase_2026-11-20.md | 2210 ++++++++--------- test/qschemetripcheck.sh | 4 + 3 files changed, 1404 insertions(+), 1514 deletions(-) diff --git a/docs/COMMANDS.md b/docs/COMMANDS.md index e685c74fa..d176463ea 100644 --- a/docs/COMMANDS.md +++ b/docs/COMMANDS.md @@ -72,10 +72,10 @@ $ ./build/ripwire . --top-k=5 - - + + - + @@ -108,10 +108,10 @@ $ ./build/ripwire . --top-k=5 --no-inventory - - + + - + @@ -142,10 +142,10 @@ $ ./build/ripwire . --max-tokens=1500 - - + + - + @@ -172,7 +172,7 @@ _GATE form: exit 3 if the map's own est_tokens exceeds the budget (over-budget f ``` $ ./build/ripwire . --token-budget=100 - + ``` **Shaped by:** `--top-k`, `--max-tokens`, `--for`, `--sections`, `--recall`, `--handoff`, `--pr-context`, `--from-trace` @@ -225,11 +225,11 @@ _Name-shaped query: the router picks name-exact BM25 (header says which/why)._ ``` $ ./build/ripwire . --for="rankGraphTeleport" - + - + PageRank with an explicit teleport / personalization vector p (Σp = 1). The prior is name-quality-biased through biasPrior() so all rank modes share one weighting seam; the transition matrix (edgesinline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>&am … [line truncated: 31 more bytes on this line] #### The convergence disclosure contract ### Wave-2 adversarial verification (2026-08-19) — six probes against `aa97c9e` @@ -262,10 +262,10 @@ _Restore the / sections the --for bundle collapses to a counted s ``` $ ./build/ripwire . --for="tree-sitter parse of a source file" --sections=lego,compose - + - + inline bool topLevelEvidence( std::string_view source, const TSLanguage* language, const Predicate& predicate ) The crawl's per-file byte ceiling. A text file larger than this is skipped: at this size it is o…constexpr std::size_t kDefaultMaxFileBytes = 4u * 1024u * 1024u @@ -289,11 +289,11 @@ _T3 opt-out: the signatures-only lens (no auto bodies, no bundle="auto" attribut ``` $ ./build/ripwire . --for="rankGraphTeleport" --signatures-only - + - + PageRank with an explicit teleport / personalization vector p (Σp = 1). The prior is name-quality-biased through biasPrior() so all rank modes share one weighting seam; the transition matrix (edgesinline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>&am … [line truncated: 31 more bytes on this line] #### The convergence disclosure contract ### Wave-2 adversarial verification (2026-08-19) — six probes against `aa97c9e` @@ -324,10 +324,10 @@ _Opt OUT of compact conceptual serving: restore the rank-first auto wal ``` $ ./build/ripwire . --for="tree-sitter parse of a source file" --auto-bodies - + - + inline bool topLevelEvidence( std::string_view source, const TSLanguage* language, const Predicate& predicate ) The crawl's per-file byte ceiling. A text file larger than this is skipped: at this size it is o…constexpr std::size_t kDefaultMaxFileBytes = 4u * 1024u * 1024u @@ -356,13 +356,13 @@ _Same query with routing forced OFF (plain subtoken+body BM25) — contrast with ``` $ ./build/ripwire . --for="rankGraphTeleport" --no-route - + - + PageRank with an explicit teleport / personalization vector p (Σp = 1). The prior is name-quali…inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>& p, float alpha = 0.85f ) - + uniform-teleport PageRank (the default). A kRankFlagNotNamed unit (model.h) has no edge and a 0 …inline RankedGraph rankGraph( const Graph& g, float alpha = 0.85f ) The default map's PageRank — uniform teleport, the one rank that is a function of the Graph al…inline std::optional<RankedGraph>& storedDefaultRank() noexcept @@ -388,10 +388,10 @@ _Cut the result at the relevance cliff (Adaptive-k) — on a flat ranking nothin ``` $ ./build/ripwire . --for="tree-sitter parse of a source file" --adaptive - + - + inline bool topLevelEvidence( std::string_view source, const TSLanguage* language, const Predicate& predicate ) The crawl's per-file byte ceiling. A text file larger than this is skipped: at this size it is o…constexpr std::size_t kDefaultMaxFileBytes = 4u * 1024u * 1024u @@ -419,7 +419,7 @@ _Same task with the anchor disabled — the contrast the flag exists for._ ``` $ ./build/ripwire . --for="why does src/lexical.h chooseForRanker pick name-exact BM25" --no-mention-boost - @@ -449,14 +449,14 @@ _The same task with doc-mention surfacing OFF — the contrast the flag exists f ``` $ ./build/ripwire . --for="quality delta acks ledger rubber stamp" --no-doc-mention - + L2 stale acks in the range form. A changed-files answer holds no whole target tree to check the …std::vector<rw::quality::StaleAck> refPairStaleAcks( const gtl::btree_map<std::string, rw::quality::AckRecord>& acks, const RefPairDelta& refs ) inline QualityDeltaOutcome computeQualityDelta( const std::string& root ) -inline std::string staleByKindValue( const std::vector<StaleAck>& staleAcks ) +inline std::string staleByKindValue( const std::vector<StaleAck>& staleAcks ) inline constexpr const char* kAtStampLegend = "<!-- at= is the git commit these numbers were computed at ... [22 more line(s); run it to see the whole thing] ``` @@ -479,7 +479,7 @@ _Interface -> implementors view: every existing impl of the named interface; the $ ./build/ripwire . --lego=Vehicle - + @@ -510,7 +510,7 @@ _The repo's best-in-class instance to imitate before writing new code (picked by $ ./build/ripwire . --exemplar="format byte sizes for humans" - + @@ -713,7 +708,7 @@ $ ./build/ripwire . --order=stable --top-k=5 - + @@ -744,10 +739,10 @@ $ ./build/ripwire . --no-stable --top-k=3 - - + + - + @@ -778,7 +773,7 @@ $ ./build/ripwire . --around=rankGraphTeleport - + @@ -828,18 +823,18 @@ _What SYM calls (1-hop out-edges)._ ``` $ ./build/ripwire . --callees=rankGraphTeleport - - + + - - - - - - + + + + + + ``` @@ -863,10 +858,10 @@ _The resolvable use-sites (call/read/write/import/extends) with file:line; count ``` $ ./build/ripwire . --uses=rankGraphTeleport - + - - + + @@ -897,10 +892,10 @@ _Composable node-set query: functions within 2 caller-hops of rankGraphTeleport. ``` $ ./build/ripwire . --graph-query='and(callers(name("rankGraphTeleport"),2),kind(all,fn))' - + - - + + @@ -934,19 +929,19 @@ _Names referenced but never defined in-corpus (stdlib/third-party surface). The ``` $ ./build/ripwire . --external-surface - - - - + + + + - - + + - + - - + + ... [17 more line(s); run it to see the whole thing] ``` @@ -969,7 +964,7 @@ _Shortest directed call-path SRC -> DST. CHANGED: now reports from_p/to_p/from_d ``` $ ./build/ripwire . --path=main,rankGraphTeleport - @@ -998,7 +993,7 @@ $ ./build/ripwire . --defs=main,rankGraphTeleport - + @@ -1021,10 +1016,10 @@ _Minimal connecting subgraph over 3 symbols (finds shared-caller joins)._ ``` $ ./build/ripwire . --connect=rankGraphTeleport,runEval,getIndex - + - + @@ -1133,7 +1128,7 @@ _Test files that transitively reach the changed file._ ``` $ ./build/ripwire . --affected=src/graph.h - @@ -1193,7 +1188,7 @@ _Mid-task situational report for the current git diff — recorded against a CLE $ ./build/ripwire . --situ ripwire situational-awareness — 0 changed file(s), 0 symbols in them root: . -at: da897642e +at: d3a73cd6e (0 changed files — working tree is clean, nothing to analyze) ``` @@ -1212,18 +1207,18 @@ _The continuation packet for the NEXT session: disk truth (branch/sha ``` $ ./build/ripwire . --handoff - + - + - - - + + + + ... [1 more line(s); run it to see the whole thing] ``` @@ -1247,7 +1242,7 @@ _Pre-PR gate on a CLEAN tree: no obligations, exit 0._ ``` $ ./build/ripwire . --test-gate - ``` @@ -1332,15 +1327,15 @@ $ ./build/ripwire . --grep=DISCLOSE --and=cache CDATA text (/ context around it); complete=1 only for an exhaustive literal scan (beside pattern_meta=, of the literal reading only); = off-index. window: shown= capped= (capped=1 cut). hits_capped=1: hits= is a floor. root=: p= relative to it. parse_degraded=1: E … [line truncated: 1693 more bytes on this line] - + - - - - - + + + + + - + ... [17 more line(s); run it to see the whole thing] ``` @@ -1544,14 +1539,14 @@ $ ./build/ripwire . --query="teleport pagerank" --top-k=5 - + - + - + ... [17 more line(s); run it to see the whole thing] ``` @@ -1574,7 +1569,7 @@ _Importance-weighted detail: FULL bodies for top-2, signatures for the rest._ ``` $ ./build/ripwire . --for="pagerank power iteration" --detail=2 - + @@ -1607,14 +1602,14 @@ _Body-elided decl skeletons — recounted on this corpus. Measured as element by $ ./build/ripwire . --pack-signatures --top-k=10 - - + + - + @@ -1640,7 +1635,7 @@ $ ./build/ripwire . --outline=rankGraphTeleport --top-k=0 signature rows. est_tokens=: price as emitted (an upper bound under compact). root=: p= relative to it. --> - + & p, float alpha = 0.85f ) { PROFILE_SCOPE_DESCRIBE( "rankGraph: PageRank (power iteration)" ); @@ -1671,7 +1666,7 @@ $ ./build/ripwire . --top-k=0 --expand=rankGraphTeleport - + of ; resolved callees (p= when not the b's file). window: shown= total= capped= (capped=1 cut). sibs_capped=/inc_capped=: 1 = cut. est_tokens=: price as emitted (an upper bound under compact). root=: p= relative to it. : that callee matched by name alone (receiver unproven); it … [line truncated: 410 more bytes on this line] -: that callee matched by name alone (receiver unproven); it does NOT mean the edge is false. sc=: enclosing scope; the full id is p::sc::n (p= of the row or its ) and selectors take it. amb=K: K calls split over several defs. locals_floor=1: locals= is a floor. role=hub: in= is 8 or more. s in= out= cx= ccx= loc= params= nest= cbo= lcom4= amp=: callers, callees, cyclomatic/cognitive complexity, lines, parameters, nesting depth, coupled types, class cohesion, callers + co-changed files. ev=/ev_why=: essential complexity (2+: jumps block extract-method; absent: 1) / the jumps behind it, tag:count. ev_floor=1: ev= is a FLOOR; noreturn calls, macro-hidden exits and unresolved gotos are unseen. layer=: built-in arch layer (game|infra|render|math|audio|ai|test) from a dir name in p=; absent if none. l=N: start line; only on a same-name overload's row, one row per body (bodyless decls fold into overloads=). f p=: a file; s t= n=: kind, name; c n=: a resolved callee. s k=: rank. --> + - - + + - + @@ -1843,10 +1838,10 @@ _File->file dependency graph (god-files, cycles)._ ``` $ ./build/ripwire . --deps - - - - + + + + @@ -1880,18 +1875,18 @@ _Complexity x recent git churn (maintenance pain)._ $ ./build/ripwire . --hotspots - - - + + + - + - + - + ... [17 more line(s); run it to see the whole thing] ``` @@ -1908,7 +1903,7 @@ _Token-normalized duplicate bodies._ ``` $ ./build/ripwire . --clones - + @@ -1918,7 +1913,7 @@ $ ./build/ripwire . --clones - + ... [17 more line(s); run it to see the whole thing] @@ -1939,8 +1934,8 @@ _Per-function size ranking, largest Halstead volume/token entropy/lines first ``` $ ./build/ripwire . --biggest-first --limit=8 - - + + @@ -1972,7 +1967,7 @@ _Per function, the non-local MUTABLE state it can reach (transitively), most wri ``` $ ./build/ripwire . --nonlocal-state --limit=8 - @@ -2007,7 +2002,7 @@ _The family join: per function, which of four orthogonal evidence families fire, ``` $ ./build/ripwire . --ensemble --limit=8 - @@ -2038,17 +2033,17 @@ _THE single wide-angle quality read: six families in one pass, an eligible/ranke ``` $ ./build/ripwire . --quality-panel - - - + + - + ... [17 more line(s); run it to see the whole thing] @@ -2075,13 +2070,13 @@ _The local-reasoning lens: to understand this symbol, how much must you know tha ``` $ ./build/ripwire . --context-ratio --limit=8 - - - - - - + + + + + + ... [23 more line(s); run it to see the whole thing] ``` @@ -2106,7 +2101,7 @@ _Score the naming-* rules against this repo's own rename history: proxy=old/(old ``` $ ./build/ripwire . --naming-calibration - + @@ -2141,16 +2136,16 @@ _The corpus's OWN case-convention vote per (language, kind) group; off-conventio ``` $ ./build/ripwire . --naming-consistency --limit=8 - - - + + + - + @@ -2178,8 +2173,8 @@ _The opt-in --lint modifier: naming predicates over LOCAL variable names too, C/ ``` $ ./build/ripwire . --lint --naming-locals - - + + @@ -2187,10 +2182,10 @@ $ ./build/ripwire . --lint --naming-locals - + - + ... [17 more line(s); run it to see the whole thing] ``` @@ -2213,7 +2208,7 @@ _Functions WITH a doc comment, most name-restating first: c_coeff (high = the co ``` $ ./build/ripwire . --comment-coherence --limit=8 - + @@ -2246,16 +2241,16 @@ _Files that change together in git (hidden coupling)._ ``` $ ./build/ripwire . --cochange - + - + - - + + ... [22 more line(s); run it to see the whole thing] ``` @@ -2278,16 +2273,16 @@ _Only pairs whose co-change RECURS in 2+ sub-windows of the mined window (sub_wi ``` $ ./build/ripwire . --cochange --cochange-recur=2 - + - - - - - - + + + + + + ... [22 more line(s); run it to see the whole thing] ``` @@ -2304,7 +2299,7 @@ _Modularity-violation GROUPS instead of pairs: "X co-changes with {A,B,C}, none ``` $ ./build/ripwire . --cochange --cochange-groups - + @@ -2333,19 +2328,19 @@ _Hotspots scoped to RECENT churn (the regression lens)._ ``` $ ./build/ripwire . --hotspots --since="2 weeks ago" - - - - - - - - + + + + + + + + + + - - ... [17 more line(s); run it to see the whole thing] ``` @@ -2371,7 +2366,7 @@ _Enforce layering rules (exit 2 on violation) — run against the repo's own tes $ ./build/ripwire . --arch=test/archfix/rules.txt - + @@ -2403,7 +2398,7 @@ _Enforce layering rules (exit 2 on violation) — run against the repo's own tes $ ./build/ripwire . --arch=test/archfix/rules.txt - + @@ -2430,7 +2425,7 @@ _Enforce layering rules (exit 2 on violation) — run against the repo's own tes $ ./build/ripwire . --arch=test/archfix/rules.txt - + @@ -2458,8 +2453,8 @@ _Built-in AST checks (c-cast, goto, unsafe-c-fn, ...)._ ``` $ ./build/ripwire . --lint - - + + @@ -2467,10 +2462,10 @@ $ ./build/ripwire . --lint - + - + ... [17 more line(s); run it to see the whole thing] ``` @@ -2567,8 +2562,8 @@ _DROP two families, applied after selection; the raw select=/ignore= you passed ``` $ ./build/ripwire . --lint --lint-ignore=naming-,cache- - + @@ -2576,10 +2571,10 @@ $ ./build/ripwire . --lint --lint-ignore=naming-,cache- - + - + ... [17 more line(s); run it to see the whole thing] ``` @@ -2681,15 +2676,15 @@ _Cluster the call graph into cohesive modules._ ``` $ ./build/ripwire . --communities - + - - - - + + + + - + @@ -2712,7 +2707,7 @@ _Drill into ONE call-graph community by id — the drill= the --communities outp ``` $ ./build/ripwire . --community=0 - ``` @@ -2737,15 +2732,15 @@ _Nested module hierarchy (multi-level Louvain) + cross-module bridges — shown_ ``` $ ./build/ripwire . --zoom - - + + - - + + @@ -2774,16 +2769,16 @@ $ ./build/ripwire . --report # ripwire architecture report -4813 files · 43892 symbols · 43002 edges · 5098 modules (20772 call-graph isolated) +4823 files · 44037 symbols · 43540 edges · 5028 modules (20786 call-graph isolated) Root: `.` -Call-graph isolate provenance: 5690 declaration, 3459 header, 4579 source, 7044 document; 0 connected Louvain singletons +Call-graph isolate provenance: 5708 declaration, 3473 header, 4561 source, 7044 document; 0 connected Louvain singletons -## Modules (call-graph clusters; showing 12 of 5098) -- **src::emitTo@infra/emit.h:53:2760 [write,run,emit]** — 1598 symbols -- **src::kindIs@infra/nodekind.h:46:3271 [push,emit,read]** — 701 symbols -- **src::DISCLOSE@infra/Diagnostics.h:622:43913 [read,compute,run]** — 554 symbols +## Modules (call-graph clusters; showing 12 of 5028) +- **src::emitTo@infra/emit.h:53:2760 [write,run,emit]** — 1893 symbols +- **src::kindIs@infra/nodekind.h:46:3271 [push,emit,read]** — 706 symbols +- **src::DISCLOSE@infra/Diagnostics.h:622:43913 [read,compute,parse]** — 538 symbols ... [17 more line(s); run it to see the whole thing] ``` @@ -2800,10 +2795,10 @@ _Cross-module call seams no test reaches. NOW carries seam_pairs/shown/capped._ ``` $ ./build/ripwire . --seams - + - + @@ -2831,11 +2826,11 @@ $ ./build/ripwire . --mermaid %% ripwire --mermaid: module (directory) dependency graph — node = dir (symbol count), edge = inter-module calls (>= 3). Render at mermaid.live. flowchart LR subgraph sg0 ["src"] - n105["src
14247"] - n106["src/infra
1679"] + n105["src
14346"] + n106["src/infra
1680"] end subgraph sg1 ["test"] - n107["test
6942"] + n107["test
6961"] n750["test/legochargefix
546"] n472["test/fixtures/recallpassage
314"] n491["test/fnslotcpp2
285"] @@ -2860,8 +2855,8 @@ _Bus-factor: recency-weighted author ownership per file._ ``` $ ./build/ripwire . --owners - - + + @@ -2891,17 +2886,20 @@ _Internal functions with no caller found in the index — a name-based graph rea ``` $ ./build/ripwire . --dead-code=src - + - + - - -... [20 more line(s); run it to see the whole thing] + + + + + +... [1 more line(s); run it to see the whole thing] ``` **Shaped by:** `--safe-delete`, `--limit` @@ -2964,7 +2962,7 @@ _The same run, the same clone, the folded rows printed back: each stale acknowle ``` $ ./build/ripwire . --quality-delta --show-stale - @@ -2993,7 +2991,7 @@ _The regression-free answer on a clone whose ledger holds stale acknowledgements ``` $ ./build/ripwire . --quality-delta - ``` @@ -3018,7 +3016,7 @@ _The regression-free answer on a clone whose ledger holds stale acknowledgements ``` $ ./build/ripwire . --quality-delta - ``` @@ -3043,7 +3041,7 @@ _A ref range run for two of the twelve kinds only: the named kinds' rows are exa ``` $ ./build/ripwire . --quality-delta=HEAD~1..HEAD --quality-kinds=complexity,dead-code -

-

+

-

-… [187 more display lines; full output is 18223 bytes on 1 raw line(s)] +

+… [188 more display lines; full output is 18300 bytes on 1 raw line(s)] ````` ## `./build/ripwire . --lint --naming-locals` *The opt-in --lint modifier: naming predicates over LOCAL variable names too, C/C++ only, only inside functions already past a size/complexity gate.* -**wall time: 3.90s** +**wall time: 5.76s** ````` - - + + @@ -5967,27 +5865,27 @@ ripwire: --run-timeout=SECONDS modifies --run-trace — pass it too (e.g. ripwir - + - - + + - - + + - + - + - -… [638 more display lines; full output is 72794 bytes on 1 raw line(s)] + +… [638 more display lines; full output is 72745 bytes on 1 raw line(s)] ````` ## `./build/ripwire . --lint-catalog` @@ -6070,7 +5968,7 @@ ripwire.path/v1 : one DIRECTED call path from= to to=, each a *Run ONLY one rule family; the root carries selected="K of N" so a filtered zero is never confusable with an unfiltered one.* -**wall time: 2.72s** +**wall time: 2.87s** ````` @@ -6110,12 +6008,12 @@ ripwire.path/v1 : one DIRECTED call path from= to to=, each a *DROP two families, applied after selection; the raw select=/ignore= you passed rides on the root.* -**wall time: 3.30s** +**wall time: 2.35s** ````` - + @@ -6123,17 +6021,17 @@ ripwire.path/v1 : one DIRECTED call path from= to to=, each a - + - - + + - + - + @@ -6143,14 +6041,14 @@ ripwire.path/v1 : one DIRECTED call path from= to to=, each a 20 delta < 0.02 && delta > -0.02 0.02 -… [710 more display lines; full output is 67089 bytes on 1 raw line(s)] +… [710 more display lines; full output is 67103 bytes on 1 raw line(s)] ````` ## `./build/ripwire . --lint --lint-select=goto --lint-max-per-rule=4` *A rule that spends its own match budget (here 4, set BELOW the default 5000 so the floor shows on this repo): goto carries count_capped="1", its count= is a FLOOR, and the root names the call that counts the rest — findings_next= re-runs only the floored rules under a 10x budget.* -**wall time: 2.98s** +**wall time: 2.66s** ````` @@ -6167,7 +6065,7 @@ ripwire.path/v1 : one DIRECTED call path from= to to=, each a *Pasting that findings_next=: the same rule under a 10x budget counts its true total — no count_capped=, no findings_next=.* -**wall time: 3.56s** +**wall time: 3.89s** ````` @@ -6197,7 +6095,7 @@ ripwire.path/v1 : one DIRECTED call path from= to to=, each a *An unresolvable PREFIX refuses (exit 1) with a did-you-mean from a real edit distance (one character off cache-).* -**exit code: 1** — **wall time: 2.92s** +**exit code: 1** — **wall time: 4.22s** ````` (empty) @@ -6213,7 +6111,7 @@ ripwire: --lint-select: 'cach-' matches no rule or family (did you mean 'cache-' *A PREFIX with no near miss at all: the refusal points at --lint-catalog instead of guessing.* -**exit code: 1** — **wall time: 2.61s** +**exit code: 1** — **wall time: 4.08s** ````` (empty) @@ -6229,7 +6127,7 @@ ripwire: --lint-select: 'nosuchfamily' matches no rule or family — see --lint- *The SAME findings as SARIF 2.1.0 (what github/codeql-action/upload-sarif consumes) — pure re-serialization, results count == the native run's.* -**wall time: 3.20s** +**wall time: 4.35s** ````` {"version":"2.1.0","$schema":"https://raw.githubusercontent.com/oasis-tcs/sarif-spec/master/Schemata/sarif-schema-2.1.0.json","runs":[{"tool":{"driver":{"name":"ripwire","rules":[{"id":"c-style-cast","shortDescription":{"text":"c-style-cast"},"properties":{"builtin":true,"capped":false,"applicable": … [line truncated: 7 more bytes on this line] @@ -6262,13 +6160,13 @@ ripwire: --lint-select: 'nosuchfamily' matches no rule or family — see --lint- {"id":"atom-nested-ternary","shortDescription":{"text":"atom-nested-ternary"},"properties":{"builtin":true,"capped":false,"applicable":true}}, {"id":"atom-implicit-predicate","shortDescription":{"text":"atom-implicit-predicate"},"properties":{"builtin":true,"capped":false,"applicable":true}}, {"id":"atom-octal-literal","shortDescription":{"text":"atom-octal-literal"},"properties":{"builtin":true,"capped":false,"applicable":true}}, -… [17007 more display lines; full output is 2414195 bytes on 1 raw line(s)] +… [17029 more display lines; full output is 2417689 bytes on 1 raw line(s)] ````` Parsed summary of the same SARIF (past the display cut): ````` -sarif 2.1.0 rules= 39 results= 8499 +sarif 2.1.0 rules= 39 results= 8510 ````` ## `./build/ripwire . --lint --sarif --limit=5` @@ -6291,11 +6189,11 @@ ripwire: --sarif always emits the full result set — drop --limit=N/--offset=M *The Delta Maintainability Model scalar for the WORKING TREE vs HEAD — recorded against a CLEAN tree (the sandbox section shows a real delta). UNAVAILABLE is a stated reason, never 0 or 1.* -**wall time: 8.82s** +**wall time: 10.92s** ````` -

@@ -6306,11 +6204,11 @@ ripwire: --sarif always emits the full result set — drop --limit=N/--offset=M *The per-commit scalar: HEAD vs its first parent, with the three separately actionable sub-scores.* -**wall time: 17.74s** +**wall time: 17.51s** ````` -

@@ -6321,14 +6219,14 @@ ripwire: --sarif always emits the full result set — drop --limit=N/--offset=M *The range form: tree HEAD vs tree HEAD~3.* -**wall time: 19.00s** +**wall time: 22.42s** ````` - -

-

+ +

+

````` @@ -6336,11 +6234,11 @@ ripwire: --sarif always emits the full result set — drop --limit=N/--offset=M *Modularity-violation GROUPS instead of pairs: "X co-changes with {A,B,C}, none of which it depends on" — a greedy cover, disclosed as greedy.* -**wall time: 5.09s** +**wall time: 8.14s** ````` - + @@ -6369,48 +6267,48 @@ ripwire: --sarif always emits the full result set — drop --limit=N/--offset=M -… [990 more display lines; full output is 66745 bytes on 1 raw line(s)] +… [989 more display lines; full output is 66680 bytes on 1 raw line(s)] ````` ## `./build/ripwire . --cochange --cochange-recur=2` *Only pairs whose co-change RECURS in 2+ sub-windows of the mined window (sub_windows= is the denominator) — a one-off sprint stops reading like a structural defect.* -**wall time: 4.80s** +**wall time: 3.52s** ````` - + - - - - - - - + + + + + + + - - + - - - - + + + + - - + + + ````` @@ -6418,7 +6316,7 @@ ripwire: --sarif always emits the full result set — drop --limit=N/--offset=M *The HTML graph with the initial colour mode set to community (the page embeds all five modes and keeps a live selector).* -**wall time: 4.95s** +**wall time: 3.14s** ````` (empty) @@ -6427,14 +6325,14 @@ ripwire: --sarif always emits the full result set — drop --limit=N/--offset=M Artifact written: ````` - 155106 /aux/map2.html + 155139 /aux/map2.html ````` ## `./build/ripwire . --index-out=/aux/ci_index` *CI generate-and-exit: cold-parse and write BOTH committable cache families (lean + rich), no map on stdout.* -**wall time: 9.49s** +**wall time: 9.85s** ````` (empty) @@ -6443,33 +6341,33 @@ Artifact written: stderr: ````` -ripwire: --index-out wrote /aux/ci_index.lean.ripwirecache (39659984 bytes, lean family) -ripwire: --index-out wrote /aux/ci_index.rich.ripwirecache (80032730 bytes, rich family) +ripwire: --index-out wrote /aux/ci_index.lean.ripwirecache (39764763 bytes, lean family) +ripwire: --index-out wrote /aux/ci_index.rich.ripwirecache (80224391 bytes, rich family) ````` Artifact written: ````` - 39659984 /aux/ci_index.lean.ripwirecache - 80032730 /aux/ci_index.rich.ripwirecache - 119692714 total + 39764763 /aux/ci_index.lean.ripwirecache + 80224391 /aux/ci_index.rich.ripwirecache + 119989154 total ````` ## `./build/ripwire . --cache=/aux/ci_index.lean.ripwirecache --top-k=3` *Consume the lean artifact in a PR job: restore-equivalence, never blob-byte-identity.* -**wall time: 2.72s** +**wall time: 1.71s** ````` - - + + - + @@ -6480,7 +6378,7 @@ Artifact written: - + @@ -6492,24 +6390,24 @@ Artifact written: -… [80 more display lines; full output is 10006 bytes on 1 raw line(s)] +… [81 more display lines; full output is 10053 bytes on 1 raw line(s)] ````` ## `./build/ripwire . --pin-census=/aux/pin_census.tsv --top-k=3` *Eval-only: a per-call-site census of WHICH mechanism resolved each call, and the canonical id of every surviving target.* -**wall time: 1.94s** +**wall time: 1.36s** ````` - - + + - + @@ -6520,7 +6418,7 @@ Artifact written: - + @@ -6532,7 +6430,7 @@ Artifact written: -… [80 more display lines; full output is 10006 bytes on 1 raw line(s)] +… [81 more display lines; full output is 10053 bytes on 1 raw line(s)] ````` Artifact written: @@ -6546,18 +6444,18 @@ Artifact written: # whose template-argument list spans lines keeps its line break as \n instead of splitting the row. # line is the 1-based call-site line in the caller's file (v2, appended LAST so v1 readers are unchanged): # the key a SCIP occurrence joins on, so a coverage loss can be classified per site instead of guessed. - 178117 /aux/pin_census.tsv + 178596 /aux/pin_census.tsv ````` ## `./build/ripwire . --plan-lint=test/planlintfix/wave.md` *The house PLAN/DESIGN format's STRUCTURE check — never semantics; exit 2 when a card or ledger row gates.* -**exit code: 2** — **wall time: 3.95s** +**exit code: 2** — **wall time: 3.04s** ````` - + @@ -6575,11 +6473,11 @@ Artifact written: *The ledger-shaped fixture through the same check (exit 2: one gating card).* -**exit code: 2** — **wall time: 2.64s** +**exit code: 2** ````` - + @@ -6591,18 +6489,18 @@ Artifact written: *--doctor plus a LIVE integration inspection for one agent: PATH binary, installed-skill manifest parity, hook executability, MCP wiring — read-only, fixed repair commands, never config contents; exit 1 when any check fails.* -**exit code: 1** — **wall time: 37.74s** +**exit code: 1** — **wall time: 10.96s** ````` - - + - - + + - - + @@ -6638,15 +6536,15 @@ Everything below runs with `cwd` = the throwaway clone at `/dirty` (`gi *Situational report for a real diff: blast radius + tests + co-change + forgotten co-change partners.* -**wall time: 19.43s** +**wall time: 9.50s** ````` ripwire situational-awareness — 1 changed file(s), 13 symbols in them root: . -at: da897642e+dirty +at: d3a73cd6e+dirty change_set: granularity=file changed_symbols=13 file_symbols=13 files_narrowed=0 files_file_granular=1 diff_hunks=7 diff_hunks_located=6 diff_hunks_unlocated=1 — seeds = symbols a diff -U0-vs-HEAD hunk overlaps (function/method body spans only); an unlocated hunk (module-level, deletion, rename) … [line truncated: 34 more bytes on this line] [1] blast radius: 351 symbols across 79 files transitively depend on these changes (showing 8 of 79 files — shown=8 total=79 capped=1 prcontext_cap=20 (--pr-context's own per-file list is cut at 20 too); next: --situ --limit=79) - counts_floor=1 graph_ambiguous=3634 graph_unresolved=20011 graph_unindexed=313 (files no grammar in this build could read at all) (the map header's own gauges) — every count above is a FLOOR, never a total: call edges are name-based, so dynamic dispatch, callbacks and macros can be missing … [line truncated: 45 more bytes on this line] + counts_floor=1 graph_ambiguous=3967 graph_unresolved=19988 graph_unindexed=313 (files no grammar in this build could read at all) (the map header's own gauges) — every count above is a FLOOR, never a total: call edges are name-based, so dynamic dispatch, callbacks and macros can be missing … [line truncated: 45 more bytes on this line] src/mcpverbs.h (37 dependent symbols) src/verbs_for.h (27 dependent symbols) src/verbs_quality.h (17 dependent symbols) @@ -6662,9 +6560,9 @@ at: da897642e+dirty test/verify_csr.cpp [hops=2] (run: bash test/a9disclosurecheck.sh) test/includeprecise_unit.cpp [hops=4] (run: bash test/includeprecisecheck.sh) test/rustimport_unit.cpp [hops=4] (run: bash test/rustimportprecisecheck.sh) - script_gates_unmodelled=942 — test/*.sh gates never appear above: script-to-binary edges are not call edges (a path count) - [3] co-change — usually edited with these but NOT in your diff (0) window="18mo@HEAD" commits="7839": - (none — 7839 commits were mined and none co-edited a file outside your diff) + script_gates_unmodelled=944 — test/*.sh gates never appear above: script-to-binary edges are not call edges (a path count) + [3] co-change — usually edited with these but NOT in your diff (0) window="18mo@HEAD" commits="7881": + (none — 7881 commits were mined and none co-edited a file outside your diff) next: --test-gate ````` @@ -6672,11 +6570,11 @@ at: da897642e+dirty *The pre-PR gate with real obligations — exit 4 when tests-to-run or untested blast radius is non-empty.* -**exit code: 4** — **wall time: 15.83s** +**exit code: 4** — **wall time: 8.73s** ````` - @@ -6689,7 +6587,7 @@ at: da897642e+dirty - + @@ -6715,11 +6613,11 @@ at: da897642e+dirty *Every row carries p="file:line", the gating rows are marked gating="1" and now bar= (the threshold each numeric row is judged against), and the exit-2 refusal prints a naming line on stderr; a gating row carries a pasteable next=.* -**exit code: 2** — **wall time: 55.92s** +**exit code: 2** — **wall time: 41.09s** ````` - @@ -6748,7 +6646,7 @@ at: da897642e+dirty -… [159 more display lines; full output is 19544 bytes on 1 raw line(s)] +… [161 more display lines; full output is 19753 bytes on 1 raw line(s)] ````` stderr: @@ -6762,11 +6660,11 @@ ripwire: --quality-delta gating: 5 preexisting-worse major finding(s); first: ap *The same gating report under --legend=full — same rows, same exit 2; the default compact comment (schema="ripwire.quality-delta/v1", the shape an agent's edit loop should run) becomes ~4 KB of prose legend.* -**exit code: 2** — **wall time: 31.26s** +**exit code: 2** — **wall time: 17.28s** ````` - @@ -6795,7 +6693,7 @@ ripwire: --quality-delta gating: 5 preexisting-worse major finding(s); first: ap -… [159 more display lines; full output is 24936 bytes on 1 raw line(s)] +… [161 more display lines; full output is 25145 bytes on 1 raw line(s)] ````` stderr: @@ -6809,10 +6707,10 @@ ripwire: --quality-delta gating: 5 preexisting-worse major finding(s); first: ap *The same findings as JSON (one of the CI/scripting verbs --json supports) — same exit 2 as the XML form.* -**exit code: 2** — **wall time: 27.40s** +**exit code: 2** — **wall time: 20.61s** ````` -{"baseline":"git-HEAD","regressions":9,"minor":1,"acked":0,"stale":177,"preexisting-worse":6,"new-symbol":3,"gating":5,"register-macro-excluded":63,"api-new-surface":2,"at":"da897642e+dirty","renames":68,"rename_window_commits":400,"acked_by_rename":0,"acked_by_content":0,"renames_window_truncated": … [line truncated: 240 more bytes on this line] +{"baseline":"git-HEAD","regressions":9,"minor":1,"acked":0,"stale":179,"preexisting-worse":6,"new-symbol":3,"gating":5,"register-macro-excluded":63,"api-new-surface":2,"at":"d3a73cd6e+dirty","renames":68,"rename_window_commits":400,"acked_by_rename":0,"acked_by_content":0,"renames_window_truncated": … [line truncated: 240 more bytes on this line] {"kind":"complexity","sym":"src/infra/sortutil.h::rw::sortutil::lessByScoreDescId","was":1,"now":67,"p":"src/infra/sortutil.h:52","gating":true}, {"kind":"dead-code","sym":"src/infra/sortutil.h::rw::sortutil::nonNegativeFloatAscKeyCopy","p":"src/infra/sortutil.h:122","origin":"new-symbol"}, {"kind":"dead-code","sym":"src/infra/sortutil.h::rw::sortutil::sortScoredIdsWithOptions","p":"src/infra/sortutil.h:132","origin":"new-symbol"}, @@ -6842,7 +6740,7 @@ ripwire: --quality-delta gating: 5 preexisting-worse major finding(s); first: ap {"kind":"api-surface:new-symbol","key":"36e39c7ab0fc1686","why":"target-gone"}, {"kind":"api-surface:new-symbol","key":"4bce64bd920de0c3","why":"target-gone"}, {"kind":"api-surface:new-symbol","key":"61f0e361ef7dee27","why":"target-gone"}, -… [156 more display lines; full output is 18157 bytes on 1 raw line(s)] +… [158 more display lines; full output is 18380 bytes on 1 raw line(s)] ````` stderr: @@ -6856,7 +6754,7 @@ ripwire: --quality-delta gating: 5 preexisting-worse major finding(s); first: ap *NEW FLAG: --ack-only matching nothing REFUSES rather than falling back to acking everything.* -**exit code: 1** — **wall time: 22.90s** +**exit code: 1** — **wall time: 7.70s** ````` (empty) @@ -6874,7 +6772,7 @@ ripwire: --ack-only=zzznope matched none of the 9 finding(s) — nothing accepte *NEW FLAG: ack only the api-surface findings — a per-finding ratchet instead of a rubber stamp.* -**wall time: 24.06s** +**wall time: 6.71s** ````` (empty) @@ -6892,11 +6790,11 @@ ripwire: acknowledged 1 of 9 finding(s) (8 left UNACKED by --ack-only, 0 already *Re-run after the partial ack: acked=3, the rest still gate (exit 2).* -**exit code: 2** — **wall time: 32.14s** +**exit code: 2** — **wall time: 11.88s** ````` - @@ -6925,7 +6823,7 @@ ripwire: acknowledged 1 of 9 finding(s) (8 left UNACKED by --ack-only, 0 already -… [158 more display lines; full output is 19247 bytes on 1 raw line(s)] +… [160 more display lines; full output is 19456 bytes on 1 raw line(s)] ````` stderr: @@ -6955,11 +6853,11 @@ ripwire: --ack-only=SUBSTR narrows --quality-ack — pass both (e.g. ripwire row identical.* -**wall time: 7.57s** +**wall time: 1.03s** ````` - @@ -6987,11 +6885,11 @@ ripwire: --ack-only=SUBSTR narrows --quality-ack — pass both (e.g. ripwire - @@ -7027,30 +6925,30 @@ ripwire: --ack-only=SUBSTR narrows --quality-ack — pass both (e.g. ripwire ) and selectors take it. layer=: built-in arch layer (game|infra|render|math|audio|ai|test) from a dir name in p=; absent if none. f p=: a file; s t= n=: kind, name; c n=: a resolved callee. s k=: rank. --> - - + + - + - + - + - + @@ -7060,11 +6958,11 @@ ripwire: --ack-only=SUBSTR narrows --quality-ack — pass both (e.g. ripwire of ; dup_loc=/dup_pct=. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). root=: p= relative to it. groups=/type3=: Type-2 and Type-3 group totals over all groups; total= is their sum. exempt_groups=N: groups whose members all sit on fixture/shell-runner paths quality-delta duplication ignores. idiom_groups=/demoted_groups=: groups of one recognized idiom / those quality-delta demotes to minor; floors. clone_groups=N: clusters after merging pairs (rows sharing gid=); a floor under type3_capped=1. total_loc=N: lines of every function body the detector considered; dup_pct= is dup_loc= over it. group exempt=fixture|shell-runner: every member is on such a path; quality-delta duplication ignores it. group idiom=: the recognized shape every member spells: threshold-ladder, switch-name-table, builder-chain, one-statement. --> - + @@ -7074,7 +6972,7 @@ ripwire: --ack-only=SUBSTR narrows --quality-ack — pass both (e.g. ripwire - + @@ -7084,7 +6982,7 @@ ripwire: --ack-only=SUBSTR narrows --quality-ack — pass both (e.g. ripwire - + @@ -7100,12 +6998,12 @@ ripwire: --ack-only=SUBSTR narrows --quality-ack — pass both (e.g. ripwire ; v=unknown = no merge base. at=: commit+dirty+shallow. head=: the HEAD commit, bare 9-hex sha (at= adds +dirty). head_ref=: HEAD's branch (HEAD when detached); that branch itself is not scanned. refs=N: local branches scanned (refs/heads only); unmerged + superseded + merged + unknown = refs. blobs=N: distinct git blobs read for the sweep. unmerged=N: refs whose authored work the live line genuinely lacks. superseded=N: refs whose work the live line re-implemented (removed the same base code). merged=N: refs whose work HEAD already has; omitted from the rows. name=: the local branch. tip=: the branch tip commit (9 hex). date=: the tip's committer date, YYYY-MM-DD. files=N: files with stray lines; rows capped at 12, a more element counts the rest (detail=1 lists all). ref superseded=N>: of this ref's stray= lines, those in files the live line re-implemented. unknown=N: refs that could not be analysed (v=unknown, e.g. no merge base); never counted merged. --> - - + + ````` @@ -7120,11 +7018,11 @@ stderr: *CHANGED: --plan surfaces those same refs as an row rather than silently dropping them.* -**wall time: 11.86s** +**wall time: 2.31s** ````` - + ````` @@ -7139,11 +7037,11 @@ stderr: *The DMM scalar on a REAL delta: the sandbox edit grew one unit past the nesting/complexity thresholds and added an 8-parameter one, so dmm is low and the three sub-scores say which property moved.* -**wall time: 17.55s** +**wall time: 6.45s** ````` -

@@ -7154,11 +7052,11 @@ stderr: *OWNERSHIP partition for a shared tree: every regression here lives in src/infra/, so under a scope naming src/graph.h they ALL print under with a do-not-ack banner and never gate — scoped-out-gating= says how many would have.* -**wall time: 32.87s** +**wall time: 11.40s** ````` - @@ -7187,7 +7085,7 @@ stderr: -… [161 more display lines; full output is 19514 bytes on 1 raw line(s)] +… [163 more display lines; full output is 19723 bytes on 1 raw line(s)] ````` stderr: @@ -7200,7 +7098,7 @@ ripwire: no ./.ripwire_quality_baseline — auto-comparing the working tree vs g *The rubber-stamp guard: an --ack-only that names an OUT-OF-SCOPE row refuses (exit 1) and writes nothing.* -**exit code: 1** — **wall time: 18.64s** +**exit code: 1** — **wall time: 10.67s** ````` (empty) @@ -7220,11 +7118,11 @@ ripwire: --ack-only=api-surface selects 1 finding(s) OUT OF SCOPE for --scope=sr *The continuation packet with a REAL diff: verified changed symbols + blast radius + tests-to-run, then the heuristic rows.* -**wall time: 13.70s** +**wall time: 4.94s** ````` - + @@ -7250,11 +7148,11 @@ ripwire: --ack-only=api-surface selects 1 finding(s) OUT OF SCOPE for --scope=sr - - - - - + + + + + ````` @@ -7263,10 +7161,8 @@ ripwire: --ack-only=api-surface selects 1 finding(s) OUT OF SCOPE for --scope=sr *Pin a field note (write-side memory) to a symbol; committed to .ripwire_notes in the sandbox. The BARE name is resolved through the same resolver the read verbs use and stored as the canonical id — the rewrite is echoed on stderr, because a silent one is not a disclosure.* -**wall time: 2.29s** - ````` -src/infra/sortutil.h::rw::sortutil::lessByScoreDescId 2026-11-20 keep this branch-free — it sits inside the PageRank sort comparator da897642edba82f8c83c0b65ff9fb6bd4738681e integration/train-1117d2-s +src/infra/sortutil.h::rw::sortutil::lessByScoreDescId 2026-11-20 keep this branch-free — it sits inside the PageRank sort comparator d3a73cd6ecd4ca6fbd16e4a246f4b7f3745c44ba integration/train-1118a ````` stderr: @@ -7280,8 +7176,6 @@ ripwire: --note-add: target 'lessByScoreDescId' canonicalised to 'src/infra/sort *The note is listed under the canonical id, dangling="0" — i.e. it will actually surface. (Before the H1 fix the bare name was stored verbatim and read dangling="1": recorded, and surfaced nowhere.)* -**wall time: 1.58s** - ````` @@ -7293,7 +7187,7 @@ ripwire: --note-add: target 'lessByScoreDescId' canonicalised to 'src/infra/sort - + @@ -7310,7 +7204,7 @@ ripwire: --note-add: target 'lessByScoreDescId' canonicalised to 'src/infra/sort *Two definitions carry this name, so the write REFUSES rather than pick one: a note keys ONE canonical id, and an ambiguous selector is refused, never silently narrowed. Every candidate is named, with a runnable retry.* -**exit code: 1** — **wall time: 2.37s** +**exit code: 1** ````` (empty) @@ -7344,20 +7238,16 @@ ripwire: --note-add: target not found: lessByScoreDescIdd (did you mean 'lessByS *The same symbol addressed by its CANONICAL id: already canonical, so nothing is rewritten and both notes land on ONE target.* -**wall time: 2.33s** - ````` -src/infra/sortutil.h::rw::sortutil::lessByScoreDescId 2026-11-20 chose the flat two-branch compare over the nested ladder because the comparator sits inside the PageRank sort da897642edba82f8c83c0b65ff9fb6bd4738681e integration/train-1117d2-s +src/infra/sortutil.h::rw::sortutil::lessByScoreDescId 2026-11-20 chose the flat two-branch compare over the nested ladder because the comparator sits inside the PageRank sort d3a73cd6ecd4ca6fbd16e4a246f4b7f3745c44ba integration/train-1118a ````` ## `./build/ripwire . --expand=lessByScoreDescId --top-k=0` *Both notes riding along with the symbol's body — the elements follow the body, past the display cut, so they are extracted below.* -**wall time: 1.89s** - ````` - + @@ -7387,16 +7277,16 @@ src/infra/sortutil.h::rw::sortutil::lessByScoreDescId 2026-11-20 chose the flat } else { -… [22 more display lines; full output is 3073 bytes on 47 raw line(s)] +… [22 more display lines; full output is 3067 bytes on 47 raw line(s)] ````` The element on the same output — past the 30-line display cut above: ````` - + - + ````` @@ -7421,7 +7311,7 @@ ripwire: --edit-payload is empty; empty never means delete *Whole-symbol replace without a whole-file read: the payload is the ORIGINAL flat body, so this edit undoes the sandbox's deep-nesting regression. The receipt's span is the POST-edit byte range; replaced_bytes counts the old bytes overwritten.* -**wall time: 13.02s** +**wall time: 8.21s** Input file: @@ -7438,13 +7328,13 @@ inline bool lessByScoreDescId( const std::vector& scores, std::uint32_t a ````` {"applied":"replace_symbol_body","symbol":"lessByScoreDescId","file":"src/infra/sortutil.h","span":{"start":2428,"end":2641},"lines":{"start":52,"end":59},"replaced_bytes":1718,"old_file_bytes":10184,"new_file_bytes":8679,"file_eol":"lf","eol_normalized":false,"trailing_newline_folded":true,"separat … [line truncated: 830 more bytes on this line] -"graph_ambiguous":3634,"graph_unresolved":20011,"graph_unindexed":313,"counts_floor":true},"tests_to_run":[{"p":"test/verify_radix.cpp","hops":1,"run":"bash test/greptiercheck.sh"}, +"graph_ambiguous":3967,"graph_unresolved":19988,"graph_unindexed":313,"counts_floor":true},"tests_to_run":[{"p":"test/verify_radix.cpp","hops":1,"run":"bash test/greptiercheck.sh"}, {"p":"test/adaptivecutshapefix/adaptive_cut_shape_test.cpp","hops":2,"run":"bash test/adaptivecutshapecheck.sh"}, {"p":"test/forrowfeatures_unit.cpp","hops":2,"run":"bash test/forrowfeaturescheck.sh"}, {"p":"test/verify_csr.cpp","hops":2,"run":"bash test/a9disclosurecheck.sh"}, {"p":"test/includeprecise_unit.cpp","hops":4,"run":"bash test/includeprecisecheck.sh"}, {"p":"test/rustimport_unit.cpp","hops":4,"run":"bash test/rustimportprecisecheck.sh"}], -"order":"evidence","partners":0,"run_first":1,"tests":6,"script_gates_unmodelled":942,"graph_ambiguous":3634,"graph_unresolved":20011,"graph_unindexed":313,"counts_floor":true,"next":"bash test/greptiercheck.sh"} +"order":"evidence","partners":0,"run_first":1,"tests":6,"script_gates_unmodelled":944,"graph_ambiguous":3967,"graph_unresolved":19988,"graph_unindexed":313,"counts_floor":true,"next":"bash test/greptiercheck.sh"} ````` stderr: @@ -7457,15 +7347,15 @@ ripwire edit: applied atomically; receipt carries region, blob_sha, edit_check, *The closed loop: contract unchanged (same params, same publicness) after the replace — nothing provably incompatible.* -**wall time: 7.18s** +**wall time: 2.45s** ````` - + - + @@ -7479,17 +7369,17 @@ ripwire edit: applied atomically; receipt carries region, blob_sha, edit_check, *Insert immediately AFTER one uniquely-resolved definition; replaced_bytes=0 because the insert verbs never overwrite. The receipt carries the folded post-edit verification (lines=, edit_check, tests_to_run) so the loop closes in one call.* -**wall time: 12.60s** +**wall time: 5.01s** ````` {"applied":"insert_after_symbol","symbol":"lessByScoreDescId","file":"src/infra/sortutil.h","span":{"start":2641,"end":2729},"lines":{"start":59,"end":61},"replaced_bytes":0,"old_file_bytes":8679,"new_file_bytes":8767,"file_eol":"lf","eol_normalized":false,"trailing_newline_folded":true,"separator_p … [line truncated: 650 more bytes on this line] -"graph_ambiguous":3634,"graph_unresolved":20011,"graph_unindexed":313,"counts_floor":true},"tests_to_run":[{"p":"test/verify_radix.cpp","hops":1,"run":"bash test/greptiercheck.sh"}, +"graph_ambiguous":3967,"graph_unresolved":19988,"graph_unindexed":313,"counts_floor":true},"tests_to_run":[{"p":"test/verify_radix.cpp","hops":1,"run":"bash test/greptiercheck.sh"}, {"p":"test/adaptivecutshapefix/adaptive_cut_shape_test.cpp","hops":2,"run":"bash test/adaptivecutshapecheck.sh"}, {"p":"test/forrowfeatures_unit.cpp","hops":2,"run":"bash test/forrowfeaturescheck.sh"}, {"p":"test/verify_csr.cpp","hops":2,"run":"bash test/a9disclosurecheck.sh"}, {"p":"test/includeprecise_unit.cpp","hops":4,"run":"bash test/includeprecisecheck.sh"}, {"p":"test/rustimport_unit.cpp","hops":4,"run":"bash test/rustimportprecisecheck.sh"}], -"order":"evidence","partners":0,"run_first":1,"tests":6,"script_gates_unmodelled":942,"graph_ambiguous":3634,"graph_unresolved":20011,"graph_unindexed":313,"counts_floor":true,"next":"bash test/greptiercheck.sh"} +"order":"evidence","partners":0,"run_first":1,"tests":6,"script_gates_unmodelled":944,"graph_ambiguous":3967,"graph_unresolved":19988,"graph_unindexed":313,"counts_floor":true,"next":"bash test/greptiercheck.sh"} ````` stderr: @@ -7502,7 +7392,7 @@ ripwire edit: applied atomically; receipt carries region, blob_sha, edit_check, *The opt-out: the same insert with the folded verification skipped — lines= still rides (it is free), edit_check/tests_to_run do not, and the two pasteable commands stay on stderr.* -**wall time: 3.89s** +**wall time: 2.12s** ````` {"applied":"insert_after_symbol","symbol":"lessByScoreDescId","file":"src/infra/sortutil.h","span":{"start":2641,"end":2729},"lines":{"start":59,"end":61},"replaced_bytes":0,"old_file_bytes":8767,"new_file_bytes":8855,"file_eol":"lf","eol_normalized":false,"trailing_newline_folded":true,"separator_p … [line truncated: 570 more bytes on this line] @@ -7518,20 +7408,20 @@ ripwire edit: applied atomically; receipt carries region, blob_sha (post-check s *Insert BEFORE, with --edit-target-file pinning which same-named definition (here unambiguous — the disambiguator is simply honoured).* -**wall time: 11.04s** +**wall time: 4.92s** ````` {"applied":"insert_before_symbol","symbol":"nonNegativeFloatDescKey","file":"src/infra/sortutil.h","span":{"start":3161,"end":3249},"lines":{"start":77,"end":78},"replaced_bytes":0,"old_file_bytes":8855,"new_file_bytes":8943,"file_eol":"lf","eol_normalized":false,"trailing_newline_folded":false,"sep … [line truncated: 753 more bytes on this line] {"n":"benchAdaptive","p":"bench/bench_radix_ab.cpp:157","l":[162]}, {"n":"radixSortNonNegativeFloatsDesc","p":"src/infra/sortutil.h:108","l":[117]}, {"n":"radixSortByScoreDescId","p":"src/infra/sortutil.h:123","l":[183]}], -"graph_ambiguous":3634,"graph_unresolved":20011,"graph_unindexed":313,"counts_floor":true},"tests_to_run":[{"p":"test/verify_radix.cpp","hops":1,"run":"bash test/greptiercheck.sh"}, +"graph_ambiguous":3967,"graph_unresolved":19988,"graph_unindexed":313,"counts_floor":true},"tests_to_run":[{"p":"test/verify_radix.cpp","hops":1,"run":"bash test/greptiercheck.sh"}, {"p":"test/adaptivecutshapefix/adaptive_cut_shape_test.cpp","hops":2,"run":"bash test/adaptivecutshapecheck.sh"}, {"p":"test/forrowfeatures_unit.cpp","hops":2,"run":"bash test/forrowfeaturescheck.sh"}, {"p":"test/verify_csr.cpp","hops":2,"run":"bash test/a9disclosurecheck.sh"}, {"p":"test/includeprecise_unit.cpp","hops":4,"run":"bash test/includeprecisecheck.sh"}, {"p":"test/rustimport_unit.cpp","hops":4,"run":"bash test/rustimportprecisecheck.sh"}], -"order":"evidence","partners":0,"run_first":1,"tests":6,"script_gates_unmodelled":942,"graph_ambiguous":3634,"graph_unresolved":20011,"graph_unindexed":313,"counts_floor":true,"next":"--uses=src/infra/sortutil.h:nonNegativeFloatDescKey"} +"order":"evidence","partners":0,"run_first":1,"tests":6,"script_gates_unmodelled":944,"graph_ambiguous":3967,"graph_unresolved":19988,"graph_unindexed":313,"counts_floor":true,"next":"--uses=src/infra/sortutil.h:nonNegativeFloatDescKey"} ````` stderr: @@ -7544,7 +7434,7 @@ ripwire edit: applied atomically; receipt carries region, blob_sha, edit_check, *An unknown TARGET refuses and leaves every file byte-identical.* -**exit code: 1** — **wall time: 5.48s** +**exit code: 1** — **wall time: 1.80s** ````` (empty) @@ -7560,7 +7450,7 @@ ripwire: --replace-symbol-body: symbol 'DoesNotExist' not found *A versioned multi-edit TRANSACTION preflighted without writing: the receipt shows what each op would read and touch.* -**wall time: 9.72s** +**wall time: 2.03s** Input file: @@ -7578,21 +7468,21 @@ Input file: ````` ````` -{"schema":"ripwire.edit-plan/v1","mode":"dry-run","edits":1,"files":1,"callers_union":4,"graph_ambiguous":3634,"graph_unresolved":20011,"graph_unindexed":313,"counts_floor":true,"atomic_scope":"per-file","rollback_on_write_error":true,"recheck_before_each_write":true,"multifile_crash_atomic":false," … [line truncated: 400 more bytes on this line] +{"schema":"ripwire.edit-plan/v1","mode":"dry-run","edits":1,"files":1,"callers_union":4,"graph_ambiguous":3967,"graph_unresolved":19988,"graph_unindexed":313,"counts_floor":true,"atomic_scope":"per-file","rollback_on_write_error":true,"recheck_before_each_write":true,"multifile_crash_atomic":false," … [line truncated: 400 more bytes on this line] ````` ## `./build/ripwire . --edit-plan=/aux/edit_plan.json --apply` *The same plan committed: per-file locks, re-verify-before-write, atomic rename, rollback on a later failure.* -**wall time: 10.73s** +**wall time: 4.52s** ````` -{"schema":"ripwire.edit-plan/v1","mode":"apply","edits":1,"files":1,"callers_union":4,"graph_ambiguous":3634,"graph_unresolved":20011,"graph_unindexed":313,"counts_floor":true,"applied":1,"atomic_files":1,"atomic_scope":"per-file","rollback_on_write_error":true,"recheck_before_each_write":true,"mult … [line truncated: 584 more bytes on this line] +{"schema":"ripwire.edit-plan/v1","mode":"apply","edits":1,"files":1,"callers_union":4,"graph_ambiguous":3967,"graph_unresolved":19988,"graph_unindexed":313,"counts_floor":true,"applied":1,"atomic_files":1,"atomic_scope":"per-file","rollback_on_write_error":true,"recheck_before_each_write":true,"mult … [line truncated: 584 more bytes on this line] {"n":"benchAdaptive","p":"bench/bench_radix_ab.cpp:157","l":[162]}, {"n":"radixSortNonNegativeFloatsDesc","p":"src/infra/sortutil.h:110","l":[119]}, {"n":"radixSortByScoreDescId","p":"src/infra/sortutil.h:125","l":[185]}], -"graph_ambiguous":3634,"graph_unresolved":20011,"graph_unindexed":313,"counts_floor":true}}]} +"graph_ambiguous":3967,"graph_unresolved":19988,"graph_unindexed":313,"counts_floor":true}}]} ````` ## `./build/ripwire . --edit-plan=/aux/edit_plan.json` @@ -7615,11 +7505,11 @@ ripwire: --edit-plan requires exactly one of --dry-run or --apply *After the agent's edits: the complexity/nesting rows on lessByScoreDescId are gone (the replace undid them), the rest still gate (exit 2).* -**exit code: 2** — **wall time: 29.10s** +**exit code: 2** — **wall time: 11.47s** ````` - @@ -7648,7 +7538,7 @@ ripwire: --edit-plan requires exactly one of --dry-run or --apply -… [155 more display lines; full output is 18613 bytes on 1 raw line(s)] +… [157 more display lines; full output is 18822 bytes on 1 raw line(s)] ````` stderr: @@ -7662,7 +7552,7 @@ ripwire: --quality-delta gating: 2 preexisting-worse major finding(s); first: du *REFUSES, exit 1: this sandbox tree is already regressed, and pinning here would swallow that debt into the floor so every later delta read clean. It names how many gating findings it would absorb, the first of them, and the way forward.* -**exit code: 1** — **wall time: 19.60s** +**exit code: 1** — **wall time: 8.43s** ````` (empty) @@ -7681,7 +7571,7 @@ ripwire: --quality-baseline: this tree already holds 2 gating finding(s) against *The consent form: pin anyway. The sidecar is stamped with the dirty pin and the absorbed count, so the fact outlives the process that knew it.* -**wall time: 25.56s** +**wall time: 9.86s** ````` (empty) @@ -7691,16 +7581,16 @@ stderr: ````` ripwire: --quality-baseline --allow-dirty: pinned with 2 gating finding(s) ABSORBED into the floor (stamped in the sidecar; every --quality-delta against it carries baseline_absorbed="2") -ripwire: wrote ./.ripwire_quality_baseline (snapshot of 41761 per-symbol rows, 43894 indexed symbols total) +ripwire: wrote ./.ripwire_quality_baseline (snapshot of 41901 per-symbol rows, 44039 indexed symbols total) ````` Artifact written: ````` - 8624015 .ripwire_quality_baseline + 8652959 .ripwire_quality_baseline # ripwire quality baseline v6 — regenerate with --quality-baseline; do not hand-edit -producer 044858a0c11fca09380aca26038052044e9b87b551e1aeb643fc0d5f83177cc6 -head da897642edba82f8c83c0b65ff9fb6bd4738681e +producer 3079011790d1a4efcdd7ecca4dfd8a74b1aa93c5497b368d775de09500ec7f19 +head d3a73cd6ecd4ca6fbd16e4a246f4b7f3745c44ba dirty 1 absorbed 2 ccx 67c15011ee8b 0 @@ -7713,11 +7603,11 @@ ccx 6a732f6699b *Against that sidecar the same tree reads regressions=0 — but baseline_absorbed= is on the root, so this green means clean SINCE THE PIN, never clean. A baseline is a floor YOU chose, and it belongs BEFORE the change.* -**wall time: 24.30s** +**wall time: 9.21s** ````` - ````` @@ -7731,7 +7621,7 @@ ccx 6a732f6699b *initialize + tools/list: the manifest an agent host loads at session start — every verb's name, description and input schema.* ````` -{"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2025-11-25","serverInfo":{"name":"ripwire","version":"0.6.10-dev.100+gda897642e"},"capabilities":{"tools":{},"resources":{}},"instructions":"Map before reading files. Start a new task with explore; use from_trace for an error; use impact plus uses … [line truncated: 760 more bytes on this line] +{"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2025-11-25","serverInfo":{"name":"ripwire","version":"0.6.10-dev.99+gd3a73cd6e"},"capabilities":{"tools":{},"resources":{}},"instructions":"Map before reading files. Start a new task with explore; use from_trace for an error; use impact plus uses … [line truncated: 759 more bytes on this line] {"jsonrpc":"2.0","id":2,"result":{"tools":[{"name":"analyze","description":"Architecture map for a directory: signatures and the call graph for the top symbols. Use when landing cold in a repo or subdir, before reading files; for a task-scoped inventory use 'for', for one symbol's neighborhood find_ … [line truncated: 742 more bytes on this line] {"name":"rank_by","description":"The SAME architecture map 'analyze' serves, ranked by a different signal instead of plain PageRank. rank_by = pagerank (default, omit it — the CLI's own unbiased --rank-by=pagerank; 'analyze' can rank differently on a tree with uncommitted changes, where it biases … [line truncated: 1077 more bytes on this line] {"name":"find_symbol","description":"A symbol's 1-hop neighborhood: the symbol (with a fetch_body handle) plus direct callers (calledBy) and callees (calls). Full transitive reach: 'impact'. Read/write/import sites, not just calls: 'uses'. JSON {symbol, calledBy, calls, defs, count, hop_tested, hop_ … [line truncated: 1181 more bytes on this line] @@ -7811,7 +7701,7 @@ quality_baseline desc_bytes= 407 schema_bytes= 193 required=[] *--mcp-tools=core: the server lists only the core profile's tools (explore, batch, from_trace, impact, uses, fetch_body, edit_check, quality_delta), so a host that loads every schema at session start pays only for those.* ````` -{"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2025-11-25","serverInfo":{"name":"ripwire","version":"0.6.10-dev.100+gda897642e"},"capabilities":{"tools":{},"resources":{}},"instructions":"Map before reading files. Start a new task with explore; use from_trace for an error; use impact plus uses … [line truncated: 977 more bytes on this line] +{"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2025-11-25","serverInfo":{"name":"ripwire","version":"0.6.10-dev.99+gd3a73cd6e"},"capabilities":{"tools":{},"resources":{}},"instructions":"Map before reading files. Start a new task with explore; use from_trace for an error; use impact plus uses … [line truncated: 976 more bytes on this line] {"jsonrpc":"2.0","id":2,"result":{"tools":[{"name":"fetch_body","description":"Full (or partial-range) source of a symbol's definition, addressed by the stable `handle` a read verb attached to it (bodies on request, not by default). start_line/end_line are optional, 1-based, INCLUSIVE and BODY-RELAT … [line truncated: 1092 more bytes on this line] {"name":"quality_delta","description":"Your PR self-check, run every time you think a change is DONE — pairs with the CLI-only --test-gate (names the tests to run + the untested blast radius; not MCP-exposed) to form the two-step pre-PR gate. Reports ONLY what your tree made WORSE vs baseline, acr … [line truncated: 862 more bytes on this line] {"name":"impact","description":"IS IT SAFE TO CHANGE X? — the TRANSITIVE blast radius of a symbol via calls, nearest first (d= hop depth), then PageRank. Use before modifying or deleting a symbol; it beats find_referencing_symbols (direct callers only), and 'uses' catches the read/write/import sit … [line truncated: 1325 more bytes on this line] @@ -7840,68 +7730,68 @@ quality_delta desc_bytes= 742 schema_bytes= 279 required=[] *MCP `for`: always bundle=sigs (never the CLI's compact route), the same ranked signatures as --for.* -**wall time: 8.53s** +**wall time: 4.16s** ````` -{"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2025-11-25","serverInfo":{"name":"ripwire","version":"0.6.10-dev.100+gda897642e"},"capabilities":{"tools":{},"resources":{}},"instructions":"Map before reading files. Start a new task with explore; use from_trace for an error; use impact plus uses … [line truncated: 760 more bytes on this line] -{"jsonrpc":"2.0","id":2,"result":{"content":[{"type":"text","text":". window: shown= total= capped= has_more= next_offset= offset= limit= (ca … [line truncated: 13902 more bytes on this line] -"_index":"[index: files=4813 symbols=43892 hash=951e3883]","_fresh":"ok"}} +"_index":"[index: files=4823 symbols=44037 hash=5a856ab0]","_fresh":"ok"}} {"jsonrpc":"2.0","id":3,"result":{"content":[{"type":"text","text":" - + @@ -108,7 +108,7 @@ $ ./build/ripwire . --top-k=5 --no-inventory - + @@ -142,7 +142,7 @@ $ ./build/ripwire . --max-tokens=1500 - + @@ -225,11 +225,11 @@ _Name-shaped query: the router picks name-exact BM25 (header says which/why)._ ``` $ ./build/ripwire . --for="rankGraphTeleport" - + - + PageRank with an explicit teleport / personalization vector p (Σp = 1). The prior is name-quality-biased through biasPrior() so all rank modes share one weighting seam; the transition matrix (edgesinline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>&am … [line truncated: 31 more bytes on this line] #### The convergence disclosure contract ### Wave-2 adversarial verification (2026-08-19) — six probes against `aa97c9e` @@ -262,7 +262,7 @@ _Restore the / sections the --for bundle collapses to a counted s ``` $ ./build/ripwire . --for="tree-sitter parse of a source file" --sections=lego,compose - + @@ -289,11 +289,11 @@ _T3 opt-out: the signatures-only lens (no auto bodies, no bundle="auto" attribut ``` $ ./build/ripwire . --for="rankGraphTeleport" --signatures-only - + - + PageRank with an explicit teleport / personalization vector p (Σp = 1). The prior is name-quality-biased through biasPrior() so all rank modes share one weighting seam; the transition matrix (edgesinline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>&am … [line truncated: 31 more bytes on this line] #### The convergence disclosure contract ### Wave-2 adversarial verification (2026-08-19) — six probes against `aa97c9e` @@ -324,7 +324,7 @@ _Opt OUT of compact conceptual serving: restore the rank-first auto wal ``` $ ./build/ripwire . --for="tree-sitter parse of a source file" --auto-bodies - + @@ -356,13 +356,13 @@ _Same query with routing forced OFF (plain subtoken+body BM25) — contrast with ``` $ ./build/ripwire . --for="rankGraphTeleport" --no-route - + - + PageRank with an explicit teleport / personalization vector p (Σp = 1). The prior is name-quali…inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>& p, float alpha = 0.85f ) - + uniform-teleport PageRank (the default). A kRankFlagNotNamed unit (model.h) has no edge and a 0 …inline RankedGraph rankGraph( const Graph& g, float alpha = 0.85f ) The default map's PageRank — uniform teleport, the one rank that is a function of the Graph al…inline std::optional<RankedGraph>& storedDefaultRank() noexcept @@ -388,7 +388,7 @@ _Cut the result at the relevance cliff (Adaptive-k) — on a flat ranking nothin ``` $ ./build/ripwire . --for="tree-sitter parse of a source file" --adaptive - + @@ -419,7 +419,7 @@ _Same task with the anchor disabled — the contrast the flag exists for._ ``` $ ./build/ripwire . --for="why does src/lexical.h chooseForRanker pick name-exact BM25" --no-mention-boost - @@ -449,7 +449,7 @@ _The same task with doc-mention surfacing OFF — the contrast the flag exists f ``` $ ./build/ripwire . --for="quality delta acks ledger rubber stamp" --no-doc-mention - + @@ -479,7 +479,7 @@ _Interface -> implementors view: every existing impl of the named interface; the $ ./build/ripwire . --lego=Vehicle - + @@ -510,7 +510,7 @@ _The repo's best-in-class instance to imitate before writing new code (picked by $ ./build/ripwire . --exemplar="format byte sizes for humans" - + @@ -739,7 +744,7 @@ $ ./build/ripwire . --no-stable --top-k=3 - + @@ -773,7 +778,7 @@ $ ./build/ripwire . --around=rankGraphTeleport - + @@ -823,18 +828,18 @@ _What SYM calls (1-hop out-edges)._ ``` $ ./build/ripwire . --callees=rankGraphTeleport - - + + - - - - - - + + + + + + ``` @@ -858,10 +863,10 @@ _The resolvable use-sites (call/read/write/import/extends) with file:line; count ``` $ ./build/ripwire . --uses=rankGraphTeleport - + - - + + @@ -892,10 +897,10 @@ _Composable node-set query: functions within 2 caller-hops of rankGraphTeleport. ``` $ ./build/ripwire . --graph-query='and(callers(name("rankGraphTeleport"),2),kind(all,fn))' - + - - + + @@ -930,7 +935,7 @@ _Names referenced but never defined in-corpus (stdlib/third-party surface). The $ ./build/ripwire . --external-surface - + @@ -940,8 +945,8 @@ $ ./build/ripwire . --external-surface - - + + ... [17 more line(s); run it to see the whole thing] ``` @@ -964,7 +969,7 @@ _Shortest directed call-path SRC -> DST. CHANGED: now reports from_p/to_p/from_d ``` $ ./build/ripwire . --path=main,rankGraphTeleport - @@ -1016,10 +1021,10 @@ _Minimal connecting subgraph over 3 symbols (finds shared-caller joins)._ ``` $ ./build/ripwire . --connect=rankGraphTeleport,runEval,getIndex - + - + @@ -1128,7 +1133,7 @@ _Test files that transitively reach the changed file._ ``` $ ./build/ripwire . --affected=src/graph.h - @@ -1188,7 +1193,7 @@ _Mid-task situational report for the current git diff — recorded against a CLE $ ./build/ripwire . --situ ripwire situational-awareness — 0 changed file(s), 0 symbols in them root: . -at: d3a73cd6e +at: cee081132 (0 changed files — working tree is clean, nothing to analyze) ``` @@ -1207,18 +1212,18 @@ _The continuation packet for the NEXT session: disk truth (branch/sha ``` $ ./build/ripwire . --handoff - + - + - - - + + + + ... [1 more line(s); run it to see the whole thing] ``` @@ -1242,7 +1247,7 @@ _Pre-PR gate on a CLEAN tree: no obligations, exit 0._ ``` $ ./build/ripwire . --test-gate - ``` @@ -1418,7 +1423,7 @@ _Span tiers off: the exhaustive view — the comment and string hits the default $ ./build/ripwire . --grep=DISCLOSE --grep-in=any - + - + - + ... [17 more line(s); run it to see the whole thing] ``` @@ -1569,7 +1574,7 @@ _Importance-weighted detail: FULL bodies for top-2, signatures for the rest._ ``` $ ./build/ripwire . --for="pagerank power iteration" --detail=2 - + @@ -1606,7 +1611,7 @@ $ ./build/ripwire . --pack-signatures --top-k=10 - + @@ -1635,7 +1640,7 @@ $ ./build/ripwire . --outline=rankGraphTeleport --top-k=0 signature rows. est_tokens=: price as emitted (an upper bound under compact). root=: p= relative to it. --> - + & p, float alpha = 0.85f ) { PROFILE_SCOPE_DESCRIBE( "rankGraph: PageRank (power iteration)" ); @@ -1666,7 +1671,7 @@ $ ./build/ripwire . --top-k=0 --expand=rankGraphTeleport - + ):the-statements-outside-every-named-definition,where-a-top-level-call-and-an-anonymous-callback-body's-calls-live;a-CALLER-never-a-callee(nothing-in-the-source-can-name-it)-with-no-body-to-expand;a-file-with-no-such-call-has-no-such-row --> - + @@ -1839,7 +1844,7 @@ _File->file dependency graph (god-files, cycles)._ $ ./build/ripwire . --deps - + @@ -1875,14 +1880,14 @@ _Complexity x recent git churn (maintenance pain)._ $ ./build/ripwire . --hotspots - - + + - + @@ -1903,7 +1908,7 @@ _Token-normalized duplicate bodies._ ``` $ ./build/ripwire . --clones - + @@ -1934,8 +1939,8 @@ _Per-function size ranking, largest Halstead volume/token entropy/lines first ``` $ ./build/ripwire . --biggest-first --limit=8 - - + + @@ -1967,7 +1972,7 @@ _Per function, the non-local MUTABLE state it can reach (transitively), most wri ``` $ ./build/ripwire . --nonlocal-state --limit=8 - @@ -2002,7 +2007,7 @@ _The family join: per function, which of four orthogonal evidence families fire, ``` $ ./build/ripwire . --ensemble --limit=8 - @@ -2033,17 +2038,17 @@ _THE single wide-angle quality read: six families in one pass, an eligible/ranke ``` $ ./build/ripwire . --quality-panel - - + - + ... [17 more line(s); run it to see the whole thing] @@ -2070,7 +2075,7 @@ _The local-reasoning lens: to understand this symbol, how much must you know tha ``` $ ./build/ripwire . --context-ratio --limit=8 - @@ -2101,7 +2106,7 @@ _Score the naming-* rules against this repo's own rename history: proxy=old/(old ``` $ ./build/ripwire . --naming-calibration - + @@ -2136,8 +2141,8 @@ _The corpus's OWN case-convention vote per (language, kind) group; off-conventio ``` $ ./build/ripwire . --naming-consistency --limit=8 - - + + @@ -2173,7 +2178,7 @@ _The opt-in --lint modifier: naming predicates over LOCAL variable names too, C/ ``` $ ./build/ripwire . --lint --naming-locals - + @@ -2208,7 +2213,7 @@ _Functions WITH a doc comment, most name-restating first: c_coeff (high = the co ``` $ ./build/ripwire . --comment-coherence --limit=8 - + @@ -2241,16 +2246,16 @@ _Files that change together in git (hidden coupling)._ ``` $ ./build/ripwire . --cochange - - + + + - - - - + + + ... [22 more line(s); run it to see the whole thing] ``` @@ -2273,15 +2278,15 @@ _Only pairs whose co-change RECURS in 2+ sub-windows of the mined window (sub_wi ``` $ ./build/ripwire . --cochange --cochange-recur=2 - + - - - - + + + + ... [22 more line(s); run it to see the whole thing] ``` @@ -2299,7 +2304,7 @@ _Modularity-violation GROUPS instead of pairs: "X co-changes with {A,B,C}, none ``` $ ./build/ripwire . --cochange --cochange-groups - + @@ -2328,14 +2333,14 @@ _Hotspots scoped to RECENT churn (the regression lens)._ ``` $ ./build/ripwire . --hotspots --since="2 weeks ago" - - + + - - - - + + + + @@ -2453,7 +2458,7 @@ _Built-in AST checks (c-cast, goto, unsafe-c-fn, ...)._ ``` $ ./build/ripwire . --lint - + @@ -2676,15 +2681,15 @@ _Cluster the call graph into cohesive modules._ ``` $ ./build/ripwire . --communities - + - + @@ -2707,7 +2712,7 @@ _Drill into ONE call-graph community by id — the drill= the --communities outp ``` $ ./build/ripwire . --community=0 - ``` @@ -2732,15 +2737,15 @@ _Nested module hierarchy (multi-level Louvain) + cross-module bridges — shown_ ``` $ ./build/ripwire . --zoom - - + + - - + + @@ -2769,16 +2774,16 @@ $ ./build/ripwire . --report # ripwire architecture report -4823 files · 44037 symbols · 43540 edges · 5028 modules (20786 call-graph isolated) +4825 files · 44048 symbols · 43566 edges · 5028 modules (20789 call-graph isolated) Root: `.` -Call-graph isolate provenance: 5708 declaration, 3473 header, 4561 source, 7044 document; 0 connected Louvain singletons +Call-graph isolate provenance: 5708 declaration, 3474 header, 4561 source, 7046 document; 0 connected Louvain singletons ## Modules (call-graph clusters; showing 12 of 5028) - **src::emitTo@infra/emit.h:53:2760 [write,run,emit]** — 1893 symbols - **src::kindIs@infra/nodekind.h:46:3271 [push,emit,read]** — 706 symbols -- **src::DISCLOSE@infra/Diagnostics.h:622:43913 [read,compute,parse]** — 538 symbols +- **src::DISCLOSE@infra/Diagnostics.h:622:43913 [read,compute,resolve]** — 546 symbols ... [17 more line(s); run it to see the whole thing] ``` @@ -2795,8 +2800,8 @@ _Cross-module call seams no test reaches. NOW carries seam_pairs/shown/capped._ ``` $ ./build/ripwire . --seams - + @@ -2826,7 +2831,7 @@ $ ./build/ripwire . --mermaid %% ripwire --mermaid: module (directory) dependency graph — node = dir (symbol count), edge = inter-module calls (>= 3). Render at mermaid.live. flowchart LR subgraph sg0 ["src"] - n105["src
14346"] + n105["src
14348"] n106["src/infra
1680"] end subgraph sg1 ["test"] @@ -2834,7 +2839,7 @@ flowchart LR n750["test/legochargefix
546"] n472["test/fixtures/recallpassage
314"] n491["test/fnslotcpp2
285"] - n913["test/lib
235"] + n913["test/lib
242"] n712["test/ifacepeelfix/cpp
206"] n1260["test/slotjoinfix
182"] ... [17 more line(s); run it to see the whole thing] @@ -2855,8 +2860,8 @@ _Bus-factor: recency-weighted author ownership per file._ ``` $ ./build/ripwire . --owners - - + + @@ -2886,7 +2891,7 @@ _Internal functions with no caller found in the index — a name-based graph rea ``` $ ./build/ripwire . --dead-code=src - + @@ -2962,7 +2967,7 @@ _The same run, the same clone, the folded rows printed back: each stale acknowle ``` $ ./build/ripwire . --quality-delta --show-stale - @@ -2991,7 +2996,7 @@ _The regression-free answer on a clone whose ledger holds stale acknowledgements ``` $ ./build/ripwire . --quality-delta - ``` @@ -3016,7 +3021,7 @@ _The regression-free answer on a clone whose ledger holds stale acknowledgements ``` $ ./build/ripwire . --quality-delta - ``` @@ -3041,7 +3046,7 @@ _A ref range run for two of the twelve kinds only: the named kinds' rows are exa ``` $ ./build/ripwire . --quality-delta=HEAD~1..HEAD --quality-kinds=complexity,dead-code -

@@ -3134,7 +3139,7 @@ _OWNERSHIP partition for a shared tree: every regression here lives in src/infra ``` $ ./build/ripwire . --quality-delta --scope=src/graph.h - @@ -3164,10 +3169,10 @@ _Fast per-symbol post-edit contract check vs git HEAD (unchanged on a clean tree ``` $ ./build/ripwire . --edit-check=rankGraphTeleport - - - + + @@ -3218,13 +3223,13 @@ $ ./build/ripwire . --insert-before-symbol=nonNegativeFloatDescKey --edit-payloa {"n":"benchAdaptive","p":"bench/bench_radix_ab.cpp:157","l":[162]}, {"n":"radixSortNonNegativeFloatsDesc","p":"src/infra/sortutil.h:108","l":[117]}, {"n":"radixSortByScoreDescId","p":"src/infra/sortutil.h:123","l":[183]}], -"graph_ambiguous":3967,"graph_unresolved":19988,"graph_unindexed":313,"counts_floor":true},"tests_to_run":[{"p":"test/verify_radix.cpp","hops":1,"run":"bash test/greptiercheck.sh"}, +"graph_ambiguous":3968,"graph_unresolved":19992,"graph_unindexed":313,"counts_floor":true},"tests_to_run":[{"p":"test/verify_radix.cpp","hops":1,"run":"bash test/greptiercheck.sh"}, {"p":"test/adaptivecutshapefix/adaptive_cut_shape_test.cpp","hops":2,"run":"bash test/adaptivecutshapecheck.sh"}, {"p":"test/forrowfeatures_unit.cpp","hops":2,"run":"bash test/forrowfeaturescheck.sh"}, {"p":"test/verify_csr.cpp","hops":2,"run":"bash test/a9disclosurecheck.sh"}, {"p":"test/includeprecise_unit.cpp","hops":4,"run":"bash test/includeprecisecheck.sh"}, {"p":"test/rustimport_unit.cpp","hops":4,"run":"bash test/rustimportprecisecheck.sh"}], -"order":"evidence","partners":0,"run_first":1,"tests":6,"script_gates_unmodelled":944,"graph_ambiguous":3967,"graph_unresolved":19988,"graph_unindexed":313,"counts_floor":true,"next":"--uses=src/infra/sortutil.h:nonNegativeFloatDescKey"} +"order":"evidence","partners":0,"run_first":1,"tests":6,"script_gates_unmodelled":945,"graph_ambiguous":3968,"graph_unresolved":19992,"graph_unindexed":313,"counts_floor":true,"next":"--uses=src/infra/sortutil.h:nonNegativeFloatDescKey"} ``` ### `--insert-after-symbol=TARGET` @@ -3240,13 +3245,13 @@ _Insert immediately AFTER one uniquely-resolved definition; replaced_bytes=0 bec ``` $ ./build/ripwire . --insert-after-symbol=lessByScoreDescId --edit-payload=/aux/payload_note.h {"applied":"insert_after_symbol","symbol":"lessByScoreDescId","file":"src/infra/sortutil.h","span":{"start":2641,"end":2729},"lines":{"start":59,"end":61},"replaced_bytes":0,"old_file_bytes":8679,"new_file_bytes":8767,"file_eol":"lf","eol_normalized":false,"trailing_newline_folded":true,"separator_p … [line truncated: 650 more bytes on this line] -"graph_ambiguous":3967,"graph_unresolved":19988,"graph_unindexed":313,"counts_floor":true},"tests_to_run":[{"p":"test/verify_radix.cpp","hops":1,"run":"bash test/greptiercheck.sh"}, +"graph_ambiguous":3968,"graph_unresolved":19992,"graph_unindexed":313,"counts_floor":true},"tests_to_run":[{"p":"test/verify_radix.cpp","hops":1,"run":"bash test/greptiercheck.sh"}, {"p":"test/adaptivecutshapefix/adaptive_cut_shape_test.cpp","hops":2,"run":"bash test/adaptivecutshapecheck.sh"}, {"p":"test/forrowfeatures_unit.cpp","hops":2,"run":"bash test/forrowfeaturescheck.sh"}, {"p":"test/verify_csr.cpp","hops":2,"run":"bash test/a9disclosurecheck.sh"}, {"p":"test/includeprecise_unit.cpp","hops":4,"run":"bash test/includeprecisecheck.sh"}, {"p":"test/rustimport_unit.cpp","hops":4,"run":"bash test/rustimportprecisecheck.sh"}], -"order":"evidence","partners":0,"run_first":1,"tests":6,"script_gates_unmodelled":944,"graph_ambiguous":3967,"graph_unresolved":19988,"graph_unindexed":313,"counts_floor":true,"next":"bash test/greptiercheck.sh"} +"order":"evidence","partners":0,"run_first":1,"tests":6,"script_gates_unmodelled":945,"graph_ambiguous":3968,"graph_unresolved":19992,"graph_unindexed":313,"counts_floor":true,"next":"bash test/greptiercheck.sh"} ``` **Caveats (stated by the binary):** @@ -3292,13 +3297,13 @@ $ ./build/ripwire . --insert-before-symbol=nonNegativeFloatDescKey --edit-payloa {"n":"benchAdaptive","p":"bench/bench_radix_ab.cpp:157","l":[162]}, {"n":"radixSortNonNegativeFloatsDesc","p":"src/infra/sortutil.h:108","l":[117]}, {"n":"radixSortByScoreDescId","p":"src/infra/sortutil.h:123","l":[183]}], -"graph_ambiguous":3967,"graph_unresolved":19988,"graph_unindexed":313,"counts_floor":true},"tests_to_run":[{"p":"test/verify_radix.cpp","hops":1,"run":"bash test/greptiercheck.sh"}, +"graph_ambiguous":3968,"graph_unresolved":19992,"graph_unindexed":313,"counts_floor":true},"tests_to_run":[{"p":"test/verify_radix.cpp","hops":1,"run":"bash test/greptiercheck.sh"}, {"p":"test/adaptivecutshapefix/adaptive_cut_shape_test.cpp","hops":2,"run":"bash test/adaptivecutshapecheck.sh"}, {"p":"test/forrowfeatures_unit.cpp","hops":2,"run":"bash test/forrowfeaturescheck.sh"}, {"p":"test/verify_csr.cpp","hops":2,"run":"bash test/a9disclosurecheck.sh"}, {"p":"test/includeprecise_unit.cpp","hops":4,"run":"bash test/includeprecisecheck.sh"}, {"p":"test/rustimport_unit.cpp","hops":4,"run":"bash test/rustimportprecisecheck.sh"}], -"order":"evidence","partners":0,"run_first":1,"tests":6,"script_gates_unmodelled":944,"graph_ambiguous":3967,"graph_unresolved":19988,"graph_unindexed":313,"counts_floor":true,"next":"--uses=src/infra/sortutil.h:nonNegativeFloatDescKey"} +"order":"evidence","partners":0,"run_first":1,"tests":6,"script_gates_unmodelled":945,"graph_ambiguous":3968,"graph_unresolved":19992,"graph_unindexed":313,"counts_floor":true,"next":"--uses=src/infra/sortutil.h:nonNegativeFloatDescKey"} ``` **Shaped by:** `--insert-after-symbol` @@ -3357,11 +3362,11 @@ _The same plan committed: per-file locks, re-verify-before-write, atomic rename, ``` $ ./build/ripwire . --edit-plan=/aux/edit_plan.json --apply -{"schema":"ripwire.edit-plan/v1","mode":"apply","edits":1,"files":1,"callers_union":4,"graph_ambiguous":3967,"graph_unresolved":19988,"graph_unindexed":313,"counts_floor":true,"applied":1,"atomic_files":1,"atomic_scope":"per-file","rollback_on_write_error":true,"recheck_before_each_write":true,"mult … [line truncated: 584 more bytes on this line] +{"schema":"ripwire.edit-plan/v1","mode":"apply","edits":1,"files":1,"callers_union":4,"graph_ambiguous":3968,"graph_unresolved":19992,"graph_unindexed":313,"counts_floor":true,"applied":1,"atomic_files":1,"atomic_scope":"per-file","rollback_on_write_error":true,"recheck_before_each_write":true,"mult … [line truncated: 584 more bytes on this line] {"n":"benchAdaptive","p":"bench/bench_radix_ab.cpp:157","l":[162]}, {"n":"radixSortNonNegativeFloatsDesc","p":"src/infra/sortutil.h:110","l":[119]}, {"n":"radixSortByScoreDescId","p":"src/infra/sortutil.h:125","l":[185]}], -"graph_ambiguous":3967,"graph_unresolved":19988,"graph_unindexed":313,"counts_floor":true}}]} +"graph_ambiguous":3968,"graph_unresolved":19992,"graph_unindexed":313,"counts_floor":true}}]} ``` **Shaped by:** `--edit-check` @@ -3407,19 +3412,19 @@ _Bare --slice=SYM: the INVENTORY of sliceable locals (), so a calle ``` $ ./build/ripwire . --slice=rankGraphTeleport - - - - - - - - - - - - - + + + + + + + + + + + + + ... [3 more line(s); run it to see the whole thing] ``` @@ -3444,17 +3449,17 @@ _Forward flow: which statements the seed's value reaches, at the default depth b ``` $ ./build/ripwire . --slice=rankGraphTeleport:teleport --slice-flow=fwd - - + + - + teleport( pw.begin(), pw.end() );]]> - + - + ... [22 more line(s); run it to see the whole thing] @@ -3498,10 +3503,10 @@ $ ./build/ripwire . --slice-depth=3 _Hold a LOCATION, not a name: the enclosing-definition chain at FILE:LINE (a compiler error, a diff hunk, a stack frame), outermost -> innermost._ ``` -$ ./build/ripwire . --at=src/graph.h:14923 +$ ./build/ripwire . --at=src/graph.h:14932 - - + + ``` @@ -3525,7 +3530,7 @@ _No-LLM review-evidence bundle for the working-tree diff (clean tree = empty)._ ``` $ ./build/ripwire . --pr-context - ``` @@ -3551,11 +3556,11 @@ _Pairwise cross-arm conflict sites + suggested landing order (any committish sha ``` $ ./build/ripwire . --merge-scout=HEAD~2,HEAD~1 - - + + - + @@ -3630,7 +3635,7 @@ _A second selection, the `fix/` ref family, picked at capture time from the refs ``` $ ./build/ripwire . --stray-content=fix/ - + ``` @@ -3655,11 +3660,11 @@ _Select the genuinely-unmerged refs of the `lane/` ref family and feed them to m ``` $ ./build/ripwire . --stray-content=lane/ --plan - + - - + + @@ -3691,8 +3696,8 @@ _Cross-branch ABI-break gate over the `lane/` ref family: struct byte-contract d ``` $ ./build/ripwire . --stray-content=lane/ --abi - + @@ -3726,10 +3731,10 @@ _Which ref's tree defines or mentions SYM — HEAD first, then every local branc ``` $ ./build/ripwire . --whereis=rankGraphTeleport - + - + - + + + - + - + @@ -3900,7 +3905,7 @@ _The cache-locality lens over every aggregate: fields READ TOGETHER but declared ``` $ ./build/ripwire . --field-affinity - @@ -3935,7 +3940,7 @@ _Which of this repo's doc claims are now false. CHANGED: row attribute at= renam ``` $ ./build/ripwire . --doc-drift - + @@ -3969,7 +3974,7 @@ _Which of this repo's doc claims are now false. CHANGED: row attribute at= renam ``` $ ./build/ripwire . --doc-drift - + @@ -4002,8 +4007,8 @@ _Same report, with git history splitting stale mentions into deleted-by-commit v ``` $ ./build/ripwire . --doc-drift --with-history - - + + @@ -4036,7 +4041,7 @@ _The house PLAN/DESIGN format's STRUCTURE check — never semantics; exit 2 when ``` $ ./build/ripwire . --plan-lint=test/planlintfix/wave.md - + @@ -4073,8 +4078,8 @@ $ ./build/ripwire . --from-trace=- AddressSanitizer:DEADLYSIGNAL ================================================================= ==41337==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000018 (pc 0x000102f4a1c8 bp 0x00016d2f1a40 sp 0x00016d2f19e0 T0) - #0 0x102f4a1c8 in rw::rankGraphTeleport(Graph const&, std::vector const&, float) src/graph.h:14923 - #1 0x102f3e884 in rw::rankGraph(Graph const&, float) src/graph.h:14966 + #0 0x102f4a1c8 in rw::rankGraphTeleport(Graph const&, std::vector const&, float) src/graph.h:14932 + #1 0x102f3e884 in rw::rankGraph(Graph const&, float) src/graph.h:14975 #2 0x102e11f30 in runDefaultMap(MainDispatch const&) src/main.cpp:1759 #3 0x102e01a44 in main src/main.cpp:4511 #4 0x1a2b3c0dc in start+0x9dc (dyld:arm64e+0x60dc) @@ -4103,7 +4108,7 @@ _A command that exits 0: a minimal success record (exit, measured duration, disc $ ./build/ripwire . --run-trace="true" - + ``` @@ -4263,7 +4268,7 @@ _Task lens + a compact Mermaid flowchart of the top anchors' 1-hop edges._ ``` $ ./build/ripwire . --for="pagerank power iteration" --with-graph - + @@ -4341,13 +4346,13 @@ _Environment self-check: binary staleness, grammars, cache dir, git, tracked-bin ``` $ ./build/ripwire . --doctor - - + - - + + - + @@ -4375,13 +4380,13 @@ _--doctor plus a LIVE integration inspection for one agent: PATH binary, install ``` $ ./build/ripwire . --doctor --agent=claude - - + - - + + - + @@ -4411,7 +4416,7 @@ $ ./build/ripwire . --skipped - @@ -4500,8 +4505,8 @@ $ ./build/ripwire . --rank-by=churn --top-k=5 - - + + @@ -4531,21 +4536,21 @@ a trailing slash is ignored; absolute paths and '..' are refused). The global block stays byte-identical, a second page follows it — n=/of= are its counts (of= IS the total, so the paging half carries no total=), capped="1" has_more="1" next_offset= offset= limit= page it, and next= replays THIS run's own corpus flags (--since/--exclude) so the page it names is a page of the same answer. The symbol map collapses to a disclosed stub — the map was not asked for and was not ranked at all, which is why the header carries no pr_iters=. merge_bombs_skipped= stays on the global block: it counts the window's skipped commits, not the directory's._ ``` -$ ./build/ripwire . --rank-by=churn-decay --since=HEAD~5 --exclude=test --exclude=docs --exclude=skills --exclude=changelog.d --in=src --limit=3 +$ ./build/ripwire . --rank-by=churn-decay --since=HEAD~7 --exclude=test --exclude=docs --exclude=skills --exclude=changelog.d --in=src --limit=3 - - + + - - - + + + - + - + ... [4 more line(s); run it to see the whole thing] ``` @@ -4608,7 +4613,7 @@ _The same gating report under --legend=full — same rows, same exit 2; the defa ``` $ ./build/ripwire . --quality-delta --legend=full - @@ -4703,7 +4708,7 @@ _The family join: per function, which of four orthogonal evidence families fire, ``` $ ./build/ripwire . --ensemble --limit=8 - @@ -4741,7 +4746,7 @@ $ ./build/ripwire . --exclude=present --exclude=bench --top-k=5 - + @@ -4772,8 +4777,8 @@ $ ./build/ripwire . --map-diff --top-k=5 - - + + @@ -4806,7 +4811,7 @@ $ ./build/ripwire . --cache=/aux/warm2.ripwirecache --top-k=3 - + @@ -4856,7 +4861,7 @@ $ ./build/ripwire . --no-cache --top-k=3 - + @@ -4887,7 +4892,7 @@ $ ./build/ripwire . --no-ignore --top-k=3 - + @@ -4923,7 +4928,7 @@ $ ./build/ripwire . --max-file-size=8K --top-k=3 - + @@ -5003,7 +5008,7 @@ $ ./build/ripwire . --pin-census=/aux/pin_census.tsv --top-k=3 - + @@ -5028,7 +5033,7 @@ _initialize + tools/list: the manifest an agent host loads at session start — ``` $ ./build/ripwire '%s\n' '{"jsonrpc":"2.0","id":1,"method":"initialize"}' '{"jsonrpc":"2.0","id":2,"method":"tools/list"}' | ./build/ripwire --mcp -{"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2025-11-25","serverInfo":{"name":"ripwire","version":"0.6.10-dev.99+gd3a73cd6e"},"capabilities":{"tools":{},"resources":{}},"instructions":"Map before reading files. Start a new task with explore; use from_trace for an error; use impact plus uses … [line truncated: 759 more bytes on this line] +{"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2025-11-25","serverInfo":{"name":"ripwire","version":"0.6.10-dev.104+gcee081132"},"capabilities":{"tools":{},"resources":{}},"instructions":"Map before reading files. Start a new task with explore; use from_trace for an error; use impact plus uses … [line truncated: 760 more bytes on this line] {"jsonrpc":"2.0","id":2,"result":{"tools":[{"name":"analyze","description":"Architecture map for a directory: signatures and the call graph for the top symbols. Use when landing cold in a repo or subdir, before reading files; for a task-scoped inventory use 'for', for one symbol's neighborhood find_ … [line truncated: 742 more bytes on this line] {"name":"rank_by","description":"The SAME architecture map 'analyze' serves, ranked by a different signal instead of plain PageRank. rank_by = pagerank (default, omit it — the CLI's own unbiased --rank-by=pagerank; 'analyze' can rank differently on a tree with uncommitted changes, where it biases … [line truncated: 1077 more bytes on this line] {"name":"find_symbol","description":"A symbol's 1-hop neighborhood: the symbol (with a fetch_body handle) plus direct callers (calledBy) and callees (calls). Full transitive reach: 'impact'. Read/write/import sites, not just calls: 'uses'. JSON {symbol, calledBy, calls, defs, count, hop_tested, hop_ … [line truncated: 1181 more bytes on this line] @@ -5054,11 +5059,11 @@ _--mcp-legend=inline: every answer of the stdio session carries its own legend ( ``` $ ./build/ripwire '%s\n' '{"jsonrpc":"2.0","id":1,"method":"initialize"}' '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"whereis","arguments":{"path":".","symbol":"rankGraphTeleport"}}}' '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"whereis","arguments":{"path":".","symbol":"computeOnePairOverlap"}}}' | ./build/ripwire --mcp --mcp-legend=inline -{"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2025-11-25","serverInfo":{"name":"ripwire","version":"0.6.10-dev.99+gd3a73cd6e"},"capabilities":{"tools":{},"resources":{}},"instructions":"Map before reading files. Start a new task with explore; use from_trace for an error; use impact plus uses … [line truncated: 756 more bytes on this line] +{"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2025-11-25","serverInfo":{"name":"ripwire","version":"0.6.10-dev.104+gcee081132"},"capabilities":{"tools":{},"resources":{}},"instructions":"Map before reading files. Start a new task with explore; use from_trace for an error; use impact plus uses … [line truncated: 757 more bytes on this line] {"jsonrpc":"2.0","id":2,"result":{"content":[{"type":"text","text":" @@ -31,7 +31,7 @@ - + @@ -59,18 +59,24 @@ … [767 more display lines; full output is 26365 bytes on 1 raw line(s)] ````` +stderr: + +````` +ripwire: cache : over its 2048 MiB budget — evicted 88 blob(s) of other roots or other ripwire builds (this build's blobs for this root are kept) +````` + ## `./build/ripwire . --top-k=5` *Same map, capped to the 5 highest-ranked symbols.* -**wall time: 1.40s** +**wall time: 1.58s** ````` - + @@ -89,7 +95,7 @@ - + @@ -108,7 +114,7 @@ - + @@ -139,7 +145,7 @@ - + @@ -226,10 +232,10 @@ ripwire: --token-budget exceeded: withheld_est_tokens=10621 > budget=100 *The task lens: ranked signatures + quality metrics framed for the task.* -**wall time: 5.16s** +**wall time: 6.74s** ````` - @@ -266,14 +272,14 @@ ripwire: --token-budget exceeded: withheld_est_tokens=10621 > budget=100 *Name-shaped query: the router picks name-exact BM25 (header says which/why).* -**wall time: 1.82s** +**wall time: 2.55s** ````` - + - + PageRank with an explicit teleport / personalization vector p (Σp = 1). The prior is name-quality-biased through biasPrior() so all rank modes share one weighting seam; the transition matrix (edgesinline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>&am … [line truncated: 31 more bytes on this line] #### The convergence disclosure contract ### Wave-2 adversarial verification (2026-08-19) — six probes against `aa97c9e` @@ -285,8 +291,8 @@ ripwire: --token-budget exceeded: withheld_est_tokens=10621 > budget=100 - - + + @@ -297,7 +303,7 @@ ripwire: --token-budget exceeded: withheld_est_tokens=10621 > budget=100 - + & p, float alpha = 0.85f ) … [28 more display lines; full output is 6611 bytes on 29 raw line(s)] ````` @@ -306,24 +312,24 @@ ripwire: --token-budget exceeded: withheld_est_tokens=10621 > budget=100 *Same query with routing forced OFF (plain subtoken+body BM25) — contrast with the routed run.* -**wall time: 1.83s** +**wall time: 1.67s** ````` - + - + PageRank with an explicit teleport / personalization vector p (Σp = 1). The prior is name-quali…inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>& p, float alpha = 0.85f ) - + uniform-teleport PageRank (the default). A kRankFlagNotNamed unit (model.h) has no edge and a 0 …inline RankedGraph rankGraph( const Graph& g, float alpha = 0.85f ) The default map's PageRank — uniform teleport, the one rank that is a function of the Graph al…inline std::optional<RankedGraph>& storedDefaultRank() noexcept inline ChurnRanking churnRankedGraph( const MainDispatch& d ) inline constexpr const char* kChurnRankLegend = "<!-- rank_by=churn: k= is PageRank re-run with the teleport BIASED by git CHANGE-FREQUENCY over window= " "(a c… -struct RankedGraph -inline std::vector<float> takeRank( RankedGraph ranked, RankDisclosure& disclosureOut ) -inline std::vector<float> biasPrior( const Graph& g, const std::vector<float>& p ) +struct RankedGraph +inline std::vector<float> takeRank( RankedGraph ranked, RankDisclosure& disclosureOut ) +inline std::vector<float> biasPrior( const Graph& g, const std::vector<float>& p ) inline std::vector<float> churnTeleportWorkspace( const std::vector<std::string>& rootDirs, const IngestResult& ing, const char* since = "18 months ago … [line truncated: 21 more bytes on this line] inline ChurnRanking churnDecayRanking( const MainDispatch& d, const rw::SinceScope& sinceScope, bool isScoped, const char* verbLabel ) PageRankRun pageRankDouble( const sparseCsr<float>& inEdges, std::span<const double> weightedOutDegree, std::span<const double> teleport, std::span<double> rank… @@ -346,14 +352,14 @@ ripwire: --token-budget exceeded: withheld_est_tokens=10621 > budget=100 *T3 opt-out: the signatures-only lens (no auto bodies, no bundle="auto" attribute) — contrast with the terminal default above.* -**wall time: 1.67s** +**wall time: 2.07s** ````` - + - + PageRank with an explicit teleport / personalization vector p (Σp = 1). The prior is name-quality-biased through biasPrior() so all rank modes share one weighting seam; the transition matrix (edgesinline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>&am … [line truncated: 31 more bytes on this line] #### The convergence disclosure contract ### Wave-2 adversarial verification (2026-08-19) — six probes against `aa97c9e` @@ -365,9 +371,9 @@ ripwire: --token-budget exceeded: withheld_est_tokens=10621 > budget=100 - - - + + + ````` @@ -376,10 +382,10 @@ ripwire: --token-budget exceeded: withheld_est_tokens=10621 > budget=100 *Cut the result at the relevance cliff (Adaptive-k) — on a flat ranking nothing is cut and the header says so ([adaptive: kept N of N]).* -**wall time: 1.28s** +**wall time: 2.06s** ````` - + @@ -409,17 +415,17 @@ ripwire: --token-budget exceeded: withheld_est_tokens=10621 > budget=100 -… [242 more display lines; full output is 26881 bytes on 44 raw line(s)] +… [242 more display lines; full output is 26876 bytes on 44 raw line(s)] ````` ## `./build/ripwire . --for="why does src/lexical.h chooseForRanker pick name-exact BM25"` *Mention anchoring (default-on): a path and a Symbol literally named in the task get lifted; the header says what anchored.* -**wall time: 1.11s** +**wall time: 1.85s** ````` - @@ -456,8 +462,10 @@ ripwire: --token-budget exceeded: withheld_est_tokens=10621 > budget=100 *Same task with the anchor disabled — the contrast the flag exists for.* +**wall time: 2.06s** + ````` - @@ -497,7 +505,7 @@ ripwire: --token-budget exceeded: withheld_est_tokens=10621 > budget=100 ````` - + @@ -513,7 +521,7 @@ ripwire: --token-budget exceeded: withheld_est_tokens=10621 > budget=100 ````` - + @@ -663,7 +692,7 @@ ripwire: redacted 1 secret from emitted context (keyword-gated-secret=1) — pas *Self-contained HTML force-directed call graph.* -**wall time: 2.29s** +**wall time: 2.20s** ````` (empty) @@ -672,7 +701,7 @@ ripwire: redacted 1 secret from emitted context (keyword-gated-secret=1) — pas Artifact written: ````` - 155134 /aux/map2.html + 155135 /aux/map2.html ````` ## `./build/ripwire . --order=stable --top-k=5` @@ -702,7 +731,7 @@ Artifact written: - + @@ -728,7 +757,7 @@ Artifact written: - + @@ -768,7 +797,7 @@ Artifact written: - + @@ -804,7 +833,7 @@ Artifact written: - + @@ -838,10 +867,10 @@ Artifact written: ````` - + - - + + @@ -856,10 +885,10 @@ Artifact written: ````` - + - - + + @@ -890,18 +919,18 @@ ripwire: --callers symbol not found: DoesNotExist (note: the lexical definition ````` - - + + - - - - - - + + + + + + ````` @@ -911,10 +940,10 @@ ripwire: --callers symbol not found: DoesNotExist (note: the lexical definition ````` - + - - + + @@ -930,10 +959,10 @@ ripwire: --callers symbol not found: DoesNotExist (note: the lexical definition ````` - + - - + + @@ -969,7 +998,7 @@ ripwire: --callers symbol not found: DoesNotExist (note: the lexical definition ````` - + @@ -979,8 +1008,8 @@ ripwire: --callers symbol not found: DoesNotExist (note: the lexical definition - - + + @@ -1007,28 +1036,28 @@ ripwire: --callers symbol not found: DoesNotExist (note: the lexical definition ````` - - - + + + - - + + - + - - - + + + - + @@ -1044,14 +1073,14 @@ ripwire: --callers symbol not found: DoesNotExist (note: the lexical definition ````` - - @@ -1099,7 +1128,7 @@ ripwire: --callers symbol not found: DoesNotExist (note: the lexical definition - + ````` @@ -1110,10 +1139,10 @@ ripwire: --callers symbol not found: DoesNotExist (note: the lexical definition ````` - + - + @@ -1147,8 +1176,8 @@ ripwire: --callers symbol not found: DoesNotExist (note: the lexical definition - - + + @@ -1182,7 +1211,7 @@ ripwire: --callers symbol not found: DoesNotExist (note: the lexical definition ````` - @@ -1200,10 +1229,12 @@ ripwire: --callers symbol not found: DoesNotExist (note: the lexical definition *Mid-task situational report for the current git diff — recorded against a CLEAN tree (contrast with the sandbox run below).* +**wall time: 1.02s** + ````` ripwire situational-awareness — 0 changed file(s), 0 symbols in them root: . -at: d3a73cd6e +at: cee081132 (0 changed files — working tree is clean, nothing to analyze) ````` @@ -1211,11 +1242,11 @@ at: d3a73cd6e *Pre-PR gate on a CLEAN tree: no obligations, exit 0.* -**wall time: 4.90s** +**wall time: 5.73s** ````` - ````` @@ -1358,7 +1389,7 @@ at: d3a73cd6e *Tree-sitter structural query WITHOUT a capture — a bare node query gets a capture AUTO-ADDED (auto_captured="1") and matches the same nodes the explicit form does.* -**wall time: 2.03s** +**wall time: 1.67s** ````` @@ -1398,11 +1429,11 @@ at: d3a73cd6e *The same shape query WITH an explicit capture — identical hits, no auto_captured= attribute.* -**wall time: 1.68s** +**wall time: 1.12s** ````` -if data.get( "schema" ) != SCHEMA: raise SystemExit( f"{path}: unexpected schema {data.get('schema')!r} (expecte if not str( data.get( "tasks_lock_content_sha256", "" ) ).startswith( "questions:" ): train_repos = select_tasks if train_repos: raise SystemExit( f"{path}: records from repo(s) that re-derive to LocBench @@ -1444,14 +1475,14 @@ at: d3a73cd6e - + - + - + @@ -1467,7 +1498,7 @@ at: d3a73cd6e - + … [23 more display lines; full output is 3783 bytes on 1 raw line(s)] ````` @@ -1481,8 +1512,10 @@ at: d3a73cd6e *Importance-weighted detail: FULL bodies for top-2, signatures for the rest.* +**wall time: 1.19s** + ````` - + @@ -1493,14 +1526,14 @@ at: d3a73cd6e The PageRank power iteration itself — the numeric kernel every ranked document's order comes f…PageRankRun pageRankDouble( const sparseCsr<float>& inEdges, std::span<const double> weightedOutDegree, std::span<const double> teleport, std::span<double> r … [line truncated: 10 more bytes on this line] inline std::string rankByText( const std::string& root, std::string_view mode, int topK, bool stable = false ) -struct RankedGraph +struct RankedGraph inline constexpr const char* kChurnRankLegend = "<!-- rank_by=churn: k= is PageRank re-run with the teleport BIASED by git CHANGE-FREQUENCY over window= " "(a c… inline std::uint32_t sliceRdIterationCeiling() noexcept struct PageRankRun Render one form of the disclosure. Empty string whenever there is nothing to say — no power it…inline std::string renderDisclosure( const RankDisclosure& d, DiscloseAs as ) -inline std::uint32_t navRelevanceWeight( const Graph& g, NodeId n ) noexcept -inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>& p, float alpha = 0.85f ) +inline std::uint32_t navRelevanceWeight( const Graph& g, NodeId n ) noexcept +inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>& p, float alpha = 0.85f ) inline constexpr std::string_view kPowerShellPathPrependScope = "in PowerShell, for this window @@ -1526,7 +1559,7 @@ at: d3a73cd6e - + @@ -1562,7 +1595,7 @@ at: d3a73cd6e signature rows. est_tokens=: price as emitted (an upper bound under compact). root=: p= relative to it. --> - + & p, float alpha = 0.85f ) { PROFILE_SCOPE_DESCRIBE( "rankGraph: PageRank (power iteration)" ); @@ -1591,7 +1624,7 @@ at: d3a73cd6e signature rows. est_tokens=: price as emitted (an upper bound under compact). root=: p= relative to it. --> - + & p, float alpha = 0.85f ) { PROFILE_SCOPE_DESCRIBE( "rankGraph: PageRank (power iteration)" ); @@ -1626,7 +1659,7 @@ ripwire: --outline=rankGraphTeleport:1-10: --outline has no line-range form — - + ):the-statements-outside-every-named-definition,where-a-top-level-call-and-an-anonymous-callback-body's-calls-live;a-CALLER-never-a-callee(nothing-in-the-source-can-name-it)-with-no-body-to-expand;a-file-with-no-such-call-has-no-such-row --> - + @@ -1852,7 +1885,7 @@ ripwire: --pack-top-n is deprecated — use --pack-task/--detail instead (unchan ````` - + @@ -1887,19 +1920,19 @@ ripwire: --pack-top-n is deprecated — use --pack-task/--detail instead (unchan *Complexity x recent git churn (maintenance pain).* -**wall time: 2.33s** +**wall time: 2.18s** ````` - - + + - + @@ -1927,11 +1960,11 @@ ripwire: --pack-top-n is deprecated — use --pack-task/--detail instead (unchan *Token-normalized duplicate bodies.* -**wall time: 1.31s** +**wall time: 2.35s** ````` - + @@ -1967,40 +2000,40 @@ ripwire: --pack-top-n is deprecated — use --pack-task/--detail instead (unchan *Files that change together in git (hidden coupling).* -**wall time: 1.87s** +**wall time: 1.59s** ````` - - + + + - - - - - + - - - - - + + + + + + - - - - + + + + + + - + ````` @@ -2009,40 +2042,40 @@ ripwire: --pack-top-n is deprecated — use --pack-task/--detail instead (unchan *Hotspots scoped to RECENT churn (the regression lens).* -**wall time: 1.64s** +**wall time: 2.30s** ````` - - + + - - - - + + + + - + - + - + - -… [13 more display lines; full output is 5194 bytes on 1 raw line(s)] + +… [13 more display lines; full output is 5204 bytes on 1 raw line(s)] ````` ## `./build/ripwire . --arch=test/archfix/rules.txt` @@ -2093,11 +2126,11 @@ ripwire arch: 407 file(s) in go,swift,java,cs,php,dart,kt,gd,clj: this build res *Built-in AST checks (c-cast, goto, unsafe-c-fn, ...).* -**wall time: 2.54s** +**wall time: 3.05s** ````` - + @@ -2113,7 +2146,7 @@ ripwire arch: 407 file(s) in go,swift,java,cs,php,dart,kt,gd,clj: this build res - + @@ -2213,36 +2246,36 @@ The joined finding — past the display cut above, extracted so the join is visi ````` - + - + - + - + -… [189 more display lines; full output is 16713 bytes on 1 raw line(s)] +… [189 more display lines; full output is 16723 bytes on 1 raw line(s)] ````` ## `./build/ripwire . --zoom` @@ -2251,15 +2284,15 @@ The joined finding — past the display cut above, extracted so the join is visi ````` - - + + - - + + @@ -2272,12 +2305,12 @@ The joined finding — past the display cut above, extracted so the join is visi - - + + - - + + … [137 more display lines; full output is 7611 bytes on 1 raw line(s)] @@ -2289,36 +2322,36 @@ The joined finding — past the display cut above, extracted so the join is visi ````` - - - + + + - + - + - + - + - + - + - + - + - + - + - + - + -… [325 more display lines; full output is 14581 bytes on 1 raw line(s)] +… [321 more display lines; full output is 14438 bytes on 1 raw line(s)] ````` ## `./build/ripwire . --report` @@ -2330,16 +2363,16 @@ The joined finding — past the display cut above, extracted so the join is visi # ripwire architecture report -4823 files · 44037 symbols · 43540 edges · 5028 modules (20786 call-graph isolated) +4825 files · 44048 symbols · 43566 edges · 5028 modules (20789 call-graph isolated) Root: `.` -Call-graph isolate provenance: 5708 declaration, 3473 header, 4561 source, 7044 document; 0 connected Louvain singletons +Call-graph isolate provenance: 5708 declaration, 3474 header, 4561 source, 7046 document; 0 connected Louvain singletons ## Modules (call-graph clusters; showing 12 of 5028) - **src::emitTo@infra/emit.h:53:2760 [write,run,emit]** — 1893 symbols - **src::kindIs@infra/nodekind.h:46:3271 [push,emit,read]** — 706 symbols -- **src::DISCLOSE@infra/Diagnostics.h:622:43913 [read,compute,parse]** — 538 symbols +- **src::DISCLOSE@infra/Diagnostics.h:622:43913 [read,compute,resolve]** — 546 symbols - **docs::`--top-k=N`@COMMANDS.md:59:9303 [pack,allow,insert]** — 185 symbols - **src::close@infra/os.h:181:9420 [open,write,read]** — 109 symbols - **test/ownerhopfix/py/pkg::big_handler_001@broadcast.py:3:72** — 106 symbols @@ -2356,7 +2389,7 @@ Not measured: 407 files in go,swift,java,cs,php,dart,kt,gd,clj (imports almost n - `src/model.h` — 143 dependents - `src/infra/emit.h` — 101 dependents - `src/infra/Diagnostics.h` — 78 dependents -… [38 more lines, 4328 bytes total] +… [38 more lines, 4336 bytes total] ````` ## `./build/ripwire . --seams` @@ -2365,8 +2398,8 @@ Not measured: 407 files in go,swift,java,cs,php,dart,kt,gd,clj (imports almost n ````` - + @@ -2405,7 +2438,7 @@ Not measured: 407 files in go,swift,java,cs,php,dart,kt,gd,clj (imports almost n %% ripwire --mermaid: module (directory) dependency graph — node = dir (symbol count), edge = inter-module calls (>= 3). Render at mermaid.live. flowchart LR subgraph sg0 ["src"] - n105["src
14346"] + n105["src
14348"] n106["src/infra
1680"] end subgraph sg1 ["test"] @@ -2413,7 +2446,7 @@ flowchart LR n750["test/legochargefix
546"] n472["test/fixtures/recallpassage
314"] n491["test/fnslotcpp2
285"] - n913["test/lib
235"] + n913["test/lib
242"] n712["test/ifacepeelfix/cpp
206"] n1260["test/slotjoinfix
182"] n1017["test/ownerhopfix/py/pkg
158"] @@ -2439,12 +2472,12 @@ flowchart LR *Bus-factor: recency-weighted author ownership per file.* -**wall time: 1.84s** +**wall time: 2.17s** ````` - - + + @@ -2479,11 +2512,11 @@ flowchart LR *Internal functions with no caller found in the index — a name-based graph reading, not a confidence score. NOTE the filter is a path-COMPONENT match: 'src' matches any .../src/... segment; use ./src to pin the root directory.* -**wall time: 1.41s** +**wall time: 1.67s** ````` - + @@ -2516,7 +2549,7 @@ flowchart LR ````` - ````` @@ -2525,11 +2558,11 @@ flowchart LR *The regression-free answer on a clone whose ledger holds stale acknowledgements (its HEAD's own history plus one demo row keyed to a finding that no longer measures as worse): the verdict-only document, every stale row collapsed to stale= and stale_by_kind=, with stale_next= naming the call below. Recorded in a throwaway clean clone so the contrast is structural — not a race with the release checkout's drift — and every regeneration on every machine sees the same pair.* -**wall time: 23.46s** +**wall time: 31.50s** ````` - ````` @@ -2543,11 +2576,11 @@ ripwire: no ./.ripwire_quality_baseline — auto-comparing the working tree vs g *The same run, the same clone, the folded rows printed back: each stale acknowledgement as an row under the full header — the demo row included, and no quarter of the bytes saved by silence. Refused without --quality-delta.* -**wall time: 10.24s** +**wall time: 14.38s** ````` - @@ -2589,14 +2622,14 @@ ripwire: no ./.ripwire_quality_baseline — auto-comparing the working tree vs g *Fast per-symbol post-edit contract check vs git HEAD (unchanged on a clean tree).* -**wall time: 19.29s** +**wall time: 10.17s** ````` - - - + + @@ -2604,21 +2637,15 @@ ripwire: no ./.ripwire_quality_baseline — auto-comparing the working tree vs g ````` -stderr: - -````` -ripwire: cache : over its 2048 MiB budget — evicted 89 blob(s) of other roots or other ripwire builds (this build's blobs for this root are kept) -````` - ## `./build/ripwire . --pr-context` *No-LLM review-evidence bundle for the working-tree diff (clean tree = empty).* -**wall time: 1.48s** +**wall time: 1.53s** ````` - ````` @@ -2627,54 +2654,55 @@ ripwire: cache : over its 2048 MiB budget — evicted 89 blob(s) of other r *The BASEREF form: diffed against merge-base(BASEREF, HEAD), never the ref tip — here the previous commit on the current line (a ref with NO merge base falls back to a disclosed two-dot diff: anchor="ref-tip-two-dot").* -**wall time: 5.02s** +**wall time: 4.13s** ````` - -: n rows with equal attrs as ONE row; each path's command is run_each= with {p} replaced by that path; p= splits on ',' into exactly n= paths; shown=/total= count test FILES. est_tokens=: price as emitted (an upper bound under compact). at=: commit+dirty+shallow. root=: p= relative to it. truncated=: what the trim ladder dropped to fit budget_tokens= (budget-floor-exceeded: still over). anchor=merge-base: diffed from merge base(base, HEAD); ref-tip-two-dot = no merge base, two-dot view. base_sha=: the merge-base commit (9 hex) the diff is anchored at. base_moved=N: paths the base ref changed since the fork that this work never touched; excluded. direction=: side reviewed: worktree-since-head, head-since-fork or head-since-ref-tip. skipped_mode_only=N: mode-only (chmod) diffs left out of the changed files; renames stay in. trim_level=0-4: trim ladder step taken to fit budget_tokens= (0 none, 4 counts only); raise token-budget. budget_default=1: the default 8000-token budget applied (no token-budget or max-tokens given). commits=N: this file's commits in window=; 0 = the window could not look, not no partners. partners=N: co-change partners NOT in the diff; rows are its top shown= (the cochange verb lists all). dependents=N: distinct symbols transitively calling this file's symbols (reach set, a FLOOR). files_other=N: non-changed files among those reached; the f rows are its top shown=. authors=N: distinct authors of this file (0 = no git data). bf=1: one author holds over 80% of recency-weighted commits (bus-factor risk). no-ref-work note=: the base ref's tip is the merge base, so it has no work of its own; rows are HEAD's. files=N: changed files in the diff (shown= of them listed). file symbols=: indexed symbols in that changed file. changed-symbols count= / tests count=: that section's full count (shown= of it listed). tests count=: test files reaching this file (shown= of them listed). impact files=: files holding the transitive callers (dependents=). impactf deps=: transitive callers in that file. author email=/share=: a committer of this file / its fraction of the recency-weighted commits. s callers=N: direct callers of that changed symbol; caller rows are its top shown= (callers verb: all). s t= n= / caller t= n=: a changed symbol's / one of its callers' kind and name. (t=modscope): a file's MODULE SCOPE — where a top-level call and an anonymous callback body's calls live; a CALLER, never a callee, with no body to expand. --> + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - - - + + - - - - + + + + + +… [39 more display lines; full output is 7143 bytes on 1 raw line(s)] ````` ## `./build/ripwire . --merge-scout=HEAD~2,HEAD~1` *Pairwise cross-arm conflict sites + suggested landing order (any committish sharing a merge base with HEAD works as an arm; one that does not is reported ok="0", never compared).* -**wall time: 33.84s** +**wall time: 23.12s** ````` - - + + - + @@ -2682,15 +2710,21 @@ ripwire: cache : over its 2048 MiB budget — evicted 89 blob(s) of other r ````` +stderr: + +````` +ripwire: cache : over its 2048 MiB budget — evicted 26 blob(s) of other roots or other ripwire builds (this build's blobs for this root are kept) +````` + ## `./build/ripwire . --stray-content=lane/` *Which refs of the `lane/` ref family still hold divergent authored work vs HEAD, with verdicts.* -**wall time: 8.16s** +**wall time: 10.55s** ````` - + @@ -2726,11 +2760,11 @@ ripwire: cache : over its 2048 MiB budget — evicted 89 blob(s) of other r *A second selection, the `fix/` ref family, picked at capture time from the refs this checkout really has and never the selection above: merged refs are OMITTED from the rows and counted in merged=; refs sharing no merge base with HEAD (a shallow clone, or a pre-rewrite history) land in unknown= with ok="0" — the counters always reconcile against refs=.* -**wall time: 1.24s** +**wall time: 2.82s** ````` - + ````` @@ -2738,15 +2772,15 @@ ripwire: cache : over its 2048 MiB budget — evicted 89 blob(s) of other r *Select the genuinely-unmerged refs of the `lane/` ref family and feed them to merge-scout for a landing order (a fully merged selection yields an empty landing set — still a measurement, disclosed on the root).* -**wall time: 25.62s** +**wall time: 23.35s** ````` - + - - + + @@ -2758,13 +2792,13 @@ ripwire: cache : over its 2048 MiB budget — evicted 89 blob(s) of other r - - - - - + + + + + - + @@ -2784,7 +2818,7 @@ ripwire: warning: --plan scouted 1 of 67 unmerged branches for conflicts and lan *A --plan filter that selects NO ref REFUSES (exit 1) naming the substring — before the wave-3 close this fell through to the '>512 refs match' sentence, and --abi under the same filter answered an empty measurement at exit 0.* -**exit code: 1** — **wall time: 1.48s** +**exit code: 1** — **wall time: 2.00s** ````` (empty) @@ -2801,12 +2835,12 @@ ripwire: --plan: --stray-content=zzzz-no-such-ref matches no local ref — a zer *Cross-branch ABI-break gate over the `lane/` ref family: struct byte-contract drift on each ref's AUTHORED paths — exit 2 when any drift row is found (the only kind that gates), 0 when the compared refs are clean, and exit 1 if the --stray-content filter matches no ref at all.* -**exit code: 2** — **wall time: 39.84s** +**exit code: 2** — **wall time: 38.01s** ````` - + @@ -2841,14 +2875,14 @@ ripwire: --plan: --stray-content=zzzz-no-such-ref matches no local ref — a zer *Which ref's tree defines or mentions SYM — HEAD first, then every local branch. The default lists the kind="def" rows (here the first 60, most on branches, each carrying tip= and date=) and counts the references in : on this symbol HEAD's references would fill the 60-row cap before the branch definitions arrive, so the whole list (below) shows fewer definitions, and the default serves the page that shows more of them, whatever its bytes.* -**wall time: 19.39s** +**wall time: 21.26s** ````` - + - + - - - - - - + + + + + + @@ -2881,21 +2915,21 @@ stderr: ````` ripwire: warning: --whereis read the newest 375 of 641 local branches; 266 older were not read (limit: 2097152 tree entries across all refs, 376 refs with HEAD at this tree's size); pass --detail=1 to read every branch, or narrow the branches with a ref-name filter -ripwire: warning: --whereis left 401 branch blobs unparsed, their rows kind=text (limit: 256 blobs or 64 MB per answer); pass --detail=1 to parse every one +ripwire: warning: --whereis left 405 branch blobs unparsed, their rows kind=text (limit: 256 blobs or 64 MB per answer); pass --detail=1 to parse every one ````` ## `./build/ripwire . --whereis=rankGraphTeleport --whereis-listing=all` *The whole hit list asked for by name: under the same 60-row cap HEAD's references fill the list, so it shows far fewer definitions (here HEAD's one) than the default above (here 60). The default serves the all page only when it shows the same definitions as the defs page in strictly fewer bytes (a tie serves it too).* -**wall time: 23.42s** +**wall time: 19.91s** ````` - + - + - - - - - - + + + + + + @@ -2928,18 +2962,18 @@ stderr: ````` ripwire: warning: --whereis read the newest 375 of 641 local branches; 266 older were not read (limit: 2097152 tree entries across all refs, 376 refs with HEAD at this tree's size); pass --detail=1 to read every branch, or narrow the branches with a ref-name filter -ripwire: warning: --whereis left 401 branch blobs unparsed, their rows kind=text (limit: 256 blobs or 64 MB per answer); pass --detail=1 to parse every one +ripwire: warning: --whereis left 405 branch blobs unparsed, their rows kind=text (limit: 256 blobs or 64 MB per answer); pass --detail=1 to parse every one ````` ## `./build/ripwire . --quality-delta=HEAD~1..HEAD --quality-kinds=complexity,dead-code` *A ref range run for two of the twelve kinds only: the named kinds' rows are exactly their rows in the full answer, the header names the others (kinds_skipped=, skipped_why="selector"), and a pass no named kind needs does not run. The replay a memory-stopped range answer hands back (kinds_next=) is this flag. Refused without --quality-delta=A..B.* -**wall time: 24.10s** +**wall time: 15.62s** ````` - - + + - - - - - - + + + + + + @@ -2987,19 +3021,19 @@ stderr: ````` ripwire: warning: --whereis read the newest 375 of 641 local branches; 266 older were not read (limit: 2097152 tree entries across all refs, 376 refs with HEAD at this tree's size); pass --detail=1 to read every branch, or narrow the branches with a ref-name filter -ripwire: warning: --whereis left 402 branch blobs unparsed, their rows kind=text (limit: 256 blobs or 64 MB per answer); pass --detail=1 to parse every one +ripwire: warning: --whereis left 405 branch blobs unparsed, their rows kind=text (limit: 256 blobs or 64 MB per answer); pass --detail=1 to parse every one ````` ## `./build/ripwire . --whereis=computeOnePairOverlap --with-history` *Same, plus a git-history row (never / removed-by-commit) for names no tree carries.* -**wall time: 23.82s** +**wall time: 24.13s** ````` - - + + @@ -3016,13 +3050,13 @@ ripwire: warning: --whereis read the newest 375 of 641 local branches; 266 older *The dark-content dashboard: gates BUILT but OFF. CHANGED: no longer invents gates from comments/heredocs, so the count only reflects real ifndef/define, CMake option(), and getenv gates.* -**wall time: 1.11s** +**wall time: 2.03s** ````` - + @@ -3058,7 +3092,7 @@ ripwire: warning: --whereis read the newest 375 of 641 local branches; 266 older ````` - + @@ -3094,7 +3128,7 @@ ripwire: warning: --whereis read the newest 375 of 641 local branches; 266 older *Unknown-gate refusal (exit 1) with a did-you-mean from a real edit distance (one character off RIPWIRE_ASAN).* -**exit code: 1** — **wall time: 1.01s** +**exit code: 1** ````` (empty) @@ -3111,10 +3145,10 @@ ripwire: run `ripwire . --flags` for the gate table *NEW VERB: pre-hoc lane plan — which of 3 parallel worktrees would COLLIDE, before a line is written. JSON on stdout.* -**wall time: 3.64s** +**wall time: 1.83s** ````` -{"v":1,"verb":"plan-lanes","at":"d3a73cd6e","root":".","task":"add a --since filter to the doc-drift verb and cover it with tests","source":"partition","requested":3,"lane_count":3,"claim_key":"path+scope+name","on_conflict":"producing-lane-rebases","corpus":{"files":4823,"symbols":44037,"edges":435 … [line truncated: 338 more bytes on this line] +{"v":1,"verb":"plan-lanes","at":"cee081132","root":".","task":"add a --since filter to the doc-drift verb and cover it with tests","source":"partition","requested":3,"lane_count":3,"claim_key":"path+scope+name","on_conflict":"producing-lane-rebases","corpus":{"files":4825,"symbols":44048,"edges":435 … [line truncated: 338 more bytes on this line] "symbols":[{"p":"./src/docdrift.h","n":"DriftResult","scope":"DriftResult","l":286,"id":"./src/docdrift.h::DriftResult::DriftResult"}, {"p":"./src/docdrift.h","n":"computeDocDrift","scope":"docdrift","l":2441,"id":"./src/docdrift.h::docdrift::computeDocDrift"}, {"p":"./src/docdrift.h","n":"kDocDriftLegend","scope":"docdrift","l":2739,"id":"./src/docdrift.h::docdrift::kDocDriftLegend"}, @@ -3151,7 +3185,7 @@ ripwire: run `ripwire . --flags` for the gate table *NEW VERB, explicit form: one line per lane, lane boundaries are the ones you wrote (the defensible mode).* -**wall time: 2.68s** +**wall time: 2.57s** Input file: @@ -3162,7 +3196,7 @@ write regression tests for the new filter ````` ````` -{"v":1,"verb":"plan-lanes","at":"d3a73cd6e","root":".","task":null,"source":"brief","requested":3,"lane_count":3,"claim_key":"path+scope+name","on_conflict":"producing-lane-rebases","corpus":{"files":4823,"symbols":44037,"edges":43540,"ambiguous":3967,"unresolved":19988},"carve":null,"core":{"files" … [line truncated: 4 more bytes on this line] +{"v":1,"verb":"plan-lanes","at":"cee081132","root":".","task":null,"source":"brief","requested":3,"lane_count":3,"claim_key":"path+scope+name","on_conflict":"producing-lane-rebases","corpus":{"files":4825,"symbols":44048,"edges":43566,"ambiguous":3968,"unresolved":19992},"carve":null,"core":{"files" … [line truncated: 4 more bytes on this line] "symbols":[]},"lanes":[{"id":"lane-0","task":"add a --since filter to the doc-drift verb","claims":{"symbols":[{"p":"./src/docdrift.h","n":"recordUnchecked","scope":"docdrift","key":"12641dab14abc8fd","id":"./src/docdrift.h::docdrift::recordUnchecked","id_addressable":true,"id_collides_with":0,"l":2 … [line truncated: 72 more bytes on this line] {"p":"./src/docdrift.h","n":"sortWeakGroupsByPath","scope":"docdrift","key":"1944ba506280ff80","id":"./src/docdrift.h::docdrift::sortWeakGroupsByPath","id_addressable":true,"id_collides_with":0,"l":2401,"ord":0,"overloads":1,"amb":0,"cx":1,"ccx":0,"churn":37,"tested":0}, {"p":"./src/mcpverbs.h","n":"docDriftText","scope":"rw","key":"1fa68e8d93c05a59","id":"./src/mcpverbs.h::rw::docDriftText","id_addressable":true,"id_collides_with":0,"l":687,"ord":0,"overloads":1,"amb":0,"cx":1,"ccx":0,"churn":671,"tested":0}, @@ -3180,7 +3214,7 @@ write regression tests for the new filter {"p":"./src/mcpverbs.h","symbols":2,"churn":671,"ccx":2,"hotspot_rank":4}, {"p":"./src/recall.h","symbols":1,"churn":49,"ccx":4,"hotspot_rank":45}, {"p":"./src/verbs_change.h","symbols":1,"churn":92,"ccx":4,"hotspot_rank":33}], -"symbols_total":4240,"symbols_capped":true},"blast_radius":{"reaches":27,"files_total":8,"capped":false,"files":["./src/docdrift.h","./src/fordocbody.h","./src/main.cpp","./src/mcp.h","./src/mcpserver.h","./src/mcpverbs.h","./src/recall.h","./src/verbs_for.h"]},"tests_to_run":[], +"symbols_total":4242,"symbols_capped":true},"blast_radius":{"reaches":27,"files_total":8,"capped":false,"files":["./src/docdrift.h","./src/fordocbody.h","./src/main.cpp","./src/mcp.h","./src/mcpserver.h","./src/mcpverbs.h","./src/recall.h","./src/verbs_for.h"]},"tests_to_run":[], "tests_total":0,"tests_capped":false,"tests_granularity":"claimed-symbols","untested":27,"module_span":5,"notes":[], "execution":{"policy":"codex-lane/v1","model":"gpt-5.6-sol","reasoning":"xhigh","rule":"wide-contract-work","basis":"structural-only","signals":{"claims":12,"files":5,"module_span":5,"max_ccx":38,"sum_ccx":70,"ambiguous_calls":14,"blast_reaches":27,"contract_touches":1,"conflicts":0,"untested":27,"t … [line truncated: 139 more bytes on this line] {"id":"lane-1","task":"add the CLI parse arm and help text for the new filter","claims":{"symbols":[{"p":"./scripts/optremarks.py","n":"main","scope":"","key":"01b3b880f77d1512","id":null,"id_addressable":false,"id_collides_with":186,"l":286,"ord":0,"overloads":1,"amb":0,"cx":23,"ccx":31,"churn":19, … [line truncated: 12 more bytes on this line] @@ -3275,9 +3309,11 @@ ripwire: --layout: 'Lang' is an enum, --layout models structs (a scoped/unscoped *Which of this repo's doc claims are now false. CHANGED: row attribute at= renamed to tgt= (at= is now only the root sha stamp).* +**wall time: 1.61s** + ````` - +
@@ -3297,8 +3333,8 @@ ripwire: --layout: 'Lang' is an enum, --layout models structs (a scoped/unscoped - - + + @@ -3313,9 +3349,11 @@ ripwire: --layout: 'Lang' is an enum, --layout models structs (a scoped/unscoped *The finishable to-do list: docs whose LIVE failing anchors a date-stamp would reclassify.* +**wall time: 1.49s** + ````` - + @@ -3335,8 +3373,8 @@ ripwire: --layout: 'Lang' is an enum, --layout models structs (a scoped/unscoped - - + + @@ -3383,8 +3421,8 @@ Tail of the same output — the `` section: ````` - - + + @@ -3404,8 +3442,8 @@ Tail of the same output — the `` section: - - + + @@ -3425,8 +3463,8 @@ Input file: AddressSanitizer:DEADLYSIGNAL ================================================================= ==41337==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000018 (pc 0x000102f4a1c8 bp 0x00016d2f1a40 sp 0x00016d2f19e0 T0) - #0 0x102f4a1c8 in rw::rankGraphTeleport(Graph const&, std::vector const&, float) src/graph.h:14923 - #1 0x102f3e884 in rw::rankGraph(Graph const&, float) src/graph.h:14966 + #0 0x102f4a1c8 in rw::rankGraphTeleport(Graph const&, std::vector const&, float) src/graph.h:14932 + #1 0x102f3e884 in rw::rankGraph(Graph const&, float) src/graph.h:14975 #2 0x102e11f30 in runDefaultMap(MainDispatch const&) src/main.cpp:1759 #3 0x102e01a44 in main src/main.cpp:4511 #4 0x1a2b3c0dc in start+0x9dc (dyld:arm64e+0x60dc) @@ -3434,25 +3472,25 @@ AddressSanitizer:DEADLYSIGNAL ````` ````` - + - - + + - + PageRank with an explicit teleport / personalization vector p (Σp = 1). The prior is name-quality-biased through biasPrior() so all rank modes share one weighting seam; the transition matrix (edgesinline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>&am … [line truncated: 31 more bytes on this line] - + uniform-teleport PageRank (the default). A kRankFlagNotNamed unit (model.h) has no edge and a 0 prior weight, so the uniform share is over the ranked nodes: every other node's teleport is the value itinline RankedGraph rankGraph( const Graph& g, float alpha = 0.85f ) int runDefaultMap( const MainDispatch& d ) int main( int argc, char** argv ) - + & p, float alpha = 0.85f ) { PROFILE_SCOPE_DESCRIBE( "rankGraph: PageRank (power iteration)" ); @@ -3570,10 +3608,10 @@ AddressSanitizer:DEADLYSIGNAL *Task lens + a compact Mermaid flowchart of the top anchors' 1-hop edges.* -**wall time: 1.53s** +**wall time: 1.03s** ````` - + @@ -3584,14 +3622,14 @@ AddressSanitizer:DEADLYSIGNAL The PageRank power iteration itself — the numeric kernel every ranked document's order comes f…PageRankRun pageRankDouble( const sparseCsr<float>& inEdges, std::span<const double> weightedOutDegree, std::span<const double> teleport, std::span<double> r … [line truncated: 10 more bytes on this line] inline std::string rankByText( const std::string& root, std::string_view mode, int topK, bool stable = false ) -struct RankedGraph +struct RankedGraph inline constexpr const char* kChurnRankLegend = "<!-- rank_by=churn: k= is PageRank re-run with the teleport BIASED by git CHANGE-FREQUENCY over window= " "(a c… inline std::uint32_t sliceRdIterationCeiling() noexcept struct PageRankRun Render one form of the disclosure. Empty string whenever there is nothing to say — no power it…inline std::string renderDisclosure( const RankDisclosure& d, DiscloseAs as ) -inline std::uint32_t navRelevanceWeight( const Graph& g, NodeId n ) noexcept -inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>& p, float alpha = 0.85f ) +inline std::uint32_t navRelevanceWeight( const Graph& g, NodeId n ) noexcept +inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>& p, float alpha = 0.85f ) inline constexpr std::string_view kPowerShellPathPrependScope = "in PowerShell, for this window @@ -3610,7 +3648,7 @@ AddressSanitizer:DEADLYSIGNAL *Per-file metrics as CodeCharta cc.json.* -**wall time: 1.74s** +**wall time: 1.95s** ````` (empty) @@ -3619,7 +3657,7 @@ AddressSanitizer:DEADLYSIGNAL Artifact written: ````` - 737942 /aux/ripwire2.cc.json + 738223 /aux/ripwire2.cc.json {"projectName":"project","apiVersion":"1.3","attributeDescriptors":{"loc":{"title":"Lines of Code","description":"Physical line count","direction":-1},"symbols":{"title":"Symbols","description":"Definitions in the file","direction":-1},"cx":{"title":"Cyclomatic Complexity","description":"Sum of per-symbol cyclomatic complexity","direction":-1},"cognitive_cx":{"title":"Cognitive Complexity","descri ````` @@ -3627,7 +3665,7 @@ Artifact written: *One-turn sweep: 4 newline-delimited verb:arg sub-queries answered in ONE deduped .* -**wall time: 2.67s** +**wall time: 1.93s** Input file: @@ -3642,7 +3680,7 @@ lego:Vehicle - + @@ -3681,17 +3719,17 @@ lego:Vehicle *Environment self-check: binary staleness, grammars, cache dir, git, tracked-binary staleness — exit 1 when any check fails (here: the PATH install is older than ./build).* -**exit code: 1** — **wall time: 11.77s** +**exit code: 1** — **wall time: 7.52s** ````` - - + - - + + - + @@ -3744,15 +3782,15 @@ ripwire scan: 0 finding(s) total (26 skill file(s) scanned, 0 unscannable file(s *Rank by git change-frequency prior instead of PageRank.* -**wall time: 2.66s** +**wall time: 2.31s** ````` - - + + @@ -3773,30 +3811,30 @@ ripwire scan: 0 finding(s) total (26 skill file(s) scanned, 0 unscannable file(s ````` -## `./build/ripwire . --rank-by=churn-decay --since=HEAD~5 --exclude=test --exclude=docs --exclude=skills --exclude=changelog.d --in=src --limit=3` +## `./build/ripwire . --rank-by=churn-decay --since=HEAD~7 --exclude=test --exclude=docs --exclude=skills --exclude=changelog.d --in=src --limit=3` *Scope the recent-changes answer to ONE directory. The global block stays byte-identical, a second page follows it — n=/of= are its counts (of= IS the total, so the paging half carries no total=), capped="1" has_more="1" next_offset= offset= limit= page it, and next= replays THIS run's own corpus flags (--since/--exclude) so the page it names is a page of the same answer. The symbol map collapses to a disclosed stub — the map was not asked for and was not ranked at all, which is why the header carries no pr_iters=. merge_bombs_skipped= stays on the global block: it counts the window's skipped commits, not the directory's.* -**wall time: 2.52s** +**wall time: 1.67s** ````` - - + + - - - + + + - + - - + + - + ````` @@ -3822,15 +3860,15 @@ ripwire: --rank-by: unknown value 'bogus' (supported: pagerank|authority|hub|rrf ````` - + 0=src/mcpindex.h 1=src/graph.h 2=src/eval.h 3=src/main.cpp 0,1,1,2,3,3,3 getIndex,rankGraph,anchoredLexicalRank,runEval,churnDecayRanking,churnRankedGraph,runDefaultMap -1224,14964,15634,171,1431,1470,1757 +1224,14973,15643,171,1431,1470,1757 fn,fn,fn,fn,fn,fn,fn 0,0,0,0,0,0,0 -1340,14968,15685,328,1445,1484 1485 1499,1877 +1340,14977,15694,328,1445,1484 1485 1499,1877 ````` @@ -3839,24 +3877,24 @@ ripwire: --rank-by: unknown value 'bogus' (supported: pagerank|authority|hub|rrf *Flat top-K export for an external reranker.* -**wall time: 1.27s** +**wall time: 1.66s** ````` - - + + inline std::string spanTierMemoPath( const std::string& diskPath ) - + inline std::vector<std::vector<NodeId>> legoImplementorsOnSurface( const IngestResult& ing, const std::vector<std::vector<NodeId>>& implementors, const std::vector<NodeId>& surfaceIds ) - + ### See the map — not just the numbers - + inline std::string receiptNextFor( const std::string& fileIdentity, const std::string& symbolName, const std::string& foldJson, const std::string& firstTestRun ) - + AncestorCacheScope( TSNode root, bool enabled ) : previous( tAncestorCache ) @@ -3883,9 +3921,9 @@ ripwire: --format: unknown value 'bogus' (supported: xml|columnar|rows|candidate *Machine-parseable JSON, same content, keys mirror the XML attrs.* ````` -{"of":"rankGraphTeleport","defs":1,"count":7,"root":".","hop_tested":0,"hop_untested":7,"graph_ambiguous":3967,"graph_unresolved":19988,"graph_unindexed":313,"counts_floor":true,"callers":[{"t":"fn","n":"getIndex","p":"src/mcpindex.h:1224","sites_at":["1340"]}, -{"t":"fn","n":"rankGraph","p":"src/graph.h:14964","sites_at":["14968"]}, -{"t":"fn","n":"anchoredLexicalRank","p":"src/graph.h:15634","sites_at":["15685"]}, +{"of":"rankGraphTeleport","defs":1,"count":7,"root":".","hop_tested":0,"hop_untested":7,"graph_ambiguous":3968,"graph_unresolved":19992,"graph_unindexed":313,"counts_floor":true,"callers":[{"t":"fn","n":"getIndex","p":"src/mcpindex.h:1224","sites_at":["1340"]}, +{"t":"fn","n":"rankGraph","p":"src/graph.h:14973","sites_at":["14977"]}, +{"t":"fn","n":"anchoredLexicalRank","p":"src/graph.h:15643","sites_at":["15694"]}, {"t":"fn","n":"runEval","p":"src/eval.h:171","sites_at":["328"]}, {"t":"fn","n":"churnDecayRanking","p":"src/main.cpp:1431","sites_at":["1445"]}, {"t":"fn","n":"churnRankedGraph","p":"src/main.cpp:1470","sites_at":["1484","1485","1499"]}, @@ -3912,12 +3950,12 @@ ripwire: --json is not yet supported for --hotspots — supported: the default m *Pagination: 3 items, skipping the first 3 (deterministic seams).* -**wall time: 2.89s** +**wall time: 2.45s** ````` - + @@ -3928,12 +3966,14 @@ ripwire: --json is not yet supported for --hotspots — supported: the default m *Drop test paths from the corpus before ranking.* +**wall time: 1.17s** + ````` - + - - + + @@ -3945,21 +3985,21 @@ ripwire: --json is not yet supported for --hotspots — supported: the default m + + + - + - + - - - -… [85 more display lines; full output is 9850 bytes on 1 raw line(s)] +… [88 more display lines; full output is 9834 bytes on 1 raw line(s)] ````` stderr: @@ -3972,14 +4012,14 @@ stderr: *Drop matching paths (repeatable) before ranking.* -**wall time: 2.22s** +**wall time: 2.07s** ````` - + @@ -3998,7 +4038,7 @@ stderr: - + @@ -4012,15 +4052,15 @@ stderr: *Full map re-ranked with teleport toward git-changed files — clean tree, so changed=0 and it degrades to the plain map.* -**wall time: 2.24s** +**wall time: 3.84s** ````` - - + + @@ -4051,14 +4091,14 @@ stderr: *Force a cold parse (bypass the warm TMPDIR cache) — shows the cold-vs-warm cost.* -**wall time: 4.09s** +**wall time: 4.04s** ````` - + @@ -4072,7 +4112,7 @@ stderr: - + @@ -4091,14 +4131,14 @@ stderr: *Explicit incremental cache at a path OUTSIDE the repo (first call writes it).* -**wall time: 5.00s** +**wall time: 6.20s** ````` - + @@ -4112,7 +4152,7 @@ stderr: - + @@ -4130,21 +4170,21 @@ stderr: Artifact written: ````` - 39764763 /aux/warm2.ripwirecache + 39772479 /aux/warm2.ripwirecache ````` ## `./build/ripwire . --max-file-size=8K --top-k=3` *Skip files above a size bound before parsing (note the corpus shrink in the header).* -**wall time: 1.30s** +**wall time: 3.05s** ````` - + @@ -4158,7 +4198,7 @@ Artifact written: - + @@ -4167,7 +4207,7 @@ Artifact written: - + … [20 more display lines; full output is 4971 bytes on 1 raw line(s)] @@ -4193,14 +4233,14 @@ ripwire: --scip=does_not_exist.scip: cannot open the index — refusing rather t *Multi-root workspace: ONE merged graph over two roots, paths labeled /.* -**wall time: 4.33s** +**wall time: 7.57s** ````` - + @@ -4228,19 +4268,19 @@ ripwire: --scip=does_not_exist.scip: cannot open the index — refusing rather t *Self-eval: co-change recall vs BM25.* -**wall time: 31.52s** +**wall time: 42.42s** ````` ripwire --eval (co-change recovery, averaged over 80 historical commits) ranker recall@5 recall@10 recall@20 - ripwire 13.5% 13.7% 17.3% - BM25 15.3% 17.7% 18.5% - BM25sub 14.6% 17.6% 22.1% - BM25body 8.6% 12.6% 19.9% - fused 12.4% 14.4% 18.9% - anchored 8.6% 12.6% 19.1% + ripwire 15.1% 15.2% 18.9% + BM25 16.6% 18.9% 19.7% + BM25sub 15.6% 17.9% 21.8% + BM25body 8.2% 13.5% 22.1% + fused 13.9% 15.3% 19.8% + anchored 8.2% 13.5% 21.2% same-dir 0.9% 1.4% 1.6% - random 0.1% 0.2% 0.4% <- floor (random ranking over F=4823 files) + random 0.1% 0.2% 0.4% <- floor (random ranking over F=4825 files) note: `ripwire` here is the DEFAULT MAP's structural-only PageRank (importance, not relatedness) — it is NOT what a --for/--query retrieval call ranks with. BM25 / BM25sub / BM25body are QUERY-TIME lexical rankers (whole-name / subtoken / @@ -4256,11 +4296,11 @@ ripwire --eval (co-change recovery, averaged over 80 historical commits) *Known-item retrieval eval: MRR + recall@k per ranker per query mode.* -**wall time: 240.13s** +**wall time: 276.84s** ````` ripwire --eval-retrieval (known-item, 4000 doc-commented symbols; gold is in-corpus by construction) - sample: population=11874 scored=4000 rule=smallest-key CAPPED — a SUBSET, not the population + sample: population=11876 scored=4000 rule=smallest-key CAPPED — a SUBSET, not the population (smallest fnv1a64(scope::name) over the population, cut on the key so an identity is never split; path- and order-independent, but a corpus this size is NOT graded exhaustively — say so when citing it) ingest: lex=rich (persisted subtoken stats; no per-query corpus re-tokenize) @@ -4269,7 +4309,7 @@ ripwire --eval-retrieval (known-item, 4000 doc-commented symbols; gold is in-co subtoken doc-phrase 0.881 85.8% 90.2% 91.3% name-exact name 0.875 79.4% 93.7% 96.1% name-exact doc-phrase 0.008 0.3% 1.1% 1.7% - anchored name 0.662 53.6% 80.9% 86.0% + anchored name 0.662 53.5% 80.9% 85.9% anchored doc-phrase 0.874 84.8% 89.8% 90.5% routed name 0.877 79.6% 93.9% 96.3% routed doc-phrase 0.879 85.7% 89.9% 91.0% @@ -4285,7 +4325,7 @@ ripwire --eval-retrieval (known-item, 4000 doc-commented symbols; gold is in-co *Labelled verdict-accuracy eval for --stray-content — three labels over REAL local refs (names resolved at capture time); exit 3 when accuracy is under the floor. Read got= against v= in the stray-content run: a ref the verb could not analyse (unknown) must never be credited as a merged hit.* -**exit code: 3** — **wall time: 15.58s** +**exit code: 3** — **wall time: 16.97s** Input file: @@ -4315,6 +4355,8 @@ ripwire: warning: --stray-content read the newest 512 of 641 local branches; 129 *Labelled skill-ROUTING eval over the repo's own skills/ directory (4 hand-labelled prompts).* +**wall time: 1.88s** + Input file: ````` @@ -4401,7 +4443,7 @@ Reach for it BEFORE blind grep + whole-file reads. First call ~1s cold; after th *Version + short build info.* ````` -ripwire 0.6.10-dev.99+gd3a73cd6e (dev, AppleClang 21.0.0.21000101, emit=std::print, built_from=d3a73cd6e) +ripwire 0.6.10-dev.104+gcee081132 (dev, AppleClang 21.0.0.21000101, emit=std::print, built_from=cee081132) ````` @@ -4409,27 +4451,31 @@ ripwire 0.6.10-dev.99+gd3a73cd6e (dev, AppleClang 21.0.0.21000101, emit=std::pri # navigate — seeds, claims, slices, shapes -## `./build/ripwire . --at=src/graph.h:14923` +## `./build/ripwire . --at=src/graph.h:14932` *Hold a LOCATION, not a name: the enclosing-definition chain at FILE:LINE (a compiler error, a diff hunk, a stack frame), outermost -> innermost.* +**wall time: 1.04s** + ````` - - + + ````` -## `./build/ripwire . --callers=@src/graph.h:14923` +## `./build/ripwire . --callers=@src/graph.h:14932` *The same seed in a SELECTOR position: @FILE:LINE resolves to the innermost enclosing definition, then --callers runs on it.* +**wall time: 1.06s** + ````` - + - - + + @@ -4450,18 +4496,20 @@ ripwire 0.6.10-dev.99+gd3a73cd6e (dev, AppleClang 21.0.0.21000101, emit=std::pri stderr: ````` -ripwire: the at flag's seed 'src/graph.h:999999' named no location (./src/graph.h has only 21356 lines — the seed asked for line 999999) +ripwire: the at flag's seed 'src/graph.h:999999' named no location (./src/graph.h has only 21365 lines — the seed asked for line 999999) ````` ## `./build/ripwire . --verify="calls(runDefaultMap, rankGraphTeleport)"` *VERIFY a closed claim in one call: three-valued verdict (confirmed / refuted / not-established) with the evidence rows inline.* +**wall time: 1.26s** + ````` - + - + ````` @@ -4471,10 +4519,10 @@ ripwire: the at flag's seed 'src/graph.h:999999' named no location (./src/graph. ````` - + - - + + @@ -4488,8 +4536,6 @@ ripwire: the at flag's seed 'src/graph.h:999999' named no location (./src/graph. *A literal-scan absence: refuted only with complete= evidence, never on a partial scan.* -**wall time: 1.02s** - ````` @@ -4516,25 +4562,25 @@ ripwire: --verify claim not recognized: 'frobnicate(x)' — unknown shape word. *Bare --slice=SYM: the INVENTORY of sliceable locals (), so a caller can pick VAR.* -**wall time: 1.15s** +**wall time: 2.70s** ````` - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + ````` @@ -4542,21 +4588,21 @@ ripwire: --verify claim not recognized: 'frobnicate(x)' — unknown shape word. *Intra-procedural def-use slice of ONE variable: one row per line touching it, k=def|use|both, reaching definitions flow-sensitive (reach=cfg).* -**wall time: 1.73s** +**wall time: 2.80s** ````` - - + + - + teleport( pw.begin(), pw.end() );]]> - + - + @@ -4566,30 +4612,30 @@ ripwire: --verify claim not recognized: 'frobnicate(x)' — unknown shape word. *TRANSITIVE backward value-flow from the seed variable, bounded BFS (depth= disclosed; a cut frontier says flow_truncated=1).* -**wall time: 1.40s** +**wall time: 4.11s** ````` - - + + - + teleport( pw.begin(), pw.end() );]]> - + - + - + pw = biasPrior( g, p );]]> - + & p, float alpha = 0.85f )]]> - + & p, float alpha = 0.85f )]]> @@ -4599,42 +4645,42 @@ ripwire: --verify claim not recognized: 'frobnicate(x)' — unknown shape word. *Forward flow: which statements the seed's value reaches, at the default depth bound.* -**wall time: 1.56s** +**wall time: 3.82s** ````` - - + + - + teleport( pw.begin(), pw.end() );]]> - + - + - + - + - + - + - + 0.0 )]]> - + - + @@ -4676,21 +4722,21 @@ ripwire: --slice-depth bounds the --slice-flow BFS — pass both (e.g. ripwire < *The compact legend posture: rows byte-identical, a versioned schema id replaces the repeated explanatory prose — for a many-small-calls loop.* -**wall time: 1.53s** +**wall time: 2.24s** ````` - - + + - + teleport( pw.begin(), pw.end() );]]> - + - + @@ -4700,12 +4746,12 @@ ripwire: --slice-depth bounds the --slice-flow BFS — pass both (e.g. ripwire < *Structural search written in CODE: $NAME binds one node; grammars=/shapes= disclose what the pattern became per grammar (a 3-argument call shape — the 2-argument spelling has no call site in this repo and correctly reports hits=0).* -**wall time: 5.83s** +**wall time: 2.73s** ````` rankGraphTeleport( g, std::vector<float>( N, ranked ? 1.0f / float( ranked ) : 0.f ), alpha ) +rankGraphTeleport( g, std::vector<float>( N, ranked ? 1.0f / float( ranked ) : 0.f ), alpha ) ````` @@ -4713,7 +4759,7 @@ ripwire: --slice-depth bounds the --slice-flow BFS — pass both (e.g. ripwire < *The ellipsis form over a macro-shaped call site; unsupported= names the families this verb does not serve.* -**wall time: 4.19s** +**wall time: 2.44s** ````` @@ -4753,7 +4799,7 @@ ripwire: --slice-depth bounds the --slice-flow BFS — pass both (e.g. ripwire < *A pattern that collapses to a bare token is REFUSED — never reported as hits=0.* -**exit code: 1** +**exit code: 1** — **wall time: 1.40s** ````` (empty) @@ -4769,7 +4815,7 @@ ripwire: --pattern: this pattern collapses to a single bare token, which is a TE *Boolean grep: hits where BOTH literals share the matched line (--grep-scope=line is the default).* -**wall time: 1.06s** +**wall time: 2.15s** ````` @@ -5048,17 +5094,17 @@ ripwire: --grep given twice; did you mean --grep='A' --and='B'? -… [242 more display lines; full output is 26766 bytes on 44 raw line(s)] +… [242 more display lines; full output is 26761 bytes on 44 raw line(s)] ````` ## `./build/ripwire . --for="tree-sitter parse of a source file" --sections=lego,compose` *Restore the / sections the --for bundle collapses to a counted stub by default (this is the stub's own next= spelling).* -**wall time: 4.37s** +**wall time: 6.98s** ````` - + @@ -5088,17 +5134,17 @@ ripwire: --grep given twice; did you mean --grep='A' --and='B'? -… [264 more display lines; full output is 28136 bytes on 44 raw line(s)] +… [264 more display lines; full output is 28131 bytes on 44 raw line(s)] ````` ## `./build/ripwire . --for="tree-sitter parse of a source file" --auto-bodies` *Opt OUT of compact conceptual serving: restore the rank-first auto walk (bundle="auto").* -**wall time: 4.30s** +**wall time: 5.05s** ````` - + @@ -5128,17 +5174,17 @@ ripwire: --grep given twice; did you mean --grep='A' --and='B'? -… [272 more display lines; full output is 28550 bytes on 96 raw line(s)] +… [272 more display lines; full output is 28545 bytes on 96 raw line(s)] ````` ## `./build/ripwire . --for="quality delta acks ledger rubber stamp"` *Doc-mention surfacing (default ON): a markdown doc naming a top-resolved symbol in a backtick rides in below that symbol — the legend's [doc mentions: …] clause says it fired.* -**wall time: 4.28s** +**wall time: 8.39s** ````` - + @@ -5175,10 +5221,10 @@ ripwire: --grep given twice; did you mean --grep='A' --and='B'? *The same task with doc-mention surfacing OFF — the contrast the flag exists for (no [doc mentions] clause, one fewer row).* -**wall time: 3.45s** +**wall time: 9.25s** ````` - + @@ -5215,14 +5261,12 @@ ripwire: --grep given twice; did you mean --grep='A' --and='B'? *"Can I delete this?" — callers + transitive impact + every use site + how much of the radius is tested, composed in ONE call; risk= names what was found, never a verdict.* -**wall time: 2.79s** - ````` - - - + + @@ -5234,7 +5278,7 @@ ripwire: --grep given twice; did you mean --grep='A' --and='B'? *Unknown-symbol refusal shape for --safe-delete.* -**exit code: 1** — **wall time: 2.67s** +**exit code: 1** — **wall time: 1.20s** ````` (empty) @@ -5250,22 +5294,22 @@ ripwire: --safe-delete symbol not found: DoesNotExist (note: the lexical definit *The continuation packet for the NEXT session: disk truth (branch/sha, changed symbols, blast radius, tests) + labeled suggestions. Recorded against a CLEAN tree.* -**wall time: 15.07s** +**wall time: 16.31s** ````` - + - + - - - + + + + ````` @@ -5274,16 +5318,16 @@ ripwire: --safe-delete symbol not found: DoesNotExist (note: the lexical definit *The same packet under a hard ceiling: heuristic rows drop tail-first (withheld= disclosed), verified rows never drop.* -**wall time: 2.97s** +**wall time: 7.91s** ````` - + - + @@ -5325,21 +5369,21 @@ ripwire: --safe-delete symbol not found: DoesNotExist (note: the lexical definit -… [563 more display lines; full output is 59670 bytes on 1 raw line(s)] +… [564 more display lines; full output is 59733 bytes on 1 raw line(s)] ````` ## `./build/ripwire . --no-ignore --top-k=3` *Crawl paths the repo's own .gitignore covers (default honours it and discloses ignored_files=/ignored_dirs= only when it dropped anything — this repo's crawl drops nothing, so the header is identical to the default map's; --skipped's ignore_mode= says which rule applied).* -**wall time: 1.06s** +**wall time: 2.20s** ````` - + @@ -5353,7 +5397,7 @@ ripwire: --safe-delete symbol not found: DoesNotExist (note: the lexical definit - + @@ -5377,7 +5421,7 @@ ripwire: --safe-delete symbol not found: DoesNotExist (note: the lexical definit - + @@ -5391,7 +5435,7 @@ ripwire: --safe-delete symbol not found: DoesNotExist (note: the lexical definit - + @@ -5419,15 +5463,15 @@ ripwire: --no-stable is read only by --mcp/--listen (it opts out of the stable o **exit code: 4** ````` - + - + const&, float) src/graph.h:14923 - #1 0x102f3e884 in rw::rankGraph(Graph const&, float) src/graph.h:14966 + #0 0x102f4a1c8 in rw::rankGraphTeleport(Graph const&, std::vector const&, float) src/graph.h:14932 + #1 0x102f3e884 in rw::rankGraph(Graph const&, float) src/graph.h:14975 #2 0x102e11f30 in runDefaultMap(MainDispatch const&) src/main.cpp:1759 #3 0x102e01a44 in main src/main.cpp:4511 #4 0x1a2b3c0dc in start+0x9dc (dyld:arm64e+0x60dc)]]> r( N, 0.f ); std::transform( rankDouble.begin(), rankDouble.end(), r.begin(), []( double value ) { return float( value ); } ); return { std::move( r ), run.iterationCount, run.hasConverged }; -}]]>inline std::vector<float> biasPrior( const Graph& g, const std::vector<float>& p )#define PROFILE_SCOPE_DESCRIBE( desc )inline std::vector<float> biasPrior( const Graph& g, const std::vector<float>& p )#define PROFILE_SCOPE_DESCRIBE( desc ) - + ````` @@ -5476,7 +5522,7 @@ ripwire: --no-stable is read only by --mcp/--listen (it opts out of the stable o *A command still running at the cap: its process group is killed and the run reports timed_out=1 — an honest timeout, never an empty success.* -**exit code: 4** — **wall time: 2.17s** +**exit code: 4** — **wall time: 2.33s** ````` @@ -5516,21 +5562,21 @@ ripwire: --run-timeout=SECONDS modifies --run-trace — pass it too (e.g. ripwir *THE single wide-angle quality read: six families in one pass, an eligible/ranked shortlist rather than a firehose.* -**wall time: 6.93s** +**wall time: 9.99s** ````` - - + - + @@ -5558,8 +5604,8 @@ ripwire: --run-timeout=SECONDS modifies --run-trace — pass it too (e.g. ripwir ````` - - + + @@ -5576,7 +5622,7 @@ ripwire: --run-timeout=SECONDS modifies --run-trace — pass it too (e.g. ripwir ````` - + @@ -5594,7 +5640,7 @@ ripwire: --run-timeout=SECONDS modifies --run-trace — pass it too (e.g. ripwir ````` - @@ -5605,7 +5651,7 @@ ripwire: --run-timeout=SECONDS modifies --run-trace — pass it too (e.g. ripwir - + @@ -5630,11 +5676,11 @@ ripwire: --run-timeout=SECONDS modifies --run-trace — pass it too (e.g. ripwir *Per function, the non-local MUTABLE state it can reach (transitively), most writes first — unsound by construction, and the legend says where.* -**wall time: 3.02s** +**wall time: 3.55s** ````` - @@ -5670,11 +5716,11 @@ ripwire: --run-timeout=SECONDS modifies --run-trace — pass it too (e.g. ripwir *The family join: per function, which of four orthogonal evidence families fire, ranked by how many agree.* -**wall time: 5.12s** +**wall time: 6.52s** ````` - @@ -5710,11 +5756,11 @@ ripwire: --run-timeout=SECONDS modifies --run-trace — pass it too (e.g. ripwir *The cache-locality lens over every aggregate: fields READ TOGETHER but declared FAR APART (split-line / straddle findings, Chilimbi separation weight) — advice only, never a rewrite.* -**wall time: 2.31s** +**wall time: 1.54s** ````` - @@ -5750,11 +5796,11 @@ ripwire: --run-timeout=SECONDS modifies --run-trace — pass it too (e.g. ripwir *The same lens narrowed to ONE struct — the one --layout=Symbol shows the offsets for.* -**wall time: 2.13s** +**wall time: 1.52s** ````` - @@ -5777,10 +5823,12 @@ ripwire: --run-timeout=SECONDS modifies --run-trace — pass it too (e.g. ripwir *The corpus's OWN case-convention vote per (language, kind) group; off-convention names get a mechanical propose= (a suggestion, never a blind rename).* +**wall time: 1.60s** + ````` - - + + @@ -5815,11 +5863,11 @@ ripwire: --run-timeout=SECONDS modifies --run-trace — pass it too (e.g. ripwir *Score the naming-* rules against this repo's own rename history: proxy=old/(old+new) per rule, 0.50 = chance; read pairs= (sample size) first.* -**wall time: 33.15s** +**wall time: 27.16s** ````` - + @@ -5852,11 +5900,11 @@ ripwire: --run-timeout=SECONDS modifies --run-trace — pass it too (e.g. ripwir *The opt-in --lint modifier: naming predicates over LOCAL variable names too, C/C++ only, only inside functions already past a size/complexity gate.* -**wall time: 5.76s** +**wall time: 5.93s** ````` - + @@ -5872,7 +5920,7 @@ ripwire: --run-timeout=SECONDS modifies --run-trace — pass it too (e.g. ripwir - + @@ -5968,7 +6016,7 @@ ripwire.path/v1 : one DIRECTED call path from= to to=, each a *Run ONLY one rule family; the root carries selected="K of N" so a filtered zero is never confusable with an unfiltered one.* -**wall time: 2.87s** +**wall time: 3.16s** ````` @@ -6008,7 +6056,7 @@ ripwire.path/v1 : one DIRECTED call path from= to to=, each a *DROP two families, applied after selection; the raw select=/ignore= you passed rides on the root.* -**wall time: 2.35s** +**wall time: 4.99s** ````` @@ -6048,7 +6096,7 @@ ripwire.path/v1 : one DIRECTED call path from= to to=, each a *A rule that spends its own match budget (here 4, set BELOW the default 5000 so the floor shows on this repo): goto carries count_capped="1", its count= is a FLOOR, and the root names the call that counts the rest — findings_next= re-runs only the floored rules under a 10x budget.* -**wall time: 2.66s** +**wall time: 4.01s** ````` @@ -6065,7 +6113,7 @@ ripwire.path/v1 : one DIRECTED call path from= to to=, each a *Pasting that findings_next=: the same rule under a 10x budget counts its true total — no count_capped=, no findings_next=.* -**wall time: 3.89s** +**wall time: 4.47s** ````` @@ -6095,7 +6143,7 @@ ripwire.path/v1 : one DIRECTED call path from= to to=, each a *An unresolvable PREFIX refuses (exit 1) with a did-you-mean from a real edit distance (one character off cache-).* -**exit code: 1** — **wall time: 4.22s** +**exit code: 1** — **wall time: 3.27s** ````` (empty) @@ -6111,7 +6159,7 @@ ripwire: --lint-select: 'cach-' matches no rule or family (did you mean 'cache-' *A PREFIX with no near miss at all: the refusal points at --lint-catalog instead of guessing.* -**exit code: 1** — **wall time: 4.08s** +**exit code: 1** — **wall time: 3.00s** ````` (empty) @@ -6127,7 +6175,7 @@ ripwire: --lint-select: 'nosuchfamily' matches no rule or family — see --lint- *The SAME findings as SARIF 2.1.0 (what github/codeql-action/upload-sarif consumes) — pure re-serialization, results count == the native run's.* -**wall time: 4.35s** +**wall time: 3.49s** ````` {"version":"2.1.0","$schema":"https://raw.githubusercontent.com/oasis-tcs/sarif-spec/master/Schemata/sarif-schema-2.1.0.json","runs":[{"tool":{"driver":{"name":"ripwire","rules":[{"id":"c-style-cast","shortDescription":{"text":"c-style-cast"},"properties":{"builtin":true,"capped":false,"applicable": … [line truncated: 7 more bytes on this line] @@ -6160,13 +6208,13 @@ ripwire: --lint-select: 'nosuchfamily' matches no rule or family — see --lint- {"id":"atom-nested-ternary","shortDescription":{"text":"atom-nested-ternary"},"properties":{"builtin":true,"capped":false,"applicable":true}}, {"id":"atom-implicit-predicate","shortDescription":{"text":"atom-implicit-predicate"},"properties":{"builtin":true,"capped":false,"applicable":true}}, {"id":"atom-octal-literal","shortDescription":{"text":"atom-octal-literal"},"properties":{"builtin":true,"capped":false,"applicable":true}}, -… [17029 more display lines; full output is 2417689 bytes on 1 raw line(s)] +… [17033 more display lines; full output is 2418273 bytes on 1 raw line(s)] ````` Parsed summary of the same SARIF (past the display cut): ````` -sarif 2.1.0 rules= 39 results= 8510 +sarif 2.1.0 rules= 39 results= 8512 ````` ## `./build/ripwire . --lint --sarif --limit=5` @@ -6189,11 +6237,11 @@ ripwire: --sarif always emits the full result set — drop --limit=N/--offset=M *The Delta Maintainability Model scalar for the WORKING TREE vs HEAD — recorded against a CLEAN tree (the sandbox section shows a real delta). UNAVAILABLE is a stated reason, never 0 or 1.* -**wall time: 10.92s** +**wall time: 8.25s** ````` -

@@ -6204,14 +6252,14 @@ ripwire: --sarif always emits the full result set — drop --limit=N/--offset=M *The per-commit scalar: HEAD vs its first parent, with the three separately actionable sub-scores.* -**wall time: 17.51s** +**wall time: 17.69s** ````` - - -

-

+ + +

+

````` @@ -6219,14 +6267,14 @@ ripwire: --sarif always emits the full result set — drop --limit=N/--offset=M *The range form: tree HEAD vs tree HEAD~3.* -**wall time: 22.42s** +**wall time: 18.24s** ````` - -

-

+ +

+

````` @@ -6234,11 +6282,11 @@ ripwire: --sarif always emits the full result set — drop --limit=N/--offset=M *Modularity-violation GROUPS instead of pairs: "X co-changes with {A,B,C}, none of which it depends on" — a greedy cover, disclosed as greedy.* -**wall time: 8.14s** +**wall time: 4.03s** ````` - + @@ -6274,41 +6322,41 @@ ripwire: --sarif always emits the full result set — drop --limit=N/--offset=M *Only pairs whose co-change RECURS in 2+ sub-windows of the mined window (sub_windows= is the denominator) — a one-off sprint stops reading like a structural defect.* -**wall time: 3.52s** +**wall time: 5.41s** ````` - + - - - - + + + + - + - - + + - + + - ````` @@ -6316,7 +6364,7 @@ ripwire: --sarif always emits the full result set — drop --limit=N/--offset=M *The HTML graph with the initial colour mode set to community (the page embeds all five modes and keeps a live selector).* -**wall time: 3.14s** +**wall time: 4.39s** ````` (empty) @@ -6325,14 +6373,14 @@ ripwire: --sarif always emits the full result set — drop --limit=N/--offset=M Artifact written: ````` - 155139 /aux/map2.html + 155140 /aux/map2.html ````` ## `./build/ripwire . --index-out=/aux/ci_index` *CI generate-and-exit: cold-parse and write BOTH committable cache families (lean + rich), no map on stdout.* -**wall time: 9.85s** +**wall time: 6.83s** ````` (empty) @@ -6341,30 +6389,30 @@ Artifact written: stderr: ````` -ripwire: --index-out wrote /aux/ci_index.lean.ripwirecache (39764763 bytes, lean family) -ripwire: --index-out wrote /aux/ci_index.rich.ripwirecache (80224391 bytes, rich family) +ripwire: --index-out wrote /aux/ci_index.lean.ripwirecache (39772479 bytes, lean family) +ripwire: --index-out wrote /aux/ci_index.rich.ripwirecache (80238101 bytes, rich family) ````` Artifact written: ````` - 39764763 /aux/ci_index.lean.ripwirecache - 80224391 /aux/ci_index.rich.ripwirecache - 119989154 total + 39772479 /aux/ci_index.lean.ripwirecache + 80238101 /aux/ci_index.rich.ripwirecache + 120010580 total ````` ## `./build/ripwire . --cache=/aux/ci_index.lean.ripwirecache --top-k=3` *Consume the lean artifact in a PR job: restore-equivalence, never blob-byte-identity.* -**wall time: 1.71s** +**wall time: 2.59s** ````` - + @@ -6378,7 +6426,7 @@ Artifact written: - + @@ -6397,14 +6445,14 @@ Artifact written: *Eval-only: a per-call-site census of WHICH mechanism resolved each call, and the canonical id of every surviving target.* -**wall time: 1.36s** +**wall time: 3.23s** ````` - + @@ -6418,7 +6466,7 @@ Artifact written: - + @@ -6444,18 +6492,18 @@ Artifact written: # whose template-argument list spans lines keeps its line break as \n instead of splitting the row. # line is the 1-based call-site line in the caller's file (v2, appended LAST so v1 readers are unchanged): # the key a SCIP occurrence joins on, so a coverage loss can be classified per site instead of guessed. - 178596 /aux/pin_census.tsv + 178660 /aux/pin_census.tsv ````` ## `./build/ripwire . --plan-lint=test/planlintfix/wave.md` *The house PLAN/DESIGN format's STRUCTURE check — never semantics; exit 2 when a card or ledger row gates.* -**exit code: 2** — **wall time: 3.04s** +**exit code: 2** — **wall time: 3.06s** ````` - + @@ -6473,11 +6521,11 @@ Artifact written: *The ledger-shaped fixture through the same check (exit 2: one gating card).* -**exit code: 2** +**exit code: 2** — **wall time: 1.60s** ````` - + @@ -6489,17 +6537,17 @@ Artifact written: *--doctor plus a LIVE integration inspection for one agent: PATH binary, installed-skill manifest parity, hook executability, MCP wiring — read-only, fixed repair commands, never config contents; exit 1 when any check fails.* -**exit code: 1** — **wall time: 10.96s** +**exit code: 1** — **wall time: 18.73s** ````` - - + - - + + - + @@ -6536,21 +6584,21 @@ Everything below runs with `cwd` = the throwaway clone at `/dirty` (`gi *Situational report for a real diff: blast radius + tests + co-change + forgotten co-change partners.* -**wall time: 9.50s** +**wall time: 13.33s** ````` ripwire situational-awareness — 1 changed file(s), 13 symbols in them root: . -at: d3a73cd6e+dirty +at: cee081132+dirty change_set: granularity=file changed_symbols=13 file_symbols=13 files_narrowed=0 files_file_granular=1 diff_hunks=7 diff_hunks_located=6 diff_hunks_unlocated=1 — seeds = symbols a diff -U0-vs-HEAD hunk overlaps (function/method body spans only); an unlocated hunk (module-level, deletion, rename) … [line truncated: 34 more bytes on this line] - [1] blast radius: 351 symbols across 79 files transitively depend on these changes (showing 8 of 79 files — shown=8 total=79 capped=1 prcontext_cap=20 (--pr-context's own per-file list is cut at 20 too); next: --situ --limit=79) - counts_floor=1 graph_ambiguous=3967 graph_unresolved=19988 graph_unindexed=313 (files no grammar in this build could read at all) (the map header's own gauges) — every count above is a FLOOR, never a total: call edges are name-based, so dynamic dispatch, callbacks and macros can be missing … [line truncated: 45 more bytes on this line] + [1] blast radius: 356 symbols across 79 files transitively depend on these changes (showing 8 of 79 files — shown=8 total=79 capped=1 prcontext_cap=20 (--pr-context's own per-file list is cut at 20 too); next: --situ --limit=79) + counts_floor=1 graph_ambiguous=3968 graph_unresolved=19992 graph_unindexed=313 (files no grammar in this build could read at all) (the map header's own gauges) — every count above is a FLOOR, never a total: call edges are name-based, so dynamic dispatch, callbacks and macros can be missing … [line truncated: 45 more bytes on this line] src/mcpverbs.h (37 dependent symbols) src/verbs_for.h (27 dependent symbols) src/verbs_quality.h (17 dependent symbols) src/verbs_navigate.h (16 dependent symbols) + src/graph.h (15 dependent symbols) src/quality.h (15 dependent symbols) - src/graph.h (12 dependent symbols) src/forfilesyms.h (11 dependent symbols) src/main.cpp (10 dependent symbols) [2] tests to run (6) order=evidence: [changed] you edited it, [partner] named after a changed file, then hops asc (1 = direct); "(n): a, b" = n runner-less files sharing that evidence; a (run: …) is relative to root: @@ -6560,21 +6608,27 @@ at: d3a73cd6e+dirty test/verify_csr.cpp [hops=2] (run: bash test/a9disclosurecheck.sh) test/includeprecise_unit.cpp [hops=4] (run: bash test/includeprecisecheck.sh) test/rustimport_unit.cpp [hops=4] (run: bash test/rustimportprecisecheck.sh) - script_gates_unmodelled=944 — test/*.sh gates never appear above: script-to-binary edges are not call edges (a path count) - [3] co-change — usually edited with these but NOT in your diff (0) window="18mo@HEAD" commits="7881": - (none — 7881 commits were mined and none co-edited a file outside your diff) + script_gates_unmodelled=945 — test/*.sh gates never appear above: script-to-binary edges are not call edges (a path count) + [3] co-change — usually edited with these but NOT in your diff (0) window="18mo@HEAD" commits="7886": + (none — 7886 commits were mined and none co-edited a file outside your diff) next: --test-gate ````` +stderr: + +````` +ripwire: cache : over its 2048 MiB budget — evicted 13 blob(s) of other roots or other ripwire builds (this build's blobs for this root are kept) +````` + ## `./build/ripwire . --test-gate` *The pre-PR gate with real obligations — exit 4 when tests-to-run or untested blast radius is non-empty.* -**exit code: 4** — **wall time: 8.73s** +**exit code: 4** — **wall time: 10.37s** ````` - @@ -6613,11 +6667,11 @@ at: d3a73cd6e+dirty *Every row carries p="file:line", the gating rows are marked gating="1" and now bar= (the threshold each numeric row is judged against), and the exit-2 refusal prints a naming line on stderr; a gating row carries a pasteable next=.* -**exit code: 2** — **wall time: 41.09s** +**exit code: 2** — **wall time: 52.73s** ````` - @@ -6660,11 +6714,11 @@ ripwire: --quality-delta gating: 5 preexisting-worse major finding(s); first: ap *The same gating report under --legend=full — same rows, same exit 2; the default compact comment (schema="ripwire.quality-delta/v1", the shape an agent's edit loop should run) becomes ~4 KB of prose legend.* -**exit code: 2** — **wall time: 17.28s** +**exit code: 2** — **wall time: 18.59s** ````` - @@ -6707,10 +6761,10 @@ ripwire: --quality-delta gating: 5 preexisting-worse major finding(s); first: ap *The same findings as JSON (one of the CI/scripting verbs --json supports) — same exit 2 as the XML form.* -**exit code: 2** — **wall time: 20.61s** +**exit code: 2** — **wall time: 19.83s** ````` -{"baseline":"git-HEAD","regressions":9,"minor":1,"acked":0,"stale":179,"preexisting-worse":6,"new-symbol":3,"gating":5,"register-macro-excluded":63,"api-new-surface":2,"at":"d3a73cd6e+dirty","renames":68,"rename_window_commits":400,"acked_by_rename":0,"acked_by_content":0,"renames_window_truncated": … [line truncated: 240 more bytes on this line] +{"baseline":"git-HEAD","regressions":9,"minor":1,"acked":0,"stale":179,"preexisting-worse":6,"new-symbol":3,"gating":5,"register-macro-excluded":63,"api-new-surface":2,"at":"cee081132+dirty","renames":68,"rename_window_commits":400,"acked_by_rename":0,"acked_by_content":0,"renames_window_truncated": … [line truncated: 240 more bytes on this line] {"kind":"complexity","sym":"src/infra/sortutil.h::rw::sortutil::lessByScoreDescId","was":1,"now":67,"p":"src/infra/sortutil.h:52","gating":true}, {"kind":"dead-code","sym":"src/infra/sortutil.h::rw::sortutil::nonNegativeFloatAscKeyCopy","p":"src/infra/sortutil.h:122","origin":"new-symbol"}, {"kind":"dead-code","sym":"src/infra/sortutil.h::rw::sortutil::sortScoredIdsWithOptions","p":"src/infra/sortutil.h:132","origin":"new-symbol"}, @@ -6754,7 +6808,7 @@ ripwire: --quality-delta gating: 5 preexisting-worse major finding(s); first: ap *NEW FLAG: --ack-only matching nothing REFUSES rather than falling back to acking everything.* -**exit code: 1** — **wall time: 7.70s** +**exit code: 1** — **wall time: 12.95s** ````` (empty) @@ -6772,7 +6826,7 @@ ripwire: --ack-only=zzznope matched none of the 9 finding(s) — nothing accepte *NEW FLAG: ack only the api-surface findings — a per-finding ratchet instead of a rubber stamp.* -**wall time: 6.71s** +**wall time: 15.80s** ````` (empty) @@ -6790,11 +6844,11 @@ ripwire: acknowledged 1 of 9 finding(s) (8 left UNACKED by --ack-only, 0 already *Re-run after the partial ack: acked=3, the rest still gate (exit 2).* -**exit code: 2** — **wall time: 11.88s** +**exit code: 2** — **wall time: 26.48s** ````` - @@ -6853,11 +6907,11 @@ ripwire: --ack-only=SUBSTR narrows --quality-ack — pass both (e.g. ripwire row identical.* -**wall time: 1.03s** +**wall time: 2.99s** ````` - @@ -6885,31 +6939,31 @@ ripwire: --ack-only=SUBSTR narrows --quality-ack — pass both (e.g. ripwire - - + + - + - + - @@ -6925,15 +6979,15 @@ ripwire: --ack-only=SUBSTR narrows --quality-ack — pass both (e.g. ripwire ) and selectors take it. layer=: built-in arch layer (game|infra|render|math|audio|ai|test) from a dir name in p=; absent if none. f p=: a file; s t= n=: kind, name; c n=: a resolved callee. s k=: rank. --> - - + + @@ -6958,11 +7012,11 @@ ripwire: --ack-only=SUBSTR narrows --quality-ack — pass both (e.g. ripwire of ; dup_loc=/dup_pct=. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). root=: p= relative to it. groups=/type3=: Type-2 and Type-3 group totals over all groups; total= is their sum. exempt_groups=N: groups whose members all sit on fixture/shell-runner paths quality-delta duplication ignores. idiom_groups=/demoted_groups=: groups of one recognized idiom / those quality-delta demotes to minor; floors. clone_groups=N: clusters after merging pairs (rows sharing gid=); a floor under type3_capped=1. total_loc=N: lines of every function body the detector considered; dup_pct= is dup_loc= over it. group exempt=fixture|shell-runner: every member is on such a path; quality-delta duplication ignores it. group idiom=: the recognized shape every member spells: threshold-ladder, switch-name-table, builder-chain, one-statement. --> - + @@ -6998,12 +7052,12 @@ ripwire: --ack-only=SUBSTR narrows --quality-ack — pass both (e.g. ripwire ; v=unknown = no merge base. at=: commit+dirty+shallow. head=: the HEAD commit, bare 9-hex sha (at= adds +dirty). head_ref=: HEAD's branch (HEAD when detached); that branch itself is not scanned. refs=N: local branches scanned (refs/heads only); unmerged + superseded + merged + unknown = refs. blobs=N: distinct git blobs read for the sweep. unmerged=N: refs whose authored work the live line genuinely lacks. superseded=N: refs whose work the live line re-implemented (removed the same base code). merged=N: refs whose work HEAD already has; omitted from the rows. name=: the local branch. tip=: the branch tip commit (9 hex). date=: the tip's committer date, YYYY-MM-DD. files=N: files with stray lines; rows capped at 12, a more element counts the rest (detail=1 lists all). ref superseded=N>: of this ref's stray= lines, those in files the live line re-implemented. unknown=N: refs that could not be analysed (v=unknown, e.g. no merge base); never counted merged. --> - - + + ````` @@ -7018,11 +7072,11 @@ stderr: *CHANGED: --plan surfaces those same refs as an row rather than silently dropping them.* -**wall time: 2.31s** +**wall time: 7.57s** ````` - + ````` @@ -7037,11 +7091,11 @@ stderr: *The DMM scalar on a REAL delta: the sandbox edit grew one unit past the nesting/complexity thresholds and added an 8-parameter one, so dmm is low and the three sub-scores say which property moved.* -**wall time: 6.45s** +**wall time: 11.27s** ````` -

@@ -7052,11 +7106,11 @@ stderr: *OWNERSHIP partition for a shared tree: every regression here lives in src/infra/, so under a scope naming src/graph.h they ALL print under with a do-not-ack banner and never gate — scoped-out-gating= says how many would have.* -**wall time: 11.40s** +**wall time: 19.61s** ````` - @@ -7098,7 +7152,7 @@ ripwire: no ./.ripwire_quality_baseline — auto-comparing the working tree vs g *The rubber-stamp guard: an --ack-only that names an OUT-OF-SCOPE row refuses (exit 1) and writes nothing.* -**exit code: 1** — **wall time: 10.67s** +**exit code: 1** — **wall time: 14.99s** ````` (empty) @@ -7118,11 +7172,11 @@ ripwire: --ack-only=api-surface selects 1 finding(s) OUT OF SCOPE for --scope=sr *The continuation packet with a REAL diff: verified changed symbols + blast radius + tests-to-run, then the heuristic rows.* -**wall time: 4.94s** +**wall time: 10.36s** ````` - + @@ -7148,11 +7202,11 @@ ripwire: --ack-only=api-surface selects 1 finding(s) OUT OF SCOPE for --scope=sr - - - - - + + + + + ````` @@ -7161,8 +7215,10 @@ ripwire: --ack-only=api-surface selects 1 finding(s) OUT OF SCOPE for --scope=sr *Pin a field note (write-side memory) to a symbol; committed to .ripwire_notes in the sandbox. The BARE name is resolved through the same resolver the read verbs use and stored as the canonical id — the rewrite is echoed on stderr, because a silent one is not a disclosure.* +**wall time: 1.06s** + ````` -src/infra/sortutil.h::rw::sortutil::lessByScoreDescId 2026-11-20 keep this branch-free — it sits inside the PageRank sort comparator d3a73cd6ecd4ca6fbd16e4a246f4b7f3745c44ba integration/train-1118a +src/infra/sortutil.h::rw::sortutil::lessByScoreDescId 2026-11-20 keep this branch-free — it sits inside the PageRank sort comparator cee081132922142dae18338f8b8849795aedae65 integration/train-1118a ````` stderr: @@ -7176,6 +7232,8 @@ ripwire: --note-add: target 'lessByScoreDescId' canonicalised to 'src/infra/sort *The note is listed under the canonical id, dangling="0" — i.e. it will actually surface. (Before the H1 fix the bare name was stored verbatim and read dangling="1": recorded, and surfaced nowhere.)* +**wall time: 1.09s** + ````` @@ -7187,7 +7245,7 @@ ripwire: --note-add: target 'lessByScoreDescId' canonicalised to 'src/infra/sort - + @@ -7204,7 +7262,7 @@ ripwire: --note-add: target 'lessByScoreDescId' canonicalised to 'src/infra/sort *Two definitions carry this name, so the write REFUSES rather than pick one: a note keys ONE canonical id, and an ambiguous selector is refused, never silently narrowed. Every candidate is named, with a runnable retry.* -**exit code: 1** +**exit code: 1** — **wall time: 1.31s** ````` (empty) @@ -7221,7 +7279,7 @@ ripwire: --note-add: target 'gitOneLine' is ambiguous — it matches 2 definitio *A name that resolves to nothing is refused with the read verbs' own did-you-mean — never written as a dead note.* -**exit code: 1** +**exit code: 1** — **wall time: 1.59s** ````` (empty) @@ -7238,14 +7296,18 @@ ripwire: --note-add: target not found: lessByScoreDescIdd (did you mean 'lessByS *The same symbol addressed by its CANONICAL id: already canonical, so nothing is rewritten and both notes land on ONE target.* +**wall time: 2.19s** + ````` -src/infra/sortutil.h::rw::sortutil::lessByScoreDescId 2026-11-20 chose the flat two-branch compare over the nested ladder because the comparator sits inside the PageRank sort d3a73cd6ecd4ca6fbd16e4a246f4b7f3745c44ba integration/train-1118a +src/infra/sortutil.h::rw::sortutil::lessByScoreDescId 2026-11-20 chose the flat two-branch compare over the nested ladder because the comparator sits inside the PageRank sort cee081132922142dae18338f8b8849795aedae65 integration/train-1118a ````` ## `./build/ripwire . --expand=lessByScoreDescId --top-k=0` *Both notes riding along with the symbol's body — the elements follow the body, past the display cut, so they are extracted below.* +**wall time: 2.13s** + ````` - + - + @@ -7369,17 +7431,17 @@ ripwire edit: applied atomically; receipt carries region, blob_sha, edit_check, *Insert immediately AFTER one uniquely-resolved definition; replaced_bytes=0 because the insert verbs never overwrite. The receipt carries the folded post-edit verification (lines=, edit_check, tests_to_run) so the loop closes in one call.* -**wall time: 5.01s** +**wall time: 6.68s** ````` {"applied":"insert_after_symbol","symbol":"lessByScoreDescId","file":"src/infra/sortutil.h","span":{"start":2641,"end":2729},"lines":{"start":59,"end":61},"replaced_bytes":0,"old_file_bytes":8679,"new_file_bytes":8767,"file_eol":"lf","eol_normalized":false,"trailing_newline_folded":true,"separator_p … [line truncated: 650 more bytes on this line] -"graph_ambiguous":3967,"graph_unresolved":19988,"graph_unindexed":313,"counts_floor":true},"tests_to_run":[{"p":"test/verify_radix.cpp","hops":1,"run":"bash test/greptiercheck.sh"}, +"graph_ambiguous":3968,"graph_unresolved":19992,"graph_unindexed":313,"counts_floor":true},"tests_to_run":[{"p":"test/verify_radix.cpp","hops":1,"run":"bash test/greptiercheck.sh"}, {"p":"test/adaptivecutshapefix/adaptive_cut_shape_test.cpp","hops":2,"run":"bash test/adaptivecutshapecheck.sh"}, {"p":"test/forrowfeatures_unit.cpp","hops":2,"run":"bash test/forrowfeaturescheck.sh"}, {"p":"test/verify_csr.cpp","hops":2,"run":"bash test/a9disclosurecheck.sh"}, {"p":"test/includeprecise_unit.cpp","hops":4,"run":"bash test/includeprecisecheck.sh"}, {"p":"test/rustimport_unit.cpp","hops":4,"run":"bash test/rustimportprecisecheck.sh"}], -"order":"evidence","partners":0,"run_first":1,"tests":6,"script_gates_unmodelled":944,"graph_ambiguous":3967,"graph_unresolved":19988,"graph_unindexed":313,"counts_floor":true,"next":"bash test/greptiercheck.sh"} +"order":"evidence","partners":0,"run_first":1,"tests":6,"script_gates_unmodelled":945,"graph_ambiguous":3968,"graph_unresolved":19992,"graph_unindexed":313,"counts_floor":true,"next":"bash test/greptiercheck.sh"} ````` stderr: @@ -7392,7 +7454,7 @@ ripwire edit: applied atomically; receipt carries region, blob_sha, edit_check, *The opt-out: the same insert with the folded verification skipped — lines= still rides (it is free), edit_check/tests_to_run do not, and the two pasteable commands stay on stderr.* -**wall time: 2.12s** +**wall time: 4.41s** ````` {"applied":"insert_after_symbol","symbol":"lessByScoreDescId","file":"src/infra/sortutil.h","span":{"start":2641,"end":2729},"lines":{"start":59,"end":61},"replaced_bytes":0,"old_file_bytes":8767,"new_file_bytes":8855,"file_eol":"lf","eol_normalized":false,"trailing_newline_folded":true,"separator_p … [line truncated: 570 more bytes on this line] @@ -7408,20 +7470,20 @@ ripwire edit: applied atomically; receipt carries region, blob_sha (post-check s *Insert BEFORE, with --edit-target-file pinning which same-named definition (here unambiguous — the disambiguator is simply honoured).* -**wall time: 4.92s** +**wall time: 7.39s** ````` {"applied":"insert_before_symbol","symbol":"nonNegativeFloatDescKey","file":"src/infra/sortutil.h","span":{"start":3161,"end":3249},"lines":{"start":77,"end":78},"replaced_bytes":0,"old_file_bytes":8855,"new_file_bytes":8943,"file_eol":"lf","eol_normalized":false,"trailing_newline_folded":false,"sep … [line truncated: 753 more bytes on this line] {"n":"benchAdaptive","p":"bench/bench_radix_ab.cpp:157","l":[162]}, {"n":"radixSortNonNegativeFloatsDesc","p":"src/infra/sortutil.h:108","l":[117]}, {"n":"radixSortByScoreDescId","p":"src/infra/sortutil.h:123","l":[183]}], -"graph_ambiguous":3967,"graph_unresolved":19988,"graph_unindexed":313,"counts_floor":true},"tests_to_run":[{"p":"test/verify_radix.cpp","hops":1,"run":"bash test/greptiercheck.sh"}, +"graph_ambiguous":3968,"graph_unresolved":19992,"graph_unindexed":313,"counts_floor":true},"tests_to_run":[{"p":"test/verify_radix.cpp","hops":1,"run":"bash test/greptiercheck.sh"}, {"p":"test/adaptivecutshapefix/adaptive_cut_shape_test.cpp","hops":2,"run":"bash test/adaptivecutshapecheck.sh"}, {"p":"test/forrowfeatures_unit.cpp","hops":2,"run":"bash test/forrowfeaturescheck.sh"}, {"p":"test/verify_csr.cpp","hops":2,"run":"bash test/a9disclosurecheck.sh"}, {"p":"test/includeprecise_unit.cpp","hops":4,"run":"bash test/includeprecisecheck.sh"}, {"p":"test/rustimport_unit.cpp","hops":4,"run":"bash test/rustimportprecisecheck.sh"}], -"order":"evidence","partners":0,"run_first":1,"tests":6,"script_gates_unmodelled":944,"graph_ambiguous":3967,"graph_unresolved":19988,"graph_unindexed":313,"counts_floor":true,"next":"--uses=src/infra/sortutil.h:nonNegativeFloatDescKey"} +"order":"evidence","partners":0,"run_first":1,"tests":6,"script_gates_unmodelled":945,"graph_ambiguous":3968,"graph_unresolved":19992,"graph_unindexed":313,"counts_floor":true,"next":"--uses=src/infra/sortutil.h:nonNegativeFloatDescKey"} ````` stderr: @@ -7434,7 +7496,7 @@ ripwire edit: applied atomically; receipt carries region, blob_sha, edit_check, *An unknown TARGET refuses and leaves every file byte-identical.* -**exit code: 1** — **wall time: 1.80s** +**exit code: 1** — **wall time: 4.23s** ````` (empty) @@ -7450,7 +7512,7 @@ ripwire: --replace-symbol-body: symbol 'DoesNotExist' not found *A versioned multi-edit TRANSACTION preflighted without writing: the receipt shows what each op would read and touch.* -**wall time: 2.03s** +**wall time: 3.42s** Input file: @@ -7468,21 +7530,21 @@ Input file: ````` ````` -{"schema":"ripwire.edit-plan/v1","mode":"dry-run","edits":1,"files":1,"callers_union":4,"graph_ambiguous":3967,"graph_unresolved":19988,"graph_unindexed":313,"counts_floor":true,"atomic_scope":"per-file","rollback_on_write_error":true,"recheck_before_each_write":true,"multifile_crash_atomic":false," … [line truncated: 400 more bytes on this line] +{"schema":"ripwire.edit-plan/v1","mode":"dry-run","edits":1,"files":1,"callers_union":4,"graph_ambiguous":3968,"graph_unresolved":19992,"graph_unindexed":313,"counts_floor":true,"atomic_scope":"per-file","rollback_on_write_error":true,"recheck_before_each_write":true,"multifile_crash_atomic":false," … [line truncated: 400 more bytes on this line] ````` ## `./build/ripwire . --edit-plan=/aux/edit_plan.json --apply` *The same plan committed: per-file locks, re-verify-before-write, atomic rename, rollback on a later failure.* -**wall time: 4.52s** +**wall time: 7.71s** ````` -{"schema":"ripwire.edit-plan/v1","mode":"apply","edits":1,"files":1,"callers_union":4,"graph_ambiguous":3967,"graph_unresolved":19988,"graph_unindexed":313,"counts_floor":true,"applied":1,"atomic_files":1,"atomic_scope":"per-file","rollback_on_write_error":true,"recheck_before_each_write":true,"mult … [line truncated: 584 more bytes on this line] +{"schema":"ripwire.edit-plan/v1","mode":"apply","edits":1,"files":1,"callers_union":4,"graph_ambiguous":3968,"graph_unresolved":19992,"graph_unindexed":313,"counts_floor":true,"applied":1,"atomic_files":1,"atomic_scope":"per-file","rollback_on_write_error":true,"recheck_before_each_write":true,"mult … [line truncated: 584 more bytes on this line] {"n":"benchAdaptive","p":"bench/bench_radix_ab.cpp:157","l":[162]}, {"n":"radixSortNonNegativeFloatsDesc","p":"src/infra/sortutil.h:110","l":[119]}, {"n":"radixSortByScoreDescId","p":"src/infra/sortutil.h:125","l":[185]}], -"graph_ambiguous":3967,"graph_unresolved":19988,"graph_unindexed":313,"counts_floor":true}}]} +"graph_ambiguous":3968,"graph_unresolved":19992,"graph_unindexed":313,"counts_floor":true}}]} ````` ## `./build/ripwire . --edit-plan=/aux/edit_plan.json` @@ -7505,11 +7567,11 @@ ripwire: --edit-plan requires exactly one of --dry-run or --apply *After the agent's edits: the complexity/nesting rows on lessByScoreDescId are gone (the replace undid them), the rest still gate (exit 2).* -**exit code: 2** — **wall time: 11.47s** +**exit code: 2** — **wall time: 20.30s** ````` - @@ -7552,7 +7614,7 @@ ripwire: --quality-delta gating: 2 preexisting-worse major finding(s); first: du *REFUSES, exit 1: this sandbox tree is already regressed, and pinning here would swallow that debt into the floor so every later delta read clean. It names how many gating findings it would absorb, the first of them, and the way forward.* -**exit code: 1** — **wall time: 8.43s** +**exit code: 1** — **wall time: 14.37s** ````` (empty) @@ -7571,7 +7633,7 @@ ripwire: --quality-baseline: this tree already holds 2 gating finding(s) against *The consent form: pin anyway. The sidecar is stamped with the dirty pin and the absorbed count, so the fact outlives the process that knew it.* -**wall time: 9.86s** +**wall time: 21.05s** ````` (empty) @@ -7581,16 +7643,16 @@ stderr: ````` ripwire: --quality-baseline --allow-dirty: pinned with 2 gating finding(s) ABSORBED into the floor (stamped in the sidecar; every --quality-delta against it carries baseline_absorbed="2") -ripwire: wrote ./.ripwire_quality_baseline (snapshot of 41901 per-symbol rows, 44039 indexed symbols total) +ripwire: wrote ./.ripwire_quality_baseline (snapshot of 41912 per-symbol rows, 44050 indexed symbols total) ````` Artifact written: ````` - 8652959 .ripwire_quality_baseline + 8655015 .ripwire_quality_baseline # ripwire quality baseline v6 — regenerate with --quality-baseline; do not hand-edit -producer 3079011790d1a4efcdd7ecca4dfd8a74b1aa93c5497b368d775de09500ec7f19 -head d3a73cd6ecd4ca6fbd16e4a246f4b7f3745c44ba +producer 001895a3747c0a780cba69eb8c9cd791fc3d6c22d51721f02c8fa68b77f6371d +head cee081132922142dae18338f8b8849795aedae65 dirty 1 absorbed 2 ccx 67c15011ee8b 0 @@ -7603,11 +7665,11 @@ ccx 6a732f6699b *Against that sidecar the same tree reads regressions=0 — but baseline_absorbed= is on the root, so this green means clean SINCE THE PIN, never clean. A baseline is a floor YOU chose, and it belongs BEFORE the change.* -**wall time: 9.21s** +**wall time: 16.98s** ````` - ````` @@ -7621,7 +7683,7 @@ ccx 6a732f6699b *initialize + tools/list: the manifest an agent host loads at session start — every verb's name, description and input schema.* ````` -{"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2025-11-25","serverInfo":{"name":"ripwire","version":"0.6.10-dev.99+gd3a73cd6e"},"capabilities":{"tools":{},"resources":{}},"instructions":"Map before reading files. Start a new task with explore; use from_trace for an error; use impact plus uses … [line truncated: 759 more bytes on this line] +{"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2025-11-25","serverInfo":{"name":"ripwire","version":"0.6.10-dev.104+gcee081132"},"capabilities":{"tools":{},"resources":{}},"instructions":"Map before reading files. Start a new task with explore; use from_trace for an error; use impact plus uses … [line truncated: 760 more bytes on this line] {"jsonrpc":"2.0","id":2,"result":{"tools":[{"name":"analyze","description":"Architecture map for a directory: signatures and the call graph for the top symbols. Use when landing cold in a repo or subdir, before reading files; for a task-scoped inventory use 'for', for one symbol's neighborhood find_ … [line truncated: 742 more bytes on this line] {"name":"rank_by","description":"The SAME architecture map 'analyze' serves, ranked by a different signal instead of plain PageRank. rank_by = pagerank (default, omit it — the CLI's own unbiased --rank-by=pagerank; 'analyze' can rank differently on a tree with uncommitted changes, where it biases … [line truncated: 1077 more bytes on this line] {"name":"find_symbol","description":"A symbol's 1-hop neighborhood: the symbol (with a fetch_body handle) plus direct callers (calledBy) and callees (calls). Full transitive reach: 'impact'. Read/write/import sites, not just calls: 'uses'. JSON {symbol, calledBy, calls, defs, count, hop_tested, hop_ … [line truncated: 1181 more bytes on this line] @@ -7701,7 +7763,7 @@ quality_baseline desc_bytes= 407 schema_bytes= 193 required=[] *--mcp-tools=core: the server lists only the core profile's tools (explore, batch, from_trace, impact, uses, fetch_body, edit_check, quality_delta), so a host that loads every schema at session start pays only for those.* ````` -{"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2025-11-25","serverInfo":{"name":"ripwire","version":"0.6.10-dev.99+gd3a73cd6e"},"capabilities":{"tools":{},"resources":{}},"instructions":"Map before reading files. Start a new task with explore; use from_trace for an error; use impact plus uses … [line truncated: 976 more bytes on this line] +{"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2025-11-25","serverInfo":{"name":"ripwire","version":"0.6.10-dev.104+gcee081132"},"capabilities":{"tools":{},"resources":{}},"instructions":"Map before reading files. Start a new task with explore; use from_trace for an error; use impact plus uses … [line truncated: 977 more bytes on this line] {"jsonrpc":"2.0","id":2,"result":{"tools":[{"name":"fetch_body","description":"Full (or partial-range) source of a symbol's definition, addressed by the stable `handle` a read verb attached to it (bodies on request, not by default). start_line/end_line are optional, 1-based, INCLUSIVE and BODY-RELAT … [line truncated: 1092 more bytes on this line] {"name":"quality_delta","description":"Your PR self-check, run every time you think a change is DONE — pairs with the CLI-only --test-gate (names the tests to run + the untested blast radius; not MCP-exposed) to form the two-step pre-PR gate. Reports ONLY what your tree made WORSE vs baseline, acr … [line truncated: 862 more bytes on this line] {"name":"impact","description":"IS IT SAFE TO CHANGE X? — the TRANSITIVE blast radius of a symbol via calls, nearest first (d= hop depth), then PageRank. Use before modifying or deleting a symbol; it beats find_referencing_symbols (direct callers only), and 'uses' catches the read/write/import sit … [line truncated: 1325 more bytes on this line] @@ -7730,33 +7792,33 @@ quality_delta desc_bytes= 742 schema_bytes= 279 required=[] *MCP `for`: always bundle=sigs (never the CLI's compact route), the same ranked signatures as --for.* -**wall time: 4.16s** +**wall time: 6.58s** ````` -{"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2025-11-25","serverInfo":{"name":"ripwire","version":"0.6.10-dev.99+gd3a73cd6e"},"capabilities":{"tools":{},"resources":{}},"instructions":"Map before reading files. Start a new task with explore; use from_trace for an error; use impact plus uses … [line truncated: 759 more bytes on this line] -{"jsonrpc":"2.0","id":2,"result":{"content":[{"type":"text","text":". window: shown= total= capped= has_more= next_offset= offset= limit= (ca … [line truncated: 13902 more bytes on this line] -"_index":"[index: files=4823 symbols=44037 hash=5a856ab0]","_fresh":"ok"}} +"_index":"[index: files=4825 symbols=44048 hash=c33967bb]","_fresh":"ok"}} {"jsonrpc":"2.0","id":3,"result":{"content":[{"type":"text","text":"

@@ -3136,7 +3134,7 @@ _OWNERSHIP partition for a shared tree: every regression here lives in src/infra ``` $ ./build/ripwire . --quality-delta --scope=src/graph.h - @@ -3166,10 +3164,10 @@ _Fast per-symbol post-edit contract check vs git HEAD (unchanged on a clean tree ``` $ ./build/ripwire . --edit-check=rankGraphTeleport - - - + + @@ -3220,13 +3218,13 @@ $ ./build/ripwire . --insert-before-symbol=nonNegativeFloatDescKey --edit-payloa {"n":"benchAdaptive","p":"bench/bench_radix_ab.cpp:157","l":[162]}, {"n":"radixSortNonNegativeFloatsDesc","p":"src/infra/sortutil.h:108","l":[117]}, {"n":"radixSortByScoreDescId","p":"src/infra/sortutil.h:123","l":[183]}], -"graph_ambiguous":3634,"graph_unresolved":20011,"graph_unindexed":313,"counts_floor":true},"tests_to_run":[{"p":"test/verify_radix.cpp","hops":1,"run":"bash test/greptiercheck.sh"}, +"graph_ambiguous":3967,"graph_unresolved":19988,"graph_unindexed":313,"counts_floor":true},"tests_to_run":[{"p":"test/verify_radix.cpp","hops":1,"run":"bash test/greptiercheck.sh"}, {"p":"test/adaptivecutshapefix/adaptive_cut_shape_test.cpp","hops":2,"run":"bash test/adaptivecutshapecheck.sh"}, {"p":"test/forrowfeatures_unit.cpp","hops":2,"run":"bash test/forrowfeaturescheck.sh"}, {"p":"test/verify_csr.cpp","hops":2,"run":"bash test/a9disclosurecheck.sh"}, {"p":"test/includeprecise_unit.cpp","hops":4,"run":"bash test/includeprecisecheck.sh"}, {"p":"test/rustimport_unit.cpp","hops":4,"run":"bash test/rustimportprecisecheck.sh"}], -"order":"evidence","partners":0,"run_first":1,"tests":6,"script_gates_unmodelled":942,"graph_ambiguous":3634,"graph_unresolved":20011,"graph_unindexed":313,"counts_floor":true,"next":"--uses=src/infra/sortutil.h:nonNegativeFloatDescKey"} +"order":"evidence","partners":0,"run_first":1,"tests":6,"script_gates_unmodelled":944,"graph_ambiguous":3967,"graph_unresolved":19988,"graph_unindexed":313,"counts_floor":true,"next":"--uses=src/infra/sortutil.h:nonNegativeFloatDescKey"} ``` ### `--insert-after-symbol=TARGET` @@ -3242,13 +3240,13 @@ _Insert immediately AFTER one uniquely-resolved definition; replaced_bytes=0 bec ``` $ ./build/ripwire . --insert-after-symbol=lessByScoreDescId --edit-payload=/aux/payload_note.h {"applied":"insert_after_symbol","symbol":"lessByScoreDescId","file":"src/infra/sortutil.h","span":{"start":2641,"end":2729},"lines":{"start":59,"end":61},"replaced_bytes":0,"old_file_bytes":8679,"new_file_bytes":8767,"file_eol":"lf","eol_normalized":false,"trailing_newline_folded":true,"separator_p … [line truncated: 650 more bytes on this line] -"graph_ambiguous":3634,"graph_unresolved":20011,"graph_unindexed":313,"counts_floor":true},"tests_to_run":[{"p":"test/verify_radix.cpp","hops":1,"run":"bash test/greptiercheck.sh"}, +"graph_ambiguous":3967,"graph_unresolved":19988,"graph_unindexed":313,"counts_floor":true},"tests_to_run":[{"p":"test/verify_radix.cpp","hops":1,"run":"bash test/greptiercheck.sh"}, {"p":"test/adaptivecutshapefix/adaptive_cut_shape_test.cpp","hops":2,"run":"bash test/adaptivecutshapecheck.sh"}, {"p":"test/forrowfeatures_unit.cpp","hops":2,"run":"bash test/forrowfeaturescheck.sh"}, {"p":"test/verify_csr.cpp","hops":2,"run":"bash test/a9disclosurecheck.sh"}, {"p":"test/includeprecise_unit.cpp","hops":4,"run":"bash test/includeprecisecheck.sh"}, {"p":"test/rustimport_unit.cpp","hops":4,"run":"bash test/rustimportprecisecheck.sh"}], -"order":"evidence","partners":0,"run_first":1,"tests":6,"script_gates_unmodelled":942,"graph_ambiguous":3634,"graph_unresolved":20011,"graph_unindexed":313,"counts_floor":true,"next":"bash test/greptiercheck.sh"} +"order":"evidence","partners":0,"run_first":1,"tests":6,"script_gates_unmodelled":944,"graph_ambiguous":3967,"graph_unresolved":19988,"graph_unindexed":313,"counts_floor":true,"next":"bash test/greptiercheck.sh"} ``` **Caveats (stated by the binary):** @@ -3294,13 +3292,13 @@ $ ./build/ripwire . --insert-before-symbol=nonNegativeFloatDescKey --edit-payloa {"n":"benchAdaptive","p":"bench/bench_radix_ab.cpp:157","l":[162]}, {"n":"radixSortNonNegativeFloatsDesc","p":"src/infra/sortutil.h:108","l":[117]}, {"n":"radixSortByScoreDescId","p":"src/infra/sortutil.h:123","l":[183]}], -"graph_ambiguous":3634,"graph_unresolved":20011,"graph_unindexed":313,"counts_floor":true},"tests_to_run":[{"p":"test/verify_radix.cpp","hops":1,"run":"bash test/greptiercheck.sh"}, +"graph_ambiguous":3967,"graph_unresolved":19988,"graph_unindexed":313,"counts_floor":true},"tests_to_run":[{"p":"test/verify_radix.cpp","hops":1,"run":"bash test/greptiercheck.sh"}, {"p":"test/adaptivecutshapefix/adaptive_cut_shape_test.cpp","hops":2,"run":"bash test/adaptivecutshapecheck.sh"}, {"p":"test/forrowfeatures_unit.cpp","hops":2,"run":"bash test/forrowfeaturescheck.sh"}, {"p":"test/verify_csr.cpp","hops":2,"run":"bash test/a9disclosurecheck.sh"}, {"p":"test/includeprecise_unit.cpp","hops":4,"run":"bash test/includeprecisecheck.sh"}, {"p":"test/rustimport_unit.cpp","hops":4,"run":"bash test/rustimportprecisecheck.sh"}], -"order":"evidence","partners":0,"run_first":1,"tests":6,"script_gates_unmodelled":942,"graph_ambiguous":3634,"graph_unresolved":20011,"graph_unindexed":313,"counts_floor":true,"next":"--uses=src/infra/sortutil.h:nonNegativeFloatDescKey"} +"order":"evidence","partners":0,"run_first":1,"tests":6,"script_gates_unmodelled":944,"graph_ambiguous":3967,"graph_unresolved":19988,"graph_unindexed":313,"counts_floor":true,"next":"--uses=src/infra/sortutil.h:nonNegativeFloatDescKey"} ``` **Shaped by:** `--insert-after-symbol` @@ -3359,11 +3357,11 @@ _The same plan committed: per-file locks, re-verify-before-write, atomic rename, ``` $ ./build/ripwire . --edit-plan=/aux/edit_plan.json --apply -{"schema":"ripwire.edit-plan/v1","mode":"apply","edits":1,"files":1,"callers_union":4,"graph_ambiguous":3634,"graph_unresolved":20011,"graph_unindexed":313,"counts_floor":true,"applied":1,"atomic_files":1,"atomic_scope":"per-file","rollback_on_write_error":true,"recheck_before_each_write":true,"mult … [line truncated: 584 more bytes on this line] +{"schema":"ripwire.edit-plan/v1","mode":"apply","edits":1,"files":1,"callers_union":4,"graph_ambiguous":3967,"graph_unresolved":19988,"graph_unindexed":313,"counts_floor":true,"applied":1,"atomic_files":1,"atomic_scope":"per-file","rollback_on_write_error":true,"recheck_before_each_write":true,"mult … [line truncated: 584 more bytes on this line] {"n":"benchAdaptive","p":"bench/bench_radix_ab.cpp:157","l":[162]}, {"n":"radixSortNonNegativeFloatsDesc","p":"src/infra/sortutil.h:110","l":[119]}, {"n":"radixSortByScoreDescId","p":"src/infra/sortutil.h:125","l":[185]}], -"graph_ambiguous":3634,"graph_unresolved":20011,"graph_unindexed":313,"counts_floor":true}}]} +"graph_ambiguous":3967,"graph_unresolved":19988,"graph_unindexed":313,"counts_floor":true}}]} ``` **Shaped by:** `--edit-check` @@ -3409,19 +3407,19 @@ _Bare --slice=SYM: the INVENTORY of sliceable locals (), so a calle ``` $ ./build/ripwire . --slice=rankGraphTeleport - - - - - - - - - - - - - + + + + + + + + + + + + + ... [3 more line(s); run it to see the whole thing] ``` @@ -3446,17 +3444,17 @@ _Forward flow: which statements the seed's value reaches, at the default depth b ``` $ ./build/ripwire . --slice=rankGraphTeleport:teleport --slice-flow=fwd - - + + - + teleport( pw.begin(), pw.end() );]]> - + - + ... [22 more line(s); run it to see the whole thing] @@ -3500,10 +3498,10 @@ $ ./build/ripwire . --slice-depth=3 _Hold a LOCATION, not a name: the enclosing-definition chain at FILE:LINE (a compiler error, a diff hunk, a stack frame), outermost -> innermost._ ``` -$ ./build/ripwire . --at=src/graph.h:14630 +$ ./build/ripwire . --at=src/graph.h:14923 - - + + ``` @@ -3527,7 +3525,7 @@ _No-LLM review-evidence bundle for the working-tree diff (clean tree = empty)._ ``` $ ./build/ripwire . --pr-context - ``` @@ -3553,11 +3551,11 @@ _Pairwise cross-arm conflict sites + suggested landing order (any committish sha ``` $ ./build/ripwire . --merge-scout=HEAD~2,HEAD~1 - - + + - + @@ -3632,7 +3630,7 @@ _A second selection, the `fix/` ref family, picked at capture time from the refs ``` $ ./build/ripwire . --stray-content=fix/ - + ``` @@ -3657,19 +3655,19 @@ _Select the genuinely-unmerged refs of the `lane/` ref family and feed them to m ``` $ ./build/ripwire . --stray-content=lane/ --plan - + - + - + - + ... [17 more line(s); run it to see the whole thing] ``` @@ -3693,8 +3691,8 @@ _Cross-branch ABI-break gate over the `lane/` ref family: struct byte-contract d ``` $ ./build/ripwire . --stray-content=lane/ --abi - + @@ -3728,10 +3726,10 @@ _Which ref's tree defines or mentions SYM — HEAD first, then every local branc ``` $ ./build/ripwire . --whereis=rankGraphTeleport - + - + - + + + - + - + @@ -3902,7 +3900,7 @@ _The cache-locality lens over every aggregate: fields READ TOGETHER but declared ``` $ ./build/ripwire . --field-affinity - @@ -3937,7 +3935,7 @@ _Which of this repo's doc claims are now false. CHANGED: row attribute at= renam ``` $ ./build/ripwire . --doc-drift - + @@ -3971,7 +3969,7 @@ _Which of this repo's doc claims are now false. CHANGED: row attribute at= renam ``` $ ./build/ripwire . --doc-drift - + @@ -4004,8 +4002,8 @@ _Same report, with git history splitting stale mentions into deleted-by-commit v ``` $ ./build/ripwire . --doc-drift --with-history - - + + @@ -4038,7 +4036,7 @@ _The house PLAN/DESIGN format's STRUCTURE check — never semantics; exit 2 when ``` $ ./build/ripwire . --plan-lint=test/planlintfix/wave.md - + @@ -4075,8 +4073,8 @@ $ ./build/ripwire . --from-trace=- AddressSanitizer:DEADLYSIGNAL ================================================================= ==41337==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000018 (pc 0x000102f4a1c8 bp 0x00016d2f1a40 sp 0x00016d2f19e0 T0) - #0 0x102f4a1c8 in rw::rankGraphTeleport(Graph const&, std::vector const&, float) src/graph.h:14630 - #1 0x102f3e884 in rw::rankGraph(Graph const&, float) src/graph.h:14673 + #0 0x102f4a1c8 in rw::rankGraphTeleport(Graph const&, std::vector const&, float) src/graph.h:14923 + #1 0x102f3e884 in rw::rankGraph(Graph const&, float) src/graph.h:14966 #2 0x102e11f30 in runDefaultMap(MainDispatch const&) src/main.cpp:1759 #3 0x102e01a44 in main src/main.cpp:4511 #4 0x1a2b3c0dc in start+0x9dc (dyld:arm64e+0x60dc) @@ -4105,7 +4103,7 @@ _A command that exits 0: a minimal success record (exit, measured duration, disc $ ./build/ripwire . --run-trace="true" - + ``` @@ -4195,7 +4193,7 @@ _ONE budget-shared bundle: ranking + top bodies + caller sigs + notes + tests_to ``` $ ./build/ripwire . --pack-task="add a new output format flag to the CLI" - + - + @@ -4265,7 +4263,7 @@ _Task lens + a compact Mermaid flowchart of the top anchors' 1-hop edges._ ``` $ ./build/ripwire . --for="pagerank power iteration" --with-graph - + @@ -4343,14 +4341,14 @@ _Environment self-check: binary staleness, grammars, cache dir, git, tracked-bin ``` $ ./build/ripwire . --doctor - - + - - + + - - + @@ -4377,14 +4375,14 @@ _--doctor plus a LIVE integration inspection for one agent: PATH binary, install ``` $ ./build/ripwire . --doctor --agent=claude - - + - - + + - - + @@ -4413,7 +4411,7 @@ $ ./build/ripwire . --skipped - @@ -4502,16 +4500,16 @@ $ ./build/ripwire . --rank-by=churn --top-k=5 - - + + - + - - - + + + ... [10 more line(s); run it to see the whole thing] ``` @@ -4533,22 +4531,22 @@ a trailing slash is ignored; absolute paths and '..' are refused). The global block stays byte-identical, a second page follows it — n=/of= are its counts (of= IS the total, so the paging half carries no total=), capped="1" has_more="1" next_offset= offset= limit= page it, and next= replays THIS run's own corpus flags (--since/--exclude) so the page it names is a page of the same answer. The symbol map collapses to a disclosed stub — the map was not asked for and was not ranked at all, which is why the header carries no pr_iters=. merge_bombs_skipped= stays on the global block: it counts the window's skipped commits, not the directory's._ ``` -$ ./build/ripwire . --rank-by=churn-decay --since=HEAD~6 --exclude=test --exclude=docs --exclude=skills --exclude=changelog.d --in=src --limit=3 +$ ./build/ripwire . --rank-by=churn-decay --since=HEAD~5 --exclude=test --exclude=docs --exclude=skills --exclude=changelog.d --in=src --limit=3 - - - - - - - - - + + + + + + + - -... [6 more line(s); run it to see the whole thing] + + + +... [4 more line(s); run it to see the whole thing] ``` **Shaped by:** `--external-surface`, `--doctor`, `--legend`, `--max-memory` @@ -4610,7 +4608,7 @@ _The same gating report under --legend=full — same rows, same exit 2; the defa ``` $ ./build/ripwire . --quality-delta --legend=full - @@ -4705,7 +4703,7 @@ _The family join: per function, which of four orthogonal evidence families fire, ``` $ ./build/ripwire . --ensemble --limit=8 - @@ -4743,8 +4741,8 @@ $ ./build/ripwire . --exclude=present --exclude=bench --top-k=5 - - + + @@ -4774,10 +4772,10 @@ $ ./build/ripwire . --map-diff --top-k=5 - - + + - + @@ -4808,10 +4806,10 @@ $ ./build/ripwire . --cache=/aux/warm2.ripwirecache --top-k=3 - - + + - + @@ -4858,10 +4856,10 @@ $ ./build/ripwire . --no-cache --top-k=3 - - + + - + @@ -4889,10 +4887,10 @@ $ ./build/ripwire . --no-ignore --top-k=3 - - + + - + @@ -4925,7 +4923,7 @@ $ ./build/ripwire . --max-file-size=8K --top-k=3 - + @@ -5005,10 +5003,10 @@ $ ./build/ripwire . --pin-census=/aux/pin_census.tsv --top-k=3 - - + + - + @@ -5030,7 +5028,7 @@ _initialize + tools/list: the manifest an agent host loads at session start — ``` $ ./build/ripwire '%s\n' '{"jsonrpc":"2.0","id":1,"method":"initialize"}' '{"jsonrpc":"2.0","id":2,"method":"tools/list"}' | ./build/ripwire --mcp -{"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2025-11-25","serverInfo":{"name":"ripwire","version":"0.6.10-dev.100+gda897642e"},"capabilities":{"tools":{},"resources":{}},"instructions":"Map before reading files. Start a new task with explore; use from_trace for an error; use impact plus uses … [line truncated: 760 more bytes on this line] +{"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2025-11-25","serverInfo":{"name":"ripwire","version":"0.6.10-dev.99+gd3a73cd6e"},"capabilities":{"tools":{},"resources":{}},"instructions":"Map before reading files. Start a new task with explore; use from_trace for an error; use impact plus uses … [line truncated: 759 more bytes on this line] {"jsonrpc":"2.0","id":2,"result":{"tools":[{"name":"analyze","description":"Architecture map for a directory: signatures and the call graph for the top symbols. Use when landing cold in a repo or subdir, before reading files; for a task-scoped inventory use 'for', for one symbol's neighborhood find_ … [line truncated: 742 more bytes on this line] {"name":"rank_by","description":"The SAME architecture map 'analyze' serves, ranked by a different signal instead of plain PageRank. rank_by = pagerank (default, omit it — the CLI's own unbiased --rank-by=pagerank; 'analyze' can rank differently on a tree with uncommitted changes, where it biases … [line truncated: 1077 more bytes on this line] {"name":"find_symbol","description":"A symbol's 1-hop neighborhood: the symbol (with a fetch_body handle) plus direct callers (calledBy) and callees (calls). Full transitive reach: 'impact'. Read/write/import sites, not just calls: 'uses'. JSON {symbol, calledBy, calls, defs, count, hop_tested, hop_ … [line truncated: 1181 more bytes on this line] @@ -5056,11 +5054,11 @@ _--mcp-legend=inline: every answer of the stdio session carries its own legend ( ``` $ ./build/ripwire '%s\n' '{"jsonrpc":"2.0","id":1,"method":"initialize"}' '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"whereis","arguments":{"path":".","symbol":"rankGraphTeleport"}}}' '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"whereis","arguments":{"path":".","symbol":"computeOnePairOverlap"}}}' | ./build/ripwire --mcp --mcp-legend=inline -{"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2025-11-25","serverInfo":{"name":"ripwire","version":"0.6.10-dev.100+gda897642e"},"capabilities":{"tools":{},"resources":{}},"instructions":"Map before reading files. Start a new task with explore; use from_trace for an error; use impact plus uses … [line truncated: 757 more bytes on this line] +{"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2025-11-25","serverInfo":{"name":"ripwire","version":"0.6.10-dev.99+gd3a73cd6e"},"capabilities":{"tools":{},"resources":{}},"instructions":"Map before reading files. Start a new task with explore; use from_trace for an error; use impact plus uses … [line truncated: 756 more bytes on this line] {"jsonrpc":"2.0","id":2,"result":{"content":[{"type":"text","text":" @@ -31,10 +31,10 @@ - - + + - + @@ -56,24 +56,24 @@ -… [765 more display lines; full output is 26221 bytes on 1 raw line(s)] +… [767 more display lines; full output is 26365 bytes on 1 raw line(s)] ````` ## `./build/ripwire . --top-k=5` *Same map, capped to the 5 highest-ranked symbols.* -**wall time: 1.55s** +**wall time: 1.40s** ````` - - + + - + @@ -89,14 +89,14 @@ - + -… [85 more display lines; full output is 10186 bytes on 1 raw line(s)] +… [86 more display lines; full output is 10233 bytes on 1 raw line(s)] ````` ## `./build/ripwire . --top-k=5 --no-inventory` @@ -108,10 +108,10 @@ - - + + - + @@ -139,7 +139,7 @@ - - + + - + @@ -211,33 +209,33 @@ ripwire: --top-k=0 means "no ranked map, payload only" — pass a payload verb ( *GATE form: exit 3 if the map's own est_tokens exceeds the budget (over-budget failure shape).* -**exit code: 3** — **wall time: 1.57s** +**exit code: 3** ````` - + ````` stderr: ````` -ripwire: --token-budget exceeded: withheld_est_tokens=10563 > budget=100 +ripwire: --token-budget exceeded: withheld_est_tokens=10621 > budget=100 ````` ## `./build/ripwire . --for="incremental cache invalidation when a file content hash changes"` *The task lens: ranked signatures + quality metrics framed for the task.* -**wall time: 12.57s** +**wall time: 5.16s** ````` - - + incremental cache (--cache): per-file content hash + raw facts so a re-run re-parses ONLY c…constexpr std::uint32_t kCacheMagic = 0x4b505443 - + and every file whose content hash differs is re-parsed — so a stale or foreign blob self-heals…constexpr std::uint32_t kHeadSnapCacheScheme = 1 inline McpRebuildBaseline mcpRebuildBaseline( const McpIndex& ix, bool isIncrementalPass ) inline void noteFactlessMiss( ParsePoolShared& sh, std::size_t fileId, bool nestRefused ) noexcept @@ -261,21 +259,21 @@ ripwire: --token-budget exceeded: withheld_est_tokens=10563 > budget=100 struct IngestFileScan inline std::uint64_t byteHash( const char* data, std::size_t n ) noexcept -… [217 more display lines; full output is 24474 bytes on 8 raw line(s)] +… [216 more display lines; full output is 24383 bytes on 8 raw line(s)] ````` ## `./build/ripwire . --for="rankGraphTeleport"` *Name-shaped query: the router picks name-exact BM25 (header says which/why).* -**wall time: 7.94s** +**wall time: 1.82s** ````` - + - + PageRank with an explicit teleport / personalization vector p (Σp = 1). The prior is name-quality-biased through biasPrior() so all rank modes share one weighting seam; the transition matrix (edgesinline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>&am … [line truncated: 31 more bytes on this line] #### The convergence disclosure contract ### Wave-2 adversarial verification (2026-08-19) — six probes against `aa97c9e` @@ -287,8 +285,8 @@ ripwire: --token-budget exceeded: withheld_est_tokens=10563 > budget=100 - - + + @@ -299,7 +297,7 @@ ripwire: --token-budget exceeded: withheld_est_tokens=10563 > budget=100 - + & p, float alpha = 0.85f ) … [28 more display lines; full output is 6611 bytes on 29 raw line(s)] ````` @@ -308,24 +306,24 @@ ripwire: --token-budget exceeded: withheld_est_tokens=10563 > budget=100 *Same query with routing forced OFF (plain subtoken+body BM25) — contrast with the routed run.* -**wall time: 6.17s** +**wall time: 1.83s** ````` - + - + PageRank with an explicit teleport / personalization vector p (Σp = 1). The prior is name-quali…inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>& p, float alpha = 0.85f ) - + uniform-teleport PageRank (the default). A kRankFlagNotNamed unit (model.h) has no edge and a 0 …inline RankedGraph rankGraph( const Graph& g, float alpha = 0.85f ) The default map's PageRank — uniform teleport, the one rank that is a function of the Graph al…inline std::optional<RankedGraph>& storedDefaultRank() noexcept inline ChurnRanking churnRankedGraph( const MainDispatch& d ) inline constexpr const char* kChurnRankLegend = "<!-- rank_by=churn: k= is PageRank re-run with the teleport BIASED by git CHANGE-FREQUENCY over window= " "(a c… -struct RankedGraph -inline std::vector<float> takeRank( RankedGraph ranked, RankDisclosure& disclosureOut ) -inline std::vector<float> biasPrior( const Graph& g, const std::vector<float>& p ) +struct RankedGraph +inline std::vector<float> takeRank( RankedGraph ranked, RankDisclosure& disclosureOut ) +inline std::vector<float> biasPrior( const Graph& g, const std::vector<float>& p ) inline std::vector<float> churnTeleportWorkspace( const std::vector<std::string>& rootDirs, const IngestResult& ing, const char* since = "18 months ago … [line truncated: 21 more bytes on this line] inline ChurnRanking churnDecayRanking( const MainDispatch& d, const rw::SinceScope& sinceScope, bool isScoped, const char* verbLabel ) PageRankRun pageRankDouble( const sparseCsr<float>& inEdges, std::span<const double> weightedOutDegree, std::span<const double> teleport, std::span<double> rank… @@ -348,14 +346,14 @@ ripwire: --token-budget exceeded: withheld_est_tokens=10563 > budget=100 *T3 opt-out: the signatures-only lens (no auto bodies, no bundle="auto" attribute) — contrast with the terminal default above.* -**wall time: 6.85s** +**wall time: 1.67s** ````` - + - + PageRank with an explicit teleport / personalization vector p (Σp = 1). The prior is name-quality-biased through biasPrior() so all rank modes share one weighting seam; the transition matrix (edgesinline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>&am … [line truncated: 31 more bytes on this line] #### The convergence disclosure contract ### Wave-2 adversarial verification (2026-08-19) — six probes against `aa97c9e` @@ -367,9 +365,9 @@ ripwire: --token-budget exceeded: withheld_est_tokens=10563 > budget=100 - - - + + + ````` @@ -378,25 +376,25 @@ ripwire: --token-budget exceeded: withheld_est_tokens=10563 > budget=100 *Cut the result at the relevance cliff (Adaptive-k) — on a flat ranking nothing is cut and the header says so ([adaptive: kept N of N]).* -**wall time: 7.83s** +**wall time: 1.28s** ````` - + - + inline bool topLevelEvidence( std::string_view source, const TSLanguage* language, const Predicate& predicate ) The crawl's per-file byte ceiling. A text file larger than this is skipped: at this size it is o…constexpr std::size_t kDefaultMaxFileBytes = 4u * 1024u * 1024u TSTree* parseTree( TSParser* parser, std::string_view src ) Exercise every registered grammar and its embedded query, reporting loaded and expected totalsinline DoctorGrammarProbe doctorProbeGrammars() -class SourceReader +class SourceReader constexpr std::array<LangEntry, 58> kLangTable = struct FileHealth struct SliceScan -explicit ParsedFile( std::string bytes ) : m_bytes( std::move( bytes ) ) -class ParsedFile +explicit ParsedFile( std::string bytes ) : m_bytes( std::move( bytes ) ) +class ParsedFile @@ -405,23 +403,23 @@ ripwire: --token-budget exceeded: withheld_est_tokens=10563 > budget=100 inline ModuleScan scanModule( std::string_view source, std::string_view path ) inline bool hasMainGuard( std::string_view source ) -inline bool hasPhantomScopeSeparator( TSNode qualified ) noexcept +inline bool hasPhantomScopeSeparator( TSNode qualified ) noexcept -… [242 more display lines; full output is 26676 bytes on 44 raw line(s)] +… [242 more display lines; full output is 26881 bytes on 44 raw line(s)] ````` ## `./build/ripwire . --for="why does src/lexical.h chooseForRanker pick name-exact BM25"` *Mention anchoring (default-on): a path and a Symbol literally named in the task get lifted; the header says what anchored.* -**wall time: 7.30s** +**wall time: 1.11s** ````` - @@ -442,7 +440,7 @@ ripwire: --token-budget exceeded: withheld_est_tokens=10563 > budget=100 inline int runEvalMined( const std::string& root, const IngestResult& ing, const Graph& g, const std::string& path ) struct LensRanking -inline bool hasIdentifierShape( std::string_view w ) noexcept +inline bool hasIdentifierShape( std::string_view w ) noexcept inline int runEvalSkills( const std::string& root, const IngestResult& ing, const Graph& g, const std::string& labelsPath ) inline std::vector<SourceSyntaxAnchor> applyAnchorHonesty( const IngestResult& ing, std::string_view task, SubjectRoute& out ) @@ -451,17 +449,15 @@ ripwire: --token-budget exceeded: withheld_est_tokens=10563 > budget=100 inline constexpr int kLexWeightDoc = 2 inline std::vector<float> lexicalScoresNameExact( const IngestResult& ing, std::string_view query ) inline void hedgeOffTaskPick( const IngestResult& ing, ExemplarPick& pick ) -… [273 more display lines; full output is 31744 bytes on 18 raw line(s)] +… [273 more display lines; full output is 31747 bytes on 18 raw line(s)] ````` ## `./build/ripwire . --for="why does src/lexical.h chooseForRanker pick name-exact BM25" --no-mention-boost` *Same task with the anchor disabled — the contrast the flag exists for.* -**wall time: 6.71s** - ````` - @@ -480,7 +476,7 @@ ripwire: --token-budget exceeded: withheld_est_tokens=10563 > budget=100 inline RouteChoice routeAnchorFallThrough( std::string_view query, const RouteChoice& anchored ) inline int runEvalMined( const std::string& root, const IngestResult& ing, const Graph& g, const std::string& path ) struct LensRanking -inline bool hasIdentifierShape( std::string_view w ) noexcept +inline bool hasIdentifierShape( std::string_view w ) noexcept inline int runEvalSkills( const std::string& root, const IngestResult& ing, const Graph& g, const std::string& labelsPath ) inline std::vector<SourceSyntaxAnchor> applyAnchorHonesty( const IngestResult& ing, std::string_view task, SubjectRoute& out ) @@ -491,19 +487,17 @@ ripwire: --token-budget exceeded: withheld_est_tokens=10563 > budget=100 inline constexpr int kLexWeightDoc = 2 inline std::vector<float> lexicalScoresNameExact( const IngestResult& ing, std::string_view query ) inline void hedgeOffTaskPick( const IngestResult& ing, ExemplarPick& pick ) -… [273 more display lines; full output is 31441 bytes on 18 raw line(s)] +… [273 more display lines; full output is 31444 bytes on 18 raw line(s)] ````` ## `./build/ripwire . --lego=Vehicle` *Interface -> implementors view: every existing impl of the named interface; the method contract is extracted for the C-family/Java/TS/Python tiers — for a Rust trait (this fixture) it discloses caveat="not-extracted-for-lang" rather than an empty list.* -**wall time: 1.18s** - ````` - + @@ -519,7 +513,7 @@ ripwire: --token-budget exceeded: withheld_est_tokens=10563 > budget=100 ````` @@ -555,8 +547,6 @@ ripwire: --token-budget exceeded: withheld_est_tokens=10563 > budget=100 *The honest half of the contract: a task with no ripwire-shaped evidence ABSTAINS with zero commands rather than guessing.* -**wall time: 2.99s** - ````` @@ -571,7 +561,7 @@ ripwire: --token-budget exceeded: withheld_est_tokens=10563 > budget=100 ````` ripwire recall — "quality delta gating exit codes" — 135 relevant of 347 document files, best-first — total=135 shown=6 capped=1 truncated=5 generated_demoted=2 generated_demoted_paths="docs/TUNING.md,docs/LIMITS.md" max_tokens=8000 share_bytes=2792 est_tokens=5385 -━━ docs/REFERENCE_GUIDE.md (relevance 22.002) ━━ [sections: 2 of 12 selected (27 in doc), section-granular; whole doc 43914 B; lines="405-417,418-425"; dropped_by_budget=10] +━━ docs/REFERENCE_GUIDE.md (relevance 21.999) ━━ [sections: 2 of 12 selected (27 in doc), section-granular; whole doc 43914 B; lines="405-417,418-425"; dropped_by_budget=10] #### 6.2 Exit codes This is the part to wire into a script. @@ -595,7 +585,7 @@ refuses by default. -━━ CHANGELOG.md (relevance 21.167) ━━ [sections: 1 of 129 selected (611 in doc), section-granular; whole doc 1298822 B; lines="2552-2576"; dropped_by_budget=128] [truncated: 2557 of 3826 bytes] +━━ CHANGELOG.md (relevance 21.165) ━━ [sections: 1 of 129 selected (611 in doc), section-granular; whole doc 1298822 B; lines="2552-2576"; dropped_by_budget=128] [truncated: 2557 of 3826 bytes] ### Changed — `--quality-delta=A..B` answers the kinds it can under memory pressure, and exits 6 when that answer has no gating row (#387 follow-up) A tripped memory guard in the range form used to give exit 5 and nothing, so on a large repository a four-file change @@ -610,38 +600,17 @@ ripwire: redacted 1 secret from emitted context (keyword-gated-secret=1) — pas ## `./build/ripwire /aux/kbcorpus --recall="field affinity cache line data layout which fields are read together" --top-k=3 --max-tokens=1200` -*The directory-as-knowledge-base pattern: --recall pointed at a 1596008-byte scratch dir of DUMPED TOOL OUTPUT (a git log, this repo's own generated command reference, --help text, an architecture doc, a fabricated JSON access log) instead of a source repo — no index to build, no daemon.* +*The directory-as-knowledge-base pattern: --recall pointed at a 1565718-byte scratch dir of DUMPED TOOL OUTPUT (a git log, this repo's own generated command reference, --help text, an architecture doc, a fabricated JSON access log) instead of a source repo — no index to build, no daemon.* ````` -ripwire recall — "field affinity cache line data layout which fields are read together" — 2 relevant of 2 document files, best-first — total=2 shown=1 capped=1 truncated=1 max_tokens=1200 share_bytes=2040 est_tokens=952 - -━━ commands.md (relevance 36.154) ━━ [sections: 1 of 166 selected (196 in doc), section-granular; whole doc 637290 B; lines="567-592"; dropped_by_budget=165] [truncated: 1854 of 4284 bytes] -#### Pattern: a directory of dumped tool output as a knowledge base +ripwire recall — "field affinity cache line data layout which fields are read together" — 2 relevant of 2 document files, best-first — total=2 shown=1 capped=1 truncated=1 max_tokens=1200 share_bytes=2040 est_tokens=957 -**Answers:** can `--recall` serve as a zero-setup knowledge base over dumped tool output — a -`git log`, an API response dump, a fetched doc, ` --help` text — sitting in a scratch -directory, instead of a source repo? +━━ commands.md (relevance 33.734) ━━ [sections: 1 of 166 selected (196 in doc), section-granular; whole doc 637840 B; lines="3892-3896"; dropped_by_budget=165] [truncated: 1865 of 7797 bytes] +### `--field-affinity[=STRUCT]` -Yes, unmodified. `--recall` never distinguishes "a codebase" from any other directory it can -walk: point it at the scratch dir and query it. No index to build, no daemon, no mutable store -between runs — the whole cost is one cold parse. Two conditions decide whether it works at all, -and both are yours, because the file you write is the only thing that sets them: +**Answers:** find fields that are read together but declared far apart — the cache-locality lens the CACHE-LOCALITY lens: which fields are READ TOGETHER but declared FAR APART. -1. **Dump to `.md`.** `--recall` ranks DOCUMENT files: `.md`, plus the docparse'd - `.ipynb`/`.html`/`.csv` (and Office/PDF through the optional markitdown bridge). `.txt`, - `.log`, `.json` and extensionless files are **not** documents to it. A directory of those - answers `0 relevant of 0 document files` and exits 0 — which reads like "nothing matched - your terms" when what happened is "nothing was indexed at all". Redirect to `notes.md`, - never `notes.txt`. The recorded run below is that rule's own demonstration: its scratch dir - holds five dumps, and the header says `2 relevant of 2 document files` because only the two - `.md` ones are documents — the `git log`, the `--help` text and the JSON access log are not - in the population at all. - -2. **Keep `##` headings in the dump.** A headed document is served as whole ranked SECTIONS, so - an answer buried mid-file arrives at a small `--max-tokens`, and — while the served document - SET stays fixed — a larger ceiling returns a strict superset of it; the `[sections: S of R - selected (N in doc) … lines="…"; dropped_by_budget=D]` note names the ranges you actually got - and what the ceiling cost. … +Builds a static field CO-ACCESS affinity graph (one observation per indexed C-family function body) and diffs it against the DECLARED field order and 64-byte cache-line geometry, reusing --layout's LP64 offset model. Bare = every aggregate in the repo, ranked by separation cost; =STRUCT narrows the … [line truncated: 1355 more bytes on this line] (capped: 1 of 2 relevant document files omitted — raise --max-tokens/budget_tokens or narrow the query for 1 more (~2548-byte budget)) ````` @@ -658,7 +627,7 @@ ripwire: redacted 1 secret from emitted context (keyword-gated-secret=1) — pas ````` - + @@ -677,7 +646,7 @@ ripwire: redacted 1 secret from emitted context (keyword-gated-secret=1) — pas - + @@ -687,14 +656,14 @@ ripwire: redacted 1 secret from emitted context (keyword-gated-secret=1) — pas -… [366 more display lines; full output is 11060 bytes on 1 raw line(s)] +… [366 more display lines; full output is 11081 bytes on 1 raw line(s)] ````` ## `./build/ripwire . --html=/aux/map2.html` *Self-contained HTML force-directed call graph.* -**wall time: 6.58s** +**wall time: 2.29s** ````` (empty) @@ -703,21 +672,19 @@ ripwire: redacted 1 secret from emitted context (keyword-gated-secret=1) — pas Artifact written: ````` - 155101 /aux/map2.html + 155134 /aux/map2.html ````` ## `./build/ripwire . --order=stable --top-k=5` *Stable (path/id) emit order — provider KV-cache hits across re-runs.* -**wall time: 1.67s** - ````` - + @@ -735,7 +702,7 @@ Artifact written: - + @@ -743,7 +710,7 @@ Artifact written: -… [85 more display lines; full output is 10204 bytes on 1 raw line(s)] +… [86 more display lines; full output is 10251 bytes on 1 raw line(s)] ````` @@ -755,15 +722,13 @@ Artifact written: *Ego graph around one symbol — depth 1 BY DEFAULT now (the root's depth= says so): ~6 KB where the 2-hop neighbourhood is ~64 KB on this repo.* -**wall time: 1.06s** - ````` - + @@ -803,8 +768,8 @@ Artifact written: - - + + @@ -826,7 +791,7 @@ Artifact written: -… [2428 more display lines; full output is 73948 bytes on 1 raw line(s)] +… [2452 more display lines; full output is 74786 bytes on 1 raw line(s)] ````` ## `./build/ripwire . --around=rankGraphTeleport --around-fanout=4` @@ -839,7 +804,7 @@ Artifact written: - + @@ -871,14 +836,12 @@ Artifact written: *Who calls SYM (1-hop in-edges).* -**wall time: 1.06s** - ````` - + - - + + @@ -893,10 +856,10 @@ Artifact written: ````` - + - - + + @@ -908,7 +871,7 @@ Artifact written: *Unknown-symbol REFUSAL shape (exit 1) with a did-you-mean from real edit distance.* -**exit code: 1** — **wall time: 5.36s** +**exit code: 1** ````` @@ -927,18 +890,18 @@ ripwire: --callers symbol not found: DoesNotExist (note: the lexical definition ````` - - + + - - - - - - + + + + + + ````` @@ -946,14 +909,12 @@ ripwire: --callers symbol not found: DoesNotExist (note: the lexical definition *The resolvable use-sites (call/read/write/import/extends) with file:line; count= is a floor.* -**wall time: 1.47s** - ````` - + - - + + @@ -969,10 +930,10 @@ ripwire: --callers symbol not found: DoesNotExist (note: the lexical definition ````` - + - - + + @@ -1007,30 +968,30 @@ ripwire: --callers symbol not found: DoesNotExist (note: the lexical definition ````` - - - - + + + + - - + + - + - - - + + + - + - + - + @@ -1045,36 +1006,36 @@ ripwire: --callers symbol not found: DoesNotExist (note: the lexical definition ````` - - - - - - - - + + + + + + + + - - - + + + - + - - - - + + + + - + - + -… [73 more display lines; full output is 5507 bytes on 1 raw line(s)] +… [73 more display lines; full output is 5508 bytes on 1 raw line(s)] ````` ## `./build/ripwire . --path=main,rankGraphTeleport` @@ -1083,20 +1044,20 @@ ripwire: --callers symbol not found: DoesNotExist (note: the lexical definition ````` - - - + @@ -1124,7 +1085,7 @@ ripwire: --callers symbol not found: DoesNotExist (note: the lexical definition - + @@ -1138,7 +1099,7 @@ ripwire: --callers symbol not found: DoesNotExist (note: the lexical definition - + ````` @@ -1149,10 +1110,10 @@ ripwire: --callers symbol not found: DoesNotExist (note: the lexical definition ````` - + - + @@ -1164,8 +1125,6 @@ ripwire: --callers symbol not found: DoesNotExist (note: the lexical definition *Transitive blast radius — everything that reaches SYM. NOW carries shown/capped.* -**wall time: 1.51s** - ````` - - + + @@ -1221,11 +1180,9 @@ ripwire: --callers symbol not found: DoesNotExist (note: the lexical definition *Test files that transitively reach the changed file.* -**wall time: 1.24s** - ````` - @@ -1243,12 +1200,10 @@ ripwire: --callers symbol not found: DoesNotExist (note: the lexical definition *Mid-task situational report for the current git diff — recorded against a CLEAN tree (contrast with the sandbox run below).* -**wall time: 4.99s** - ````` ripwire situational-awareness — 0 changed file(s), 0 symbols in them root: . -at: da897642e +at: d3a73cd6e (0 changed files — working tree is clean, nothing to analyze) ````` @@ -1256,11 +1211,11 @@ at: da897642e *Pre-PR gate on a CLEAN tree: no obligations, exit 0.* -**wall time: 12.03s** +**wall time: 4.90s** ````` - ````` @@ -1268,8 +1223,6 @@ at: da897642e *Literal trigram-indexed search. Each hit carries its MATCHED line as the element's own CDATA (the wrapper is gone), plus shown/capped/hits_capped and a pasteable next= on the root.* -**wall time: 1.27s** - ````` @@ -1447,11 +1398,11 @@ at: da897642e *The same shape query WITH an explicit capture — identical hits, no auto_captured= attribute.* -**wall time: 2.75s** +**wall time: 1.68s** ````` -if data.get( "schema" ) != SCHEMA: raise SystemExit( f"{path}: unexpected schema {data.get('schema')!r} (expecte if not str( data.get( "tasks_lock_content_sha256", "" ) ).startswith( "questions:" ): train_repos = select_tasks if train_repos: raise SystemExit( f"{path}: records from repo(s) that re-derive to LocBench @@ -1487,22 +1438,20 @@ at: da897642e *Raw BM25 ranking (debug lens; --for is the real verb).* -**wall time: 2.37s** - ````` - + - + - + @@ -1513,12 +1462,12 @@ at: da897642e - + - + … [23 more display lines; full output is 3783 bytes on 1 raw line(s)] ````` @@ -1532,10 +1481,8 @@ at: da897642e *Importance-weighted detail: FULL bodies for top-2, signatures for the rest.* -**wall time: 5.50s** - ````` - + @@ -1546,21 +1493,21 @@ at: da897642e The PageRank power iteration itself — the numeric kernel every ranked document's order comes f…PageRankRun pageRankDouble( const sparseCsr<float>& inEdges, std::span<const double> weightedOutDegree, std::span<const double> teleport, std::span<double> r … [line truncated: 10 more bytes on this line] inline std::string rankByText( const std::string& root, std::string_view mode, int topK, bool stable = false ) -struct RankedGraph +struct RankedGraph inline constexpr const char* kChurnRankLegend = "<!-- rank_by=churn: k= is PageRank re-run with the teleport BIASED by git CHANGE-FREQUENCY over window= " "(a c… inline std::uint32_t sliceRdIterationCeiling() noexcept struct PageRankRun Render one form of the disclosure. Empty string whenever there is nothing to say — no power it…inline std::string renderDisclosure( const RankDisclosure& d, DiscloseAs as ) -inline std::uint32_t navRelevanceWeight( const Graph& g, NodeId n ) noexcept -inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>& p, float alpha = 0.85f ) +inline std::uint32_t navRelevanceWeight( const Graph& g, NodeId n ) noexcept +inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>& p, float alpha = 0.85f ) inline constexpr std::string_view kPowerShellPathPrependScope = "in PowerShell, for this window inline std::string path_prepend_hint( std::string_view dir ) -HOT_FILES = ( "src/pagerank.cpp", # the power-iteration loop — G2's no-allocation scope "src/infra/radixSort.h", # LSD radix entry points "src/infra/radixSort.inl", # the counting … [line truncated: 76 more bytes on this line] -handle_t leftmost_leaf() const +handle_t leftmost_leaf() const +HOT_FILES = ( "src/pagerank.cpp", # the power-iteration loop — G2's no-allocation scope "src/infra/radixSort.h", # LSD radix entry points "src/infra/radixSort.inl", # the counting … [line truncated: 76 more bytes on this line] inline std::string doctorPathPrependLine( const std::string& selfPath ) @@ -1572,19 +1519,17 @@ at: da897642e *Body-elided decl skeletons — recounted on this corpus. Measured as element bytes: the signature+doc elements --pack-signatures emits, against the SAME symbols' full bodies from --expand, with the CORPUS-ROOT PREFIX SUBTRACTED FROM BOTH SIDES. That subtraction is the whole methodology and the figure is meaningless without it: the root repeats inside every element's id= and p=, it is not what this verb elides, and counting it makes the headline a function of how deep the checkout happens to sit on disk — on one corpus, three spellings of the same root read 18.6 points apart before the subtraction and agree exactly after it. Root-neutralised on THIS repo: 89.7% fewer bytes at top-10, 88.0% at top-50, 87.8% at top-100 (re-derived 2026-10-10 when the C++ standard-member gate stopped std::vector/std::string calls such as out.push_back() and s.empty() from binding to in-tree namesakes by name: the ranked top-10/50 lost one-line container accessors (svector::push_back, WidePath::c_str, every empty) and gained one-line forwarding helpers and macros (kindIs, ASSUME, formatTo, emitTo) whose signature is nearly the whole body, so less of the set is elidable, from 92.7/88.7/87.6; before that, re-derived 2026-09-20 when the native Windows port landed: src/infra/os_win32.cpp and os_win32_logic.h are ~3,900 lines of new, heavily commented infra that the ranked top-10/50/100 now reach, and their bodies are this ratio's DENOMINATOR, so the figure rises without --pack-signatures eliding anything new, from top-50 87.1. Measured by test/showcasecapturecheck.sh's own recount arm on the combined tree, which is the gate that would otherwise report the drift; before that, re-derived 2026-09-17 at the self-check macro vocabulary rename: VERIFY/VERIFY_TEXT/VERIFY_DEBUG_ONLY/VERIFY_NOT_REACHED/VERIFY_SAME_THREAD/VERIFY_NO_ALIAS*/DYNMAP_VERIFY/DEGRADED_PATH_ALERT renamed to ASSUME/EXPECTS/ENSURES/DASSERT/UNREACHABLE/ASSUME_SAME_THREAD*/ASSUME_NO_ALIAS*/DYNMAP_ASSUME/DISCLOSE (plus new VALIDATE sites) across 839 identifier renames in 179 files, and a hand-written Diagnostics.h/diagnostics.cpp replacing the old ones outright: this moves both WHICH symbols the ranked top-10/50/100 hold and how large their bodies are, from top-50 85.2. A real re-derivation of a corpus that changed, not a tolerance edit; previously re-derived 2026-09-12 when the rows dropped the path-repeating id= for the short sc= scope: the signature side shrank, the bodies did not; before that, 89.5% / 81.8% / 84.3% re-derived 2026-09-10 at the sibs= cap raise: kMaxExpandSibs went 8 -> 100, so --expand's bodies now carry the file context the old cap hid — 89.3% of all sibling names — and the body side is this ratio's DENOMINATOR, so the figure rises without --pack-signatures eliding anything new. Measured on a fixed tree with the top-50 membership and the signature side unchanged: top-50 from 71.0. A real re-derivation of a corpus that changed, not a tolerance edit; previously re-derived 2026-09-09 at the printf-family -> std::print conversion: converting ~1,500 emitter call sites to rw::emitTo/emitRaw/formatTo across 93 files changes how large the ranked symbols' BODIES are, and the body side is this ratio's denominator — top-50 from 72.3. A real re-derivation of a corpus that changed, not a tolerance edit; previously re-derived 2026-09-08 at the confident-zero round, issues #62/#63/#66: that change adds symbols to src/graphlegend.h and the new src/preprocdead.h and re-homes two long comment blocks from call sites onto the helpers they explain, which moves both WHICH symbols the ranked top-50 holds and how large their bodies are — top-50 from 74.0. A real re-derivation of a corpus that changed, not a tolerance edit; previously re-derived 2026-09-06 at the stranger-audit fix round: the doctor, cache-sweep and html-provenance bodies grew this corpus's BODY side, moving top-50 from 75.6 — a real re-derivation, not a tolerance edit; before that, re-derived 2026-09-05 at the capture-audit close: lane L7's P16 caps --expand's sibs= at 8 names, which SHRINKS the body side of this ratio and moved the figure down from 84.5/80.2/80.6 — the V1 2026-08-15 re-center, when sibs=/inc= first grew the body side from 70.0/61.0/63.8, in reverse; both were real re-derivations, not tolerance edits). top-50 is the number to quote, because the sigs payload is top-50 regardless of --top-k and is therefore what THIS command emits. A single small/trivial body can still invert it (signature+doc bigger than the body), like the --format=columnar sibling below. test/showcasecapturecheck.sh (C) re-derives all three from this repo every run, in the same quantity, and fails if the caption and the recount drift apart.* -**wall time: 1.15s** - ````` - - + + - + @@ -1605,21 +1550,19 @@ at: da897642e -… [146 more display lines; full output is 15445 bytes on 1 raw line(s)] +… [145 more display lines; full output is 15481 bytes on 1 raw line(s)] ````` ## `./build/ripwire . --outline=rankGraphTeleport --top-k=0` *Control-flow skeleton of one symbol, payload-only via the new --top-k=0.* -**wall time: 1.40s** - ````` - + & p, float alpha = 0.85f ) { PROFILE_SCOPE_DESCRIBE( "rankGraph: PageRank (power iteration)" ); @@ -1643,14 +1586,12 @@ at: da897642e *CHANGED: a line range on --outline is now STRIPPED with a stderr note (it used to refuse).* -**wall time: 1.44s** - ````` - + & p, float alpha = 0.85f ) { PROFILE_SCOPE_DESCRIBE( "rankGraph: PageRank (power iteration)" ); @@ -1680,14 +1621,12 @@ ripwire: --outline=rankGraphTeleport:1-10: --outline has no line-range form — *Full body + inline callee signatures.* -**wall time: 1.27s** - ````` - + : files the ranked rows show / do not (sum = files=), each named or counted below. : a program entry by its language's convention (C/Go/Rust main, Java/C# static main, a script main its module scope calls, __main__.py), callees as c rows; manifest entries not read. : n= unshown files under dir p=; f= names its code files, the rest (tests, docs, config, test/doc/example dirs) counted. declined=K: K call sites without edges, including inert Elixir quote sites after unquote/unquote_splicing re-entry. external=K: K calls proven outside the tree, no edge. locality_pinned=K: K calls pinned by locality alone (a guess). extent_suspect_syms=K: K defs failed containment, corpus-wide. macro_blanked_files=K: K files indexed from a macro-blanked re-parse. prov=scip|binding|import|split|final-segment: how that edge bound (absent: one unique name); split = one arm of an amb= pick; final-segment = a qualified type matched by last name only. files=/symbols=: files and symbols indexed; edges= distinct call edges; shown= symbols printed, a merged row counting each def; ambiguous= calls split over several defs, corpus-wide; unresolved= calls with in-tree evidence and no edge (every def language-filtered or unreachable, or binding refused); order= rows by rank (important-first, important-last; (auto:fill) = flipped past a size threshold) or by path (stable). skipped_oversize=K: K files over a size ceiling, not indexed. unindexed=ext:N: N text files of that extension no grammar reads (6 extensions at most). unindexed_exts=E: E such extensions in all, the list cut. : a non-test row an indexed test transitively reaches (absent otherwise, never 0). : that callee matched by name alone (receiver unproven); it does NOT mean the edge is false. sc=: enclosing scope; the full id is p::sc::n (p= of the row or its ) and selectors take it. amb=K: K calls split over several defs. locals_floor=1: locals= is a floor. role=hub: in= is 8 or more. s in= out= cx= ccx= loc= params= nest= cbo= lcom4= amp=: callers, callees, cyclomatic/cognitive complexity, lines, parameters, nesting depth, coupled types, class cohesion, callers + co-changed files. ev=/ev_why=: essential complexity (2+: jumps block extract-method; absent: 1) / the jumps behind it, tag:count. ev_floor=1: ev= is a FLOOR; noreturn calls, macro-hidden exits and unresolved gotos are unseen. layer=: built-in arch layer (game|infra|render|math|audio|ai|test) from a dir name in p=; absent if none. l=N: start line; only on a same-name overload's row, one row per body (bodyless decls fold into overloads=). f p=: a file; s t= n=: kind, name; c n=: a resolved callee. s k=: rank. --> + - - + + - + @@ -1894,7 +1829,7 @@ ripwire: --pack-top-n is deprecated — use --pack-task/--detail instead (unchan - + @@ -1907,7 +1842,7 @@ ripwire: --pack-top-n is deprecated — use --pack-task/--detail instead (unchan -… [108 more display lines; full output is 12758 bytes on 1 raw line(s)] +… [110 more display lines; full output is 12768 bytes on 1 raw line(s)] ````` ## `./build/ripwire . --deps` @@ -1916,10 +1851,10 @@ ripwire: --pack-top-n is deprecated — use --pack-task/--detail instead (unchan ````` - - - - + + + + @@ -1952,51 +1887,51 @@ ripwire: --pack-top-n is deprecated — use --pack-task/--detail instead (unchan *Complexity x recent git churn (maintenance pain).* -**wall time: 8.62s** +**wall time: 2.33s** ````` - - - + + + - + - + + - - + - + -… [14 more display lines; full output is 5825 bytes on 1 raw line(s)] +… [14 more display lines; full output is 5831 bytes on 1 raw line(s)] ````` ## `./build/ripwire . --clones` *Token-normalized duplicate bodies.* -**wall time: 5.57s** +**wall time: 1.31s** ````` - + @@ -2006,7 +1941,7 @@ ripwire: --pack-top-n is deprecated — use --pack-task/--detail instead (unchan - + @@ -2016,7 +1951,7 @@ ripwire: --pack-top-n is deprecated — use --pack-task/--detail instead (unchan - + @@ -2032,40 +1967,40 @@ ripwire: --pack-top-n is deprecated — use --pack-task/--detail instead (unchan *Files that change together in git (hidden coupling).* -**wall time: 5.18s** +**wall time: 1.87s** ````` - + - + - - + - - - - + + + + + + + + + - - - + - - - - - - + + + + ````` @@ -2074,40 +2009,40 @@ ripwire: --pack-top-n is deprecated — use --pack-task/--detail instead (unchan *Hotspots scoped to RECENT churn (the regression lens).* -**wall time: 7.22s** +**wall time: 1.64s** ````` - - - - - - - - + + + + + + + + + + - - - - - - - - - - + + + + + + + - - + + + -… [13 more display lines; full output is 5180 bytes on 1 raw line(s)] +… [13 more display lines; full output is 5194 bytes on 1 raw line(s)] ````` ## `./build/ripwire . --arch=test/archfix/rules.txt` @@ -2117,7 +2052,7 @@ ripwire: --pack-top-n is deprecated — use --pack-task/--detail instead (unchan ````` - + @@ -2145,7 +2080,7 @@ ripwire: --pack-top-n is deprecated — use --pack-task/--detail instead (unchan -… [1391 more display lines; full output is 194120 bytes on 1 raw line(s)] +… [1392 more display lines; full output is 194260 bytes on 1 raw line(s)] ````` stderr: @@ -2158,12 +2093,12 @@ ripwire arch: 407 file(s) in go,swift,java,cs,php,dart,kt,gd,clj: this build res *Built-in AST checks (c-cast, goto, unsafe-c-fn, ...).* -**wall time: 9.74s** +**wall time: 2.54s** ````` - - + + @@ -2171,35 +2106,33 @@ ripwire arch: 407 file(s) in go,swift,java,cs,php,dart,kt,gd,clj: this build res - + - - + + - - + + - + - + - -… [680 more display lines; full output is 70978 bytes on 1 raw line(s)] + +… [679 more display lines; full output is 70931 bytes on 1 raw line(s)] ````` ## `./build/ripwire . --lint-rules=test/lintrulesfix/rules` *User lint rules (YAML, ast-grep style) from a directory.* -**wall time: 2.23s** - ````` @@ -2225,8 +2158,6 @@ ripwire: AST query did not compile for any grammar: (this_is_not_a_real_node @x *Join MEASURED heat onto --lint findings — runs in a tiny fabricated demo corpus (one cache-pointer-chase-loop finding under a PROFILE_SCOPE site) because a real report needs a RIPWIRE_PROFILE build; the finding inside the profiled scope gains heat_* columns from the report's #PROF_TSV row.* -**wall time: 2.09s** - Input file: ````` @@ -2282,36 +2213,36 @@ The joined finding — past the display cut above, extracted so the join is visi ````` - + - - - - + + + + - + - + - - + + - + -… [189 more display lines; full output is 16631 bytes on 1 raw line(s)] +… [189 more display lines; full output is 16713 bytes on 1 raw line(s)] ````` ## `./build/ripwire . --zoom` @@ -2320,15 +2251,15 @@ The joined finding — past the display cut above, extracted so the join is visi ````` - - + + - - + + @@ -2358,36 +2289,36 @@ The joined finding — past the display cut above, extracted so the join is visi ````` - - - + + + - + - + - + - + - + - + - + - + - + - + - + - + -… [325 more display lines; full output is 14595 bytes on 1 raw line(s)] +… [325 more display lines; full output is 14581 bytes on 1 raw line(s)] ````` ## `./build/ripwire . --report` @@ -2399,25 +2330,25 @@ The joined finding — past the display cut above, extracted so the join is visi # ripwire architecture report -4813 files · 43892 symbols · 43002 edges · 5098 modules (20772 call-graph isolated) +4823 files · 44037 symbols · 43540 edges · 5028 modules (20786 call-graph isolated) Root: `.` -Call-graph isolate provenance: 5690 declaration, 3459 header, 4579 source, 7044 document; 0 connected Louvain singletons +Call-graph isolate provenance: 5708 declaration, 3473 header, 4561 source, 7044 document; 0 connected Louvain singletons -## Modules (call-graph clusters; showing 12 of 5098) -- **src::emitTo@infra/emit.h:53:2760 [write,run,emit]** — 1598 symbols -- **src::kindIs@infra/nodekind.h:46:3271 [push,emit,read]** — 701 symbols -- **src::DISCLOSE@infra/Diagnostics.h:622:43913 [read,compute,run]** — 554 symbols +## Modules (call-graph clusters; showing 12 of 5028) +- **src::emitTo@infra/emit.h:53:2760 [write,run,emit]** — 1893 symbols +- **src::kindIs@infra/nodekind.h:46:3271 [push,emit,read]** — 706 symbols +- **src::DISCLOSE@infra/Diagnostics.h:622:43913 [read,compute,parse]** — 538 symbols - **docs::`--top-k=N`@COMMANDS.md:59:9303 [pack,allow,insert]** — 185 symbols -- **src/infra::fail@os_win32.cpp:63:2553 [open,get,close]** — 109 symbols +- **src::close@infra/os.h:181:9420 [open,write,read]** — 109 symbols - **test/ownerhopfix/py/pkg::big_handler_001@broadcast.py:3:72** — 106 symbols - **src::trimWs@resolve.h:2003:104459 [read,scan,drop]** — 105 symbols +- **src/infra::fail@os_win32.cpp:63:2553 [get,open,release]** — 92 symbols - **src::text@ingest_valuerefs.h:805:41741 [emit,open,mark]** — 80 symbols -- **src::rowOffsets@infra/sparseCsr.h:248:8990 [connect,collect,compute]** — 76 symbols +- **src::str@infra/internedtext.h:323:16987 [resolve,call,attach]** — 79 symbols +- **src::rowOffsets@infra/sparseCsr.h:248:8990 [connect,collect,compute]** — 77 symbols - **test::no@estchargecheck.sh:52:4108 [skip]** — 63 symbols -- **src::open@helpdeadline.h:379:17028 [open,read,get]** — 60 symbols -- **src/infra::DYNMAP_ASSUME@dynamic_map.hpp:90:4411 [insert,erase,find]** — 49 symbols Not measured: 407 files in go,swift,java,cs,php,dart,kt,gd,clj (imports almost never resolved to files), so the god files and cycles below cover the resolved edges only. @@ -2425,7 +2356,7 @@ Not measured: 407 files in go,swift,java,cs,php,dart,kt,gd,clj (imports almost n - `src/model.h` — 143 dependents - `src/infra/emit.h` — 101 dependents - `src/infra/Diagnostics.h` — 78 dependents -… [38 more lines, 4323 bytes total] +… [38 more lines, 4328 bytes total] ````` ## `./build/ripwire . --seams` @@ -2434,10 +2365,10 @@ Not measured: 407 files in go,swift,java,cs,php,dart,kt,gd,clj (imports almost n ````` - + - + @@ -2474,11 +2405,11 @@ Not measured: 407 files in go,swift,java,cs,php,dart,kt,gd,clj (imports almost n %% ripwire --mermaid: module (directory) dependency graph — node = dir (symbol count), edge = inter-module calls (>= 3). Render at mermaid.live. flowchart LR subgraph sg0 ["src"] - n105["src
14247"] - n106["src/infra
1679"] + n105["src
14346"] + n106["src/infra
1680"] end subgraph sg1 ["test"] - n107["test
6942"] + n107["test
6961"] n750["test/legochargefix
546"] n472["test/fixtures/recallpassage
314"] n491["test/fnslotcpp2
285"] @@ -2508,12 +2439,12 @@ flowchart LR *Bus-factor: recency-weighted author ownership per file.* -**wall time: 4.14s** +**wall time: 1.84s** ````` - - + + @@ -2548,40 +2479,24 @@ flowchart LR *Internal functions with no caller found in the index — a name-based graph reading, not a confidence score. NOTE the filter is a path-COMPONENT match: 'src' matches any .../src/... segment; use ./src to pin the root directory.* -**wall time: 3.75s** +**wall time: 1.41s** ````` - + - + - - - - - - - - - - - - - - - - - - - - -… [61 more display lines; full output is 16496 bytes on 1 raw line(s)] + + + + + ````` ## `./build/ripwire . --exercises=test/regression.sh` @@ -2601,7 +2516,7 @@ flowchart LR ````` - ````` @@ -2610,11 +2525,11 @@ flowchart LR *The regression-free answer on a clone whose ledger holds stale acknowledgements (its HEAD's own history plus one demo row keyed to a finding that no longer measures as worse): the verdict-only document, every stale row collapsed to stale= and stale_by_kind=, with stale_next= naming the call below. Recorded in a throwaway clean clone so the contrast is structural — not a race with the release checkout's drift — and every regeneration on every machine sees the same pair.* -**wall time: 60.14s** +**wall time: 23.46s** ````` - ````` @@ -2628,11 +2543,11 @@ ripwire: no ./.ripwire_quality_baseline — auto-comparing the working tree vs g *The same run, the same clone, the folded rows printed back: each stale acknowledgement as an row under the full header — the demo row included, and no quarter of the bytes saved by silence. Refused without --quality-delta.* -**wall time: 27.40s** +**wall time: 10.24s** ````` - @@ -2660,8 +2575,8 @@ ripwire: no ./.ripwire_quality_baseline — auto-comparing the working tree vs g - -… [151 more display lines; full output is 17482 bytes on 1 raw line(s)] + +… [153 more display lines; full output is 17691 bytes on 1 raw line(s)] ````` stderr: @@ -2674,14 +2589,14 @@ ripwire: no ./.ripwire_quality_baseline — auto-comparing the working tree vs g *Fast per-symbol post-edit contract check vs git HEAD (unchanged on a clean tree).* -**wall time: 24.24s** +**wall time: 19.29s** ````` - - - + + @@ -2689,15 +2604,21 @@ ripwire: no ./.ripwire_quality_baseline — auto-comparing the working tree vs g ````` +stderr: + +````` +ripwire: cache : over its 2048 MiB budget — evicted 89 blob(s) of other roots or other ripwire builds (this build's blobs for this root are kept) +````` + ## `./build/ripwire . --pr-context` *No-LLM review-evidence bundle for the working-tree diff (clean tree = empty).* -**wall time: 3.85s** +**wall time: 1.48s** ````` - ````` @@ -2706,55 +2627,54 @@ ripwire: no ./.ripwire_quality_baseline — auto-comparing the working tree vs g *The BASEREF form: diffed against merge-base(BASEREF, HEAD), never the ref tip — here the previous commit on the current line (a ref with NO merge base falls back to a disclosed two-dot diff: anchor="ref-tip-two-dot").* -**wall time: 10.68s** +**wall time: 5.02s** ````` - -: n runner-less rows with equal attrs as ONE row, paths verbatim; a path holding ',' is never grouped, so p= splits into exactly n=; shown=/total= over these rows counts test FILES. est_tokens=: price as emitted (an upper bound under compact). at=: commit+dirty+shallow. root=: p= relative to it. truncated=: what the trim ladder dropped to fit budget_tokens= (budget-floor-exceeded: still over). anchor=merge-base: diffed from merge base(base, HEAD); ref-tip-two-dot = no merge base, two-dot view. base_sha=: the merge-base commit (9 hex) the diff is anchored at. base_moved=N: paths the base ref changed since the fork that this work never touched; excluded. direction=: side reviewed: worktree-since-head, head-since-fork or head-since-ref-tip. skipped_mode_only=N: mode-only (chmod) diffs left out of the changed files; renames stay in. trim_level=0-4: trim ladder step taken to fit budget_tokens= (0 none, 4 counts only); raise token-budget. budget_default=1: the default 8000-token budget applied (no token-budget or max-tokens given). commits=N: this file's commits in window=; 0 = the window could not look, not no partners. partners=N: co-change partners NOT in the diff; rows are its top shown= (the cochange verb lists all). dependents=N: distinct symbols transitively calling this file's symbols (reach set, a FLOOR). files_other=N: non-changed files among those reached; the f rows are its top shown=. authors=N: distinct authors of this file (0 = no git data). bf=1: one author holds over 80% of recency-weighted commits (bus-factor risk). no-ref-work note=: the base ref's tip is the merge base, so it has no work of its own; rows are HEAD's. files=N: changed files in the diff (shown= of them listed). file symbols=: indexed symbols in that changed file. changed-symbols count= / tests count=: that section's full count (shown= of it listed). tests count=: test files reaching this file (shown= of them listed). impact files=: files holding the transitive callers (dependents=). impactf deps=: transitive callers in that file. test run=: the command that runs that test file (run_unknown=1: none derivable). --> + - - + + + + - + + + - - - - - - - - - - - - - - - - - - - - - - -… [33 more display lines; full output is 6739 bytes on 1 raw line(s)] + + + + + + + + + + + + + + + + + + ````` ## `./build/ripwire . --merge-scout=HEAD~2,HEAD~1` *Pairwise cross-arm conflict sites + suggested landing order (any committish sharing a merge base with HEAD works as an arm; one that does not is reported ok="0", never compared).* -**wall time: 43.71s** +**wall time: 33.84s** ````` - - + + - + @@ -2766,11 +2686,11 @@ ripwire: no ./.ripwire_quality_baseline — auto-comparing the working tree vs g *Which refs of the `lane/` ref family still hold divergent authored work vs HEAD, with verdicts.* -**wall time: 19.98s** +**wall time: 8.16s** ````` - + @@ -2799,18 +2719,18 @@ ripwire: no ./.ripwire_quality_baseline — auto-comparing the working tree vs g -… [783 more display lines; full output is 88914 bytes on 1 raw line(s)] +… [799 more display lines; full output is 90718 bytes on 1 raw line(s)] ````` ## `./build/ripwire . --stray-content=fix/` *A second selection, the `fix/` ref family, picked at capture time from the refs this checkout really has and never the selection above: merged refs are OMITTED from the rows and counted in merged=; refs sharing no merge base with HEAD (a shallow clone, or a pre-rewrite history) land in unknown= with ok="0" — the counters always reconcile against refs=.* -**wall time: 3.21s** +**wall time: 1.24s** ````` - + ````` @@ -2818,40 +2738,40 @@ ripwire: no ./.ripwire_quality_baseline — auto-comparing the working tree vs g *Select the genuinely-unmerged refs of the `lane/` ref family and feed them to merge-scout for a landing order (a fully merged selection yields an empty landing set — still a measurement, disclosed on the root).* -**wall time: 39.11s** +**wall time: 25.62s** ````` - + - + - + - - - - + + + + + - - + - + -… [278 more display lines; full output is 30508 bytes on 1 raw line(s)] +… [278 more display lines; full output is 30522 bytes on 1 raw line(s)] ````` stderr: @@ -2864,7 +2784,7 @@ ripwire: warning: --plan scouted 1 of 67 unmerged branches for conflicts and lan *A --plan filter that selects NO ref REFUSES (exit 1) naming the substring — before the wave-3 close this fell through to the '>512 refs match' sentence, and --abi under the same filter answered an empty measurement at exit 0.* -**exit code: 1** — **wall time: 6.19s** +**exit code: 1** — **wall time: 1.48s** ````` (empty) @@ -2881,12 +2801,12 @@ ripwire: --plan: --stray-content=zzzz-no-such-ref matches no local ref — a zer *Cross-branch ABI-break gate over the `lane/` ref family: struct byte-contract drift on each ref's AUTHORED paths — exit 2 when any drift row is found (the only kind that gates), 0 when the compared refs are clean, and exit 1 if the --stray-content filter matches no ref at all.* -**exit code: 2** — **wall time: 41.65s** +**exit code: 2** — **wall time: 39.84s** ````` - + @@ -2914,21 +2834,21 @@ ripwire: --plan: --stray-content=zzzz-no-such-ref matches no local ref — a zer -… [642 more display lines; full output is 48111 bytes on 1 raw line(s)] +… [652 more display lines; full output is 48704 bytes on 1 raw line(s)] ````` ## `./build/ripwire . --whereis=rankGraphTeleport` *Which ref's tree defines or mentions SYM — HEAD first, then every local branch. The default lists the kind="def" rows (here the first 60, most on branches, each carrying tip= and date=) and counts the references in : on this symbol HEAD's references would fill the 60-row cap before the branch definitions arrive, so the whole list (below) shows fewer definitions, and the default serves the page that shows more of them, whatever its bytes.* -**wall time: 28.93s** +**wall time: 19.39s** ````` - + - + - - - - - - + + + + + + @@ -2960,22 +2880,22 @@ ripwire: --plan: --stray-content=zzzz-no-such-ref matches no local ref — a zer stderr: ````` -ripwire: warning: --whereis read the newest 376 of 637 local branches; 261 older were not read (limit: 2097152 tree entries across all refs, 377 refs with HEAD at this tree's size); pass --detail=1 to read every branch, or narrow the branches with a ref-name filter -ripwire: warning: --whereis left 398 branch blobs unparsed, their rows kind=text (limit: 256 blobs or 64 MB per answer); pass --detail=1 to parse every one +ripwire: warning: --whereis read the newest 375 of 641 local branches; 266 older were not read (limit: 2097152 tree entries across all refs, 376 refs with HEAD at this tree's size); pass --detail=1 to read every branch, or narrow the branches with a ref-name filter +ripwire: warning: --whereis left 401 branch blobs unparsed, their rows kind=text (limit: 256 blobs or 64 MB per answer); pass --detail=1 to parse every one ````` ## `./build/ripwire . --whereis=rankGraphTeleport --whereis-listing=all` *The whole hit list asked for by name: under the same 60-row cap HEAD's references fill the list, so it shows far fewer definitions (here HEAD's one) than the default above (here 60). The default serves the all page only when it shows the same definitions as the defs page in strictly fewer bytes (a tie serves it too).* -**wall time: 30.40s** +**wall time: 23.42s** ````` - + - + - - - - - - + + + + + + @@ -3007,19 +2927,19 @@ ripwire: warning: --whereis left 398 branch blobs unparsed, their rows kind=text stderr: ````` -ripwire: warning: --whereis read the newest 376 of 637 local branches; 261 older were not read (limit: 2097152 tree entries across all refs, 377 refs with HEAD at this tree's size); pass --detail=1 to read every branch, or narrow the branches with a ref-name filter -ripwire: warning: --whereis left 398 branch blobs unparsed, their rows kind=text (limit: 256 blobs or 64 MB per answer); pass --detail=1 to parse every one +ripwire: warning: --whereis read the newest 375 of 641 local branches; 266 older were not read (limit: 2097152 tree entries across all refs, 376 refs with HEAD at this tree's size); pass --detail=1 to read every branch, or narrow the branches with a ref-name filter +ripwire: warning: --whereis left 401 branch blobs unparsed, their rows kind=text (limit: 256 blobs or 64 MB per answer); pass --detail=1 to parse every one ````` ## `./build/ripwire . --quality-delta=HEAD~1..HEAD --quality-kinds=complexity,dead-code` *A ref range run for two of the twelve kinds only: the named kinds' rows are exactly their rows in the full answer, the header names the others (kinds_skipped=, skipped_why="selector"), and a pass no named kind needs does not run. The replay a memory-stopped range answer hands back (kinds_next=) is this flag. Refused without --quality-delta=A..B.* -**wall time: 31.68s** +**wall time: 24.10s** ````` - - + + - - - - - - + + + + + + @@ -3066,43 +2986,43 @@ ripwire: warning: --whereis left 398 branch blobs unparsed, their rows kind=text stderr: ````` -ripwire: warning: --whereis read the newest 376 of 637 local branches; 261 older were not read (limit: 2097152 tree entries across all refs, 377 refs with HEAD at this tree's size); pass --detail=1 to read every branch, or narrow the branches with a ref-name filter -ripwire: warning: --whereis left 398 branch blobs unparsed, their rows kind=text (limit: 256 blobs or 64 MB per answer); pass --detail=1 to parse every one +ripwire: warning: --whereis read the newest 375 of 641 local branches; 266 older were not read (limit: 2097152 tree entries across all refs, 376 refs with HEAD at this tree's size); pass --detail=1 to read every branch, or narrow the branches with a ref-name filter +ripwire: warning: --whereis left 402 branch blobs unparsed, their rows kind=text (limit: 256 blobs or 64 MB per answer); pass --detail=1 to parse every one ````` ## `./build/ripwire . --whereis=computeOnePairOverlap --with-history` *Same, plus a git-history row (never / removed-by-commit) for names no tree carries.* -**wall time: 46.02s** +**wall time: 23.82s** ````` - - + + - - + + ````` stderr: ````` -ripwire: warning: --whereis read the newest 376 of 637 local branches; 261 older were not read (limit: 2097152 tree entries across all refs, 377 refs with HEAD at this tree's size); pass --detail=1 to read every branch, or narrow the branches with a ref-name filter +ripwire: warning: --whereis read the newest 375 of 641 local branches; 266 older were not read (limit: 2097152 tree entries across all refs, 376 refs with HEAD at this tree's size); pass --detail=1 to read every branch, or narrow the branches with a ref-name filter ````` ## `./build/ripwire . --flags` *The dark-content dashboard: gates BUILT but OFF. CHANGED: no longer invents gates from comments/heredocs, so the count only reflects real ifndef/define, CMake option(), and getenv gates.* -**wall time: 2.61s** +**wall time: 1.11s** ````` - + @@ -3129,18 +3049,16 @@ ripwire: warning: --whereis read the newest 376 of 637 local branches; 261 older -… [2397 more display lines; full output is 150778 bytes on 1 raw line(s)] +… [2398 more display lines; full output is 150825 bytes on 1 raw line(s)] ````` ## `./build/ripwire . --flags --flip=RIPWIRE_ASAN` *Blast radius of turning ONE gate on: live code, symbols, transitive reach, covering tests.* -**wall time: 1.98s** - ````` - + @@ -3176,7 +3094,7 @@ ripwire: warning: --whereis read the newest 376 of 637 local branches; 261 older *Unknown-gate refusal (exit 1) with a did-you-mean from a real edit distance (one character off RIPWIRE_ASAN).* -**exit code: 1** — **wall time: 3.61s** +**exit code: 1** — **wall time: 1.01s** ````` (empty) @@ -3193,10 +3111,10 @@ ripwire: run `ripwire . --flags` for the gate table *NEW VERB: pre-hoc lane plan — which of 3 parallel worktrees would COLLIDE, before a line is written. JSON on stdout.* -**wall time: 6.92s** +**wall time: 3.64s** ````` -{"v":1,"verb":"plan-lanes","at":"da897642e","root":".","task":"add a --since filter to the doc-drift verb and cover it with tests","source":"partition","requested":3,"lane_count":3,"claim_key":"path+scope+name","on_conflict":"producing-lane-rebases","corpus":{"files":4813,"symbols":43892,"edges":430 … [line truncated: 338 more bytes on this line] +{"v":1,"verb":"plan-lanes","at":"d3a73cd6e","root":".","task":"add a --since filter to the doc-drift verb and cover it with tests","source":"partition","requested":3,"lane_count":3,"claim_key":"path+scope+name","on_conflict":"producing-lane-rebases","corpus":{"files":4823,"symbols":44037,"edges":435 … [line truncated: 338 more bytes on this line] "symbols":[{"p":"./src/docdrift.h","n":"DriftResult","scope":"DriftResult","l":286,"id":"./src/docdrift.h::DriftResult::DriftResult"}, {"p":"./src/docdrift.h","n":"computeDocDrift","scope":"docdrift","l":2441,"id":"./src/docdrift.h::docdrift::computeDocDrift"}, {"p":"./src/docdrift.h","n":"kDocDriftLegend","scope":"docdrift","l":2739,"id":"./src/docdrift.h::docdrift::kDocDriftLegend"}, @@ -3233,7 +3151,7 @@ ripwire: run `ripwire . --flags` for the gate table *NEW VERB, explicit form: one line per lane, lane boundaries are the ones you wrote (the defensible mode).* -**wall time: 12.10s** +**wall time: 2.68s** Input file: @@ -3244,7 +3162,7 @@ write regression tests for the new filter ````` ````` -{"v":1,"verb":"plan-lanes","at":"da897642e","root":".","task":null,"source":"brief","requested":3,"lane_count":3,"claim_key":"path+scope+name","on_conflict":"producing-lane-rebases","corpus":{"files":4813,"symbols":43892,"edges":43002,"ambiguous":3634,"unresolved":20011},"carve":null,"core":{"files" … [line truncated: 4 more bytes on this line] +{"v":1,"verb":"plan-lanes","at":"d3a73cd6e","root":".","task":null,"source":"brief","requested":3,"lane_count":3,"claim_key":"path+scope+name","on_conflict":"producing-lane-rebases","corpus":{"files":4823,"symbols":44037,"edges":43540,"ambiguous":3967,"unresolved":19988},"carve":null,"core":{"files" … [line truncated: 4 more bytes on this line] "symbols":[]},"lanes":[{"id":"lane-0","task":"add a --since filter to the doc-drift verb","claims":{"symbols":[{"p":"./src/docdrift.h","n":"recordUnchecked","scope":"docdrift","key":"12641dab14abc8fd","id":"./src/docdrift.h::docdrift::recordUnchecked","id_addressable":true,"id_collides_with":0,"l":2 … [line truncated: 72 more bytes on this line] {"p":"./src/docdrift.h","n":"sortWeakGroupsByPath","scope":"docdrift","key":"1944ba506280ff80","id":"./src/docdrift.h::docdrift::sortWeakGroupsByPath","id_addressable":true,"id_collides_with":0,"l":2401,"ord":0,"overloads":1,"amb":0,"cx":1,"ccx":0,"churn":37,"tested":0}, {"p":"./src/mcpverbs.h","n":"docDriftText","scope":"rw","key":"1fa68e8d93c05a59","id":"./src/mcpverbs.h::rw::docDriftText","id_addressable":true,"id_collides_with":0,"l":687,"ord":0,"overloads":1,"amb":0,"cx":1,"ccx":0,"churn":671,"tested":0}, @@ -3258,14 +3176,14 @@ write regression tests for the new filter {"p":"./src/mcpverbs.h","n":"unknownSubVerbRefusal","scope":"rw","key":"e336d39b0a6addea","id":"./src/mcpverbs.h::rw::unknownSubVerbRefusal","id_addressable":true,"id_collides_with":0,"l":6288,"ord":0,"overloads":1,"amb":0,"cx":3,"ccx":2,"churn":671,"tested":0}, {"p":"./src/docdrift.h","n":"kDocDriftLegend","scope":"docdrift","key":"ff2ba74637bbbebf","id":"./src/docdrift.h::docdrift::kDocDriftLegend","id_addressable":true,"id_collides_with":0,"l":2739,"ord":0,"overloads":1,"amb":0,"cx":0,"ccx":0,"churn":37,"tested":0}], "files":[{"p":"./src/docdrift.h","symbols":7,"churn":37,"ccx":60,"hotspot_rank":49}, -{"p":"./src/ensemble.h","symbols":1,"churn":23,"ccx":0,"hotspot_rank":127}, +{"p":"./src/ensemble.h","symbols":1,"churn":23,"ccx":0,"hotspot_rank":128}, {"p":"./src/mcpverbs.h","symbols":2,"churn":671,"ccx":2,"hotspot_rank":4}, {"p":"./src/recall.h","symbols":1,"churn":49,"ccx":4,"hotspot_rank":45}, {"p":"./src/verbs_change.h","symbols":1,"churn":92,"ccx":4,"hotspot_rank":33}], -"symbols_total":4241,"symbols_capped":true},"blast_radius":{"reaches":27,"files_total":8,"capped":false,"files":["./src/docdrift.h","./src/fordocbody.h","./src/main.cpp","./src/mcp.h","./src/mcpserver.h","./src/mcpverbs.h","./src/recall.h","./src/verbs_for.h"]},"tests_to_run":[], +"symbols_total":4240,"symbols_capped":true},"blast_radius":{"reaches":27,"files_total":8,"capped":false,"files":["./src/docdrift.h","./src/fordocbody.h","./src/main.cpp","./src/mcp.h","./src/mcpserver.h","./src/mcpverbs.h","./src/recall.h","./src/verbs_for.h"]},"tests_to_run":[], "tests_total":0,"tests_capped":false,"tests_granularity":"claimed-symbols","untested":27,"module_span":5,"notes":[], "execution":{"policy":"codex-lane/v1","model":"gpt-5.6-sol","reasoning":"xhigh","rule":"wide-contract-work","basis":"structural-only","signals":{"claims":12,"files":5,"module_span":5,"max_ccx":38,"sum_ccx":70,"ambiguous_calls":14,"blast_reaches":27,"contract_touches":1,"conflicts":0,"untested":27,"t … [line truncated: 139 more bytes on this line] -{"id":"lane-1","task":"add the CLI parse arm and help text for the new filter","claims":{"symbols":[{"p":"./scripts/optremarks.py","n":"main","scope":"","key":"01b3b880f77d1512","id":null,"id_addressable":false,"id_collides_with":186,"l":285,"ord":0,"overloads":1,"amb":0,"cx":23,"ccx":31,"churn":18, … [line truncated: 12 more bytes on this line] +{"id":"lane-1","task":"add the CLI parse arm and help text for the new filter","claims":{"symbols":[{"p":"./scripts/optremarks.py","n":"main","scope":"","key":"01b3b880f77d1512","id":null,"id_addressable":false,"id_collides_with":186,"l":286,"ord":0,"overloads":1,"amb":0,"cx":23,"ccx":31,"churn":19, … [line truncated: 12 more bytes on this line] {"p":"./scripts/merge_resolve.py","n":"main","scope":"","key":"0618162fab697309","id":null,"id_addressable":false,"id_collides_with":186,"l":208,"ord":0,"overloads":1,"amb":0,"cx":17,"ccx":34,"churn":4,"tested":0}, {"p":"./src/cli.h","n":"HelpLine","scope":"rw","key":"1489844dbc310b82","id":"./src/cli.h::rw::HelpLine","id_addressable":true,"id_collides_with":0,"l":3144,"ord":0,"overloads":1,"amb":0,"cx":0,"ccx":0,"churn":645,"tested":0}, {"p":"./src/cli.h","n":"HelpFilter","scope":"HelpFilter","key":"3103a5e8bfc33d38","id":"./src/cli.h::HelpFilter::HelpFilter","id_addressable":true,"id_collides_with":0,"l":3223,"ord":0,"overloads":1,"amb":0,"cx":0,"ccx":0,"churn":645,"tested":0}, @@ -3281,7 +3199,7 @@ write regression tests for the new filter *Out-of-range refusal shape for the lane count.* -**exit code: 1** — **wall time: 1.06s** +**exit code: 1** ````` (empty) @@ -3297,8 +3215,6 @@ ripwire: --plan-lanes=99 is out of range — N must be 2..16 (1 is not a fan-out *CPU/GPU contract view of one struct: computed offsets/sizes/padding + mirror check.* -**wall time: 1.10s** - ````` @@ -3359,11 +3275,9 @@ ripwire: --layout: 'Lang' is an enum, --layout models structs (a scoped/unscoped *Which of this repo's doc claims are now false. CHANGED: row attribute at= renamed to tgt= (at= is now only the root sha stamp).* -**wall time: 7.43s** - ````` - +
@@ -3383,8 +3297,8 @@ ripwire: --layout: 'Lang' is an enum, --layout models structs (a scoped/unscoped - - + + @@ -3392,18 +3306,16 @@ ripwire: --layout: 'Lang' is an enum, --layout models structs (a scoped/unscoped -… [253 more display lines; full output is 25409 bytes on 1 raw line(s)] +… [258 more display lines; full output is 25726 bytes on 1 raw line(s)] ````` ## `./build/ripwire . --doc-drift --gateability` *The finishable to-do list: docs whose LIVE failing anchors a date-stamp would reclassify.* -**wall time: 4.70s** - ````` - + @@ -3423,8 +3335,8 @@ ripwire: --layout: 'Lang' is an enum, --layout models structs (a scoped/unscoped - - + + @@ -3432,13 +3344,13 @@ ripwire: --layout: 'Lang' is an enum, --layout models structs (a scoped/unscoped -… [283 more display lines; full output is 26789 bytes on 1 raw line(s)] +… [289 more display lines; full output is 27168 bytes on 1 raw line(s)] ````` Tail of the same output — the `` section: ````` - + @@ -3448,6 +3360,7 @@ Tail of the same output — the `` section: + @@ -3462,19 +3375,16 @@ Tail of the same output — the `` section: - ````` ## `./build/ripwire . --doc-drift --with-history` *Same report, with git history splitting stale mentions into deleted-by-commit vs never-existed.* -**wall time: 9.51s** - ````` - - + + @@ -3494,15 +3404,15 @@ Tail of the same output — the `` section: - - + + -… [232 more display lines; full output is 25615 bytes on 1 raw line(s)] +… [235 more display lines; full output is 25809 bytes on 1 raw line(s)] ````` ## `./build/ripwire . --from-trace=-` @@ -3515,8 +3425,8 @@ Input file: AddressSanitizer:DEADLYSIGNAL ================================================================= ==41337==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000018 (pc 0x000102f4a1c8 bp 0x00016d2f1a40 sp 0x00016d2f19e0 T0) - #0 0x102f4a1c8 in rw::rankGraphTeleport(Graph const&, std::vector const&, float) src/graph.h:14630 - #1 0x102f3e884 in rw::rankGraph(Graph const&, float) src/graph.h:14673 + #0 0x102f4a1c8 in rw::rankGraphTeleport(Graph const&, std::vector const&, float) src/graph.h:14923 + #1 0x102f3e884 in rw::rankGraph(Graph const&, float) src/graph.h:14966 #2 0x102e11f30 in runDefaultMap(MainDispatch const&) src/main.cpp:1759 #3 0x102e01a44 in main src/main.cpp:4511 #4 0x1a2b3c0dc in start+0x9dc (dyld:arm64e+0x60dc) @@ -3524,25 +3434,25 @@ AddressSanitizer:DEADLYSIGNAL ````` ````` - + - - + + - + PageRank with an explicit teleport / personalization vector p (Σp = 1). The prior is name-quality-biased through biasPrior() so all rank modes share one weighting seam; the transition matrix (edgesinline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>&am … [line truncated: 31 more bytes on this line] - + uniform-teleport PageRank (the default). A kRankFlagNotNamed unit (model.h) has no edge and a 0 prior weight, so the uniform share is over the ranked nodes: every other node's teleport is the value itinline RankedGraph rankGraph( const Graph& g, float alpha = 0.85f ) int runDefaultMap( const MainDispatch& d ) int main( int argc, char** argv ) - + & p, float alpha = 0.85f ) { PROFILE_SCOPE_DESCRIBE( "rankGraph: PageRank (power iteration)" ); @@ -3584,10 +3494,8 @@ AddressSanitizer:DEADLYSIGNAL *ONE budget-shared bundle: ranking + top bodies + caller sigs + notes + tests_to_run. CHANGED: rows now carry n=/id=.* -**wall time: 1.48s** - ````` - + - + @@ -3655,17 +3563,17 @@ AddressSanitizer:DEADLYSIGNAL post.insert( post.size() - 1, " " + std::string( toolsArg ) ); } return post; -… [79 more display lines; full output is 22889 bytes on 87 raw line(s)] +… [89 more display lines; full output is 24522 bytes on 97 raw line(s)] ````` ## `./build/ripwire . --for="pagerank power iteration" --with-graph` *Task lens + a compact Mermaid flowchart of the top anchors' 1-hop edges.* -**wall time: 7.68s** +**wall time: 1.53s** ````` - + @@ -3676,21 +3584,21 @@ AddressSanitizer:DEADLYSIGNAL The PageRank power iteration itself — the numeric kernel every ranked document's order comes f…PageRankRun pageRankDouble( const sparseCsr<float>& inEdges, std::span<const double> weightedOutDegree, std::span<const double> teleport, std::span<double> r … [line truncated: 10 more bytes on this line] inline std::string rankByText( const std::string& root, std::string_view mode, int topK, bool stable = false ) -struct RankedGraph +struct RankedGraph inline constexpr const char* kChurnRankLegend = "<!-- rank_by=churn: k= is PageRank re-run with the teleport BIASED by git CHANGE-FREQUENCY over window= " "(a c… inline std::uint32_t sliceRdIterationCeiling() noexcept struct PageRankRun Render one form of the disclosure. Empty string whenever there is nothing to say — no power it…inline std::string renderDisclosure( const RankDisclosure& d, DiscloseAs as ) -inline std::uint32_t navRelevanceWeight( const Graph& g, NodeId n ) noexcept -inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>& p, float alpha = 0.85f ) +inline std::uint32_t navRelevanceWeight( const Graph& g, NodeId n ) noexcept +inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>& p, float alpha = 0.85f ) inline constexpr std::string_view kPowerShellPathPrependScope = "in PowerShell, for this window inline std::string path_prepend_hint( std::string_view dir ) -HOT_FILES = ( "src/pagerank.cpp", # the power-iteration loop — G2's no-allocation scope "src/infra/radixSort.h", # LSD radix entry points "src/infra/radixSort.inl", # the counting … [line truncated: 76 more bytes on this line] -handle_t leftmost_leaf() const +handle_t leftmost_leaf() const +HOT_FILES = ( "src/pagerank.cpp", # the power-iteration loop — G2's no-allocation scope "src/infra/radixSort.h", # LSD radix entry points "src/infra/radixSort.inl", # the counting … [line truncated: 76 more bytes on this line] inline std::string doctorPathPrependLine( const std::string& selfPath ) @@ -3702,7 +3610,7 @@ AddressSanitizer:DEADLYSIGNAL *Per-file metrics as CodeCharta cc.json.* -**wall time: 7.89s** +**wall time: 1.74s** ````` (empty) @@ -3711,7 +3619,7 @@ AddressSanitizer:DEADLYSIGNAL Artifact written: ````` - 736565 /aux/ripwire2.cc.json + 737942 /aux/ripwire2.cc.json {"projectName":"project","apiVersion":"1.3","attributeDescriptors":{"loc":{"title":"Lines of Code","description":"Physical line count","direction":-1},"symbols":{"title":"Symbols","description":"Definitions in the file","direction":-1},"cx":{"title":"Cyclomatic Complexity","description":"Sum of per-symbol cyclomatic complexity","direction":-1},"cognitive_cx":{"title":"Cognitive Complexity","descri ````` @@ -3719,7 +3627,7 @@ Artifact written: *One-turn sweep: 4 newline-delimited verb:arg sub-queries answered in ONE deduped .* -**wall time: 13.04s** +**wall time: 2.67s** Input file: @@ -3734,7 +3642,7 @@ lego:Vehicle - + @@ -3749,7 +3657,7 @@ lego:Vehicle Ingest the tree at `sha`, materialized out of `root`'s object store. The HEAD side reuses the SA…inline bool ingestCommitTree( const std::string& root, const std::string& sha, const std::vector<std::string>& excludes, std::size_t maxFileBytes, IngestResult&… … [line truncated: 4 more bytes on this line] struct FileHealth inline std::vector<std::vector<NodeId>> legoImplementorsOnSurface( const IngestResult& ing, const std::vector<std::vector<NodeId>>& implementors, const std::v … [line truncated: 9 more bytes on this line] -inline std::pair<Snapshot, bool> computeHeadSnapshot( const std::string& root, const std::string_view* cacheNever = nullptr, std::size_t maxFileBytes = kDefault… +inline std::pair<Snapshot, bool> computeHeadSnapshot( const std::string& root, const std::string_view* cacheNever = nullptr, std::size_t maxFileBytes = kDefault… inline RawFacts runParsePool( IngestResult& result, const char* rootDir, std::string_view cacheFile, bool captureValueUses, CacheRecords& cache, const CacheLoadStats& cacheStats, IngestFileScan … [line truncated: 62 more bytes on this line] inline McpRebuildBaseline mcpRebuildBaseline( const McpIndex& ix, bool isIncrementalPass ) inline std::string mcpFreshFields( std::uint64_t passesAtEntry ) @@ -3761,7 +3669,7 @@ lego:Vehicle const char* cacheArtifactVerdict( const std::string& path, bool captureValueUses ) inline bool parentCacheOn() -… [236 more display lines; full output is 60644 bytes on 1 raw line(s)] +… [236 more display lines; full output is 60645 bytes on 1 raw line(s)] ````` @@ -3773,18 +3681,18 @@ lego:Vehicle *Environment self-check: binary staleness, grammars, cache dir, git, tracked-binary staleness — exit 1 when any check fails (here: the PATH install is older than ./build).* -**exit code: 1** — **wall time: 49.71s** +**exit code: 1** — **wall time: 11.77s** ````` - - + - - + + - - + @@ -3799,8 +3707,6 @@ lego:Vehicle *Scan a single skill file for injection/exfiltration patterns before installing.* -**wall time: 1.50s** - ````` @@ -3838,17 +3744,21 @@ ripwire scan: 0 finding(s) total (26 skill file(s) scanned, 0 unscannable file(s *Rank by git change-frequency prior instead of PageRank.* -**wall time: 9.68s** +**wall time: 2.66s** ````` - - + + - + + + + + @@ -3860,39 +3770,33 @@ ripwire scan: 0 finding(s) total (26 skill file(s) scanned, 0 unscannable file(s - - - - ````` -## `./build/ripwire . --rank-by=churn-decay --since=HEAD~6 --exclude=test --exclude=docs --exclude=skills --exclude=changelog.d --in=src --limit=3` +## `./build/ripwire . --rank-by=churn-decay --since=HEAD~5 --exclude=test --exclude=docs --exclude=skills --exclude=changelog.d --in=src --limit=3` *Scope the recent-changes answer to ONE directory. The global block stays byte-identical, a second page follows it — n=/of= are its counts (of= IS the total, so the paging half carries no total=), capped="1" has_more="1" next_offset= offset= limit= page it, and next= replays THIS run's own corpus flags (--since/--exclude) so the page it names is a page of the same answer. The symbol map collapses to a disclosed stub — the map was not asked for and was not ranked at all, which is why the header carries no pr_iters=. merge_bombs_skipped= stays on the global block: it counts the window's skipped commits, not the directory's.* -**wall time: 10.64s** +**wall time: 2.52s** ````` - - - - - - - - - + + + + + + + - - - - + + + + - + ````` @@ -3918,15 +3822,15 @@ ripwire: --rank-by: unknown value 'bogus' (supported: pagerank|authority|hub|rrf ````` - + 0=src/mcpindex.h 1=src/graph.h 2=src/eval.h 3=src/main.cpp 0,1,1,2,3,3,3 getIndex,rankGraph,anchoredLexicalRank,runEval,churnDecayRanking,churnRankedGraph,runDefaultMap -1224,14671,15341,171,1431,1470,1757 +1224,14964,15634,171,1431,1470,1757 fn,fn,fn,fn,fn,fn,fn 0,0,0,0,0,0,0 -1340,14675,15392,328,1445,1484 1485 1499,1877 +1340,14968,15685,328,1445,1484 1485 1499,1877 ````` @@ -3935,24 +3839,24 @@ ripwire: --rank-by: unknown value 'bogus' (supported: pagerank|authority|hub|rrf *Flat top-K export for an external reranker.* -**wall time: 5.80s** +**wall time: 1.27s** ````` - - + + inline std::string spanTierMemoPath( const std::string& diskPath ) - + inline std::vector<std::vector<NodeId>> legoImplementorsOnSurface( const IngestResult& ing, const std::vector<std::vector<NodeId>>& implementors, const std::vector<NodeId>& surfaceIds ) - + ### See the map — not just the numbers - + inline std::string receiptNextFor( const std::string& fileIdentity, const std::string& symbolName, const std::string& foldJson, const std::string& firstTestRun ) - + AncestorCacheScope( TSNode root, bool enabled ) : previous( tAncestorCache ) @@ -3979,9 +3883,9 @@ ripwire: --format: unknown value 'bogus' (supported: xml|columnar|rows|candidate *Machine-parseable JSON, same content, keys mirror the XML attrs.* ````` -{"of":"rankGraphTeleport","defs":1,"count":7,"root":".","hop_tested":0,"hop_untested":7,"graph_ambiguous":3634,"graph_unresolved":20011,"graph_unindexed":313,"counts_floor":true,"callers":[{"t":"fn","n":"getIndex","p":"src/mcpindex.h:1224","sites_at":["1340"]}, -{"t":"fn","n":"rankGraph","p":"src/graph.h:14671","sites_at":["14675"]}, -{"t":"fn","n":"anchoredLexicalRank","p":"src/graph.h:15341","sites_at":["15392"]}, +{"of":"rankGraphTeleport","defs":1,"count":7,"root":".","hop_tested":0,"hop_untested":7,"graph_ambiguous":3967,"graph_unresolved":19988,"graph_unindexed":313,"counts_floor":true,"callers":[{"t":"fn","n":"getIndex","p":"src/mcpindex.h:1224","sites_at":["1340"]}, +{"t":"fn","n":"rankGraph","p":"src/graph.h:14964","sites_at":["14968"]}, +{"t":"fn","n":"anchoredLexicalRank","p":"src/graph.h:15634","sites_at":["15685"]}, {"t":"fn","n":"runEval","p":"src/eval.h:171","sites_at":["328"]}, {"t":"fn","n":"churnDecayRanking","p":"src/main.cpp:1431","sites_at":["1445"]}, {"t":"fn","n":"churnRankedGraph","p":"src/main.cpp:1470","sites_at":["1484","1485","1499"]}, @@ -4008,12 +3912,12 @@ ripwire: --json is not yet supported for --hotspots — supported: the default m *Pagination: 3 items, skipping the first 3 (deterministic seams).* -**wall time: 10.38s** +**wall time: 2.89s** ````` - + @@ -4024,14 +3928,12 @@ ripwire: --json is not yet supported for --hotspots — supported: the default m *Drop test paths from the corpus before ranking.* -**wall time: 1.54s** - ````` - - + + @@ -4045,11 +3947,11 @@ ripwire: --json is not yet supported for --hotspots — supported: the default m - + - + @@ -4057,7 +3959,7 @@ ripwire: --json is not yet supported for --hotspots — supported: the default m -… [84 more display lines; full output is 9803 bytes on 1 raw line(s)] +… [85 more display lines; full output is 9850 bytes on 1 raw line(s)] ````` stderr: @@ -4070,15 +3972,15 @@ stderr: *Drop matching paths (repeatable) before ranking.* -**wall time: 4.06s** +**wall time: 2.22s** ````` - - + + @@ -4096,31 +3998,31 @@ stderr: - + -… [83 more display lines; full output is 10029 bytes on 1 raw line(s)] +… [84 more display lines; full output is 10076 bytes on 1 raw line(s)] ````` ## `./build/ripwire . --map-diff --top-k=5` *Full map re-ranked with teleport toward git-changed files — clean tree, so changed=0 and it degrades to the plain map.* -**wall time: 5.20s** +**wall time: 2.24s** ````` - - + + - + @@ -4149,17 +4051,17 @@ stderr: *Force a cold parse (bypass the warm TMPDIR cache) — shows the cold-vs-warm cost.* -**wall time: 4.42s** +**wall time: 4.09s** ````` - - + + - + @@ -4170,7 +4072,7 @@ stderr: - + @@ -4182,24 +4084,24 @@ stderr: -… [80 more display lines; full output is 10006 bytes on 1 raw line(s)] +… [81 more display lines; full output is 10053 bytes on 1 raw line(s)] ````` ## `./build/ripwire . --cache=/aux/warm2.ripwirecache --top-k=3` *Explicit incremental cache at a path OUTSIDE the repo (first call writes it).* -**wall time: 7.47s** +**wall time: 5.00s** ````` - - + + - + @@ -4210,7 +4112,7 @@ stderr: - + @@ -4222,27 +4124,27 @@ stderr: -… [80 more display lines; full output is 10006 bytes on 1 raw line(s)] +… [81 more display lines; full output is 10053 bytes on 1 raw line(s)] ````` Artifact written: ````` - 39659984 /aux/warm2.ripwirecache + 39764763 /aux/warm2.ripwirecache ````` ## `./build/ripwire . --max-file-size=8K --top-k=3` *Skip files above a size bound before parsing (note the corpus shrink in the header).* -**wall time: 3.33s** +**wall time: 1.30s** ````` - + @@ -4256,7 +4158,7 @@ Artifact written: - + @@ -4291,15 +4193,15 @@ ripwire: --scip=does_not_exist.scip: cannot open the index — refusing rather t *Multi-root workspace: ONE merged graph over two roots, paths labeled /.* -**wall time: 5.70s** +**wall time: 4.33s** ````` - - + + @@ -4326,19 +4228,19 @@ ripwire: --scip=does_not_exist.scip: cannot open the index — refusing rather t *Self-eval: co-change recall vs BM25.* -**wall time: 30.81s** +**wall time: 31.52s** ````` ripwire --eval (co-change recovery, averaged over 80 historical commits) ranker recall@5 recall@10 recall@20 - ripwire 10.5% 10.7% 14.4% - BM25 13.1% 14.4% 15.4% - BM25sub 12.5% 15.6% 18.2% - BM25body 8.4% 11.6% 20.2% - fused 9.3% 11.3% 16.6% - anchored 8.3% 11.2% 19.4% - same-dir 1.6% 3.1% 3.9% - random 0.1% 0.2% 0.4% <- floor (random ranking over F=4813 files) + ripwire 13.5% 13.7% 17.3% + BM25 15.3% 17.7% 18.5% + BM25sub 14.6% 17.6% 22.1% + BM25body 8.6% 12.6% 19.9% + fused 12.4% 14.4% 18.9% + anchored 8.6% 12.6% 19.1% + same-dir 0.9% 1.4% 1.6% + random 0.1% 0.2% 0.4% <- floor (random ranking over F=4823 files) note: `ripwire` here is the DEFAULT MAP's structural-only PageRank (importance, not relatedness) — it is NOT what a --for/--query retrieval call ranks with. BM25 / BM25sub / BM25body are QUERY-TIME lexical rankers (whole-name / subtoken / @@ -4354,22 +4256,22 @@ ripwire --eval (co-change recovery, averaged over 80 historical commits) *Known-item retrieval eval: MRR + recall@k per ranker per query mode.* -**wall time: 366.20s** +**wall time: 240.13s** ````` ripwire --eval-retrieval (known-item, 4000 doc-commented symbols; gold is in-corpus by construction) - sample: population=11790 scored=4000 rule=smallest-key CAPPED — a SUBSET, not the population + sample: population=11874 scored=4000 rule=smallest-key CAPPED — a SUBSET, not the population (smallest fnv1a64(scope::name) over the population, cut on the key so an identity is never split; path- and order-independent, but a corpus this size is NOT graded exhaustively — say so when citing it) ingest: lex=rich (persisted subtoken stats; no per-query corpus re-tokenize) ranker query-mode MRR recall@1 recall@5 recall@10 - subtoken name 0.658 52.4% 82.1% 87.4% - subtoken doc-phrase 0.881 85.8% 90.1% 91.2% - name-exact name 0.874 79.4% 93.7% 96.1% - name-exact doc-phrase 0.009 0.4% 1.2% 1.7% - anchored name 0.663 53.6% 81.0% 85.9% + subtoken name 0.658 52.5% 82.2% 87.4% + subtoken doc-phrase 0.881 85.8% 90.2% 91.3% + name-exact name 0.875 79.4% 93.7% 96.1% + name-exact doc-phrase 0.008 0.3% 1.1% 1.7% + anchored name 0.662 53.6% 80.9% 86.0% anchored doc-phrase 0.874 84.8% 89.8% 90.5% - routed name 0.876 79.5% 93.8% 96.3% + routed name 0.877 79.6% 93.9% 96.3% routed doc-phrase 0.879 85.7% 89.9% 91.0% note: routing chose name-exact on 3989/4000 NAME queries (a NAME query is always identifier-shaped); the confidence gate routes doc-phrase queries to name-exact ONLY when EVERY content word names a symbol @@ -4383,7 +4285,7 @@ ripwire --eval-retrieval (known-item, 4000 doc-commented symbols; gold is in-co *Labelled verdict-accuracy eval for --stray-content — three labels over REAL local refs (names resolved at capture time); exit 3 when accuracy is under the floor. Read got= against v= in the stray-content run: a ref the verb could not analyse (unknown) must never be credited as a merged hit.* -**exit code: 3** — **wall time: 30.90s** +**exit code: 3** — **wall time: 15.58s** Input file: @@ -4406,15 +4308,13 @@ arm/orient-map-067-narrow merged stderr: ````` -ripwire: warning: --stray-content read the newest 512 of 637 local branches; 125 older were not read (limit: 512 refs); pass --detail=1 to read every branch, or narrow the branches with a ref-name filter +ripwire: warning: --stray-content read the newest 512 of 641 local branches; 129 older were not read (limit: 512 refs); pass --detail=1 to read every branch, or narrow the branches with a ref-name filter ````` ## `./build/ripwire skills --eval-skills=/aux/skills_labels2.tsv` *Labelled skill-ROUTING eval over the repo's own skills/ directory (4 hand-labelled prompts).* -**wall time: 1.18s** - Input file: ````` @@ -4501,7 +4401,7 @@ Reach for it BEFORE blind grep + whole-file reads. First call ~1s cold; after th *Version + short build info.* ````` -ripwire 0.6.10-dev.100+gda897642e (dev, AppleClang 21.0.0.21000101, emit=std::print, built_from=da897642e) +ripwire 0.6.10-dev.99+gd3a73cd6e (dev, AppleClang 21.0.0.21000101, emit=std::print, built_from=d3a73cd6e) ````` @@ -4509,27 +4409,27 @@ ripwire 0.6.10-dev.100+gda897642e (dev, AppleClang 21.0.0.21000101, emit=std::pr # navigate — seeds, claims, slices, shapes -## `./build/ripwire . --at=src/graph.h:14630` +## `./build/ripwire . --at=src/graph.h:14923` *Hold a LOCATION, not a name: the enclosing-definition chain at FILE:LINE (a compiler error, a diff hunk, a stack frame), outermost -> innermost.* ````` - - + + ````` -## `./build/ripwire . --callers=@src/graph.h:14630` +## `./build/ripwire . --callers=@src/graph.h:14923` *The same seed in a SELECTOR position: @FILE:LINE resolves to the innermost enclosing definition, then --callers runs on it.* ````` - + - - + + @@ -4550,7 +4450,7 @@ ripwire 0.6.10-dev.100+gda897642e (dev, AppleClang 21.0.0.21000101, emit=std::pr stderr: ````` -ripwire: the at flag's seed 'src/graph.h:999999' named no location (./src/graph.h has only 21063 lines — the seed asked for line 999999) +ripwire: the at flag's seed 'src/graph.h:999999' named no location (./src/graph.h has only 21356 lines — the seed asked for line 999999) ````` ## `./build/ripwire . --verify="calls(runDefaultMap, rankGraphTeleport)"` @@ -4559,9 +4459,9 @@ ripwire: the at flag's seed 'src/graph.h:999999' named no location (./src/graph. ````` - + - + ````` @@ -4571,10 +4471,10 @@ ripwire: the at flag's seed 'src/graph.h:999999' named no location (./src/graph. ````` - + - - + + @@ -4588,7 +4488,7 @@ ripwire: the at flag's seed 'src/graph.h:999999' named no location (./src/graph. *A literal-scan absence: refuted only with complete= evidence, never on a partial scan.* -**wall time: 1.29s** +**wall time: 1.02s** ````` @@ -4616,25 +4516,25 @@ ripwire: --verify claim not recognized: 'frobnicate(x)' — unknown shape word. *Bare --slice=SYM: the INVENTORY of sliceable locals (), so a caller can pick VAR.* -**wall time: 2.93s** +**wall time: 1.15s** ````` - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + ````` @@ -4642,21 +4542,21 @@ ripwire: --verify claim not recognized: 'frobnicate(x)' — unknown shape word. *Intra-procedural def-use slice of ONE variable: one row per line touching it, k=def|use|both, reaching definitions flow-sensitive (reach=cfg).* -**wall time: 2.18s** +**wall time: 1.73s** ````` - - + + - + teleport( pw.begin(), pw.end() );]]> - + - + @@ -4666,30 +4566,30 @@ ripwire: --verify claim not recognized: 'frobnicate(x)' — unknown shape word. *TRANSITIVE backward value-flow from the seed variable, bounded BFS (depth= disclosed; a cut frontier says flow_truncated=1).* -**wall time: 2.54s** +**wall time: 1.40s** ````` - - + + - + teleport( pw.begin(), pw.end() );]]> - + - + - + pw = biasPrior( g, p );]]> - + & p, float alpha = 0.85f )]]> - + & p, float alpha = 0.85f )]]> @@ -4699,42 +4599,42 @@ ripwire: --verify claim not recognized: 'frobnicate(x)' — unknown shape word. *Forward flow: which statements the seed's value reaches, at the default depth bound.* -**wall time: 3.07s** +**wall time: 1.56s** ````` - - + + - + teleport( pw.begin(), pw.end() );]]> - + - + - + - + - + - + - + 0.0 )]]> - + - + @@ -4776,21 +4676,21 @@ ripwire: --slice-depth bounds the --slice-flow BFS — pass both (e.g. ripwire < *The compact legend posture: rows byte-identical, a versioned schema id replaces the repeated explanatory prose — for a many-small-calls loop.* -**wall time: 1.77s** +**wall time: 1.53s** ````` - - + + - + teleport( pw.begin(), pw.end() );]]> - + - + @@ -4800,12 +4700,12 @@ ripwire: --slice-depth bounds the --slice-flow BFS — pass both (e.g. ripwire < *Structural search written in CODE: $NAME binds one node; grammars=/shapes= disclose what the pattern became per grammar (a 3-argument call shape — the 2-argument spelling has no call site in this repo and correctly reports hits=0).* -**wall time: 3.28s** +**wall time: 5.83s** ````` rankGraphTeleport( g, std::vector<float>( N, ranked ? 1.0f / float( ranked ) : 0.f ), alpha ) +rankGraphTeleport( g, std::vector<float>( N, ranked ? 1.0f / float( ranked ) : 0.f ), alpha ) ````` @@ -4813,7 +4713,7 @@ ripwire: --slice-depth bounds the --slice-flow BFS — pass both (e.g. ripwire < *The ellipsis form over a macro-shaped call site; unsupported= names the families this verb does not serve.* -**wall time: 2.49s** +**wall time: 4.19s** ````` @@ -4869,32 +4769,34 @@ ripwire: --pattern: this pattern collapses to a single bare token, which is a TE *Boolean grep: hits where BOTH literals share the matched line (--grep-scope=line is the default).* +**wall time: 1.06s** + ````` - + inline bool topLevelEvidence( std::string_view source, const TSLanguage* language, const Predicate& predicate ) The crawl's per-file byte ceiling. A text file larger than this is skipped: at this size it is o…constexpr std::size_t kDefaultMaxFileBytes = 4u * 1024u * 1024u TSTree* parseTree( TSParser* parser, std::string_view src ) Exercise every registered grammar and its embedded query, reporting loaded and expected totalsinline DoctorGrammarProbe doctorProbeGrammars() -class SourceReader +class SourceReader constexpr std::array<LangEntry, 58> kLangTable = struct FileHealth struct SliceScan -explicit ParsedFile( std::string bytes ) : m_bytes( std::move( bytes ) ) -class ParsedFile +explicit ParsedFile( std::string bytes ) : m_bytes( std::move( bytes ) ) +class ParsedFile @@ -5140,38 +5042,38 @@ ripwire: --grep given twice; did you mean --grep='A' --and='B'? inline ModuleScan scanModule( std::string_view source, std::string_view path ) inline bool hasMainGuard( std::string_view source ) -inline bool hasPhantomScopeSeparator( TSNode qualified ) noexcept +inline bool hasPhantomScopeSeparator( TSNode qualified ) noexcept -… [242 more display lines; full output is 26561 bytes on 44 raw line(s)] +… [242 more display lines; full output is 26766 bytes on 44 raw line(s)] ````` ## `./build/ripwire . --for="tree-sitter parse of a source file" --sections=lego,compose` *Restore the / sections the --for bundle collapses to a counted stub by default (this is the stub's own next= spelling).* -**wall time: 5.81s** +**wall time: 4.37s** ````` - + - + inline bool topLevelEvidence( std::string_view source, const TSLanguage* language, const Predicate& predicate ) The crawl's per-file byte ceiling. A text file larger than this is skipped: at this size it is o…constexpr std::size_t kDefaultMaxFileBytes = 4u * 1024u * 1024u TSTree* parseTree( TSParser* parser, std::string_view src ) Exercise every registered grammar and its embedded query, reporting loaded and expected totalsinline DoctorGrammarProbe doctorProbeGrammars() -class SourceReader +class SourceReader constexpr std::array<LangEntry, 58> kLangTable = struct FileHealth struct SliceScan -explicit ParsedFile( std::string bytes ) : m_bytes( std::move( bytes ) ) -class ParsedFile +explicit ParsedFile( std::string bytes ) : m_bytes( std::move( bytes ) ) +class ParsedFile @@ -5180,38 +5082,38 @@ ripwire: --grep given twice; did you mean --grep='A' --and='B'? inline ModuleScan scanModule( std::string_view source, std::string_view path ) inline bool hasMainGuard( std::string_view source ) -inline bool hasPhantomScopeSeparator( TSNode qualified ) noexcept +inline bool hasPhantomScopeSeparator( TSNode qualified ) noexcept -… [264 more display lines; full output is 27931 bytes on 44 raw line(s)] +… [264 more display lines; full output is 28136 bytes on 44 raw line(s)] ````` ## `./build/ripwire . --for="tree-sitter parse of a source file" --auto-bodies` *Opt OUT of compact conceptual serving: restore the rank-first auto walk (bundle="auto").* -**wall time: 4.20s** +**wall time: 4.30s** ````` - + - + inline bool topLevelEvidence( std::string_view source, const TSLanguage* language, const Predicate& predicate ) The crawl's per-file byte ceiling. A text file larger than this is skipped: at this size it is o…constexpr std::size_t kDefaultMaxFileBytes = 4u * 1024u * 1024u TSTree* parseTree( TSParser* parser, std::string_view src ) Exercise every registered grammar and its embedded query, reporting loaded and expected totalsinline DoctorGrammarProbe doctorProbeGrammars() -class SourceReader +class SourceReader constexpr std::array<LangEntry, 58> kLangTable = struct FileHealth struct SliceScan -explicit ParsedFile( std::string bytes ) : m_bytes( std::move( bytes ) ) -class ParsedFile +explicit ParsedFile( std::string bytes ) : m_bytes( std::move( bytes ) ) +class ParsedFile @@ -5220,30 +5122,30 @@ ripwire: --grep given twice; did you mean --grep='A' --and='B'? inline ModuleScan scanModule( std::string_view source, std::string_view path ) inline bool hasMainGuard( std::string_view source ) -inline bool hasPhantomScopeSeparator( TSNode qualified ) noexcept +inline bool hasPhantomScopeSeparator( TSNode qualified ) noexcept -… [272 more display lines; full output is 28347 bytes on 96 raw line(s)] +… [272 more display lines; full output is 28550 bytes on 96 raw line(s)] ````` ## `./build/ripwire . --for="quality delta acks ledger rubber stamp"` *Doc-mention surfacing (default ON): a markdown doc naming a top-resolved symbol in a backtick rides in below that symbol — the legend's [doc mentions: …] clause says it fired.* -**wall time: 5.90s** +**wall time: 4.28s** ````` - + L2 stale acks in the range form. A changed-files answer holds no whole target tree to check the …std::vector<rw::quality::StaleAck> refPairStaleAcks( const gtl::btree_map<std::string, rw::quality::AckRecord>& acks, const RefPairDelta& refs ) inline QualityDeltaOutcome computeQualityDelta( const std::string& root ) -inline std::string staleByKindValue( const std::vector<StaleAck>& staleAcks ) +inline std::string staleByKindValue( const std::vector<StaleAck>& staleAcks ) inline constexpr const char* kAtStampLegend = "<!-- at= is the git commit these numbers were computed at std::optional<int> runForLensPosture( const MainDispatch& d, rw::ForAnswerLedger* ledger ) inline Result computeDmm( const std::string& root, std::string_view spec, const IngestResult& workingIng, const std::vector<std::string>& excludes, std::size_t maxFileBytes … [line truncated: 5 more bytes on this line] @@ -5259,11 +5161,11 @@ ripwire: --grep given twice; did you mean --grep='A' --and='B'? -inline bool writeAckRecords( const std::string& path, const gtl::btree_map<std::string, AckRecord>& acks ) +inline bool writeAckRecords( const std::string& path, const gtl::btree_map<std::string, AckRecord>& acks ) inline std::pair<std::string, std::string> qualityDeltaJson( const std::string& root, bool showStale = false ) inline std::string qualityAcksPath( const std::string& root ) -inline std::string staleAcksXml( const std::vector<StaleAck>& staleAcks, EscapeFn esc ) -inline std::string gitHeadSha( const std::string& root ) +inline std::string staleAcksXml( const std::vector<StaleAck>& staleAcks, EscapeFn esc ) +inline std::string gitHeadSha( const std::string& root ) std::optional<int> resolveDeltaBasis( const MainDispatch& d, const std::string& baselineFile, RefPairDelta& refs, DeltaBasis& out ) … [319 more display lines; full output is 31224 bytes on 46 raw line(s)] @@ -5273,17 +5175,17 @@ ripwire: --grep given twice; did you mean --grep='A' --and='B'? *The same task with doc-mention surfacing OFF — the contrast the flag exists for (no [doc mentions] clause, one fewer row).* -**wall time: 4.46s** +**wall time: 3.45s** ````` - + L2 stale acks in the range form. A changed-files answer holds no whole target tree to check the …std::vector<rw::quality::StaleAck> refPairStaleAcks( const gtl::btree_map<std::string, rw::quality::AckRecord>& acks, const RefPairDelta& refs ) inline QualityDeltaOutcome computeQualityDelta( const std::string& root ) -inline std::string staleByKindValue( const std::vector<StaleAck>& staleAcks ) +inline std::string staleByKindValue( const std::vector<StaleAck>& staleAcks ) inline constexpr const char* kAtStampLegend = "<!-- at= is the git commit these numbers were computed at std::optional<int> runForLensPosture( const MainDispatch& d, rw::ForAnswerLedger* ledger ) inline Result computeDmm( const std::string& root, std::string_view spec, const IngestResult& workingIng, const std::vector<std::string>& excludes, std::size_t maxFileBytes … [line truncated: 5 more bytes on this line] @@ -5299,11 +5201,11 @@ ripwire: --grep given twice; did you mean --grep='A' --and='B'? -inline bool writeAckRecords( const std::string& path, const gtl::btree_map<std::string, AckRecord>& acks ) +inline bool writeAckRecords( const std::string& path, const gtl::btree_map<std::string, AckRecord>& acks ) inline std::pair<std::string, std::string> qualityDeltaJson( const std::string& root, bool showStale = false ) inline std::string qualityAcksPath( const std::string& root ) -inline std::string staleAcksXml( const std::vector<StaleAck>& staleAcks, EscapeFn esc ) -inline std::string gitHeadSha( const std::string& root ) +inline std::string staleAcksXml( const std::vector<StaleAck>& staleAcks, EscapeFn esc ) +inline std::string gitHeadSha( const std::string& root ) std::optional<int> resolveDeltaBasis( const MainDispatch& d, const std::string& baselineFile, RefPairDelta& refs, DeltaBasis& out ) … [319 more display lines; full output is 30948 bytes on 46 raw line(s)] @@ -5313,12 +5215,14 @@ ripwire: --grep given twice; did you mean --grep='A' --and='B'? *"Can I delete this?" — callers + transitive impact + every use site + how much of the radius is tested, composed in ONE call; risk= names what was found, never a verdict.* +**wall time: 2.79s** + ````` - - - + + @@ -5330,7 +5234,7 @@ ripwire: --grep given twice; did you mean --grep='A' --and='B'? *Unknown-symbol refusal shape for --safe-delete.* -**exit code: 1** +**exit code: 1** — **wall time: 2.67s** ````` (empty) @@ -5346,22 +5250,22 @@ ripwire: --safe-delete symbol not found: DoesNotExist (note: the lexical definit *The continuation packet for the NEXT session: disk truth (branch/sha, changed symbols, blast radius, tests) + labeled suggestions. Recorded against a CLEAN tree.* -**wall time: 8.39s** +**wall time: 15.07s** ````` - + - + - - - + + + + ````` @@ -5370,16 +5274,16 @@ ripwire: --safe-delete symbol not found: DoesNotExist (note: the lexical definit *The same packet under a hard ceiling: heuristic rows drop tail-first (withheld= disclosed), verified rows never drop.* -**wall time: 9.76s** +**wall time: 2.97s** ````` - - + + - + @@ -5421,24 +5325,24 @@ ripwire: --safe-delete symbol not found: DoesNotExist (note: the lexical definit -… [561 more display lines; full output is 59444 bytes on 1 raw line(s)] +… [563 more display lines; full output is 59670 bytes on 1 raw line(s)] ````` ## `./build/ripwire . --no-ignore --top-k=3` *Crawl paths the repo's own .gitignore covers (default honours it and discloses ignored_files=/ignored_dirs= only when it dropped anything — this repo's crawl drops nothing, so the header is identical to the default map's; --skipped's ignore_mode= says which rule applied).* -**wall time: 3.01s** +**wall time: 1.06s** ````` - - + + - + @@ -5449,7 +5353,7 @@ ripwire: --safe-delete symbol not found: DoesNotExist (note: the lexical definit - + @@ -5461,24 +5365,22 @@ ripwire: --safe-delete symbol not found: DoesNotExist (note: the lexical definit -… [80 more display lines; full output is 10006 bytes on 1 raw line(s)] +… [81 more display lines; full output is 10053 bytes on 1 raw line(s)] ````` ## `./build/ripwire . --no-stable --top-k=3` *--no-stable outside --mcp: what the flag does (or says) when there is no stable-by-default ordering to opt out of.* -**wall time: 1.12s** - ````` - - + + - + @@ -5489,7 +5391,7 @@ ripwire: --safe-delete symbol not found: DoesNotExist (note: the lexical definit - + @@ -5501,7 +5403,7 @@ ripwire: --safe-delete symbol not found: DoesNotExist (note: the lexical definit -… [80 more display lines; full output is 10006 bytes on 1 raw line(s)] +… [81 more display lines; full output is 10053 bytes on 1 raw line(s)] ````` stderr: @@ -5514,18 +5416,18 @@ ripwire: --no-stable is read only by --mcp/--listen (it opts out of the stable o *EXEC-MODE --from-trace: run a command, and on a non-zero exit map its captured output onto indexed symbols in the same call — the whole fix-loop entry. ripwire exits 4 here because the wrapped command failed, which is the signal, not an incident.* -**exit code: 4** — **wall time: 1.02s** +**exit code: 4** ````` - + - + const&, float) src/graph.h:14630 - #1 0x102f3e884 in rw::rankGraph(Graph const&, float) src/graph.h:14673 + #0 0x102f4a1c8 in rw::rankGraphTeleport(Graph const&, std::vector const&, float) src/graph.h:14923 + #1 0x102f3e884 in rw::rankGraph(Graph const&, float) src/graph.h:14966 #2 0x102e11f30 in runDefaultMap(MainDispatch const&) src/main.cpp:1759 #3 0x102e01a44 in main src/main.cpp:4511 #4 0x1a2b3c0dc in start+0x9dc (dyld:arm64e+0x60dc)]]> r( N, 0.f ); std::transform( rankDouble.begin(), rankDouble.end(), r.begin(), []( double value ) { return float( value ); } ); return { std::move( r ), run.iterationCount, run.hasConverged }; -}]]>inline std::vector<float> biasPrior( const Graph& g, const std::vector<float>& p )#define PROFILE_SCOPE_DESCRIBE( desc )inline std::vector<float> biasPrior( const Graph& g, const std::vector<float>& p )#define PROFILE_SCOPE_DESCRIBE( desc ) - + ````` @@ -5576,12 +5476,12 @@ ripwire: --no-stable is read only by --mcp/--listen (it opts out of the stable o *A command still running at the cap: its process group is killed and the run reports timed_out=1 — an honest timeout, never an empty success.* -**exit code: 4** — **wall time: 2.46s** +**exit code: 4** — **wall time: 2.17s** ````` - + ````` @@ -5616,21 +5516,21 @@ ripwire: --run-timeout=SECONDS modifies --run-trace — pass it too (e.g. ripwir *THE single wide-angle quality read: six families in one pass, an eligible/ranked shortlist rather than a firehose.* -**wall time: 13.36s** +**wall time: 6.93s** ````` - - - + + - + @@ -5658,8 +5558,8 @@ ripwire: --run-timeout=SECONDS modifies --run-trace — pass it too (e.g. ripwir ````` - - + + @@ -5676,7 +5576,7 @@ ripwire: --run-timeout=SECONDS modifies --run-trace — pass it too (e.g. ripwir ````` - + @@ -5692,51 +5592,49 @@ ripwire: --run-timeout=SECONDS modifies --run-trace — pass it too (e.g. ripwir *The local-reasoning lens: to understand this symbol, how much must you know that is NOT in front of you (ent_ratio= edge share, read_ratio= token-weighted).* -**wall time: 1.02s** - ````` - - - - - - - - - - - - - - - - - - - - - - - - - - - - -… [21 more display lines; full output is 11233 bytes on 1 raw line(s)] + + + + + + + + + + + + + + + + + + + + + + + + + + + + +… [21 more display lines; full output is 11236 bytes on 1 raw line(s)] ````` ## `./build/ripwire . --nonlocal-state --limit=8` *Per function, the non-local MUTABLE state it can reach (transitively), most writes first — unsound by construction, and the legend says where.* -**wall time: 6.57s** +**wall time: 3.02s** ````` - @@ -5772,11 +5670,11 @@ ripwire: --run-timeout=SECONDS modifies --run-trace — pass it too (e.g. ripwir *The family join: per function, which of four orthogonal evidence families fire, ranked by how many agree.* -**wall time: 9.52s** +**wall time: 5.12s** ````` - @@ -5790,7 +5688,7 @@ ripwire: --run-timeout=SECONDS modifies --run-trace — pass it too (e.g. ripwir - + @@ -5812,11 +5710,11 @@ ripwire: --run-timeout=SECONDS modifies --run-trace — pass it too (e.g. ripwir *The cache-locality lens over every aggregate: fields READ TOGETHER but declared FAR APART (split-line / straddle findings, Chilimbi separation weight) — advice only, never a rewrite.* -**wall time: 7.89s** +**wall time: 2.31s** ````` - @@ -5845,18 +5743,18 @@ ripwire: --run-timeout=SECONDS modifies --run-trace — pass it too (e.g. ripwir -… [1636 more display lines; full output is 154719 bytes on 1 raw line(s)] +… [1635 more display lines; full output is 154776 bytes on 1 raw line(s)] ````` ## `./build/ripwire . --field-affinity=Symbol` *The same lens narrowed to ONE struct — the one --layout=Symbol shows the offsets for.* -**wall time: 4.74s** +**wall time: 2.13s** ````` - @@ -5866,7 +5764,7 @@ ripwire: --run-timeout=SECONDS modifies --run-trace — pass it too (e.g. ripwir - + @@ -5881,16 +5779,16 @@ ripwire: --run-timeout=SECONDS modifies --run-trace — pass it too (e.g. ripwir ````` - - - + + + - + @@ -5917,11 +5815,11 @@ ripwire: --run-timeout=SECONDS modifies --run-trace — pass it too (e.g. ripwir *Score the naming-* rules against this repo's own rename history: proxy=old/(old+new) per rule, 0.50 = chance; read pairs= (sample size) first.* -**wall time: 20.43s** +**wall time: 33.15s** ````` - + @@ -5943,23 +5841,23 @@ ripwire: --run-timeout=SECONDS modifies --run-trace — pass it too (e.g. ripwir