From cf89ac85ea51112cca36852f263f76b73ff6df70 Mon Sep 17 00:00:00 2001 From: joyful-ii-V-I <210578314+joyful-ii-V-I@users.noreply.github.com> Date: Sat, 21 Nov 2026 12:45:56 -0500 Subject: [PATCH 01/44] refactor(quality): runQualityDelta in named phases, one row model for XML and JSON GE-RUNQD (#4 on the 5df5a26be tangle census, S 19.2): split computing the --quality-delta answer from rendering it, byte-identical output. - QdJudged + judgeQualityDelta: the scope partition and the ack ratchet. - runQualityAckWrite: the --quality-ack arm as named steps (ackOnlySelects, discloseAckBackfill, acceptFinding, refuseUnmatchedAckOnly, writeAcceptedAcks) instead of a lambda and loop nested five deep. - QdReport + qdReportOf: every count and root disclosure, computed once, in the order their stderr lines have always printed; exitCode() names the exit decision that was written at four return sites. - QdRowModel: each row's shape, display symbol, gating, facet name and origin decided once; emitQdXmlRow and emitQdJsonRow render it, and the in-scope and out-of-scope halves share one row loop per format. - emitQualityDeltaJson / emitQualityDeltaXml (+ emitQdXmlDocument, emitQdVerdict, qdStaleCollapse, qdNothingElseToDisclose) render it. Co-Authored-By: Claude Opus 5.5 --- src/verbs_quality.h | 1588 +++++++++++++++++++++++-------------------- 1 file changed, 864 insertions(+), 724 deletions(-) diff --git a/src/verbs_quality.h b/src/verbs_quality.h index d0b6186af..c730c16e4 100644 --- a/src/verbs_quality.h +++ b/src/verbs_quality.h @@ -2584,749 +2584,889 @@ inline std::string presentXmlAttr( std::string_view name, const std::string& v, return v.empty() ? std::string() : " " + std::string( name ) + "=\"" + esc( v ) + "\""; } -std::optional runQualityDelta( const MainDispatch& d ) +// ── --quality-delta, in three phases: JUDGE (scope partition + ack ratchet), then either WRITE ACKS or REPORT ────────── +// GE-RUNQD: runQualityDelta used to compute the answer and render it in one 744-line body, with the JSON and XML row +// emitters written twice inside it. The phases are now named functions over two small state structs — QdJudged (the +// comparison after the partition and the ratchet) and QdReport (everything a rendering reads) — and one row model +// (QdRowModel) decides each row's printed facts once for both formats. + +// The comparison once the scope partition and the ack ratchet ran: what the --quality-ack writer and the report both read. +// `refs` owns both materialized trees' teardown and must outlive every read of basis.regs (DeltaBasis's header states that +// rule, and why every path and symbol downstream is spelled against basis.deltaRoot rather than against `root`). +struct QdJudged +{ + const rw::Config& cfg; + const std::string& root; + RefPairDelta& refs; + DeltaBasis& basis; + const bool refPair; + const rw::IngestResult& judged; // the JUDGED tree's index: tree B in the ref-pair form, else the working tree + const rw::Graph& workingGraph; // the working tree's graph: the bare form's stale-ack snapshot reads it + rw::quality::Scope scope; + std::vector outOfScope; + std::vector foreignAcks; + std::size_t diffFileCount = 0; // P1.2: 0 = the reserved diff token was not used + std::size_t scopedOutGating = 0; + std::size_t ackedCount = 0; +}; + +// JUDGE — the scope partition, then the per-finding ack ratchet, over the delta resolveDeltaBasis computed. Returns the +// refusal's exit code when the scope cannot be used. +std::optional judgeQualityDelta( QdJudged& j ) { using namespace rw; - const Config& cfg = d.cfg; - const IngestResult& ing = d.ing; - const Graph& g = d.g; - const std::string& root = d.root; - - // --quality-baseline / --quality-delta (the convergence-loop oracle): snapshot ccx + clone groups + dead - // candidates to .ripwire_quality_baseline; then report ONLY what a change made WORSE vs it. The "delta not - // absolute" discipline — a refine loop targets the regression it introduced, not absolute numbers (the - // defense against metric-gaming). exit 2 if any new debt, like --arch. - if( cfg.qualityBaseline || cfg.qualityDelta ) - { - // D1 fix (HIGH): resolve BOTH sidecars against the analyzed ROOT, not the process CWD — - // see quality::rootQualifiedSidecar's comment for why a bare relative filename is unsafe here - // (a foreign cwd's sidecar could be silently rewritten, or even deleted by the stale-baseline - // self-heal below). Computed once; every read/write/remove site in this block uses it. - const std::string baselineFile = quality::baselinePath( root ); - const std::string acksFile = quality::acksPath( root ); - - if( cfg.qualityBaseline ) - { - return runQualityBaselinePin( d, baselineFile, acksFile ); - } + std::vector& regs = j.basis.regs; + // ── P1 SCOPE — the OWNERSHIP partition for a working tree with several writers in it ───────────── + j.scope = quality::parseScope( j.cfg.qualityScope ); + if( const std::optional refused = expandScopeDiff( j.scope, j.refPair, j.judged, j.root, j.basis.deltaRoot, j.diffFileCount ) ) + { + return refused; + } + if( const std::optional refused = refuseUnusableScope( j.cfg, j.scope, j.judged, j.basis.deltaRoot, j.refs.scopeFiles() ) ) + { + return refused; + } + + // Signal-to-noise round — the per-finding ACK RATCHET. Suppress findings already accepted (with a + // reason) in .ripwire_quality_acks, honestly (acked="N"); a finding that WORSENED past its acked + // magnitude survives the filter and reappears. --quality-ack merges the currently-VISIBLE findings + // into that file instead of printing the report (accepting what previous acks already hid would be + // a silent blanket ack — only what the agent can see right now is what it can accept). + // R1 IDENTITY: the ledger was read and HEALED inside resolveDeltaBasis (it had to be — the baseline + // half of the same healing has to precede computeDelta), so this arm takes the already-current map + // rather than re-reading the file and undoing it. + gtl::btree_map& acks = j.basis.acks; + quality::countAckRescues( regs, acks, j.basis.healing.ackRemap, j.basis.healing.ackedByRename, j.basis.healing.ackedByContent ); + // P1.4 PROVENANCE — the foreign-ack sweep reads the PRE-ratchet list on purpose (computeForeignAcks' + // header states why: the question is about acks that are suppressing something right now). + j.foreignAcks = quality::computeForeignAcks( regs, acks ); + // P1 — the partition runs BEFORE the ratchet so acked="N" counts THIS scope's suppressions rather + // than the whole tree's (partitionByScope owns the rest of the rule). + j.scopedOutGating = partitionByScope( j.scope, regs, j.outOfScope, acks ); + j.ackedCount = quality::applyAckRatchet( regs, acks ); + return std::nullopt; +} - // Precedence for the baseline: (1) an explicit `.ripwire_quality_baseline` sidecar (from - // --quality-baseline) wins whenever it is pinned at the CURRENT HEAD — the mid-task convergence loop - // (baseline once, edit, re-check) is unchanged; (2) else — no sidecar, or a STALE one (see R3 below) — - // if the root is a git repo with a HEAD tree, auto-baseline against HEAD so the "before I push" loop - // works with no start-of-task ritual (T0.1); (3) else degrade to the exit-1 "run --quality-baseline - // first" guidance (non-git / unborn / detached-no-tree — unchanged). - // - // STALENESS + the self-heal now live in ONE place, quality::selectBaseline — R3 owner ruling - // (2026-07-29): a sidecar whose pinned sha != the CURRENT HEAD sha is STALE, full stop. The B10.1b - // "reachable ancestor is a deliberately-pinned floor" carve-out this arm used to apply (gitIsAncestor) - // is REVOKED: a parallel session's sidecar pinned at a commit that merely happened to be an ancestor of - // this session's HEAD made THIS arm report 31 phantom regressions while the MCP quality_delta verb — - // same binary, same repo, same second — correctly reported zero. That divergence was only possible - // because each arm carried its own copy of the test; there is now exactly one, in quality.h. - // - // What remains this arm's own POLICY is the `removeStaleFile=true` argument: the stale sidecar is - // silently UNLINKED (best-effort) so the NEXT run sees no file at all rather than rediscovering the - // same dead pin, and the ONLY record is the `baseline=` XML attribute ("git-HEAD (stale sidecar - // removed)") — no stderr spam, which is the B10.1b noise fix that survives the ruling intact. The - // read-only MCP arm passes false and reports "…ignored" instead. When the unlink FAILS (read-only - // parent dir) this arm degrades to the read-only story — marker "…ignored", one DISCLOSE - // from the seam — because the pin is still on disk; `baseSel.isStaleFileOnDisk()` is the fact, and the - // fatal message below words itself from it rather than from the intent. - // `refs` is declared HERE because it owns both materialized trees' teardown and they must outlive - // every read of `regs` (DeltaBasis's header states that rule, and why the emitters below spell every - // path and symbol against basis.deltaRoot rather than against `root`). - // F-04 (round-4 audit) — SERIALIZE THE ACK LEDGER'S READ-MODIFY-WRITE, cross-process. - // - // --quality-ack reads the whole ledger (inside resolveDeltaBasis just below — the heal has to happen - // before computeDelta), folds this run's accepted findings into that map, then rewrites the file from - // it. Nothing serialized that. Three sessions acking DISJOINT rows in one shared checkout — the exact - // scenario --scope exists for — lost two of the three acks on 8 of 8 measured runs, because whichever - // process rewrote last overwrote a map the other two had already published into. - // - // The lock therefore has to span the READ as well as the write, which is why it is taken HERE and not - // inside writeAckRecords: a lock held only around the final rewrite still lets two processes read the - // same stale map first and then take turns clobbering. Engaged ONLY under --quality-ack — a read-only - // --quality-delta never waits, never creates the lockfile, and is byte-for-byte the run it always was. - // RAII: released when this function returns, on every path including the refusals below. quality.h's - // SidecarWriteLock has the lockfile's location (per-user cache dir, never a repo-tree sidecar), the - // wait budget, and the honest limits. - std::optional ackLock; - if( cfg.qualityAck ) +// --ack-only=SUBSTR[,SUBSTR]: ack a SUBSET instead of everything on screen. Without it, the only way to accept one +// deliberate contract change was to accept the whole report — which is how a ratchet quietly becomes a rubber stamp. A +// finding matches if a pattern occurs in its kind, its canonical id or its FACET (so "api-surface", "src/quality.h", one +// exact id, or "format-arity" all work). The facet is what makes this precise enough to be honest: "api-surface" also +// covers the never-gating new-symbol rows, so acking by kind would sweep in 59 findings to accept 8; +// --ack-only=contract-change accepts exactly the deliberate ones. The pseudo-token "gating" selects whatever would +// actually exit 2. +// P1: `inScope` is a parameter because the predicate is asked about BOTH halves of the partition — once to choose what to +// write, once to detect an ack selection that NAMES a row belonging to someone else. It is also what keeps `gating` honest +// under a scope: an out-of-scope row does not gate, so `gating` must not select it. +bool ackOnlySelects( std::string_view ackOnly, const rw::quality::Regression& r, bool inScope ) +{ + if( ackOnly.empty() ) + { + return true; + } + const bool gates = rw::quality::rowGates( r ) && inScope; + const auto patternSelects = [ & ]( std::string_view pat ) + { + return !pat.empty() && ( r.kind.find( pat ) != std::string::npos || r.sym.find( pat ) != std::string::npos + || ( !r.facet.empty() && r.facet.find( pat ) != std::string::npos ) || ( pat == "gating" && gates ) ); + }; + for( std::string_view rest = ackOnly; !rest.empty(); ) + { + const std::size_t comma = rest.find( ',' ); + if( patternSelects( rest.substr( 0, comma ) ) ) { - ackLock.emplace( acksFile ); + return true; } + rest = comma == std::string_view::npos ? std::string_view() : rest.substr( comma + 1 ); + } + return false; +} - const bool refPair = !cfg.qualityDeltaRange.empty(); - RefPairDelta refs; - DeltaBasis basis; - if( const std::optional refused = applyKindSelector( cfg, refs ) ) - { - return refused; - } - if( const std::optional refused = resolveDeltaBasis( d, baselineFile, refs, basis ) ) - { - return refused; - } - const quality::BaselineSelection& baseSel = basis.baseSel; - const std::string& deltaRoot = basis.deltaRoot; - std::vector& regs = basis.regs; - - // ── P1 SCOPE — the OWNERSHIP partition for a working tree with several writers in it ───────────── - quality::Scope scope = quality::parseScope( cfg.qualityScope ); - std::vector outOfScope; - std::size_t diffFileCount = 0; // P1.2: 0 = the reserved diff token was not used - const IngestResult& judged = refPair ? refs.target().ing : ing; - if( const std::optional refused = expandScopeDiff( scope, refPair, judged, root, deltaRoot, diffFileCount ) ) - { - return refused; - } - if( const std::optional refused = refuseUnusableScope( cfg, scope, judged, deltaRoot, refs.scopeFiles() ) ) - { - return refused; - } +// THE LEGACY-ACK BACKFILL's disclosure. A reconstructed row is a weaker claim than a measured one, so a reader is told how +// many rows just changed confidence class and how many could not be healed at all. The unresolved count is a FLOOR on +// what is missing, not a total of what is wrong: a member set that no longer clones in THIS tree is unanswerable here, +// not proven gone. Silent when the backfill touched nothing. +void discloseAckBackfill( const rw::quality::AckBackfill& backfilled ) +{ + if( backfilled.resolved == 0 && backfilled.refreshed == 0 && backfilled.unverified == 0 && backfilled.unresolved == 0 ) + { + return; + } + rw::emitTo( stderr, "ripwire: ack provenance backfill — {} clone row(s) reconstructed from the current tree, {} re-derived, {} left UNVERIFIED (their group was not found here — a floor, not proof it is gone), " + "{} left legacy (member set not found cloning here — a floor, not proof it is gone), {} ineligible (no current-tree fact answers their kind), {} already measured (left alone). " + "prov=recon is what the idiom is NOW, as of the last run that could check it — not what was measured when the row was accepted.\n", + backfilled.resolved, backfilled.refreshed, backfilled.unverified, backfilled.unresolved, backfilled.ineligible, backfilled.measured ); +} - // Signal-to-noise round — the per-finding ACK RATCHET. Suppress findings already accepted (with a - // reason) in .ripwire_quality_acks, honestly (acked="N"); a finding that WORSENED past its acked - // magnitude survives the filter and reappears. --quality-ack merges the currently-VISIBLE findings - // into that file instead of printing the report (accepting what previous acks already hid would be - // a silent blanket ack — only what the agent can see right now is what it can accept). - // R1 IDENTITY: the ledger was read and HEALED inside resolveDeltaBasis (it had to be — the baseline - // half of the same healing has to precede computeDelta), so this arm takes the already-current map - // rather than re-reading the file and undoing it. - gtl::btree_map& acks = basis.acks; - quality::countAckRescues( regs, acks, basis.healing.ackRemap, - basis.healing.ackedByRename, basis.healing.ackedByContent ); - // P1.4 PROVENANCE — the foreign-ack sweep reads the PRE-ratchet list on purpose (computeForeignAcks' - // header states why: the question is about acks that are suppressing something right now). - const std::vector foreignAcks = quality::computeForeignAcks( regs, acks ); - // P1 — the partition runs BEFORE the ratchet so acked="N" counts THIS scope's suppressions rather - // than the whole tree's (partitionByScope owns the rest of the rule). - const std::size_t scopedOutGating = partitionByScope( scope, regs, outOfScope, acks ); - const std::size_t ackedCount = quality::applyAckRatchet( regs, acks ); - if( cfg.qualityAck ) - { - // --ack-only=SUBSTR[,SUBSTR]: ack a SUBSET instead of everything on screen. Without it, the only - // way to accept one deliberate contract change was to accept the whole report — which is how a - // ratchet quietly becomes a rubber stamp. A finding matches if a substring occurs in its kind or - // in its canonical id (so "api-surface", "src/quality.h", or one exact id all work). - // P1: `inScope` is a parameter rather than a capture because this predicate is asked about BOTH - // halves of the partition — once to choose what to write, once to detect an ack selection that - // NAMES a row belonging to someone else. It is also what keeps the `gating` pseudo-token honest - // under a scope: an out-of-scope row does not gate, so `gating` must not select it. - const auto ackSelected = [ & ]( const quality::Regression& r, bool inScope ) -> bool - { - if( cfg.qualityAckOnly.empty() ) - { - return true; - } - std::string_view rest = cfg.qualityAckOnly; - while( !rest.empty() ) - { - const std::size_t comma = rest.find( ',' ); - const std::string_view pat = rest.substr( 0, comma ); - // kind, canonical id, or FACET. The facet is what makes this precise enough to be honest: - // "api-surface" also covers the never-gating new-symbol rows, so acking by kind would - // sweep in 59 findings to accept 8. --ack-only=contract-change accepts exactly the - // deliberate ones. The pseudo-token "gating" selects whatever would actually exit 2. - const bool gates = quality::rowGates( r ) && inScope; - if( !pat.empty() && ( r.kind.find( pat ) != std::string::npos || r.sym.find( pat ) != std::string::npos || ( !r.facet.empty() && r.facet.find( pat ) != std::string::npos ) || ( pat == "gating" && gates ) ) ) - { - return true; - } - if( comma == std::string_view::npos ) - { - break; - } - rest = rest.substr( comma + 1 ); - } - return false; - }; +// Fold ONE accepted finding into the ack ledger `j.basis.acks`, then prove the re-score formula agrees with the live one. +void acceptFinding( QdJudged& j, const rw::quality::Regression& r ) +{ + using namespace rw; + // P0.3: the ack IDENTITY is ackKindToken, not the bare kind — a zero-magnitude finding + // (was==now==0: dead-code, api-surface tier A) acks per ORIGIN, so acking the never-gating + // new-symbol row can no longer blank-check the gating contract-change row on the same symbol. + const std::string ackKind = quality::ackKindToken( r ); + quality::AckRecord& rec = j.basis.acks[ quality::ackMapKey( ackKind, r.key ) ]; + // R1 IDENTITY: stamp the finding's SCRUBBED CONTENT ID alongside the key, so this ack can + // still be found after a move git records no rename for. Absent (0) for the two clone kinds — + // their key is a member-SET hash with no single body behind it — and the row is then written + // exactly as it is today. A REFRESH, not a preserve: re-acking a finding re-reads the body, so + // the stored cid always describes the code as accepted, never as it was two edits ago. + const auto cidIt = j.basis.healing.cids.cidByKey.find( r.key ); + const std::uint64_t cid = ( cidIt == j.basis.healing.cids.cidByKey.end() ) ? 0u : cidIt->second; + // P1.4 PROVENANCE: `by` follows the SAME rule the reason does one line down — set from this + // run when this run supplies one, PRESERVED otherwise. A later scope-less re-ack therefore + // refreshes the magnitude without erasing the record of who accepted the row originally, + // which is the only reading under which the foreign-ack sweep means anything. + // REASON CLOBBER FIX (round 2026-08-29): a re-ack that supplies a DIFFERENT reason no longer + // overwrites the row's existing one outright — composeAckReason folds it in as + // " | prior: " (capped at one hop; a no-op when the reason is unchanged), so a + // shared row re-acked by unrelated sessions keeps both justifications instead of the last + // writer silently erasing the one before it. See quality.h's composeAckReason for the rule. + // RE-SCORE PROVENANCE: was/now/facet/path/line are a REFRESH, not a preserve, same posture as + // cid= above — a re-ack re-reads the finding, so the stored triple always describes the row AS + // JUST ACCEPTED, never as it was some earlier run. See AckRecord's doc comment for what each + // one is and why a later run can re-score from them alone. + rec = quality::AckRecord{ ackKind, r.key, std::max( rec.ackNow, r.now ), cid, + j.scope.active() ? j.scope.spec : rec.by, + r.was, r.now, r.facet, r.path, r.line, quality::AckProvenance::Measured, + j.cfg.qualityAckReason.empty() ? rec.reason + : quality::composeAckReason( rec.reason, std::string( j.cfg.qualityAckReason ) ) }; + // SELF-CHECK, not a one-off test: every magnitude-bearing ack proves that the TABLE-DRIVEN + // re-score formula agrees with the LIVE one on the row it just built. NOT a full round trip — + // rescoreAckRecord runs here on the in-memory `rec` directly; it never goes through + // renderAckRecords/readAckRecords, so this does not exercise the ledger's text grammar (order- + // tolerant token parsing, splitAckLocator, the takeAckNamedToken family) at all — that half of + // the contract is what qackconcurrencycheck.sh's grammar arm (2) and byte-identity arm (7) pin + // instead, over the actual file. What THIS catches: rescoreNumericMajor's kMaterialityBars + // lookup (by kind name) silently drifting from the kMaterialityBars row perSymbolKind is handed + // by index (computeDelta; the static_assert beside the table pins the order) — two ways + // to reach the same constants that a future edit could break in only one place. A drift there means the live + // formula (numericRegressionIsMajor, via perSymbolKind) and the re-score formula + // (rescoreNumericMajor) have silently diverged — see quality.h's MaterialityBar table, the one + // place both are meant to agree. ENSURES, not ASSUME: this is this function's OWN postcondition + // on the row it just built, not a fact something else already guarantees. + const std::optional rescored = quality::rescoreAckRecord( rec ); + const bool rescoreAgrees = !rescored.has_value() || *rescored == !r.isMinor; // plain bool, so the promise below is a bare accessor-free read + ENSURES( rescoreAgrees, + "ack provenance re-score (in-memory, not a ledger round trip) must reproduce the just-computed severity" ); +} - // P1 — THE RUBBER-STAMP GUARD (refuseForeignAckSelection owns the rule and the message). - if( const std::optional refused = refuseForeignAckSelection( cfg, scope, outOfScope, deltaRoot, ackSelected ) ) - { - return refused; - } +// An --ack-only that matched NO finding: refused with exit 1, and nothing accepted. +// M1 FOLLOW-UP (round train-18, rv-ack-provenance-backfill.md): this refusal used to discard the backfill unconditionally — +// `backfillCloneAckProvenance` already mutated `acks` in memory, but returning without ever calling writeAckRecords threw +// that healing away, so a rubber-stamp-guarded --ack-only that (correctly) refused to accept anything ALSO silently un-did +// an otherwise-independent repair to the ledger's provenance. Same canonical-bytes rule H10's ackNothingToAccept applies +// when there is nothing to accept at all: a ledger already equal to its own canonical bytes is left untouched (no spurious +// diff); a non-canonical one — including one this run's backfill just healed — is rewritten and the run says so. This +// never accepts a finding and the refusal's exit code is unchanged. +int refuseUnmatchedAckOnly( std::string_view ackOnly, const std::string& acksFile, + const gtl::btree_map& acks, std::size_t findingCount ) +{ + using namespace rw; + const bool nonCanonical = !acks.empty() + && quality::renderAckRecords( acks ) != docparse::detail::readRegularFile( "the quality-acks ledger", acksFile ).value_or( std::string() ); + if( !nonCanonical ) + { + rw::emitTo( stderr, "ripwire: --ack-only={} matched none of the {} finding(s) — nothing written\n", ackOnly, findingCount ); + return 1; + } + // A failed heal is said, not folded into "nothing written" (CodeRabbit on #331): the same "could not write" + // ackNothingToAccept prints for the same failure. writeAckRecords has already DISCLOSEd on its answerRefused sink; the + // exit code is 1 either way. + if( !quality::writeAckRecords( acksFile, acks ) ) + { + rw::emitTo( stderr, "ripwire: --ack-only={} matched none of the {} finding(s) — nothing accepted; could not write {} " + "(it was not in canonical form, and re-serialising it failed)\n", + ackOnly, findingCount, acksFile.c_str() ); + return 1; + } + rw::emitTo( stderr, "ripwire: --ack-only={} matched none of the {} finding(s) — nothing accepted, but {} was not in canonical form " + "(ack provenance backfill / legacy rows) and has been re-serialised\n", + ackOnly, findingCount, acksFile.c_str() ); + return 1; +} - // THE LEGACY-ACK BACKFILL, run on the map this process already holds the write lock over and - // BEFORE this run's own acks are folded in, so a row healed here can still be overwritten by a - // live measurement of the same finding in the loop below — measured always beats reconstructed, - // and ordering is what guarantees it rather than a check. It runs even when this run accepts - // NOTHING: healing the ledger's provenance is the same class of forward repair the identity - // remap already performs on every ack, and H10's ackNothingToAccept re-renders and notices. - // quality::backfillCloneAckProvenance owns the rule, what it refuses to touch, and why. - const quality::AckBackfill backfilled = quality::backfillCloneAckProvenance( acks, basis.cloneIdioms ); - // DISCLOSED, never silent: a reconstructed row is a weaker claim than a measured one, so a reader - // is told how many rows just changed confidence class and how many could not be healed at all. - // The unresolved count is a FLOOR on what is missing, not a total of what is wrong: a member set - // that no longer clones in THIS tree is unanswerable here, not proven gone. - if( backfilled.resolved > 0 || backfilled.refreshed > 0 || backfilled.unverified > 0 || backfilled.unresolved > 0 ) - { - rw::emitTo( stderr, "ripwire: ack provenance backfill — {} clone row(s) reconstructed from the current tree, {} re-derived, {} left UNVERIFIED (their group was not found here — a floor, not proof it is gone), " - "{} left legacy (member set not found cloning here — a floor, not proof it is gone), {} ineligible (no current-tree fact answers their kind), {} already measured (left alone). " - "prov=recon is what the idiom is NOW, as of the last run that could check it — not what was measured when the row was accepted.\n", - backfilled.resolved, backfilled.refreshed, backfilled.unverified, backfilled.unresolved, backfilled.ineligible, backfilled.measured ); - } +// Rewrite the ledger with this run's accepted findings and say what was written. Returns the exit code. +int writeAcceptedAcks( const QdJudged& j, const std::string& acksFile, std::size_t ackWritten, std::size_t ackSkipped ) +{ + using namespace rw; + const std::size_t findingCount = j.basis.regs.size(); + const bool wroteAcks = quality::writeAckRecords( acksFile, j.basis.acks ); + if( !wroteAcks ) + { + rw::emitTo( stderr, "ripwire: could not write {}\n", acksFile.c_str() ); + return 1; + } + if( !j.cfg.qualityAckOnly.empty() ) + { + rw::emitTo( stderr, "ripwire: acknowledged {} of {} finding(s) ({} left UNACKED by --ack-only, {} already acked) → {}\n", + ackWritten, findingCount, ackSkipped, j.ackedCount, acksFile.c_str() ); + } + else + { + rw::emitTo( stderr, "ripwire: acknowledged {} finding(s) ({} already acked) → {}\n", findingCount, j.ackedCount, acksFile.c_str() ); + } + // P1 — the skip is DISCLOSED, never silent: the count of rows this ack deliberately did not + // touch is the whole reason the caller passed a scope, and a quiet success would leave them + // believing the ledger now covers the report they were looking at. + if( j.scope.active() && !j.outOfScope.empty() ) + { + rw::emitTo( stderr, "ripwire: {} finding(s) OUT OF SCOPE for --scope={} were left unacked — not yours to accept " + "(they are still in the report, under the out-of-scope element)\n", + j.outOfScope.size(), j.scope.spec.c_str() ); + } + return 0; +} - std::size_t ackWritten = 0, ackSkipped = 0; - for( const quality::Regression& r : regs ) - { - if( !ackSelected( r, /*inScope=*/true ) ) { ++ackSkipped; continue; } - ++ackWritten; - // P0.3: the ack IDENTITY is ackKindToken, not the bare kind — a zero-magnitude finding - // (was==now==0: dead-code, api-surface tier A) acks per ORIGIN, so acking the never-gating - // new-symbol row can no longer blank-check the gating contract-change row on the same symbol. - const std::string ackKind = quality::ackKindToken( r ); - quality::AckRecord& rec = acks[ quality::ackMapKey( ackKind, r.key ) ]; - // R1 IDENTITY: stamp the finding's SCRUBBED CONTENT ID alongside the key, so this ack can - // still be found after a move git records no rename for. Absent (0) for the two clone kinds — - // their key is a member-SET hash with no single body behind it — and the row is then written - // exactly as it is today. A REFRESH, not a preserve: re-acking a finding re-reads the body, so - // the stored cid always describes the code as accepted, never as it was two edits ago. - const auto cidIt = basis.healing.cids.cidByKey.find( r.key ); - const std::uint64_t cid = ( cidIt == basis.healing.cids.cidByKey.end() ) ? 0u : cidIt->second; - // P1.4 PROVENANCE: `by` follows the SAME rule the reason does one line down — set from this - // run when this run supplies one, PRESERVED otherwise. A later scope-less re-ack therefore - // refreshes the magnitude without erasing the record of who accepted the row originally, - // which is the only reading under which the foreign-ack sweep means anything. - // REASON CLOBBER FIX (round 2026-08-29): a re-ack that supplies a DIFFERENT reason no longer - // overwrites the row's existing one outright — composeAckReason folds it in as - // " | prior: " (capped at one hop; a no-op when the reason is unchanged), so a - // shared row re-acked by unrelated sessions keeps both justifications instead of the last - // writer silently erasing the one before it. See quality.h's composeAckReason for the rule. - // RE-SCORE PROVENANCE: was/now/facet/path/line are a REFRESH, not a preserve, same posture as - // cid= above — a re-ack re-reads the finding, so the stored triple always describes the row AS - // JUST ACCEPTED, never as it was some earlier run. See AckRecord's doc comment for what each - // one is and why a later run can re-score from them alone. - rec = quality::AckRecord{ ackKind, r.key, std::max( rec.ackNow, r.now ), cid, - scope.active() ? scope.spec : rec.by, - r.was, r.now, r.facet, r.path, r.line, quality::AckProvenance::Measured, - cfg.qualityAckReason.empty() ? rec.reason - : quality::composeAckReason( rec.reason, std::string( cfg.qualityAckReason ) ) }; - // SELF-CHECK, not a one-off test: every magnitude-bearing ack proves that the TABLE-DRIVEN - // re-score formula agrees with the LIVE one on the row it just built. NOT a full round trip — - // rescoreAckRecord runs here on the in-memory `rec` directly; it never goes through - // renderAckRecords/readAckRecords, so this does not exercise the ledger's text grammar (order- - // tolerant token parsing, splitAckLocator, the takeAckNamedToken family) at all — that half of - // the contract is what qackconcurrencycheck.sh's grammar arm (2) and byte-identity arm (7) pin - // instead, over the actual file. What THIS catches: rescoreNumericMajor's kMaterialityBars - // lookup (by kind name) silently drifting from the kMaterialityBars row perSymbolKind is handed - // by index (computeDelta, above; the static_assert beside the table pins the order) — two ways - // to reach the same constants that a future edit could break in only one place. A drift there means the live - // formula (numericRegressionIsMajor, via perSymbolKind) and the re-score formula - // (rescoreNumericMajor) have silently diverged — see quality.h's MaterialityBar table, the one - // place both are meant to agree. ENSURES, not ASSUME: this is this function's OWN postcondition - // on the row it just built, not a fact something else already guarantees. - const std::optional rescored = quality::rescoreAckRecord( rec ); - const bool rescoreAgrees = !rescored.has_value() || *rescored == !r.isMinor; // plain bool, so the promise below is a bare accessor-free read - ENSURES( rescoreAgrees, - "ack provenance re-score (in-memory, not a ledger round trip) must reproduce the just-computed severity" ); - } - if( ackWritten == 0 && !cfg.qualityAckOnly.empty() ) - { - // M1 FOLLOW-UP (round train-18, rv-ack-provenance-backfill.md): this refusal used to discard - // the backfill above unconditionally — `backfillCloneAckProvenance` already mutated `acks` in - // memory, but returning here without ever calling writeAckRecords threw that healing away, - // so a rubber-stamp-guarded --ack-only that (correctly) refused to accept anything ALSO - // silently un-did an otherwise-independent repair to the ledger's provenance. Same - // canonical-bytes rule H10's ackNothingToAccept applies when there is nothing to accept at - // all: a ledger already equal to its own canonical bytes is left untouched (no spurious - // diff); a non-canonical one — including one this run's backfill just healed — is rewritten - // and the run says so. This never accepts a finding and the refusal's exit code is unchanged. - const bool nonCanonical = !acks.empty() - && quality::renderAckRecords( acks ) != docparse::detail::readRegularFile( "the quality-acks ledger", acksFile ).value_or( std::string() ); - if( nonCanonical ) - { - // A failed heal is said, not folded into "nothing written" (CodeRabbit on #331): the same - // "could not write" ackNothingToAccept prints for the same failure. writeAckRecords has already - // DISCLOSEd on its answerRefused sink; the exit code is 1 either way. - if( !quality::writeAckRecords( acksFile, acks ) ) - { - rw::emitTo( stderr, "ripwire: --ack-only={} matched none of the {} finding(s) — nothing accepted; could not write {} " - "(it was not in canonical form, and re-serialising it failed)\n", - std::string_view( cfg.qualityAckOnly.data(), cfg.qualityAckOnly.size() ), regs.size(), acksFile.c_str() ); - return 1; - } - rw::emitTo( stderr, "ripwire: --ack-only={} matched none of the {} finding(s) — nothing accepted, but {} was not in canonical form " - "(ack provenance backfill / legacy rows) and has been re-serialised\n", - std::string_view( cfg.qualityAckOnly.data(), cfg.qualityAckOnly.size() ), regs.size(), acksFile.c_str() ); - return 1; - } - rw::emitTo( stderr, "ripwire: --ack-only={} matched none of the {} finding(s) — nothing written\n", std::string_view( cfg.qualityAckOnly.data(), cfg.qualityAckOnly.size() ), regs.size() ); - return 1; - } - // H10: nothing to accept — leave a canonical ledger alone, heal a non-canonical one (ackNothingToAccept) - if( regs.empty() ) - { - return ackNothingToAccept( acksFile, acks, scope, outOfScope.size() ); - } - const bool wroteAcks = quality::writeAckRecords( acksFile, acks ); - if( wroteAcks && !cfg.qualityAckOnly.empty() ) - { - rw::emitTo( stderr, "ripwire: acknowledged {} of {} finding(s) ({} left UNACKED by --ack-only, {} already acked) → {}\n", - ackWritten, regs.size(), ackSkipped, ackedCount, acksFile.c_str() ); - } - else if( wroteAcks ) - { - rw::emitTo( stderr, "ripwire: acknowledged {} finding(s) ({} already acked) → {}\n", - regs.size(), ackedCount, acksFile.c_str() ); - } - else - { - rw::emitTo( stderr, "ripwire: could not write {}\n", acksFile.c_str() ); - } - // P1 — the skip is DISCLOSED, never silent: the count of rows this ack deliberately did not - // touch is the whole reason the caller passed a scope, and a quiet success would leave them - // believing the ledger now covers the report they were looking at. - if( wroteAcks && scope.active() && !outOfScope.empty() ) - { - rw::emitTo( stderr, "ripwire: {} finding(s) OUT OF SCOPE for --scope={} were left unacked — not yours to accept " - "(they are still in the report, under the out-of-scope element)\n", - outOfScope.size(), scope.spec.c_str() ); - } - return wroteAcks ? 0 : 1; - } +// WRITE ACKS — the --quality-ack arm: fold the VISIBLE findings --ack-only selects into the ledger instead of printing the +// report. Returns the exit code. +int runQualityAckWrite( QdJudged& j, const std::string& acksFile ) +{ + using namespace rw; + const std::string_view ackOnly = j.cfg.qualityAckOnly; + const auto selected = [ & ]( const quality::Regression& r, bool inScope ) { return ackOnlySelects( ackOnly, r, inScope ); }; - // L2 — stale-ack disclosure (rationale: quality.h's computeStaleAcks). Checked against the CURRENT - // tree, not the baseline above, so it costs one more computeSnapshot; skipped when the ledger is - // empty. Reported, never gated — the exit code below reads `regs` alone. - // R-I: "the CURRENT tree" is the JUDGED tree, which in the ref-pair form is tree B — checking the - // ledger against the working tree there would report acks as stale because of edits that have nothing - // to do with the comparison being made. - // qd-memory-degrade: refPairStaleAcks owns the two range-form departures (a changed-files answer judges none; a - // kind selection judges its own kinds' acks only). - const std::vector staleAcks = acks.empty() ? std::vector{} - : refPair ? refPairStaleAcks( acks, refs ) - : quality::computeStaleAcks( acks, quality::computeSnapshot( ing, g, cfg.rootPath, nullptr, {}, &basis.passes ) ); - if( std::getenv( "RIPWIRE_STATS" ) ) // QD-ENVOY-TIME cost bound: Type-3 passes this call ran (test/qdtype3oncecheck.sh) - { - rw::emitTo( stderr, "ripwire: quality-passes type3_runs={} type3_pairs={}\n", gType3PassRuns.load( std::memory_order_relaxed ), - gType3PassPairs.load( std::memory_order_relaxed ) ); - } + // P1 — THE RUBBER-STAMP GUARD (refuseForeignAckSelection owns the rule and the message). + if( const std::optional refused = refuseForeignAckSelection( j.cfg, j.scope, j.outOfScope, j.basis.deltaRoot, selected ) ) + { + return *refused; + } - // P1.4 — the family now carries THREE whys, and the third is counted SEPARATELY: stale= means - // "this ack no longer applies", and a foreign ack applies fine — it is the SESSION that was wrong, - // not the target. Merging the rows into one list keeps the two emitters from growing a second loop - // each; keeping the COUNTS apart keeps stale= meaning what it has always meant. - std::vector saRows = staleAcks; - saRows.insert( saRows.end(), foreignAcks.begin(), foreignAcks.end() ); - // M21(a): name the rows the tree can still name, against the SAME tree computeStaleAcks judged - // (tree B in the ref-pair form) — naming a stale ack after the working tree would print an identity - // the verdict was never computed from. Costs one walk over ing.symbols, and only when there are rows. - quality::stampStaleAckIdentity( saRows, refPair ? refs.target().ing : ing, - refPair ? std::string_view( refs.target().root ) : std::string_view( cfg.rootPath ) ); - - // r26 ORIGIN SPLIT — three counts over the VISIBLE (post-ack) findings, one pass: - // minorCount — the materiality tier (unchanged axis). - // newSymbolCount — findings that exist only because the code is NEW (quality.h's origin axis). - // gatingCount — the EXIT PREDICATE (quality::rowGates): major AND preexisting-worse, or a defect-shape - // format-arity row of any origin. Emitted as gating= so the header alone tells you - // the exit code (it used to be "regressions > minor"). - // preexisting-worse = regressions − new-symbol by construction (the axis is a partition), so the two - // header counters always sum to regressions= — an invariant the gate asserts. - std::size_t minorCount = 0, newSymbolCount = 0, gatingCount = 0; - for( const quality::Regression& r : regs ) - { - if( r.isMinor ) - { - ++minorCount; - } - if( r.isNewSymbol ) - { - ++newSymbolCount; - } - if( quality::rowGates( r ) ) - { - ++gatingCount; - } - } - const std::size_t preexistingCount = regs.size() - newSymbolCount; - // H11 — the absorbed-debt stamp on the honored sidecar, or 0. Read ONLY when the sidecar is the floor - // in force: on the git-HEAD and ref-pair floors there is no pin whose contents could have absorbed - // anything, and printing a 0 there would define an attribute about a file this run did not use. - const std::size_t baselineAbsorbed = ( baseSel.marker == std::string_view( "sidecar" ) ) - ? quality::readBaselineAbsorbed( baselineFile ) : 0; - const std::string baselineAbsorbedAttr = baselineAbsorbed == 0 ? std::string() - : " baseline_absorbed=\"" + std::to_string( baselineAbsorbed ) + "\""; - - // R1 IDENTITY — the disclosure, built ONCE for both emitters (quality::identityDisclosure). An ack - // that follows a rename is a claim about identity, and a claim is only honest if the reader can see - // what it rested on; building the XML and JSON halves in one place is what keeps the two surfaces - // from disclosing different things about the same run. - const auto [ identityAttrs, identityJson ] = quality::identityDisclosure( basis.healing ); - // hwh-fix4 (N1): the history a gating kind could not read, one builder for every emitter (absent when all was read) - const auto [ historyAttrs, historyJson ] = quality::historyUnreadDisclosure( basis.historyUnread ); - if( gatingCount == 0 && basis.historyUnread.any() ) - { - rw::emitTo( stderr, "ripwire: --quality-delta: not a clean pass - git history a gating kind needs could not be read ({}; a partial clone " - "does not download it), so a gating row may be missing: exit 6\n", historyAttrs.substr( 1 ).c_str() ); - } + // THE LEGACY-ACK BACKFILL, run on the map this process already holds the write lock over and + // BEFORE this run's own acks are folded in, so a row healed here can still be overwritten by a + // live measurement of the same finding in the loop below — measured always beats reconstructed, + // and ordering is what guarantees it rather than a check. It runs even when this run accepts + // NOTHING: healing the ledger's provenance is the same class of forward repair the identity + // remap already performs on every ack, and H10's ackNothingToAccept re-renders and notices. + // quality::backfillCloneAckProvenance owns the rule, what it refuses to touch, and why. + discloseAckBackfill( quality::backfillCloneAckProvenance( j.basis.acks, j.basis.cloneIdioms ) ); - // P1/P1.4 — the scope disclosure, built once for both emitters (quality::scopeDisclosure). - const auto [ scopeAttrs, scopeJson ] = quality::scopeDisclosure( scope, outOfScope.size(), scopedOutGating, foreignAcks.size(), diffFileCount ); - - // F-13 — the .ripwire_config disclosure, built once for both emitters (see the header comment on - // registerMacroConfigWarningAttr just above runQualityViews for why the stderr wording lives there). - // #387: the inert-name test reads the JUDGED tree's index, which in the ref-pair form is tree B — the working tree - // is not indexed there at all (runQualityDeltaRangeBeforeIngest). - // qd-memory-degrade: not over a changed-files index, which cannot tell an inert name from one the tree defines (also_skipped=) - const rw::quality::RegisterMacroConfigDiagnostics configDiag = refs.degraded ? rw::quality::RegisterMacroConfigDiagnostics{} - : rw::quality::diagnoseRegisterMacroConfig( judged, root ); - const std::string configWarnAttr = registerMacroConfigWarningAttr( configDiag ); - // qd-memory-degrade: the kinds this answer did not run, why, and the replay — plus the peak, read once now that the - // comparison is done (kindsDisclosure). Their stderr lines come first: an answer that is partial, or that ran past - // the limit, says so on the channel a human reads before anything else. - const KindsDisclosure kd = kindsDisclosure( cfg, refs, basis, refPair ); - emitMemoryLines( kd, refs ); - const bool deadRan = !refPair || quality::kindSelected( refs.kinds, "dead-code" ); // dead-code's side counts exist only when it ran - - // P2.5 — one stderr line NAMING the gating finding, in --token-budget's style ("ripwire: --token-budget - // exceeded: est_tokens=… > budget=…"). stdout is the machine artifact and a caller that only checks - // `$?` gets a number with no subject; this puts the WHICH on the channel a human reads, without - // touching the XML contract. Names the first gating row in the already-sorted list (deterministic). - // - // §A4 (minor): emitted BEFORE the format fork, not after the XML tail — under --json the fork returned - // first, so exactly the caller most likely to be a script reading `$?` got the bare exit=2 with no - // subject. The line is about the EXIT CODE, which both formats share, so it belongs to neither. - emitQdGatingLine( regs, gatingCount, deltaRoot ); - - // L2: --json — same regressions, keys mirror the XML attr names (kind/sym/members/tokens/was/now/ - // sev/churn/surface). jsonUnsupportedVerb already refused --quality-baseline/--quality-ack, so - // reaching here with cfg.json means the plain --quality-delta report. - if( cfg.json ) + std::size_t ackWritten = 0, ackSkipped = 0; + for( const quality::Regression& r : j.basis.regs ) + { + if( !selected( r, /*inScope=*/true ) ) { - const char* baseMarkerJ = baseSel.marker; // R3: the one spelling table lives in quality::selectBaseline — the XML/JSON twins cannot drift apart - // The JSON sibling of the XML at= anchor — "at":null (never a fake sha) on a non-git root, and - // null in the ref-pair form too: the list was not computed "at" any working-tree state, and the - // two refs below ARE its anchor. - const std::string atValJ = refPair ? std::string{} : gitstamp::stampAt( root ); - const std::string atJsonJ = atValJ.empty() ? std::string( "null" ) : ( "\"" + atValJ + "\"" ); - // R-I: the same two shas + the same unmeasurable-kind disclosure the XML root carries, spelled in - // JSON. Empty for the bare form, so that object stays byte-identical to before. - // F-13: config-warnings is the JSON sibling of the XML config-warnings= attribute — omitted - // (never 0) when .ripwire_config carried nothing to disclose, same "absent means never happened, - // 0 means checked and clean" rule scopeJson/identityJson already follow. - const std::string configWarnJson = configDiag.total() == 0 ? std::string() - : ",\"config-warnings\":" + std::to_string( configDiag.total() ); - // H11: the JSON twin of baseline_absorbed=, under the same absent-means-none rule as the XML half. - const std::string absorbedJson = baselineAbsorbed == 0 ? std::string() - : ",\"baseline_absorbed\":" + std::to_string( baselineAbsorbed ); - // #228: the JSON twin of head_basis=, under the same absent-means-the-ordinary-archived-tree rule. - const std::string headBasisJson = ( basis.headBasis == nullptr ? std::string() - : std::string( ",\"head_basis\":\"" ) + basis.headBasis + "\"" ) - + ( basis.declinedCallExcluded == 0 ? std::string() // the XML twin's declined-call-excluded=, absent at zero - : ",\"declined-call-excluded\":" + std::to_string( basis.declinedCallExcluded ) ) - + rw::countFieldOrEmpty( "value-ref-excluded", basis.valueRefExcluded, /*json=*/true ); - // qd-memory-degrade: stale and register-macro-excluded are absent (never 0) when their pass did not run - const std::string staleJ = refs.degraded ? std::string() : ",\"stale\":" + std::to_string( staleAcks.size() ); - const std::string rmeJ = deadRan ? ",\"register-macro-excluded\":" + std::to_string( basis.registerMacroExcluded ) : std::string(); - rw::emitTo( stdout, "{{\"baseline\":\"{}\",\"regressions\":{},\"minor\":{},\"acked\":{}{}," - "\"preexisting-worse\":{},\"new-symbol\":{},\"gating\":{}{},\"api-new-surface\":{},\"at\":{}{}{}{}{}{}{}{},\"r\":[", - jsonStr( baseMarkerJ ).c_str(), regs.size(), minorCount, ackedCount, staleJ, - preexistingCount, newSymbolCount, gatingCount, rmeJ, basis.apiNewSurface, atJsonJ.c_str(), refs.jsonAttrs.c_str(), - identityJson.c_str(), scopeJson.c_str(), configWarnJson.c_str(), absorbedJson.c_str(), headBasisJson.c_str(), kd.json + historyJson + quality::ratchetAttrsJson( basis.extras ) ); - // P1: one row emitter, called for both halves of the scope partition — the disclosed rows carry - // the identical key set, so nothing about a row changes by being someone else's. `gatingAllowed` - // is the ONE difference: an out-of-scope row is not what the exit code fires on, so claiming - // gating on it would contradict the exit code in the same document. - const auto emitJsonRow = [ & ]( const quality::Regression& r, bool gatingAllowed ) - { - rw::emitTo( stdout, "{{\"kind\":\"{}\"", jsonStr( r.kind ).c_str() ); - if( r.kind == "duplication" ) - { - rw::emitTo( stdout, ",\"members\":\"{}\",\"tokens\":{}", jsonStr( quality::displaySym( r.sym, deltaRoot ) ).c_str(), r.now ); - } - else - { - rw::emitTo( stdout, ",\"sym\":\"{}\"", jsonStr( quality::displaySym( r.sym, deltaRoot ) ).c_str() ); - if( !( r.kind == "dead-code" ) && !( r.kind == "api-surface" && r.was == r.now ) ) - { - rw::emitTo( stdout, ",\"was\":{},\"now\":{}", quality::rowValueText( r, r.was ), quality::rowValueText( r, r.now ) ); - } - } - if( !r.path.empty() ) - { - rw::emitTo( stdout, ",\"p\":\"{}:{}\"", jsonStr( r.path ).c_str(), r.line ); // P2.5 locator - } - if( gatingAllowed && quality::rowGates( r ) ) - { - rw::emitRaw( stdout, ",\"gating\":true" ); // P2.5 — the exit predicate, stated per row - } - if( r.isMinor ) - { - rw::emitRaw( stdout, ",\"sev\":\"minor\"" ); - } - if( !r.facet.empty() ) - { - const char* facetName = quality::facetAttrName( r.kind ); // ONE kind→name table (quality.h) - if( facetName ) - { - rw::emitTo( stdout, ",\"{}\":\"{}\"", facetName, jsonStr( r.facet ).c_str() ); - } - } - if( const char* origin = quality::originValue( r ) ) - { - rw::emitTo( stdout, ",\"origin\":\"{}\"", origin ); // absent = preexisting-worse (mirrors the XML) - } - if( r.ceiling != 0 ) - { - rw::emitTo( stdout, ",\"ceiling\":{}", r.ceiling ); // QD-ENTRY-CEILING (mirrors the XML) - } - rw::emitRaw( stdout, presentJsonMember( "call", r.call ).c_str() ); // QD-UNCHECKED-STATUS (mirrors the XML) - std::fputs( quality::tangleRowAttrs( r, /*json=*/true, []( std::string_view s ) { return jsonStr( s ); } ).c_str(), stdout ); // QD-TANGLE (mirrors the XML) - rw::emitRaw( stdout, "}" ); - }; - bool firstR = true; - for( const quality::Regression& r : regs ) - { - if( !firstR ) - { - rw::emitRaw( stdout, "," ); - } - firstR = false; - emitJsonRow( r, /*gatingAllowed=*/true ); - } - rw::emitRaw( stdout, "]," ); - if( scope.active() ) - { - // The JSON sibling of the XML out-of-scope element: a SEPARATE array, never a flag on a row - // in "r", so a consumer that reads "r" and checks "gating" cannot accidentally count someone - // else's debt as this run's. Emitted (possibly empty) whenever a scope was given, so its - // absence means "no scope", never "no disclosed rows". - rw::emitRaw( stdout, "\"oos\":[" ); - bool firstO = true; - for( const quality::Regression& r : outOfScope ) - { - if( !firstO ) - { - rw::emitRaw( stdout, "," ); - } - firstO = false; - emitJsonRow( r, /*gatingAllowed=*/false ); - } - rw::emitRaw( stdout, "]," ); - } - std::fputs( quality::staleAcksJsonArray( saRows ).c_str(), stdout ); // L2 — "sa":[...], same taxonomy as the XML sa= rows below - std::fputs( quality::improvedJson( basis.extras.improved, deltaRoot ).c_str(), stdout ); // QD-CREDIT-ROW (absent when none) - rw::emitRaw( stdout, "}" ); - return qualityDeltaExit( gatingCount, refs.degraded || basis.historyUnread.any() ); + ++ackSkipped; + continue; } + ++ackWritten; + acceptFinding( j, r ); + } + if( ackWritten == 0 && !ackOnly.empty() ) + { + return refuseUnmatchedAckOnly( ackOnly, acksFile, j.basis.acks, j.basis.regs.size() ); + } + // H10: nothing to accept — leave a canonical ledger alone, heal a non-canonical one (ackNothingToAccept) + if( j.basis.regs.empty() ) + { + return ackNothingToAccept( acksFile, j.basis.acks, j.scope, j.outOfScope.size() ); + } + return writeAcceptedAcks( j, acksFile, ackWritten, ackSkipped ); +} - std::vector esc; - const auto ex = [ & ]( std::string_view s ) -> std::string { return std::string( escapeXml( s, esc ) ); }; - // §B7.1 (CA4) — the heading used to open "only what changed for the WORSE vs - // .ripwire_quality_baseline", which is FALSE in every state but one: three of the five floors this - // verb can use are not that file, and in one of them the file was judged stale and DELETED from the - // user's tree during this very run. The floor actually used is named by baseline= on the element - // below, so the heading points at that attribute instead of asserting a floor. - // - // 2026-09-02 (lane B): the marker states are still defined on the first screen — the only place a - // reader meets them — but ONE state per run, the one in force, rather than all five on every call. - // emitQualityDeltaLegend above holds the section table and the reasoning; it is passed the same - // values the root element below prints, so "the legend defines what the header emits" is read off - // one set of values rather than restated as a second condition that could drift from it. - // idea #11 — THE CLEAN-TREE PAYLOAD. A regression-free answer collapses its stale-ack rows to counts (stale= and - // stale_by_kind=), and stale_next= is the call that prints them; on a tree that IS its HEAD (head_basis="identity": - // the floor is this tree's own snapshot) with nothing else to disclose, the verdict is the whole answer. Foreign- - // scope rows are never collapsed: they are about findings suppressed RIGHT NOW. --show-stale restores today's - // document byte for byte, so every collapsed row and attribute is one flag away (PROCESS rule 5). - const bool collapseStale = regs.empty() && outOfScope.empty() && !cfg.showStale && !staleAcks.empty(); - std::string staleCollapseAttrs; - if( collapseStale ) - { - const std::string kinds = quality::staleByKindValue( staleAcks ); // shared with the MCP twin (lane lean2b) - std::string replay = cfg.qualityDeltaRange.empty() ? std::string( "--quality-delta" ) : rw::nextFlag( "--quality-delta=", cfg.qualityDeltaRange ); - if( scope.active() ) - { - replay += " " + rw::nextFlag( "--scope=", cfg.qualityScope ); - } - staleCollapseAttrs = " stale_by_kind=\"" + ex( kinds ) + "\"" + rw::nextAttrXml( replay + " --show-stale", "stale_next" ); - } - const bool verdictOnly = collapseStale && !refPair && basis.headBasis != nullptr && std::string_view( basis.headBasis ) == "identity" - && !scope.active() && foreignAcks.empty() && ackedCount == 0 && configDiag.total() == 0 && baselineAbsorbed == 0 - && basis.apiNewSurface == 0 && baseSel.sidecarBadLines == 0 && basis.acksBadLines == 0; - // P1: ONE row emitter for both halves of the scope partition — a disclosed row carries the identical - // attribute set, because nothing about a finding changes by belonging to someone else. `gatingAllowed` - // is the one difference: an out-of-scope row is not what the exit code fires on, and a gating - // attribute on it would contradict the header's own gating counter inside the same document. - const auto emitRow = [ & ]( std::FILE* out, const quality::Regression& r, bool gatingAllowed ) - { - // duplication carries a member LIST (members=) + token count; the per-symbol was/now kinds - // (complexity/verbosity/nesting/params) carry was/now; api-surface + dead-code are sym-only. - // sev="minor" marks a below-materiality delta (never gates); absent = major. - const char* sev = r.isMinor ? " sev=\"minor\"" : ""; - // B10.2 — the optional classification facet: attribute NAME is chosen by kind (churn= - // short-horizon-churn's self/ambient split; surface= api-surface's new-symbol/contract-change - // tier; idiom= the duplication kind's recognized clone-body shape); r.facet carries only the - // VALUE, and quality::facetAttrName is the ONE table that maps kind → attribute name for all - // three emitters (this one, the --json twin above, and the MCP one). - std::string facetAttr; - if( !r.facet.empty() ) - { - const char* facetName = quality::facetAttrName( r.kind ); - if( facetName ) - { - facetAttr = std::string( " " ) + facetName + "=\"" + ex( r.facet ) + "\""; // escaped: a ratchet facet is a tag name - } - } - // r26 — the ORIGIN axis, emitted LAST so the existing attribute order is untouched. Present only - // on new-symbol rows (absent = preexisting-worse), the same "mark the exception" convention sev= - // uses. api-surface's own surface="new-symbol" facet is the same fact narrowed to that kind; it - // stays for shape compatibility, and origin= is what the exit gate reads. - const char* origin = !r.isNewSymbol ? "" : r.isMoved ? " origin=\"moved\"" : " origin=\"new-symbol\""; // quality::originValue - // P2.5 — the two attributes that make a row ACTIONABLE, appended last so every pre-r27 attribute - // keeps its position: - // p="path:line" — sym= is a canonical id whose display tail is often a bare one-letter local - // (`sym="cc"`), i.e. ungreppable. Omitted, never faked, when no locator was resolvable. - // gating="1" — marks exactly the rows the header's gating= counts and the exit code fires on. - // Until now a gating row was identifiable ONLY by the ABSENCE of sev="minor" (and of - // origin="new-symbol") — absence-as-signal is the least machine-friendly encoding available. - std::string locAttr; - if( !r.path.empty() ) - { - locAttr = " p=\"" + ex( r.path ) + ":" + std::to_string( r.line ) + "\""; - } - const char* gatingAttr = ( gatingAllowed && quality::rowGates( r ) ) ? " gating=\"1\"" : ""; - // QD-ENTRY-CEILING: the ceiling a NEW function reached, beside the gating= it causes (present-only) - const std::string ceilingAttr = r.ceiling != 0 ? " ceiling=\"" + std::to_string( r.ceiling ) + "\"" : std::string(); - // QD-UNCHECKED-STATUS: the call whose status a defect-shape unchecked-status row drops (present-only) - const std::string callAttr = presentXmlAttr( "call", r.call, ex ); - // P8 (L7): the threshold beside the number it judges — bar= on the four numeric kinds (quality.h's - // kCcxBar/kLocBar/kNestBar/kParamBar), so was=/now= read without the legend. - const char* barAttr = qdBarAttrOf( r.kind ); - const std::string tangleAttrs = quality::tangleRowAttrs( r, /*json=*/false, ex ); // QD-TANGLE: why= / fix= / locals= - // P3 (L7, nextverb.h): a GATING row hands the agent the body to fix — --expand=FILE:NAME (the file-qualified - // selector, so a same-named symbol elsewhere cannot answer). The name is the sym key's last :: segment; - // duplication rows name a SET (members=) and carry no single body to open, nor does a FILE-anchored - // defect-shape row (top-level code: sym= is the path, and --expand=FILE:FILE matches no symbol). - std::string nextAttr; - if( *gatingAttr && !r.path.empty() && r.kind != "duplication" && !( r.kind == "defect-shape" && r.sym == r.path ) ) - { - const std::size_t sep = r.sym.rfind( "::" ); - const std::string bare = sep == std::string::npos ? r.sym : r.sym.substr( sep + 2 ); - nextAttr = rw::nextAttrXml( rw::nextFlag( "--expand=", r.path + ":" + bare ) ); - } - if( r.kind == "duplication" ) - { - rw::emitTo( out, "", ex( quality::displaySym( r.sym, deltaRoot ) ).c_str(), r.now, sev, facetAttr.c_str(), origin, locAttr.c_str(), gatingAttr, - tangleAttrs ); // QD-IDIOM-ELEMTYPE: why= when the operand path demoted it - } - else if( r.kind == "dead-code" ) - { - rw::emitTo( out, "", r.kind.c_str(), ex( quality::displaySym( r.sym, deltaRoot ) ).c_str(), sev, facetAttr.c_str(), origin, locAttr.c_str(), gatingAttr, nextAttr.c_str() ); - // B10.2e: api-surface now carries two shapes — a brand-new/newly-public symbol (was=now=0, no - // param comparison to show) and a param-count contract-change (was/now = the real counts). Print - // was/now whenever they differ from each other so the contract-change case's was=/now= is visible - // while the new-symbol case's meaningless was="0" now="0" is omitted, matching its old sym-only shape. - } - else if( r.kind == "api-surface" && r.was == r.now ) - { - rw::emitTo( out, "", r.kind.c_str(), ex( quality::displaySym( r.sym, deltaRoot ) ).c_str(), sev, facetAttr.c_str(), origin, locAttr.c_str(), gatingAttr, nextAttr.c_str() ); - } - else - { - rw::emitTo( out, "", r.kind.c_str(), ex( quality::displaySym( r.sym, deltaRoot ) ).c_str(), - quality::rowValueText( r, r.was ), quality::rowValueText( r, r.now ), barAttr, sev, facetAttr.c_str(), origin, locAttr.c_str(), gatingAttr, - ceilingAttr.c_str(), callAttr.c_str(), nextAttr.c_str(), tangleAttrs ); - } - }; - // Fix round 1 (rv-lean-trio item 5, owner ruling 5): a fold ships only when it PAYS (compactlegend.h foldPays: shorter - // by its margin, as written AND as the compact layer delivers it). The whole XML document is one renderer over a FILE*, - // so both candidates are rendered and measured, and the full document wins a fold that does not pay or a failed render - // (fx, dirty tree, one stale ack: 1512 B folded vs 1481 B full). - // `collapse` picks the stale rows' form: true serves only the foreign-scope rows and the stale_by_kind=/stale_next= counts. - // R-I: at= is OMITTED for the ref-pair form (see the root below). Read ONCE: both candidates print the same stamp. - const std::string atAttrs = refPair ? std::string() : gitstamp::atAttr( root ); - const auto emitDocument = [ & ]( std::FILE* out, bool collapse ) - { - const std::vector& served = collapse ? foreignAcks : saRows; - emitQualityDeltaLegend( { baseSel.marker, refPair, identityAttrs, !served.empty(), ackedCount > 0, - basis.registerMacroExcluded > 0, configDiag.total() > 0, regs, outOfScope, - scope.active() || !foreignAcks.empty(), !foreignAcks.empty(), baselineAbsorbed, - basis.headBasis, basis.declinedCallExcluded > 0, basis.valueRefExcluded > 0, collapse, - refs.kinds != quality::kAllKinds, refs.degraded, !refs.memoryStop.empty(), kd.peakOver != 0, - kd.memorySkipped != 0 && refs.selected != quality::kAllKinds, basis.historyUnread.any(), - basis.rustTestExcluded, refs.staleTree, !basis.extras.ratchetRef.empty(), !basis.extras.improved.empty() }, out ); - const char* baseMarker = baseSel.marker; // R3: ditto — one seam decides staleness AND names it - // 2026-09-06: what the sidecar readers skipped, on the root (absent means none) — see kQdBaseHeadUnreadable - std::string sidecarHealthAttrs; - if( baseSel.sidecarBadLines > 0 ) { sidecarHealthAttrs += " baseline_bad_lines=\"" + std::to_string( baseSel.sidecarBadLines ) + "\""; } - if( basis.acksBadLines > 0 ) { sidecarHealthAttrs += " acks_bad_lines=\"" + std::to_string( basis.acksBadLines ) + "\""; } - // #228: present-only, and its absence is the ordinary archived HEAD tree — the floor every git-HEAD - // marker named on its own before this attribute existed. - if( basis.headBasis != nullptr ) { sidecarHealthAttrs += std::string( " head_basis=\"" ) + basis.headBasis + "\""; } - if( basis.declinedCallExcluded > 0 ) { sidecarHealthAttrs += " declined-call-excluded=\"" + std::to_string( basis.declinedCallExcluded ) + "\""; } - sidecarHealthAttrs += rw::countAttrXmlOrEmpty( "value-ref-excluded", basis.valueRefExcluded ); // absent at zero, beside its sibling - // at= anchors this regression list to the commit (+dirty state) it was computed against. - // qd-memory-degrade: stale= and register-macro-excluded= are absent (never 0) when their pass did not run - const std::string staleX = refs.degraded ? std::string() : " stale=\"" + std::to_string( staleAcks.size() ) + "\""; - const std::string rmeX = deadRan ? " register-macro-excluded=\"" + std::to_string( basis.registerMacroExcluded ) + "\"" : std::string(); - rw::emitTo( out, "", - baseMarker, regs.size(), minorCount, ackedCount, staleX, preexistingCount, newSymbolCount, gatingCount, rmeX, basis.apiNewSurface, - // R-I: at= is OMITTED for the ref-pair form rather than stamped with the working tree's - // sha, which would anchor the list to a commit it was not computed from. base_ref= and - // target_ref= are the anchor there, and they carry FULL shas because a wave measurement - // gets quoted into handoffs where a 9-char prefix is one collision from unverifiable. - atAttrs.c_str(), refs.attrs.c_str(), identityAttrs.c_str(), - scopeAttrs.c_str(), configWarnAttr.c_str(), baselineAbsorbedAttr.c_str(), ( sidecarHealthAttrs + ( collapse ? staleCollapseAttrs : std::string() ) + kd.xml + historyAttrs + quality::ratchetAttrsXml( basis.extras, ex ) ).c_str() ); - for( const quality::Regression& r : regs ) - { - emitRow( out, r, /*gatingAllowed=*/true ); - } - std::fputs( quality::improvedXml( basis.extras.improved, deltaRoot, ex ).c_str(), out ); // QD-CREDIT-ROW: never a row, never gating - if( scope.active() ) - { - // P1 — the DISCLOSURE half. Dropping these rows would make a scoped report a quieter lie than - // the unscoped one it replaces: the debt is real, it is in the same tree, and it will be in - // someone's report. So they are printed, in their own element, marked non-gating, with the one - // sentence a reader needs written where they meet it. Emitted even when EMPTY — an absent - // element then means "no scope was given", never "nobody else has anything open". - rw::emitTo( out, "", - outOfScope.size(), scopedOutGating ); - for( const quality::Regression& r : outOfScope ) - { - emitRow( out, r, /*gatingAllowed=*/false ); - } - rw::emitRaw( out, "" ); - } - { // L2 — one row per stale ack (quality::staleAcksXml). M21(a): the escaper is passed in - // because sym= carries a canonical id (corpus text), unlike the closed-vocabulary kind=/why=. - std::vector saEsc; - std::fputs( quality::staleAcksXml( served, [ & ]( std::string_view t ) { return std::string( escapeXml( t, saEsc ) ); } ).c_str(), out ); - } - rw::emitRaw( out, "" ); - }; - // the identity-tree VERDICT (verdictOnly above): the root line alone - const auto emitVerdict = [ & ]( std::FILE* out ) - { - rw::emitTo( out, "" - "", - baseSel.marker, staleAcks.size(), atAttrs, staleCollapseAttrs ); - }; - if( !collapseStale ) - { - emitDocument( stdout, /*collapse=*/false ); - return qualityDeltaExit( gatingCount, refs.degraded || basis.historyUnread.any() ); - } - const Rendered full = renderToString( [ & ]( std::FILE* f ) { emitDocument( f, /*collapse=*/false ); } ); - const Rendered folded = renderToString( [ & ]( std::FILE* f ) { if( verdictOnly ) { emitVerdict( f ); } else { emitDocument( f, /*collapse=*/true ); } } ); - if( !full.ok || !folded.ok ) +// r26 ORIGIN SPLIT — three counts over the VISIBLE (post-ack) findings, one pass: +// minor — the materiality tier (unchanged axis). +// newSymbol — findings that exist only because the code is NEW (quality.h's origin axis). +// gating — the EXIT PREDICATE (quality::rowGates): major AND preexisting-worse, or a defect-shape +// format-arity row of any origin. Emitted as gating= so the header alone tells you +// the exit code (it used to be "regressions > minor"). +// preexisting-worse = regressions − new-symbol by construction (the axis is a partition), so the two +// header counters always sum to regressions= — an invariant the gate asserts. +struct QdCounts +{ + std::size_t minor = 0, newSymbol = 0, gating = 0, preexisting = 0; +}; +QdCounts countQdRows( const std::vector& regs ) +{ + QdCounts c; + for( const rw::quality::Regression& r : regs ) + { + c.minor += r.isMinor ? 1 : 0; + c.newSymbol += r.isNewSymbol ? 1 : 0; + c.gating += rw::quality::rowGates( r ) ? 1 : 0; + } + c.preexisting = regs.size() - c.newSymbol; + return c; +} + +// Everything one --quality-delta answer renders, computed before the format is chosen: the JSON and XML emitters read only +// this (plus the judged comparison it points at), so the two formats cannot disagree about a fact. +struct QdReport +{ + const QdJudged& j; + std::vector staleAcks; + std::vector saRows; // stale + foreign acks: the one / "sa" list + QdCounts counts; + std::size_t baselineAbsorbed = 0; + std::pair identity, history, scope; // (XML attrs, JSON members), built once for both + rw::quality::RegisterMacroConfigDiagnostics configDiag; + std::string configWarnAttr; + KindsDisclosure kd; + bool deadRan = false; // dead-code's side counts exist only when it ran + + const rw::quality::BaselineSelection& baseSel() const noexcept { return j.basis.baseSel; } + const std::vector& regs() const noexcept { return j.basis.regs; } + const std::string& deltaRoot() const noexcept { return j.basis.deltaRoot; } + // The exit code every rendering returns (qualityDeltaExit): r26 — only a PREEXISTING-worse AND major regression gates (== gating=). + int exitCode() const noexcept { return qualityDeltaExit( counts.gating, j.refs.degraded || j.basis.historyUnread.any() ); } +}; + +// REPORT (compute half) — the stale-ack verdicts, the counts and every root disclosure, in the order their stderr lines +// have always printed. +QdReport qdReportOf( const QdJudged& j, const std::string& baselineFile ) +{ + using namespace rw; + QdReport rep{ .j = j }; + const gtl::btree_map& acks = j.basis.acks; + // L2 — stale-ack disclosure (rationale: quality.h's computeStaleAcks). Checked against the CURRENT + // tree, not the baseline above, so it costs one more computeSnapshot; skipped when the ledger is + // empty. Reported, never gated — the exit code reads `regs` alone. + // R-I: "the CURRENT tree" is the JUDGED tree, which in the ref-pair form is tree B — checking the + // ledger against the working tree there would report acks as stale because of edits that have nothing + // to do with the comparison being made. + // qd-memory-degrade: refPairStaleAcks owns the two range-form departures (a changed-files answer judges none; a + // kind selection judges its own kinds' acks only). + rep.staleAcks = acks.empty() ? std::vector{} + : j.refPair ? refPairStaleAcks( acks, j.refs ) + : quality::computeStaleAcks( acks, quality::computeSnapshot( j.judged, j.workingGraph, j.cfg.rootPath, nullptr, {}, &j.basis.passes ) ); + if( std::getenv( "RIPWIRE_STATS" ) ) // QD-ENVOY-TIME cost bound: Type-3 passes this call ran (test/qdtype3oncecheck.sh) + { + rw::emitTo( stderr, "ripwire: quality-passes type3_runs={} type3_pairs={}\n", gType3PassRuns.load( std::memory_order_relaxed ), + gType3PassPairs.load( std::memory_order_relaxed ) ); + } + + // P1.4 — the family now carries THREE whys, and the third is counted SEPARATELY: stale= means + // "this ack no longer applies", and a foreign ack applies fine — it is the SESSION that was wrong, + // not the target. Merging the rows into one list keeps the two emitters from growing a second loop + // each; keeping the COUNTS apart keeps stale= meaning what it has always meant. + rep.saRows = rep.staleAcks; + rep.saRows.insert( rep.saRows.end(), j.foreignAcks.begin(), j.foreignAcks.end() ); + // M21(a): name the rows the tree can still name, against the SAME tree computeStaleAcks judged + // (tree B in the ref-pair form) — naming a stale ack after the working tree would print an identity + // the verdict was never computed from. Costs one walk over the judged symbols, and only when there are rows. + quality::stampStaleAckIdentity( rep.saRows, j.judged, j.refPair ? std::string_view( j.refs.target().root ) : std::string_view( j.cfg.rootPath ) ); + + rep.counts = countQdRows( j.basis.regs ); + // H11 — the absorbed-debt stamp on the honored sidecar, or 0. Read ONLY when the sidecar is the floor + // in force: on the git-HEAD and ref-pair floors there is no pin whose contents could have absorbed + // anything, and printing a 0 there would define an attribute about a file this run did not use. + rep.baselineAbsorbed = ( rep.baseSel().marker == std::string_view( "sidecar" ) ) ? quality::readBaselineAbsorbed( baselineFile ) : 0; + + // R1 IDENTITY — the disclosure, built ONCE for both emitters (quality::identityDisclosure). An ack + // that follows a rename is a claim about identity, and a claim is only honest if the reader can see + // what it rested on; building the XML and JSON halves in one place is what keeps the two surfaces + // from disclosing different things about the same run. + rep.identity = quality::identityDisclosure( j.basis.healing ); + // hwh-fix4 (N1): the history a gating kind could not read, one builder for every emitter (absent when all was read) + rep.history = quality::historyUnreadDisclosure( j.basis.historyUnread ); + if( rep.counts.gating == 0 && j.basis.historyUnread.any() ) + { + rw::emitTo( stderr, "ripwire: --quality-delta: not a clean pass - git history a gating kind needs could not be read ({}; a partial clone " + "does not download it), so a gating row may be missing: exit 6\n", rep.history.first.substr( 1 ).c_str() ); + } + + // P1/P1.4 — the scope disclosure, built once for both emitters (quality::scopeDisclosure). + rep.scope = quality::scopeDisclosure( j.scope, j.outOfScope.size(), j.scopedOutGating, j.foreignAcks.size(), j.diffFileCount ); + + // F-13 — the .ripwire_config disclosure, built once for both emitters (see the header comment on + // registerMacroConfigWarningAttr just above runQualityViews for why the stderr wording lives there). + // #387: the inert-name test reads the JUDGED tree's index, which in the ref-pair form is tree B — the working tree + // is not indexed there at all (runQualityDeltaRangeBeforeIngest). + // qd-memory-degrade: not over a changed-files index, which cannot tell an inert name from one the tree defines (also_skipped=) + rep.configDiag = j.refs.degraded ? quality::RegisterMacroConfigDiagnostics{} : quality::diagnoseRegisterMacroConfig( j.judged, j.root ); + rep.configWarnAttr = registerMacroConfigWarningAttr( rep.configDiag ); + // qd-memory-degrade: the kinds this answer did not run, why, and the replay — plus the peak, read once now that the + // comparison is done (kindsDisclosure). Its stderr lines are the caller's to print, first. + rep.kd = kindsDisclosure( j.cfg, j.refs, j.basis, j.refPair ); + rep.deadRan = !j.refPair || quality::kindSelected( j.refs.kinds, "dead-code" ); + return rep; +} + +// ── the ROW MODEL: one --quality-delta row's printed facts, decided once for the XML and JSON emitters ───────────────── +// P1: both formats print the in-scope rows and the disclosed out-of-scope rows with this one model — a disclosed row +// carries the identical attribute set, because nothing about a finding changes by belonging to someone else. `gating` is +// the one difference: an out-of-scope row is not what the exit code fires on, and claiming gating on it would contradict +// the header's own gating counter inside the same document. +struct QdRowModel +{ + // duplication carries a member LIST (members=) + token count; dead-code and an api-surface row whose counts did not + // change are sym-only; every other kind carries was/now. + // B10.2e: api-surface carries two shapes — a brand-new/newly-public symbol (was=now=0, no param comparison to show) + // and a param-count contract-change (was/now = the real counts). was/now print whenever they differ from each other, + // so the contract-change case's was=/now= is visible while the new-symbol case's meaningless was="0" now="0" is + // omitted, matching its old sym-only shape. + enum class Shape : std::uint8_t { Members, SymOnly, WasNow }; + Shape shape = Shape::WasNow; + std::string sym; // quality::displaySym, unescaped: members= for Members, sym= otherwise + bool gating = false; // P2.5: the exit predicate (quality::rowGates), stated per row; never on a disclosed row + // B10.2 — the optional classification facet: its attribute NAME is chosen by kind (quality::facetAttrName, the ONE + // kind→name table for every emitter, MCP included); r.facet carries only the VALUE. nullptr = no facet attribute. + const char* facetName = nullptr; + // r26 — the ORIGIN axis (quality::originValue): present only on new-symbol rows (absent = preexisting-worse), the same + // "mark the exception" convention sev= uses. origin= is what the exit gate reads. + const char* origin = nullptr; +}; +QdRowModel qdRowModel( const rw::quality::Regression& r, bool gatingAllowed, std::string_view deltaRoot ) +{ + using namespace rw; + QdRowModel m; + m.shape = r.kind == "duplication" ? QdRowModel::Shape::Members + : ( r.kind == "dead-code" || ( r.kind == "api-surface" && r.was == r.now ) ) ? QdRowModel::Shape::SymOnly + : QdRowModel::Shape::WasNow; + m.sym = quality::displaySym( r.sym, deltaRoot ); + m.gating = gatingAllowed && quality::rowGates( r ); + m.facetName = r.facet.empty() ? nullptr : quality::facetAttrName( r.kind ); + m.origin = quality::originValue( r ); + return m; +} + +// P3 (L7, nextverb.h): a GATING row hands the agent the body to fix — --expand=FILE:NAME (the file-qualified selector, so +// a same-named symbol elsewhere cannot answer). The name is the sym key's last :: segment; duplication rows name a SET +// (members=) and carry no single body to open, nor does a FILE-anchored defect-shape row (top-level code: sym= is the +// path, and --expand=FILE:FILE matches no symbol). Empty when the row offers no body. +std::string qdExpandNextAttr( const rw::quality::Regression& r, const QdRowModel& m ) +{ + if( !m.gating || r.path.empty() || r.kind == "duplication" || ( r.kind == "defect-shape" && r.sym == r.path ) ) + { + return std::string(); + } + const std::size_t sep = r.sym.rfind( "::" ); + const std::string bare = sep == std::string::npos ? r.sym : r.sym.substr( sep + 2 ); + return rw::nextAttrXml( rw::nextFlag( "--expand=", r.path + ":" + bare ) ); +} + +// One XML row. The attribute order is the contract every gate reads: kind/sym (or members/tokens), was/now with bar=, +// then sev= facet= origin= and the P2.5 pair p= gating= (appended after every pre-r27 attribute), then the per-kind tail. +// `ex` is the document's XML escaper. +template +void emitQdXmlRow( std::FILE* out, const rw::quality::Regression& r, const QdRowModel& m, const Escape& ex ) +{ + using namespace rw; + // sev="minor" marks a below-materiality delta (never gates); absent = major. + std::string common = r.isMinor ? " sev=\"minor\"" : ""; + if( m.facetName != nullptr ) + { + common += std::string( " " ) + m.facetName + "=\"" + ex( r.facet ) + "\""; // escaped: a ratchet facet is a tag name + } + if( m.origin != nullptr ) + { + common += std::string( " origin=\"" ) + m.origin + "\""; + } + // P2.5 — p="path:line": sym= is a canonical id whose display tail is often a bare one-letter local (`sym="cc"`), i.e. + // ungreppable. Omitted, never faked, when no locator was resolvable. gating="1" marks exactly the rows the header's + // gating= counts — until r27 a gating row was identifiable only by the ABSENCE of sev="minor" and origin=. + if( !r.path.empty() ) + { + common += " p=\"" + ex( r.path ) + ":" + std::to_string( r.line ) + "\""; + } + common += m.gating ? " gating=\"1\"" : ""; + switch( m.shape ) + { + case QdRowModel::Shape::Members: + rw::emitTo( out, "", ex( m.sym ), r.now, common, + quality::tangleRowAttrs( r, /*json=*/false, ex ) ); // QD-IDIOM-ELEMTYPE: why= when the operand path demoted it + return; + case QdRowModel::Shape::SymOnly: + rw::emitTo( out, "", r.kind, ex( m.sym ), common, qdExpandNextAttr( r, m ) ); + return; + case QdRowModel::Shape::WasNow: + // P8 (L7): bar= is the threshold beside the number it judges, on the four numeric kinds (quality.h's + // kCcxBar/kLocBar/kNestBar/kParamBar), so was=/now= read without the legend. QD-ENTRY-CEILING: ceiling= is the + // ceiling a NEW function reached, beside the gating= it causes; QD-UNCHECKED-STATUS: call= is the call whose + // status a defect-shape unchecked-status row drops; QD-TANGLE: why= / fix= / locals=. All present-only. + rw::emitTo( out, "", r.kind, ex( m.sym ), + quality::rowValueText( r, r.was ), quality::rowValueText( r, r.now ), qdBarAttrOf( r.kind ), common, + r.ceiling != 0 ? " ceiling=\"" + std::to_string( r.ceiling ) + "\"" : std::string(), presentXmlAttr( "call", r.call, ex ), + qdExpandNextAttr( r, m ), quality::tangleRowAttrs( r, /*json=*/false, ex ) ); + return; + } +} + +// One JSON row object: the keys mirror the XML attribute names, in the order the --json contract has always used. +void emitQdJsonRow( std::FILE* out, const rw::quality::Regression& r, const QdRowModel& m ) +{ + using namespace rw; + rw::emitTo( out, "{{\"kind\":\"{}\"", jsonStr( r.kind ) ); + if( m.shape == QdRowModel::Shape::Members ) + { + rw::emitTo( out, ",\"members\":\"{}\",\"tokens\":{}", jsonStr( m.sym ), r.now ); + } + else + { + rw::emitTo( out, ",\"sym\":\"{}\"", jsonStr( m.sym ) ); + } + if( m.shape == QdRowModel::Shape::WasNow ) + { + rw::emitTo( out, ",\"was\":{},\"now\":{}", quality::rowValueText( r, r.was ), quality::rowValueText( r, r.now ) ); + } + if( !r.path.empty() ) + { + rw::emitTo( out, ",\"p\":\"{}:{}\"", jsonStr( r.path ), r.line ); // P2.5 locator + } + rw::emitRaw( out, m.gating ? ",\"gating\":true" : "" ); // P2.5 — the exit predicate, stated per row + rw::emitRaw( out, r.isMinor ? ",\"sev\":\"minor\"" : "" ); + if( m.facetName != nullptr ) + { + rw::emitTo( out, ",\"{}\":\"{}\"", m.facetName, jsonStr( r.facet ) ); + } + if( m.origin != nullptr ) + { + rw::emitTo( out, ",\"origin\":\"{}\"", m.origin ); // absent = preexisting-worse (mirrors the XML) + } + if( r.ceiling != 0 ) + { + rw::emitTo( out, ",\"ceiling\":{}", r.ceiling ); // QD-ENTRY-CEILING (mirrors the XML) + } + rw::emitRaw( out, presentJsonMember( "call", r.call ).c_str() ); // QD-UNCHECKED-STATUS (mirrors the XML) + std::fputs( quality::tangleRowAttrs( r, /*json=*/true, []( std::string_view s ) { return jsonStr( s ); } ).c_str(), out ); // QD-TANGLE (mirrors the XML) + rw::emitRaw( out, "}" ); +} + +// A comma-separated run of JSON rows (the "r" array's body, or "oos"'s). +void emitQdJsonRows( std::FILE* out, const std::vector& rows, bool gatingAllowed, std::string_view deltaRoot ) +{ + bool first = true; + for( const rw::quality::Regression& r : rows ) + { + rw::emitRaw( out, first ? "" : "," ); + first = false; + emitQdJsonRow( out, r, qdRowModel( r, gatingAllowed, deltaRoot ) ); + } +} + +// REPORT (render half), --json — same regressions, keys mirror the XML attr names (kind/sym/members/tokens/was/now/ +// sev/churn/surface). jsonUnsupportedVerb already refused --quality-baseline/--quality-ack, so reaching here with cfg.json +// means the plain --quality-delta report. Every optional root member follows the XML twin's absent-means-never-happened rule. +void emitQualityDeltaJson( const QdReport& rep ) +{ + using namespace rw; + const QdJudged& j = rep.j; + const DeltaBasis& basis = j.basis; + // The JSON sibling of the XML at= anchor — "at":null (never a fake sha) on a non-git root, and + // null in the ref-pair form too: the list was not computed "at" any working-tree state, and the + // two refs ARE its anchor. + const std::string atVal = j.refPair ? std::string{} : gitstamp::stampAt( j.root ); + const std::string atJson = atVal.empty() ? std::string( "null" ) : ( "\"" + atVal + "\"" ); + // F-13: config-warnings is the JSON sibling of the XML config-warnings= attribute — omitted + // (never 0) when .ripwire_config carried nothing to disclose. + const std::string configWarnJson = rep.configDiag.total() == 0 ? std::string() : ",\"config-warnings\":" + std::to_string( rep.configDiag.total() ); + // H11: the JSON twin of baseline_absorbed=. + const std::string absorbedJson = rep.baselineAbsorbed == 0 ? std::string() : ",\"baseline_absorbed\":" + std::to_string( rep.baselineAbsorbed ); + // #228: the JSON twin of head_basis=, under the same absent-means-the-ordinary-archived-tree rule. + const std::string headBasisJson = ( basis.headBasis == nullptr ? std::string() : std::string( ",\"head_basis\":\"" ) + basis.headBasis + "\"" ) + + ( basis.declinedCallExcluded == 0 ? std::string() // the XML twin's declined-call-excluded=, absent at zero + : ",\"declined-call-excluded\":" + std::to_string( basis.declinedCallExcluded ) ) + + rw::countFieldOrEmpty( "value-ref-excluded", basis.valueRefExcluded, /*json=*/true ); + // qd-memory-degrade: stale and register-macro-excluded are absent (never 0) when their pass did not run + const std::string staleJ = j.refs.degraded ? std::string() : ",\"stale\":" + std::to_string( rep.staleAcks.size() ); + const std::string rmeJ = rep.deadRan ? ",\"register-macro-excluded\":" + std::to_string( basis.registerMacroExcluded ) : std::string(); + // R-I: refs.jsonAttrs carries the same two shas + unmeasurable-kind disclosure the XML root carries (empty for the bare form). + rw::emitTo( stdout, "{{\"baseline\":\"{}\",\"regressions\":{},\"minor\":{},\"acked\":{}{}," + "\"preexisting-worse\":{},\"new-symbol\":{},\"gating\":{}{},\"api-new-surface\":{},\"at\":{}{}{}{}{}{}{}{},\"r\":[", + jsonStr( rep.baseSel().marker ), rep.regs().size(), rep.counts.minor, j.ackedCount, staleJ, + rep.counts.preexisting, rep.counts.newSymbol, rep.counts.gating, rmeJ, basis.apiNewSurface, atJson, j.refs.jsonAttrs, + rep.identity.second, rep.scope.second, configWarnJson, absorbedJson, headBasisJson, + rep.kd.json + rep.history.second + quality::ratchetAttrsJson( basis.extras ) ); + emitQdJsonRows( stdout, rep.regs(), /*gatingAllowed=*/true, rep.deltaRoot() ); + rw::emitRaw( stdout, "]," ); + if( j.scope.active() ) + { + // The JSON sibling of the XML out-of-scope element: a SEPARATE array, never a flag on a row + // in "r", so a consumer that reads "r" and checks "gating" cannot accidentally count someone + // else's debt as this run's. Emitted (possibly empty) whenever a scope was given, so its + // absence means "no scope", never "no disclosed rows". + rw::emitRaw( stdout, "\"oos\":[" ); + emitQdJsonRows( stdout, j.outOfScope, /*gatingAllowed=*/false, rep.deltaRoot() ); + rw::emitRaw( stdout, "]," ); + } + std::fputs( quality::staleAcksJsonArray( rep.saRows ).c_str(), stdout ); // L2 — "sa":[...], same taxonomy as the XML sa= rows + std::fputs( quality::improvedJson( basis.extras.improved, rep.deltaRoot() ).c_str(), stdout ); // QD-CREDIT-ROW (absent when none) + rw::emitRaw( stdout, "}" ); +} + +// 2026-09-06: what the sidecar readers skipped, on the root (absent means none) — see kQdBaseHeadUnreadable — plus the +// #228 head_basis= (present-only: its absence is the ordinary archived HEAD tree) and the dead-code exemption counts. +std::string qdSidecarHealthAttrs( const DeltaBasis& basis ) +{ + std::string out; + if( basis.baseSel.sidecarBadLines > 0 ) { out += " baseline_bad_lines=\"" + std::to_string( basis.baseSel.sidecarBadLines ) + "\""; } + if( basis.acksBadLines > 0 ) { out += " acks_bad_lines=\"" + std::to_string( basis.acksBadLines ) + "\""; } + if( basis.headBasis != nullptr ) { out += std::string( " head_basis=\"" ) + basis.headBasis + "\""; } + if( basis.declinedCallExcluded > 0 ) { out += " declined-call-excluded=\"" + std::to_string( basis.declinedCallExcluded ) + "\""; } + out += rw::countAttrXmlOrEmpty( "value-ref-excluded", basis.valueRefExcluded ); // absent at zero, beside its sibling + return out; +} + +// idea #11 — THE CLEAN-TREE PAYLOAD. A regression-free answer collapses its stale-ack rows to counts (stale= and +// stale_by_kind=), and stale_next= is the call that prints them; on a tree that IS its HEAD (head_basis="identity": the +// floor is this tree's own snapshot) with nothing else to disclose, the verdict is the whole answer. Foreign-scope rows are +// never collapsed: they are about findings suppressed RIGHT NOW. --show-stale restores today's document byte for byte, so +// every collapsed row and attribute is one flag away (PROCESS rule 5). `attrs` is empty when the answer does not collapse. +struct QdStaleCollapse +{ + bool collapse = false; + bool verdictOnly = false; // the identity-tree VERDICT: the root line alone + std::string attrs; // stale_by_kind= + stale_next= +}; +// The identity-tree verdict's precondition: a working-tree answer whose floor is this tree's own snapshot +// (head_basis="identity") with no scope, foreign or accepted ack, config warning, absorbed debt, new public surface or +// unreadable sidecar line to disclose — so the root line alone loses nothing. +bool qdNothingElseToDisclose( const QdReport& rep ) +{ + const QdJudged& j = rep.j; + const DeltaBasis& basis = j.basis; + return !j.refPair && basis.headBasis != nullptr && std::string_view( basis.headBasis ) == "identity" + && !j.scope.active() && j.foreignAcks.empty() && j.ackedCount == 0 && rep.configDiag.total() == 0 && rep.baselineAbsorbed == 0 + && basis.apiNewSurface == 0 && rep.baseSel().sidecarBadLines == 0 && basis.acksBadLines == 0; +} + +template +QdStaleCollapse qdStaleCollapse( const QdReport& rep, const Escape& ex ) +{ + using namespace rw; + const QdJudged& j = rep.j; + QdStaleCollapse c; + c.collapse = rep.regs().empty() && j.outOfScope.empty() && !j.cfg.showStale && !rep.staleAcks.empty(); + if( !c.collapse ) + { + return c; + } + const std::string kinds = quality::staleByKindValue( rep.staleAcks ); // shared with the MCP twin (lane lean2b) + std::string replay = j.cfg.qualityDeltaRange.empty() ? std::string( "--quality-delta" ) : rw::nextFlag( "--quality-delta=", j.cfg.qualityDeltaRange ); + if( j.scope.active() ) + { + replay += " " + rw::nextFlag( "--scope=", j.cfg.qualityScope ); + } + c.attrs = " stale_by_kind=\"" + ex( kinds ) + "\"" + rw::nextAttrXml( replay + " --show-stale", "stale_next" ); + c.verdictOnly = qdNothingElseToDisclose( rep ); + return c; +} + +// The whole XML document over one FILE*: legend, root, rows, improvements, the out-of-scope disclosure and the rows. +// `collapse` picks the stale rows' form: true serves only the foreign-scope rows and the stale_by_kind=/stale_next= counts. +void emitQdXmlDocument( std::FILE* out, const QdReport& rep, const QdStaleCollapse& stale, const std::string& atAttrs, bool collapse ) +{ + using namespace rw; + const QdJudged& j = rep.j; + const DeltaBasis& basis = j.basis; + const RefPairDelta& refs = j.refs; + std::vector esc; + const auto ex = [ & ]( std::string_view s ) -> std::string { return std::string( escapeXml( s, esc ) ); }; + const std::vector& served = collapse ? j.foreignAcks : rep.saRows; + // the legend is passed the same values the root element below prints, so "the legend defines what the header emits" is + // read off one set of values rather than restated as a second condition that could drift from it + emitQualityDeltaLegend( { rep.baseSel().marker, j.refPair, rep.identity.first, !served.empty(), j.ackedCount > 0, + basis.registerMacroExcluded > 0, rep.configDiag.total() > 0, rep.regs(), j.outOfScope, + j.scope.active() || !j.foreignAcks.empty(), !j.foreignAcks.empty(), rep.baselineAbsorbed, + basis.headBasis, basis.declinedCallExcluded > 0, basis.valueRefExcluded > 0, collapse, + refs.kinds != quality::kAllKinds, refs.degraded, !refs.memoryStop.empty(), rep.kd.peakOver != 0, + rep.kd.memorySkipped != 0 && refs.selected != quality::kAllKinds, basis.historyUnread.any(), + basis.rustTestExcluded, refs.staleTree, !basis.extras.ratchetRef.empty(), !basis.extras.improved.empty() }, out ); + // qd-memory-degrade: stale= and register-macro-excluded= are absent (never 0) when their pass did not run + const std::string staleX = refs.degraded ? std::string() : " stale=\"" + std::to_string( rep.staleAcks.size() ) + "\""; + const std::string rmeX = rep.deadRan ? " register-macro-excluded=\"" + std::to_string( basis.registerMacroExcluded ) + "\"" : std::string(); + rw::emitTo( out, "", + rep.baseSel().marker, rep.regs().size(), rep.counts.minor, j.ackedCount, staleX, rep.counts.preexisting, rep.counts.newSymbol, rep.counts.gating, + rmeX, basis.apiNewSurface, + // at= anchors this regression list to the commit (+dirty state) it was computed against. R-I: it is + // OMITTED for the ref-pair form rather than stamped with the working tree's sha, which would anchor the + // list to a commit it was not computed from. base_ref= and target_ref= are the anchor there, and they + // carry FULL shas because a wave measurement gets quoted into handoffs where a 9-char prefix is one + // collision from unverifiable. + atAttrs, refs.attrs, rep.identity.first, rep.scope.first, rep.configWarnAttr, rep.baselineAbsorbed == 0 ? std::string() : " baseline_absorbed=\"" + std::to_string( rep.baselineAbsorbed ) + "\"", + qdSidecarHealthAttrs( basis ) + ( collapse ? stale.attrs : std::string() ) + rep.kd.xml + rep.history.first + quality::ratchetAttrsXml( basis.extras, ex ) ); + for( const quality::Regression& r : rep.regs() ) + { + emitQdXmlRow( out, r, qdRowModel( r, /*gatingAllowed=*/true, rep.deltaRoot() ), ex ); + } + std::fputs( quality::improvedXml( basis.extras.improved, rep.deltaRoot(), ex ).c_str(), out ); // QD-CREDIT-ROW: never a row, never gating + if( j.scope.active() ) + { + // P1 — the DISCLOSURE half. Dropping these rows would make a scoped report a quieter lie than + // the unscoped one it replaces: the debt is real, it is in the same tree, and it will be in + // someone's report. So they are printed, in their own element, marked non-gating, with the one + // sentence a reader needs written where they meet it. Emitted even when EMPTY — an absent + // element then means "no scope was given", never "nobody else has anything open". + rw::emitTo( out, "", + j.outOfScope.size(), j.scopedOutGating ); + for( const quality::Regression& r : j.outOfScope ) { - // renderToString DISCLOSEd the failed buffer; the full document is the superset, written straight to stdout - emitDocument( stdout, /*collapse=*/false ); - return qualityDeltaExit( gatingCount, refs.degraded || basis.historyUnread.any() ); + emitQdXmlRow( out, r, qdRowModel( r, /*gatingAllowed=*/false, rep.deltaRoot() ), ex ); } - const std::string& chosen = foldPays( folded.text, full.text ) ? folded.text : full.text; // compactlegend.h: the margin and why - std::fwrite( chosen.data(), 1, chosen.size(), stdout ); - return qualityDeltaExit( gatingCount, refs.degraded || basis.historyUnread.any() ); // r26: only a PREEXISTING-worse AND major regression gates (== gating=) + rw::emitRaw( out, "" ); } - return std::nullopt; + // L2 — one row per stale ack (quality::staleAcksXml). M21(a): the escaper is passed in because sym= carries a + // canonical id (corpus text), unlike the closed-vocabulary kind=/why=. + std::vector saEsc; + std::fputs( quality::staleAcksXml( served, [ & ]( std::string_view t ) { return std::string( escapeXml( t, saEsc ) ); } ).c_str(), out ); + rw::emitRaw( out, "" ); +} + +// The identity-tree VERDICT (QdStaleCollapse::verdictOnly): the root line alone. +void emitQdVerdict( std::FILE* out, const QdReport& rep, const QdStaleCollapse& stale, const std::string& atAttrs ) +{ + rw::emitTo( out, "" + "", + rep.baseSel().marker, rep.staleAcks.size(), atAttrs, stale.attrs ); +} + +// REPORT (render half), XML. +// §B7.1 (CA4) — the heading used to open "only what changed for the WORSE vs .ripwire_quality_baseline", which is FALSE in +// every state but one: three of the five floors this verb can use are not that file, and in one of them the file was judged +// stale and DELETED from the user's tree during this very run. The floor actually used is named by baseline= on the root, +// so the heading points at that attribute instead of asserting a floor. +// 2026-09-02 (lane B): the marker states are still defined on the first screen — the only place a reader meets them — but +// ONE state per run, the one in force, rather than all five on every call (emitQualityDeltaLegend). +// Fix round 1 (rv-lean-trio item 5, owner ruling 5): a fold ships only when it PAYS (compactlegend.h foldPays: shorter +// by its margin, as written AND as the compact layer delivers it). The whole XML document is one renderer over a FILE*, +// so both candidates are rendered and measured, and the full document wins a fold that does not pay or a failed render +// (fx, dirty tree, one stale ack: 1512 B folded vs 1481 B full). +void emitQualityDeltaXml( const QdReport& rep ) +{ + using namespace rw; + std::vector esc; + const QdStaleCollapse stale = qdStaleCollapse( rep, [ & ]( std::string_view s ) -> std::string { return std::string( escapeXml( s, esc ) ); } ); + // R-I: at= is OMITTED for the ref-pair form (see the root). Read ONCE: both candidates print the same stamp. + const std::string atAttrs = rep.j.refPair ? std::string() : gitstamp::atAttr( rep.j.root ); + if( !stale.collapse ) + { + emitQdXmlDocument( stdout, rep, stale, atAttrs, /*collapse=*/false ); + return; + } + const Rendered full = renderToString( [ & ]( std::FILE* f ) { emitQdXmlDocument( f, rep, stale, atAttrs, /*collapse=*/false ); } ); + const Rendered folded = renderToString( [ & ]( std::FILE* f ) + { + if( stale.verdictOnly ) { emitQdVerdict( f, rep, stale, atAttrs ); } + else { emitQdXmlDocument( f, rep, stale, atAttrs, /*collapse=*/true ); } + } ); + if( !full.ok || !folded.ok ) + { + // renderToString DISCLOSEd the failed buffer; the full document is the superset, written straight to stdout + emitQdXmlDocument( stdout, rep, stale, atAttrs, /*collapse=*/false ); + return; + } + const std::string& chosen = foldPays( folded.text, full.text ) ? folded.text : full.text; // compactlegend.h: the margin and why + std::fwrite( chosen.data(), 1, chosen.size(), stdout ); +} + +// --quality-baseline / --quality-delta (the convergence-loop oracle): snapshot ccx + clone groups + dead candidates to +// .ripwire_quality_baseline; then report ONLY what a change made WORSE vs it. The "delta not absolute" discipline — a refine +// loop targets the regression it introduced, not absolute numbers (the defense against metric-gaming). exit 2 if any new +// debt, like --arch. The phases: resolve the floor and the delta (resolveDeltaBasis), JUDGE (judgeQualityDelta), then +// either WRITE ACKS (runQualityAckWrite) or REPORT (qdReportOf, then the JSON or XML rendering). +std::optional runQualityDelta( const MainDispatch& d ) +{ + using namespace rw; + const Config& cfg = d.cfg; + if( !cfg.qualityBaseline && !cfg.qualityDelta ) + { + return std::nullopt; + } + // D1 fix (HIGH): resolve BOTH sidecars against the analyzed ROOT, not the process CWD — + // see quality::rootQualifiedSidecar's comment for why a bare relative filename is unsafe here + // (a foreign cwd's sidecar could be silently rewritten, or even deleted by the stale-baseline + // self-heal). Computed once; every read/write/remove site downstream uses it. + const std::string baselineFile = quality::baselinePath( d.root ); + const std::string acksFile = quality::acksPath( d.root ); + if( cfg.qualityBaseline ) + { + return runQualityBaselinePin( d, baselineFile, acksFile ); + } + + // Precedence for the baseline: (1) an explicit `.ripwire_quality_baseline` sidecar (from + // --quality-baseline) wins whenever it is pinned at the CURRENT HEAD — the mid-task convergence loop + // (baseline once, edit, re-check) is unchanged; (2) else — no sidecar, or a STALE one (see R3 below) — + // if the root is a git repo with a HEAD tree, auto-baseline against HEAD so the "before I push" loop + // works with no start-of-task ritual (T0.1); (3) else degrade to the exit-1 "run --quality-baseline + // first" guidance (non-git / unborn / detached-no-tree — unchanged). + // + // STALENESS + the self-heal now live in ONE place, quality::selectBaseline — R3 owner ruling + // (2026-07-29): a sidecar whose pinned sha != the CURRENT HEAD sha is STALE, full stop. The B10.1b + // "reachable ancestor is a deliberately-pinned floor" carve-out this arm used to apply (gitIsAncestor) + // is REVOKED: a parallel session's sidecar pinned at a commit that merely happened to be an ancestor of + // this session's HEAD made THIS arm report 31 phantom regressions while the MCP quality_delta verb — + // same binary, same repo, same second — correctly reported zero. That divergence was only possible + // because each arm carried its own copy of the test; there is now exactly one, in quality.h. + // + // What remains this arm's own POLICY is the `removeStaleFile=true` argument: the stale sidecar is + // silently UNLINKED (best-effort) so the NEXT run sees no file at all rather than rediscovering the + // same dead pin, and the ONLY record is the `baseline=` XML attribute ("git-HEAD (stale sidecar + // removed)") — no stderr spam, which is the B10.1b noise fix that survives the ruling intact. The + // read-only MCP arm passes false and reports "…ignored" instead. When the unlink FAILS (read-only + // parent dir) this arm degrades to the read-only story — marker "…ignored", one DISCLOSE + // from the seam — because the pin is still on disk; `baseSel.isStaleFileOnDisk()` is the fact, and the + // fatal message words itself from it rather than from the intent. + // + // F-04 (round-4 audit) — SERIALIZE THE ACK LEDGER'S READ-MODIFY-WRITE, cross-process. + // + // --quality-ack reads the whole ledger (inside resolveDeltaBasis just below — the heal has to happen + // before computeDelta), folds this run's accepted findings into that map, then rewrites the file from + // it. Nothing serialized that. Three sessions acking DISJOINT rows in one shared checkout — the exact + // scenario --scope exists for — lost two of the three acks on 8 of 8 measured runs, because whichever + // process rewrote last overwrote a map the other two had already published into. + // + // The lock therefore has to span the READ as well as the write, which is why it is taken HERE and not + // inside writeAckRecords: a lock held only around the final rewrite still lets two processes read the + // same stale map first and then take turns clobbering. Engaged ONLY under --quality-ack — a read-only + // --quality-delta never waits, never creates the lockfile, and is byte-for-byte the run it always was. + // RAII: released when this function returns, on every path including the refusals below. quality.h's + // SidecarWriteLock has the lockfile's location (per-user cache dir, never a repo-tree sidecar), the + // wait budget, and the honest limits. + std::optional ackLock; + if( cfg.qualityAck ) + { + ackLock.emplace( acksFile ); + } + + // `refs` is declared HERE because it owns both materialized trees' teardown and they must outlive every read of the + // delta (QdJudged's header). + RefPairDelta refs; + DeltaBasis basis; + if( const std::optional refused = applyKindSelector( cfg, refs ) ) + { + return refused; + } + if( const std::optional refused = resolveDeltaBasis( d, baselineFile, refs, basis ) ) + { + return refused; + } + const bool refPair = !cfg.qualityDeltaRange.empty(); + QdJudged judged{ .cfg = cfg, .root = d.root, .refs = refs, .basis = basis, .refPair = refPair, .judged = refPair ? refs.target().ing : d.ing, + .workingGraph = d.g }; + if( const std::optional refused = judgeQualityDelta( judged ) ) + { + return refused; + } + if( cfg.qualityAck ) + { + return runQualityAckWrite( judged, acksFile ); + } + + const QdReport report = qdReportOf( judged, baselineFile ); + // the stderr lines of a partial or over-the-limit answer come first: it says so on the channel a human reads before + // anything else + emitMemoryLines( report.kd, refs ); + // P2.5 — one stderr line NAMING the gating finding, in --token-budget's style ("ripwire: --token-budget + // exceeded: est_tokens=… > budget=…"). stdout is the machine artifact and a caller that only checks + // `$?` gets a number with no subject; this puts the WHICH on the channel a human reads, without + // touching the XML contract. Names the first gating row in the already-sorted list (deterministic). + // §A4 (minor): emitted BEFORE the format fork — the line is about the EXIT CODE, which both formats share, so it + // belongs to neither (under --json the fork used to return first, and a script reading `$?` got no subject). + emitQdGatingLine( report.regs(), report.counts.gating, report.deltaRoot() ); + if( cfg.json ) + { + emitQualityDeltaJson( report ); + } + else + { + emitQualityDeltaXml( report ); + } + return report.exitCode(); } // #387: the range form compares two COMMITTED trees, each materialized and indexed by loadRefPairDelta, and reads the From eb05d07752606e0d772a2ea19ddc4f218a95eb09 Mon Sep 17 00:00:00 2001 From: joyful-ii-V-I <210578314+joyful-ii-V-I@users.noreply.github.com> Date: Sat, 21 Nov 2026 16:45:23 -0500 Subject: [PATCH 02/44] refactor(quality): --quality-delta computes silently, decides each root attribute once GE-RUNQD round 2, from the blind review of 38c9aac7d; output byte-identical. - computeQdReport (was qdReportOf) prints nothing: the RIPWIRE_STATS, unread-history, .ripwire_config, memory and gating lines all print from emitQdStderrLines, in their old order. registerMacroConfigWarningAttr's stderr half is now emitRegisterMacroConfigWarnings (--dead-code keeps the combined call). - Each optional root attribute is one QdRootField {xml, json} built once in qdRootFieldsOf (stale, register-macro-excluded, at, the range refs, identity, scope, config-warnings, baseline_absorbed, the bad-line counts, head_basis, the two exclusion counts, kinds, history, ratchet); qdRootTail renders the tail in one order for both formats. This replaces the .first/.second pairs and the per-format presence tests. - The context structs are gone: applyScopeAndAcks returns a QdPartition; the ack arm takes the config, scope, partition and basis it uses; acceptFinding takes the ledger map, the cid index, the scope spec and the reason. The report reads a read-only QdComparison built once. - The bare form's stale-ack snapshot is computed in runQualityDelta from d.ing and d.g, with its write to basis.passes visible there. - The stale fold is one optional QdStaleFold (no second collapse bool), and qdExpandNextAttr drops its unreachable duplication test. Co-Authored-By: Claude Opus 5.5 --- src/verbs_quality.h | 676 ++++++++++++++++++++++++-------------------- 1 file changed, 374 insertions(+), 302 deletions(-) diff --git a/src/verbs_quality.h b/src/verbs_quality.h index c730c16e4..102f96b39 100644 --- a/src/verbs_quality.h +++ b/src/verbs_quality.h @@ -2166,15 +2166,12 @@ inline void emitQualityDeltaLegend( const QualityDeltaLegendParts& p, std::FILE* // F-13 — the one place both --dead-code and --quality-delta turn a RegisterMacroConfigDiagnostics into // output: the specific keys/names on stderr (never guessed at in the XML — a hand-edited config's tokens -// are not free text an attribute repeats), and the shared `config-warnings="N"` attribute string, present -// only when non-zero (this file's standing convention for every optional root attribute). One function so -// the two verbs cannot report the same misconfiguration two different ways. -inline std::string registerMacroConfigWarningAttr( const rw::quality::RegisterMacroConfigDiagnostics& diag ) +// are not free text an attribute repeats; emitRegisterMacroConfigWarnings), and the shared `config-warnings="N"` +// attribute, present only when non-zero (this file's standing convention for every optional root attribute; +// --quality-delta spells it as a QdRootField). One pair of functions so the two verbs cannot report the same +// misconfiguration two different ways. +inline void emitRegisterMacroConfigWarnings( const rw::quality::RegisterMacroConfigDiagnostics& diag ) { - if( diag.total() == 0 ) - { - return std::string(); - } const auto joined = [] ( const std::vector& v ) -> std::string { std::string out; @@ -2195,7 +2192,13 @@ inline std::string registerMacroConfigWarningAttr( const rw::quality::RegisterMa rw::emitTo( stderr, "ripwire: .ripwire_config's register_macros= names a macro matching no indexed symbol (typo, or unused): {}\n", joined( diag.inertNames ).c_str() ); } - return " config-warnings=\"" + std::to_string( diag.total() ) + "\""; +} + +// --dead-code's half of F-13: the stderr lines, then the attribute. +inline std::string registerMacroConfigWarningAttr( const rw::quality::RegisterMacroConfigDiagnostics& diag ) +{ + emitRegisterMacroConfigWarnings( diag ); + return diag.total() == 0 ? std::string() : " config-warnings=\"" + std::to_string( diag.total() ) + "\""; } // H10 (capture-audit 2026-09-04): the --quality-ack run that has NOTHING to accept. It used to re-serialise @@ -2584,67 +2587,48 @@ inline std::string presentXmlAttr( std::string_view name, const std::string& v, return v.empty() ? std::string() : " " + std::string( name ) + "=\"" + esc( v ) + "\""; } -// ── --quality-delta, in three phases: JUDGE (scope partition + ack ratchet), then either WRITE ACKS or REPORT ────────── +// ── --quality-delta, in phases: SCOPE + RATCHET, then either WRITE ACKS or COMPUTE the report and RENDER it ────────────── // GE-RUNQD: runQualityDelta used to compute the answer and render it in one 744-line body, with the JSON and XML row -// emitters written twice inside it. The phases are now named functions over two small state structs — QdJudged (the -// comparison after the partition and the ratchet) and QdReport (everything a rendering reads) — and one row model -// (QdRowModel) decides each row's printed facts once for both formats. - -// The comparison once the scope partition and the ack ratchet ran: what the --quality-ack writer and the report both read. -// `refs` owns both materialized trees' teardown and must outlive every read of basis.regs (DeltaBasis's header states that -// rule, and why every path and symbol downstream is spelled against basis.deltaRoot rather than against `root`). -struct QdJudged +// emitters written twice inside it. The phases are now named functions: applyScopeAndAcks returns what the partition and +// the ratchet decided (QdPartition); runQualityAckWrite is the --quality-ack arm; computeQdReport builds every count and +// root disclosure once, silently (QdReport, with each root attribute a QdRootField spelled for both formats); the stderr +// lines print from emitQdStderrLines; one row model (QdRowModel) decides each row's printed facts for both formats. + +// What the scope partition and the ack ratchet decided over basis.regs (applyScopeAndAcks): the rows that belong to someone +// else, the acks suppressing a finding in a session other than the one that wrote them, and the two counts they feed. +struct QdPartition { - const rw::Config& cfg; - const std::string& root; - RefPairDelta& refs; - DeltaBasis& basis; - const bool refPair; - const rw::IngestResult& judged; // the JUDGED tree's index: tree B in the ref-pair form, else the working tree - const rw::Graph& workingGraph; // the working tree's graph: the bare form's stale-ack snapshot reads it - rw::quality::Scope scope; std::vector outOfScope; std::vector foreignAcks; - std::size_t diffFileCount = 0; // P1.2: 0 = the reserved diff token was not used - std::size_t scopedOutGating = 0; - std::size_t ackedCount = 0; + std::size_t scopedOutGating = 0; // out-of-scope rows that would have gated (would-gate=) + std::size_t ackedCount = 0; // in-scope rows the ack ledger suppressed (acked=) }; -// JUDGE — the scope partition, then the per-finding ack ratchet, over the delta resolveDeltaBasis computed. Returns the -// refusal's exit code when the scope cannot be used. -std::optional judgeQualityDelta( QdJudged& j ) +// SCOPE + RATCHET — split basis.regs by --scope, then suppress what the ack ledger already accepted. basis.regs keeps only +// the in-scope, unsuppressed rows. +// Signal-to-noise round — the per-finding ACK RATCHET. Suppress findings already accepted (with a +// reason) in .ripwire_quality_acks, honestly (acked="N"); a finding that WORSENED past its acked +// magnitude survives the filter and reappears. --quality-ack merges the currently-VISIBLE findings +// into that file instead of printing the report (accepting what previous acks already hid would be +// a silent blanket ack — only what the agent can see right now is what it can accept). +// R1 IDENTITY: the ledger was read and HEALED inside resolveDeltaBasis (it had to be — the baseline +// half of the same healing has to precede computeDelta), so this step takes the already-current map +// rather than re-reading the file and undoing it. +QdPartition applyScopeAndAcks( const rw::quality::Scope& scope, DeltaBasis& basis ) { using namespace rw; - std::vector& regs = j.basis.regs; - // ── P1 SCOPE — the OWNERSHIP partition for a working tree with several writers in it ───────────── - j.scope = quality::parseScope( j.cfg.qualityScope ); - if( const std::optional refused = expandScopeDiff( j.scope, j.refPair, j.judged, j.root, j.basis.deltaRoot, j.diffFileCount ) ) - { - return refused; - } - if( const std::optional refused = refuseUnusableScope( j.cfg, j.scope, j.judged, j.basis.deltaRoot, j.refs.scopeFiles() ) ) - { - return refused; - } - - // Signal-to-noise round — the per-finding ACK RATCHET. Suppress findings already accepted (with a - // reason) in .ripwire_quality_acks, honestly (acked="N"); a finding that WORSENED past its acked - // magnitude survives the filter and reappears. --quality-ack merges the currently-VISIBLE findings - // into that file instead of printing the report (accepting what previous acks already hid would be - // a silent blanket ack — only what the agent can see right now is what it can accept). - // R1 IDENTITY: the ledger was read and HEALED inside resolveDeltaBasis (it had to be — the baseline - // half of the same healing has to precede computeDelta), so this arm takes the already-current map - // rather than re-reading the file and undoing it. - gtl::btree_map& acks = j.basis.acks; - quality::countAckRescues( regs, acks, j.basis.healing.ackRemap, j.basis.healing.ackedByRename, j.basis.healing.ackedByContent ); + std::vector& regs = basis.regs; + const gtl::btree_map& acks = basis.acks; + QdPartition out; + quality::countAckRescues( regs, acks, basis.healing.ackRemap, basis.healing.ackedByRename, basis.healing.ackedByContent ); // P1.4 PROVENANCE — the foreign-ack sweep reads the PRE-ratchet list on purpose (computeForeignAcks' // header states why: the question is about acks that are suppressing something right now). - j.foreignAcks = quality::computeForeignAcks( regs, acks ); + out.foreignAcks = quality::computeForeignAcks( regs, acks ); // P1 — the partition runs BEFORE the ratchet so acked="N" counts THIS scope's suppressions rather // than the whole tree's (partitionByScope owns the rest of the rule). - j.scopedOutGating = partitionByScope( j.scope, regs, j.outOfScope, acks ); - j.ackedCount = quality::applyAckRatchet( regs, acks ); - return std::nullopt; + out.scopedOutGating = partitionByScope( scope, regs, out.outOfScope, acks ); + out.ackedCount = quality::applyAckRatchet( regs, acks ); + return out; } // --ack-only=SUBSTR[,SUBSTR]: ack a SUBSET instead of everything on screen. Without it, the only way to accept one @@ -2697,22 +2681,25 @@ void discloseAckBackfill( const rw::quality::AckBackfill& backfilled ) backfilled.resolved, backfilled.refreshed, backfilled.unverified, backfilled.unresolved, backfilled.ineligible, backfilled.measured ); } -// Fold ONE accepted finding into the ack ledger `j.basis.acks`, then prove the re-score formula agrees with the live one. -void acceptFinding( QdJudged& j, const rw::quality::Regression& r ) +// Fold ONE accepted finding into the ack ledger `acks`, then prove the re-score formula agrees with the live one. `cidByKey` +// is the healing pre-pass's content-id index; `scopeSpec` is the --scope this run names (nullptr: none, so an existing row +// keeps its `by`); `reason` is --quality-ack's text (empty: an existing row keeps its reason). +void acceptFinding( gtl::btree_map& acks, const gtl::btree_map& cidByKey, + const rw::quality::Regression& r, const std::string* scopeSpec, std::string_view reason ) { using namespace rw; // P0.3: the ack IDENTITY is ackKindToken, not the bare kind — a zero-magnitude finding // (was==now==0: dead-code, api-surface tier A) acks per ORIGIN, so acking the never-gating // new-symbol row can no longer blank-check the gating contract-change row on the same symbol. const std::string ackKind = quality::ackKindToken( r ); - quality::AckRecord& rec = j.basis.acks[ quality::ackMapKey( ackKind, r.key ) ]; + quality::AckRecord& rec = acks[ quality::ackMapKey( ackKind, r.key ) ]; // R1 IDENTITY: stamp the finding's SCRUBBED CONTENT ID alongside the key, so this ack can // still be found after a move git records no rename for. Absent (0) for the two clone kinds — // their key is a member-SET hash with no single body behind it — and the row is then written // exactly as it is today. A REFRESH, not a preserve: re-acking a finding re-reads the body, so // the stored cid always describes the code as accepted, never as it was two edits ago. - const auto cidIt = j.basis.healing.cids.cidByKey.find( r.key ); - const std::uint64_t cid = ( cidIt == j.basis.healing.cids.cidByKey.end() ) ? 0u : cidIt->second; + const auto cidIt = cidByKey.find( r.key ); + const std::uint64_t cid = ( cidIt == cidByKey.end() ) ? 0u : cidIt->second; // P1.4 PROVENANCE: `by` follows the SAME rule the reason does one line down — set from this // run when this run supplies one, PRESERVED otherwise. A later scope-less re-ack therefore // refreshes the magnitude without erasing the record of who accepted the row originally, @@ -2727,10 +2714,9 @@ void acceptFinding( QdJudged& j, const rw::quality::Regression& r ) // JUST ACCEPTED, never as it was some earlier run. See AckRecord's doc comment for what each // one is and why a later run can re-score from them alone. rec = quality::AckRecord{ ackKind, r.key, std::max( rec.ackNow, r.now ), cid, - j.scope.active() ? j.scope.spec : rec.by, + scopeSpec != nullptr ? *scopeSpec : rec.by, r.was, r.now, r.facet, r.path, r.line, quality::AckProvenance::Measured, - j.cfg.qualityAckReason.empty() ? rec.reason - : quality::composeAckReason( rec.reason, std::string( j.cfg.qualityAckReason ) ) }; + reason.empty() ? rec.reason : quality::composeAckReason( rec.reason, std::string( reason ) ) }; // SELF-CHECK, not a one-off test: every magnitude-bearing ack proves that the TABLE-DRIVEN // re-score formula agrees with the LIVE one on the row it just built. NOT a full round trip — // rescoreAckRecord runs here on the in-memory `rec` directly; it never goes through @@ -2786,48 +2772,58 @@ int refuseUnmatchedAckOnly( std::string_view ackOnly, const std::string& acksFil return 1; } +// What one --quality-ack run counted, for writeAcceptedAcks's report. +struct QdAckTally +{ + std::size_t findings = 0; // visible findings this run could accept + std::size_t alreadyAcked = 0; // suppressed by an earlier ack (acked=) + std::size_t accepted = 0; + std::size_t skipped = 0; // visible but not selected by --ack-only + bool narrowed = false; // --ack-only was given +}; + // Rewrite the ledger with this run's accepted findings and say what was written. Returns the exit code. -int writeAcceptedAcks( const QdJudged& j, const std::string& acksFile, std::size_t ackWritten, std::size_t ackSkipped ) +int writeAcceptedAcks( const std::string& acksFile, const gtl::btree_map& acks, const QdAckTally& tally, + const rw::quality::Scope& scope, std::size_t outOfScopeCount ) { using namespace rw; - const std::size_t findingCount = j.basis.regs.size(); - const bool wroteAcks = quality::writeAckRecords( acksFile, j.basis.acks ); - if( !wroteAcks ) + if( !quality::writeAckRecords( acksFile, acks ) ) { rw::emitTo( stderr, "ripwire: could not write {}\n", acksFile.c_str() ); return 1; } - if( !j.cfg.qualityAckOnly.empty() ) + if( tally.narrowed ) { rw::emitTo( stderr, "ripwire: acknowledged {} of {} finding(s) ({} left UNACKED by --ack-only, {} already acked) → {}\n", - ackWritten, findingCount, ackSkipped, j.ackedCount, acksFile.c_str() ); + tally.accepted, tally.findings, tally.skipped, tally.alreadyAcked, acksFile.c_str() ); } else { - rw::emitTo( stderr, "ripwire: acknowledged {} finding(s) ({} already acked) → {}\n", findingCount, j.ackedCount, acksFile.c_str() ); + rw::emitTo( stderr, "ripwire: acknowledged {} finding(s) ({} already acked) → {}\n", tally.findings, tally.alreadyAcked, acksFile.c_str() ); } // P1 — the skip is DISCLOSED, never silent: the count of rows this ack deliberately did not // touch is the whole reason the caller passed a scope, and a quiet success would leave them // believing the ledger now covers the report they were looking at. - if( j.scope.active() && !j.outOfScope.empty() ) + if( scope.active() && outOfScopeCount != 0 ) { rw::emitTo( stderr, "ripwire: {} finding(s) OUT OF SCOPE for --scope={} were left unacked — not yours to accept " "(they are still in the report, under the out-of-scope element)\n", - j.outOfScope.size(), j.scope.spec.c_str() ); + outOfScopeCount, scope.spec.c_str() ); } return 0; } -// WRITE ACKS — the --quality-ack arm: fold the VISIBLE findings --ack-only selects into the ledger instead of printing the -// report. Returns the exit code. -int runQualityAckWrite( QdJudged& j, const std::string& acksFile ) +// WRITE ACKS — the --quality-ack arm: fold the VISIBLE findings --ack-only selects into the ledger (basis.acks, then the +// file) instead of printing the report. Returns the exit code. +int runQualityAckWrite( const rw::Config& cfg, const rw::quality::Scope& scope, const QdPartition& part, DeltaBasis& basis, + const std::string& acksFile ) { using namespace rw; - const std::string_view ackOnly = j.cfg.qualityAckOnly; + const std::string_view ackOnly = cfg.qualityAckOnly; const auto selected = [ & ]( const quality::Regression& r, bool inScope ) { return ackOnlySelects( ackOnly, r, inScope ); }; // P1 — THE RUBBER-STAMP GUARD (refuseForeignAckSelection owns the rule and the message). - if( const std::optional refused = refuseForeignAckSelection( j.cfg, j.scope, j.outOfScope, j.basis.deltaRoot, selected ) ) + if( const std::optional refused = refuseForeignAckSelection( cfg, scope, part.outOfScope, basis.deltaRoot, selected ) ) { return *refused; } @@ -2839,29 +2835,30 @@ int runQualityAckWrite( QdJudged& j, const std::string& acksFile ) // NOTHING: healing the ledger's provenance is the same class of forward repair the identity // remap already performs on every ack, and H10's ackNothingToAccept re-renders and notices. // quality::backfillCloneAckProvenance owns the rule, what it refuses to touch, and why. - discloseAckBackfill( quality::backfillCloneAckProvenance( j.basis.acks, j.basis.cloneIdioms ) ); + discloseAckBackfill( quality::backfillCloneAckProvenance( basis.acks, basis.cloneIdioms ) ); - std::size_t ackWritten = 0, ackSkipped = 0; - for( const quality::Regression& r : j.basis.regs ) + const std::string* const scopeSpec = scope.active() ? &scope.spec : nullptr; + QdAckTally tally{ .findings = basis.regs.size(), .alreadyAcked = part.ackedCount, .narrowed = !ackOnly.empty() }; + for( const quality::Regression& r : basis.regs ) { if( !selected( r, /*inScope=*/true ) ) { - ++ackSkipped; + ++tally.skipped; continue; } - ++ackWritten; - acceptFinding( j, r ); + ++tally.accepted; + acceptFinding( basis.acks, basis.healing.cids.cidByKey, r, scopeSpec, cfg.qualityAckReason ); } - if( ackWritten == 0 && !ackOnly.empty() ) + if( tally.accepted == 0 && tally.narrowed ) { - return refuseUnmatchedAckOnly( ackOnly, acksFile, j.basis.acks, j.basis.regs.size() ); + return refuseUnmatchedAckOnly( ackOnly, acksFile, basis.acks, tally.findings ); } // H10: nothing to accept — leave a canonical ledger alone, heal a non-canonical one (ackNothingToAccept) - if( j.basis.regs.empty() ) + if( basis.regs.empty() ) { - return ackNothingToAccept( acksFile, j.basis.acks, j.scope, j.outOfScope.size() ); + return ackNothingToAccept( acksFile, basis.acks, scope, part.outOfScope.size() ); } - return writeAcceptedAcks( j, acksFile, ackWritten, ackSkipped ); + return writeAcceptedAcks( acksFile, basis.acks, tally, scope, part.outOfScope.size() ); } // r26 ORIGIN SPLIT — three counts over the VISIBLE (post-ack) findings, one pass: @@ -2889,97 +2886,202 @@ QdCounts countQdRows( const std::vector& regs ) return c; } -// Everything one --quality-delta answer renders, computed before the format is chosen: the JSON and XML emitters read only -// this (plus the judged comparison it points at), so the two formats cannot disagree about a fact. -struct QdReport +// The finished comparison every report step reads, READ-ONLY: the floor and the delta (basis), the range form's trees +// (refs), the scope and what the partition and the ratchet decided. Built once, after the last write to any of them. +// Every path and symbol downstream is spelled against basis.deltaRoot rather than against `root` (DeltaBasis's header). +struct QdComparison { - const QdJudged& j; - std::vector staleAcks; - std::vector saRows; // stale + foreign acks: the one / "sa" list - QdCounts counts; - std::size_t baselineAbsorbed = 0; - std::pair identity, history, scope; // (XML attrs, JSON members), built once for both - rw::quality::RegisterMacroConfigDiagnostics configDiag; - std::string configWarnAttr; - KindsDisclosure kd; - bool deadRan = false; // dead-code's side counts exist only when it ran - - const rw::quality::BaselineSelection& baseSel() const noexcept { return j.basis.baseSel; } - const std::vector& regs() const noexcept { return j.basis.regs; } - const std::string& deltaRoot() const noexcept { return j.basis.deltaRoot; } - // The exit code every rendering returns (qualityDeltaExit): r26 — only a PREEXISTING-worse AND major regression gates (== gating=). - int exitCode() const noexcept { return qualityDeltaExit( counts.gating, j.refs.degraded || j.basis.historyUnread.any() ); } + const rw::Config& cfg; + const std::string& root; + const RefPairDelta& refs; + const DeltaBasis& basis; + const rw::quality::Scope& scope; + const QdPartition& part; + const rw::IngestResult& judgedIndex; // the JUDGED tree's index: tree B in the range form, else the working tree + bool refPair; // the range form (--quality-delta=A..B) + std::size_t diffFileCount; // P1.2: files the reserved diff token expanded to (0 = not used) }; -// REPORT (compute half) — the stale-ack verdicts, the counts and every root disclosure, in the order their stderr lines -// have always printed. -QdReport qdReportOf( const QdJudged& j, const std::string& baselineFile ) +// Which spelling of a root disclosure an emitter wants. +enum class QdFormat : std::uint8_t { - using namespace rw; - QdReport rep{ .j = j }; - const gtl::btree_map& acks = j.basis.acks; - // L2 — stale-ack disclosure (rationale: quality.h's computeStaleAcks). Checked against the CURRENT - // tree, not the baseline above, so it costs one more computeSnapshot; skipped when the ledger is - // empty. Reported, never gated — the exit code reads `regs` alone. - // R-I: "the CURRENT tree" is the JUDGED tree, which in the ref-pair form is tree B — checking the - // ledger against the working tree there would report acks as stale because of edits that have nothing - // to do with the comparison being made. - // qd-memory-degrade: refPairStaleAcks owns the two range-form departures (a changed-files answer judges none; a - // kind selection judges its own kinds' acks only). - rep.staleAcks = acks.empty() ? std::vector{} - : j.refPair ? refPairStaleAcks( acks, j.refs ) - : quality::computeStaleAcks( acks, quality::computeSnapshot( j.judged, j.workingGraph, j.cfg.rootPath, nullptr, {}, &j.basis.passes ) ); - if( std::getenv( "RIPWIRE_STATS" ) ) // QD-ENVOY-TIME cost bound: Type-3 passes this call ran (test/qdtype3oncecheck.sh) + Xml, + Json +}; + +// One optional root disclosure of the --quality-delta answer, decided ONCE and spelled for both formats: `xml` is spliced +// into the root element, `json` into the top-level object. Both are empty when the fact is absent — absent means "never +// happened" or "not run", never 0. A field the JSON object has never carried keeps `json` empty. +struct QdRootField +{ + std::string xml, json; + + const std::string& in( QdFormat format ) const noexcept { return format == QdFormat::Xml ? xml : json; } +}; + +// A count as a root disclosure: ` name="N"` / `,"name":N` when `present`, else absent. +QdRootField qdCountField( std::string_view name, std::size_t count, bool present ) +{ + if( !present ) { - rw::emitTo( stderr, "ripwire: quality-passes type3_runs={} type3_pairs={}\n", gType3PassRuns.load( std::memory_order_relaxed ), - gType3PassPairs.load( std::memory_order_relaxed ) ); + return {}; + } + const std::string n = std::to_string( count ); + return { " " + std::string( name ) + "=\"" + n + "\"", ",\"" + std::string( name ) + "\":" + n }; +} + +// Every root disclosure, each built once (qdRootFieldsOf). `stale` and `registerMacroExcluded` sit between the fixed +// counts; the rest form the root's tail in qdRootTail's order. +struct QdRootFields +{ + // qd-memory-degrade: stale= and register-macro-excluded= are absent (never 0) when their pass did not run + QdRootField stale, registerMacroExcluded; + QdRootField at; // at=: commit+dirty state; the range form omits it in XML and says null in JSON + QdRootField rangeRefs; // R-I: base_ref= target_ref= churn= (RefPairDelta::attrs / jsonAttrs) + QdRootField identity; // R1 IDENTITY: renames and acks re-filed by rename or content (quality::identityDisclosure) + QdRootField scopeDisclosure; // P1/P1.4: --scope, out-of-scope and foreign-ack counts (quality::scopeDisclosure) + QdRootField configWarnings; // F-13: .ripwire_config keys/names that did nothing + QdRootField baselineAbsorbed; // H11: debt the honored sidecar absorbed + QdRootField baselineBadLines, acksBadLines; // 2026-09-06: unparseable sidecar lines skipped (XML only, as always) + QdRootField headBasis; // #228: which basis produced a git-HEAD floor (absent = the archived HEAD tree) + QdRootField declinedCallExcluded, valueRefExcluded; // dead-code exemptions, absent at zero + QdRootField kinds; // qd-memory-degrade: kinds not run, why, the replay, the peak (kindsDisclosure) + QdRootField history; // hwh-fix4 (N1): history a gating kind could not read (unread_history=) + QdRootField ratchet; // D4: the ratchet's reference point and what it could not read +}; + +// The root's tail in one order for both formats. `foldAttrs` (XML only) is the stale fold's stale_by_kind=/stale_next=, +// which sits between the exclusion counts and the kinds disclosure. +std::string qdRootTail( const QdRootFields& f, QdFormat format, std::string_view foldAttrs ) +{ + std::string out; + for( const QdRootField* field : { &f.at, &f.rangeRefs, &f.identity, &f.scopeDisclosure, &f.configWarnings, &f.baselineAbsorbed, + &f.baselineBadLines, &f.acksBadLines, &f.headBasis, &f.declinedCallExcluded, &f.valueRefExcluded } ) + { + out += field->in( format ); + } + out += foldAttrs; + for( const QdRootField* field : { &f.kinds, &f.history, &f.ratchet } ) + { + out += field->in( format ); } + return out; +} + +// Everything one --quality-delta answer renders, computed before the format is chosen (computeQdReport): the JSON and XML +// emitters read only this and the comparison it points at, so the two formats cannot disagree about a fact. +struct QdReport +{ + const QdComparison& c; + std::vector staleAcks; + std::vector saRows; // stale + foreign acks: the one / "sa" list + QdCounts counts; + std::size_t baselineAbsorbed = 0; + rw::quality::RegisterMacroConfigDiagnostics configDiag; // its stderr lines are emitQdStderrLines' + KindsDisclosure kd; + QdRootFields root; + + // The exit code every rendering returns (qualityDeltaExit): r26 — only a PREEXISTING-worse AND major regression gates + // (== gating=); a changed-files answer, or one whose gating history could not be read, is partial. + int exitCode() const noexcept { return qualityDeltaExit( counts.gating, c.refs.degraded || c.basis.historyUnread.any() ); } +}; +// Every root disclosure of `rep`, each decided here once for both formats. +QdRootFields qdRootFieldsOf( const QdReport& rep ) +{ + using namespace rw; + const QdComparison& c = rep.c; + const DeltaBasis& basis = c.basis; + const bool deadRan = !c.refPair || quality::kindSelected( c.refs.kinds, "dead-code" ); // dead-code's side counts exist only when it ran + const auto fromPair = []( std::pair p ) { return QdRootField{ std::move( p.first ), std::move( p.second ) }; }; + std::vector esc; + QdRootFields f; + f.stale = qdCountField( "stale", rep.staleAcks.size(), !c.refs.degraded ); + f.registerMacroExcluded = qdCountField( "register-macro-excluded", basis.registerMacroExcluded, deadRan ); + // R-I: the range form's list was not computed "at" any working-tree state — base_ref= and target_ref= are its anchor, so + // XML omits at= and JSON says null (never a fake sha); a non-git root is null too. + const std::string atValue = c.refPair ? std::string() : gitstamp::stampAt( c.root ); + f.at = { atValue.empty() ? std::string() : " at=\"" + atValue + "\"", + ",\"at\":" + ( atValue.empty() ? std::string( "null" ) : "\"" + atValue + "\"" ) }; + f.rangeRefs = { c.refs.attrs, c.refs.jsonAttrs }; + f.identity = fromPair( quality::identityDisclosure( basis.healing ) ); + f.scopeDisclosure = fromPair( quality::scopeDisclosure( c.scope, c.part.outOfScope.size(), c.part.scopedOutGating, c.part.foreignAcks.size(), c.diffFileCount ) ); + f.configWarnings = qdCountField( "config-warnings", rep.configDiag.total(), rep.configDiag.total() != 0 ); + f.baselineAbsorbed = qdCountField( "baseline_absorbed", rep.baselineAbsorbed, rep.baselineAbsorbed != 0 ); + f.baselineBadLines = { qdCountField( "baseline_bad_lines", basis.baseSel.sidecarBadLines, basis.baseSel.sidecarBadLines != 0 ).xml, {} }; + f.acksBadLines = { qdCountField( "acks_bad_lines", basis.acksBadLines, basis.acksBadLines != 0 ).xml, {} }; + if( basis.headBasis != nullptr ) + { + f.headBasis = { std::string( " head_basis=\"" ) + basis.headBasis + "\"", std::string( ",\"head_basis\":\"" ) + basis.headBasis + "\"" }; + } + f.declinedCallExcluded = qdCountField( "declined-call-excluded", basis.declinedCallExcluded, basis.declinedCallExcluded != 0 ); + f.valueRefExcluded = qdCountField( "value-ref-excluded", basis.valueRefExcluded, basis.valueRefExcluded != 0 ); + f.kinds = { rep.kd.xml, rep.kd.json }; + f.history = fromPair( quality::historyUnreadDisclosure( basis.historyUnread ) ); + f.ratchet = { quality::ratchetAttrsXml( basis.extras, [ & ]( std::string_view s ) { return std::string( escapeXml( s, esc ) ); } ), + quality::ratchetAttrsJson( basis.extras ) }; + return f; +} + +// COMPUTE — the counts, the rows and every root disclosure of one answer. Prints nothing: its stderr lines are +// emitQdStderrLines'. `staleAcks` are the ledger rows the judged tree no longer supports (the caller computes them, since +// the bare form's snapshot writes the shared tree passes). +QdReport computeQdReport( const QdComparison& c, std::vector staleAcks, const std::string& baselineFile ) +{ + using namespace rw; + QdReport rep{ .c = c, .staleAcks = std::move( staleAcks ) }; // P1.4 — the family now carries THREE whys, and the third is counted SEPARATELY: stale= means // "this ack no longer applies", and a foreign ack applies fine — it is the SESSION that was wrong, // not the target. Merging the rows into one list keeps the two emitters from growing a second loop // each; keeping the COUNTS apart keeps stale= meaning what it has always meant. rep.saRows = rep.staleAcks; - rep.saRows.insert( rep.saRows.end(), j.foreignAcks.begin(), j.foreignAcks.end() ); + rep.saRows.insert( rep.saRows.end(), c.part.foreignAcks.begin(), c.part.foreignAcks.end() ); // M21(a): name the rows the tree can still name, against the SAME tree computeStaleAcks judged // (tree B in the ref-pair form) — naming a stale ack after the working tree would print an identity // the verdict was never computed from. Costs one walk over the judged symbols, and only when there are rows. - quality::stampStaleAckIdentity( rep.saRows, j.judged, j.refPair ? std::string_view( j.refs.target().root ) : std::string_view( j.cfg.rootPath ) ); + quality::stampStaleAckIdentity( rep.saRows, c.judgedIndex, c.refPair ? std::string_view( c.refs.target().root ) : std::string_view( c.cfg.rootPath ) ); - rep.counts = countQdRows( j.basis.regs ); + rep.counts = countQdRows( c.basis.regs ); // H11 — the absorbed-debt stamp on the honored sidecar, or 0. Read ONLY when the sidecar is the floor // in force: on the git-HEAD and ref-pair floors there is no pin whose contents could have absorbed // anything, and printing a 0 there would define an attribute about a file this run did not use. - rep.baselineAbsorbed = ( rep.baseSel().marker == std::string_view( "sidecar" ) ) ? quality::readBaselineAbsorbed( baselineFile ) : 0; + rep.baselineAbsorbed = ( c.basis.baseSel.marker == std::string_view( "sidecar" ) ) ? quality::readBaselineAbsorbed( baselineFile ) : 0; + // F-13 — the .ripwire_config diagnosis. #387: the inert-name test reads the JUDGED tree's index, which in the ref-pair + // form is tree B — the working tree is not indexed there at all (runQualityDeltaRangeBeforeIngest). + // qd-memory-degrade: not over a changed-files index, which cannot tell an inert name from one the tree defines (also_skipped=) + rep.configDiag = c.refs.degraded ? quality::RegisterMacroConfigDiagnostics{} : quality::diagnoseRegisterMacroConfig( c.judgedIndex, c.root ); + // qd-memory-degrade: the kinds this answer did not run, why, and the replay — plus the peak, read once now that the + // comparison is done (kindsDisclosure). + rep.kd = kindsDisclosure( c.cfg, c.refs, c.basis, c.refPair ); + rep.root = qdRootFieldsOf( rep ); + return rep; +} - // R1 IDENTITY — the disclosure, built ONCE for both emitters (quality::identityDisclosure). An ack - // that follows a rename is a claim about identity, and a claim is only honest if the reader can see - // what it rested on; building the XML and JSON halves in one place is what keeps the two surfaces - // from disclosing different things about the same run. - rep.identity = quality::identityDisclosure( j.basis.healing ); - // hwh-fix4 (N1): the history a gating kind could not read, one builder for every emitter (absent when all was read) - rep.history = quality::historyUnreadDisclosure( j.basis.historyUnread ); - if( rep.counts.gating == 0 && j.basis.historyUnread.any() ) +// The human channel's lines of one answer, in the order they have always printed, before stdout is written: a stdout +// answer that is partial, ran past the memory limit or gates says so first on the channel a human reads. +void emitQdStderrLines( const QdReport& rep ) +{ + using namespace rw; + const QdComparison& c = rep.c; + if( std::getenv( "RIPWIRE_STATS" ) ) // QD-ENVOY-TIME cost bound: Type-3 passes this call ran (test/qdtype3oncecheck.sh) + { + rw::emitTo( stderr, "ripwire: quality-passes type3_runs={} type3_pairs={}\n", gType3PassRuns.load( std::memory_order_relaxed ), + gType3PassPairs.load( std::memory_order_relaxed ) ); + } + if( rep.counts.gating == 0 && c.basis.historyUnread.any() ) { rw::emitTo( stderr, "ripwire: --quality-delta: not a clean pass - git history a gating kind needs could not be read ({}; a partial clone " - "does not download it), so a gating row may be missing: exit 6\n", rep.history.first.substr( 1 ).c_str() ); + "does not download it), so a gating row may be missing: exit 6\n", rep.root.history.xml.substr( 1 ).c_str() ); } - - // P1/P1.4 — the scope disclosure, built once for both emitters (quality::scopeDisclosure). - rep.scope = quality::scopeDisclosure( j.scope, j.outOfScope.size(), j.scopedOutGating, j.foreignAcks.size(), j.diffFileCount ); - - // F-13 — the .ripwire_config disclosure, built once for both emitters (see the header comment on - // registerMacroConfigWarningAttr just above runQualityViews for why the stderr wording lives there). - // #387: the inert-name test reads the JUDGED tree's index, which in the ref-pair form is tree B — the working tree - // is not indexed there at all (runQualityDeltaRangeBeforeIngest). - // qd-memory-degrade: not over a changed-files index, which cannot tell an inert name from one the tree defines (also_skipped=) - rep.configDiag = j.refs.degraded ? quality::RegisterMacroConfigDiagnostics{} : quality::diagnoseRegisterMacroConfig( j.judged, j.root ); - rep.configWarnAttr = registerMacroConfigWarningAttr( rep.configDiag ); - // qd-memory-degrade: the kinds this answer did not run, why, and the replay — plus the peak, read once now that the - // comparison is done (kindsDisclosure). Its stderr lines are the caller's to print, first. - rep.kd = kindsDisclosure( j.cfg, j.refs, j.basis, j.refPair ); - rep.deadRan = !j.refPair || quality::kindSelected( j.refs.kinds, "dead-code" ); - return rep; + emitRegisterMacroConfigWarnings( rep.configDiag ); // F-13: the specific keys and names, never guessed at in the attribute + emitMemoryLines( rep.kd, c.refs ); + // P2.5 — one stderr line NAMING the gating finding, in --token-budget's style ("ripwire: --token-budget + // exceeded: est_tokens=… > budget=…"). stdout is the machine artifact and a caller that only checks + // `$?` gets a number with no subject; this puts the WHICH on the channel a human reads, without + // touching the XML contract. Names the first gating row in the already-sorted list (deterministic). + // §A4 (minor): emitted BEFORE the format fork — the line is about the EXIT CODE, which both formats share, so it + // belongs to neither (under --json the fork used to return first, and a script reading `$?` got no subject). + emitQdGatingLine( c.basis.regs, rep.counts.gating, c.basis.deltaRoot ); } // ── the ROW MODEL: one --quality-delta row's printed facts, decided once for the XML and JSON emitters ───────────────── @@ -3021,12 +3123,12 @@ QdRowModel qdRowModel( const rw::quality::Regression& r, bool gatingAllowed, std } // P3 (L7, nextverb.h): a GATING row hands the agent the body to fix — --expand=FILE:NAME (the file-qualified selector, so -// a same-named symbol elsewhere cannot answer). The name is the sym key's last :: segment; duplication rows name a SET -// (members=) and carry no single body to open, nor does a FILE-anchored defect-shape row (top-level code: sym= is the -// path, and --expand=FILE:FILE matches no symbol). Empty when the row offers no body. +// a same-named symbol elsewhere cannot answer). The name is the sym key's last :: segment. Only the sym-carrying shapes ask: +// a Members row (duplication) names a SET and has no single body to open. Nor does a FILE-anchored defect-shape row +// (top-level code: sym= is the path, and --expand=FILE:FILE matches no symbol). Empty when the row offers no body. std::string qdExpandNextAttr( const rw::quality::Regression& r, const QdRowModel& m ) { - if( !m.gating || r.path.empty() || r.kind == "duplication" || ( r.kind == "defect-shape" && r.sym == r.path ) ) + if( !m.gating || r.path.empty() || ( r.kind == "defect-shape" && r.sym == r.path ) ) { return std::string(); } @@ -3134,153 +3236,113 @@ void emitQdJsonRows( std::FILE* out, const std::vector& } } -// REPORT (render half), --json — same regressions, keys mirror the XML attr names (kind/sym/members/tokens/was/now/ -// sev/churn/surface). jsonUnsupportedVerb already refused --quality-baseline/--quality-ack, so reaching here with cfg.json -// means the plain --quality-delta report. Every optional root member follows the XML twin's absent-means-never-happened rule. +// RENDER, --json — same regressions, keys mirror the XML attr names (kind/sym/members/tokens/was/now/sev/churn/surface). +// jsonUnsupportedVerb already refused --quality-baseline/--quality-ack, so reaching here with cfg.json means the plain +// --quality-delta report. Every optional root member is the JSON spelling of a QdRootField. void emitQualityDeltaJson( const QdReport& rep ) { using namespace rw; - const QdJudged& j = rep.j; - const DeltaBasis& basis = j.basis; - // The JSON sibling of the XML at= anchor — "at":null (never a fake sha) on a non-git root, and - // null in the ref-pair form too: the list was not computed "at" any working-tree state, and the - // two refs ARE its anchor. - const std::string atVal = j.refPair ? std::string{} : gitstamp::stampAt( j.root ); - const std::string atJson = atVal.empty() ? std::string( "null" ) : ( "\"" + atVal + "\"" ); - // F-13: config-warnings is the JSON sibling of the XML config-warnings= attribute — omitted - // (never 0) when .ripwire_config carried nothing to disclose. - const std::string configWarnJson = rep.configDiag.total() == 0 ? std::string() : ",\"config-warnings\":" + std::to_string( rep.configDiag.total() ); - // H11: the JSON twin of baseline_absorbed=. - const std::string absorbedJson = rep.baselineAbsorbed == 0 ? std::string() : ",\"baseline_absorbed\":" + std::to_string( rep.baselineAbsorbed ); - // #228: the JSON twin of head_basis=, under the same absent-means-the-ordinary-archived-tree rule. - const std::string headBasisJson = ( basis.headBasis == nullptr ? std::string() : std::string( ",\"head_basis\":\"" ) + basis.headBasis + "\"" ) - + ( basis.declinedCallExcluded == 0 ? std::string() // the XML twin's declined-call-excluded=, absent at zero - : ",\"declined-call-excluded\":" + std::to_string( basis.declinedCallExcluded ) ) - + rw::countFieldOrEmpty( "value-ref-excluded", basis.valueRefExcluded, /*json=*/true ); - // qd-memory-degrade: stale and register-macro-excluded are absent (never 0) when their pass did not run - const std::string staleJ = j.refs.degraded ? std::string() : ",\"stale\":" + std::to_string( rep.staleAcks.size() ); - const std::string rmeJ = rep.deadRan ? ",\"register-macro-excluded\":" + std::to_string( basis.registerMacroExcluded ) : std::string(); - // R-I: refs.jsonAttrs carries the same two shas + unmeasurable-kind disclosure the XML root carries (empty for the bare form). + const QdComparison& c = rep.c; + const DeltaBasis& basis = c.basis; rw::emitTo( stdout, "{{\"baseline\":\"{}\",\"regressions\":{},\"minor\":{},\"acked\":{}{}," - "\"preexisting-worse\":{},\"new-symbol\":{},\"gating\":{}{},\"api-new-surface\":{},\"at\":{}{}{}{}{}{}{}{},\"r\":[", - jsonStr( rep.baseSel().marker ), rep.regs().size(), rep.counts.minor, j.ackedCount, staleJ, - rep.counts.preexisting, rep.counts.newSymbol, rep.counts.gating, rmeJ, basis.apiNewSurface, atJson, j.refs.jsonAttrs, - rep.identity.second, rep.scope.second, configWarnJson, absorbedJson, headBasisJson, - rep.kd.json + rep.history.second + quality::ratchetAttrsJson( basis.extras ) ); - emitQdJsonRows( stdout, rep.regs(), /*gatingAllowed=*/true, rep.deltaRoot() ); + "\"preexisting-worse\":{},\"new-symbol\":{},\"gating\":{}{},\"api-new-surface\":{}{},\"r\":[", + jsonStr( basis.baseSel.marker ), basis.regs.size(), rep.counts.minor, c.part.ackedCount, rep.root.stale.json, + rep.counts.preexisting, rep.counts.newSymbol, rep.counts.gating, rep.root.registerMacroExcluded.json, basis.apiNewSurface, + qdRootTail( rep.root, QdFormat::Json, {} ) ); + emitQdJsonRows( stdout, basis.regs, /*gatingAllowed=*/true, basis.deltaRoot ); rw::emitRaw( stdout, "]," ); - if( j.scope.active() ) + if( c.scope.active() ) { // The JSON sibling of the XML out-of-scope element: a SEPARATE array, never a flag on a row // in "r", so a consumer that reads "r" and checks "gating" cannot accidentally count someone // else's debt as this run's. Emitted (possibly empty) whenever a scope was given, so its // absence means "no scope", never "no disclosed rows". rw::emitRaw( stdout, "\"oos\":[" ); - emitQdJsonRows( stdout, j.outOfScope, /*gatingAllowed=*/false, rep.deltaRoot() ); + emitQdJsonRows( stdout, c.part.outOfScope, /*gatingAllowed=*/false, basis.deltaRoot ); rw::emitRaw( stdout, "]," ); } std::fputs( quality::staleAcksJsonArray( rep.saRows ).c_str(), stdout ); // L2 — "sa":[...], same taxonomy as the XML sa= rows - std::fputs( quality::improvedJson( basis.extras.improved, rep.deltaRoot() ).c_str(), stdout ); // QD-CREDIT-ROW (absent when none) + std::fputs( quality::improvedJson( basis.extras.improved, basis.deltaRoot ).c_str(), stdout ); // QD-CREDIT-ROW (absent when none) rw::emitRaw( stdout, "}" ); } -// 2026-09-06: what the sidecar readers skipped, on the root (absent means none) — see kQdBaseHeadUnreadable — plus the -// #228 head_basis= (present-only: its absence is the ordinary archived HEAD tree) and the dead-code exemption counts. -std::string qdSidecarHealthAttrs( const DeltaBasis& basis ) -{ - std::string out; - if( basis.baseSel.sidecarBadLines > 0 ) { out += " baseline_bad_lines=\"" + std::to_string( basis.baseSel.sidecarBadLines ) + "\""; } - if( basis.acksBadLines > 0 ) { out += " acks_bad_lines=\"" + std::to_string( basis.acksBadLines ) + "\""; } - if( basis.headBasis != nullptr ) { out += std::string( " head_basis=\"" ) + basis.headBasis + "\""; } - if( basis.declinedCallExcluded > 0 ) { out += " declined-call-excluded=\"" + std::to_string( basis.declinedCallExcluded ) + "\""; } - out += rw::countAttrXmlOrEmpty( "value-ref-excluded", basis.valueRefExcluded ); // absent at zero, beside its sibling - return out; -} - -// idea #11 — THE CLEAN-TREE PAYLOAD. A regression-free answer collapses its stale-ack rows to counts (stale= and +// idea #11 — THE CLEAN-TREE PAYLOAD. A regression-free answer folds its stale-ack rows to counts (stale= and // stale_by_kind=), and stale_next= is the call that prints them; on a tree that IS its HEAD (head_basis="identity": the // floor is this tree's own snapshot) with nothing else to disclose, the verdict is the whole answer. Foreign-scope rows are -// never collapsed: they are about findings suppressed RIGHT NOW. --show-stale restores today's document byte for byte, so -// every collapsed row and attribute is one flag away (PROCESS rule 5). `attrs` is empty when the answer does not collapse. -struct QdStaleCollapse +// never folded: they are about findings suppressed RIGHT NOW. --show-stale restores today's document byte for byte, so +// every folded row and attribute is one flag away (PROCESS rule 5). +struct QdStaleFold { - bool collapse = false; - bool verdictOnly = false; // the identity-tree VERDICT: the root line alone - std::string attrs; // stale_by_kind= + stale_next= + bool verdictOnly = false; // the identity-tree VERDICT: the root line alone (qdNothingElseToDisclose) + std::string attrs; // stale_by_kind= + stale_next=, on the folded root }; + // The identity-tree verdict's precondition: a working-tree answer whose floor is this tree's own snapshot // (head_basis="identity") with no scope, foreign or accepted ack, config warning, absorbed debt, new public surface or // unreadable sidecar line to disclose — so the root line alone loses nothing. bool qdNothingElseToDisclose( const QdReport& rep ) { - const QdJudged& j = rep.j; - const DeltaBasis& basis = j.basis; - return !j.refPair && basis.headBasis != nullptr && std::string_view( basis.headBasis ) == "identity" - && !j.scope.active() && j.foreignAcks.empty() && j.ackedCount == 0 && rep.configDiag.total() == 0 && rep.baselineAbsorbed == 0 - && basis.apiNewSurface == 0 && rep.baseSel().sidecarBadLines == 0 && basis.acksBadLines == 0; + const QdComparison& c = rep.c; + const DeltaBasis& basis = c.basis; + return !c.refPair && basis.headBasis != nullptr && std::string_view( basis.headBasis ) == "identity" + && !c.scope.active() && c.part.foreignAcks.empty() && c.part.ackedCount == 0 && rep.configDiag.total() == 0 && rep.baselineAbsorbed == 0 + && basis.apiNewSurface == 0 && basis.baseSel.sidecarBadLines == 0 && basis.acksBadLines == 0; } +// The stale fold this answer could ship (whether it PAYS is emitQualityDeltaXml's to measure), or nullopt when it has a +// regression, an out-of-scope row, no stale ack, or --show-stale. template -QdStaleCollapse qdStaleCollapse( const QdReport& rep, const Escape& ex ) +std::optional qdStaleFold( const QdReport& rep, const Escape& ex ) { using namespace rw; - const QdJudged& j = rep.j; - QdStaleCollapse c; - c.collapse = rep.regs().empty() && j.outOfScope.empty() && !j.cfg.showStale && !rep.staleAcks.empty(); - if( !c.collapse ) + const QdComparison& c = rep.c; + if( !c.basis.regs.empty() || !c.part.outOfScope.empty() || c.cfg.showStale || rep.staleAcks.empty() ) { - return c; + return std::nullopt; } const std::string kinds = quality::staleByKindValue( rep.staleAcks ); // shared with the MCP twin (lane lean2b) - std::string replay = j.cfg.qualityDeltaRange.empty() ? std::string( "--quality-delta" ) : rw::nextFlag( "--quality-delta=", j.cfg.qualityDeltaRange ); - if( j.scope.active() ) + std::string replay = c.cfg.qualityDeltaRange.empty() ? std::string( "--quality-delta" ) : rw::nextFlag( "--quality-delta=", c.cfg.qualityDeltaRange ); + if( c.scope.active() ) { - replay += " " + rw::nextFlag( "--scope=", j.cfg.qualityScope ); + replay += " " + rw::nextFlag( "--scope=", c.cfg.qualityScope ); } - c.attrs = " stale_by_kind=\"" + ex( kinds ) + "\"" + rw::nextAttrXml( replay + " --show-stale", "stale_next" ); - c.verdictOnly = qdNothingElseToDisclose( rep ); - return c; + return QdStaleFold{ .verdictOnly = qdNothingElseToDisclose( rep ), + .attrs = " stale_by_kind=\"" + ex( kinds ) + "\"" + rw::nextAttrXml( replay + " --show-stale", "stale_next" ) }; } // The whole XML document over one FILE*: legend, root, rows, improvements, the out-of-scope disclosure and the rows. -// `collapse` picks the stale rows' form: true serves only the foreign-scope rows and the stale_by_kind=/stale_next= counts. -void emitQdXmlDocument( std::FILE* out, const QdReport& rep, const QdStaleCollapse& stale, const std::string& atAttrs, bool collapse ) +// `fold` null renders every stale row; otherwise only the foreign-scope rows, with fold->attrs on the root. +void emitQdXmlDocument( std::FILE* out, const QdReport& rep, const QdStaleFold* fold ) { using namespace rw; - const QdJudged& j = rep.j; - const DeltaBasis& basis = j.basis; - const RefPairDelta& refs = j.refs; - std::vector esc; - const auto ex = [ & ]( std::string_view s ) -> std::string { return std::string( escapeXml( s, esc ) ); }; - const std::vector& served = collapse ? j.foreignAcks : rep.saRows; + const QdComparison& c = rep.c; + const DeltaBasis& basis = c.basis; + const RefPairDelta& refs = c.refs; + std::vector esc; + const auto ex = [ & ]( std::string_view s ) -> std::string { return std::string( escapeXml( s, esc ) ); }; + const std::vector& served = fold != nullptr ? c.part.foreignAcks : rep.saRows; // the legend is passed the same values the root element below prints, so "the legend defines what the header emits" is // read off one set of values rather than restated as a second condition that could drift from it - emitQualityDeltaLegend( { rep.baseSel().marker, j.refPair, rep.identity.first, !served.empty(), j.ackedCount > 0, - basis.registerMacroExcluded > 0, rep.configDiag.total() > 0, rep.regs(), j.outOfScope, - j.scope.active() || !j.foreignAcks.empty(), !j.foreignAcks.empty(), rep.baselineAbsorbed, - basis.headBasis, basis.declinedCallExcluded > 0, basis.valueRefExcluded > 0, collapse, + emitQualityDeltaLegend( { basis.baseSel.marker, c.refPair, rep.root.identity.xml, !served.empty(), c.part.ackedCount > 0, + basis.registerMacroExcluded > 0, rep.configDiag.total() > 0, basis.regs, c.part.outOfScope, + c.scope.active() || !c.part.foreignAcks.empty(), !c.part.foreignAcks.empty(), rep.baselineAbsorbed, + basis.headBasis, basis.declinedCallExcluded > 0, basis.valueRefExcluded > 0, fold != nullptr, refs.kinds != quality::kAllKinds, refs.degraded, !refs.memoryStop.empty(), rep.kd.peakOver != 0, rep.kd.memorySkipped != 0 && refs.selected != quality::kAllKinds, basis.historyUnread.any(), basis.rustTestExcluded, refs.staleTree, !basis.extras.ratchetRef.empty(), !basis.extras.improved.empty() }, out ); - // qd-memory-degrade: stale= and register-macro-excluded= are absent (never 0) when their pass did not run - const std::string staleX = refs.degraded ? std::string() : " stale=\"" + std::to_string( rep.staleAcks.size() ) + "\""; - const std::string rmeX = rep.deadRan ? " register-macro-excluded=\"" + std::to_string( basis.registerMacroExcluded ) + "\"" : std::string(); - rw::emitTo( out, "", - rep.baseSel().marker, rep.regs().size(), rep.counts.minor, j.ackedCount, staleX, rep.counts.preexisting, rep.counts.newSymbol, rep.counts.gating, - rmeX, basis.apiNewSurface, - // at= anchors this regression list to the commit (+dirty state) it was computed against. R-I: it is - // OMITTED for the ref-pair form rather than stamped with the working tree's sha, which would anchor the - // list to a commit it was not computed from. base_ref= and target_ref= are the anchor there, and they - // carry FULL shas because a wave measurement gets quoted into handoffs where a 9-char prefix is one - // collision from unverifiable. - atAttrs, refs.attrs, rep.identity.first, rep.scope.first, rep.configWarnAttr, rep.baselineAbsorbed == 0 ? std::string() : " baseline_absorbed=\"" + std::to_string( rep.baselineAbsorbed ) + "\"", - qdSidecarHealthAttrs( basis ) + ( collapse ? stale.attrs : std::string() ) + rep.kd.xml + rep.history.first + quality::ratchetAttrsXml( basis.extras, ex ) ); - for( const quality::Regression& r : rep.regs() ) - { - emitQdXmlRow( out, r, qdRowModel( r, /*gatingAllowed=*/true, rep.deltaRoot() ), ex ); - } - std::fputs( quality::improvedXml( basis.extras.improved, rep.deltaRoot(), ex ).c_str(), out ); // QD-CREDIT-ROW: never a row, never gating - if( j.scope.active() ) + // at= anchors this regression list to the commit (+dirty state) it was computed against (QdRootFields::at). R-I: the range + // form's base_ref= and target_ref= carry FULL shas because a wave measurement gets quoted into handoffs where a 9-char + // prefix is one collision from unverifiable. + rw::emitTo( out, "", + basis.baseSel.marker, basis.regs.size(), rep.counts.minor, c.part.ackedCount, rep.root.stale.xml, rep.counts.preexisting, + rep.counts.newSymbol, rep.counts.gating, rep.root.registerMacroExcluded.xml, basis.apiNewSurface, + qdRootTail( rep.root, QdFormat::Xml, fold != nullptr ? std::string_view( fold->attrs ) : std::string_view() ) ); + for( const quality::Regression& r : basis.regs ) + { + emitQdXmlRow( out, r, qdRowModel( r, /*gatingAllowed=*/true, basis.deltaRoot ), ex ); + } + std::fputs( quality::improvedXml( basis.extras.improved, basis.deltaRoot, ex ).c_str(), out ); // QD-CREDIT-ROW: never a row, never gating + if( c.scope.active() ) { // P1 — the DISCLOSURE half. Dropping these rows would make a scoped report a quieter lie than // the unscoped one it replaces: the debt is real, it is in the same tree, and it will be in @@ -3289,10 +3351,10 @@ void emitQdXmlDocument( std::FILE* out, const QdReport& rep, const QdStaleCollap // element then means "no scope was given", never "nobody else has anything open". rw::emitTo( out, "", - j.outOfScope.size(), j.scopedOutGating ); - for( const quality::Regression& r : j.outOfScope ) + c.part.outOfScope.size(), c.part.scopedOutGating ); + for( const quality::Regression& r : c.part.outOfScope ) { - emitQdXmlRow( out, r, qdRowModel( r, /*gatingAllowed=*/false, rep.deltaRoot() ), ex ); + emitQdXmlRow( out, r, qdRowModel( r, /*gatingAllowed=*/false, basis.deltaRoot ), ex ); } rw::emitRaw( out, "" ); } @@ -3303,8 +3365,8 @@ void emitQdXmlDocument( std::FILE* out, const QdReport& rep, const QdStaleCollap rw::emitRaw( out, "" ); } -// The identity-tree VERDICT (QdStaleCollapse::verdictOnly): the root line alone. -void emitQdVerdict( std::FILE* out, const QdReport& rep, const QdStaleCollapse& stale, const std::string& atAttrs ) +// The identity-tree VERDICT (QdStaleFold::verdictOnly): the root line alone. +void emitQdVerdict( std::FILE* out, const QdReport& rep, const QdStaleFold& fold ) { rw::emitTo( out, "" "", - rep.baseSel().marker, rep.staleAcks.size(), atAttrs, stale.attrs ); + rep.c.basis.baseSel.marker, rep.staleAcks.size(), rep.root.at.xml, fold.attrs ); } -// REPORT (render half), XML. +// RENDER, XML. // §B7.1 (CA4) — the heading used to open "only what changed for the WORSE vs .ripwire_quality_baseline", which is FALSE in // every state but one: three of the five floors this verb can use are not that file, and in one of them the file was judged // stale and DELETED from the user's tree during this very run. The floor actually used is named by baseline= on the root, @@ -3329,25 +3391,23 @@ void emitQdVerdict( std::FILE* out, const QdReport& rep, const QdStaleCollapse& void emitQualityDeltaXml( const QdReport& rep ) { using namespace rw; - std::vector esc; - const QdStaleCollapse stale = qdStaleCollapse( rep, [ & ]( std::string_view s ) -> std::string { return std::string( escapeXml( s, esc ) ); } ); - // R-I: at= is OMITTED for the ref-pair form (see the root). Read ONCE: both candidates print the same stamp. - const std::string atAttrs = rep.j.refPair ? std::string() : gitstamp::atAttr( rep.j.root ); - if( !stale.collapse ) + std::vector esc; + const std::optional fold = qdStaleFold( rep, [ & ]( std::string_view s ) -> std::string { return std::string( escapeXml( s, esc ) ); } ); + if( !fold ) { - emitQdXmlDocument( stdout, rep, stale, atAttrs, /*collapse=*/false ); + emitQdXmlDocument( stdout, rep, /*fold=*/nullptr ); return; } - const Rendered full = renderToString( [ & ]( std::FILE* f ) { emitQdXmlDocument( f, rep, stale, atAttrs, /*collapse=*/false ); } ); + const Rendered full = renderToString( [ & ]( std::FILE* f ) { emitQdXmlDocument( f, rep, /*fold=*/nullptr ); } ); const Rendered folded = renderToString( [ & ]( std::FILE* f ) { - if( stale.verdictOnly ) { emitQdVerdict( f, rep, stale, atAttrs ); } - else { emitQdXmlDocument( f, rep, stale, atAttrs, /*collapse=*/true ); } + if( fold->verdictOnly ) { emitQdVerdict( f, rep, *fold ); } + else { emitQdXmlDocument( f, rep, &*fold ); } } ); if( !full.ok || !folded.ok ) { // renderToString DISCLOSEd the failed buffer; the full document is the superset, written straight to stdout - emitQdXmlDocument( stdout, rep, stale, atAttrs, /*collapse=*/false ); + emitQdXmlDocument( stdout, rep, /*fold=*/nullptr ); return; } const std::string& chosen = foldPays( folded.text, full.text ) ? folded.text : full.text; // compactlegend.h: the margin and why @@ -3357,8 +3417,9 @@ void emitQualityDeltaXml( const QdReport& rep ) // --quality-baseline / --quality-delta (the convergence-loop oracle): snapshot ccx + clone groups + dead candidates to // .ripwire_quality_baseline; then report ONLY what a change made WORSE vs it. The "delta not absolute" discipline — a refine // loop targets the regression it introduced, not absolute numbers (the defense against metric-gaming). exit 2 if any new -// debt, like --arch. The phases: resolve the floor and the delta (resolveDeltaBasis), JUDGE (judgeQualityDelta), then -// either WRITE ACKS (runQualityAckWrite) or REPORT (qdReportOf, then the JSON or XML rendering). +// debt, like --arch. The phases: resolve the floor and the delta (resolveDeltaBasis), the scope and the ack ratchet +// (applyScopeAndAcks), then either WRITE ACKS (runQualityAckWrite) or COMPUTE the report (computeQdReport), print its +// stderr lines (emitQdStderrLines) and RENDER it as JSON or XML. std::optional runQualityDelta( const MainDispatch& d ) { using namespace rw; @@ -3424,7 +3485,7 @@ std::optional runQualityDelta( const MainDispatch& d ) } // `refs` is declared HERE because it owns both materialized trees' teardown and they must outlive every read of the - // delta (QdJudged's header). + // delta (QdComparison's header). RefPairDelta refs; DeltaBasis basis; if( const std::optional refused = applyKindSelector( cfg, refs ) ) @@ -3435,29 +3496,40 @@ std::optional runQualityDelta( const MainDispatch& d ) { return refused; } - const bool refPair = !cfg.qualityDeltaRange.empty(); - QdJudged judged{ .cfg = cfg, .root = d.root, .refs = refs, .basis = basis, .refPair = refPair, .judged = refPair ? refs.target().ing : d.ing, - .workingGraph = d.g }; - if( const std::optional refused = judgeQualityDelta( judged ) ) + const bool refPair = !cfg.qualityDeltaRange.empty(); + const IngestResult& judgedIndex = refPair ? refs.target().ing : d.ing; // the JUDGED tree's index: tree B in the range form + + // ── P1 SCOPE — the OWNERSHIP partition for a working tree with several writers in it ───────────── + quality::Scope scope = quality::parseScope( cfg.qualityScope ); + std::size_t diffFileCount = 0; // P1.2: 0 = the reserved diff token was not used + if( const std::optional refused = expandScopeDiff( scope, refPair, judgedIndex, d.root, basis.deltaRoot, diffFileCount ) ) { return refused; } - if( cfg.qualityAck ) + if( const std::optional refused = refuseUnusableScope( cfg, scope, judgedIndex, basis.deltaRoot, refs.scopeFiles() ) ) { - return runQualityAckWrite( judged, acksFile ); + return refused; } - - const QdReport report = qdReportOf( judged, baselineFile ); - // the stderr lines of a partial or over-the-limit answer come first: it says so on the channel a human reads before - // anything else - emitMemoryLines( report.kd, refs ); - // P2.5 — one stderr line NAMING the gating finding, in --token-budget's style ("ripwire: --token-budget - // exceeded: est_tokens=… > budget=…"). stdout is the machine artifact and a caller that only checks - // `$?` gets a number with no subject; this puts the WHICH on the channel a human reads, without - // touching the XML contract. Names the first gating row in the already-sorted list (deterministic). - // §A4 (minor): emitted BEFORE the format fork — the line is about the EXIT CODE, which both formats share, so it - // belongs to neither (under --json the fork used to return first, and a script reading `$?` got no subject). - emitQdGatingLine( report.regs(), report.counts.gating, report.deltaRoot() ); + const QdPartition part = applyScopeAndAcks( scope, basis ); + if( cfg.qualityAck ) + { + return runQualityAckWrite( cfg, scope, part, basis, acksFile ); + } + + // L2 — stale-ack disclosure (rationale: quality.h's computeStaleAcks). Checked against the CURRENT tree, not the baseline, + // so it costs one more computeSnapshot; skipped when the ledger is empty. Reported, never gated — the exit code reads the + // rows alone. R-I: "the CURRENT tree" is the JUDGED tree, which in the range form is tree B — checking the ledger against + // the working tree there would report acks as stale because of edits that have nothing to do with the comparison. + // qd-memory-degrade: refPairStaleAcks owns the two range-form departures (a changed-files answer judges none; a kind + // selection judges its own kinds' acks only). The bare form's snapshot is the working tree's own (d.ing, d.g) and reuses + // the clone and construct passes the delta already ran (QD-IDENTITY-ONCE), so it writes basis.passes — here, in view. + std::vector staleAcks = basis.acks.empty() ? std::vector{} + : refPair ? refPairStaleAcks( basis.acks, refs ) + : quality::computeStaleAcks( basis.acks, quality::computeSnapshot( d.ing, d.g, cfg.rootPath, nullptr, {}, &basis.passes ) ); + const QdComparison comparison{ .cfg = cfg, .root = d.root, .refs = refs, .basis = basis, .scope = scope, .part = part, + .judgedIndex = judgedIndex, .refPair = refPair, .diffFileCount = diffFileCount }; + const QdReport report = computeQdReport( comparison, std::move( staleAcks ), baselineFile ); + emitQdStderrLines( report ); if( cfg.json ) { emitQualityDeltaJson( report ); From 2d1a6f95da4570e534930b7be0402bcd6897f3f6 Mon Sep 17 00:00:00 2001 From: joyful-ii-V-I <210578314+joyful-ii-V-I@users.noreply.github.com> Date: Sat, 21 Nov 2026 16:55:13 -0500 Subject: [PATCH 03/44] refactor(quality): qdCountField reuses rw::countField countFieldOrEmpty's spelling moves into an always-present sibling, countField, so qd's root count disclosures (present at 0) share it instead of cloning the format. No output change. Co-Authored-By: Claude Opus 5.5 --- src/graphlegend.h | 11 ++++++----- src/verbs_quality.h | 9 ++------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/graphlegend.h b/src/graphlegend.h index f32e39e1f..954c7b701 100644 --- a/src/graphlegend.h +++ b/src/graphlegend.h @@ -888,15 +888,16 @@ inline const char* toValueRefsLegend( bool on ) noexcept { return on ? kToValueR // --skipped's extent_suspect_files=/macro_blanked_files= (root) and extent_suspect_syms=/macro_blanked= ( rows) // all spell through it, so the shape has one definition instead of a copy per verb. // `json` spells the same count as a key instead: `,"name":N` (imports_unresolved= is the one caller today). -inline std::string countFieldOrEmpty( std::string_view name, std::size_t count, bool json ) +// countField is the same spelling for a count that is present even at 0 (a pass that ran and found none). +inline std::string countField( std::string_view name, std::size_t count, bool json ) { - if( count == 0 ) - { - return {}; - } const std::string n = std::to_string( count ); return json ? ",\"" + std::string( name ) + "\":" + n : " " + std::string( name ) + "=\"" + n + "\""; } +inline std::string countFieldOrEmpty( std::string_view name, std::size_t count, bool json ) +{ + return count == 0 ? std::string() : countField( name, count, json ); +} inline std::string countAttrXmlOrEmpty( std::string_view name, std::size_t count ) { return countFieldOrEmpty( name, count, /*json=*/false ); diff --git a/src/verbs_quality.h b/src/verbs_quality.h index 102f96b39..2e496932f 100644 --- a/src/verbs_quality.h +++ b/src/verbs_quality.h @@ -2919,15 +2919,10 @@ struct QdRootField const std::string& in( QdFormat format ) const noexcept { return format == QdFormat::Xml ? xml : json; } }; -// A count as a root disclosure: ` name="N"` / `,"name":N` when `present`, else absent. +// A count as a root disclosure: ` name="N"` / `,"name":N` (rw::countField) when `present`, else absent. QdRootField qdCountField( std::string_view name, std::size_t count, bool present ) { - if( !present ) - { - return {}; - } - const std::string n = std::to_string( count ); - return { " " + std::string( name ) + "=\"" + n + "\"", ",\"" + std::string( name ) + "\":" + n }; + return present ? QdRootField{ rw::countField( name, count, /*json=*/false ), rw::countField( name, count, /*json=*/true ) } : QdRootField{}; } // Every root disclosure, each built once (qdRootFieldsOf). `stale` and `registerMacroExcluded` sit between the fixed From 6abf83cf4151a1119e17c90ca8d603f62a4e138c Mon Sep 17 00:00:00 2001 From: joyful-ii-V-I <210578314+joyful-ii-V-I@users.noreply.github.com> Date: Sat, 21 Nov 2026 18:06:37 -0500 Subject: [PATCH 04/44] qd tangle: rule (b) gates; the ratchet reads the range base (TANGLE-GATE-B, QD-RATCHET-BASE) Owner 11-21 (tangle re-census): a new function at or over tangle 6, or one that crossed the bar, now GATES (not a moved body, not test code: the census's harness mains were its false class). A new-symbol tangle row that is major gates in rowGates, and the stderr gating line names it. QD-RATCHET-BASE: a function over the bar at the range base whose score is higher now (a tenth is enough) is a ratchet row, report-only in this commit. The tag-best compare (D4) no longer makes rows of its own: it adds ratchet="TAG" and "best since TAG" to rows the base made. Replay 11-21: its four own rows were functions the change did not grow (buildGraph in #706/#714, serialize in #705, captureTagsFacts 29.2 -> 29.1 in #714). tanglecheck: t1/b1/b3 (rule (b) gating, red on main), b2 (test code stays minor), k1 (grow1: a ratchet row under the rise step, red on main), k2/k3 (reflow same tenth, settle fell: no row; both rowed on main), r1 reads was= as HEAD's score. Fixture creep/nudge fold into one generator (byte-identical files). Co-Authored-By: Claude Opus 5.5 --- src/cli.h | 8 +-- src/compactlegend.h | 2 +- src/mcp.h | 2 +- src/quality.h | 138 +++++++++++++++++++++++-------------- src/verbs_quality.h | 40 +++++++---- test/lib/tanglefixtures.py | 49 ++++++++----- test/tanglecheck.sh | 73 ++++++++++++++++---- 7 files changed, 209 insertions(+), 103 deletions(-) diff --git a/src/cli.h b/src/cli.h index 64d41f16b..8c207d461 100644 --- a/src/cli.h +++ b/src/cli.h @@ -1882,12 +1882,12 @@ inline constexpr char kHelpHead[] = " — a regression-free answer keeps only stale= and stale_by_kind= (its rows collapsed), and on a tree\n" " that IS its HEAD only the verdict; either fold only when it saves a quarter of the bytes. Refused alone.\n" " --quality-delta before a PR: report ONLY what your change made worse, across 13 kinds\n" - " — pair with --test-gate. Each kind is measured against the baseline (complexity/verbosity/nesting/params/dup/dead/api-surface + error-masking/short-horizon-churn/new-clone-of-reused-helper + placeholder + defect-shape + tangle, report-only);\n" + " — pair with --test-gate. Each kind is measured against the baseline (complexity/verbosity/nesting/params/dup/dead/api-surface + error-masking/short-horizon-churn/new-clone-of-reused-helper + placeholder + defect-shape + tangle);\n" " every finding is classified by ORIGIN: a symbol that EXISTED at the baseline and got worse (preexisting-worse=\"N\", no attribute on the row) vs one that exists only\n" " because the code is NEW (new-symbol=\"N\", origin=\"new-symbol\" on the row). A small numeric delta is additionally sev=\"minor\". EXIT 2 ONLY on a major AND unacked row that is\n" - " preexisting-worse, defect-shape format-arity (any origin) or a new function at the ceiling — the gating=\"N\" header count. New-symbol rows are still PRINTED (they are the debt you are adding — read them);\n" - " new-symbol rows never gate, except defect-shape format-arity and a new function at the ceiling (4x the bar: ccx 60 or 240 lines,\n" - " not a moved body, not test code, ceiling= on the row); exit 0 means\n" + " preexisting-worse, defect-shape format-arity (any origin), a new function at the ceiling or a tangled new one — the gating=\"N\" header count. New-symbol rows are still PRINTED (they are the debt you are adding — read them);\n" + " new-symbol rows never gate, except defect-shape format-arity, a new function at the ceiling (4x the bar: ccx 60 or 240 lines,\n" + " not a moved body, not test code, ceiling= on the row) and a new one at tangle 6 or more (not moved, not test code); exit 0 means\n" " \"nothing that already existed got worse\", not \"clean\". Clone kinds classify by member set (new-symbol only if EVERY member is new); short-horizon-churn is preexisting\n" " by construction. LIMIT: origin is canonId (path::scope::name) identity; a function RENAMED or MOVED with its body unchanged (whitespace and its own name aside: one body that left its key, matched to one new key) keeps its identity and the move reports nothing (and a file rename git recorded keeps each symbol in it under its own name, twins and changed bodies included), while one whose body also changed reads as new and a regression carried in with it will not gate;\n" " a function over the ccx or line bar whose body moved with a small edit (a clone-sketch match to a body that left its key) reads origin=\"moved\" and never gates.\n" diff --git a/src/compactlegend.h b/src/compactlegend.h index 3fc39ecdf..8a172f674 100644 --- a/src/compactlegend.h +++ b/src/compactlegend.h @@ -1059,7 +1059,7 @@ inline constexpr CompactCompletenessTerm kCompactAttributeReadings[] = // D4 (src/quality.h ratchetAttrsXml): present when the tangle ratchet read its reference point { "ratchet_ref", "ratchet_ref=TAG ratchet_judged=N: the ratchet compared N touched over-bar functions with their best since TAG; ratchet_unread= / ratchet_cut=1: versions not measured", false, "quality-delta", MapHeaderRead::No, {}, "quality-delta" }, { "preexisting-worse", "preexisting-worse=N: regressions on symbols that existed at baseline; they gate when major", false, "quality-delta", MapHeaderRead::No, {}, "quality-delta" }, - { "new-symbol", "new-symbol=N: NEW code; new-symbol rows never gate, except defect-shape format-arity or a ceiling= row", false, "quality-delta", MapHeaderRead::No, {}, "quality-delta" }, + { "new-symbol", "new-symbol=N: NEW code; new-symbol rows never gate, except defect-shape format-arity, a ceiling= row or a tangle row", false, "quality-delta", MapHeaderRead::No, {}, "quality-delta" }, { "register-macro-excluded", "register-macro-excluded=N: symbols skipped: self-registering test/bench macros or Rust #[test]; a floor", false, "quality-delta", MapHeaderRead::No, {}, "quality-delta" }, { "declined-call-excluded", "declined-call-excluded=N: symbols kept out of dead-code only because a declined call may mean them; a floor", false, "quality-delta", MapHeaderRead::No, {}, "quality-delta" }, { "api-new-surface", "api-new-surface=N: new PUBLIC symbols; a count, never gates, not in regressions=", false, "quality-delta", MapHeaderRead::No, {}, "quality-delta" }, diff --git a/src/mcp.h b/src/mcp.h index c3b33c7ed..b8cf0421d 100644 --- a/src/mcp.h +++ b/src/mcp.h @@ -1378,7 +1378,7 @@ inline McpDispatchResult dispatchMcpLine( const std::string& line, int topK, boo // paraphrased — this stanza used to describe an ordering the selector does not use. "{\"name\":\"exemplar\",\"description\":\"BEFORE writing a function / method / class / struct / interface / variable, get the repo's single best-in-class instance of that kind to imitate — signature AND full body. " + std::string( kExemplarSelectionRule ) + ". Beats grep/find_symbol: those find A definition, this ranks every definition and returns the one worth copying. kind = fn|method|class|struct|iface|var, OR a task string (its top match's kind is used).\"," + mcprefuse::toolMetadataFor( "exemplar", pathIsRequired ) + "}," - "{\"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, across 13 kinds (complexity, verbosity, nesting, params, new duplication/dead code/public API, error-masking, short-horizon churn, new helper clone, a stub/TODO, a defect shape, a tangle). new-symbol rows never gate, except defect-shape format-arity and a new function at the ceiling. Read-only; compares vs git HEAD or a pinned .ripwire_quality_baseline sidecar when fresh. sev=minor does not gate; acked findings stay hidden until worse. at= is the commit compared at (+dirty: tree differed).\"," + "{\"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, across 13 kinds (complexity, verbosity, nesting, params, new duplication/dead code/public API, error-masking, short-horizon churn, new helper clone, a stub/TODO, a defect shape, a tangle). new-symbol rows never gate, except defect-shape format-arity, a new function at the ceiling and a tangled new function. Read-only; compares vs git HEAD or a pinned .ripwire_quality_baseline sidecar when fresh. sev=minor does not gate; acked findings stay hidden until worse. at= is the commit compared at (+dirty: tree differed).\"," + mcprefuse::toolMetadataFor( "quality_delta", pathIsRequired ) + "}," "{\"name\":\"quality_baseline\",\"description\":\"PIN the quality floor: writes .ripwire_quality_baseline stamped with the current git HEAD sha, snapshotting complexity / duplication / dead-code / API surface. Call once at the start of non-trivial work, then quality_delta compares against this pinned floor instead of HEAD. Side-effecting (writes a file) — skip it for a simple 'before I push' check, quality_delta already compares vs HEAD with zero setup.\"," + mcprefuse::toolMetadataFor( "quality_baseline", pathIsRequired ) + "}," diff --git a/src/quality.h b/src/quality.h index 8da39dc01..5540741a8 100644 --- a/src/quality.h +++ b/src/quality.h @@ -8323,9 +8323,12 @@ inline std::string rowValueText( const Regression& r, std::uint32_t v ) return metricValueText( r.kind, v ); } +// A new-symbol tangle row is major only under rule (b) (tangleCauseGates: a new function at or over the bar, not moved, not +// test code), so a major one gates like a ceiling row (QD-LESSONS-2, owner 11-21). inline bool rowGates( const Regression& r ) noexcept { - return !r.isMinor && ( !r.isNewSymbol || r.ceiling != 0 || ( r.kind == "defect-shape" && r.facet == defectshape::facetName( defectshape::Facet::FormatArity ) ) ); + return !r.isMinor + && ( !r.isNewSymbol || r.ceiling != 0 || r.kind == "tangle" || ( r.kind == "defect-shape" && r.facet == defectshape::facetName( defectshape::Facet::FormatArity ) ) ); } // B10.2 — kind → the ATTRIBUTE NAME its facet value is emitted under. `Regression::facet` carries only the @@ -11379,14 +11382,15 @@ inline std::uint32_t newSymbolCeilingGate( const Regression& r, SymKind measured return gates ? ceilingAt : 0; } -// ─── QD-TANGLE — the thirteenth kind, REPORT-ONLY (STAGE0 2; owner 11-19: length amplifies tangle, never stands alone) ─────────── +// ─── QD-TANGLE — the thirteenth kind (STAGE0 2; owner 11-19: length amplifies tangle, never stands alone; 11-21: rule (b) gates) ─ // // A row when a function's tangle score (model.h tangleScore10) is at or over the bar (S >= 6) AND the change made it so: the function -// is new, it crossed the bar, or an input rose — nesting +1, deep lines +kTangleDeepRise, or a new steering local. The trigger reads -// the INPUTS, not the score, on purpose: the score is a share, so 12 deep lines added to a 4000-line function move it a tenth, and a -// score trigger would let a monster grow forever (QD-MONSTER-GROWTH's lesson). Every row is sev="minor" and never gates in this -// stage; why= names the inputs that rose, fix= the shape the rise calls for (with its lines, from a re-walk of the ONE function: -// tangleDetailOf), locals= the steering locals. A long orchestrator of named steps or a long flat body scores 0 and never rows. +// is new, it crossed the bar, its score grew against the range base while over the bar (the RATCHET, QD-RATCHET-BASE), or an input +// rose — nesting +1, deep lines +kTangleDeepRise, or a new steering local. Rows on the score's growth catch a monster growing by a +// tenth per change (12 deep lines in a 4000-line function), which a size floor would let grow forever (QD-MONSTER-GROWTH's lesson). +// A new function or a crossing GATES (rule (b), owner 11-21: tangleCauseGates); every other row is sev="minor". why= names the +// inputs that changed, fix= the shape the rise calls for (with its lines, from a re-walk of the ONE function: tangleDetailOf), +// locals= the steering locals. A long orchestrator of named steps or a long flat body scores 0 and never rows. inline constexpr std::uint32_t kTangleDeepRise = 5; // deep lines that count as a rise (STAGE0 2.5's "worse" tier) struct TangleRise @@ -11532,6 +11536,48 @@ struct TangleDetailReader } }; +// What made a row over the bar (QD-LESSONS-2, owner 11-21): the function is new or crossed the bar (rule (b)); already over it, +// its score grew against the range base (the RATCHET, QD-RATCHET-BASE); or an input rose by the rise rule while the score did +// not grow. The caller has already left out a function under the bar now. +enum class TangleCause : std::uint8_t +{ + None, // over the bar before and after, the score did not grow and nothing rose: no row + New, // a new function at or over the bar + Crossed, // under the bar at the baseline, at or over it now + Grew, // over the bar at the baseline and the score is higher now (a tenth is enough: log-length scaling keeps steps small) + Rose, // over the bar at the baseline, the score not higher, an input rose (nest +1, deep +kTangleDeepRise, a steering local) +}; +inline TangleCause tangleCauseOf( bool isNew, std::uint32_t was10, std::uint32_t now10, const TangleRise& rise ) noexcept +{ + if( isNew ) + { + return TangleCause::New; + } + if( was10 < kTangleBar10 ) + { + return TangleCause::Crossed; + } + if( now10 > was10 ) + { + return TangleCause::Grew; + } + return rise.any() ? TangleCause::Rose : TangleCause::None; +} + +// The inputs that grew at all (the fix= reading of a ratchet row, whose growth can be under the rise rule's steps). +inline TangleRise tangleGrowth( const TangleInputs& was, const TangleInputs& now ) noexcept +{ + return { now.nest > was.nest, now.deep > was.deep, now.steer > was.steer }; +} + +// Rule (b): a new function at or over the bar, or one that crossed it, GATES — except a moved body (its code is not new; the +// re-census found no such row) and test code (the census's test-harness mains were its false class, and QD-ENTRY-CEILING exempts +// test drivers the same way). A ratchet row or a row of a rising input stays sev="minor". `rel` = the root-relative path. +inline bool tangleCauseGates( TangleCause cause, bool moved, std::string_view rel ) noexcept +{ + return ( cause == TangleCause::New || cause == TangleCause::Crossed ) && !moved && !isTestPath( rel ); +} + // QD-CREDIT-ROW for tangle (STAGE0 2.5): over the bar at the baseline, an input fell by the rise rule (tangleRise read backwards) and none rose, and the score is lower. inline bool tangleCredited( const TangleInputs& was, const TangleInputs& now ) noexcept { @@ -11540,19 +11586,18 @@ inline bool tangleCredited( const TangleInputs& was, const TangleInputs& now ) n return tangleScore10( was ) >= kTangleBar10 && tangleRise( now, was ).any() && !tangleRise( was, now ).any() && tangleScore10( now ) < tangleScore10( was ); } -// D4 RATCHET (report-only): each `ratchetable` key — over the bar now, existing at the baseline, inputs moved by this change — against its -// best since the reference point (extras.bestSince over those keys' files only). It fires when the score is above its best AND an input -// rose over its minimum by the same rise rule the baseline row uses (nest +1 past the free levels, deep +kTangleDeepRise, a new steering -// local): a function that crept up across merges, each step under the rise rule, is named once it has crept that far. On a key this -// pass already rowed, the ratchet adds its facet (ratchet="") and its reading to why=; otherwise it is a row of its own, was= the -// best score. A key the history never held (created in this working tree) is not judged. -template -inline void appendTangleRatchet( std::vector& regs, const IngestResult& ing, const Graph& g, - const std::vector>& ratchetable, const gtl::btree_map& rowOfKey, - TangleDetailReader& detailOf, Stamp&& stamp, std::string_view root, DeltaExtras& extras ) +// D4 (QD-RATCHET-BASE: a facet, never a row of its own): each tangle row on a function that existed at the baseline, against its best +// since the reference point (extras.bestSince over those rows' files only). When the score is above that best AND an input rose over +// its minimum by the rise rule, the row gets ratchet="" and why= adds "best since : ...": the context of a function that +// crept up across merges. Whether a function is judged at all is the range base's question (tangleCauseOf); replay 11-21: four of the +// nine rows the tag-best compare made on its own were functions this change did not grow (buildGraph twice, serialize, and a +// captureTagsFacts that fell 29.2 -> 29.1). A key the history never held (created after the tag) is not judged. +inline void appendTangleRatchet( std::vector& regs, const IngestResult& ing, + const std::vector>& rowed, const gtl::btree_map& rowOfKey, + std::string_view root, DeltaExtras& extras ) { std::vector paths; - for( const auto& [ key, nowOfKey ] : ratchetable ) + for( const auto& [ key, nowOfKey ] : rowed ) { paths.emplace_back( relForHash( ing.files[ ing.symbols[ nowOfKey->at ].fileId ], root ) ); } @@ -11565,37 +11610,23 @@ inline void appendTangleRatchet( std::vector& regs, const IngestResu { return; } - for( const auto& [ key, nowOfKey ] : ratchetable ) + for( const auto& [ key, nowOfKey ] : rowed ) { const BestSinceRow* row = store.find( key ); - if( row == nullptr ) + const auto at = rowOfKey.find( key ); + if( row == nullptr || at == rowOfKey.end() ) { continue; } ++extras.ratchetJudged; - const TangleNow& now = *nowOfKey; - const TangleBest best = unpackTangleBest( row->value ); - const std::uint32_t now10 = tangleScore10( now.in ); - const TangleRise rise = tangleRise( best.minima, now.in ); - if( now10 <= best.score10 || !rise.any() ) - { - continue; - } - const std::string since = "best since " + store.ref + ": " + tangleWhy( best.minima, now.in, /*isNew=*/false ); - if( const auto it = rowOfKey.find( key ); it != rowOfKey.end() ) + const TangleBest best = unpackTangleBest( row->value ); + if( tangleScore10( nowOfKey->in ) <= best.score10 || !tangleRise( best.minima, nowOfKey->in ).any() ) { - Regression& r = regs[ it->second ]; - r.facet = store.ref; - r.why += "; " + since; continue; } - const TangleDetailFacts detail = detailOf.of( ing.symbols[ now.at ] ); - Regression r{ "tangle", g.canonId[ now.at ], best.score10, now10, key, /*isMinor=*/true, store.ref, /*isNewSymbol=*/false, /*isMoved=*/false }; - r.why = since; - r.fix = tangleFix( rise, /*isNew=*/false, now.in, detail ); - r.locals = tangleLocals( detail ); - regs.push_back( std::move( r ) ); - stamp( now.at ); + Regression& r = regs[ at->second ]; + r.facet = store.ref; + r.why += "; best since " + store.ref + ": " + tangleWhy( best.minima, nowOfKey->in, /*isNew=*/false ); } } @@ -11824,7 +11855,7 @@ inline void appendRepeatedDecisionFixes( std::vector& regs, const In // The rows, appended to `regs` (stamped by the caller's `stamp( NodeId )`). `existed` and `movedAt` are computeDelta's own origin // oracles, so a tangle row's origin= reads exactly as every other per-symbol kind's. With `extras`, also the tangle credits and the -// D4 ratchet (appendTangleRatchet). +// D4 facet on the rows (appendTangleRatchet). // Judged only when the kind is selected and against a floor that recorded the tangle inputs — an older sidecar or blob has none, and // reading every function as new would bury the answer in rows that are not about this change. template @@ -11839,7 +11870,7 @@ inline void appendTangleRows( std::vector& regs, const IngestResult& const gtl::btree_map nowByKey = tangleNowByKey( ing, g, keyByNode ); TangleDetailReader detailOf{ ing }; gtl::btree_map rowOfKey; // the row this pass emitted for a key (the ratchet adds its facet there) - std::vector> ratchetable; // over the bar, existed, and the change moved its inputs (key, its nowByKey entry) + std::vector> rowed; // the rows on functions that existed at the baseline (D4 reads their history) for( const auto& [ key, best ] : nowByKey ) { const bool isNew = !existed( key ); @@ -11854,27 +11885,30 @@ inline void appendTangleRows( std::vector& regs, const IngestResult& { continue; // under the bar now: no row, whatever it was } - if( !isNew && packTangle( was ) != packTangle( best.in ) ) - { - ratchetable.emplace_back( key, &best ); - } - const TangleRise rise = tangleRise( was, best.in ); - if( !isNew && was10 >= kTangleBar10 && !rise.any() ) + const TangleRise rise = tangleRise( was, best.in ); + const TangleCause cause = tangleCauseOf( isNew, was10, now10, rise ); + if( cause == TangleCause::None ) { continue; // already over the bar and nothing rose: the change did not make it so } + const bool moved = isNew && movedAt( best.at ); + const bool gates = tangleCauseGates( cause, moved, relForHash( ing.files[ ing.symbols[ best.at ].fileId ], root ) ); const TangleDetailFacts detail = detailOf.of( ing.symbols[ best.at ] ); - Regression r{ "tangle", g.canonId[ best.at ], isNew ? 0u : was10, now10, key, /*isMinor=*/true, {}, isNew, isNew && movedAt( best.at ) }; + Regression r{ "tangle", g.canonId[ best.at ], isNew ? 0u : was10, now10, key, /*isMinor=*/!gates, {}, isNew, moved }; r.why = tangleWhy( was, best.in, isNew ); - r.fix = tangleFix( rise, isNew, best.in, detail ); + r.fix = tangleFix( cause == TangleCause::Grew ? tangleGrowth( was, best.in ) : rise, isNew, best.in, detail ); r.locals = tangleLocals( detail ); rowOfKey[ key ] = regs.size(); regs.push_back( std::move( r ) ); stamp( best.at ); + if( !isNew ) + { + rowed.emplace_back( key, &best ); + } } - if( extras != nullptr && extras->bestSince && !ratchetable.empty() ) + if( extras != nullptr && extras->bestSince && !rowed.empty() ) { - appendTangleRatchet( regs, ing, g, ratchetable, rowOfKey, detailOf, stamp, root, *extras ); + appendTangleRatchet( regs, ing, rowed, rowOfKey, root, *extras ); } } diff --git a/src/verbs_quality.h b/src/verbs_quality.h index 2e496932f..708cdc0f8 100644 --- a/src/verbs_quality.h +++ b/src/verbs_quality.h @@ -1477,13 +1477,13 @@ inline constexpr const char* kQdLegendCore = "score). THIRTEEN KINDS, and kind= on every row names which one: complexity over the ccx bar, verbosity " "(LOC), nesting, params, duplication, dead-code, api-surface (new public contract drift), " "error-masking, short-horizon-churn, new-clone-of-reused-helper, placeholder (added stub/TODO), " - "defect-shape (defect= names it), tangle (a long function's nesting, deep share and steering locals; report-only). " + "defect-shape (defect= names it), tangle (a long function's nesting, deep share and steering locals; a new or crossing one gates). " "THREE independent axes, in this " "order: (1) acked findings are suppressed entirely (acked= counts them); (2) ORIGIN — a finding on a " "symbol that EXISTED at the baseline is preexisting-worse (no origin attribute), one that exists only " "because the code is NEW carries origin=\"new-symbol\"; (3) MATERIALITY — a small numeric delta is " "sev=\"minor\", and minor= counts them. EXIT 2 fires only on preexisting-worse AND major, the gating= count; " - "new-symbol rows never gate, except defect-shape format-arity and a new function at the ceiling, so exit 0 " + "new-symbol rows never gate, except defect-shape format-arity, a new function at the ceiling and a tangled new function, so exit 0 " "is NOT a verdict on them — nothing that existed got worse, but the new debt is yours: read them. Clone kinds are new-symbol only when EVERY member is new; short-horizon-churn is " "preexisting by construction. preexisting-worse= and new-symbol= partition regressions=. stale= is a " "FOURTH axis, never gating and never counted in regressions=: rows in the .ripwire_quality_acks ledger " @@ -1744,23 +1744,25 @@ inline constexpr const char* kQdFailureDefaultLegend = // QD-TANGLE — emitted only when a tangle row is in the document. inline constexpr const char* kQdTangleLegend = - "tangle rows are REPORT-ONLY (always sev=\"minor\", never gating). was= and now= are the score S = T x log2(loc/50), " + "a tangle row GATES when the function is new or crossed the bar (not a moved body, not test code); a row an input rose on is " + "sev=\"minor\". was= and now= are the score S = T x log2(loc/50), " "T = nesting levels past 3 + deep%/5 + steering locals per 100 lines (deep%: the share of lines inside regions at nesting 4+, " "short arms of a flat switch or else-if chain of 4+ arms left out); bar= 6. Length only AMPLIFIES: a function of 50 lines or " "fewer, a long flat body and an orchestrator of named steps all score 0. A row means the change made it so: the function is " - "new, crossed the bar, or an input rose (nesting +1, deep lines +5, a new steering local); why= names those inputs, fix= the " + "new, crossed the bar, its score grew against the baseline while over the bar (the ratchet: a tenth counts), or an input rose " + "(nesting +1, deep lines +5, a new steering local); why= names the inputs that changed, fix= the " "shape the rise calls for with its lines, locals= the steering locals: a primitive local written again after its " "declaration and read by a branch condition 10 or more statements after that write. "; // D4 — present when the ratchet read its reference point (ratchet_ref= on the root). A ratchet= facet needs that read, so this one // sentence defines both. inline constexpr const char* kQdRatchetLegend = - "ratchet_ref= is the reference point the tangle ratchet read, the last tag reachable from HEAD: each function over the tangle bar " - "whose inputs this change moved is compared with its BEST since that tag (the lowest of each input and of the score over every first-parent " + "ratchet_ref= is the reference point the tangle rows' history read, the last tag reachable from HEAD: each tangle row on a function " + "that existed at the baseline is compared with its BEST since that tag (the lowest of each input and of the score over every first-parent " "version since it, or since the function's creation); ratchet_judged= counts those that had history, ratchet_unread= versions " "that could not be measured, ratchet_cut=\"1\" that only the 512 newest versions were read. ratchet=\"TAG\" on a tangle row: " "the score is above its best since TAG and an input rose over its minimum by the rise rule, so a function that crept up across " - "changes is named; why= then adds \"best since TAG: ...\", and on a row of its own was= is that best score. Report-only. "; + "changes says so; why= then adds \"best since TAG: ...\". A facet only: it makes no row and changes no severity. "; // QD-CREDIT-ROW — present when the document carries an section. inline constexpr const char* kQdImprovedLegend = @@ -2549,27 +2551,39 @@ inline void emitQdGatingLine( const std::vector& regs, // M12: displaySym, not first->sym raw — the XML/JSON rows both normalize sym's path segment // for display (quality::displaySym); this stderr line was the one caller that skipped it, // so it named "./src/…::rw::…" beside a row that named the same finding "src/…::rw::…". - // a gating row on NEW code is defect-shape format-arity or a new function at the ceiling (rowGates); the line names + // a gating row on NEW code is defect-shape format-arity, a new function at the ceiling or a tangled new function (rowGates); the line names // either part only when there is one, so every run without them keeps its bytes. const std::size_t newGating = static_cast( std::count_if( regs.begin(), regs.end(), []( const quality::Regression& r ) { return r.isNewSymbol && quality::rowGates( r ); } ) ); const std::size_t ceilingGating = static_cast( std::count_if( regs.begin(), regs.end(), []( const quality::Regression& r ) { return r.ceiling != 0 && quality::rowGates( r ); } ) ); + // a new-symbol tangle row gates under rule (b) (QD-LESSONS-2); was=/now= read as every surface prints them (a tangle score's tenths) + const std::size_t newTangleGating = static_cast( std::count_if( regs.begin(), regs.end(), []( const quality::Regression& r ) + { return r.isNewSymbol && r.kind == "tangle" && quality::rowGates( r ); } ) ); + const std::string was = quality::rowValueText( *first, first->was ), now = quality::rowValueText( *first, first->now ); if( ceilingGating != 0 ) { - rw::emitTo( stderr, "ripwire: --quality-delta gating: {} gating finding(s), {} of them a new function at the ceiling (ccx {} / {} lines); first: {} {}{} (was={} now={})\n", - gatingCount, ceilingGating, quality::newSymbolCeiling( quality::kCcxBar ), quality::newSymbolCeiling( quality::kLocBar ), - first->kind.c_str(), quality::displaySym( first->sym, deltaRoot ).c_str(), at.c_str(), first->was, first->now ); + const std::string tangled = newTangleGating == 0 ? std::string() + : std::format( ", {} a tangled new function (tangle {} or more)", newTangleGating, quality::metricValueText( "tangle", rw::kTangleBar10 ) ); + rw::emitTo( stderr, "ripwire: --quality-delta gating: {} gating finding(s), {} of them a new function at the ceiling (ccx {} / {} lines){}; first: {} {}{} (was={} now={})\n", + gatingCount, ceilingGating, quality::newSymbolCeiling( quality::kCcxBar ), quality::newSymbolCeiling( quality::kLocBar ), tangled, + first->kind.c_str(), quality::displaySym( first->sym, deltaRoot ).c_str(), at.c_str(), was, now ); } else if( newGating == 0 ) { rw::emitTo( stderr, "ripwire: --quality-delta gating: {} preexisting-worse major finding(s); first: {} {}{} (was={} now={})\n", - gatingCount, first->kind.c_str(), quality::displaySym( first->sym, deltaRoot ).c_str(), at.c_str(), first->was, first->now ); + gatingCount, first->kind.c_str(), quality::displaySym( first->sym, deltaRoot ).c_str(), at.c_str(), was, now ); + } + else if( newTangleGating != 0 ) + { + rw::emitTo( stderr, "ripwire: --quality-delta gating: {} gating finding(s), {} of them a tangled new function (tangle {} or more); first: {} {}{} (was={} now={})\n", + gatingCount, newTangleGating, quality::metricValueText( "tangle", rw::kTangleBar10 ), first->kind.c_str(), + quality::displaySym( first->sym, deltaRoot ).c_str(), at.c_str(), was, now ); } else { rw::emitTo( stderr, "ripwire: --quality-delta gating: {} gating finding(s), {} of them defect-shape format-arity on new code; first: {} {}{} (was={} now={})\n", - gatingCount, newGating, first->kind.c_str(), quality::displaySym( first->sym, deltaRoot ).c_str(), at.c_str(), first->was, first->now ); + gatingCount, newGating, first->kind.c_str(), quality::displaySym( first->sym, deltaRoot ).c_str(), at.c_str(), was, now ); } } diff --git a/test/lib/tanglefixtures.py b/test/lib/tanglefixtures.py index b97aa4cdd..e6f9b6fba 100644 --- a/test/lib/tanglefixtures.py +++ b/test/lib/tanglefixtures.py @@ -21,6 +21,13 @@ shrink — tangled at v1/c2; wt removes its deep region: credited in (tangle), no row. simplify — ccx 21 at v1/c2, ccx 11 in wt: credited in (complexity). nudge — tangled at v1/c2 (40 deep lines); wt drops 2 of them: under the rise step, so no entry (and no row). + crossing — 100 flat lines at v1/c2 (score 0); wt gives it tangled's body: it crossed the bar, a GATING row (rule (b), 11-21). + harnessmain — new in wt under test/: tangled's body, a row that stays sev="minor" (test code never gates by tangle). + The RATCHET against the range base (QD-RATCHET-BASE, replay 11-21), three over-bar functions (v1 40 deep lines): + grow1 — 40 at c2, 42 in wt: the score grew a little, under the rise step and under its best since v1's rise: a ratchet row. + reflow — 46 at c2 (+6 over v1), wt adds one flat line: its inputs moved but the score is the same tenth: no row (the replay's + buildGraph in #706, +28 lines at 56.9 -> 56.9, that the tag-best compare flagged). + settle — 48 at c2 (+8 over v1), 47 in wt: the score fell: no row (the replay's captureTagsFacts 29.2 -> 29.1 in #714). The wip stage cuts creep to 5 deep lines on the side branch, whose next commit (c2) grows it back: a version the first-parent line never stood at, so it must not become creep's best (r1 would read deep 8->49). """ @@ -40,15 +47,7 @@ def deep_block(n, depth_indent): def creep(extra): # depth: for(1) if(2) for(3) if(4) -> the deep region is the body of the 4th level - body = deep_block(40 + extra, 20) - tail = "".join(f" total = total * 3 + {k};\n" for k in range(70)) - return ("int creep( const std::vector& xs )\n{\n int total = 0;\n" - " for( int x : xs )\n {\n if( x > 0 )\n {\n" - " for( int y = 0; y < x; ++y )\n {\n" - " if( y % 2 )\n {\n" - + body + - " }\n }\n }\n }\n" - + tail + " return total;\n}\n") + return overbar("creep", 40 + extra, mult=3, gt=0, mod=2) def shrink(deep): @@ -72,19 +71,24 @@ def simplify(branches): def nudge(deep): + return overbar("nudge", deep, mult=11) + + +def overbar(name, deep, extra=0, mult=13, gt=2, mod=5): + # nudge's shape under another name: for(1) if(2) for(3) if(4), `deep` lines at depth 4, a flat tail of 70 + extra lines inner = deep_block(deep, 20) - tail = "".join(f" total = total * 11 + {k};\n" for k in range(70)) - return ("int nudge( const std::vector& xs )\n{\n int total = 0;\n" - " for( int x : xs )\n {\n if( x > 2 )\n {\n" + tail = "".join(f" total = total * {mult} + {k};\n" for k in range(70 + extra)) + return (f"int {name}( const std::vector& xs )\n{{\n int total = 0;\n" + f" for( int x : xs )\n {{\n if( x > {gt} )\n {{\n" " for( int y = 0; y < x; ++y )\n {\n" - " if( y % 5 )\n {\n" + inner + + f" if( y % {mod} )\n {{\n" + inner + " }\n }\n }\n }\n" + tail + " return total;\n}\n") -def tangled(): +def tangled(name="tangled"): deep = deep_block(25, 28) seq = "".join(f" total = total + {k};\n" for k in range(60)) - return ("int tangled( const std::vector& xs )\n{\n int total = 0;\n bool found = false;\n" + return (f"int {name}( const std::vector& xs )\n{{\n int total = 0;\n bool found = false;\n" " for( int x : xs )\n {\n if( x > 0 )\n {\n" " for( int y = 0; y < x; ++y )\n {\n" " if( y % 2 )\n {\n" @@ -96,9 +100,9 @@ def tangled(): + seq + " if( found )\n {\n total *= 2;\n }\n return total;\n}\n") -def sequential(): - return ("int sequential( int x )\n{\n int total = x;\n" - + "".join(f" total = total * 7 + {k};\n" for k in range(150)) + " return total;\n}\n") +def sequential(name="sequential", n=150): + return (f"int {name}( int x )\n{{\n int total = x;\n" + + "".join(f" total = total * 7 + {k};\n" for k in range(n)) + " return total;\n}\n") def orchestrator(): @@ -189,7 +193,16 @@ def main(): write(d, "shrink.cpp", hdr + shrink(stage != "wt")) write(d, "simplify.cpp", simplify(20 if stage != "wt" else 10)) write(d, "nudge.cpp", hdr + nudge(40 if stage != "wt" else 38)) + if stage != "wt": + write(d, "crossing.cpp", sequential("crossing", 100)) + write(d, "grow1.cpp", hdr + overbar("grow1", 42 if stage == "wt" else 40, mult=17)) + write(d, "reflow.cpp", hdr + overbar("reflow", 40 if stage == "v1" else 46, extra=1 if stage == "wt" else 0, mult=19)) + write(d, "settle.cpp", hdr + overbar("settle", {"v1": 40, "wt": 47}.get(stage, 48), mult=23)) if stage == "wt": + write(d, "crossing.cpp", hdr + tangled("crossing")) + os.makedirs(os.path.join(d, "test"), exist_ok=True) + with open(os.path.join(d, "test", "harness.cpp"), "w") as f: + f.write(hdr + tangled("harnessmain")) write(d, "tangled.cpp", hdr + tangled()) write(d, "sequential.cpp", sequential()) write(d, "orchestrator.cpp", orchestrator()) diff --git a/test/tanglecheck.sh b/test/tanglecheck.sh index 6b66c92b3..9ad032219 100755 --- a/test/tanglecheck.sh +++ b/test/tanglecheck.sh @@ -1,11 +1,14 @@ #!/usr/bin/env bash -# tanglecheck.sh — QD-TANGLE gate: the tangle kind (report-only), its steering-local fact, the D4 best-since ratchet and the +# tanglecheck.sh — QD-TANGLE gate: the tangle kind (rule (b) gates, owner 11-21), its steering-local fact, the D4 best-since ratchet and the # QD-CREDIT-ROW section (STAGE0 2.1-2.8; quality.h appendTangleRows / appendTangleRatchet, qdbestsince.h). # # One seeded C++ repo, four stages (test/lib/tanglefixtures.py): v1 (tagged); a side branch with wip (cuts creep) then c2, # merged --no-ff; the working tree (judged). -# (t1) TANGLED NEW: a depth-6 function with a steering flag rows: kind="tangle" sev="minor" origin="new-symbol", why= names the -# nesting, fix= an extraction with its lines, locals= the flag. +# (t1) TANGLED NEW: a depth-6 function with a steering flag rows: kind="tangle" origin="new-symbol" gating="1" (rule (b)), why= +# names the nesting, fix= an extraction with its lines, locals= the flag. +# (b1) CROSSING: crossing was 100 flat lines (score 0) and now has tangled's body: a preexisting row (no origin=) with gating="1". +# (b2) TEST CODE: harnessmain, new under test/ with tangled's body: a row with sev="minor" and no gating= (premise: the row exists). +# (b3) EXIT: the answer exits 2 and the root's gating= counts at least t1 + b1; the stderr line names a tangled new function. # (n1) LONG SEQUENTIAL, (n2) LONG ORCHESTRATOR, (n3) FLAT DISPATCHER, (n4) SHORT NESTED HELPER: no tangle row. Each counts its # premise in --metrics first (the function is there, and n3/n4 really reach depth 4+) and FAILS on a zero premise. # (n5) ARM NESTING: a 6-arm else-if chain whose short arms nest to depth 7, beside one depth-4 region outside it: no tangle row @@ -15,17 +18,26 @@ # an index (`xs[ pos ]`): no steer= (premise: steercursor in --metrics). Census 11-19: lexCpp's `j`, buildGraph's indices. # (s4) SCOPE: a counter rewritten in a block that closes, then a for-head local of the same name tested 12 statements # later: no steer= (premise: steerscope in --metrics). Census 11-19: genPathOf's `a`. -# (r1) RATCHET: creep gained 3 deep lines at c2 and 3 more in the working tree — each step under the rise rule (+5), so no -# baseline row reason exists, but against its best since v1 it rose 6: a tangle row with ratchet="v1"; root ratchet_ref="v1". +# (r1) RATCHET: creep gained 3 deep lines at c2 and 3 more in the working tree — each step under the rise rule (+5); its score +# grew against HEAD (a ratchet row, k1's rule), and against its best since v1 it rose 6: the row carries ratchet="v1" and why= +# "best since v1: ..."; root ratchet_ref="v1". # The wip side branch's 5-deep-line creep is not its best: the ratchet reads the first-parent line (replay 11-19). +# (k1) RATCHET VS THE BASE: grow1 (over the bar) gained 2 deep lines: under the rise step and under its best-since-v1 rise, yet +# its score grew against HEAD: a tangle row was= HEAD's score, now= higher, sev="minor", no ratchet= facet. +# (k2) MOVED, NOT GROWN: reflow's inputs moved (one flat line) but its score is HEAD's tenth: no row. Against its best since v1 +# it is 6 deep lines up, which made the tag-best compare row it (replay 11-21: buildGraph in #706). +# (k3) FELL: settle's score fell against HEAD (48 -> 47 deep lines), still 7 over v1: no row and no entry (under the +# rise step). Replay 11-21: captureTagsFacts 29.2 -> 29.1 in #714. k1-k3 read their premise from --metrics of HEAD and wt. # (r2) CREDIT: shrink lost its deep region: listed in as kind="tangle", and no tangle row. # (r4) NO CREDIT FOR A NUDGE: nudge (over the bar) lost 2 of its 40 deep lines, under the rise step: no entry # (premise: nudge over the bar in --metrics). Replay 11-19: buildGraph 56.9 -> 56.8 was credited for one deep line. # (r3) NEW FN: the tangled new function's row carries no ratchet= (a symbol created after the tag has no history here). # (c1) CREDIT: simplify ccx 21 -> 11: listed in as kind="complexity". -# (g) report-only: gating="0" on the root although tangle rows are present (premise: >= 1 tangle row). +# (g) only rule (b) gates: every gating tangle row is a new or crossing one (tangled, crossing); every other tangle row is sev="minor". # (j) --json carries the same tangle rows (count) and "improved". # (d) determinism: the working-tree run twice is byte-identical. +# Red before QD-LESSONS-2 (main 8861b0d4d): t1 b1 b3 (every tangle row minor), k1 (no row: no rise), k2 k3 (the tag-best rows); b2 +# is red only on a guard-off build (no test-path exemption). # Red before the lane (main's bin): t1 r1 r2 r3 c1 s1 (no tangle kind, no steer=, no improved); red before the census fixes (11-19): n5 s3 s4; before the replay fixes (11-19): r1 (wip best) r4. # Usage: test/tanglecheck.sh [BIN] set -u @@ -60,6 +72,8 @@ Q="$TMP/qd.xml" "$BIN" "$R" --quality-delta --no-cache >"$Q.2" 2>/dev/null; rc2=$? "$BIN" "$R" --quality-delta --json --no-cache >"$TMP/qd.json" 2>/dev/null; rcj=$? M="$( "$BIN" "$R" --metrics --no-cache 2>/dev/null )"; rcm=$? +mkdir -p "$TMP/head" && "${G[@]}" -C "$R" archive HEAD | tar -x -C "$TMP/head" +MH="$( "$BIN" "$TMP/head" --metrics --no-cache 2>/dev/null )" rc="$( cat "$Q.rc" )" case "$rc" in 0|2) ;; *) no "quality-delta exit status $rc (stderr: $( head -c 300 "$Q.err" ))";; esac if [ "$rc2" != "$rc" ] || [ "$rcj" != "$rc" ]; then no "quality-delta exit status differs between runs: $rc, again $rc2, --json $rcj"; fi @@ -69,15 +83,30 @@ if [ "$rcm" != 0 ]; then no "--metrics exit status $rcm"; fi trow(){ grep -oE "]*>" "$Q" | head -1; } attr(){ printf '%s' "$1" | grep -oE " $2=\"[^\"]*\"" | head -1 | sed -E "s/.*=\"([^\"]*)\"/\1/"; } mrow(){ printf '%s' "$M" | tr '>' '\n' | grep "n=\"$1\"" | head -1; } +hrow(){ printf '%s' "$MH" | tr '>' '\n' | grep "n=\"$1\"" | head -1; } +kpre(){ local h w; h="$( hrow "$1" )"; w="$( mrow "$1" )"; printf '%s %s %s %s' "$( attr "$h" tangle )" "$( attr "$w" tangle )" "$( attr "$h" loc )" "$( attr "$w" loc )"; } tangles="$( grep -oE '= 2 and the tangled-new stderr line; got rc=$rc gating=${rg:-none} stderr='$( grep -F 'gating:' "$Q.err" | head -c 300 )'"; fi # (n1)-(n4): premise from --metrics, then no row neg(){ local label="$1" sym="$2" need="$3" m; m="$( mrow "$sym" )" @@ -113,10 +142,25 @@ else if [ -z "$( attr "$ms" steer )" ]; then ok "(s4) steerscope: no steer= (clo # (r1) r="$( trow creep )" dw="$( attr "$r" why | sed -nE 's/.*best since v1: deep ([0-9]+)->([0-9]+) lines.*/\1 \2/p' )" -if [ -n "$r" ] && [ "$( attr "$r" ratchet )" = v1 ] && [ -n "$dw" ] && [ $(( ${dw#* } - ${dw% *} )) = 6 ]; then +read -r ht wt hl wl <<<"$( kpre creep )" +if [ -n "$r" ] && [ "$( attr "$r" ratchet )" = v1 ] && [ -n "$dw" ] && [ $(( ${dw#* } - ${dw% *} )) = 6 ] && [ "$( attr "$r" was )" = "$ht" ]; then ok "(r1) creep: ratchet=\"v1\" row: $r" -else no "(r1) creep: want a tangle row with ratchet=\"v1\" and why=best since v1: deep N->N+6 lines, got '${r:-none}'"; fi +else no "(r1) creep: want a tangle row was=\"$ht\" (HEAD) with ratchet=\"v1\" and why=best since v1: deep N->N+6 lines, got '${r:-none}'"; fi if grep -q 'ratchet_ref="v1"' "$Q"; then ok "(r1) root ratchet_ref=\"v1\""; else no "(r1) root: no ratchet_ref=\"v1\""; fi +# (k1)-(k3): the ratchet against the range base; premise from HEAD's and the working tree's --metrics +read -r ht wt hl wl <<<"$( kpre grow1 )"; r="$( trow grow1 )" +if [ -z "$ht" ] || [ -z "$wt" ] || [ "${ht%.*}" -lt 6 ] || [ "${ht/./}" -ge "${wt/./}" ]; then no "(k1) PREMISE: grow1 over the bar and higher in wt, got HEAD=$ht wt=$wt" +elif [ -n "$r" ] && [ "$( attr "$r" was )" = "$ht" ] && [ "$( attr "$r" now )" = "$wt" ] && [ "$( attr "$r" sev )" = minor ] && [ -z "$( attr "$r" ratchet )" ]; then + ok "(k1) grow1 $ht -> $wt: a minor ratchet row, no ratchet= facet: $r" +else no "(k1) grow1 $ht -> $wt: want a minor tangle row was=\"$ht\" now=\"$wt\" without ratchet=, got '${r:-none}'"; fi +read -r ht wt hl wl <<<"$( kpre reflow )" +if [ -z "$ht" ] || [ "$ht" != "$wt" ] || [ "$hl" = "$wl" ] || [ "${ht%.*}" -lt 6 ]; then no "(k2) PREMISE: reflow over the bar, same score, lines moved; got $ht/$wt, $hl/$wl lines" +elif [ -z "$( trow reflow )" ]; then ok "(k2) reflow (S $ht, $hl -> $wl lines): no tangle row" +else no "(k2) reflow: want no tangle row (score unchanged), got $( trow reflow )"; fi +read -r ht wt hl wl <<<"$( kpre settle )" +if [ -z "$ht" ] || [ -z "$wt" ] || [ "${wt%.*}" -lt 6 ] || [ "${wt/./}" -ge "${ht/./}" ]; then no "(k3) PREMISE: settle over the bar and lower in wt, got HEAD=$ht wt=$wt" +elif [ -z "$( trow settle )" ] && ! grep -qE ' $wt: no tangle row, no entry" +else no "(k3) settle $ht -> $wt: want no row and no credit, got row '$( trow settle )' / $( grep -oE ']*>' "$Q" )"; fi # (r2) / (c1) if grep -qE '"; else no "(r2) shrink: no entry"; fi if [ -z "$( trow shrink )" ]; then ok "(r2) shrink: no tangle row"; else no "(r2) shrink: unexpected tangle row $( trow shrink )"; fi @@ -130,10 +174,11 @@ elif grep -qE ' entry"; fi # (r3) if r="$( trow tangled )"; [ -n "$r" ] && [ -z "$( attr "$r" ratchet )" ]; then ok "(r3) tangled (new): no ratchet="; else no "(r3) tangled: want a row without ratchet=, got '${r:-none}'"; fi -# (g) report-only: no tangle row gates (other kinds' rows on these fixtures may) +# (g) only rule (b) gates: the gating tangle rows are exactly the new and crossing ones; every other tangle row is minor +gsyms="$( grep -oE ']*gating="1"[^>]*>' "$Q" | grep -oE ' sym="[^"]*"' | sed -E 's/.*(::|")([A-Za-z0-9_]+)"$/\2/' | sort | tr '\n' ' ' )" tg="$( grep -oE ']*>' "$Q" | grep -c 'gating="1"' )"; tm="$( grep -oE ']*>' "$Q" | grep -c 'sev="minor"' )" -if [ "$tangles" -ge 1 ] && [ "$tg" = 0 ] && [ "$tm" = "$tangles" ]; then ok "(g) report-only: $tangles tangle row(s), all sev=\"minor\", none gating" -else no "(g) tangle rows $tangles: gating $tg, minor $tm"; fi +if [ "$tangles" -ge 3 ] && [ "$gsyms" = "crossing tangled " ] && [ $(( tg + tm )) = "$tangles" ]; then ok "(g) $tangles tangle row(s): gating $gsyms, the other $tm sev=\"minor\"" +else no "(g) tangle rows $tangles: want gating exactly 'crossing tangled ', got '$gsyms' (gating $tg, minor $tm)"; fi # (j) the JSON twin: the same tangle rows in "r" and an "improved" list jt="$( python3 -c 'import json,sys; d=json.load(open(sys.argv[1])); print(sum(1 for r in d["r"] if r.get("kind")=="tangle"), len(d.get("improved",[])))' "$TMP/qd.json" 2>/dev/null )" if [ "${jt% *}" = "$tangles" ] && [ "${jt#* }" -ge 2 ]; then ok "(j) --json: ${jt% *} tangle row(s) and ${jt#* } improved entries" From b9418fa60ca4e0e1c03263099df503849a2447b4 Mon Sep 17 00:00:00 2001 From: joyful-ii-V-I <210578314+joyful-ii-V-I@users.noreply.github.com> Date: Sat, 21 Nov 2026 18:13:54 -0500 Subject: [PATCH 05/44] qd tangle: the ratchet against the range base GATES (QD-RATCHET-BASE, owner 11-21) A function over tangle 6 at the range base whose score is higher now gates (not a moved body, not test code). Its own commit so it can be reverted alone. Expected effect (replay 11-21): a PR that grows buildGraph, serialize or captureTagsFacts by a tenth blocks until it is acked or the function is split (GE-BUILDGRAPH / GE-SERIALIZE / GE-CAPTURETAGS). tanglecheck k1 (grow1) and g read the ratchet rows as gating. Co-Authored-By: Claude Opus 5.5 --- src/quality.h | 12 +++++++----- src/verbs_quality.h | 4 ++-- test/tanglecheck.sh | 14 +++++++------- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/quality.h b/src/quality.h index 5540741a8..bacaa9557 100644 --- a/src/quality.h +++ b/src/quality.h @@ -11388,7 +11388,7 @@ inline std::uint32_t newSymbolCeilingGate( const Regression& r, SymKind measured // is new, it crossed the bar, its score grew against the range base while over the bar (the RATCHET, QD-RATCHET-BASE), or an input // rose — nesting +1, deep lines +kTangleDeepRise, or a new steering local. Rows on the score's growth catch a monster growing by a // tenth per change (12 deep lines in a 4000-line function), which a size floor would let grow forever (QD-MONSTER-GROWTH's lesson). -// A new function or a crossing GATES (rule (b), owner 11-21: tangleCauseGates); every other row is sev="minor". why= names the +// A new function, a crossing and a ratchet row GATE (owner 11-21: tangleCauseGates); every other row is sev="minor". why= names the // inputs that changed, fix= the shape the rise calls for (with its lines, from a re-walk of the ONE function: tangleDetailOf), // locals= the steering locals. A long orchestrator of named steps or a long flat body scores 0 and never rows. inline constexpr std::uint32_t kTangleDeepRise = 5; // deep lines that count as a rise (STAGE0 2.5's "worse" tier) @@ -11570,12 +11570,14 @@ inline TangleRise tangleGrowth( const TangleInputs& was, const TangleInputs& now return { now.nest > was.nest, now.deep > was.deep, now.steer > was.steer }; } -// Rule (b): a new function at or over the bar, or one that crossed it, GATES — except a moved body (its code is not new; the -// re-census found no such row) and test code (the census's test-harness mains were its false class, and QD-ENTRY-CEILING exempts -// test drivers the same way). A ratchet row or a row of a rising input stays sev="minor". `rel` = the root-relative path. +// What gates (owner 11-21): rule (b), a new function at or over the bar or one that crossed it, and the ratchet, a function over the +// bar whose score grew against the range base — except a moved body (its code is not new; the re-census found no such row) and test +// code (the census's test-harness mains were its false class, and QD-ENTRY-CEILING exempts test drivers the same way). A row of a +// rising input whose score did not grow stays sev="minor". `rel` = the root-relative path. Expected effect (replay 11-21): a change +// that grows buildGraph, serialize or captureTagsFacts by a tenth blocks until it is acked or the function is split. inline bool tangleCauseGates( TangleCause cause, bool moved, std::string_view rel ) noexcept { - return ( cause == TangleCause::New || cause == TangleCause::Crossed ) && !moved && !isTestPath( rel ); + return ( cause == TangleCause::New || cause == TangleCause::Crossed || cause == TangleCause::Grew ) && !moved && !isTestPath( rel ); } // QD-CREDIT-ROW for tangle (STAGE0 2.5): over the bar at the baseline, an input fell by the rise rule (tangleRise read backwards) and none rose, and the score is lower. diff --git a/src/verbs_quality.h b/src/verbs_quality.h index 708cdc0f8..94324d807 100644 --- a/src/verbs_quality.h +++ b/src/verbs_quality.h @@ -1744,8 +1744,8 @@ inline constexpr const char* kQdFailureDefaultLegend = // QD-TANGLE — emitted only when a tangle row is in the document. inline constexpr const char* kQdTangleLegend = - "a tangle row GATES when the function is new or crossed the bar (not a moved body, not test code); a row an input rose on is " - "sev=\"minor\". was= and now= are the score S = T x log2(loc/50), " + "a tangle row GATES when the function is new, crossed the bar or its score grew while over it (not a moved body, not test " + "code); a row an input rose on while the score did not grow is sev=\"minor\". was= and now= are the score S = T x log2(loc/50), " "T = nesting levels past 3 + deep%/5 + steering locals per 100 lines (deep%: the share of lines inside regions at nesting 4+, " "short arms of a flat switch or else-if chain of 4+ arms left out); bar= 6. Length only AMPLIFIES: a function of 50 lines or " "fewer, a long flat body and an orchestrator of named steps all score 0. A row means the change made it so: the function is " diff --git a/test/tanglecheck.sh b/test/tanglecheck.sh index 9ad032219..e992b63c2 100755 --- a/test/tanglecheck.sh +++ b/test/tanglecheck.sh @@ -23,7 +23,7 @@ # "best since v1: ..."; root ratchet_ref="v1". # The wip side branch's 5-deep-line creep is not its best: the ratchet reads the first-parent line (replay 11-19). # (k1) RATCHET VS THE BASE: grow1 (over the bar) gained 2 deep lines: under the rise step and under its best-since-v1 rise, yet -# its score grew against HEAD: a tangle row was= HEAD's score, now= higher, sev="minor", no ratchet= facet. +# its score grew against HEAD: a GATING tangle row was= HEAD's score, now= higher, no ratchet= facet (QD-RATCHET-BASE gate). # (k2) MOVED, NOT GROWN: reflow's inputs moved (one flat line) but its score is HEAD's tenth: no row. Against its best since v1 # it is 6 deep lines up, which made the tag-best compare row it (replay 11-21: buildGraph in #706). # (k3) FELL: settle's score fell against HEAD (48 -> 47 deep lines), still 7 over v1: no row and no entry (under the @@ -33,7 +33,7 @@ # (premise: nudge over the bar in --metrics). Replay 11-19: buildGraph 56.9 -> 56.8 was credited for one deep line. # (r3) NEW FN: the tangled new function's row carries no ratchet= (a symbol created after the tag has no history here). # (c1) CREDIT: simplify ccx 21 -> 11: listed in as kind="complexity". -# (g) only rule (b) gates: every gating tangle row is a new or crossing one (tangled, crossing); every other tangle row is sev="minor". +# (g) only rule (b) and the ratchet gate: the gating tangle rows are exactly creep crossing grow1 tangled; the rest are sev="minor". # (j) --json carries the same tangle rows (count) and "improved". # (d) determinism: the working-tree run twice is byte-identical. # Red before QD-LESSONS-2 (main 8861b0d4d): t1 b1 b3 (every tangle row minor), k1 (no row: no rise), k2 k3 (the tag-best rows); b2 @@ -150,9 +150,9 @@ if grep -q 'ratchet_ref="v1"' "$Q"; then ok "(r1) root ratchet_ref=\"v1\""; else # (k1)-(k3): the ratchet against the range base; premise from HEAD's and the working tree's --metrics read -r ht wt hl wl <<<"$( kpre grow1 )"; r="$( trow grow1 )" if [ -z "$ht" ] || [ -z "$wt" ] || [ "${ht%.*}" -lt 6 ] || [ "${ht/./}" -ge "${wt/./}" ]; then no "(k1) PREMISE: grow1 over the bar and higher in wt, got HEAD=$ht wt=$wt" -elif [ -n "$r" ] && [ "$( attr "$r" was )" = "$ht" ] && [ "$( attr "$r" now )" = "$wt" ] && [ "$( attr "$r" sev )" = minor ] && [ -z "$( attr "$r" ratchet )" ]; then - ok "(k1) grow1 $ht -> $wt: a minor ratchet row, no ratchet= facet: $r" -else no "(k1) grow1 $ht -> $wt: want a minor tangle row was=\"$ht\" now=\"$wt\" without ratchet=, got '${r:-none}'"; fi +elif [ -n "$r" ] && [ "$( attr "$r" was )" = "$ht" ] && [ "$( attr "$r" now )" = "$wt" ] && [ "$( attr "$r" gating )" = 1 ] && [ -z "$( attr "$r" ratchet )" ]; then + ok "(k1) grow1 $ht -> $wt: a gating ratchet row, no ratchet= facet: $r" +else no "(k1) grow1 $ht -> $wt: want a gating tangle row was=\"$ht\" now=\"$wt\" without ratchet=, got '${r:-none}'"; fi read -r ht wt hl wl <<<"$( kpre reflow )" if [ -z "$ht" ] || [ "$ht" != "$wt" ] || [ "$hl" = "$wl" ] || [ "${ht%.*}" -lt 6 ]; then no "(k2) PREMISE: reflow over the bar, same score, lines moved; got $ht/$wt, $hl/$wl lines" elif [ -z "$( trow reflow )" ]; then ok "(k2) reflow (S $ht, $hl -> $wl lines): no tangle row" @@ -177,8 +177,8 @@ if r="$( trow tangled )"; [ -n "$r" ] && [ -z "$( attr "$r" ratchet )" ]; then o # (g) only rule (b) gates: the gating tangle rows are exactly the new and crossing ones; every other tangle row is minor gsyms="$( grep -oE ']*gating="1"[^>]*>' "$Q" | grep -oE ' sym="[^"]*"' | sed -E 's/.*(::|")([A-Za-z0-9_]+)"$/\2/' | sort | tr '\n' ' ' )" tg="$( grep -oE ']*>' "$Q" | grep -c 'gating="1"' )"; tm="$( grep -oE ']*>' "$Q" | grep -c 'sev="minor"' )" -if [ "$tangles" -ge 3 ] && [ "$gsyms" = "crossing tangled " ] && [ $(( tg + tm )) = "$tangles" ]; then ok "(g) $tangles tangle row(s): gating $gsyms, the other $tm sev=\"minor\"" -else no "(g) tangle rows $tangles: want gating exactly 'crossing tangled ', got '$gsyms' (gating $tg, minor $tm)"; fi +if [ "$tangles" -ge 3 ] && [ "$gsyms" = "creep crossing grow1 tangled " ] && [ $(( tg + tm )) = "$tangles" ]; then ok "(g) $tangles tangle row(s): gating $gsyms, the other $tm sev=\"minor\"" +else no "(g) tangle rows $tangles: want gating exactly 'creep crossing grow1 tangled ', got '$gsyms' (gating $tg, minor $tm)"; fi # (j) the JSON twin: the same tangle rows in "r" and an "improved" list jt="$( python3 -c 'import json,sys; d=json.load(open(sys.argv[1])); print(sum(1 for r in d["r"] if r.get("kind")=="tangle"), len(d.get("improved",[])))' "$TMP/qd.json" 2>/dev/null )" if [ "${jt% *}" = "$tangles" ] && [ "${jt#* }" -ge 2 ]; then ok "(j) --json: ${jt% *} tangle row(s) and ${jt#* } improved entries" From e849e1d702bf144e2db69be7a9e68b65168eb338 Mon Sep 17 00:00:00 2001 From: joyful-ii-V-I <210578314+joyful-ii-V-I@users.noreply.github.com> Date: Sat, 21 Nov 2026 18:39:24 -0500 Subject: [PATCH 06/44] shstatus: one nesting budget for the shell lexer and parser; a cut scan is disclosed (CR712-SHSTATUS-DEPTH) shstatus.h recursed with no bound through quotes and $( ) in the lexer (skipQuote <-> skipParen) and through compound commands in the parser (parseList -> ... -> parseCommand): 5,000 nested subshells, brace groups or if-then blocks in a shell file killed --quality-delta with SIGSEGV (rc 139 on main 8861b0d4d). Now one NestBudget (kMaxShellNest 64) is shared by the lexer's skips, the dq descent, every parseCommand and every substitution parser; past it the rest is left unparsed and Tree::cut is set. It replaces the silent 40-level substitution cap (kMaxSubDepth). Disclosure: defectSitesOf counts the shell files whose scan was cut into DeltaExtras::shellCut, and the root carries shell_cut="N" (XML and --json, through the extras' root-attribute helper; absent at 0), defined in the core legend and the compact dictionary (a static_assert ties the 64). capdisclose.map: kMaxShellNest sink:cut (shstatus.h joins the lint's scope). New gate test/shellnestcheck.sh (generated scripts, never committed): five 5,000-deep shapes exit 0/2 with shell_cut="1" (subshell/group/if crash on main; quote/subst were cut silently), --json carries it, and a 40-deep unhandled-arm site is still found with no shell_cut=. Co-Authored-By: Claude Opus 5.5 --- src/compactlegend.h | 4 +- src/defectshape.h | 19 +++++-- src/quality.h | 44 +++++++++------ src/shstatus.h | 119 ++++++++++++++++++++++++++++++---------- src/verbs_quality.h | 8 ++- test/capdisclose.map | 1 + test/lib/capdisclose.py | 4 +- test/regression.sh | 1 + test/shellnestcheck.sh | 78 ++++++++++++++++++++++++++ 9 files changed, 221 insertions(+), 57 deletions(-) create mode 100755 test/shellnestcheck.sh diff --git a/src/compactlegend.h b/src/compactlegend.h index 8a172f674..3648bef6c 100644 --- a/src/compactlegend.h +++ b/src/compactlegend.h @@ -1057,7 +1057,9 @@ inline constexpr CompactCompletenessTerm kCompactAttributeReadings[] = { "stale_by_kind", "stale_by_kind=: stale= split by ack kind (kind:N,...); the sa rows are collapsed", false, "quality-delta", MapHeaderRead::No, {}, "quality-delta" }, { "stale_next", "stale_next=: the call printing the sa rows and the full header", false, "quality-delta", MapHeaderRead::No, {}, "quality-delta" }, // D4 (src/quality.h ratchetAttrsXml): present when the tangle ratchet read its reference point - { "ratchet_ref", "ratchet_ref=TAG ratchet_judged=N: the ratchet compared N touched over-bar functions with their best since TAG; ratchet_unread= / ratchet_cut=1: versions not measured", false, "quality-delta", MapHeaderRead::No, {}, "quality-delta" }, + { "ratchet_ref", "ratchet_ref=TAG ratchet_judged=N: N tangle rows' functions compared with their best since TAG; ratchet_unread= / ratchet_cut=1: versions not measured", false, "quality-delta", MapHeaderRead::No, {}, "quality-delta" }, + // CR712-SHSTATUS-DEPTH (src/quality.h ratchetAttrsXml): present when not 0 + { "shell_cut", "shell_cut=N: shell files whose defect-shape scan stopped at nesting depth 64; deeper code not judged", false, "quality-delta", MapHeaderRead::No, {}, "quality-delta" }, { "preexisting-worse", "preexisting-worse=N: regressions on symbols that existed at baseline; they gate when major", false, "quality-delta", MapHeaderRead::No, {}, "quality-delta" }, { "new-symbol", "new-symbol=N: NEW code; new-symbol rows never gate, except defect-shape format-arity, a ceiling= row or a tangle row", false, "quality-delta", MapHeaderRead::No, {}, "quality-delta" }, { "register-macro-excluded", "register-macro-excluded=N: symbols skipped: self-registering test/bench macros or Rust #[test]; a floor", false, "quality-delta", MapHeaderRead::No, {}, "quality-delta" }, diff --git a/src/defectshape.h b/src/defectshape.h index 13e2f5803..ce2f4866d 100644 --- a/src/defectshape.h +++ b/src/defectshape.h @@ -4059,13 +4059,17 @@ inline std::vector Script::sites() const } // namespace va -inline std::vector scanVacuousAssertBash( std::string_view src, const std::vector& /*spans*/ ) +inline std::vector scanVacuousAssertBash( std::string_view src, const std::vector& /*spans*/, bool* cut = nullptr ) { if( src.empty() ) { return {}; } const rw::shstatus::Tree tree = rw::shstatus::parse( src ); + if( cut != nullptr ) + { + *cut = *cut || tree.cut; // the nesting budget stopped the parse: sites past it were not judged + } const rw::shstatus::Analysis an = rw::shstatus::analyze( tree, src ); const va::Script script( src, tree, an ); return script.sites(); @@ -5839,13 +5843,17 @@ inline void assignedCaseSites( std::string_view src, const sh::Tree& t, const st } // namespace uash // Bash: a case with no *) arm whose result is read, in either form. -inline void scanUnhandledArmBash( std::string_view src, const std::vector& fnSpans, std::vector& out ) +inline void scanUnhandledArmBash( std::string_view src, const std::vector& fnSpans, std::vector& out, bool* cut = nullptr ) { if( src.find( "esac" ) == std::string_view::npos ) { return; } const rw::shstatus::Tree t = rw::shstatus::parse( src ); + if( cut != nullptr ) + { + *cut = *cut || t.cut; + } uash::endingCaseSites( src, t, out ); uash::assignedCaseSites( src, t, fnSpans, out ); } @@ -5942,10 +5950,11 @@ inline std::vector scanPython( std::string_view src, const std::vector scanBashTestScript( std::string_view src, const std::vector& fnSpans ) +// definitions, the scopes a capture and its guards are matched in. `cut` (optional) is set when the shell nesting budget +// (shstatus kMaxShellNest) stopped the parse. +inline std::vector scanBashTestScript( std::string_view src, const std::vector& fnSpans, bool* cut = nullptr ) { - return detail::scanVacuousAssertBash( src, fnSpans ); + return detail::scanVacuousAssertBash( src, fnSpans, cut ); } // Bash, any path: unhandled-arm (a case with no *) arm whose result is read), appended to `out`. diff --git a/src/quality.h b/src/quality.h index bacaa9557..aabac7458 100644 --- a/src/quality.h +++ b/src/quality.h @@ -6712,8 +6712,9 @@ inline defectshape::EnumTable cFamilyEnumTable( const IngestResult& ing, std::st // `macroOverride`, when given, is the macro-name set to scan C++ files against instead of this index's own — the whole // tree's, when this index holds only some of its files (a degraded --quality-delta=A..B's changed files). +// `shellCut`, when given, counts the shell files whose scan the nesting budget cut (shstatus kMaxShellNest): the answer's shell_cut=. inline std::vector defectSitesOf( const IngestResult& ing, std::string_view root, const std::vector* fileInBaseline, - const std::vector* macroOverride = nullptr ) + const std::vector* macroOverride = nullptr, std::uint32_t* shellCut = nullptr ) { std::vector out; const SymbolsByFile byFile = symbolsByFileInIdOrder( ing, []( const Symbol& s ) { return s.endByte > s.sigStartByte && s.kind != SymKind::ModuleScope; } ); @@ -6768,11 +6769,16 @@ inline std::vector defectSitesOf( const IngestResult& ing, std::st } else if( scan == DefectScan::Bash ) { + bool cut = false; // the shell nesting budget stopped a parse: the file's sites past it are not judged (shell_cut=) if( isTestScriptPath( rel ) ) // a test script: every assertion form (grep, [ ], cmp, case, rc=$?) is read { - sites = defectshape::scanBashTestScript( src, fnSpans ); + sites = defectshape::scanBashTestScript( src, fnSpans, &cut ); + } + defectshape::scanUnhandledArmBash( src, fnSpans, sites, &cut ); // any path: a case with no *) arm whose result is read + if( cut && shellCut != nullptr ) + { + ++*shellCut; } - defectshape::scanUnhandledArmBash( src, fnSpans, sites ); // any path: a case with no *) arm whose result is read } if( defectshape::looksGenerated( rel, src ) ) // unhandled-arm judges no generated switch: the fix is in the generator { @@ -8234,6 +8240,7 @@ struct DeltaExtras BestSinceSource bestSince; BaseBodySource baseBodies; // QD-SHRINK-PAIR (demoteShrinkOnlyClones): the base commit's bodies of the named files std::vector improved; + std::uint32_t shellCut = 0; // shell files whose defect-shape scan the nesting budget cut (shell_cut=) std::string ratchetRef; // the reference point the ratchet read ("" = not consulted: no candidate, or no source) std::uint32_t ratchetJudged = 0; // symbols judged against their best std::uint32_t ratchetUnread = 0; // history blobs that could not be measured @@ -10920,28 +10927,31 @@ inline std::string tangleRowAttrs( const Regression& r, bool json, Escape&& esc return out; } -// D4 — the ratchet's disclosure on the root: the reference point it read, and what it could not read. "" when it was not consulted. +// D4 — the ratchet's disclosure on the root: the reference point it read, and what it could not read ("" when it was not +// consulted); then CR712-SHSTATUS-DEPTH's shell_cut= (the shell files whose defect-shape scan the nesting budget cut; absent at 0). template inline std::string ratchetAttrsXml( const DeltaExtras& x, Escape&& ex ) { - if( x.ratchetRef.empty() ) + std::string out; + if( !x.ratchetRef.empty() ) { - return {}; + out = " ratchet_ref=\"" + ex( x.ratchetRef ) + "\" ratchet_judged=\"" + std::to_string( x.ratchetJudged ) + "\""; + out += x.ratchetUnread > 0 ? " ratchet_unread=\"" + std::to_string( x.ratchetUnread ) + "\"" : std::string(); + out += x.ratchetCut ? " ratchet_cut=\"1\"" : ""; } - std::string out = " ratchet_ref=\"" + ex( x.ratchetRef ) + "\" ratchet_judged=\"" + std::to_string( x.ratchetJudged ) + "\""; - out += x.ratchetUnread > 0 ? " ratchet_unread=\"" + std::to_string( x.ratchetUnread ) + "\"" : std::string(); - out += x.ratchetCut ? " ratchet_cut=\"1\"" : ""; + out += x.shellCut > 0 ? " shell_cut=\"" + std::to_string( x.shellCut ) + "\"" : std::string(); return out; } inline std::string ratchetAttrsJson( const DeltaExtras& x ) { - if( x.ratchetRef.empty() ) + std::string out; + if( !x.ratchetRef.empty() ) { - return {}; + out = ",\"ratchet_ref\":\"" + rw::jsonesc::escapeMcp( x.ratchetRef ) + "\",\"ratchet_judged\":" + std::to_string( x.ratchetJudged ); + out += x.ratchetUnread > 0 ? ",\"ratchet_unread\":" + std::to_string( x.ratchetUnread ) : std::string(); + out += x.ratchetCut ? ",\"ratchet_cut\":1" : ""; } - std::string out = ",\"ratchet_ref\":\"" + rw::jsonesc::escapeMcp( x.ratchetRef ) + "\",\"ratchet_judged\":" + std::to_string( x.ratchetJudged ); - out += x.ratchetUnread > 0 ? ",\"ratchet_unread\":" + std::to_string( x.ratchetUnread ) : std::string(); - out += x.ratchetCut ? ",\"ratchet_cut\":1" : ""; + out += x.shellCut > 0 ? ",\"shell_cut\":" + std::to_string( x.shellCut ) : std::string(); return out; } @@ -11108,9 +11118,9 @@ inline void appendSimilarArgsRows( std::vector& regs, const SimilarR template inline void appendDefectShapeRows( std::vector& regs, const IngestResult& ing, const Graph& g, const Snapshot& base, std::string_view root, ExistedFn&& existedAtBaseline, StampFn&& stampLoc, - const std::vector* macroOverride = nullptr ) + const std::vector* macroOverride = nullptr, std::uint32_t* shellCut = nullptr ) { - const std::vector nowSites = defectSitesOf( ing, root, nullptr, macroOverride ); + const std::vector nowSites = defectSitesOf( ing, root, nullptr, macroOverride, shellCut ); const auto isRealSite = []( std::uint64_t v ) { return v != kDefectFilePresent && v != kDefectFileUnreadable; }; std::vector baseVals, nowVals, baseUnreadable; for( const DefectSiteKey& d : base.defectSites ) @@ -12594,7 +12604,7 @@ inline std::vector computeDelta( const IngestResult& ing, const Grap if( kindSelected( scope.kinds, "defect-shape" ) ) { - appendDefectShapeRows( regs, ing, g, base, root, existedAtBaseline, stampLoc, scope.macroOverride ); // the twelfth kind (see its doc) + appendDefectShapeRows( regs, ing, g, base, root, existedAtBaseline, stampLoc, scope.macroOverride, extras != nullptr ? &extras->shellCut : nullptr ); // the twelfth kind (see its doc) } if( kindSelected( scope.kinds, "params" ) ) // QD-SWAP-1117 similar=: on by default, report-only (never gating) { diff --git a/src/shstatus.h b/src/shstatus.h index 867d82e81..10f6153fb 100644 --- a/src/shstatus.h +++ b/src/shstatus.h @@ -118,6 +118,36 @@ struct Tree std::vector nodes; std::vector lists; std::uint32_t top = kNone; + bool cut = false; // the nesting budget (kMaxShellNest) stopped the scan: what lies past it was not parsed +}; + +// ONE nesting budget for the lexer and the parser (CR712-SHSTATUS-DEPTH): every recursion of either — a quote or $( ) the +// lexer skips through, a compound command or a substitution the parser descends into — takes a level, so a script nested +// past kMaxShellNest is cut there (Tree::cut) instead of exhausting the stack (20,000 nested subshells crashed the scan). +inline constexpr int kMaxShellNest = 64; +struct NestBudget +{ + int depth = 0; + bool cut = false; +}; +// One level of the budget for the scope of a recursion; `over` = the budget is spent (and the cut is recorded). +class NestLevel +{ +public: + explicit NestLevel( NestBudget& b ) noexcept : b_( b ) + { + over_ = b_.depth >= kMaxShellNest; + b_.cut = b_.cut || over_; // the disclosure: Tree::cut, then the answer's shell_cut= (quality.h defectSitesOf) + ++b_.depth; + } + ~NestLevel() { --b_.depth; } + NestLevel( const NestLevel& ) = delete; + NestLevel& operator=( const NestLevel& ) = delete; + bool over() const noexcept { return over_; } + +private: + NestBudget& b_; + bool over_ = false; }; namespace detail @@ -462,9 +492,14 @@ inline bool isRedirOp( std::string_view o ) noexcept return o == "<" || o == ">" || o == ">>" || o == "&>" || o == "&>>" || o == ">&" || o == "<&" || o == "<>" || o == ">|" || o == "<<<" || o == "<<"; } -std::size_t skipParen( std::string_view s, std::size_t i ); -inline std::size_t skipQuote( std::string_view s, std::size_t i, char q ) // s[i] is the opening quote +std::size_t skipParen( std::string_view s, std::size_t i, NestBudget& nb ); +inline std::size_t skipQuote( std::string_view s, std::size_t i, char q, NestBudget& nb ) // s[i] is the opening quote { + const NestLevel level( nb ); + if( level.over() ) + { + return s.size(); // past the budget: the rest is one unscanned word (Tree::cut says so) + } ++i; while( i < s.size() ) { @@ -476,7 +511,7 @@ inline std::size_t skipQuote( std::string_view s, std::size_t i, char q ) // s } if( q == '"' && c == '$' && startsAt( s, i, "$(" ) ) { - i = skipParen( s, i + 1 ); + i = skipParen( s, i + 1, nb ); continue; } if( q == '"' && c == '`' ) @@ -493,8 +528,13 @@ inline std::size_t skipQuote( std::string_view s, std::size_t i, char q ) // s } return i; } -inline std::size_t skipParen( std::string_view s, std::size_t i ) // s[i] == '(' +inline std::size_t skipParen( std::string_view s, std::size_t i, NestBudget& nb ) // s[i] == '(' { + const NestLevel level( nb ); + if( level.over() ) + { + return s.size(); + } int depth = 0; while( i < s.size() ) { @@ -506,7 +546,7 @@ inline std::size_t skipParen( std::string_view s, std::size_t i ) // s[i] == ' } if( c == '\'' || c == '"' ) { - i = skipQuote( s, i, c ); + i = skipQuote( s, i, c, nb ); continue; } if( c == '#' && ( i == 0 || s[i - 1] == ' ' || s[i - 1] == '\t' || s[i - 1] == '\n' || s[i - 1] == ';' || s[i - 1] == '(' ) ) @@ -531,8 +571,13 @@ inline std::size_t skipParen( std::string_view s, std::size_t i ) // s[i] == ' } return i; } -inline std::size_t skipBrace( std::string_view s, std::size_t i ) // s[i] == '{' of a ${...} +inline std::size_t skipBrace( std::string_view s, std::size_t i, NestBudget& nb ) // s[i] == '{' of a ${...} { + const NestLevel level( nb ); + if( level.over() ) + { + return s.size(); + } int depth = 0; while( i < s.size() ) { @@ -544,7 +589,7 @@ inline std::size_t skipBrace( std::string_view s, std::size_t i ) // s[i] == ' } if( c == '\'' || c == '"' ) { - i = skipQuote( s, i, c ); + i = skipQuote( s, i, c, nb ); continue; } if( c == '{' ) @@ -567,7 +612,7 @@ inline std::size_t skipBrace( std::string_view s, std::size_t i ) // s[i] == ' // A double-quoted text with its own single quotes blanked: they are literal there ("don't"), but a quote inside a $( ) // or ` ` it holds is live ("$( grep -o '& out ) +inline void subsIn( std::string_view raw, std::uint32_t line, std::uint32_t base, std::vector& out, NestBudget& nb ) { std::size_t i = 0; while( i < raw.size() ) @@ -613,17 +658,17 @@ inline void subsIn( std::string_view raw, std::uint32_t line, std::uint32_t base } if( c == '\'' ) { - i = skipQuote( raw, i, '\'' ); + i = skipQuote( raw, i, '\'', nb ); continue; } if( startsAt( raw, i, "$((" ) ) { - i = skipParen( raw, i + 1 ); + i = skipParen( raw, i + 1, nb ); continue; } if( startsAt( raw, i, "$(" ) ) { - const std::size_t j = skipParen( raw, i + 1 ); + const std::size_t j = skipParen( raw, i + 1, nb ); out.push_back( { std::string( sliceOf( raw, i + 2, j - 1 ) ), static_cast( line + countNl( raw, 0, i ) ), static_cast( base + i + 2 ), kNone } ); i = j; continue; @@ -639,8 +684,13 @@ inline void subsIn( std::string_view raw, std::uint32_t line, std::uint32_t base if( c == '"' ) { // descend: substitutions inside double quotes are live (single quotes inside them are not quotes) - const std::size_t j = skipQuote( raw, i, '"' ); - subsIn( dqLiteralQuotes( sliceOf( raw, i + 1, j - 1 ) ), static_cast( line + countNl( raw, 0, i ) ), static_cast( base + i + 1 ), out ); + const std::size_t j = skipQuote( raw, i, '"', nb ); + const NestLevel level( nb ); // the descent is a recursion of its own + if( level.over() ) + { + return; + } + subsIn( dqLiteralQuotes( sliceOf( raw, i + 1, j - 1 ), nb ), static_cast( line + countNl( raw, 0, i ) ), static_cast( base + i + 1 ), out, nb ); i = j; continue; } @@ -703,7 +753,7 @@ inline std::size_t heredocDelim( std::string_view s, std::size_t k, std::string& class Lexer { public: - Lexer( std::string_view src, std::uint32_t line0, std::uint32_t base ) : src_( src ), n_( src.size() ), line_( line0 ), base_( base ) {} + Lexer( std::string_view src, std::uint32_t line0, std::uint32_t base, NestBudget& nb ) : src_( src ), n_( src.size() ), line_( line0 ), base_( base ), nb_( nb ) {} std::vector run() { @@ -725,6 +775,7 @@ class Lexer std::size_t i_ = 0; std::uint32_t line_; std::uint32_t base_; + NestBudget& nb_; std::vector> pending_; // heredoc delimiters waiting for the end of this line bool prevBlank_ = true; std::vector toks_; @@ -758,7 +809,7 @@ class Lexer t.word.pos = posAt( b ); if( withSubs ) { - subsIn( t.word.text, line_, t.word.pos, t.word.subs ); + subsIn( t.word.text, line_, t.word.pos, t.word.subs, nb_ ); } t.line = line_; t.pos = t.word.pos; @@ -933,7 +984,7 @@ class Lexer } if( d == '\'' || d == '"' ) { - return skipQuote( src_, i, d ); + return skipQuote( src_, i, d, nb_ ); } if( d == '`' ) { @@ -942,27 +993,26 @@ class Lexer } if( startsAt( src_, i, "$(" ) ) { - return skipParen( src_, i + 1 ); + return skipParen( src_, i + 1, nb_ ); } if( startsAt( src_, i, "${" ) ) { - return skipBrace( src_, i + 1 ); + return skipBrace( src_, i + 1, nb_ ); } if( d == '(' && i > start && src_[i - 1] == '=' ) // array assignment X=( ... ) { - return skipParen( src_, i ); + return skipParen( src_, i, nb_ ); } return i + 1; } }; -inline std::vector lex( std::string_view src, std::uint32_t line0, std::uint32_t base ) +inline std::vector lex( std::string_view src, std::uint32_t line0, std::uint32_t base, NestBudget& nb ) { - return Lexer( src, line0, base ).run(); + return Lexer( src, line0, base, nb ).run(); } // ── parser ────────────────────────────────────────────────────────────────────────────────────────────────────────── -inline constexpr int kMaxSubDepth = 40; // nested $( ) parsed past this depth are left unparsed (an empty list) struct Stops { @@ -976,7 +1026,7 @@ struct Stops class Parser { public: - Parser( Tree& tree, std::vector toks, int depth ) : t_( std::move( toks ) ), tree_( tree ), depth_( depth ) {} + Parser( Tree& tree, std::vector toks, NestBudget& nb ) : t_( std::move( toks ) ), tree_( tree ), nb_( nb ) {} std::uint32_t parseAll() { @@ -1000,7 +1050,7 @@ class Parser std::vector t_; std::size_t i_ = 0; Tree& tree_; - int depth_; + NestBudget& nb_; // shared with the lexer and every nested Parser: one budget for the whole script Tok eof_{}; const Tok& peek() const noexcept @@ -1057,11 +1107,12 @@ class Parser { for( Sub& s : w.subs ) { - if( depth_ >= kMaxSubDepth ) + const NestLevel level( nb_ ); + if( level.over() ) { - continue; + continue; // past the budget: an empty list (Tree::cut says so) } - Parser p( tree_, lex( s.inner, s.line, s.pos ), depth_ + 1 ); + Parser p( tree_, lex( s.inner, s.line, s.pos, nb_ ), nb_ ); s.list = p.parseAll(); } } @@ -1146,6 +1197,12 @@ class Parser } std::uint32_t parseCommand( const Stops& stops ) { + const NestLevel level( nb_ ); // every nested list (subshell, group, if, loop, case, function body) is reached through here + if( level.over() ) + { + i_ = t_.size(); // past the budget: the rest of this token stream is not parsed (Tree::cut says so) + return kNone; + } const Tok& p = peek(); if( p.kind == TokKind::Eof || stopped( stops ) ) { @@ -1453,8 +1510,10 @@ class Parser inline Tree parse( std::string_view src ) { Tree t; - detail::Parser p( t, detail::lex( src, 1, 0 ), 0 ); + NestBudget nb; + detail::Parser p( t, detail::lex( src, 1, 0, nb ), nb ); t.top = p.parseAll(); + t.cut = nb.cut; return t; } diff --git a/src/verbs_quality.h b/src/verbs_quality.h index 94324d807..ccdca0d9d 100644 --- a/src/verbs_quality.h +++ b/src/verbs_quality.h @@ -1477,7 +1477,7 @@ inline constexpr const char* kQdLegendCore = "score). THIRTEEN KINDS, and kind= on every row names which one: complexity over the ccx bar, verbosity " "(LOC), nesting, params, duplication, dead-code, api-surface (new public contract drift), " "error-masking, short-horizon-churn, new-clone-of-reused-helper, placeholder (added stub/TODO), " - "defect-shape (defect= names it), tangle (a long function's nesting, deep share and steering locals; a new or crossing one gates). " + "defect-shape (defect= names it), tangle (a long function's nesting, deep share and steering locals; a new, crossing or growing one gates). " "THREE independent axes, in this " "order: (1) acked findings are suppressed entirely (acked= counts them); (2) ORIGIN — a finding on a " "symbol that EXISTED at the baseline is preexisting-worse (no origin attribute), one that exists only " @@ -1495,7 +1495,11 @@ inline constexpr const char* kQdLegendCore = // P3 (L7): next= on gating rows, defined where the reader meets it "A gating row's next= is the one pasteable follow-up: expand on FILE:NAME, the body to fix (a duplication row names a SET and carries none). " // P8 (L7): the threshold beside the number - "bar= on a complexity/verbosity/nesting/params row is the threshold now= is judged against (ccx 15, loc 60, nest 4, params 5). "; + "bar= on a complexity/verbosity/nesting/params row is the threshold now= is judged against (ccx 15, loc 60, nest 4, params 5). " + // CR712-SHSTATUS-DEPTH: present only when not 0 + "shell_cut=N: shell files whose defect-shape scan stopped at nesting depth 64; what lies deeper was not judged. "; + +static_assert( rw::shstatus::kMaxShellNest == 64, "kQdLegendCore's and compactlegend.h's shell_cut= sentences say depth 64" ); // The macro FAMILIES, and why a member of one cannot be judged dead — printed only when the run actually // excluded something, because on a repo with no such macro the roster explains an empty set. diff --git a/test/capdisclose.map b/test/capdisclose.map index 387968960..6c5b7c6ec 100644 --- a/test/capdisclose.map +++ b/test/capdisclose.map @@ -182,6 +182,7 @@ kMaxQualifierHops pending:B43 ingest extraction bound (LARGE-PARTIAL-1 widened t kMaxRefs pending:B43 disclosed elsewhere: refs_omitted= (refsOmittedAttr, which the lint cannot tie to the cap) and a stderr warning (LARGE-PARTIAL-1) kMaxRenameProbeFiles none:a rename hint is never a claim (Stage 0 class d) kMaxRestDepth sink:noteCapped +kMaxShellNest sink:cut kMaxRestName pending:B43 ingest extraction bound (LARGE-PARTIAL-1 widened the lint to ingest*.h); the sibling lane NO-SKIP-INGEST owns the ingest limits and audits it kMaxRestUnits sink:noteCapped kMaxRoleBytes pending:B43 ingest extraction bound (LARGE-PARTIAL-1 widened the lint to ingest*.h); the sibling lane NO-SKIP-INGEST owns the ingest limits and audits it diff --git a/test/lib/capdisclose.py b/test/lib/capdisclose.py index de7204ce5..92bc47c06 100755 --- a/test/lib/capdisclose.py +++ b/test/lib/capdisclose.py @@ -6,7 +6,7 @@ Scope: a constant `constexpr kName = ` defined in an answer-path file (src/for*.h, src/verbs_*.h, src/pathroute.h, src/clones.h; LARGE-PARTIAL-1 added the size and git-sweep caps' files src/crossref.h, -src/ingest*.h, src/search.h, src/binstale.h) that some line of src/ compares as a bound (a CAP SITE, below), or whose +src/ingest*.h, src/search.h, src/binstale.h; CR712-SHSTATUS-DEPTH the shell parser's nesting budget, src/shstatus.h) that some line of src/ compares as a bound (a CAP SITE, below), or whose name says it bounds something (Max, Limit, Cap, Ceiling, Depth, Pairs), or that a `static_assert( kName == N, ... )` ties to legend text. The name alone is not the scope: #613's reader cap was kReaderCallerReaders. A name with `Min` is a threshold (a row needs at least N), not a cut, and is out of scope. A CAP SITE is a line that compares the @@ -47,7 +47,7 @@ def uncommented( text ): def answer_path( root ): out = [] for f in sorted( os.listdir( os.path.join( root, "src" ) ) ): - if ( f.startswith( ( "for", "verbs_", "ingest" ) ) and f.endswith( ".h" ) ) or f in ( "pathroute.h", "clones.h", "crossref.h", "search.h", "binstale.h" ): + if ( f.startswith( ( "for", "verbs_", "ingest" ) ) and f.endswith( ".h" ) ) or f in ( "pathroute.h", "clones.h", "crossref.h", "search.h", "binstale.h", "shstatus.h" ): out.append( "src/" + f ) return out diff --git a/test/regression.sh b/test/regression.sh index 605fbe807..1112c34eb 100755 --- a/test/regression.sh +++ b/test/regression.sh @@ -1043,6 +1043,7 @@ for _g in \ shallowhistorycheck \ shapingflagcheck \ shellgateindexcheck \ + shellnestcheck \ showcasecapturecheck \ shrinkpaircheck \ sibliftcheck \ diff --git a/test/shellnestcheck.sh b/test/shellnestcheck.sh new file mode 100755 index 000000000..5925fca2f --- /dev/null +++ b/test/shellnestcheck.sh @@ -0,0 +1,78 @@ +#!/usr/bin/env bash +# shellnestcheck.sh — CR712-SHSTATUS-DEPTH: the shell parser's ONE nesting budget (src/shstatus.h kMaxShellNest), shared by the +# lexer's quote / $( ) / ${ } skips and the parser's compound commands and substitutions, cuts a deeply nested script instead +# of exhausting the stack, and --quality-delta says so (shell_cut= on the root, XML and --json). +# +# The scripts are GENERATED here, never committed (PRODUCER_COMMON 12: a committed fixture that trips a cap would put a +# disclosure into every whole-repo run). Each is a new test script under test/ in a one-commit repo, so the defect-shape +# scan (vacuous-assert and unhandled-arm, both through shstatus::parse) reads it. +# (p1)-(p5) DEEP: 5,000 levels of one shape each — nested subshells, brace groups, if-then, "$( … "$( … )" … )" quotes and +# bare $( ) substitutions: the run exits 0 or 2 (no signal), within 60 s, and the root carries shell_cut="1". +# Red before the lane (main 8861b0d4d): subshell, group and if die on SIGSEGV (rc 139); quote and subst exit 0 with no +# disclosure (the old 40-level substitution cap cut them silently). At 20,000 levels ingest itself takes 60-70 s +# (tree-sitter on the file, outside this card), so the gate stays at 5,000. +# (j) --json on the subshell script: "shell_cut":1. +# (n1) UNDER THE BUDGET: a function ending in a case with no *) arm (unhandled-arm), 40 subshells deep: the unhandled-arm row is still found +# and there is no shell_cut= (the budget cut nothing real). Red on a build with a budget under 40. +# (n2) SHALLOW: the same file at depth 1: no shell_cut= (premise for n1: the row exists without nesting too). +# Usage: test/shellnestcheck.sh [BIN] +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" +[ -x "$BIN" ] || { echo "no ripwire binary at $BIN — build first"; exit 2; } +TMP="$( mktemp -d )"; trap 'rm -rf "$TMP"' EXIT +export TMPDIR="$TMP/cache"; mkdir -p "$TMPDIR" +export HOME="$TMP/home"; mkdir -p "$HOME" +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; } +echo "shellnestcheck: BIN=$BIN" +G=( git -c user.name=t -c user.email=t@t -c commit.gpgsign=false ) + +# gen KIND N OUT — one script nested N levels in one shape (python: no shell recursion of our own) +gen(){ python3 - "$1" "$2" "$3" <<'PY' +import sys +kind, n, out = sys.argv[1], int(sys.argv[2]), sys.argv[3] +case = 'kindof() { case "$1" in a) echo x ;; b) echo y ;; esac; }; kindof a' +body = { + "subshell": "( " * n + "false" + " )" * n, + "group": "{ " * n + "false; " + "}; " * n, + "if": "if true; then " * n + "false" + "; fi" * n, + "quote": 'x="' + '$( echo "' * n + "y" + '" )' * n + '"', + "subst": "x=" + "$( echo " * n + "y" + " )" * n, + "case": "( " * n + case + " )" * n, +}[kind] +with open(out, "w") as f: + f.write("#!/usr/bin/env bash\nset -u\n" + body + "\n") +PY +} +# repo KIND N — a one-commit repo whose working tree adds test/deep_check.sh; prints its path +repo(){ local R="$TMP/r-$1-$2"; mkdir -p "$R/test"; "${G[@]}" -C "$R" init -q; echo 'echo hi' >"$R/test/a.sh" + "${G[@]}" -C "$R" add -A && "${G[@]}" -C "$R" commit -qm a; gen "$1" "$2" "$R/test/deep_check.sh"; printf '%s' "$R"; } +cutof(){ grep -oE ']*' "$1" | grep -oE ' shell_cut="[0-9]+"' | grep -oE '[0-9]+'; } + +for k in subshell group if quote subst; do + R="$( repo "$k" 5000 )"; s=$( date +%s ) + "$BIN" "$R" --quality-delta --no-cache >"$TMP/$k.xml" 2>"$TMP/$k.err"; rc=$?; t=$(( $( date +%s ) - s )) + c="$( cutof "$TMP/$k.xml" )" + if { [ "$rc" = 0 ] || [ "$rc" = 2 ]; } && [ "$t" -le 60 ] && [ "${c:-0}" = 1 ]; then ok "($k) 5000 deep: rc=$rc in ${t}s, shell_cut=\"$c\"" + else no "($k) 5000 deep: want rc 0/2 within 60 s and shell_cut=\"1\"; got rc=$rc in ${t}s, shell_cut='${c:-none}' ($( tail -c 160 "$TMP/$k.err" | tr '\n' ' ' ))"; fi +done +R="$TMP/r-subshell-5000" +j="$( "$BIN" "$R" --quality-delta --json --no-cache 2>/dev/null | python3 -c 'import json,sys; print(json.load(sys.stdin).get("shell_cut","absent"))' 2>/dev/null || echo unparseable )" +if [ "$j" = 1 ]; then ok "(j) --json: \"shell_cut\":1"; else no "(j) --json: want \"shell_cut\":1, got '$j'"; fi + +for n in 40 1; do + R="$( repo case "$n" )" + "$BIN" "$R" --quality-delta --no-cache >"$TMP/case$n.xml" 2>/dev/null + row="$( grep -oE ']*defect="unhandled-arm"[^>]*>' "$TMP/case$n.xml" | grep 'deep_check.sh' | head -1 )" + c="$( cutof "$TMP/case$n.xml" )" + label=n1; [ "$n" = 1 ] && label=n2 + if [ -n "$row" ] && [ -z "$c" ]; then ok "($label) case $n deep: the unhandled-arm row is found, no shell_cut=: $row" + else no "($label) case $n deep: want an unhandled-arm row in deep_check.sh and no shell_cut=; got row='${row:-none}' shell_cut='${c:-none}'"; fi +done + +[ "$fail" = 0 ] && echo "shellnestcheck: PASS" || echo "shellnestcheck: FAIL" +exit "$fail" From e01533c9a78b83550e45d50d5f755c23a4701ab5 Mon Sep 17 00:00:00 2001 From: joyful-ii-V-I <210578314+joyful-ii-V-I@users.noreply.github.com> Date: Sat, 21 Nov 2026 18:51:58 -0500 Subject: [PATCH 07/44] qd: re-file two-bit-era defect-shape acks to the three-bit key (CR712-ACK-KEY-MASK) QD-UNCHECKED-STATUS widened the defect site value's facet bits from two to three, which moved every site whose hash had bit 2 set and with it the defectRowKey of its row: about half of the format-arity acks written by v0.6.9/v0.6.10 stopped matching, so the acked row gated again and the ack was listed stale. Each defect site now also carries its two-bit value (defectLegacySiteValue); addDefectFacetSchemeAliases maps every (anchor, facet) row's two-bit key to its current key through the existing SCHEME alias path, only when the ledger holds a defect-shape ack. A legacy ack is suppressed, counted in acks_rekeyed_by_scheme=, and healed forward by the next --quality-ack; an ack written under the current scheme matches directly as before. Gate: test/defectackschemecheck.sh (legacy key recorded from v0.6.9; red on main 8861b0d4d: rc 2, stale=1, the row gates). Co-Authored-By: Claude Opus 5.5 --- src/quality.h | 73 ++++++++++++++++++++++++++++++- src/verbs_quality.h | 5 ++- test/defectackschemecheck.sh | 83 ++++++++++++++++++++++++++++++++++++ test/regression.sh | 1 + 4 files changed, 160 insertions(+), 2 deletions(-) create mode 100755 test/defectackschemecheck.sh diff --git a/src/quality.h b/src/quality.h index aabac7458..19fcd696a 100644 --- a/src/quality.h +++ b/src/quality.h @@ -1385,6 +1385,29 @@ inline std::uint64_t defectSiteValue( defectshape::Facet f, std::string_view tex return v; } +// CR712-ACK-KEY-MASK — the site value as the two-bit facet scheme spelled it (v0.6.10 and before: four facets, `& ~3`). +// QD-UNCHECKED-STATUS widened the facet bits to three, which moved every site value whose hash had bit 2 set, and with it the +// defectRowKey of every row holding such a site: a released ack of a format-arity row stopped matching and the row gated +// again. addDefectFacetSchemeAliases re-files such an ack to the current key; this is the old value it needs. A facet the +// two-bit scheme never had (unchecked-status, unhandled-arm) has none (0). +inline std::uint64_t defectLegacySiteValue( defectshape::Facet f, std::string_view text ) +{ + constexpr std::uint64_t kLegacyMask = 3; + if( static_cast( f ) > kLegacyMask ) + { + return 0; + } + std::string id( defectshape::facetName( f ) ); + id.push_back( '\0' ); + id.append( text ); + std::uint64_t h = fnv1a64( id ) & ~kLegacyMask; + if( h == 0 ) + { + h = kLegacyMask + 1; + } + return h | static_cast( f ); +} + // A defect-shape ROW's identity — the ack key: the anchor, the facet AND the identities of the anchor's sites of // that facet (each a defectSiteValue: facet + normalized offending text), so an ack covers exactly the defects it // named (checklist 16). A format-arity ack and a utf8-cut ack on one definition are two acks; and an ack of @@ -1439,6 +1462,7 @@ struct DefectSiteAt std::uint32_t line = 0; std::string_view call; // unchecked-status: the call whose status is dropped (defectshape's static spelling) std::string why; // unhandled-arm: what the classifier leaves without an outcome (defectshape's Site::why) + std::uint64_t legacySite = 0; // CR712-ACK-KEY-MASK: the site's value in the two-bit scheme (defectLegacySiteValue), 0 = none }; @@ -6790,7 +6814,7 @@ inline std::vector defectSitesOf( const IngestResult& ing, std::st const NodeId owner = enclosingDefOf( ing, byFile, f, st.startByte ); const std::uint64_t anchor = owner == kNoNode ? fileAnchor : qualityKey( ing, owner, root ); const std::uint32_t line = static_cast( 1 + std::count( src.begin(), src.begin() + st.startByte, '\n' ) ); - out.push_back( { { anchor, defectSiteValue( st.facet, st.text ) }, owner, f, line, st.call, st.why } ); + out.push_back( { { anchor, defectSiteValue( st.facet, st.text ) }, owner, f, line, st.call, st.why, defectLegacySiteValue( st.facet, st.text ) } ); } } std::stable_sort( out.begin(), out.end(), []( const DefectSiteAt& a, const DefectSiteAt& b ) { return a.key < b.key; } ); @@ -9724,6 +9748,52 @@ inline void addSchemeAliases( IdentityAliases& al, const IngestResult& ing, cons std::sort( al.schemeAmbiguousKeys.begin(), al.schemeAmbiguousKeys.end() ); } +// CR712-ACK-KEY-MASK — the defect-shape half of the SCHEME migration: for every current (anchor, facet) row whose key under the +// two-bit site values (defectLegacySiteValue) differs from its key now, legacy key -> current key, fed into the same toCurrent +// map addSchemeAliases fills, so remapAckIdentity re-files a released ack (acks_rekeyed_by_scheme=), computeStaleAcks reads it at +// its current key, and --quality-ack writes it back healed. It scans the tree's defect sites once, and only when the ledger +// holds a defect-shape ack. Add, never overwrite (a rename alias keeps precedence). +inline void addDefectFacetSchemeAliases( IdentityAliases& al, const gtl::btree_map& acks, const IngestResult& ing, + std::string_view root ) +{ + if( std::none_of( acks.begin(), acks.end(), []( const auto& kv ) { return kv.second.kind.starts_with( "defect-shape" ); } ) ) + { + return; + } + const std::vector sites = defectSitesOf( ing, root, nullptr ); // sorted by (anchor, site) + for( auto it = sites.begin(); it != sites.end(); ) + { + const auto end = std::find_if( it, sites.end(), [ & ]( const DefectSiteAt& d ) { return d.key.anchor != it->key.anchor; } ); + for( std::size_t f = 0; f < defectshape::kFacetCount; ++f ) + { + std::vector now, old; + for( auto d = it; d != end; ++d ) + { + if( d->legacySite != 0 && d->key.site != kDefectFilePresent && d->key.site != kDefectFileUnreadable + && defectFacetOf( d->key.site ) == static_cast( f ) ) + { + now.push_back( d->key.site ); + old.push_back( d->legacySite ); + } + } + if( now.empty() ) + { + continue; + } + std::sort( now.begin(), now.end() ); + std::sort( old.begin(), old.end() ); + const auto facet = static_cast( f ); + const std::uint64_t oldKey = defectRowKey( it->key.anchor, facet, old ), newKey = defectRowKey( it->key.anchor, facet, now ); + if( oldKey != newKey && al.toCurrent.emplace( oldKey, newKey ).second ) + { + al.schemeKeys.push_back( oldKey ); + } + } + it = end; + } + std::sort( al.schemeKeys.begin(), al.schemeKeys.end() ); +} + // The two transient rename facts the delta reads (Snapshot::renamedFrom, Snapshot::renamedKeys), from the RENAME aliases only and // BEFORE remapSnapshotIdentity: a key counts as re-filed only when the alias fills a hole (its source is in the baseline and its // target is not), so a file renamed long before the baseline (the ledger's 400-commit window) marks nothing. @@ -10280,6 +10350,7 @@ inline IdentityHealing healIdentity( Snapshot& base, gtl::btree_map\n#include \nint drive() { return 1; }\n' >"$1/src/a.cpp" + "${G[@]}" -C "$1" add -A && "${G[@]}" -C "$1" commit -qm a + printf '#include \n#include \nstd::string label1( int a )\n{\n return std::format( "{} 1", a, a );\n}\nint drive() { return 1; }\n' >"$1/src/a.cpp"; } +ackkey(){ grep -E '^ack defect-shape ' "$1/$LEDGER" | awk '{ print $3 }' | tr '\n' ' ' | sed 's/ $//'; } +root(){ grep -oE ']*' "$1"; } +attr(){ root "$2" | grep -oE " $1=\"[0-9]+\"" | grep -oE '[0-9]+'; } +ack(){ ( cd "$1" && "$BIN" . --quality-delta --no-cache --ack-only=format-arity --quality-ack="$2" >/dev/null 2>&1 ); } +run(){ ( cd "$1" && "$BIN" . --quality-delta --no-cache >"$2" 2>/dev/null ); } + +# (p) the binary's own key for this row +fixture "$TMP/cur"; ack "$TMP/cur" "current ack" +CUR="$( ackkey "$TMP/cur" )" +if [ -n "$CUR" ] && [ "$CUR" != "$LEGACY_KEY" ]; then ok "(p) the row's current key $CUR differs from its two-bit key $LEGACY_KEY" +else no "(p) want one current key different from $LEGACY_KEY; got '${CUR:-none}' — the fixture no longer exercises a moved site"; fi + +# (l) the legacy ledger row, verbatim as v0.6.9 wrote it +fixture "$TMP/leg" +printf 'ack defect-shape %s 1 now=1 was=0 facet=format-arity p=src/a.cpp:3 legacy ack\n' "$LEGACY_KEY" >"$TMP/leg/$LEDGER" +run "$TMP/leg" "$TMP/leg.xml"; rc=$? +a="$( attr acked "$TMP/leg.xml" )"; s="$( attr stale "$TMP/leg.xml" )"; g="$( attr gating "$TMP/leg.xml" )"; k="$( attr acks_rekeyed_by_scheme "$TMP/leg.xml" )" +if [ "$rc" = 0 ] && [ "$a" = 1 ] && [ "$s" = 0 ] && [ "$g" = 0 ] && [ "$k" = 1 ]; then ok "(l) the two-bit ack suppresses its row: rc=0 acked=1 stale=0 gating=0 acks_rekeyed_by_scheme=1" +else no "(l) want rc=0 acked=1 stale=0 gating=0 acks_rekeyed_by_scheme=1; got rc=$rc acked=${a:-?} stale=${s:-?} gating=${g:-?} acks_rekeyed_by_scheme=${k:-absent}"; fi + +# (c) the binary's own ack +run "$TMP/cur" "$TMP/cur.xml"; rc=$? +a="$( attr acked "$TMP/cur.xml" )"; k="$( attr acks_rekeyed_by_scheme "$TMP/cur.xml" )" +if [ "$rc" = 0 ] && [ "$a" = 1 ] && [ -z "$k" ]; then ok "(c) the current-key ack matches directly: rc=0 acked=1, no acks_rekeyed_by_scheme=" +else no "(c) want rc=0 acked=1 and no acks_rekeyed_by_scheme=; got rc=$rc acked=${a:-?} acks_rekeyed_by_scheme=${k:-absent}"; fi + +# (h) re-ack heals the legacy row forward +ack "$TMP/leg" "re-ack" +HK="$( ackkey "$TMP/leg" )"; reason="$( grep -cE '^ack defect-shape .* legacy ack$' "$TMP/leg/$LEDGER" )" +run "$TMP/leg" "$TMP/heal.xml"; rc=$?; k="$( attr acks_rekeyed_by_scheme "$TMP/heal.xml" )" +if [ "$HK" = "$CUR" ] && [ "$reason" = 1 ] && [ "$rc" = 0 ] && [ -z "$k" ]; then ok "(h) --quality-ack re-filed the row at $HK with its reason; the next run needs no alias" +else no "(h) want the ledger at $CUR with the legacy reason and a later run without acks_rekeyed_by_scheme=; got key='${HK:-none}' reason-rows=$reason rc=$rc acks_rekeyed_by_scheme=${k:-absent}"; fi + +# (r) optional: re-derive the recorded key with a two-bit binary +if [ -n "${RIPWIRE_LEGACY_BIN:-}" ]; then + fixture "$TMP/rec"; ( cd "$TMP/rec" && "$RIPWIRE_LEGACY_BIN" . --quality-delta --no-cache --ack-only=format-arity --quality-ack="legacy ack" >/dev/null 2>&1 ) + RK="$( ackkey "$TMP/rec" )" + if [ "$RK" = "$LEGACY_KEY" ]; then ok "(r) $RIPWIRE_LEGACY_BIN writes the recorded two-bit key $RK"; else no "(r) $RIPWIRE_LEGACY_BIN wrote '${RK:-none}', the recorded key is $LEGACY_KEY"; fi +fi + +[ "$fail" = 0 ] && echo "defectackschemecheck: PASS" || echo "defectackschemecheck: FAIL" +exit "$fail" diff --git a/test/regression.sh b/test/regression.sh index 1112c34eb..aa3efc658 100755 --- a/test/regression.sh +++ b/test/regression.sh @@ -1044,6 +1044,7 @@ for _g in \ shapingflagcheck \ shellgateindexcheck \ shellnestcheck \ + defectackschemecheck \ showcasecapturecheck \ shrinkpaircheck \ sibliftcheck \ From 119dca4d5289efe8e140a5f908d8de873a70e3ad Mon Sep 17 00:00:00 2001 From: joyful-ii-V-I <210578314+joyful-ii-V-I@users.noreply.github.com> Date: Sat, 21 Nov 2026 19:00:07 -0500 Subject: [PATCH 08/44] =?UTF-8?q?docs:=20tangle=20gates,=20shell=5Fcut,=20?= =?UTF-8?q?two-bit=20ack=20re-filing=20=E2=80=94=20README,=20EVALS,=20skil?= =?UTF-8?q?l,=20COMMANDS,=20changelog?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The exception rule now names its third case everywhere it is stated: new-symbol rows never gate, except defect-shape format-arity, a new function at the ceiling and a tangled new function. defectshapecheck's surfaces arm requires it. EVALS records the 20-merge replay (main 0 gating / lane 9 over 5 PRs; the four non-growth tag-best rows print nothing). Three changelog fragments. Co-Authored-By: Claude Opus 5.5 --- README.md | 7 ++++--- changelog.d/defect-ack-two-bit.md | 3 +++ changelog.d/shell-nest-budget.md | 3 +++ changelog.d/tangle-gates.md | 3 +++ docs/COMMANDS.md | 4 ++-- docs/EVALS.md | 16 +++++++++++++--- skills/ripwire-quality-bar/SKILL.md | 4 ++-- test/defectshapecheck.sh | 7 ++++--- 8 files changed, 34 insertions(+), 13 deletions(-) create mode 100644 changelog.d/defect-ack-two-bit.md create mode 100644 changelog.d/shell-nest-budget.md create mode 100644 changelog.d/tangle-gates.md diff --git a/README.md b/README.md index 2ccbcfa70..7c9565406 100644 --- a/README.md +++ b/README.md @@ -964,10 +964,11 @@ AI-authored commits, a function rewritten again inside two weeks **+15%** more l `--quality-delta`'s 13 kinds each target one measured mode like those (the eleventh, `placeholder`, lists the stubs and TODOs a change adds, and never gates; the twelfth, `defect-shape`, catches four defect shapes review kept finding by hand — -new-symbol rows never gate, except defect-shape format-arity and a new function at the ceiling, +new-symbol rows never gate, except defect-shape format-arity, a new function at the ceiling and a tangled new function, because a format/argument mismatch is a defect, not debt, and a new function at 4x the bar — ccx 60 or 240 lines — -is how a 1,000-line function starts; the thirteenth, `tangle`, is report-only: a long function's nesting, deep share and -steering locals, with length only amplifying them, so a long orchestrator of named steps stays quiet), and it reports **only what your +is how a 1,000-line function starts; the thirteenth, `tangle`, scores a long function's nesting, deep share and +steering locals, with length only amplifying them, so a long orchestrator of named steps stays quiet, and gates a function +that is new at tangle 6 or more, crossed 6, or grew while over it), and it reports **only what your change made worse** — then `--exemplar` shows the pattern in your own repo to copy, and `--test-gate` names the tests that must run before "done." diff --git a/changelog.d/defect-ack-two-bit.md b/changelog.d/defect-ack-two-bit.md new file mode 100644 index 000000000..f7bf74d67 --- /dev/null +++ b/changelog.d/defect-ack-two-bit.md @@ -0,0 +1,3 @@ +### Fixed — format-arity acks written by 0.6.10 and earlier match again + +The unchecked-status facet widened the facet bits of a defect-shape site value from two to three, which changed the ack key of every row holding a site whose hash had bit 2 set (about half of all one-site rows; 4 of 8 in a fixture sample): an ack written by 0.6.10 or earlier stopped matching, the row gated again and the ack was listed stale. Such an ack is now re-filed to its current key on read (counted in `acks_rekeyed_by_scheme=`) and written back healed by the next `--quality-ack`. Only rows whose key moved are affected; acks written since are unchanged. New gate `test/defectackschemecheck.sh`, its legacy key recorded from the released 0.6.9 binary. diff --git a/changelog.d/shell-nest-budget.md b/changelog.d/shell-nest-budget.md new file mode 100644 index 000000000..7adaec24a --- /dev/null +++ b/changelog.d/shell-nest-budget.md @@ -0,0 +1,3 @@ +### Fixed — a deeply nested shell script no longer crashes `--quality-delta` + +The shell lexer and parser behind the Bash defect-shape facets recursed without a bound on subshells, brace groups, `if` and quote/substitution nesting; a test script 5,000 levels deep ended the run on SIGSEGV. One nesting budget (64 levels) now covers the lexer and the parser; a script that reaches it is cut there, and the run says so with `shell_cut=N` on the `` root (and `"shell_cut"` in `--json`): N shell files whose scan stopped, what lies deeper was not judged. The old silent 40-level substitution cap is gone. New gate `test/shellnestcheck.sh` (generated scripts, never committed). diff --git a/changelog.d/tangle-gates.md b/changelog.d/tangle-gates.md new file mode 100644 index 000000000..fce77ca4d --- /dev/null +++ b/changelog.d/tangle-gates.md @@ -0,0 +1,3 @@ +### Changed — `--quality-delta`'s tangle kind gates a new, crossing or growing tangle + +`tangle` was report-only. A row now gates (exit 2) when the function is new at tangle 6.0 or more, crossed 6.0, or its score grew against the range base while over 6.0; a moved body and test code never gate, and a row an input rose on while the score held stays `sev="minor"`. The best-since-tag ratchet is now a facet (`ratchet=`) on those rows, not a row of its own, so a function that only sits above its tag best no longer prints. Replayed on the 20 merges before 8861b0d4d (tangle kind, range form): main gated 0 rows; this gates 9 over 5 PRs, every one a function that crossed or grew in its own PR (#702 `runLsp` 2.1→11.0, eight growth rows of a tenth or more), and the four rows on functions that did not grow in their PR print nothing. What it does not mean: a function already over 6.0 that the change leaves no worse never gates. Method and table: `docs/EVALS.md`, the thirteen kinds. diff --git a/docs/COMMANDS.md b/docs/COMMANDS.md index 0a950b665..93da48fda 100644 --- a/docs/COMMANDS.md +++ b/docs/COMMANDS.md @@ -2988,7 +2988,7 @@ $ ./build/ripwire . --quality-delta --show-stale **Answers:** before a PR: report ONLY what your change made worse, across 13 kinds — pair with --test-gate. -Each kind is measured against the baseline (complexity/verbosity/nesting/params/dup/dead/api-surface + error-masking/short-horizon-churn/new-clone-of-reused-helper + placeholder + defect-shape + tangle, report-only); every finding is classified by ORIGIN: a symbol that EXISTED at the baseline and got worse (preexisting-worse="N", no attribute on the row) vs one that exists only because the code is NEW (new-symbol="N", origin="new-symbol" on the row). A small numeric delta is additionally sev="minor". EXIT 2 ONLY on a major AND unacked row that is preexisting-worse, defect-shape format-arity (any origin) or a new function at the ceiling — the gating="N" header count. New-symbol rows are still PRINTED (they are the debt you are adding — read them); new-symbol rows never gate, except defect-shape format-arity and a new function at the ceiling (4x the bar: ccx 60 or 240 lines, not a moved body, not test code, ceiling= on the row); exit 0 means "nothing that already existed got worse", not "clean". Clone kinds classify by member set (new-symbol only if EVERY member is new); short-horizon-churn is preexisting by construction. LIMIT: origin is canonId (path::scope::name) identity; a function RENAMED or MOVED with its body unchanged (whitespace and its own name aside: one body that left its key, matched to one new key) keeps its identity and the move reports nothing (and a file rename git recorded keeps each symbol in it under its own name, twins and changed bodies included), while one whose body also changed reads as new and a regression carried in with it will not gate; a function over the ccx or line bar whose body moved with a small edit (a clone-sketch match to a body that left its key) reads origin="moved" and never gates. error-masking = a NEW empty/pass/comment-only handler, or log-only (a broad handler whose body only logs and never names the error) or rethrow-only (the sole handler re-throws it unchanged); those two gate only where their precision was measured (Python) and are sev="minor" in every other language. Empty counts Go's `if err != nil {}` on a call's err and Rust's `if let Err(..) = f() {}` / `Err(..) => {}` or `=> ()`, and gates like Python's `except: pass`; log-only counts a Rust Err arm of print/log macros and a C++ catch of `std::cerr <<`, `LOG( x ) <<` or `fprintf( stderr, … )` (sev="minor"). facet="failure-default": a read, parse or spawn failure returned as an empty success (a TypeScript catch or .catch returning []/null/{}/false/0/'' around JSON.parse/fs reads/exec/spawn/fetch, in a function typed to return an array/boolean/object; a C++ value_or( empty ) on a file read); it never gates by itself. placeholder = a stub the change ADDED (todo!()/unimplemented!(), Kotlin TODO(), NotImplementedException, a bare raise NotImplementedError as a free function's body, a throw/raise/panic/assert saying "not implemented") or a comment line opening with TODO/FIXME that names no issue (#12, ABC-12, a URL); new-symbol by construction, so it never gates. Counted per enclosing symbol, like error-masking: a file-level TODO outside every definition is not counted. defect-shape = a known defect shape the change ADDED, named by defect=: format-arity (a literal std::format/print/format_to, fmt::, rw::emitTo/formatTo or Python "literal".format whose fields do not match its arguments — GATES on any origin, a defect not debt), utf8-cut and dedup-first (C++) and vacuous-assert (Bash test scripts) and unchecked-status (a dropped pclose/rename/write/system/fflush/close/waitpid status in C/C++; Python subprocess.run without check=, subprocess.call, os.system; the row carries call=) and unhandled-arm (a C/C++ switch with no default: that leaves an in-tree enum's enumerator out, a shell case with no *) arm whose result is read, a Python if/elif or match ending a value-returning function with no else; the row carries why=) — report-only, always sev="minor". A site is new only when its text occurs more often than in the baseline: a moved one is not. Test-fixture dirs + doc sections are exempt from dead-code/churn; churn needs COMMITTED thrash evidence (rewritten across recent commits AND again by this diff), never the current edit alone WHICH FLOOR IT COMPARES AGAINST, and a side effect: the sidecar is honored only when the sha it was pinned at EQUALS the current git HEAD (strict equality — an ancestor commit describes a DIFFERENT tree, so everything committed since would read as your regression). A sidecar pinned anywhere else is STALE: this verb then DELETES it from your working tree (self-heal, so the next run does not rediscover the dead pin) and auto-compares the working tree vs git HEAD instead. Re-pin with --quality-baseline. The read-only MCP quality_delta verb applies the SAME staleness test but never deletes. A sidecar at the current HEAD that ANOTHER ripwire build pinned (its producer stamp names other sources — a dead set depends on how calls were resolved) is FOREIGN: both arms ignore it, never delete it, and auto-compare vs git HEAD. Which floor was actually used is on every report as baseline=: sidecar | git-HEAD | git-HEAD (stale sidecar removed) | git-HEAD (stale sidecar ignored) | git-HEAD (foreign sidecar ignored) — the stale two say a stale sidecar existed, and 'removed' means the file is gone. A non-git root has no HEAD to fall back to, so its sidecar is honored whenever this build pinned it; without one there, or with another build's, the verb exits 1. +Each kind is measured against the baseline (complexity/verbosity/nesting/params/dup/dead/api-surface + error-masking/short-horizon-churn/new-clone-of-reused-helper + placeholder + defect-shape + tangle); every finding is classified by ORIGIN: a symbol that EXISTED at the baseline and got worse (preexisting-worse="N", no attribute on the row) vs one that exists only because the code is NEW (new-symbol="N", origin="new-symbol" on the row). A small numeric delta is additionally sev="minor". EXIT 2 ONLY on a major AND unacked row that is preexisting-worse, defect-shape format-arity (any origin), a new function at the ceiling or a tangled new one — the gating="N" header count. New-symbol rows are still PRINTED (they are the debt you are adding — read them); new-symbol rows never gate, except defect-shape format-arity, a new function at the ceiling (4x the bar: ccx 60 or 240 lines, not a moved body, not test code, ceiling= on the row) and a new one at tangle 6 or more (not moved, not test code); exit 0 means "nothing that already existed got worse", not "clean". Clone kinds classify by member set (new-symbol only if EVERY member is new); short-horizon-churn is preexisting by construction. LIMIT: origin is canonId (path::scope::name) identity; a function RENAMED or MOVED with its body unchanged (whitespace and its own name aside: one body that left its key, matched to one new key) keeps its identity and the move reports nothing (and a file rename git recorded keeps each symbol in it under its own name, twins and changed bodies included), while one whose body also changed reads as new and a regression carried in with it will not gate; a function over the ccx or line bar whose body moved with a small edit (a clone-sketch match to a body that left its key) reads origin="moved" and never gates. error-masking = a NEW empty/pass/comment-only handler, or log-only (a broad handler whose body only logs and never names the error) or rethrow-only (the sole handler re-throws it unchanged); those two gate only where their precision was measured (Python) and are sev="minor" in every other language. Empty counts Go's `if err != nil {}` on a call's err and Rust's `if let Err(..) = f() {}` / `Err(..) => {}` or `=> ()`, and gates like Python's `except: pass`; log-only counts a Rust Err arm of print/log macros and a C++ catch of `std::cerr <<`, `LOG( x ) <<` or `fprintf( stderr, … )` (sev="minor"). facet="failure-default": a read, parse or spawn failure returned as an empty success (a TypeScript catch or .catch returning []/null/{}/false/0/'' around JSON.parse/fs reads/exec/spawn/fetch, in a function typed to return an array/boolean/object; a C++ value_or( empty ) on a file read); it never gates by itself. placeholder = a stub the change ADDED (todo!()/unimplemented!(), Kotlin TODO(), NotImplementedException, a bare raise NotImplementedError as a free function's body, a throw/raise/panic/assert saying "not implemented") or a comment line opening with TODO/FIXME that names no issue (#12, ABC-12, a URL); new-symbol by construction, so it never gates. Counted per enclosing symbol, like error-masking: a file-level TODO outside every definition is not counted. defect-shape = a known defect shape the change ADDED, named by defect=: format-arity (a literal std::format/print/format_to, fmt::, rw::emitTo/formatTo or Python "literal".format whose fields do not match its arguments — GATES on any origin, a defect not debt), utf8-cut and dedup-first (C++) and vacuous-assert (Bash test scripts) and unchecked-status (a dropped pclose/rename/write/system/fflush/close/waitpid status in C/C++; Python subprocess.run without check=, subprocess.call, os.system; the row carries call=) and unhandled-arm (a C/C++ switch with no default: that leaves an in-tree enum's enumerator out, a shell case with no *) arm whose result is read, a Python if/elif or match ending a value-returning function with no else; the row carries why=) — report-only, always sev="minor". A site is new only when its text occurs more often than in the baseline: a moved one is not. Test-fixture dirs + doc sections are exempt from dead-code/churn; churn needs COMMITTED thrash evidence (rewritten across recent commits AND again by this diff), never the current edit alone WHICH FLOOR IT COMPARES AGAINST, and a side effect: the sidecar is honored only when the sha it was pinned at EQUALS the current git HEAD (strict equality — an ancestor commit describes a DIFFERENT tree, so everything committed since would read as your regression). A sidecar pinned anywhere else is STALE: this verb then DELETES it from your working tree (self-heal, so the next run does not rediscover the dead pin) and auto-compares the working tree vs git HEAD instead. Re-pin with --quality-baseline. The read-only MCP quality_delta verb applies the SAME staleness test but never deletes. A sidecar at the current HEAD that ANOTHER ripwire build pinned (its producer stamp names other sources — a dead set depends on how calls were resolved) is FOREIGN: both arms ignore it, never delete it, and auto-compare vs git HEAD. Which floor was actually used is on every report as baseline=: sidecar | git-HEAD | git-HEAD (stale sidecar removed) | git-HEAD (stale sidecar ignored) | git-HEAD (foreign sidecar ignored) — the stale two say a stale sidecar existed, and 'removed' means the file is gone. A non-git root has no HEAD to fall back to, so its sidecar is honored whenever this build pinned it; without one there, or with another build's, the verb exits 1. **Try it** @@ -3005,7 +3005,7 @@ $ ./build/ripwire . --quality-delta **Caveats (stated by the binary):** -- new-symbol rows never gate, except defect-shape format-arity and a new function at the ceiling (4x the bar: ccx 60 or 240 lines, not a moved body, not test code, ceiling= on the row); +- new-symbol rows never gate, except defect-shape format-arity, a new function at the ceiling (4x the bar: ccx 60 or 240 lines, not a moved body, not test code, ceiling= on the row) and a new one at tangle 6 or more (not moved, not test code); - LIMIT: origin is canonId (path::scope::name) identity; - a function over the ccx or line bar whose body moved with a small edit (a clone-sketch match to a body that left its key) reads origin="moved" and never gates. diff --git a/docs/EVALS.md b/docs/EVALS.md index 5088e2be8..c536c25c8 100644 --- a/docs/EVALS.md +++ b/docs/EVALS.md @@ -6199,14 +6199,24 @@ These are the exact `kind=` strings the binary emits, from `src/quality.h`: `complexity` · `verbosity` · `nesting` · `params` · `duplication` · `dead-code` · `api-surface` · `error-masking` · `short-horizon-churn` · `new-clone-of-reused-helper` · `placeholder` · `defect-shape` · `tangle` -`tangle` (QD-TANGLE, 2026-11-19) is report-only: always `sev="minor"`, a long function's nesting past 3, deep share and -steering locals amplified by length (AUC 0.986 on 44 hand labels; a long orchestrator of named steps scores 0). +`tangle` (QD-TANGLE, 2026-11-19) scores a long function's nesting past 3, deep share and steering locals amplified by +length (AUC 0.986 on 44 hand labels; a long orchestrator of named steps scores 0). It was report-only until +TANGLE-GATE-B / QD-RATCHET-BASE (2026-11-21): a row now gates when the function is new at 6.0 or more, crossed 6.0, or +its score grew against the range base while over 6.0 (not a moved body, not test code); a row an input rose on while the +score held stays `sev="minor"`, and the best-since-tag ratchet is a facet (`ratchet=`) on those rows, never a row of its +own. Replayed on the 20 merges before 8861b0d4d (range form, tangle kind only): main printed 3 minor rows and gated 0; +the lane gates 9 rows over 5 PRs — #702 `runLsp` 2.1→11.0 (crossed) and the 8 growth rows the re-census found +(#714 `serialize` 25.4→25.5 and `cc_walk` 9.1→9.7, #706 `runForLensPass` 16.4→16.5, #705 `buildGraph` 56.8→56.9, +#702 `serialize` 25.2→25.4, #688 `ElixirContext::prepare` 12.2→12.3 and `captureTagsFacts` 28.8→29.2); the four +tag-best rows on functions that did not grow in their PR (`buildGraph` #706/#714, `serialize` #705, `captureTagsFacts` +#714 29.2→29.1) print nothing. Expected effect: a PR that adds even a tenth to an over-bar function gates until it +leaves the function no worse (or acks it). The first ten each target a failure mode measured in the literature; `placeholder` (added 0.6.7) is an honesty check on "done" — a stub or TODO the change added — and never gates. `defect-shape` carries six facets in `defect=` (`format-arity`, `utf8-cut`, `dedup-first`, `vacuous-assert`, `unchecked-status`, `unhandled-arm`), shapes this project's own code review kept finding; only `format-arity` gates, and on any origin (new-symbol rows never gate, except -defect-shape format-arity; since QD-ENTRY-CEILING also a new function at the ceiling). Measured (2026-10-07): recall 7/8 on the eight review findings it was built +defect-shape format-arity, a new function at the ceiling (QD-ENTRY-CEILING) and a tangled new function (TANGLE-GATE-B)). Measured (2026-10-07): recall 7/8 on the eight review findings it was built from; with every site treated as new, 0 format-arity false positives on this tree (1,330 literal-format calls), on the Python 3.13 standard library (405 calls) and on libc++'s std::format tests (80 calls; the 24 hits are its deliberately ill-formed `.verify.cpp` calls); vacuous-assert sample precision 30/30 on this tree's gates diff --git a/skills/ripwire-quality-bar/SKILL.md b/skills/ripwire-quality-bar/SKILL.md index 934228278..6a1b062e0 100644 --- a/skills/ripwire-quality-bar/SKILL.md +++ b/skills/ripwire-quality-bar/SKILL.md @@ -3,7 +3,7 @@ name: ripwire-quality-bar description: > Code QUALITY of what YOU just wrote, before commit/'done' or a cleanup: --quality-delta lists what got WORSE in 13 kinds; exit 2 if old code did (new-symbol rows never gate, - except defect-shape format-arity and a new function at the ceiling); the fix each shape calls for. + except defect-shape format-arity, a new function at the ceiling and a tangled new one); the fix each shape calls for. Merge safety → change-check. Even a single-line leaf fix runs it. allowed-tools: Bash, Read --- @@ -265,7 +265,7 @@ Thresholds/definitions are the catalog in [`quality-metrics.md`](quality-metrics | `new-clone-of-reused-helper` | `--clones` · `--callers=HELPER` | call the existing well-reused helper — reuse is declining in AI code (GitClear) | | `placeholder` (an added stub or TODO: `todo!()`, `NotImplementedException`, a "not implemented" throw/panic, a TODO/FIXME naming no issue) | `--expand=SYM` | finish it, or name the issue that tracks it — never gates, but do not call the work done over it | | `defect-shape` (`defect=`: `format-arity` — a literal format whose `{}` fields do not match its arguments; `utf8-cut` — a byte cap plus an ellipsis with no UTF-8 back-off; `dedup-first` — `std::unique` keeping the first of a run over a type with a severity field; `vacuous-assert` — a test script's assertion that passes on an empty text (absence, parity) read off a run whose failure is unchecked: a capture, a pipe without pipefail, a redirected file, a dropped wrapper status; also a FAIL reporter inside `$( )` and an unread `rc=$?`; `unchecked-status` — a dropped I/O or child status: C/C++ `pclose`/`rename`/`write`/`system`/`fflush`/`waitpid`, an `fclose`/`close` of what the function wrote, Python `subprocess.run` with no `check=`, `subprocess.call`, `os.system`; the row's `call=` names it and its `p=` is the site; `unhandled-arm` — a switch/case/if-chain over a closed set that gives an unnamed value no outcome: a C/C++ switch missing an in-tree enumerator with no `default:`, a shell case with no `*)`, a Python chain that falls off to `None`; `why=` names what is left out) | `--expand=SYM` | `format-arity` gates on any origin: match the fields to the arguments. The other five are `sev="minor"`: back off continuation bytes (or call the utf8 helper), sort worst-first before the unique, check the run's exit status before the absence, check the status (`check=True`) or `(void)` it with a reason, add the arm or a default that states the decision | -| `tangle` (report-only, always `sev="minor"`: a long function's nesting past 3, deep share and steering locals, amplified by length; `why=` names the input that rose, `locals=` the steering locals, `ratchet="TAG"` a function above its best since the last tag) | `--expand=SYM` · `--metrics` for `steer=`/`tangle=` | follow `fix=`: split the step that sets a steering local from the branch that reads it, extract the deep region it names, or split into named phases. A long orchestrator of named steps scores 0 — length alone is never the finding. `` lists what your change made better | +| `tangle` (gates a function that is new at 6.0 or more, crossed 6.0, or grew while over it — not a moved body, not test code; a row an input rose on while the score held is `sev="minor"`: a long function's nesting past 3, deep share and steering locals, amplified by length; `why=` names the input that rose, `locals=` the steering locals, `ratchet="TAG"` a function above its best since the last tag) | `--expand=SYM` · `--metrics` for `steer=`/`tangle=` | follow `fix=`: split the step that sets a steering local from the branch that reads it, extract the deep region it names, or split into named phases. A long orchestrator of named steps scores 0 — length alone is never the finding. `` lists what your change made better | These 13 kinds aren't a generic lint list. Ten target an agent-code degradation mode validated at large N (verbosity, structural erosion, smell rate, contract drift; passing tests ≠ clean design); `placeholder` is an diff --git a/test/defectshapecheck.sh b/test/defectshapecheck.sh index 94d76475b..19d6aa33e 100644 --- a/test/defectshapecheck.sh +++ b/test/defectshapecheck.sh @@ -2149,9 +2149,10 @@ fi # rule states the exception in ONE fixed phrase (PHRASE below), so no surface still reads unqualified. L="surfaces" PHRASE='new-symbol rows never gate, except defect-shape format-arity' -# QD-ENTRY-CEILING (2026-11-13) adds the second exception, a NEW function at 4x the bar: every statement of the -# rule names it too, in the long form (legend, help, MCP, docs) or the compact legend's ceiling= row. -CEILX='( and a new function at the ceiling| or a ceiling= row)' +# QD-ENTRY-CEILING (2026-11-13) adds the second exception, a NEW function at 4x the bar, and TANGLE-GATE-B (2026-11-21) +# the third, a new function at tangle 6 or more: every statement of the rule names both, in the long form (legend, +# help, MCP, docs) or the compact legend's ceiling= row and tangle row. +CEILX='(, a new function at the ceiling[^.;]* (and a tangled new (function|one)|and a new one at tangle 6 or more)|, a ceiling= row or a tangle row)' phrase_ok(){ # LABEL TEXT — the text states the exception, and every "new-symbol rows never gate" in it carries it local all qual flat # whitespace-normalized first: a sentence may wrap anywhere in a document flat="$( printf '%s' "$2" | tr '\n' ' ' | tr -s ' ' )" From 82d6580c7e0f3cecf19eb2a8864c7dfdccfc7e3e Mon Sep 17 00:00:00 2001 From: joyful-ii-V-I <210578314+joyful-ii-V-I@users.noreply.github.com> Date: Sat, 21 Nov 2026 19:06:43 -0500 Subject: [PATCH 09/44] qd dogfood: pastBacktick and parseShellScan helpers (own-range qd) The lane's own range gated skipQuote's complexity (15 -> 16, the budget guard) and a duplication of scanVacuousAssertBash / scanUnhandledArmBash (the same parse-and-report-cut tail). One backquote skip now serves skipQuote, dqLiteralQuotes and Lexer::skipWordPart; one parseShellScan serves both Bash scans. Behaviour unchanged. Co-Authored-By: Claude Opus 5.5 --- src/defectshape.h | 24 ++++++++++++++---------- src/shstatus.h | 16 ++++++++++------ 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/src/defectshape.h b/src/defectshape.h index ce2f4866d..a607d8e12 100644 --- a/src/defectshape.h +++ b/src/defectshape.h @@ -4059,17 +4059,25 @@ inline std::vector Script::sites() const } // namespace va +// One shell parse for a Bash facet scan; `cut` (optional) is set when the nesting budget (shstatus kMaxShellNest) stopped it, +// so the sites past that point were not judged. +inline rw::shstatus::Tree parseShellScan( std::string_view src, bool* cut ) +{ + rw::shstatus::Tree tree = rw::shstatus::parse( src ); + if( cut != nullptr ) + { + *cut = *cut || tree.cut; + } + return tree; +} + inline std::vector scanVacuousAssertBash( std::string_view src, const std::vector& /*spans*/, bool* cut = nullptr ) { if( src.empty() ) { return {}; } - const rw::shstatus::Tree tree = rw::shstatus::parse( src ); - if( cut != nullptr ) - { - *cut = *cut || tree.cut; // the nesting budget stopped the parse: sites past it were not judged - } + const rw::shstatus::Tree tree = parseShellScan( src, cut ); const rw::shstatus::Analysis an = rw::shstatus::analyze( tree, src ); const va::Script script( src, tree, an ); return script.sites(); @@ -5849,11 +5857,7 @@ inline void scanUnhandledArmBash( std::string_view src, const std::vector& { return; } - const rw::shstatus::Tree t = rw::shstatus::parse( src ); - if( cut != nullptr ) - { - *cut = *cut || t.cut; - } + const rw::shstatus::Tree t = parseShellScan( src, cut ); uash::endingCaseSites( src, t, out ); uash::assignedCaseSites( src, t, fnSpans, out ); } diff --git a/src/shstatus.h b/src/shstatus.h index 10f6153fb..24267615e 100644 --- a/src/shstatus.h +++ b/src/shstatus.h @@ -492,6 +492,13 @@ inline bool isRedirOp( std::string_view o ) noexcept return o == "<" || o == ">" || o == ">>" || o == "&>" || o == "&>>" || o == ">&" || o == "<&" || o == "<>" || o == ">|" || o == "<<<" || o == "<<"; } +// s[i] is an opening backquote: the index past its closing one, or the end when it never closes. +inline std::size_t pastBacktick( std::string_view s, std::size_t i ) noexcept +{ + const std::size_t j = s.find( '`', i + 1 ); + return j == std::string_view::npos ? s.size() : j + 1; +} + std::size_t skipParen( std::string_view s, std::size_t i, NestBudget& nb ); inline std::size_t skipQuote( std::string_view s, std::size_t i, char q, NestBudget& nb ) // s[i] is the opening quote { @@ -516,8 +523,7 @@ inline std::size_t skipQuote( std::string_view s, std::size_t i, char q, NestBud } if( q == '"' && c == '`' ) { - const std::size_t j = s.find( '`', i + 1 ); - i = j == std::string_view::npos ? s.size() : j + 1; + i = pastBacktick( s, i ); continue; } if( c == q ) @@ -631,8 +637,7 @@ inline std::string dqLiteralQuotes( std::string_view s, NestBudget& nb ) } if( c == '`' ) { - const std::size_t j = s.find( '`', i + 1 ); - i = j == std::string_view::npos ? s.size() : j + 1; + i = pastBacktick( s, i ); continue; } if( c == '\'' ) @@ -988,8 +993,7 @@ class Lexer } if( d == '`' ) { - const std::size_t j = src_.find( '`', i + 1 ); - return j == std::string_view::npos ? n_ : j + 1; + return pastBacktick( src_, i ); // n_ == src_.size() } if( startsAt( src_, i, "$(" ) ) { From 13f3263192cf2f25b9b778a4faf82165786c0bcd Mon Sep 17 00:00:00 2001 From: joyful-ii-V-I <210578314+joyful-ii-V-I@users.noreply.github.com> Date: Sat, 21 Nov 2026 19:14:19 -0500 Subject: [PATCH 10/44] qd dogfood: one budget guard in skipParen; split defectRowKeysBothSchemes skipQuote and skipBrace recurse only through skipParen, so one guard there bounds the skip trio; the guards in skipQuote and skipBrace made the two a duplication row (and skipQuote's complexity 15 -> 16). The two-bit/current row-key pair of one (anchor, facet) is its own function, so addDefectFacetSchemeAliases is a loop over anchors (ccx 19 -> under the bar). Co-Authored-By: Claude Opus 5.5 --- src/quality.h | 47 +++++++++++++++++++++++++++-------------------- src/shstatus.h | 14 +++----------- 2 files changed, 30 insertions(+), 31 deletions(-) diff --git a/src/quality.h b/src/quality.h index 19fcd696a..32effaeef 100644 --- a/src/quality.h +++ b/src/quality.h @@ -9748,6 +9748,29 @@ inline void addSchemeAliases( IdentityAliases& al, const IngestResult& ing, cons std::sort( al.schemeAmbiguousKeys.begin(), al.schemeAmbiguousKeys.end() ); } +// One (anchor, facet) row's key under the two-bit site values and under the current ones, from that anchor's sites; +// {0, 0} when it has no site of the facet the two-bit scheme knew (a file record carries no legacySite, so it never counts). +inline std::pair defectRowKeysBothSchemes( std::span anchorSites, defectshape::Facet f ) +{ + std::vector now, old; + for( const DefectSiteAt& d : anchorSites ) + { + if( d.legacySite != 0 && defectFacetOf( d.key.site ) == f ) + { + now.push_back( d.key.site ); + old.push_back( d.legacySite ); + } + } + if( now.empty() ) + { + return { 0, 0 }; + } + std::sort( now.begin(), now.end() ); + std::sort( old.begin(), old.end() ); + const std::uint64_t anchor = anchorSites.front().key.anchor; + return { defectRowKey( anchor, f, old ), defectRowKey( anchor, f, now ) }; +} + // CR712-ACK-KEY-MASK — the defect-shape half of the SCHEME migration: for every current (anchor, facet) row whose key under the // two-bit site values (defectLegacySiteValue) differs from its key now, legacy key -> current key, fed into the same toCurrent // map addSchemeAliases fills, so remapAckIdentity re-files a released ack (acks_rekeyed_by_scheme=), computeStaleAcks reads it at @@ -9760,30 +9783,14 @@ inline void addDefectFacetSchemeAliases( IdentityAliases& al, const gtl::btree_m { return; } - const std::vector sites = defectSitesOf( ing, root, nullptr ); // sorted by (anchor, site) + constexpr std::size_t kTwoBitFacets = 4; // format-arity, utf8-cut, dedup-first, vacuous-assert + const std::vector sites = defectSitesOf( ing, root, nullptr ); // sorted by (anchor, site) for( auto it = sites.begin(); it != sites.end(); ) { const auto end = std::find_if( it, sites.end(), [ & ]( const DefectSiteAt& d ) { return d.key.anchor != it->key.anchor; } ); - for( std::size_t f = 0; f < defectshape::kFacetCount; ++f ) + for( std::size_t f = 0; f < kTwoBitFacets; ++f ) { - std::vector now, old; - for( auto d = it; d != end; ++d ) - { - if( d->legacySite != 0 && d->key.site != kDefectFilePresent && d->key.site != kDefectFileUnreadable - && defectFacetOf( d->key.site ) == static_cast( f ) ) - { - now.push_back( d->key.site ); - old.push_back( d->legacySite ); - } - } - if( now.empty() ) - { - continue; - } - std::sort( now.begin(), now.end() ); - std::sort( old.begin(), old.end() ); - const auto facet = static_cast( f ); - const std::uint64_t oldKey = defectRowKey( it->key.anchor, facet, old ), newKey = defectRowKey( it->key.anchor, facet, now ); + const auto [ oldKey, newKey ] = defectRowKeysBothSchemes( { it, end }, static_cast( f ) ); if( oldKey != newKey && al.toCurrent.emplace( oldKey, newKey ).second ) { al.schemeKeys.push_back( oldKey ); diff --git a/src/shstatus.h b/src/shstatus.h index 24267615e..f1c878896 100644 --- a/src/shstatus.h +++ b/src/shstatus.h @@ -502,11 +502,6 @@ inline std::size_t pastBacktick( std::string_view s, std::size_t i ) noexcept std::size_t skipParen( std::string_view s, std::size_t i, NestBudget& nb ); inline std::size_t skipQuote( std::string_view s, std::size_t i, char q, NestBudget& nb ) // s[i] is the opening quote { - const NestLevel level( nb ); - if( level.over() ) - { - return s.size(); // past the budget: the rest is one unscanned word (Tree::cut says so) - } ++i; while( i < s.size() ) { @@ -534,12 +529,14 @@ inline std::size_t skipQuote( std::string_view s, std::size_t i, char q, NestBud } return i; } +// The one budget guard of the skip trio: skipQuote and skipBrace recurse only through skipParen, so each nesting level of +// "$( … "$( … )" … )" or ${ … "$( … )" … } costs one level here. inline std::size_t skipParen( std::string_view s, std::size_t i, NestBudget& nb ) // s[i] == '(' { const NestLevel level( nb ); if( level.over() ) { - return s.size(); + return s.size(); // past the budget: the rest is one unscanned word (Tree::cut says so) } int depth = 0; while( i < s.size() ) @@ -579,11 +576,6 @@ inline std::size_t skipParen( std::string_view s, std::size_t i, NestBudget& nb } inline std::size_t skipBrace( std::string_view s, std::size_t i, NestBudget& nb ) // s[i] == '{' of a ${...} { - const NestLevel level( nb ); - if( level.over() ) - { - return s.size(); - } int depth = 0; while( i < s.size() ) { From d78e9bbda3efe9ebd435ff5d36b7d3e3cbf2004e Mon Sep 17 00:00:00 2001 From: joyful-ii-V-I <210578314+joyful-ii-V-I@users.noreply.github.com> Date: Sat, 21 Nov 2026 19:17:56 -0500 Subject: [PATCH 11/44] qd: ack the shstatus.h detail:: signature rows (nesting budget threading) Seven api-surface contract-change rows on shstatus.h's detail:: lexer and skip helpers: each now takes the NestBudget the lexer and parser share (CR712-SHSTATUS-DEPTH). detail:: is internal to the header and every caller changed in the same commit; not a public contract. Co-Authored-By: Claude Opus 5.5 --- .ripwire_quality_acks | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.ripwire_quality_acks b/.ripwire_quality_acks index 0c0360f2c..fe35ab739 100644 --- a/.ripwire_quality_acks +++ b/.ripwire_quality_acks @@ -15,6 +15,7 @@ ack api-surface 105c48e20c80c896 3 cid=720fab31ea99ebde A2: unmeasuredHintNote g ack api-surface 1085f731a3dde7c8 7 cid=b012ca29106914d1 capture-audit 2026-09-04 wave-1 close: symbols two lanes each grew past the other's acked magnitude — runDoctor (L10 legend + blobs_floor=, L9 built_from=), writeEnsembleReport (L9 root=, L10 conditional unavailable=), runAffected/runVerify (L9 root-relative block, L4 gauge), writeTestGateReport (L4 gauge splice, L9 row-gated root=; the XML/JSON twins' duplication is the lockstep mcpclidiffcheck asserts, as L9 acked; graphGaugeAttrXml/Json are the same lockstep), writePanelReport (L10 conditional attrs, L4 counts_floor), printUsage/validateConfig (L1 H10 hoist + L5/L9/L10 help text). Re-acked at the merged magnitude; prior reasons kept ack api-surface 10f47dd5a3f35d86 5 fnbody-require lane: deliberate additive API widening (optional out-params, default nullptr, every existing caller unaffected) to disclose the lazy require/import distinction on --impact's importer tier; residual complexity/duplication is the twin-dialect emitter shape and the dual-mode importersOfFiles scan this feature requires, already extracted where a helper genuinely reduced it (scanImporterEdges, recordLazyPair); short-horizon-churn is this same commit's own edit history ack api-surface 1103e9ea8ace3099 5 cid=186a55a17ef44834 now=5 was=4 facet=contract-change p=src/exemplarfamily.h:2505 REDACT-TOUCH: every emitter that quotes a source, manifest or plan line takes the run's RedactCounts* (nullptr = --no-redact), the #686 pattern; the added parameter is the fix and every caller passes the tally it already holds (d.redactPtr, the MCP request's redactPtr, PathAnswerSurface::redact). +ack api-surface 11c919df1ef385d7 3 cid=d706aec64c7e594d now=3 was=2 facet=contract-change p=src/shstatus.h:502 CR712-SHSTATUS-DEPTH: shstatus.h detail:: recursion helpers (internal to the header, every caller updated in the same commit) take the one NestBudget the lexer and parser share; not a public contract ack api-surface 131068a6cedf0864 4 cid=9ead4ea91ba5d605 review of #219: the run= relativity claim is CONDITIONAL, so the predicate has to reach every site that states it — prLegendText and writeFlipHeader take rootRelativeRuns (and its root= attribute) because the legend sentence and the command spelling must be decided by ONE fact, testmap.h runsAreRootRelative; a legend that claims a relativity the spelling does not have is the defect this round fixes. The duplication row pairs that 19-token predicate with mcp.h mcpOmitsGitVerbs, which asks a different question about a different field and shares only the shape of a two-term boolean return — merging them would name neither. | prior: E1 follow-up (#214 CI): prLegendText gains the one pre-render fact that gates testmap.h's run=/run_unknown=/ clause (corpusHasTests) — its single caller writePrContext passes it; the unconditional clause put defaultceilingcheck's 120-file no-test bundle 25 tokens over its 8000 default budget ack api-surface 147451c4175d9f08 2 cid=6d5a9dab1a24c31f degrade disclosure: each read seam and the ref pool now take the DISCLOSE sink whose field the document reads ack api-surface 1520fa02411735c3 6 cid=69e2cb4c55a88771 C1 F-06/F-07/F-10 (the listing-paging round): three listing verbs learn to disclose and page their row listings, and every gating row is that one change. api-surface 14 = ONE trailing DEFAULTED parameter each (an int pageOffset, an McpPageArgs window, a SituPageArgs, or the next= invocation a header now carries) on the emitters that must be TOLD their window — writeFlags/writeGate, writeCappedRows/writeCappedList/writeFlip/writeFlipHeader/writeFlipLights, computeFlip, nearestGateNames (which gains its cap and its TOTAL, the disclosure itself), situShowingNote/writeSituation, and the three MCP twins flagsText/flipText/situationDiffJson; additive by construction, every pre-existing call site compiles unchanged, and the alternative — a second capped emitter per verb — is the drift this repo removes rather than adds, because two emitters that disagree about a window can drop the row that IS the answer. verbosity 3 = kDocDriftLegend +20 lines and writeDocDriftPage +10 are the in-band vocabulary a reader needs to read shown_failed=/failed_capped=/failed_total= where they meet it (the rationale and the next= scan were already hoisted OUT of the body into their own function and comment, which took the complexity row to zero and the LOC row from +48 to +10); dispatchMcpLine +12 is two pagedResult wrappers on a pre-existing 1376-line dispatcher this lane adds to rather than creates. complexity 1 = the same dispatcher, +9 on a base of 518. duplication 1 = flagsText | flipText at 110 tokens, down from 131 after the shared mcpRowCap fold; the residual is getIndex + compute + captureXml, the shape EVERY index-backed MCP twin in this file has, and merging two verbs that return different results behind one entry point would be worse code than the clone. short-horizon-churn 19 = this lane's own footprint across cli.h/docdrift.h/darkflags.h/flipimpact.h/situ.h/mcp*, plus cli.h symbols three other lanes touched the same day; none foreign, none thrash. @@ -54,6 +55,7 @@ ack api-surface 3478654139c90f0f 5 cid=fc086b8b559ee8c6 Review of #214, round 2. ack api-surface 3561d0281d324276 14 WAVE-2 close (2026-08-19), finding 3 of 3: the 76 remaining gating rows, ONE change. All of them are W2-E's root-relative p= landing (9beaa2c/fccea68/a271e6c/b3fe074 plus the f9108b7 correction), measured for the first time at WAVE granularity. The per-lane acks written during W2-E covered only the correction round's own diff (working-tree-vs-HEAD at that moment), so the original ~30-verb landing was never QD-acked; this ack closes that gap rather than re-accepting anything. Verified by reading the whole 20cdc04..860291c src/main.cpp diff line by line: 282 of 448 added lines match the root-relative predicate directly and every one of the remaining 127 is an existing std::printf rewritten from ing.files[...] to the root-relative rp local, plus four extracted emit helpers (computeDirModules, printJsonSymbolRows, writeOversizeRows, writeDropRows). No unrelated logic rides in. By kind: api-surface 28 = the +1 rootArg/rootPrefix parameter on the emitters that must now be TOLD their root (writeAbiCheck/Ref/Struct, emitColumnar*, packBodies/Deps/Lego/Outline/Signatures[Json], serialize[Json], writeLayout*, packConnect, buildD1Row and the report writers) - defaulted wherever a caller could stay unchanged. complexity 31 and verbosity 16 = the single-root-condition ternary and its guarded root= clause applied per emitter, with no new nesting level and no new control flow beyond that one conditional; the large absolute numbers (runStructureText 207->231, runLint 313->323, runMaintenanceViews 174->190, runCallHierarchy 71->80) are pre-existing dispatcher size the wave adds to, not creates - decomposing them is its own round and is recorded as a wave-2 follow-up. params 1 = writeNonLocalStateReport 4->6, the same contract. The three sibling lanes are individually clean: --quality-delta at f6ec56d..1732fd8 (W2-J), 1732fd8..9a41c74 (W2-K) and 9a41c74..20cdc04 (W2-F) each report gating=0. Full suite green at this head: gates=429 pass=427 skip=2 fail=0, ASan+LSan clean, byte-deterministic, xmllint clean. churn= is unavailable in ref-pair mode by construction (both trees materialized out of the repo), so short-horizon-churn is silent here and that silence is not evidence. ack api-surface 35e8077fb0c11e92 4 cid=f1030dd30da5863d now=4 was=3 facet=contract-change p=src/editcheck.h:733 PROVEN-SITE-KEEPS-NAMESAKES (lane edge-strays-1118): CallSiteCalleeTest/EditCheckCalleeTest take ONE trailing span, the graph's provenSites, and reaches() takes the site's ref index, so a proven call site counts only for its own targets (red-first in test/callerscheck.sh SP1-SP4); every caller passes g.provenSites and the ref index in the same commit. ack api-surface 3703c22e2f2112bd 5 cid=e07b67ecf3068d1d by=src/* Phase 5 (docs/EVALS.md): the external-name veto (@external, externalnames.h tables, ExternalVeto predicate, import-name bindings at ingest) and the receiver MRO walk (rule1BaseWalk, SuperObj); every gating row is this one change — the four deliberate contract changes (serialize/serializeJson gain externalCalls, captureIncludes gains binds, methodOnTypeOrBases gains skipSelf/unionOnMulti), the ladder's two new steps in buildGraph, the census's tenth mechanism, kParserVer 77, and the two lexical clone false-positives (a one-line binary_search vs a counts total; a key-buffer probe vs a JSON string writer) +ack api-surface 372b1abf43677adf 4 cid=c4cd86becfdabe6d now=4 was=3 facet=contract-change p=src/shstatus.h:1006 CR712-SHSTATUS-DEPTH: shstatus.h detail:: recursion helpers (internal to the header, every caller updated in the same commit) take the one NestBudget the lexer and parser share; not a public contract ack api-surface 3877dd1e9b4ae997 4 R-E (2026-08-17 harvest): narrowLegoToRenderedSigs needs an explicit rootPrefix param because packSignatures' sigsRendered rows are already root-relative while the function's own escaped path comparison was still absolute -- every comparison silently failed, narrowing legoScoped to nothing on every --for run whose rendered sigs hit this path. The +1 param (defaulted, so every other caller is unaffected) and the small cx/LOC bump on narrowLegoToRenderedSigs and its one caller runForLens are the minimal fix; caught by legobundlecheck.sh going red for the wrong reason. churn=self is this lane's own edit window. ack api-surface 39588f57bd7b46b5 6 cid=2116294439c0a50f M13 paging/budget parity: each of these nine gained exactly ONE trailing DEFAULTED parameter (an McpPageArgs window, a token budget, or the legend posture) so its MCP twin can honor the flag its CLI twin already honors. Additive by construction - every pre-existing call site compiles unchanged and was verified to - and the alternative, a second overload per verb, is the clone seam this repo removes rather than adds. ack api-surface 3a54ea98a485670c 2 W1-S2 churn-keying fix (pathQualifiedKey): bodyHashesBySym's pathQualified-param drop is the deliberate contract change (one keying, no mode); pathQualifiedKey is canonicalId/voteKey-SHAPED but a distinct key domain — canonicalId's bare-name degrade IS the bug this fixes, voteKey is a rename-vote pair with a different separator and value type; churn=self is this fix's own edit trail; gate: qualitysignalcheck.sh §1d @@ -71,10 +73,12 @@ ack api-surface 44bac7b0ded56eb7 3 one grouped astQuery walk for --lint three bu ack api-surface 451442e5d1031096 5 R-R root-relative emission lane: threading the corpus root into 8 emitters is the change itself — +1 param each (contract-change), +3 cx from each pathRel lambda, and the verbosity of the relativization plus its comments. Reviewed row by row; none is avoidable without abandoning root-relative emission. Storage keys unmoved (baseline + ack ledger byte-identical across the cure). ack api-surface 49e172c2aa455e68 6 cid=0ece6180949ad4aa C1 F-06/F-07/F-10 (the listing-paging round): three listing verbs learn to disclose and page their row listings, and every gating row is that one change. api-surface 14 = ONE trailing DEFAULTED parameter each (an int pageOffset, an McpPageArgs window, a SituPageArgs, or the next= invocation a header now carries) on the emitters that must be TOLD their window — writeFlags/writeGate, writeCappedRows/writeCappedList/writeFlip/writeFlipHeader/writeFlipLights, computeFlip, nearestGateNames (which gains its cap and its TOTAL, the disclosure itself), situShowingNote/writeSituation, and the three MCP twins flagsText/flipText/situationDiffJson; additive by construction, every pre-existing call site compiles unchanged, and the alternative — a second capped emitter per verb — is the drift this repo removes rather than adds, because two emitters that disagree about a window can drop the row that IS the answer. verbosity 3 = kDocDriftLegend +20 lines and writeDocDriftPage +10 are the in-band vocabulary a reader needs to read shown_failed=/failed_capped=/failed_total= where they meet it (the rationale and the next= scan were already hoisted OUT of the body into their own function and comment, which took the complexity row to zero and the LOC row from +48 to +10); dispatchMcpLine +12 is two pagedResult wrappers on a pre-existing 1376-line dispatcher this lane adds to rather than creates. complexity 1 = the same dispatcher, +9 on a base of 518. duplication 1 = flagsText | flipText at 110 tokens, down from 131 after the shared mcpRowCap fold; the residual is getIndex + compute + captureXml, the shape EVERY index-backed MCP twin in this file has, and merging two verbs that return different results behind one entry point would be worse code than the clone. short-horizon-churn 19 = this lane's own footprint across cli.h/docdrift.h/darkflags.h/flipimpact.h/situ.h/mcp*, plus cli.h symbols three other lanes touched the same day; none foreign, none thrash. ack api-surface 49ea9954a4e77a06 6 cid=cf442ef6cda47ce0 P4.1 grep fast path — the mechanical footprint of threading two modes through one call chain, and nothing else. FOUR api-surface contract-change rows: spanTiersOfFiles (decl+def), grepApplySpanTiers and emitGrepReport each gained exactly ONE parameter, defaulted where it has more than one caller, so every existing call site is unchanged; RIPWIRE_BASE= argvdiffcheck reports 607/610 argv vectors byte-identical (the 3 diffs are the disclosed --version sha stamp and --run-trace duration_ms), and test/grepfastcheck.sh arm 6 byte-compares the whole --grep option matrix against the same base binary. TWO short-horizon-churn churn=self rows on the same two symbols: the footprint of having edited them in this window, not new debt. ONE complexity row, spanTiersOfFiles 49 to 52: the memo consult is a single branch inside the per-file worker, at the nesting that worker already had; extracting the whole worker body would be a refactor of the pre-existing tree-sitter parse path and was deliberately NOT bundled into a change whose claim is byte-identical output. What was FIXED rather than acked in this same pass: the duplication row (spanTierMemoPath now reuses quality.h's shaKeyedCachePath/headSnapRepoHex/exclConfigHex composition instead of a fourth hand-rolled name builder), main's complexity and verbosity rows (the prefetch launch/join moved into verbs_grep.h seams), and spanTiersOfFiles' verbosity row (prose moved out of the body onto the seams). +ack api-surface 4adca5de6c27054a 5 cid=bf23095f84826b6d now=5 was=4 facet=contract-change p=src/shstatus.h:645 CR712-SHSTATUS-DEPTH: shstatus.h detail:: recursion helpers (internal to the header, every caller updated in the same commit) take the one NestBudget the lexer and parser share; not a public contract ack api-surface 4b788e6f0a75bc80 6 WAVE-2 close (2026-08-19), finding 3 of 3: the 76 remaining gating rows, ONE change. All of them are W2-E's root-relative p= landing (9beaa2c/fccea68/a271e6c/b3fe074 plus the f9108b7 correction), measured for the first time at WAVE granularity. The per-lane acks written during W2-E covered only the correction round's own diff (working-tree-vs-HEAD at that moment), so the original ~30-verb landing was never QD-acked; this ack closes that gap rather than re-accepting anything. Verified by reading the whole 20cdc04..860291c src/main.cpp diff line by line: 282 of 448 added lines match the root-relative predicate directly and every one of the remaining 127 is an existing std::printf rewritten from ing.files[...] to the root-relative rp local, plus four extracted emit helpers (computeDirModules, printJsonSymbolRows, writeOversizeRows, writeDropRows). No unrelated logic rides in. By kind: api-surface 28 = the +1 rootArg/rootPrefix parameter on the emitters that must now be TOLD their root (writeAbiCheck/Ref/Struct, emitColumnar*, packBodies/Deps/Lego/Outline/Signatures[Json], serialize[Json], writeLayout*, packConnect, buildD1Row and the report writers) - defaulted wherever a caller could stay unchanged. complexity 31 and verbosity 16 = the single-root-condition ternary and its guarded root= clause applied per emitter, with no new nesting level and no new control flow beyond that one conditional; the large absolute numbers (runStructureText 207->231, runLint 313->323, runMaintenanceViews 174->190, runCallHierarchy 71->80) are pre-existing dispatcher size the wave adds to, not creates - decomposing them is its own round and is recorded as a wave-2 follow-up. params 1 = writeNonLocalStateReport 4->6, the same contract. The three sibling lanes are individually clean: --quality-delta at f6ec56d..1732fd8 (W2-J), 1732fd8..9a41c74 (W2-K) and 9a41c74..20cdc04 (W2-F) each report gating=0. Full suite green at this head: gates=429 pass=427 skip=2 fail=0, ASan+LSan clean, byte-deterministic, xmllint clean. churn= is unavailable in ref-pair mode by construction (both trees materialized out of the repo), so short-horizon-churn is silent here and that silence is not evidence. ack api-surface 4b8467d6559779e4 3 fnbody-require lane: deliberate additive API widening (optional out-params, default nullptr, every existing caller unaffected) to disclose the lazy require/import distinction on --impact's importer tier; residual complexity/duplication is the twin-dialect emitter shape and the dual-mode importersOfFiles scan this feature requires, already extracted where a helper genuinely reduced it (scanImporterEdges, recordLazyPair); short-horizon-churn is this same commit's own edit history ack api-surface 4be283ea1e39ca3b 3 cid=711b1fede0bf0fe8 by=src/* lane/n3-a phase 3 (2026-09-03): PinCensus::addRow gains the call-site line (6 to 7 params) and addOracleRow the sentinel kind (2 to 3) — the census format v2 join keys registered in docs/EVALS.md Phase 3; eval-only struct with two call sites, both in graph.h ack api-surface 4c3f4f250744d20d 4 cid=da1d80ac704b57a2 P9 the folded edit receipt: runEditVerb gains the postCheck opt-out parameter (defaulted true, so every existing call site is source-compatible) and the line-range + post-check splice; editplan's ensureStage and receipt each gain the root parameter they need to spell one identity (M12's root-relative rule, applied to the sibling it missed) and to run the per-op post-check. The +15 LOC in runEditVerb is the copy-out-before-the-index-rebuild discipline the fold requires — every reference into ing dangles once getIndex re-ingests, and that is stated in the code. +ack api-surface 52961f8157cf72f3 4 cid=85d6402f654152eb now=4 was=3 facet=contract-change p=src/shstatus.h:503 CR712-SHSTATUS-DEPTH: shstatus.h detail:: recursion helpers (internal to the header, every caller updated in the same commit) take the one NestBudget the lexer and parser share; not a public contract ack api-surface 5361e2bced6f1988 8 cid=9cf2c52c10b9d878 M12 follow-up (capture-audit L9): --ensemble gained root=/root-relative p= — writeEnsembleReport's 3 new default-valued params (singleRoot/rootPrefix/rootAttr, back-compat) thread the caller's already-computed single-root spelling through; short-horizon-churn on the touched dispatcher. ack api-surface 5383f63ad718935c 7 cid=170e3fe466966e87 L10: printLintRuleTallyRow's compiled= param and runLintRules' uncompiled-query mapping loop disambiguate a lint-rules query that failed to compile from one that legitimately found zero matches (see docs/PLAN lane L10, finding 3) — deliberate, backward-compatible (defaulted param, incompatible=0) ack api-surface 5391ffd9aa5765bf 6 cid=8a2aed10e80ed270 P2.2 register-macro dead-code fix: additive params on computeDelta/isDeadCandidate, complexity/verbosity growth in computeDelta and runQualityViews (the --dead-code verb), and the kQSnapCacheScheme bump line sit inside the in-window churn threshold - all eight gating rows are this lane's own footprint, none foreign @@ -131,14 +135,17 @@ ack api-surface 85dd951a8f730eec 4 cid=4e0fbe2c7a019909 P7 (terminality round A, ack api-surface 861092ef53c6c2dd 4 cid=48c86b50ca49ddb4 capture-audit 2026-09-04 wave-1 close: deliberate contract changes, each --edit-check incompatible=0 in its lane report — L4 (lane-L4.md, Symbols whose contract changed): pageDisclosure/computePageDisclosure +collectionCapped (defaulted), packLego +graphCountFloorAttr (defaulted), packConnect/writePrRootOpen/writeTestGateReport/writeTestGateReportJson/memberUsesArm +const Graph& for the M15 gauge; L5: enumerateRefs +filterNameHits out-param (defaulted, three callers source-compatible); L3: emitGrepUnindexed/grepAuxJson +window (the H4 paging fix, caller updated) ack api-surface 86db2ff4e22cae54 6 cid=b9c9829a2aac834e C1 F-06/F-07/F-10 (the listing-paging round): three listing verbs learn to disclose and page their row listings, and every gating row is that one change. api-surface 14 = ONE trailing DEFAULTED parameter each (an int pageOffset, an McpPageArgs window, a SituPageArgs, or the next= invocation a header now carries) on the emitters that must be TOLD their window — writeFlags/writeGate, writeCappedRows/writeCappedList/writeFlip/writeFlipHeader/writeFlipLights, computeFlip, nearestGateNames (which gains its cap and its TOTAL, the disclosure itself), situShowingNote/writeSituation, and the three MCP twins flagsText/flipText/situationDiffJson; additive by construction, every pre-existing call site compiles unchanged, and the alternative — a second capped emitter per verb — is the drift this repo removes rather than adds, because two emitters that disagree about a window can drop the row that IS the answer. verbosity 3 = kDocDriftLegend +20 lines and writeDocDriftPage +10 are the in-band vocabulary a reader needs to read shown_failed=/failed_capped=/failed_total= where they meet it (the rationale and the next= scan were already hoisted OUT of the body into their own function and comment, which took the complexity row to zero and the LOC row from +48 to +10); dispatchMcpLine +12 is two pagedResult wrappers on a pre-existing 1376-line dispatcher this lane adds to rather than creates. complexity 1 = the same dispatcher, +9 on a base of 518. duplication 1 = flagsText | flipText at 110 tokens, down from 131 after the shared mcpRowCap fold; the residual is getIndex + compute + captureXml, the shape EVERY index-backed MCP twin in this file has, and merging two verbs that return different results behind one entry point would be worse code than the clone. short-horizon-churn 19 = this lane's own footprint across cli.h/docdrift.h/darkflags.h/flipimpact.h/situ.h/mcp*, plus cli.h symbols three other lanes touched the same day; none foreign, none thrash. ack api-surface 8a92173ded649e17 14 cid=f76e97c84ac7c168 by=src/* lane 2 of the Graft head-to-head (2026-09-07): packSignatures and packSignaturesJson each gain ONE defaulted trailing out-parameter, the ids of the sigs rows they actually emitted, so the file-grain tail can exclude those files instead of the whole 40-candidate surface (three single-file answers at candidate rank 5/10/5 were served nowhere on rocksdb). Every existing caller is byte-identical; the facet is the deliberate arity change the ack-only help names. | prior: A2 (dropped_positive, 2026-09-03): packSignatures gained one trailing droppedPositiveOut out-param and the post-ladder accounting inside the rank-adaptive branch — same shared-arithmetic reason as its JSON sibling. +ack api-surface 8d454d9290626445 2 cid=8e10fcb30385d76d now=2 was=1 facet=contract-change p=src/shstatus.h:613 CR712-SHSTATUS-DEPTH: shstatus.h detail:: recursion helpers (internal to the header, every caller updated in the same commit) take the one NestBudget the lexer and parser share; not a public contract ack api-surface 8d58de9bb922f582 4 T1 completeness claims (complete= on grep/whereis): the +1 on streamBlobs is the deliberate DEFAULTED StreamBlobStats* param (null-object sink inside, no per-site null test; every existing caller byte-identical) so whereis can prove its scan exhaustive before claiming; cx/LOC on streamBlobs/computeWhereis/writeWhereisPage/emitGrepReport is the claim computation plus its in-band legend (the honesty text IS the feature); churn=self on those plus grepCollect/dispatchMcpLine is this lane own edit window. Gated red-first by test/completecheck.sh (24 arms, 10 red pre-fix; mutation arms force cap/offset/budget/unreadable-file/regex-mode/oversized-blob and assert the attribute VANISHES); full plain suite green, 21 touched-family gates green under ASan+LSan, determinism x3, xmllint clean ack api-surface 8fa8514c421e478d 4 cid=7826a06c6d682763 now=4 was=3 facet=contract-change p=src/editcheck.h:833 train 30 fcall-forward nit N1 (d62c00e0): ONE trailing span parameter, the graph's keptForwards, so this call-site reader applies the one model.h forwardCounts rule (--uses' own) instead of counting a forward buildGraph dropped; every caller passes g.keptForwards in the same commit; red-first in test/fcallforwardcheck.sh S1-S3. ack api-surface 925094be92085dae 3 cid=714cea1e1b31a1ae A6: rollbackMessage gained a 'cause' parameter one commit after this lane introduced it (57fe5fc). It is a header-inline helper in namespace rw::editplan with two callers, both in the same function in the same file; no consumer outside this lane ever saw the 2-arg form. The parameter is what lets the concurrent-write abort reuse the rollback disposition wording instead of growing a second copy of it. +ack api-surface 92749d497bf1775c 3 cid=747ebe8bc9af81a4 now=3 was=2 facet=contract-change p=src/shstatus.h:577 CR712-SHSTATUS-DEPTH: shstatus.h detail:: recursion helpers (internal to the header, every caller updated in the same commit) take the one NestBudget the lexer and parser share; not a public contract ack api-surface 92784a33434e383d 2 cid=e19f01572dacdb87 now=2 was=1 facet=contract-change p=src/hopbody.h:121 fix1: intended internal signature changes (graph for the hop hedge, language for the comment rule, the answer-wide follow budget); every caller updated in the same commit ack api-surface 92ac9caf38b8aab0 4 root-relative coverage round (verifier E1-E4 + two gaps the widened gate exposed, 2026-08-19): every gating row here is the SAME three-line pattern every verb in the original root-relative round already pays — a singleRoot bool, a rootPrefix, a rootAttr, and one ternary per path emission (the shape clones/prcontext/situ/mcp-path all carry verbatim). --tree (runStructureText) +8 ccx / +13 LOC and --quality-panel (writePanelReport) +4 ccx / +12 LOC are those lines plus the finding comment; forTaskText and packTaskBundleText are argument threading only. packBodiesJson api-surface 3 to 4 params is a DELIBERATE contract change: a defaulted trailing rootArg, identical in name, position and default to the one packSignatures/packBodies/packLego/packOutline already take, so the emitter family stays one shape and every existing call site is unaffected. churn=self/ambient is this change's own edit window. Payoff: 1340 absolute paths removed from four surfaces (tree 1212, analyze 85, panel 40, mcp-for 3) plus 5 in the pack-task JSON tail that the gate had been scoring on an empty document, and every single-root run now discloses its root exactly once. All red-first in test/rootrelcheck.sh ack api-surface 93848617cae1fe4e 2 cid=a42863f577100fa6 A3: TestRunnerIndex takes the run's crawl root so run= is spelled relative to root= (one absolute root per document, test/rootrelemitcheck.sh ARM 9). The parameter is the fix; every caller passes the root it already holds. ack api-surface 95cc88ca4aab7039 4 cid=25c411d4871bda46 C1 F-06/F-07/F-10 (the listing-paging round): three listing verbs learn to disclose and page their row listings, and every gating row is that one change. api-surface 14 = ONE trailing DEFAULTED parameter each (an int pageOffset, an McpPageArgs window, a SituPageArgs, or the next= invocation a header now carries) on the emitters that must be TOLD their window — writeFlags/writeGate, writeCappedRows/writeCappedList/writeFlip/writeFlipHeader/writeFlipLights, computeFlip, nearestGateNames (which gains its cap and its TOTAL, the disclosure itself), situShowingNote/writeSituation, and the three MCP twins flagsText/flipText/situationDiffJson; additive by construction, every pre-existing call site compiles unchanged, and the alternative — a second capped emitter per verb — is the drift this repo removes rather than adds, because two emitters that disagree about a window can drop the row that IS the answer. verbosity 3 = kDocDriftLegend +20 lines and writeDocDriftPage +10 are the in-band vocabulary a reader needs to read shown_failed=/failed_capped=/failed_total= where they meet it (the rationale and the next= scan were already hoisted OUT of the body into their own function and comment, which took the complexity row to zero and the LOC row from +48 to +10); dispatchMcpLine +12 is two pagedResult wrappers on a pre-existing 1376-line dispatcher this lane adds to rather than creates. complexity 1 = the same dispatcher, +9 on a base of 518. duplication 1 = flagsText | flipText at 110 tokens, down from 131 after the shared mcpRowCap fold; the residual is getIndex + compute + captureXml, the shape EVERY index-backed MCP twin in this file has, and merging two verbs that return different results behind one entry point would be worse code than the clone. short-horizon-churn 19 = this lane's own footprint across cli.h/docdrift.h/darkflags.h/flipimpact.h/situ.h/mcp*, plus cli.h symbols three other lanes touched the same day; none foreign, none thrash. ack api-surface 96fdcdff2f0ff0f7 4 R-H span tiers (2026-08-19 wave-3 lane, harvest R-H / experiment E5). The nine gating rows are ONE change, read line by line before acking. (1) api-surface grepHitsJson 3->4 params + verbosity: the MCP grep verb takes the span-tier MODE, because the escape hatch has to exist on the MCP surface too — an MCP-only agent that reads suppressed_comment= has no CLI to re-ask from; deliberate contract-change. WAVE-3 VERIFIER CORRECTION (P6-1): this reason originally read 'both callers updated in the same commit' and that was FALSE - src/mcpverbs.h's batch arm still took the defaulted GrepIn::Code and read no 'in' field at all, so the hatch was closed on the ONE surface that had no CLI fallback. Closed in the wave-3 fix lane: both callers now read the value through the same closed-value reader (mcpverbs.h::grepInModeFromArg), 'in' is a declared kBatchSubQueryFields member, and greptiercheck arms (9b)/(9c) pin the batch hatch and its refusal. (2) parseArgs +6 cx / +14 LOC and dispatchMcpLine +3 cx: one new closed-value flag arm (--grep-in=code|any) and its MCP twin, the same shape --grep-scope= added; a flag cannot be added to a hand-rolled parser without them. (3) churn=self on emitGrepReport / grepHitsJson / measure_set: this change's own edit window, not a history signal. (4) emitGrepReport +20 LOC / grepHitsJson +14 LOC: the filter call plus its wiring — the six conditional appends and the legend clause were already lifted into grepTierAttrs/grepTierLegend/grepTierKeys (the grepUnindexedAttrs/grepUnindexedKeys pattern), which is why the COMPLEXITY regressions on both are gone. Nothing here is a shortcut: the tier policy lives in search.h::grepApplySpanTiers and the parse in ingest.cpp::spanTiersOfFiles, both new symbols with their own gate (test/greptiercheck.sh - 30 arms at the wave-3 fix-lane head, 18 FAIL on the clean adb0831 pre-lane binary, 0 here; this text read '22 arms, 12 red', written against an earlier revision of the gate and never refreshed - WAVE-3 VERIFIER CORRECTION P6-7, and an ack's reason is the artifact a future reader trusts instead of re-deriving). +ack api-surface 9700dd1faa4b268d 4 cid=80480bc14e175681 now=4 was=3 facet=contract-change p=src/shstatus.h:750 CR712-SHSTATUS-DEPTH: shstatus.h detail:: recursion helpers (internal to the header, every caller updated in the same commit) take the one NestBudget the lexer and parser share; not a public contract ack api-surface 983814f2b5912a90 3 cid=fe2cfa34166f503a M13 paging/budget parity: each of these nine gained exactly ONE trailing DEFAULTED parameter (an McpPageArgs window, a token budget, or the legend posture) so its MCP twin can honor the flag its CLI twin already honors. Additive by construction - every pre-existing call site compiles unchanged and was verified to - and the alternative, a second overload per verb, is the clone seam this repo removes rather than adds. ack api-surface 9b27b4a434a22d52 5 cid=d77ea26ba88a5261 now=5 was=4 facet=contract-change p=src/editcheck.h:814 train 30 fcall-forward nit N1 (d62c00e0): ONE trailing span parameter, the graph's keptForwards, so this call-site reader applies the one model.h forwardCounts rule (--uses' own) instead of counting a forward buildGraph dropped; every caller passes g.keptForwards in the same commit; red-first in test/fcallforwardcheck.sh S1-S3. ack api-surface 9ebbafddddd086b4 7 cid=50e8788010378ebe capture-audit 2026-09-04 wave-1 close, lane L5 (refusal population, lane-L5.md) + lane L0 H13: guard code and its reasoning, not accidental growth — H6 file-list refusal (writeSituation/dispatchMcpLine/runChangeViews), H7 empty-selection refusals (runCrossRef flags/stray-content, evalStray badRefs, writeWhereisPage line-seed + near-miss), M7 named-file inputs + M8 --since validated once before any verb (main), M9 edit-verb refusals (runCliEdit/nearestNames/resolveOneForEdit), M20 seed disclosure (serialize + MapAnnotations::SeedDisclosure, packLego defs=, packConnect terminal defs=), F10/F14 empty list items (runPath/packConnect). L5 left these un-acked on purpose (shared-ledger race, H10); acked at close against the lane's own ec5e3c3 measurement | prior: WAVE-2 close (2026-08-19), finding 3 of 3: the 76 remaining gating rows, ONE change. All of them are W2-E's root-relative p= landing (9beaa2c/fccea68/a271e6c/b3fe074 plus the f9108b7 correction), measured for the first time at WAVE granularity. The per-lane acks written during W2-E covered only the correction round's own diff (working-tree-vs-HEAD at that moment), so the original ~30-verb landing was never QD-acked; this ack closes that gap rather than re-accepting anything. Verified by reading the whole 20cdc04..860291c src/main.cpp diff line by line: 282 of 448 added lines match the root-relative predicate directly and every one of the remaining 127 is an existing std::printf rewritten from ing.files[...] to the root-relative rp local, plus four extracted emit helpers (computeDirModules, printJsonSymbolRows, writeOversizeRows, writeDropRows). No unrelated logic rides in. By kind: api-surface 28 = the +1 rootArg/rootPrefix parameter on the emitters that must now be TOLD their root (writeAbiCheck/Ref/Struct, emitColumnar*, packBodies/Deps/Lego/Outline/Signatures[Json], serialize[Json], writeLayout*, packConnect, buildD1Row and the report writers) - defaulted wherever a caller could stay unchanged. complexity 31 and verbosity 16 = the single-root-condition ternary and its guarded root= clause applied per emitter, with no new nesting level and no new control flow beyond that one conditional; the large absolute numbers (runStructureText 207->231, runLint 313->323, runMaintenanceViews 174->190, runCallHierarchy 71->80) are pre-existing dispatcher size the wave adds to, not creates - decomposing them is its own round and is recorded as a wave-2 follow-up. params 1 = writeNonLocalStateReport 4->6, the same contract. The three sibling lanes are individually clean: --quality-delta at f6ec56d..1732fd8 (W2-J), 1732fd8..9a41c74 (W2-K) and 9a41c74..20cdc04 (W2-F) each report gating=0. Full suite green at this head: gates=429 pass=427 skip=2 fail=0, ASan+LSan clean, byte-deterministic, xmllint clean. churn= is unavailable in ref-pair mode by construction (both trees materialized out of the repo), so short-horizon-churn is silent here and that silence is not evidence. From 079594b32c14d8c6d033104f7c780fe160d54f72 Mon Sep 17 00:00:00 2001 From: joyful-ii-V-I <210578314+joyful-ii-V-I@users.noreply.github.com> Date: Sat, 21 Nov 2026 20:32:06 -0500 Subject: [PATCH 12/44] qd: tangle's gating rule only in the present-only tangle legend; pins The always-emitted legend core no longer says how tangle rows gate (the tangle row legend, emitted only beside a tangle row, already does), so the clean "am I done" legend pays 13 B less for tangle than before the lane. Pins: legend dictv in COMMANDS.md and the 11-20 showcase capture, the printf parity golden (help_all), the qscheme tripwire (defectSitesOf moved, blob shape unchanged, kQSnapCacheScheme stays 38). The new gates check every exit status they rely on (prereview CI10). Co-Authored-By: Claude Opus 5.5 --- docs/COMMANDS.md | 2 +- docs/captures/COMMANDS_showcase_2026-11-20.md | 2 +- src/verbs_quality.h | 2 +- test/defectackschemecheck.sh | 7 ++++--- test/printf_parity.manifest | 2 +- test/qschemetripcheck.sh | 6 ++++++ test/shellnestcheck.sh | 8 +++++--- test/tanglecheck.sh | 4 ++-- 8 files changed, 21 insertions(+), 12 deletions(-) diff --git a/docs/COMMANDS.md b/docs/COMMANDS.md index 93da48fda..a42061290 100644 --- a/docs/COMMANDS.md +++ b/docs/COMMANDS.md @@ -4658,7 +4658,7 @@ _The session legend dictionary the MCP server serves as ripwire://legend-dict/fu ``` $ ./build/ripwire . --legend-dict -ripwire legend dictionary ripwire.dict/v1 dictv=c40ddf725e4befcb entries=1177 +ripwire legend dictionary ripwire.dict/v1 dictv=f068f81fdac8104f entries=1178 : this LAST child is only the legend pointer; the root keeps every attribute it carries inline, unchanged (schema=, each count, cut and floor); rows follow it; legend="ref": a definition is sent once per session (this dictionary's core, or the first answer that needs … [line truncated: 80 more bytes on this line] schema=ripwire.KEY/v1: the line ripwire.KEY/v1 below reads the answer's rows window: shown= total= capped= has_more= next_offset= offset= limit= page a list (capped=1 cut; next_offset= pastes as offset=) diff --git a/docs/captures/COMMANDS_showcase_2026-11-20.md b/docs/captures/COMMANDS_showcase_2026-11-20.md index a3f728743..cf84407d5 100644 --- a/docs/captures/COMMANDS_showcase_2026-11-20.md +++ b/docs/captures/COMMANDS_showcase_2026-11-20.md @@ -5981,7 +5981,7 @@ ripwire: --run-timeout=SECONDS modifies --run-trace — pass it too (e.g. ripwir *The session legend dictionary the MCP server serves as ripwire://legend-dict/full — one definition per line, headed by its dictv= version; no corpus needed. =roster lists the completeness attributes it defines.* ````` -ripwire legend dictionary ripwire.dict/v1 dictv=c40ddf725e4befcb entries=1177 +ripwire legend dictionary ripwire.dict/v1 dictv=f068f81fdac8104f entries=1178 : this LAST child is only the legend pointer; the root keeps every attribute it carries inline, unchanged (schema=, each count, cut and floor); rows follow it; legend="ref": a definition is sent once per session (this dictionary's core, or the first answer that needs … [line truncated: 80 more bytes on this line] schema=ripwire.KEY/v1: the line ripwire.KEY/v1 below reads the answer's rows window: shown= total= capped= has_more= next_offset= offset= limit= page a list (capped=1 cut; next_offset= pastes as offset=) diff --git a/src/verbs_quality.h b/src/verbs_quality.h index 386ab15b7..d26dc2217 100644 --- a/src/verbs_quality.h +++ b/src/verbs_quality.h @@ -1477,7 +1477,7 @@ inline constexpr const char* kQdLegendCore = "score). THIRTEEN KINDS, and kind= on every row names which one: complexity over the ccx bar, verbosity " "(LOC), nesting, params, duplication, dead-code, api-surface (new public contract drift), " "error-masking, short-horizon-churn, new-clone-of-reused-helper, placeholder (added stub/TODO), " - "defect-shape (defect= names it), tangle (a long function's nesting, deep share and steering locals; a new, crossing or growing one gates). " + "defect-shape (defect= names it), tangle (a long function's nesting, deep share and steering locals). " "THREE independent axes, in this " "order: (1) acked findings are suppressed entirely (acked= counts them); (2) ORIGIN — a finding on a " "symbol that EXISTED at the baseline is preexisting-worse (no origin attribute), one that exists only " diff --git a/test/defectackschemecheck.sh b/test/defectackschemecheck.sh index b38f9ed85..756720807 100755 --- a/test/defectackschemecheck.sh +++ b/test/defectackschemecheck.sh @@ -46,7 +46,8 @@ ack(){ ( cd "$1" && "$BIN" . --quality-delta --no-cache --ack-only=format-arity run(){ ( cd "$1" && "$BIN" . --quality-delta --no-cache >"$2" 2>/dev/null ); } # (p) the binary's own key for this row -fixture "$TMP/cur"; ack "$TMP/cur" "current ack" +fixture "$TMP/cur"; ack "$TMP/cur" "current ack"; arc=$? +[ "$arc" = 0 ] || no "(p) --quality-ack on the fresh row exited $arc, want 0" CUR="$( ackkey "$TMP/cur" )" if [ -n "$CUR" ] && [ "$CUR" != "$LEGACY_KEY" ]; then ok "(p) the row's current key $CUR differs from its two-bit key $LEGACY_KEY" else no "(p) want one current key different from $LEGACY_KEY; got '${CUR:-none}' — the fixture no longer exercises a moved site"; fi @@ -66,7 +67,7 @@ if [ "$rc" = 0 ] && [ "$a" = 1 ] && [ -z "$k" ]; then ok "(c) the current-key ac else no "(c) want rc=0 acked=1 and no acks_rekeyed_by_scheme=; got rc=$rc acked=${a:-?} acks_rekeyed_by_scheme=${k:-absent}"; fi # (h) re-ack heals the legacy row forward -ack "$TMP/leg" "re-ack" +ack "$TMP/leg" "re-ack" # status: exits 1 by design (the row is already acked through the alias: nothing new to accept); (h) judges the ledger it re-serialised HK="$( ackkey "$TMP/leg" )"; reason="$( grep -cE '^ack defect-shape .* legacy ack$' "$TMP/leg/$LEDGER" )" run "$TMP/leg" "$TMP/heal.xml"; rc=$?; k="$( attr acks_rekeyed_by_scheme "$TMP/heal.xml" )" if [ "$HK" = "$CUR" ] && [ "$reason" = 1 ] && [ "$rc" = 0 ] && [ -z "$k" ]; then ok "(h) --quality-ack re-filed the row at $HK with its reason; the next run needs no alias" @@ -74,7 +75,7 @@ else no "(h) want the ledger at $CUR with the legacy reason and a later run with # (r) optional: re-derive the recorded key with a two-bit binary if [ -n "${RIPWIRE_LEGACY_BIN:-}" ]; then - fixture "$TMP/rec"; ( cd "$TMP/rec" && "$RIPWIRE_LEGACY_BIN" . --quality-delta --no-cache --ack-only=format-arity --quality-ack="legacy ack" >/dev/null 2>&1 ) + fixture "$TMP/rec"; ( cd "$TMP/rec" && "$RIPWIRE_LEGACY_BIN" . --quality-delta --no-cache --ack-only=format-arity --quality-ack="legacy ack" >/dev/null 2>&1 ) # status: (r) judges the key the legacy binary wrote, not its exit RK="$( ackkey "$TMP/rec" )" if [ "$RK" = "$LEGACY_KEY" ]; then ok "(r) $RIPWIRE_LEGACY_BIN writes the recorded two-bit key $RK"; else no "(r) $RIPWIRE_LEGACY_BIN wrote '${RK:-none}', the recorded key is $LEGACY_KEY"; fi fi diff --git a/test/printf_parity.manifest b/test/printf_parity.manifest index 54048d283..5251b1176 100644 --- a/test/printf_parity.manifest +++ b/test/printf_parity.manifest @@ -38,5 +38,5 @@ safe_delete 0 7b17c59f7606ebe5c5119ffc2a712e8249feea645887d791368324bb3f60b6c1 e verify_layer 1 e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 5288c345d7d6e335f88b9c1daa8935db22e1dcf89c0c8bc1f6140d4cb5af0b48 graph_query 1 e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 bfa4319feb9dee09cfbd3991cf6fbd752297e99d14de9e75768820d2a9c8832f callers_limit 0 04256d098a1e739789770682d305d4cae6102ecd99f702cbef7d1f34a8173160 e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 -help_all 0 9c870f038f1ba0d5d9d97ddeb1f219e740bb693a03c9cf1319d17b15dddaf1ea e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 +help_all 0 7a8cc9daf0d713650f0cfe68cfe11aa34a98e5fb1783c20fb650123edb60de67 e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 help_one 0 938ff4f8802a8f5d9cb10f9a1f3804ac755be44c8ab00e24e45bfe8255224a21 e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 diff --git a/test/qschemetripcheck.sh b/test/qschemetripcheck.sh index b0931e0f1..08d8819b8 100755 --- a/test/qschemetripcheck.sh +++ b/test/qschemetripcheck.sh @@ -46,6 +46,12 @@ PIN="$ROOT/test/qschemetrip.hash" # 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-21, lane QD-LESSONS-2a (on main 8861b0d4d): RE-PINNED with UPDATE_GOLDEN=1 (hash 269831ba67…15a52a). defectSitesOf moved: +# it takes an optional shell-cut counter (CR712-SHSTATUS-DEPTH) and each site record also carries its two-bit value +# (legacySite, CR712-ACK-KEY-MASK), which computeSnapshot does not store. The blob shape is unchanged; the Bash scanners +# now stop at the one nesting budget (64) instead of crashing (subshell/group/if) or cutting $( ) at 40, which changes +# the site set only for a script nested that deep, and the producer identity keeps this build's blobs apart, so +# kQSnapCacheScheme stays 38 (the cr-qd-kinds-068 fix-round-1 precedent below). # 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/shellnestcheck.sh b/test/shellnestcheck.sh index 5925fca2f..50aa0f91d 100755 --- a/test/shellnestcheck.sh +++ b/test/shellnestcheck.sh @@ -61,12 +61,14 @@ for k in subshell group if quote subst; do else no "($k) 5000 deep: want rc 0/2 within 60 s and shell_cut=\"1\"; got rc=$rc in ${t}s, shell_cut='${c:-none}' ($( tail -c 160 "$TMP/$k.err" | tr '\n' ' ' ))"; fi done R="$TMP/r-subshell-5000" -j="$( "$BIN" "$R" --quality-delta --json --no-cache 2>/dev/null | python3 -c 'import json,sys; print(json.load(sys.stdin).get("shell_cut","absent"))' 2>/dev/null || echo unparseable )" -if [ "$j" = 1 ]; then ok "(j) --json: \"shell_cut\":1"; else no "(j) --json: want \"shell_cut\":1, got '$j'"; fi +"$BIN" "$R" --quality-delta --json --no-cache >"$TMP/j.json" 2>/dev/null; jrc=$? +j="$( python3 -c 'import json,sys; print(json.load(open(sys.argv[1])).get("shell_cut","absent"))' "$TMP/j.json" 2>/dev/null || echo unparseable )" +if { [ "$jrc" = 0 ] || [ "$jrc" = 2 ]; } && [ "$j" = 1 ]; then ok "(j) --json: \"shell_cut\":1"; else no "(j) --json: want rc 0/2 and \"shell_cut\":1, got rc=$jrc '$j'"; fi for n in 40 1; do R="$( repo case "$n" )" - "$BIN" "$R" --quality-delta --no-cache >"$TMP/case$n.xml" 2>/dev/null + "$BIN" "$R" --quality-delta --no-cache >"$TMP/case$n.xml" 2>/dev/null; crc=$? + case "$crc" in 0|2) ;; *) no "(case $n) --quality-delta exited $crc";; esac row="$( grep -oE ']*defect="unhandled-arm"[^>]*>' "$TMP/case$n.xml" | grep 'deep_check.sh' | head -1 )" c="$( cutof "$TMP/case$n.xml" )" label=n1; [ "$n" = 1 ] && label=n2 diff --git a/test/tanglecheck.sh b/test/tanglecheck.sh index e992b63c2..ebbbda3e0 100755 --- a/test/tanglecheck.sh +++ b/test/tanglecheck.sh @@ -73,11 +73,11 @@ Q="$TMP/qd.xml" "$BIN" "$R" --quality-delta --json --no-cache >"$TMP/qd.json" 2>/dev/null; rcj=$? M="$( "$BIN" "$R" --metrics --no-cache 2>/dev/null )"; rcm=$? mkdir -p "$TMP/head" && "${G[@]}" -C "$R" archive HEAD | tar -x -C "$TMP/head" -MH="$( "$BIN" "$TMP/head" --metrics --no-cache 2>/dev/null )" +MH="$( "$BIN" "$TMP/head" --metrics --no-cache 2>/dev/null )"; rcmh=$? rc="$( cat "$Q.rc" )" case "$rc" in 0|2) ;; *) no "quality-delta exit status $rc (stderr: $( head -c 300 "$Q.err" ))";; esac if [ "$rc2" != "$rc" ] || [ "$rcj" != "$rc" ]; then no "quality-delta exit status differs between runs: $rc, again $rc2, --json $rcj"; fi -if [ "$rcm" != 0 ]; then no "--metrics exit status $rcm"; fi +if [ "$rcm" != 0 ] || [ "$rcmh" != 0 ]; then no "--metrics exit status $rcm (working tree), $rcmh (HEAD)"; fi # tangle row for a symbol (sym= ends in ::NAME or is NAME), or empty trow(){ grep -oE "]*>" "$Q" | head -1; } From c3d395d7cc28e11e2e74b8902e59b0e042b587a2 Mon Sep 17 00:00:00 2001 From: joyful-ii-V-I <210578314+joyful-ii-V-I@users.noreply.github.com> Date: Sat, 21 Nov 2026 22:43:42 -0500 Subject: [PATCH 13/44] qd: fit the tangle exception into the MCP and compact legend budgets; pins The quality_delta MCP description (tools/list ceiling 47,420 B; prose never moves it) and the compact new-symbol= reading (stair target 940 B) each paid for the tangle exception in fewer words elsewhere: "a tangled one", "hide until worse", "never gates", "a fresh pinned ... sidecar"; compact "ceiling=, tangle". qdrefpaircheck arm E re-pinned 8 -> 10 (packBodies grew over the bar, collectSources crossed it: tangle gates now). The new gate sorts into regression.sh's list; dictv pins follow the legend. Co-Authored-By: Claude Opus 5.5 --- docs/COMMANDS.md | 2 +- docs/captures/COMMANDS_showcase_2026-11-20.md | 2 +- src/compactlegend.h | 2 +- src/mcp.h | 2 +- test/defectshapecheck.sh | 2 +- test/qdrefpaircheck.sh | 12 +++++++++--- test/regression.sh | 2 +- 7 files changed, 15 insertions(+), 9 deletions(-) diff --git a/docs/COMMANDS.md b/docs/COMMANDS.md index a42061290..74156ca55 100644 --- a/docs/COMMANDS.md +++ b/docs/COMMANDS.md @@ -4658,7 +4658,7 @@ _The session legend dictionary the MCP server serves as ripwire://legend-dict/fu ``` $ ./build/ripwire . --legend-dict -ripwire legend dictionary ripwire.dict/v1 dictv=f068f81fdac8104f entries=1178 +ripwire legend dictionary ripwire.dict/v1 dictv=6ad237691d743450 entries=1178 : this LAST child is only the legend pointer; the root keeps every attribute it carries inline, unchanged (schema=, each count, cut and floor); rows follow it; legend="ref": a definition is sent once per session (this dictionary's core, or the first answer that needs … [line truncated: 80 more bytes on this line] schema=ripwire.KEY/v1: the line ripwire.KEY/v1 below reads the answer's rows window: shown= total= capped= has_more= next_offset= offset= limit= page a list (capped=1 cut; next_offset= pastes as offset=) diff --git a/docs/captures/COMMANDS_showcase_2026-11-20.md b/docs/captures/COMMANDS_showcase_2026-11-20.md index cf84407d5..b32febb29 100644 --- a/docs/captures/COMMANDS_showcase_2026-11-20.md +++ b/docs/captures/COMMANDS_showcase_2026-11-20.md @@ -5981,7 +5981,7 @@ ripwire: --run-timeout=SECONDS modifies --run-trace — pass it too (e.g. ripwir *The session legend dictionary the MCP server serves as ripwire://legend-dict/full — one definition per line, headed by its dictv= version; no corpus needed. =roster lists the completeness attributes it defines.* ````` -ripwire legend dictionary ripwire.dict/v1 dictv=f068f81fdac8104f entries=1178 +ripwire legend dictionary ripwire.dict/v1 dictv=6ad237691d743450 entries=1178 : this LAST child is only the legend pointer; the root keeps every attribute it carries inline, unchanged (schema=, each count, cut and floor); rows follow it; legend="ref": a definition is sent once per session (this dictionary's core, or the first answer that needs … [line truncated: 80 more bytes on this line] schema=ripwire.KEY/v1: the line ripwire.KEY/v1 below reads the answer's rows window: shown= total= capped= has_more= next_offset= offset= limit= page a list (capped=1 cut; next_offset= pastes as offset=) diff --git a/src/compactlegend.h b/src/compactlegend.h index 3648bef6c..ed333e310 100644 --- a/src/compactlegend.h +++ b/src/compactlegend.h @@ -1061,7 +1061,7 @@ inline constexpr CompactCompletenessTerm kCompactAttributeReadings[] = // CR712-SHSTATUS-DEPTH (src/quality.h ratchetAttrsXml): present when not 0 { "shell_cut", "shell_cut=N: shell files whose defect-shape scan stopped at nesting depth 64; deeper code not judged", false, "quality-delta", MapHeaderRead::No, {}, "quality-delta" }, { "preexisting-worse", "preexisting-worse=N: regressions on symbols that existed at baseline; they gate when major", false, "quality-delta", MapHeaderRead::No, {}, "quality-delta" }, - { "new-symbol", "new-symbol=N: NEW code; new-symbol rows never gate, except defect-shape format-arity, a ceiling= row or a tangle row", false, "quality-delta", MapHeaderRead::No, {}, "quality-delta" }, + { "new-symbol", "new-symbol=N: NEW code; new-symbol rows never gate, except defect-shape format-arity, ceiling=, tangle", false, "quality-delta", MapHeaderRead::No, {}, "quality-delta" }, { "register-macro-excluded", "register-macro-excluded=N: symbols skipped: self-registering test/bench macros or Rust #[test]; a floor", false, "quality-delta", MapHeaderRead::No, {}, "quality-delta" }, { "declined-call-excluded", "declined-call-excluded=N: symbols kept out of dead-code only because a declined call may mean them; a floor", false, "quality-delta", MapHeaderRead::No, {}, "quality-delta" }, { "api-new-surface", "api-new-surface=N: new PUBLIC symbols; a count, never gates, not in regressions=", false, "quality-delta", MapHeaderRead::No, {}, "quality-delta" }, diff --git a/src/mcp.h b/src/mcp.h index b8cf0421d..5f240d6d2 100644 --- a/src/mcp.h +++ b/src/mcp.h @@ -1378,7 +1378,7 @@ inline McpDispatchResult dispatchMcpLine( const std::string& line, int topK, boo // paraphrased — this stanza used to describe an ordering the selector does not use. "{\"name\":\"exemplar\",\"description\":\"BEFORE writing a function / method / class / struct / interface / variable, get the repo's single best-in-class instance of that kind to imitate — signature AND full body. " + std::string( kExemplarSelectionRule ) + ". Beats grep/find_symbol: those find A definition, this ranks every definition and returns the one worth copying. kind = fn|method|class|struct|iface|var, OR a task string (its top match's kind is used).\"," + mcprefuse::toolMetadataFor( "exemplar", pathIsRequired ) + "}," - "{\"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, across 13 kinds (complexity, verbosity, nesting, params, new duplication/dead code/public API, error-masking, short-horizon churn, new helper clone, a stub/TODO, a defect shape, a tangle). new-symbol rows never gate, except defect-shape format-arity, a new function at the ceiling and a tangled new function. Read-only; compares vs git HEAD or a pinned .ripwire_quality_baseline sidecar when fresh. sev=minor does not gate; acked findings stay hidden until worse. at= is the commit compared at (+dirty: tree differed).\"," + "{\"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, across 13 kinds (complexity, verbosity, nesting, params, new duplication/dead code/public API, error-masking, short-horizon churn, new helper clone, a stub/TODO, a defect shape, tangle). new-symbol rows never gate, except defect-shape format-arity, a new function at the ceiling and a tangled one. Read-only; compares vs git HEAD or a fresh pinned .ripwire_quality_baseline sidecar. sev=minor never gates; acked findings hide until worse. at= is the commit compared at (+dirty: tree differed).\"," + mcprefuse::toolMetadataFor( "quality_delta", pathIsRequired ) + "}," "{\"name\":\"quality_baseline\",\"description\":\"PIN the quality floor: writes .ripwire_quality_baseline stamped with the current git HEAD sha, snapshotting complexity / duplication / dead-code / API surface. Call once at the start of non-trivial work, then quality_delta compares against this pinned floor instead of HEAD. Side-effecting (writes a file) — skip it for a simple 'before I push' check, quality_delta already compares vs HEAD with zero setup.\"," + mcprefuse::toolMetadataFor( "quality_baseline", pathIsRequired ) + "}," diff --git a/test/defectshapecheck.sh b/test/defectshapecheck.sh index 19d6aa33e..377574162 100644 --- a/test/defectshapecheck.sh +++ b/test/defectshapecheck.sh @@ -2152,7 +2152,7 @@ PHRASE='new-symbol rows never gate, except defect-shape format-arity' # QD-ENTRY-CEILING (2026-11-13) adds the second exception, a NEW function at 4x the bar, and TANGLE-GATE-B (2026-11-21) # the third, a new function at tangle 6 or more: every statement of the rule names both, in the long form (legend, # help, MCP, docs) or the compact legend's ceiling= row and tangle row. -CEILX='(, a new function at the ceiling[^.;]* (and a tangled new (function|one)|and a new one at tangle 6 or more)|, a ceiling= row or a tangle row)' +CEILX='(, a new function at the ceiling[^.;]* (and a tangled (new )?(function|one)|and a new one at tangle 6 or more)|, ceiling=, tangle)' phrase_ok(){ # LABEL TEXT — the text states the exception, and every "new-symbol rows never gate" in it carries it local all qual flat # whitespace-normalized first: a sentence may wrap anywhere in a document flat="$( printf '%s' "$2" | tr '\n' ' ' | tr -s ' ' )" diff --git a/test/qdrefpaircheck.sh b/test/qdrefpaircheck.sh index 36ad1baf8..308a210da 100755 --- a/test/qdrefpaircheck.sh +++ b/test/qdrefpaircheck.sh @@ -277,6 +277,12 @@ printf 'register_macros = NOPE_NEVER_USED\n' >"$RC/.ripwire_config" # ── (E) DECISIVE: ripwire's own recorded harvest wave, against the live-recomputed overlay oracle ───────── # RE-PIN LOG for the recorded literal below (it is a bare number, so its justification has to live here). +# 2026-11-21, lane QD-LESSONS-2a (TANGLE-GATE-B / QD-RATCHET-BASE): 8 → 10 gating rows on this wave. Both new rows are +# tangle rows the kind now gates by design (it was report-only): +# (over the bar and grew: deep 45->49, 257->277 lines) +# (crossed the bar: deep 14->22, 182->213 lines) +# The eight rows before are unchanged, and (E)'s row-for-row oracle comparison stays green (7 rows = the 5 before + these 2), +# so 7 + 3 churn = 10. # 2026-09-20, integration/train-13 (lane/t13-honesty-fixes fix 2): 9 → 8 gating rows on this wave, and the # row that left is EXACTLY the row train 12 added below. Fix 2 gives `reuse-decline` # (new-clone-of-reused-helper) the two demotions its sibling `duplication` already had, one of which is @@ -342,9 +348,9 @@ else # the two RECORDED literals from the round record — a cross-check that these shas still name that wave overlayTotal=$(( oracleN + overlayChurn )) - [ "$overlayTotal" = 8 ] \ - && ok "(E) the overlay reproduces the pinned 8 gating rows (= $oracleN + $overlayChurn churn; 9 between #60 and reuse-decline's test-script skip, 8 before #60, 18 pre-dial)" \ - || no "(E) the overlay gave $overlayTotal gating rows; this binary is pinned at 8 (9 between #60's file-scope callers and reuse-decline's all-test-script skip, 8 before #60, 18 before the 2026-09-10 dial round) — the shas, the corpus, a kind's tier or a kind's EVIDENCE moved; the RE-PIN LOG above arm (E) records how the last move was justified" + [ "$overlayTotal" = 10 ] \ + && ok "(E) the overlay reproduces the pinned 10 gating rows (= $oracleN + $overlayChurn churn; 8 before tangle gated, 9 between #60 and reuse-decline's test-script skip, 8 before #60, 18 pre-dial)" \ + || no "(E) the overlay gave $overlayTotal gating rows; this binary is pinned at 10 (8 before tangle gated (QD-LESSONS-2a), 9 between #60's file-scope callers and reuse-decline's all-test-script skip, 8 before #60, 18 before the 2026-09-10 dial round) — the shas, the corpus, a kind's tier or a kind's EVIDENCE moved; the RE-PIN LOG above arm (E) records how the last move was justified" dmmVal="$( "$BIN" "$ROOT" "--dmm=$WAVE_A..$WAVE_B" 2>/dev/null | grep -o ' dmm="[0-9.]*"' | head -1 | sed -E 's/.*"([0-9.]*)".*/\1/' )" # tolerance band, not equality: dmm is a float printed to 3 places (house float rule). if [ -n "$dmmVal" ] && awk -v v="$dmmVal" 'BEGIN{ exit !(v > 0.525 && v < 0.535) }'; then diff --git a/test/regression.sh b/test/regression.sh index aa3efc658..a84e850ea 100755 --- a/test/regression.sh +++ b/test/regression.sh @@ -451,6 +451,7 @@ for _g in \ decltodefcheck \ deeptailcheck \ defaultceilingcheck \ + defectackschemecheck \ defectshapecheck \ defoverdeclcheck \ defslookupcheck \ @@ -1044,7 +1045,6 @@ for _g in \ shapingflagcheck \ shellgateindexcheck \ shellnestcheck \ - defectackschemecheck \ showcasecapturecheck \ shrinkpaircheck \ sibliftcheck \ From 1116920704b397311c4e35cff1447e17525d1391 Mon Sep 17 00:00:00 2001 From: joyful-ii-V-I <210578314+joyful-ii-V-I@users.noreply.github.com> Date: Sat, 21 Nov 2026 23:38:24 -0500 Subject: [PATCH 14/44] docs: LIMITS.md lists kMaxShellNest (replaces kMaxSubDepth) The shell nesting budget's declaration carries its effect, so the generated cap table says what a cut does and where it is disclosed (shell_cut=N). Co-Authored-By: Claude Opus 5.5 --- docs/LIMITS.md | 2 +- src/shstatus.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/LIMITS.md b/docs/LIMITS.md index d82bc37f0..fcfefb56e 100644 --- a/docs/LIMITS.md +++ b/docs/LIMITS.md @@ -1499,7 +1499,7 @@ Discloses: **none** | constant | value | class | note | | --- | --- | --- | --- | -| `kMaxSubDepth` | `40` | — | nested $( ) parsed past this depth are left unparsed (an empty list) | +| `kMaxShellNest` | `64` | — | shell nesting past this depth is cut and not judged; --quality-delta says shell_cut=N | ### `src/siblift.h` diff --git a/src/shstatus.h b/src/shstatus.h index f1c878896..1229b4645 100644 --- a/src/shstatus.h +++ b/src/shstatus.h @@ -124,7 +124,7 @@ struct Tree // ONE nesting budget for the lexer and the parser (CR712-SHSTATUS-DEPTH): every recursion of either — a quote or $( ) the // lexer skips through, a compound command or a substitution the parser descends into — takes a level, so a script nested // past kMaxShellNest is cut there (Tree::cut) instead of exhausting the stack (20,000 nested subshells crashed the scan). -inline constexpr int kMaxShellNest = 64; +inline constexpr int kMaxShellNest = 64; // shell nesting past this depth is cut and not judged; --quality-delta says shell_cut=N struct NestBudget { int depth = 0; From a1ab35de480d1773c096e127eb8ac720ce77cad4 Mon Sep 17 00:00:00 2001 From: joyful-ii-V-I <210578314+joyful-ii-V-I@users.noreply.github.com> Date: Sat, 21 Nov 2026 23:50:02 -0500 Subject: [PATCH 15/44] qd: shell_cut= is a QdRootField and its legend sentence is present-only shell_cut= moves out of ratchetAttrsXml/Json (it is not a ratchet fact) into QdRootFields::shellCut, one qdCountField built in qdRootFieldsOf and named in qdRootTail's order right after the ratchet (same bytes, same place). The MCP quality_delta object adds the same countFieldOrEmpty after the ratchet attrs. The legend sentence leaves kQdLegendCore for kQdShellCutLegend, emitted only when QualityDeltaLegendParts.shellCut (basis.extras.shellCut > 0): a clean answer no longer pays 109 B for an attribute it does not carry (donelegendcheck full:qd_* targets). Co-Authored-By: Claude Opus 5.5 --- src/compactlegend.h | 2 +- src/mcpverbs.h | 1 + src/quality.h | 25 +++++++++++-------------- src/verbs_quality.h | 20 +++++++++++++++----- 4 files changed, 28 insertions(+), 20 deletions(-) diff --git a/src/compactlegend.h b/src/compactlegend.h index ed333e310..a6230be8b 100644 --- a/src/compactlegend.h +++ b/src/compactlegend.h @@ -1058,7 +1058,7 @@ inline constexpr CompactCompletenessTerm kCompactAttributeReadings[] = { "stale_next", "stale_next=: the call printing the sa rows and the full header", false, "quality-delta", MapHeaderRead::No, {}, "quality-delta" }, // D4 (src/quality.h ratchetAttrsXml): present when the tangle ratchet read its reference point { "ratchet_ref", "ratchet_ref=TAG ratchet_judged=N: N tangle rows' functions compared with their best since TAG; ratchet_unread= / ratchet_cut=1: versions not measured", false, "quality-delta", MapHeaderRead::No, {}, "quality-delta" }, - // CR712-SHSTATUS-DEPTH (src/quality.h ratchetAttrsXml): present when not 0 + // CR712-SHSTATUS-DEPTH (src/verbs_quality.h QdRootFields::shellCut): present when not 0 { "shell_cut", "shell_cut=N: shell files whose defect-shape scan stopped at nesting depth 64; deeper code not judged", false, "quality-delta", MapHeaderRead::No, {}, "quality-delta" }, { "preexisting-worse", "preexisting-worse=N: regressions on symbols that existed at baseline; they gate when major", false, "quality-delta", MapHeaderRead::No, {}, "quality-delta" }, { "new-symbol", "new-symbol=N: NEW code; new-symbol rows never gate, except defect-shape format-arity, ceiling=, tangle", false, "quality-delta", MapHeaderRead::No, {}, "quality-delta" }, diff --git a/src/mcpverbs.h b/src/mcpverbs.h index a565db309..8714b79a7 100644 --- a/src/mcpverbs.h +++ b/src/mcpverbs.h @@ -5051,6 +5051,7 @@ inline std::pair qualityDeltaJson( const std::string& + ( oc.headBasis == nullptr ? std::string() : std::string( ",\"head_basis\":\"" ) + mcpdetail::jsonEscape( oc.headBasis ) + "\"" ) + oc.historyJson + rw::quality::ratchetAttrsJson( oc.extras ) + + countFieldOrEmpty( "shell_cut", oc.extras.shellCut, /*json=*/true ) // CR712-SHSTATUS-DEPTH (QdRootFields::shellCut) + ",\"at\":" + atJson + ",\"r\":["; bool first = true; for( const rw::quality::Regression& r : oc.regs ) diff --git a/src/quality.h b/src/quality.h index 32effaeef..c13271273 100644 --- a/src/quality.h +++ b/src/quality.h @@ -11005,31 +11005,28 @@ inline std::string tangleRowAttrs( const Regression& r, bool json, Escape&& esc return out; } -// D4 — the ratchet's disclosure on the root: the reference point it read, and what it could not read ("" when it was not -// consulted); then CR712-SHSTATUS-DEPTH's shell_cut= (the shell files whose defect-shape scan the nesting budget cut; absent at 0). +// D4 — the ratchet's disclosure on the root: the reference point it read, and what it could not read. "" when it was not consulted. template inline std::string ratchetAttrsXml( const DeltaExtras& x, Escape&& ex ) { - std::string out; - if( !x.ratchetRef.empty() ) + if( x.ratchetRef.empty() ) { - out = " ratchet_ref=\"" + ex( x.ratchetRef ) + "\" ratchet_judged=\"" + std::to_string( x.ratchetJudged ) + "\""; - out += x.ratchetUnread > 0 ? " ratchet_unread=\"" + std::to_string( x.ratchetUnread ) + "\"" : std::string(); - out += x.ratchetCut ? " ratchet_cut=\"1\"" : ""; + return {}; } - out += x.shellCut > 0 ? " shell_cut=\"" + std::to_string( x.shellCut ) + "\"" : std::string(); + std::string out = " ratchet_ref=\"" + ex( x.ratchetRef ) + "\" ratchet_judged=\"" + std::to_string( x.ratchetJudged ) + "\""; + out += x.ratchetUnread > 0 ? " ratchet_unread=\"" + std::to_string( x.ratchetUnread ) + "\"" : std::string(); + out += x.ratchetCut ? " ratchet_cut=\"1\"" : ""; return out; } inline std::string ratchetAttrsJson( const DeltaExtras& x ) { - std::string out; - if( !x.ratchetRef.empty() ) + if( x.ratchetRef.empty() ) { - out = ",\"ratchet_ref\":\"" + rw::jsonesc::escapeMcp( x.ratchetRef ) + "\",\"ratchet_judged\":" + std::to_string( x.ratchetJudged ); - out += x.ratchetUnread > 0 ? ",\"ratchet_unread\":" + std::to_string( x.ratchetUnread ) : std::string(); - out += x.ratchetCut ? ",\"ratchet_cut\":1" : ""; + return {}; } - out += x.shellCut > 0 ? ",\"shell_cut\":" + std::to_string( x.shellCut ) : std::string(); + std::string out = ",\"ratchet_ref\":\"" + rw::jsonesc::escapeMcp( x.ratchetRef ) + "\",\"ratchet_judged\":" + std::to_string( x.ratchetJudged ); + out += x.ratchetUnread > 0 ? ",\"ratchet_unread\":" + std::to_string( x.ratchetUnread ) : std::string(); + out += x.ratchetCut ? ",\"ratchet_cut\":1" : ""; return out; } diff --git a/src/verbs_quality.h b/src/verbs_quality.h index d26dc2217..f0f227702 100644 --- a/src/verbs_quality.h +++ b/src/verbs_quality.h @@ -1495,11 +1495,13 @@ inline constexpr const char* kQdLegendCore = // P3 (L7): next= on gating rows, defined where the reader meets it "A gating row's next= is the one pasteable follow-up: expand on FILE:NAME, the body to fix (a duplication row names a SET and carries none). " // P8 (L7): the threshold beside the number - "bar= on a complexity/verbosity/nesting/params row is the threshold now= is judged against (ccx 15, loc 60, nest 4, params 5). " - // CR712-SHSTATUS-DEPTH: present only when not 0 + "bar= on a complexity/verbosity/nesting/params row is the threshold now= is judged against (ccx 15, loc 60, nest 4, params 5). "; + +// CR712-SHSTATUS-DEPTH — present-only: rides with shell_cut= on the root (QdRootFields::shellCut), absent at 0. +inline constexpr const char* kQdShellCutLegend = "shell_cut=N: shell files whose defect-shape scan stopped at nesting depth 64; what lies deeper was not judged. "; -static_assert( rw::shstatus::kMaxShellNest == 64, "kQdLegendCore's and compactlegend.h's shell_cut= sentences say depth 64" ); +static_assert( rw::shstatus::kMaxShellNest == 64, "kQdShellCutLegend's and compactlegend.h's shell_cut= sentences say depth 64" ); // The macro FAMILIES, and why a member of one cannot be judged dead — printed only when the run actually // excluded something, because on a repo with no such macro the roster explains an empty set. @@ -1904,6 +1906,7 @@ struct QualityDeltaLegendParts bool staleTree = false; // D3 QD-STALE-HEADER: stale_tree= is on the root bool ratchetRead = false; // D4: ratchet_ref= is on the root bool anyImproved = false; // QD-CREDIT-ROW: the section is in the document + bool shellCut = false; // CR712-SHSTATUS-DEPTH: shell_cut= is on the root }; // qd-memory-degrade — present-only: each rides only with the attributes it defines. No double dash anywhere in them @@ -2131,6 +2134,10 @@ inline void emitQualityDeltaLegend( const QualityDeltaLegendParts& p, std::FILE* { rw::emitRaw( out, kQdImprovedLegend ); // QD-CREDIT-ROW } + if( p.shellCut ) + { + rw::emitRaw( out, kQdShellCutLegend ); // CR712-SHSTATUS-DEPTH + } if( p.scoped ) { @@ -2964,6 +2971,7 @@ struct QdRootFields QdRootField kinds; // qd-memory-degrade: kinds not run, why, the replay, the peak (kindsDisclosure) QdRootField history; // hwh-fix4 (N1): history a gating kind could not read (unread_history=) QdRootField ratchet; // D4: the ratchet's reference point and what it could not read + QdRootField shellCut; // CR712-SHSTATUS-DEPTH: shell files whose defect-shape scan the nesting budget cut }; // The root's tail in one order for both formats. `foldAttrs` (XML only) is the stale fold's stale_by_kind=/stale_next=, @@ -2977,7 +2985,7 @@ std::string qdRootTail( const QdRootFields& f, QdFormat format, std::string_view out += field->in( format ); } out += foldAttrs; - for( const QdRootField* field : { &f.kinds, &f.history, &f.ratchet } ) + for( const QdRootField* field : { &f.kinds, &f.history, &f.ratchet, &f.shellCut } ) { out += field->in( format ); } @@ -3036,6 +3044,7 @@ QdRootFields qdRootFieldsOf( const QdReport& rep ) f.history = fromPair( quality::historyUnreadDisclosure( basis.historyUnread ) ); f.ratchet = { quality::ratchetAttrsXml( basis.extras, [ & ]( std::string_view s ) { return std::string( escapeXml( s, esc ) ); } ), quality::ratchetAttrsJson( basis.extras ) }; + f.shellCut = qdCountField( "shell_cut", basis.extras.shellCut, basis.extras.shellCut != 0 ); return f; } @@ -3345,7 +3354,8 @@ void emitQdXmlDocument( std::FILE* out, const QdReport& rep, const QdStaleFold* basis.headBasis, basis.declinedCallExcluded > 0, basis.valueRefExcluded > 0, fold != nullptr, refs.kinds != quality::kAllKinds, refs.degraded, !refs.memoryStop.empty(), rep.kd.peakOver != 0, rep.kd.memorySkipped != 0 && refs.selected != quality::kAllKinds, basis.historyUnread.any(), - basis.rustTestExcluded, refs.staleTree, !basis.extras.ratchetRef.empty(), !basis.extras.improved.empty() }, out ); + basis.rustTestExcluded, refs.staleTree, !basis.extras.ratchetRef.empty(), !basis.extras.improved.empty(), + basis.extras.shellCut > 0 }, out ); // at= anchors this regression list to the commit (+dirty state) it was computed against (QdRootFields::at). R-I: the range // form's base_ref= and target_ref= carry FULL shas because a wave measurement gets quoted into handoffs where a 9-char // prefix is one collision from unverifiable. From be80b0b46d5a0c3e70d074c7b6ae3b70d3ee166d Mon Sep 17 00:00:00 2001 From: joyful-ii-V-I <210578314+joyful-ii-V-I@users.noreply.github.com> Date: Sat, 21 Nov 2026 12:42:56 -0500 Subject: [PATCH 16/44] refactor(ingest): captureTagsFacts runs one match through named steps The 948-line tags pass (tangle S 29.1, nest 6, 222 deep lines, five steering locals) becomes an orchestrator over a file's TagsPass state and one match's TagsMatch: - readTagsMatch reads a match's captures once (role, name, keyword head) and emits its @import.* facts in capture order, as before. - captureTagsMatch runs the capture-time drop decisions in their order, then the definition or the reference arm. - captureDefinition: definitionSpanOf (the declarator climb is climbDeclaratorToDefinition, its stop set isDeclaratorClimbStop), fillDefinitionExtent / fillDefinitionShape, nameDefinition, scopeDefinition, captureDefinitionEdges. - captureReference: consumeSpecialReference, qualifyElixirReference, qualifyPathReference, readReceiverFacts. - Ruby's file passes are captureRubyFilePasses. Byte-identical: every step runs in the order the loop body ran it. The name facts reuse ingest_names.h DefNameFacts; the complexity fill saturates with saturatedTo (the fnOrMethod gates were redundant: off a callable the Complexity is all zeros). Co-Authored-By: Claude Opus 5.5 --- src/ingest_sidecap.h | 2004 ++++++++++++++++++++++++------------------ 1 file changed, 1150 insertions(+), 854 deletions(-) diff --git a/src/ingest_sidecap.h b/src/ingest_sidecap.h index 4c7573dfc..7473a6980 100644 --- a/src/ingest_sidecap.h +++ b/src/ingest_sidecap.h @@ -1894,6 +1894,1147 @@ inline void applyAnnotationRename( RawDef& d, const AnnotationRename& renamed, T // the best-since store's reading of a history blob (ingest.h tangleInputsOfBlob). enum class TagsCapture : std::uint8_t { Full, DefinitionsOnly, DefinitionsAndShape }; +// ── captureTagsFacts, as named steps (GE-CAPTURETAGS) ──────────────────────────────────────────────────────────────────────── +// One file's pass state (TagsPass), one match's captures read once into a TagsMatch (readTagsMatch), then the capture-time drop +// decisions in order (captureTagsMatch) and the definition or reference arm (captureDefinition / captureReference), each a +// sequence of named steps. Every step runs in the order the single loop body ran it; the outputs are byte-identical. + +// One file's tags pass: the facts every match reads and the sinks it appends to. Built once per file by captureTagsFacts. +struct TagsPass +{ + const LangEntry& le; + std::uint32_t fileId; + std::string_view src; + TSNode root; + std::vector& defs; + std::vector& refs; + std::vector& binds; + std::vector& includes; + ExtractShortfall& shortfall; + ElixirContext& elixir; + std::string_view fileStem; // the name of a bare `module.exports = ` (JS) + bool full; // TagsCapture::Full: references, imports and the def arm's IS-A / HAS-A / macro-body edges too + bool shape; // the callables' cc_walk facts (Full or DefinitionsAndShape) + bool fileHasError; // extent honesty: the recovered-bit walk (parseRecoveredBits) only exists in a file the parser had to recover +}; + +// What one tags match captured. A tags pattern yields one @definition/@reference node plus a child @name: the role capture sets +// kind, the capture's name and roleNode; the @name capture sets the four name facts, and every later re-seat (C++ declarator, +// macro annotation, test-macro title) moves all four at once. +struct TagsMatch +{ + SymKind kind = SymKind::Other; + bool isDef = false; + bool isRef = false; + std::string_view defCap; // the @definition capture's name — dropGatedCapture keys the constant/cjsexport/protomethod gates on it + std::string_view refCap; // the @reference capture's name — "reference.import" routes the using-declaration role (r9 loss bucket 1) + TSNode roleNode {}; + DefNameFacts name {}; // the @name identifier: its node (for C++ scope/qualifier, E#4), text, start byte and 0-based row + bool keywordHead = false; // #355: the pattern carried @_keyword, a head its tags.scm predicates accepted + + bool hasRole() const noexcept { return isDef || isRef; } + bool hasName() const noexcept { return !ts_node_is_null( name.node ); } + void reseatName( TSNode node, std::string_view text ) noexcept + { + name = DefNameFacts{ node, text, ts_node_start_byte( node ), ts_node_start_point( node ).row }; + } +}; + +// A C++ conversion operator's declarator is an `operator_cast` node whose text spans the WHOLE `operator () const` (the +// tags query captures the declarator itself — there is no sub-node spanning just `operator bool`). Its name ends at the end of +// the `type` field, so the symbol name is `operator bool` / `operator MyType`, not the param list. Symbolic ops +// (operator==/[]/()) go through operator_name and are untouched — trimming at `(` there would wrongly cut `operator()`, so +// this is operator_cast-only. Every other @name ends where its node does. +inline std::uint32_t capturedNameEnd( TSNode node ) noexcept +{ + const std::uint32_t end = ts_node_end_byte( node ); + if( !kindIs( ts_node_type( node ), "operator_cast" ) ) + { + return end; + } + const TSNode typeNode = fieldChild( node, NodeField::Type ); + if( ts_node_is_null( typeNode ) ) + { + return end; + } + const std::uint32_t typeEnd = ts_node_end_byte( typeNode ); + return typeEnd > ts_node_start_byte( node ) && typeEnd <= end ? typeEnd : end; +} + +// The @name capture's four facts; a null node when its span falls outside `src` (the match then has no name from this capture). +inline DefNameFacts capturedNameOf( TSNode node, std::string_view src ) noexcept +{ + const std::uint32_t start = ts_node_start_byte( node ); + const std::uint32_t end = capturedNameEnd( node ); + if( end > src.size() || start > end ) + { + return DefNameFacts{}; + } + return DefNameFacts{ node, src.substr( start, end - start ), start, ts_node_start_point( node ).row }; +} + +// #358: an `@import.*` capture, emitted here in capture order, not in a second pass. Matches arrive by start byte and captures +// within a match in query order, so a staging vector would produce the identical order while costing an allocation and a drain +// block. `import.names` / `import.alias` are one clause's target and its optional alias, paired once the match is read. +inline void noteImportCapture( const TagsPass& pass, std::string_view capSv, TSNode node, TSNode& importNames, TSNode& importAlias ) +{ + if( !pass.full ) + { + return; + } + if( capSv == "import.path" ) + { + emitCapturedImport( node, pass.fileId, pass.le.lang, pass.src, pass.includes, pass.refs, pass.shortfall ); + } + else if( capSv == "import.names" ) + { + importNames = node; + } + else if( capSv == "import.alias" ) + { + importAlias = node; + } +} + +// Walk one match's captures into a TagsMatch: the role node and its capture, the name, the keyword head. The match's imports are +// emitted on the way (noteImportCapture), and its import clause's bind (emitCapturedImportBind) after the walk. +inline TagsMatch readTagsMatch( const TagsPass& pass, TSQuery* query, const TSQueryMatch& match ) +{ + TagsMatch m; + TSNode importNames {}; + TSNode importAlias {}; + for( uint16_t ci = 0; ci < match.capture_count; ++ci ) + { + const TSQueryCapture& cap = match.captures[ ci ]; + + uint32_t nameLen = 0; + const char* capName = ts_query_capture_name_for_id( query, cap.index, &nameLen ); + const std::string_view capSv( capName, nameLen ); + if( capSv == "_keyword" ) + { + m.keywordHead = true; // a predicate-only capture: roleOf ignores it, the definition keyword is its pattern's #any-of? + } + + SymKind k = SymKind::Other; + switch( roleOf( capSv, k ) ) + { + case CapRole::Def: + { + m.isDef = true; + m.kind = k; + m.defCap = capSv; + m.roleNode = cap.node; + } + break; + + case CapRole::Ref: + { + m.isRef = true; + m.refCap = capSv; + m.roleNode = cap.node; + } + break; + + case CapRole::NameOnly: + { + if( const DefNameFacts name = capturedNameOf( cap.node, pass.src ); !ts_node_is_null( name.node ) ) + { + m.name = name; + } + } + break; + + case CapRole::Ignore: + break; + + case CapRole::Import: + { + noteImportCapture( pass, capSv, cap.node, importNames, importAlias ); + } + break; + } + } + if( !ts_node_is_null( importNames ) ) + { + emitCapturedImportBind( importNames, importAlias, pass.fileId, pass.le.lang, pass.src, pass.binds ); + } + return m; +} + +// MACRO-P0 (ingest_names.h): a macro invocation read as a typeless declarator mints no definition of its own; the site is a +// call-shaped use of the macro (model.h retagMacroCallReferences makes it role="macro" when the #define is indexed and its name +// is uniquely a macro). No argument count: the "parameters" are macro arguments. MACRO-P1: when the grammar read the real +// function's own `f()` as a variable (ingest_names.h annotationRenamedName), this definition is the only one f gets — it +// carries f's name, from f's own start (`renamed`). false: the capture ends here (a macro use and nothing renamed behind it). +inline bool keepAfterMacroInvocation( const TagsPass& pass, TagsMatch& m, AnnotationRename& renamed ) +{ + if( !cFamilyMacroInvocationCapture( m.defCap, pass.le.lang, m.name.text, m.roleNode, pass.src ) ) // defCap: set by a @definition capture only + { + return true; + } + RawRef r; + r.fileId = pass.fileId; + r.startByte = ts_node_start_byte( m.roleNode ); + r.line = ts_node_start_point( m.roleNode ).row + 1; + r.lang = pass.le.lang; + r.role = RefRole::Call; + r.name = m.name.text; + pass.refs.push_back( std::move( r ) ); + renamed = annotationRenamedName( m.roleNode, pass.src ); + if( ts_node_is_null( renamed.name ) ) + { + return false; + } + m.reseatName( renamed.name, nodeTextOf( renamed.name, pass.src ) ); + m.kind = renamedAnnotationKind( renamed.name ); + return true; +} + +// INDEX-ALIAS-CONST (src/aliasdef.h, the one alias reader): a C++ alias form is a definition unless it is function-local +// (ingest_relations.h insideFunctionBody: a function-local alias is a local name, the local-const rule). std::nullopt: the capture +// is dropped; form None: not an alias definition. +inline std::optional aliasShapeOfCapture( Lang lang, const TagsMatch& m ) +{ + if( !m.isDef || !langFacts( lang ).aliasTargetDefs || m.defCap != "definition.alias" ) + { + return AliasShape{}; + } + if( insideFunctionBody( m.roleNode ) ) + { + return std::nullopt; + } + return aliasShapeOf( Lang::Cpp, m.roleNode ); +} + +// INDEX-ALIAS-CONST: where an alias's written target starts when it ENDS the declaration (--defs to=), else 0 (a typedef). The +// target is a suffix when every child after it is the `;` or a comment (`using X = Y /* c */ ;` keeps its target; the printer +// drops the comment, defslookup.h aliasTargetText); one cursor walk (infra/tschildren.h). Only `using`/namespace alias rows +// reach here (a typedef capture is never definition.alias). +inline std::uint32_t aliasTargetStartOf( TSNode roleNode, const AliasShape& aliasShape ) +{ + const std::uint32_t tEnd = ts_node_end_byte( aliasShape.target ); + bool suffix = true; + ChildCursor cursor( roleNode ); + forEachChild( roleNode, cursor.cur, [ & ]( TSNode c ) + { + const char* k = ts_node_type( c ); + suffix = ts_node_start_byte( c ) < tEnd || kindIs( k, ";" ) || kindIs( k, "comment" ); + return suffix; + } ); + return suffix ? ts_node_start_byte( aliasShape.target ) : 0u; +} + +// Elixir's capture filters a tags pattern cannot state: elixirKeepCapture's syntax filters; a bare name is a call only off a pipe +// (bare pipe targets have their own capture) and past lexical variable exclusion; the special-form operators are no calls. +inline bool keepElixirCapture( const TagsPass& pass, const TagsMatch& m ) +{ + if( !elixirKeepCapture( m.roleNode, m.name.node, ElixirCaptureRole{ m.isDef, m.kind, m.keywordHead }, pass.src, pass.elixir.keywords ) ) + { + return false; + } + if( m.refCap == "reference.bare" ) + { + const TSNode parent = parentOf( m.name.node ); + const bool pipeTarget = elixirNodeIs( parent, "binary_operator" ) && nodeFieldText( parent, NodeField::Operator, pass.src ) == "|>" + && ts_node_eq( fieldChild( parent, NodeField::Right ), m.name.node ); + return !pipeTarget && pass.elixir.bareCall( m.name.node ); + } + if( m.refCap == "reference.operator" ) + { + constexpr std::string_view special[] = { "=", "<-", "\\\\", "::", "|>", "when", "|", "^", "&", "@" }; + if( std::find( std::begin( special ), std::end( special ), m.name.text ) != std::end( special ) ) + { + return false; + } + const TSNode parent = parentOf( m.roleNode ); + return !( m.name.text == "/" && elixirNodeIs( parent, "unary_operator" ) && nodeFieldText( parent, NodeField::Operator, pass.src ) == "&" ); + } + return true; +} + +// The per-language capture filters (Elixir's, Clojure's); a Clojure definition's kind is its head's shape. +inline bool keepLanguageCapture( const TagsPass& pass, TagsMatch& m ) +{ + if( pass.le.lang == Lang::Elixir ) + { + return keepElixirCapture( pass, m ); + } + if( pass.le.lang != Lang::Clojure ) + { + return true; + } + if( !clojureKeepCapture( m.roleNode, m.isDef, pass.src ) ) + { + return false; + } + if( m.isDef ) + { + m.kind = clojureDefinitionShape( m.roleNode, pass.src ).kind; + } + return true; +} + +// A capture inside an inert quote region: call/operator/named-capture candidates are kept as declined facts, never edges. Heads, +// special forms and non-call operators already failed their syntax filters. Bare AST names remain variable-shaped syntax unless +// they explicitly name a function capture. true: the capture was in such a region (consumed here). +inline bool consumeInertQuoteCapture( const TagsPass& pass, const TagsMatch& m ) +{ + if( !langFacts( pass.le.lang ).hasInertQuoteRegions || !elixirInert( m.roleNode, pass.src ) ) + { + return false; + } + const bool candidate = m.isRef && ( m.refCap == "reference.call" || m.refCap == "reference.operator" + || ( m.refCap == "reference.bare" && pass.elixir.namedCapture( m.name.node ) ) ); + if( !candidate ) + { + return true; + } + RawRef r; + r.fileId = pass.fileId; + r.startByte = ts_node_start_byte( m.roleNode ); + r.line = m.name.row + 1; + r.lang = Lang::Elixir; + r.role = RefRole::Inert; + auto [ count, known ] = elixirCallArity( m.roleNode, m.name.node, pass.src ); + if( m.refCap == "reference.operator" ) { count = elixirNodeIs( m.roleNode, "binary_operator" ) ? 2 : 1; known = true; } + r.name = known ? elixirFunctionName( m.name.text, count ) : std::string( m.name.text ); + pass.refs.push_back( std::move( r ) ); + return true; +} + +// Where a definition's code lives: the node its span covers, its body (null: a declaration), the function literal a name is bound +// to (kFnLiteralBinding: params/cx/nest read from it), and whether the body is a SIBLING the span runs through. +struct DefCodeNodes +{ + TSNode defNode {}; + TSNode body {}; + TSNode literal {}; + bool testMacroBlock = false; // LB-E: the def is TWO SIBLING nodes (testMacroBlockPartsOf) + bool spanThroughBody = false; // the code this symbol owns lives in a SIBLING node: byte/row extents and complexity run through it +}; + +// LB-E testmacroblock: adopt the sibling compound_statement as the body and the title literal as the name BEFORE the shared +// span/complexity steps. The span's endByte and the loc row window run past defNode's own end (no single node covers both +// siblings). false: not a test macro block after all (dropGatedCapture already vetoed non-candidates — guard, don't assert). +inline bool adoptTestMacroBlock( const TagsPass& pass, TagsMatch& m, DefCodeNodes& span ) +{ + const TestMacroBlockParts parts = testMacroBlockPartsOf( m.roleNode, pass.src ); + if( !parts.ok ) + { + return false; + } + span.body = parts.body; + m.reseatName( parts.title, testMacroTitleOf( parts.title, pass.src ) ); + return true; +} + +// The declarator climb's STOP set: a type/namespace/file scope — a function's body never lives above one of these, so reaching +// one means the role node is a prototype/declaration with no body (without this, an in-class method declaration would climb into +// class_specifier and wrongly grab the whole CLASS body as its span — corrupting spans + ref attribution) — and a C-family +// function BODY: a block-scope `Type v(args);` (most-vexing-parse) must not climb up and steal its enclosing function's span. A +// real function definition's declarator parents directly to function_definition (found at hop 1), so that never fires for it. +inline bool isDeclaratorClimbStop( const char* pt ) noexcept +{ + return kindIs( pt, "class_specifier" ) || kindIs( pt, "struct_specifier" ) + || kindIs( pt, "field_declaration_list" ) || kindIs( pt, "declaration_list" ) + || kindIs( pt, "namespace_definition" ) || kindIs( pt, "enum_specifier" ) + || kindIs( pt, "translation_unit" ) || kindIs( pt, "source_file" ) // Swift top + || kindIs( pt, "class_body" ) || kindIs( pt, "protocol_body" ) // Swift type bodies + || kindIs( pt, "enum_class_body" ) + || kindIs( pt, "class_interface" ) || kindIs( pt, "class_implementation" ) // ObjC + || kindIs( pt, "implementation_definition" ) || kindIs( pt, "protocol_declaration" ) + || kindIs( pt, "compound_statement" ) || kindIs( pt, "block" ); +} + +// What the declarator climb found: the span to adopt (null: keep the capture's own), the body it owns, and whether the role node +// is a body-less C/C++ type specifier in a function's signature (a type use, never a definition). +struct DeclaratorClimb +{ + TSNode span {}; + TSNode body {}; + bool typeUseInSignature = false; +}; + +// At a scope stop: the member/decl wrapper the climb came up through (a prototype's span, so the RETURN TYPE is included), else null. +inline TSNode declarationWrapperOrNull( TSNode child ) noexcept +{ + const char* ct = ts_node_type( child ); + return kindIs( ct, "field_declaration" ) || kindIs( ct, "declaration" ) ? child : TSNode{}; +} + +// At the first ancestor owning a body: adopt it when the role node is its signature (outside the body) and not a body-less type +// specifier; a body-less type specifier outside the body is a type use in the signature. +inline DeclaratorClimb bodyOwnerClimb( TSNode owner, TSNode ownerBody, TSNode roleNode, bool bodylessTypeSpec ) +{ + const bool outsideBody = !spanContains( ownerBody, roleNode ); + if( outsideBody && !bodylessTypeSpec ) + { + return DeclaratorClimb{ .span = owner, .body = ownerBody }; + } + return DeclaratorClimb{ .typeUseInSignature = outsideBody && bodylessTypeSpec }; +} + +// The C++ tags query captures @definition on the function_declarator (name+params) — its span excludes the return type AND the +// body. Walk up to the nearest ancestor owning a "body" field (the real function_definition) so [startByte,endByte) spans the +// WHOLE def: return type + signature + body. Fixes --expand bodies, --pack-signatures return-types, AND reference +// enclosing-attribution (a call in a body is now inside its function span). At a scope stop, a prototype/declaration takes its +// member/decl wrapper as the span so the RETURN TYPE is included (not just the declarator), WITHOUT grabbing the class body. +// +// An ancestor's span is adopted only if the role node sits OUTSIDE its body — i.e. it is the ancestor's own signature/declarator +// (the C++ function_declarator → function_definition hop this climb exists for). A def spelled INSIDE the body is a different, +// NESTED definition — a JS/TS named const-closure (`const f = (..) => {..}` in a function body) — and adopting here broadcast the +// encloser's whole span (loc/cx/params/nest) onto every such closure (webpack lib/html/syntax.js: eight closures inside the +// 3439-line `tokenize` all reported loc=3439 cx=487). The enclosing statement_block is not in the scope-stop list (only C-family +// compound_statement/block are), so nested defs escaped upward; containment is the grammar-agnostic stop. Gate: +// test/jsnestedcheck.sh. +// +// A BODY-LESS C/C++ type specifier — `enum cmd_retval` as a return type (`static enum cmd_retval⏎fn(…)`, tmux's style) or a +// parameter type — is captured by the tags query's bare enum/class pattern, and the climb ADOPTED the enclosing +// function_definition, whose body it sits outside of: the specifier took the WHOLE function's span, so --at chained +// `struct cmd_retval` around the function, --grep labelled its hits in="cmd_retval" and its calls were attributed to a `struct +// box_lines` caller (comparison table tmux-07/15, test/ccheck.sh). The adoption is for a function DECLARATOR. A type specifier +// whose climb reaches a body owner it sits outside of is a type USE in that function's signature, not a definition, so it mints +// NO def: keeping it as a small def of its own put a span in the return-type position wholly before the name — extentsuspect.h +// R3's derailed-parse signature — and flagged clean functions extent_suspect="head" (review of this lane, ccheck arm (f)). The +// declaration-wrapper rule at a scope stop is unchanged (`enum E : int;`, a prototype). +inline DeclaratorClimb climbDeclaratorToDefinition( TSNode roleNode, bool bodylessTypeSpec ) +{ + TSNode child = roleNode; + TSNode p = parentOf( roleNode ); + for( int guard = 0; !ts_node_is_null( p ) && guard < 4; ++guard ) + { + if( isDeclaratorClimbStop( ts_node_type( p ) ) ) + { + return DeclaratorClimb{ .span = declarationWrapperOrNull( child ) }; + } + if( const TSNode pb = fieldChild( p, NodeField::Body ); !ts_node_is_null( pb ) ) + { + return bodyOwnerClimb( p, pb, roleNode, bodylessTypeSpec ); + } + child = p; + p = parentOf( p ); + } + return DeclaratorClimb{}; +} + +// ObjC/Kotlin body-field fallback for the grammars that expose a body as an unnamed CHILD, not a named "body" field. C++ +// function_definition owns a "body" field (found by the climb); the ObjC grammar never does, so the field lookup returns null and +// bodyByte would stay 0 for a real definition — making an @implementation def indistinguishable from its @interface DECL (both +// bodyByte==0). That breaks BOTH the same-file decl/def collapse (3a-bis) and graph.h's cross-file hasBody +// (endByte > sigEndByte), doubling every ObjC symbol node AND its call edges. Recover the body-present signal from a direct child: +// - a METHOD def: a bare `compound_statement` / `function_body` / `block` child (the `{...}`). +// - an ObjC CLASS: an @implementation carries `implementation_definition` member children; the +// matching @interface carries only `method_declaration`s → so an `implementation_definition` +// child is exactly "this is the class's definition, not its forward @interface". +// - Kotlin: `function_body` / `class_body` / `enum_class_body` are positional children too +// (function_declaration's only named field is `receiver`), and the cost of missing them is +// the same collapse bug in the other direction — a Kotlin definition read as bodyless is +// deleted from the candidate pool as a forward declaration whenever a same-named Java +// definition exists (test/kotlincheck.sh §5). `enum_class_body` (`enum class Status { … }`) +// was the one omission a second-opinion review caught: `class_declaration`'s enum-class form +// nests its members under that node, not `class_body` — verified via a raw parse of +// `enum class Status { READY, DONE }` → `(class_declaration (type_identifier) +// (enum_class_body (enum_entry …) (enum_entry …)))`. +// A bodyLESS declaration (@interface method / @interface class) has none of these children → bodyByte stays 0 → it stays a decl +// (a bodyless KOTLIN TYPE does too, and is still a definition: model.h isDefinitionNotDeclaration). GATED to ObjC and Kotlin so +// C++/Python/Rust/Go/TS/Swift bodyByte — and therefore their sigEndByte, spans, and node/edge output — are BYTE-for-byte unchanged +// (a .mm's C++ functions take the C "body"-field path and never reach here). See test/langcheck.sh c.m and the byte-identical +// src/ regression gate. O(children): `- (void) m /*…*/ { }` puts the comments in the method_definition, before its body — 24x at +// 16 000 (test/childwalkscalecheck.sh, arm B35). +// +// Proto (PROTO-INDEX): the grammar names no `body:` field. A message's or enum's body is its *_body child; a service's, an rpc's +// option block's and a oneof's body starts at its `{` token (an rpc ending in `;` has none). +inline TSNode positionalBodyOf( Lang lang, TSNode defNode ) +{ + TSNode body {}; + if( lang == Lang::ObjC || lang == Lang::Kotlin ) + { + body = firstChildOfKind( defNode, /*namedOnly=*/false, + { "compound_statement", "function_body", "block", "implementation_definition", "class_body", "enum_class_body" } ); + } + if( ts_node_is_null( body ) && langFacts( lang ).generatedSchema ) + { + body = firstChildOfKind( defNode, /*namedOnly=*/false, { "message_body", "enum_body", "{" } ); + } + return body; +} + +// A definition's span and body. defBodyNodeOf = the `body:` field, PLUS the macro-edges round's one addition: a #define's +// replacement text (`value:` field) is adopted as a macro symbol's body, set before the climb so the climb is skipped for macros +// — PLUS a name bound to a function literal (kFnLiteralBinding): the literal's body, with `literal` the node params/cx/nest read +// from. Grammars whose @definition node already owns the body (class/struct/enum) don't climb. +// +// A Var's span is its own declaration — never climb. The climb exists to find a FUNCTION's body; for a var it can only steal a +// container's span (a Ruby class-level constant's parent chain is body_statement → class, and class owns a "body" field, so the +// climb would hand the constant THE WHOLE CLASS — the exact Rust-method span bug the H4 W3 note describes). No-op for every +// pre-existing Var capture (Swift/C#/Go/Python parents hit a scope-stop or the file root before any "body"-owning ancestor — +// verified byte-identical on the gate corpora). A Field's span is its own field_declaration / defining assignment — the Var rule, +// same reason. std::nullopt: the capture mints no definition (a test macro block without its parts, a type use in a signature). +inline std::optional definitionSpanOf( const TagsPass& pass, TagsMatch& m ) +{ + const Lang lang = pass.le.lang; + const DefBodyNodes own = lang == Lang::Elixir ? DefBodyNodes{ elixirBody( m.roleNode, pass.src ), {}, m.roleNode } + : defBodyNodeOf( m.roleNode, m.name.node, m.kind, lang ); + DefCodeNodes span; + span.defNode = own.span; + span.body = own.body; + span.literal = own.literal; + span.testMacroBlock = m.defCap == "definition.testmacroblock"; + if( span.testMacroBlock && !adoptTestMacroBlock( pass, m, span ) ) + { + return std::nullopt; + } + if( ts_node_is_null( span.body ) && m.kind != SymKind::Var && m.kind != SymKind::Field && lang != Lang::Elixir ) + { + const DeclaratorClimb climb = climbDeclaratorToDefinition( m.roleNode, isCFamilyTypeSpecifier( lang, m.roleNode ) ); + if( climb.typeUseInSignature ) + { + return std::nullopt; // a body-less C/C++ specifier in a function's signature: a type use, never a definition + } + span.defNode = ts_node_is_null( climb.span ) ? span.defNode : climb.span; + span.body = climb.body; + } + + // MACRO-P1: a prototype adopts its trailing annotation's definition body, its span running THROUGH that sibling + const TSNode ownBody = span.body; + span.body = annotatedSiblingBody( span.body, lang, m.kind, m.roleNode, pass.src ); + bool siblingBody = !ts_node_eq( span.body, ownBody ); + if( ts_node_is_null( span.body ) ) + { + span.body = positionalBodyOf( lang, span.defNode ); + } + // Dart's body is a SIBLING of the signature, so neither defBodyNodeOf nor the climb can find it and the span would stop at the + // signature — see dartFollowingBody (ingest_relations.h) for the measurement and for why an abstract member still comes back null. + if( ts_node_is_null( span.body ) && lang == Lang::Dart ) + { + span.body = dartFollowingBody( span.defNode ); + siblingBody = !ts_node_is_null( span.body ); + } + span.spanThroughBody = span.testMacroBlock || siblingBody; + return span; +} + +// The byte extents: the span (LB-E: through the sibling block), the name, the body. INDEX-ALIAS-CONST: a body-less alias row's +// target start rides bodyByte to the model, which moves it to IngestResult::aliasTargets and keeps the whole declaration as the +// signature (ingest_model.h rawDefIsAliasRow); 0 when the target is not a suffix. +inline void fillDefinitionExtent( RawDef& d, const DefCodeNodes& span, std::uint32_t nameByte, std::uint32_t aliasTargetStart ) noexcept +{ + d.startByte = ts_node_start_byte( span.defNode ); + d.endByte = span.spanThroughBody ? ts_node_end_byte( span.body ) : ts_node_end_byte( span.defNode ); + d.nameByte = nameByte; + d.bodyByte = ts_node_is_null( span.body ) ? 0u : ts_node_start_byte( span.body ); + if( d.bodyByte == 0 && aliasTargetStart > d.startByte && aliasTargetStart < d.endByte ) + { + d.bodyByte = aliasTargetStart; // INDEX-ALIAS-CONST: the transport only (ingest_model.h rawDefIsAliasRow) + } +} + +// A callable's cc_walk facts (complexityOf) onto its definition: all 0 off a callable, where complexityOf did not run. The narrower +// fields saturate on purpose — ppalt (model.h Symbol::ppAlt): a def past 65535 is beyond every triage threshold, and the attribute's +// claim ("the body carries alternatives") is already made at 1; the nesting profile (model.h Symbol::humps/deepLoc): deepLoc is a +// floor already, so a clamp there stays honest in the direction the attribute already claims; essential complexity (model.h +// Symbol::ev) is already saturated inside ev_finalize, 0 for non-function kinds and outside evCountedLang, matching the emitters' +// omission rule; QD-TANGLE's steering locals and dispatch share (model.h Symbol::steer, ::dispatchShare). +inline void fillDefinitionComplexity( RawDef& d, const Complexity& c ) noexcept +{ + d.cx = c.cx; + d.ccx = c.ccx; + d.locals = c.locals; // Phase 1: floor count, C/C++ only (model.h localsCountedLang) — 0 elsewhere, never emitted there + d.ppAlt = saturatedTo( c.ppAlt ); + d.maxNest = saturatedTo( c.maxNest ); + d.steer = saturatedTo( c.steer ); + d.deepDispatch = saturatedTo( c.deepDispatch ); + d.nestArmCut = saturatedTo( c.nestArmCut ); + d.humps = saturatedTo( c.humps ); + d.deepLoc = saturatedTo( c.deepLoc ); + d.ev = saturatedTo( c.ev ); + d.evWhy = c.evWhy; +} + +// A callable's parameter count: Elixir's and Clojure's heads have their own readers; every other language counts the list. +inline std::uint16_t definitionParamCount( Lang lang, TSNode defNode, TSNode metricNode, bool literalBound, std::string_view src ) +{ + if( lang == Lang::Elixir ) + { + return elixirParams( defNode, src ); + } + return lang == Lang::Clojure ? clojureParams( defNode, src ) : paramCountOf( metricNode, literalBound ); +} + +// The definition's shape: complexity (LB-E: a testmacroblock's body SIBLING is where the code lives — complexityOf walks INSIDE its +// root node, so handing it defNode, the bare macro statement, would count nothing; a literal-bound name measures its LITERAL; every +// other def measures defNode), Q4 size smells (SIZE = master variable: physical LOC = span line count; param count + max nesting +// for functions/methods only, 0 otherwise, absent in emit — all descriptive), the parameter shape, the in-file test-scope bit. +inline void fillDefinitionShape( const TagsPass& pass, RawDef& d, const TagsMatch& m, const DefCodeNodes& span, const AnnotationRename& renamed ) +{ + const Lang lang = pass.le.lang; + const bool fnOrMethod = ( m.kind == SymKind::Function || m.kind == SymKind::Method ); + const bool literalBound = !ts_node_is_null( span.literal ); + const TSNode metricNode = literalBound ? span.literal : span.defNode; + fillDefinitionComplexity( d, + fnOrMethod && pass.shape ? complexityOf( span.spanThroughBody ? span.body : metricNode, pass.src, lang ) + : Complexity{ 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, {}, 0u, 0u, 0u } ); + const std::uint32_t startRow = ts_node_start_point( span.defNode ).row; + const std::uint32_t endRow = ts_node_end_point( span.spanThroughBody ? span.body : span.defNode ).row; // LB-E: rows through the sibling block + d.loc = ( endRow >= startRow ) ? ( endRow - startRow + 1u ) : 1u; + d.params = fnOrMethod ? definitionParamCount( lang, span.defNode, metricNode, literalBound, pass.src ) : std::uint16_t( 0 ); + // LB-E: a testmacroblock's parameter surface is the MACRO's business, not visible here — claim inexact so the resolver's arity + // narrowing never trusts params=0 on a test-title symbol. B2.2: the fixed-arity bit and the minimum (fewest arguments a call can + // pass) come from ONE scan of the list. A minimum above the counted params (a literal-bound bare parameter countParams cannot + // see) is not trusted. + const ParamShape paramShape = ( fnOrMethod && !span.testMacroBlock && lang != Lang::Clojure ) ? cc_paramShape( metricNode, lang, m.kind, pass.src ) : ParamShape{}; + d.arityExact = paramShape.exact ? std::uint8_t( 1 ) : std::uint8_t( 0 ); + d.paramsMin = paramShape.minimum <= d.params ? paramShape.minimum : std::uint16_t( 0 ); + applyAnnotationRename( d, renamed, span.defNode ); // MACRO-P1: the real function's parameters and start, not the annotation's + // L8: the in-file test-scope bit, for EVERY kind (a `#[cfg(test)] mod` and a `class TestFoo` are themselves symbols, and dropping + // the members while keeping the shell would be a worse answer than either). Runs on defNode, whose ancestors are the enclosing scopes. + d.testScope = span.testMacroBlock ? std::uint8_t( 1 ) : std::uint8_t( inFileTestScope( span.defNode, pass.src, lang ) ); // LB-E: a test macro IS the in-file convention + d.kind = m.kind; + d.lang = lang; +} + +// An Elixir module attribute's definition name: a typed attribute (@type/@callback and kin) is named with its arity, any other +// attribute is `@name`. +inline std::string elixirAttributeDefName( std::string_view attribute, const TagsMatch& m ) +{ + if( !elixirTypedAttribute( attribute ) ) + { + return "@" + std::string( m.name.text ); + } + const TSNode args = elixirArguments( parentOf( m.name.node ) ); + std::uint32_t arity = 0; + for( std::uint32_t i = 0; !ts_node_is_null( args ) && i < ts_node_named_child_count( args ); ++i ) + { + arity += elixirNodeIs( ts_node_named_child( args, i ), "comment" ) ? 0u : 1u; + } + return ( attribute == "callback" || attribute == "macrocallback" ? "@callback " : "@type " ) + elixirFunctionName( m.name.text, arity ); +} + +// `defimpl P, for: T` — the @name capture is just the protocol alias, but the module Elixir generates is `P.T`, which is what the +// impl's own defs carry as their scope. A protocol is an Interface, a module that defines a struct (or exception) a Struct. +inline SymKind elixirModuleKind( const TagsPass& pass, TSNode roleNode, const std::string& module ) +{ + const SymKind kind = elixirTarget( roleNode, pass.src ) == "defprotocol" ? SymKind::Interface : SymKind::Class; + for( TSNode call : pass.elixir.calls ) + { + const auto keyword = elixirTarget( call, pass.src ); + if( ( keyword == "defstruct" || keyword == "defexception" ) && pass.elixir.scopeOf( call ) == module ) + { + return SymKind::Struct; + } + } + return kind; +} + +// Elixir's definition names: a static ExUnit title (interpolation was rejected by elixirKeepCapture), a module attribute, a +// generated module. false: a module with no name to give it. +inline bool nameElixirDefinition( const TagsPass& pass, RawDef& d, const TagsMatch& m ) +{ + if( elixirTarget( m.roleNode, pass.src ) == "test" ) + { + d.name = "test " + std::string( m.name.text.substr( 1, m.name.text.size() - 2 ) ); + d.testScope = 1; + return true; + } + if( const std::string_view attribute = elixirAttribute( m.roleNode, pass.src ); !attribute.empty() ) + { + d.name = elixirAttributeDefName( attribute, m ); + return true; + } + if( m.kind != SymKind::Other ) + { + return true; + } + d.name = pass.elixir.moduleName( m.roleNode ); + if( d.name.empty() ) + { + return false; + } + d.kind = elixirModuleKind( pass, m.roleNode, d.name ); + return true; +} + +// The definition's name: the capture's (LB-E: a test title is a display string — see testMacroTitleOf), the file's stem for the +// module's own CommonJS export function (lane js-def-naming, ingest_names.h isCjsModuleExportsItself), Elixir's own. false: the +// capture mints no row (no stem to name an anonymous export by, as before; an unnamed Elixir module). +inline bool nameDefinition( const TagsPass& pass, RawDef& d, const TagsMatch& m, bool testMacroBlock ) +{ + d.name = testMacroBlock ? std::string( m.name.text ) : defNameFromCapture( pass.le.lang, m.name.text ); + if( m.defCap == "definition.cjsexport" && isCjsModuleExportsItself( m.name.node, pass.src ) ) + { + if( pass.fileStem.empty() ) + { + return false; + } + d.name = std::string( pass.fileStem ); + } + return pass.le.lang != Lang::Elixir || nameElixirDefinition( pass, d, m ); +} + +// A FUNCTION bound inside another function's body records that function's span (ingest_names.h enclosingFunctionScope): graph.h +// reachableByName ranks it below every def a call outside it can name. Descend to the OUTER of the two def nodes: a C-family def's +// defNode climbed from its declarator (the role node) to the function_definition, which must not read as the function enclosing +// itself; a multi-name binding's defNode narrowed to one declarator, whose declaration (the role node) holds no scope node and is +// not a 20k-child list to rescan per name. +inline void noteEnclosingFunctionScope( const TagsPass& pass, RawDef& d, const TagsMatch& m, TSNode defNode ) +{ + if( !pass.full || m.kind != SymKind::Function || bindsOutsideItsFunction( m.roleNode, pass.le.lang ) ) + { + return; + } + const bool defIsOuter = ts_node_start_byte( defNode ) <= ts_node_start_byte( m.roleNode ) && ts_node_end_byte( defNode ) >= ts_node_end_byte( m.roleNode ); + const FnScope fnScope = enclosingFunctionScope( pass.root, defIsOuter ? defNode : m.roleNode ); + d.fnScopeStart = fnScope.start; + d.fnScopeEnd = fnScope.end; +} + +// `defdelegate f(x), to: M, as: g`: the delegating clause calls M.g with its own arity. +inline void emitElixirDelegate( const TagsPass& pass, const RawDef& d, const TagsMatch& m ) +{ + RawRef delegated; + delegated.fileId = pass.fileId; delegated.startByte = d.startByte; delegated.line = d.line; + delegated.lang = pass.le.lang; delegated.recv = RecvKind::ElixirModule; + delegated.qualifier = pass.elixir.moduleOf( elixirKeywordValue( m.roleNode, "to:", pass.src ), m.roleNode ); + const auto as = nodeTextOf( elixirKeywordValue( m.roleNode, "as:", pass.src ), pass.src ); + delegated.name = elixirFunctionName( as.starts_with( ":" ) ? as.substr( 1 ) : m.name.text, d.params ); + delegated.argCount = d.params; delegated.argCountKnown = true; + if( !delegated.qualifier.empty() ) { pass.refs.push_back( std::move( delegated ) ); } +} + +// An Elixir definition's scope, and for a def head (#355: the match's own @_keyword capture, decided by tags.scm, not a C++ keyword +// list) its arity-qualified name. B2.2 for Elixir: a clause's arity IS its parameter count (no variadic form), so `params` is +// call-comparable unless a `\\` default widens the callable to more than one arity. cc_paramShape's language gate leaves this at 0, +// which made every Elixir caller unflaggable by --edit-check (test/elixirnamearitycheck.sh arm C: run(x) -> run(x, y) must flag +// run(x) callers; run(x, y \\ 1) must flag none). +inline void scopeElixirDefinition( const TagsPass& pass, RawDef& d, const TagsMatch& m ) +{ + d.scope = m.kind == SymKind::Other ? std::string{} : pass.elixir.scopeOf( m.roleNode ); + if( !m.keywordHead ) + { + return; + } + d.name = elixirFunctionName( m.name.text, d.params ); + d.arityExact = elixirHeadDefaultCount( m.roleNode, pass.src ) == 0 ? std::uint8_t( 1 ) : std::uint8_t( 0 ); + elixirDefinitionFacts( d, m.roleNode, pass.src, pass.binds, pass.elixir.keywords ); + if( elixirTarget( m.roleNode, pass.src ) == "defdelegate" ) + { + emitElixirDelegate( pass, d, m ); + } +} + +// A C++ definition's canonical scope (E#4): out-of-line `A::b` → "A", else the enclosing class/namespace. +inline void scopeCppDefinition( RawDef& d, TSNode nameNode, std::string_view src ) +{ + d.scope = qualifierOfDefinition( nameNode, src ); // `Box::grow` (primary) → "Box"; a specialization keeps its id + if( d.scope.empty() ) + { + d.scope = enclosingScopeOf( nameNode, src ); + } + // #150: is this def genuinely INSIDE namespace std, at ANY nesting depth — not just a def + // whose immediate scope happens to spell a segment std also uses? See Symbol::scopeRootsStd. + d.scopeRootsStd = cppDefinitionRootsStd( nameNode, src ) ? std::uint8_t( 1 ) : std::uint8_t( 0 ); +} + +// The definition's scope, per language. +inline void scopeDefinition( const TagsPass& pass, RawDef& d, const TagsMatch& m, TSNode defNode ) +{ + const Lang lang = pass.le.lang; + if( lang == Lang::Cpp ) + { + scopeCppDefinition( d, m.name.node, pass.src ); + } + else if( enumTableAt( kDefScopeWalkerOfLang, lang, DefScopeWalker::None ) != DefScopeWalker::None ) + { // Python, Go, Rust, Kotlin: the language's row in ingest_names.h kDefScopeWalkerOfLang + d.scope = defScopeOf( lang, m.name.node, pass.src ); + } + else if( lang == Lang::Elixir ) + { + scopeElixirDefinition( pass, d, m ); + } + else if( lang == Lang::Ruby ) + { // enclosing class/module → id= addressability, per-class overload sets, editCheckImplicitReceiver + d.scope = rubyEnclosingScopeOf( m.name.node, pass.src ); // (test/rubyscopecheck.sh) + if( m.kind == SymKind::Method || m.kind == SymKind::Function ) + { + rubyNoteClassSideDef( defNode, pass.fileId, d.name, pass.src, pass.binds ); // a class object's method (test/rubyclassrecvcheck.sh) + } + } + else if( ( lang == Lang::JavaScript || lang == Lang::TypeScript ) && m.defCap == "definition.protomethod" ) + { // only the five built-in ctors: every Foo.prototype.bar gaining sc= would mint a new + // canonical id and move quality baselines (node lib/ has ~163 anonymous protomethods) + const std::string_view ctor = prototypeCtorName( m.name.node, pass.src ); + if( isJsTsBuiltinCtor( ctor ) ) + { + d.scope = std::string( ctor ); + } + } +} + +// The reference edges a definition mints (TagsCapture::Full only): a type's IS-A and HAS-A edges, a macro's body calls. +inline void captureDefinitionEdges( const TagsPass& pass, const TagsMatch& m, TSNode defNode ) +{ + const Lang lang = pass.le.lang; + if( m.kind == SymKind::Class || isStructOrNamedType( m.kind ) || m.kind == SymKind::Interface ) + { + // #446: a language on the bases-as-captures port reads its bases through the + // @reference.base reader (LangFacts::basesAsCaptures; C++ is the first). The + // others keep the walk; C++'s own walk survives for captureSpecializationHeader. + if( !langFacts( lang ).basesAsCaptures ) + { + captureBases( defNode, pass.fileId, lang, pass.src, pass.refs ); // IS-A: inheritance edges (derived → base) + } + if( m.defCap == "definition.classfactory" ) // lane lego-transitive (M2): the factory's receiver is the base + { + emitBaseRef( jsClassFactoryReceiver( m.name.node, pass.src ), pass.fileId, lang, pass.src, pass.refs, defNode ); + } + captureFields( defNode, pass.fileId, lang, pass.src, pass.refs ); // HAS-A: member-variable type edges (S5-E) + } + else if( m.kind == SymKind::Macro ) + { + captureMacroBodyCalls( m.roleNode, pass.fileId, lang, pass.src, pass.refs ); // macro-edges: the graph connects THROUGH the macro + if( langFacts( lang ).bangMacros ) // Rust: `$crate` exists only where `name!` macros do + { + captureRustTranscriberMacroCalls( m.roleNode, pass.fileId, pass.src, pass.refs ); // RUST-MACRO-PATH: `$crate::m!` in a transcriber + } + } +} + +// The definition arm: span, extents, shape, name, linkage, function scope, scope and parse-recovery bits into one RawDef, then +// (Full) the edges it mints. `renamed`: MACRO-P1's annotation rename; `aliasTargetStart`: INDEX-ALIAS-CONST's written target. +void captureDefinition( const TagsPass& pass, TagsMatch& m, const AnnotationRename& renamed, std::uint32_t aliasTargetStart ) +{ + if( pass.le.lang == Lang::Elixir && m.defCap == "definition.attribute" ) { m.kind = SymKind::Var; } + const std::optional span = definitionSpanOf( pass, m ); + if( !span ) + { + return; + } + RawDef d; + d.fileId = pass.fileId; + d.line = m.name.row + 1; // the identifier's line — most accurate, dedup-stable (a test macro block's: its title's, re-seated above) + fillDefinitionExtent( d, *span, m.name.byte, aliasTargetStart ); + fillDefinitionShape( pass, d, m, *span, renamed ); + if( !nameDefinition( pass, d, m, span->testMacroBlock ) ) + { + return; + } + // Internal linkage (model.h Symbol::internalLinkage): C and C++ only, read off defNode — the node that owns + // the storage class and whose ancestors are the enclosing namespaces (ingest_names.h::cppInternalLinkage). + d.internalLinkage = internalLinkageBit( pass.le.lang, span->defNode, pass.src ); + noteEnclosingFunctionScope( pass, d, m, span->defNode ); + scopeDefinition( pass, d, m, span->defNode ); + // extent honesty: did the parse RECOVER this def's container or kind? Only asked in a file whose root + // holds an error (fileHasError, one O(1) flag test per file) — see parseRecoveredBits. + d.recovered = pass.fileHasError ? parseRecoveredBits( span->defNode, m.kind, pass.le.lang, d.scope.empty() ) : std::uint8_t( 0 ); + pass.defs.push_back( std::move( d ) ); + if( pass.full ) // TagsCapture::DefinitionsOnly: the reference edges feed no definition + { + captureDefinitionEdges( pass, m, span->defNode ); + } +} + +// The reference captures that are not a plain use-site. true: consumed here — emitted as their own fact, or dropped. +inline bool consumeSpecialReference( const TagsPass& pass, const TagsMatch& m ) +{ + const Lang lang = pass.le.lang; + // An element access: @name is its RECEIVER, and the site names the receiver class's subscript operator + // method (ingest_binds.h subscriptOperatorRef) — never a call by itself (RefRole::Subscript). + if( m.refCap == "reference.subscript" ) + { + if( std::optional sub = subscriptOperatorRef( m.roleNode, m.name.node, pass.fileId, lang, pass.src ) ) + { + pass.refs.push_back( std::move( *sub ) ); + } + return true; + } + // H4: a C++ cast keyword is not a call — see isCppCastKeyword. Valid input, skipped, no alert. + if( lang == Lang::Cpp && isCppCastKeyword( m.name.text ) ) + { + return true; + } + // #285: an intrinsic JSX tag (`
`, `

`) is not a call — see isJsxIntrinsicTagIdentifier. + // Valid input, skipped, no alert; a qualified (``) or namespaced (``) + // tag never reaches this test (see that function's note for why). + if( ( lang == Lang::TypeScript || lang == Lang::JavaScript ) && isJsxIntrinsicTagIdentifier( m.roleNode, m.name.node, m.name.text ) ) + { + return true; + } + // using-declaration re-exports (r9 loss bucket 1): @reference.import marks the C++ + // `using ns::name;` tags pattern. The site becomes a role="import" use-site of the target + // (never a call edge — graph.h admits Call+Macro only), and the grammar KEYWORD forms + // (`using namespace ns;` / `using enum E;`) are dropped here at capture time, where the + // query predicate a tags pattern cannot express IS enforceable (see the helper's note). + if( m.refCap == "reference.import" && usingDeclarationIsDirective( m.roleNode ) ) + { + return true; + } + // family 4 / slice 4a: a @reference.mixin capture is Ruby's `include`/`extend`/`prepend` — the shape + // lives in queries/ruby/tags.scm, so the capture IS the language gate and no Lang:: branch is spent + // here. The two guards a tags pattern cannot state (the directive's TEXT, and its POSITION) live in + // the Ruby reader, ingest_ruby.h emitCapturedRubyMixinBase, which takes the language from this call + // site and EXPECTS Ruby: Ruby is the capture's only emitter today, and a second language adds its own + // reader and dispatch here rather than reusing Ruby's. The directive's own CALL reference is a + // separate match. + if( m.refCap == "reference.mixin" ) + { + emitCapturedRubyMixinBase( m.roleNode, m.name.node, pass.fileId, lang, pass.src, pass.refs ); + return true; + } + // #446: a @reference.base capture is a base-clause type on the class-def path — + // queries//tags.scm names the clause's type node, so the capture IS the language + // gate. The clause's parent is the class node (emitBaseRef's `self`), the same pairing + // the captureBases walk passed; C++ is the first language on this capture. + if( m.refCap == "reference.base" ) + { + emitBaseRef( m.name.node, pass.fileId, lang, pass.src, pass.refs, parentOf( m.roleNode ) ); + return true; + } + return false; +} + +// An Elixir reference's module, role and arity-qualified name. false: `r` is finished here — an attribute read pushed as its own +// fact, or a call whose module or arity is unknown (dropped). +inline bool qualifyElixirReference( const TagsPass& pass, const TagsMatch& m, RawRef& r ) +{ + r.qualifier = pass.elixir.scopeOf( m.roleNode ); + if( m.refCap == "reference.attribute" ) + { + r.role = RefRole::Read; r.name = "@" + std::string( m.name.text ); + pass.refs.push_back( std::move( r ) ); + return false; + } + const TSNode target = fieldChild( m.roleNode, NodeField::Target ); + if( !ts_node_is_null( target ) && kindIs( ts_node_type( target ), "dot" ) ) + { + const TSNode receiver = fieldChild( target, NodeField::Left ); + r.qualifier = pass.elixir.moduleOf( receiver, m.roleNode ); + if( r.qualifier.empty() ) { return false; } + // `__MODULE__` spelled, or an alias of it (`alias __MODULE__, as: Current`): the receiver names the + // enclosing module, and the reference is re-attributed per implementation of a multi-target defimpl + r.recv = nodeTextOf( receiver, pass.src ).starts_with( "__MODULE__" ) || pass.elixir.selfRelativeAlias( receiver, m.roleNode ) + ? RecvKind::ElixirSelfModule : RecvKind::ElixirModule; + } + auto [ count, known ] = elixirCallArity( m.roleNode, m.name.node, pass.src ); + if( m.refCap == "reference.operator" ) { count = elixirNodeIs( m.roleNode, "binary_operator" ) ? 2 : 1; known = true; } + if( !known ) { return false; } + r.argCount = count; r.argCountKnown = true; + r.name = elixirFunctionName( m.name.text, count ); + return true; +} + +// A C++ or Rust reference's qualifier as written. Returns RULE3-MEMBER-GUARD fix 4's Rust path-call qualifier as written, when +// longer than one segment ("" otherwise) — set by readReceiverFacts once the receiver fields are. +inline std::string qualifyPathReference( const TagsPass& pass, const TagsMatch& m, RawRef& r ) +{ + const Lang lang = pass.le.lang; + std::string rustWritten; + if( lang == Lang::Cpp ) + { + r.qualifier = qualifierOf( m.name.node, pass.src ); // `A::b()` → "A" (E#4 canonical resolve) + // #150: the FULL written chain's root, BEFORE the H4 re-split below overwrites r.qualifier + // with the immediate segment only (`std::ranges::move` loses "std", keeps "ranges") — see + // Reference::qualifierRootsStd and graph.h::keepStdQualifiedCandidates. + r.qualifierRootsStd = cppQualifiedChainRootsStd( m.name.node, pass.src ); + cppResplitRefName( r, m.name.text ); // H4 RE-SPLIT at 3+ segments, operator tails, `template` disambiguator + } + else if( langFacts( lang ).bangMacros && r.role == RefRole::Macro ) + { + // RUST-MACRO-PATH: `crate::m!`, `axum_core::m!`, `serde_json::json!`: the written path, which graph.h requires to prove the macro + const TSNode parent = parentOf( m.name.node ); + if( !ts_node_is_null( parent ) && kindIs( ts_node_type( parent ), "scoped_identifier" ) ) + { + std::string qualifier; + rustMacroPathOf( nodeTextOf( fieldChild( parent, NodeField::Path ), pass.src ), qualifier, rustWritten ); + r.qualifier = qualifier; + } + } + else if( lang == Lang::Rust ) + { + r.qualifier = rustQualifierOf( m.name.node, pass.src ); // H4: `Widget::new()` → "Widget" + if( r.role == RefRole::Call ) + { + rustWritten = rustWrittenQualifier( m.name.node, pass.src ); + } + } + return rustWritten; +} + +// A call site's receiver and argument facts (an import site has no receiver and no argument list — the defaults, +// RecvKind::None and argCountKnown=false, are the truth there; Elixir's were read by qualifyElixirReference). +inline void readReceiverFacts( const TagsPass& pass, const TagsMatch& m, RawRef& r, std::string rustWritten ) +{ + const Lang lang = pass.le.lang; + // FE-B: a Java method INVOCATION reads its receiver like every other language (a member call or a bare + // implicit-this call); only a method REFERENCE (`T::m`) keeps issue #74's type-candidate shape. + const bool javaMethodRef = lang == Lang::Java && !ts_node_is_null( m.roleNode ) && kindIs( ts_node_type( m.roleNode ), "method_reference" ); + RecvShape rs = javaMethodRef + ? javaMethodReferenceReceiver( m.roleNode, pass.src ) + : receiverOf( m.name.node, lang, pass.src ); // P2-D: `this`/`self`/`x`/`base.field` shape + r.recv = rs.kind; r.recvVar = rs.var; // → one-hop narrowing in resolve.h + r.setFieldName( std::move( rs.field ) ); // depth-2 intermediate field; "" otherwise + r.viaArrow = rs.viaArrow; // `p->m()`: Rule 2b's smart-pointer pointee needs it + r.memberCall = rs.member; r.memberRoot = rs.root; // FE-A: a Go/JS/TS/Rust member call and its receiver root + r.setMemberPath( std::move( rs.path ) ); r.setMemberCtor( std::move( rs.ctor ) ); // FE-B: the rest of that receiver chain + if( lang == Lang::Ruby && r.recv == RecvKind::NamedVar ) + { + r.setFieldName( rubyReceiverWrittenPath( m.name.node, r.recvVar, pass.src ) ); // parser version 137: a constant's path as written + } + auto [ ac, ak ] = callArity( m.name.node, lang, pass.src ); // B2.2: call-site positional arg count + r.argCount = ac; r.argCountKnown = ak; // → arity filter in graph.h + if( langFacts( lang ).trailingLambdaScopeFns ) + { + r.trailingLambda = kotlinTrailingLambda( m.roleNode ); // #155: `x.run { }` / `with( x ) { }` — graph.h FalseEdgeRules' Kotlin arm + } + if( !rustWritten.empty() ) + { + r.setFieldName( std::move( rustWritten ) ); // a Rust path call's whole written qualifier (model.h Reference::fieldName) + } + if( isQueueLang( lang ) && isQueueCallName( r.name ) ) + { + if( const std::uint8_t kw = callKeywords( m.name.node, pass.src ); kw != 0 ) + { + r.setComposeRel( pyKwTag( kw ) ); // a queue call's keywords, for QueueHops (model.h pyKwTag) + } + } +} + +// The reference arm (TagsCapture::Full only): a use-site's role, name, qualifier and receiver facts into one RawRef. +void captureReference( const TagsPass& pass, const TagsMatch& m ) +{ + if( consumeSpecialReference( pass, m ) ) + { + return; + } + const Lang lang = pass.le.lang; + const bool isImportRef = ( m.refCap == "reference.import" ); + RawRef r; + r.fileId = pass.fileId; + r.startByte = ts_node_start_byte( m.roleNode ); + r.line = ts_node_start_point( m.roleNode ).row + 1; // ABS-3: 1-based use-site line for --uses + r.lang = lang; + // ABS-3: @reference.call is a call use-site; @reference.import a using-decl re-export. EDGE-PRELUDE-VETO: @reference.macro is a macro + // invocation the grammar spells as one (Rust `name!(..)`): role Macro, so it binds only to an indexed macro of the name (graph.h). + r.role = isImportRef ? RefRole::Import : ( m.refCap == "reference.macro" ? RefRole::Macro : RefRole::Call ); + r.name = finalSegment( m.name.text ); + if( lang == Lang::Clojure ) + { + r.qualifier = nodeFieldText( parentOf( m.name.node ), NodeField::Namespace, pass.src ); + } + if( lang == Lang::Elixir ) + { + if( !qualifyElixirReference( pass, m, r ) ) + { + return; + } + } + else if( lang == Lang::Ruby && rubyCallIsAssignmentTarget( m.name.node ) ) + { + r.name.push_back( '=' ); // `obj.name = v` calls `name=`, never the getter `name` (test/rubysettercheck.sh) + } + std::string rustWritten = qualifyPathReference( pass, m, r ); + if( !isImportRef && lang != Lang::Elixir ) + { + readReceiverFacts( pass, m, r, std::move( rustWritten ) ); + } + pass.refs.push_back( std::move( r ) ); +} + +// One match with a role and a name, through the capture-time drop decisions in their order, then into the definition or the +// reference arm. +void captureTagsMatch( const TagsPass& pass, TagsMatch& m ) +{ + const Lang lang = pass.le.lang; + if( captureSpecializationHeader( m.isDef, lang, m.defCap, m.roleNode, m.name.node, pass.fileId, pass.src, pass.refs ) ) + { + return; // a C++ specialization header: its base clause only, never a symbol + } + + // C1 (memgraph F1) — see cppDefNameReseat. A null node is "nothing to re-seat". + if( const DefNameFacts reseated = cppDefNameReseat( m.isDef && lang == Lang::Cpp, m.name.node, pass.src ); !ts_node_is_null( reseated.node ) ) + { + m.name = reseated; + } + + // F5: drop Swift function-local `let`/`var` bindings — they are not module symbols and, left in, + // they steal the enclosing function's call edges (the last local binding above the call sites + // becomes the nearest enclosing symbol). roleNode is the `property_declaration`; a `statements` + // ancestor marks it as local. Real stored/computed members (class/struct/enum/top-level) survive. + if( m.isDef && m.kind == SymKind::Var && lang == Lang::Swift && isSwiftLocalBinding( m.roleNode ) ) + { + return; + } + + const std::optional aliasShape = aliasShapeOfCapture( lang, m ); + if( !aliasShape ) + { + return; + } + AnnotationRename renamed {}; + if( !keepAfterMacroInvocation( pass, m, renamed ) ) + { + return; + } + // the gated capture classes — r3 q10 constants (plus the §7b CUDA memory-space policy for the + // uninitialized C++ shape, which needs the captured declaration node), JS export/prototype + // assignments — in one drop decision (see dropGatedCapture for the per-class rationale and why + // none of this can live in the query as a #match?/#eq? predicate). + if( m.isDef && dropGatedCapture( m.defCap, lang, m.name.text, m.name.node, m.roleNode, pass.src ) ) + { + return; + } + const std::uint32_t aliasTargetStart = aliasShape->form != AliasForm::None ? aliasTargetStartOf( m.roleNode, *aliasShape ) : 0u; + + if( !keepLanguageCapture( pass, m ) ) + { + return; + } + if( consumeInertQuoteCapture( pass, m ) ) + { + return; + } + + if( m.isDef ) + { + captureDefinition( pass, m, renamed, aliasTargetStart ); + } + else if( m.isRef && pass.full ) + { + captureReference( pass, m ); + } +} + +// Ruby's own passes over the file, after the dead/field folds — neither touches Ruby (no preprocessor; Var is not a Field kind): +// Parser version 121 (test/rubyattrscheck.sh): the Ruby attr family's Var defs, inside the same defs window, so the lex build and +// cache round-trip treat these defs like captured ones. +// Parser version 130 (test/rubybarecallcheck.sh): Ruby's bare-word calls, by Ruby's own local rule, into the +// same refs window — the tags query cannot tell a bare call from a local read (both are an (identifier)). +// Parser version 132 (test/rubytypedrecvcheck.sh): the same walk types each call receiver the file builds, written +// into the call references this window holds; and FactoryBot's factory definitions, into binds. +// Parser version 135 (test/rubyrakejbuildercheck.sh): `helper_method` declarations into binds, and a Jbuilder +// template's `json` — a local, typed JbuilderTemplate — in the refs window. +// Parser version 137 (test/rubyclassrecvcheck.sh): the accessors a `class << self` declares, into binds as singleton +// methods — beside each singleton def, which the def capture notes. +// Parser version 145 (test/rubyclassrecvcheck.sh): the mixins the class object's lookup reaches — an `extend`, an +// `include` in `class << self` — into binds, beside the inherit reference each mixin already is. +inline void captureRubyFilePasses( const TagsPass& pass ) +{ + captureRubyDefs( pass.root, pass.fileId, pass.src, pass.defs ); // #339: the Definitions-only walker (attr defs + rendered db/schema.rb columns) + if( !pass.full ) + { + return; // TagsCapture::DefinitionsOnly: the passes below write references and binds only + } + captureRubyBareCalls( pass.root, pass.fileId, pass.src, pass.refs ); + captureRubyFactories( pass.root, pass.fileId, pass.src, pass.binds ); + captureRubyHelperMethods( pass.root, pass.fileId, pass.src, pass.binds ); + captureRubySingletonAccessors( pass.root, pass.fileId, pass.src, pass.binds ); + captureRubyClassMixins( pass.root, pass.fileId, pass.src, pass.binds ); + captureRubyMainMixins( pass.root, pass.fileId, pass.src, pass.binds ); + if( pass.le.ext == kJbuilderExt ) + { + typeRubyJbuilderLocal( pass.fileId, pass.refs ); + } +} + /// Append definitions and references captured by the language query, with language-specific filtering. /// Captured spans refer to src and root; a null cursor appends nothing. Existing output rows are retained. /// `ppDead` is this file's decided-dead byte ranges (preprocDeadRangesFor, computed ONCE per file by the @@ -1904,8 +3045,6 @@ void captureTagsFacts( TSQueryCursor* cursor, const LangEntry& le, std::uint32_t const std::vector& ppDead, ExtractShortfall& shortfall, TagsCapture mode = TagsCapture::Full, std::string_view fileStem = {} ) // the file's stem: the name of a bare `module.exports = ` (JS) { - const bool full = mode == TagsCapture::Full; - const bool shape = mode != TagsCapture::DefinitionsOnly; // the callables' cc_walk facts (Full or DefinitionsAndShape) if( cursor == nullptr ) { return; @@ -1936,9 +3075,9 @@ void captureTagsFacts( TSQueryCursor* cursor, const LangEntry& le, std::uint32_t elixir.shortfall = &shortfall; if( le.lang == Lang::Elixir ) { elixir.prepare( cursor, query, root, src, fileId, binds, includes, refs ); } - // extent honesty: the recovered-bit walk (parseRecoveredBits) only exists in a file the parser had to recover. - const bool fileHasError = ts_node_has_error( root ); - + const TagsPass pass{ .le = le, .fileId = fileId, .src = src, .root = root, .defs = defs, .refs = refs, .binds = binds, .includes = includes, + .shortfall = shortfall, .elixir = elixir, .fileStem = fileStem, .full = mode == TagsCapture::Full, .shape = mode != TagsCapture::DefinitionsOnly, + .fileHasError = ts_node_has_error( root ) }; { PROFILE_SCOPE_DESCRIBE( "ingest/extractFile: tags query exec+captures" ); ts_query_cursor_exec( cursor, query, root ); @@ -1953,828 +3092,12 @@ void captureTagsFacts( TSQueryCursor* cursor, const LangEntry& le, std::uint32_t { continue; } - // A tags pattern yields one @definition/@reference node + a child @name. - // Walk this match's captures: remember the role node + the name text. - SymKind kind = SymKind::Other; - bool isDef = false; - bool isRef = false; - std::string_view defCapSv; // the @definition capture's name — dropGatedCapture keys the constant/cjsexport/protomethod gates on it - std::string_view refCapSv; // the @reference capture's name — "reference.import" routes the using-declaration role (r9 loss bucket 1) - TSNode roleNode {}; - bool haveRole = false; - std::string_view nameTxt; - uint32_t nameByte = 0; - uint32_t nameRow = 0; // 0-based row of the @name identifier - bool haveName = false; - TSNode nameNode {}; // the @name identifier node — for C++ scope/qualifier (E#4) - TSNode importNamesNode {}; // one clause's target, paired with its optional alias (emitCapturedImportBind) - TSNode importAliasNode {}; - bool keywordHead = false; // #355: the pattern carried @_keyword, a head its tags.scm predicates accepted - - for( uint16_t ci = 0; ci < match.capture_count; ++ci ) - { - const TSQueryCapture& cap = match.captures[ ci ]; - - uint32_t nameLen = 0; - const char* capName = ts_query_capture_name_for_id( query, cap.index, &nameLen ); - const std::string_view capSv( capName, nameLen ); - if( capSv == "_keyword" ) - { - keywordHead = true; // a predicate-only capture: roleOf ignores it, the definition keyword is its pattern's #any-of? - } - - SymKind k = SymKind::Other; - switch( roleOf( capSv, k ) ) - { - case CapRole::Def: - { - isDef = true; - kind = k; - defCapSv = capSv; - roleNode = cap.node; - haveRole = true; - } - break; - - case CapRole::Ref: - { - isRef = true; - refCapSv = capSv; - roleNode = cap.node; - haveRole = true; - } - break; - - case CapRole::NameOnly: - { - const uint32_t a = ts_node_start_byte( cap.node ); - uint32_t b = ts_node_end_byte( cap.node ); - - // A C++ conversion operator's declarator is an `operator_cast` node whose text spans - // the WHOLE `operator () const` (the tags query captures the declarator itself — - // there is no sub-node spanning just `operator bool`). Trim the name's end to the end of - // the `type` field so the symbol name is `operator bool` / `operator MyType`, not the - // param list. Symbolic ops (operator==/[]/()) go through operator_name and are untouched — - // trimming at `(` there would wrongly cut `operator()`, so this is operator_cast-only. - if( kindIs( ts_node_type( cap.node ), "operator_cast" ) ) - { - const TSNode typeNode = fieldChild( cap.node, NodeField::Type ); - if( !ts_node_is_null( typeNode ) ) - { - const uint32_t typeEnd = ts_node_end_byte( typeNode ); - if( typeEnd > a && typeEnd <= b ) - { - b = typeEnd; - } - } - } - - if( b <= src.size() && a <= b ) - { - nameTxt = src.substr( a, b - a ); - nameByte = a; - nameRow = ts_node_start_point( cap.node ).row; - nameNode = cap.node; - haveName = true; - } - } - break; - - case CapRole::Ignore: - break; - - // #358: `@import.path` — emit here, not in a second pass. Matches arrive by start byte and captures - // within a match in query order, so a staging vector would produce the identical - // order while costing an allocation and a drain block. - case CapRole::Import: - { - if( full && capSv == "import.path" ) - { - emitCapturedImport( cap.node, fileId, le.lang, src, includes, refs, shortfall ); - } - else if( full && capSv == "import.names" ) - { - importNamesNode = cap.node; - } - else if( full && capSv == "import.alias" ) - { - importAliasNode = cap.node; - } - } - break; - } - } - - if( !ts_node_is_null( importNamesNode ) ) - { - emitCapturedImportBind( importNamesNode, importAliasNode, fileId, le.lang, src, binds ); - } - if( !haveName ) - { - continue; - } - - // Some patterns (e.g. a bare (identifier) @name) carry no @definition/@reference - // wrapper. Treat a wrapper-less @name as a reference fallback only when the pattern - // had a role; otherwise skip (avoids turning every identifier into an edge). - if( !haveRole ) - { - continue; - } - if( captureSpecializationHeader( isDef, le.lang, defCapSv, roleNode, nameNode, fileId, src, refs ) ) - { - continue; // a C++ specialization header: its base clause only, never a symbol - } - - // C1 (memgraph F1) — see cppDefNameReseat. A null node is "nothing to re-seat". - const auto [ reNode, reTxt, reByte, reRow ] = cppDefNameReseat( isDef && le.lang == Lang::Cpp, nameNode, src ); - if( !ts_node_is_null( reNode ) ) - { - nameNode = reNode; nameTxt = reTxt; nameByte = reByte; nameRow = reRow; - } - - // F5: drop Swift function-local `let`/`var` bindings — they are not module symbols and, left in, - // they steal the enclosing function's call edges (the last local binding above the call sites - // becomes the nearest enclosing symbol). roleNode is the `property_declaration`; a `statements` - // ancestor marks it as local. Real stored/computed members (class/struct/enum/top-level) survive. - if( isDef && kind == SymKind::Var && le.lang == Lang::Swift && isSwiftLocalBinding( roleNode ) ) - { - continue; - } - - // the gated capture classes — r3 q10 constants (plus the §7b CUDA memory-space policy for the - // uninitialized C++ shape, which needs the captured declaration node), JS export/prototype - // assignments — in one drop decision (see dropGatedCapture for the per-class rationale and why - // none of this can live in the query as a #match?/#eq? predicate). - // INDEX-ALIAS-CONST (src/aliasdef.h, the one alias reader): a C++ alias form is a definition unless it is - // function-local. aliasTargetStart: where the written target starts when it ENDS the declaration (--defs to=); it - // rides the RawDef's bodyByte to the model, which moves it to IngestResult::aliasTargets and keeps the whole - // declaration as the signature (ingest_model.h rawDefIsAliasRow); 0 when the target is not a suffix (a typedef). - std::uint32_t aliasTargetStart = 0; - AliasShape aliasShape {}; - if( isDef && langFacts( le.lang ).aliasTargetDefs && defCapSv == "definition.alias" ) - { - if( insideFunctionBody( roleNode ) ) // ingest_relations.h: a function-local alias is a local name (the local-const rule) - { - continue; - } - aliasShape = aliasShapeOf( Lang::Cpp, roleNode ); - } - AnnotationRename renamed {}; - if( cFamilyMacroInvocationCapture( defCapSv, le.lang, nameTxt, roleNode, src ) ) // defCapSv: set by a @definition capture only - { - // MACRO-P0 (ingest_names.h): a macro invocation read as a typeless declarator mints no definition of its own; the site is - // a call-shaped use of the macro (model.h retagMacroCallReferences makes it role="macro" when the #define is - // indexed and its name is uniquely a macro). No argument count: the "parameters" are macro arguments. - RawRef r; - r.fileId = fileId; - r.startByte = ts_node_start_byte( roleNode ); - r.line = ts_node_start_point( roleNode ).row + 1; - r.lang = le.lang; - r.role = RefRole::Call; - r.name = nameTxt; - refs.push_back( std::move( r ) ); - // MACRO-P1: when the grammar read the real function's own `f()` as a variable (ingest_names.h - // annotationRenamedName), this definition is the only one f gets — it carries f's name, from f's own start. - renamed = annotationRenamedName( roleNode, src ); - if( ts_node_is_null( renamed.name ) ) - { - continue; - } - nameNode = renamed.name; - nameTxt = nodeTextOf( renamed.name, src ); - nameByte = ts_node_start_byte( renamed.name ); - nameRow = ts_node_start_point( renamed.name ).row; - kind = renamedAnnotationKind( renamed.name ); - } - if( isDef && dropGatedCapture( defCapSv, le.lang, nameTxt, nameNode, roleNode, src ) ) - { - continue; - } - if( aliasShape.form != AliasForm::None ) - { - // the target is a suffix when every child after it is the `;` or a comment (`using X = Y /* c */ ;` keeps its - // target; the printer drops the comment, defslookup.h aliasTargetText); one cursor walk (infra/tschildren.h) - const std::uint32_t tEnd = ts_node_end_byte( aliasShape.target ); - bool suffix = true; // only `using`/namespace alias rows reach here (a typedef capture is never definition.alias) - ChildCursor cursor( roleNode ); - forEachChild( roleNode, cursor.cur, [ & ]( TSNode c ) - { - const char* k = ts_node_type( c ); - suffix = ts_node_start_byte( c ) < tEnd || kindIs( k, ";" ) || kindIs( k, "comment" ); - return suffix; - } ); - aliasTargetStart = suffix ? ts_node_start_byte( aliasShape.target ) : 0u; - } - - if( le.lang == Lang::Elixir && !elixirKeepCapture( roleNode, nameNode, ElixirCaptureRole{ isDef, kind, keywordHead }, src, elixir.keywords ) ) - { - continue; - } - if( le.lang == Lang::Clojure ) - { - if( !clojureKeepCapture( roleNode, isDef, src ) ) - { - continue; - } - if( isDef ) - { - kind = clojureDefinitionShape( roleNode, src ).kind; - } - } - if( le.lang == Lang::Elixir && refCapSv == "reference.bare" ) - { - // Bare pipe targets have their own capture; every other bare name needs lexical variable exclusion. - const TSNode parent = parentOf( nameNode ); - if( ( elixirNodeIs( parent, "binary_operator" ) && nodeFieldText( parent, NodeField::Operator, src ) == "|>" - && ts_node_eq( fieldChild( parent, NodeField::Right ), nameNode ) ) || !elixir.bareCall( nameNode ) ) { continue; } - } - if( le.lang == Lang::Elixir && refCapSv == "reference.operator" ) - { - constexpr std::string_view special[] = { "=", "<-", "\\\\", "::", "|>", "when", "|", "^", "&", "@" }; - if( std::find( std::begin( special ), std::end( special ), nameTxt ) != std::end( special ) ) { continue; } - const TSNode parent = parentOf( roleNode ); - if( nameTxt == "/" && elixirNodeIs( parent, "unary_operator" ) && nodeFieldText( parent, NodeField::Operator, src ) == "&" ) { continue; } - } - - if( langFacts( le.lang ).hasInertQuoteRegions && elixirInert( roleNode, src ) ) - { - // Keep call/operator/named-capture candidates as declined facts, never edges. Heads, - // special forms and non-call operators already failed their syntax filters. Bare AST - // names remain variable-shaped syntax unless they explicitly name a function capture. - if( isRef && ( refCapSv == "reference.call" || refCapSv == "reference.operator" - || ( refCapSv == "reference.bare" && elixir.namedCapture( nameNode ) ) ) ) - { - RawRef r; - r.fileId = fileId; - r.startByte = ts_node_start_byte( roleNode ); - r.line = nameRow + 1; - r.lang = Lang::Elixir; - r.role = RefRole::Inert; - auto [ count, known ] = elixirCallArity( roleNode, nameNode, src ); - if( refCapSv == "reference.operator" ) { count = elixirNodeIs( roleNode, "binary_operator" ) ? 2 : 1; known = true; } - r.name = known ? elixirFunctionName( nameTxt, count ) : std::string( nameTxt ); - refs.push_back( std::move( r ) ); - } - continue; - } - - if( isDef ) - { - if( le.lang == Lang::Elixir && defCapSv == "definition.attribute" ) { kind = SymKind::Var; } - RawDef d; - d.fileId = fileId; - d.line = nameRow + 1; // the identifier's line — most accurate, dedup-stable - // The C++ tags query captures @definition on the function_declarator (name+params) — its - // span excludes the return type AND the body. Walk up to the nearest ancestor owning a - // "body" field (the real function_definition) so [startByte,endByte) spans the WHOLE def: - // return type + signature + body. Fixes --expand bodies, --pack-signatures return-types, - // AND reference enclosing-attribution (a call in a body is now inside its function span). - // Grammars whose @definition node already owns the body (class/struct/enum) don't climb. - // defBodyNodeOf = the `body:` field, PLUS the macro-edges round's one addition: a #define's - // replacement text (`value:` field) is adopted as a macro symbol's body, set before the climb - // below so the climb is skipped for macros — PLUS a name bound to a function literal - // (kFnLiteralBinding): the literal's body, with `literal` the node params/cx/nest read from. - const DefBodyNodes own = le.lang == Lang::Elixir ? DefBodyNodes{ elixirBody( roleNode, src ), {}, roleNode } - : defBodyNodeOf( roleNode, nameNode, kind, le.lang ); - TSNode defNode = own.span; - TSNode body = own.body; - // LB-E testmacroblock: the def is TWO SIBLING nodes (see testMacroBlockPartsOf) — adopt the - // sibling compound_statement as the body and the title literal as the name BEFORE the shared - // span/complexity code below. The span's endByte and the loc row window are extended past - // defNode's own end further down (no single node covers both siblings). - const bool isTestMacroBlock = ( defCapSv == "definition.testmacroblock" ); - if( isTestMacroBlock ) - { - const TestMacroBlockParts parts = testMacroBlockPartsOf( roleNode, src ); - if( !parts.ok ) - { - continue; // dropGatedCapture already vetoed non-candidates — guard, don't assert - } - body = parts.body; - nameNode = parts.title; - nameTxt = testMacroTitleOf( parts.title, src ); - nameByte = ts_node_start_byte( parts.title ); - nameRow = ts_node_start_point( parts.title ).row; - d.line = nameRow + 1; // re-seat: d.line above was filled from the @name capture (the macro identifier) - } - // A Var's span is its own declaration — never climb. The climb exists to find a FUNCTION's - // body; for a var it can only steal a container's span (a Ruby class-level constant's parent - // chain is body_statement → class, and class owns a "body" field, so the climb would hand the - // constant THE WHOLE CLASS — the exact Rust-method span bug the H4 W3 note above describes). - // No-op for every pre-existing Var capture (Swift/C#/Go/Python parents hit a scope-stop or the - // file root before any "body"-owning ancestor — verified byte-identical on the gate corpora). - // A Field's span is its own field_declaration / defining assignment — the Var rule, same reason. - // A BODY-LESS C/C++ type specifier — `enum cmd_retval` as a return type (`static enum cmd_retval⏎fn(…)`, tmux's - // style) or a parameter type — is captured by the tags query's bare enum/class pattern, and the climb below - // ADOPTED the enclosing function_definition, whose body it sits outside of: the specifier took the WHOLE - // function's span, so --at chained `struct cmd_retval` around the function, --grep labelled its hits - // in="cmd_retval" and its calls were attributed to a `struct box_lines` caller (comparison table tmux-07/15, - // test/ccheck.sh). The adoption is for a function DECLARATOR. A type specifier whose climb reaches a body owner - // it sits outside of is a type USE in that function's signature, not a definition, so it mints NO def: keeping - // it as a small def of its own put a span in the return-type position wholly before the name — extentsuspect.h - // R3's derailed-parse signature — and flagged clean functions extent_suspect="head" (review of this lane, - // ccheck arm (f)). The declaration-wrapper rule at a scope stop is unchanged (`enum E : int;`, a prototype). - const bool bodylessTypeSpec = isCFamilyTypeSpecifier( le.lang, roleNode ); - bool typeUseInSignature = false; - if( ts_node_is_null( body ) && kind != SymKind::Var && kind != SymKind::Field && le.lang != Lang::Elixir ) - { - TSNode child = roleNode; - TSNode p = parentOf( roleNode ); - for( int guard = 0; !ts_node_is_null( p ) && guard < 4; ++guard ) - { - const char* pt = ts_node_type( p ); - // STOP at a type/namespace/file scope: a function's body never lives above one of - // these, so reaching here means roleNode is a prototype/declaration with no body. - // (Without this, an in-class method declaration would climb into class_specifier and - // wrongly grab the whole CLASS body as its span — corrupting spans + ref attribution.) - const bool scope = kindIs( pt, "class_specifier" ) || kindIs( pt, "struct_specifier" ) - || kindIs( pt, "field_declaration_list" ) || kindIs( pt, "declaration_list" ) - || kindIs( pt, "namespace_definition" ) || kindIs( pt, "enum_specifier" ) - || kindIs( pt, "translation_unit" ) || kindIs( pt, "source_file" ) // Swift top - || kindIs( pt, "class_body" ) || kindIs( pt, "protocol_body" ) // Swift type bodies - || kindIs( pt, "enum_class_body" ) - || kindIs( pt, "class_interface" ) || kindIs( pt, "class_implementation" ) // ObjC - || kindIs( pt, "implementation_definition" ) || kindIs( pt, "protocol_declaration" ) - || kindIs( pt, "compound_statement" ) || kindIs( pt, "block" ); // a function BODY: a block-scope - // `Type v(args);` (most-vexing-parse) must not climb up and steal its enclosing function's span. A real - // function definition's declarator parents directly to function_definition (found at hop 1, above), so this never fires for it. - if( scope ) - { - // prototype/declaration: use the member/decl wrapper as the span so the RETURN - // TYPE is included (not just the declarator), WITHOUT grabbing the class body. - const char* ct = ts_node_type( child ); - if( kindIs( ct, "field_declaration" ) || kindIs( ct, "declaration" ) ) - { - defNode = child; - } - break; - } - // Adopt an ancestor's span only if roleNode sits OUTSIDE its body — i.e. roleNode is the - // ancestor's own signature/declarator (the C++ function_declarator → function_definition - // hop this climb exists for). A def spelled INSIDE the body is a different, NESTED - // definition — a JS/TS named const-closure (`const f = (..) => {..}` in a function body) — - // and adopting here broadcast the encloser's whole span (loc/cx/params/nest) onto every - // such closure (webpack lib/html/syntax.js: eight closures inside the 3439-line `tokenize` - // all reported loc=3439 cx=487). The enclosing statement_block is not in the scope-stop - // list above (only C-family compound_statement/block are), so nested defs escaped upward; - // containment is the grammar-agnostic stop. Gate: test/jsnestedcheck.sh. - const TSNode pb = fieldChild( p, NodeField::Body ); - if( !ts_node_is_null( pb ) ) - { - const bool outsideBody = !spanContains( pb, roleNode ); - if( outsideBody && !bodylessTypeSpec ) { defNode = p; body = pb; } - typeUseInSignature = outsideBody && bodylessTypeSpec; - break; - } - child = p; - p = parentOf( p ); - } - } - if( typeUseInSignature ) - { - continue; // a body-less C/C++ specifier in a function's signature: a type use, never a definition - } - - // MACRO-P1: a prototype adopts its trailing annotation's definition body, its span running THROUGH that sibling - const TSNode ownBody = body; - body = annotatedSiblingBody( body, le.lang, kind, roleNode, src ); - const bool annotatedBody = !ts_node_eq( body, ownBody ); - - // ObjC/Kotlin body-field fallback for the grammars that expose a body as an unnamed CHILD, not a - // named "body" field. C++ function_definition owns a "body" field (found above); the ObjC grammar - // never does, so the field lookup returns null and bodyByte would stay 0 for a real definition — - // making an @implementation def indistinguishable from its @interface DECL (both bodyByte==0). That - // breaks BOTH the same-file decl/def collapse (3a-bis) and graph.h's cross-file hasBody - // (endByte > sigEndByte), doubling every ObjC symbol node AND its call edges. Recover the - // body-present signal from a direct child: - // - a METHOD def: a bare `compound_statement` / `function_body` / `block` child (the `{...}`). - // - an ObjC CLASS: an @implementation carries `implementation_definition` member children; the - // matching @interface carries only `method_declaration`s → so an `implementation_definition` - // child is exactly "this is the class's definition, not its forward @interface". - // - Kotlin: `function_body` / `class_body` / `enum_class_body` are positional children too - // (function_declaration's only named field is `receiver`), and the cost of missing them is - // the same collapse bug in the other direction — a Kotlin definition read as bodyless is - // deleted from the candidate pool as a forward declaration whenever a same-named Java - // definition exists (test/kotlincheck.sh §5). `enum_class_body` (`enum class Status { … }`) - // was the one omission a second-opinion review caught: `class_declaration`'s enum-class form - // nests its members under that node, not `class_body` — verified via a raw parse of - // `enum class Status { READY, DONE }` → `(class_declaration (type_identifier) - // (enum_class_body (enum_entry …) (enum_entry …)))`. - // A bodyLESS declaration (@interface method / @interface class) has none of these children → - // bodyByte stays 0 → it stays a decl (a bodyless KOTLIN TYPE does too, and is still a definition: model.h isDefinitionNotDeclaration). GATED to ObjC and - // Kotlin so C++/Python/Rust/Go/TS/Swift bodyByte — and therefore their sigEndByte, spans, and - // node/edge output — are BYTE-for-byte unchanged (a .mm's C++ functions take the C "body"-field - // path above and never reach here). See test/langcheck.sh c.m and the byte-identical src/ - // regression gate. - if( ts_node_is_null( body ) && ( le.lang == Lang::ObjC || le.lang == Lang::Kotlin ) ) - { - // O(children): `- (void) m /*…*/ { }` puts the comments in the method_definition, before its - // body — 24x at 16 000 (test/childwalkscalecheck.sh, arm B35) - body = firstChildOfKind( defNode, /*namedOnly=*/false, - { "compound_statement", "function_body", "block", "implementation_definition", "class_body", "enum_class_body" } ); - } - - // Proto (PROTO-INDEX): the grammar names no `body:` field. A message's or enum's body is its *_body child; a service's, - // an rpc's option block's and a oneof's body starts at its `{` token (an rpc ending in `;` has none). - if( ts_node_is_null( body ) && langFacts( le.lang ).generatedSchema ) - { - body = firstChildOfKind( defNode, /*namedOnly=*/false, { "message_body", "enum_body", "{" } ); - } - - // Dart's body is a SIBLING of the signature, so neither defBodyNodeOf nor the climb above can - // find it and the span would stop at the signature — see dartFollowingBody (ingest_relations.h) - // for the measurement and for why an abstract member still comes back null. - bool siblingBody = annotatedBody; // MACRO-P1's annotated sibling above, or Dart's here - if( ts_node_is_null( body ) && le.lang == Lang::Dart ) - { - body = dartFollowingBody( defNode ); - siblingBody = !ts_node_is_null( body ); - } - // Both flags mean the same thing to the three span consumers below: the code this symbol - // owns lives in a SIBLING node, so byte/row extents and complexity must run through it. - const bool spanThroughBody = isTestMacroBlock || siblingBody; - - d.startByte = ts_node_start_byte( defNode ); - d.endByte = spanThroughBody ? ts_node_end_byte( body ) : ts_node_end_byte( defNode ); // LB-E: the span runs THROUGH the sibling block - d.nameByte = nameByte; - d.bodyByte = ts_node_is_null( body ) ? 0u : ts_node_start_byte( body ); - if( d.bodyByte == 0 && aliasTargetStart > d.startByte && aliasTargetStart < d.endByte ) - { - d.bodyByte = aliasTargetStart; // INDEX-ALIAS-CONST: the transport only (ingest_model.h rawDefIsAliasRow) - } - const bool fnOrMethod = ( kind == SymKind::Function || kind == SymKind::Method ); - // LB-E: for a testmacroblock the body SIBLING is where the code lives — complexityOf walks - // INSIDE its root node, so handing it defNode (the bare macro statement) would count nothing. - // A literal-bound name measures its LITERAL; every other def measures defNode, as before. - const bool literalBound = !ts_node_is_null( own.literal ); - const TSNode metricNode = literalBound ? own.literal : defNode; - const auto [ cxVal, ccxVal, nestVal, localsVal, ppAltVal, humpsVal, deepVal, evVal, evWhyVal, steerVal, dispatchVal, nestCutVal ] = fnOrMethod && shape ? complexityOf( spanThroughBody ? body : metricNode, src, le.lang ) : Complexity{ 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, {}, 0u, 0u, 0u }; - d.cx = cxVal; - d.ccx = ccxVal; - d.locals = localsVal; // Phase 1: floor count, C/C++ only (model.h localsCountedLang) — 0 elsewhere, never emitted there - // ppalt disclosure (model.h Symbol::ppAlt). Saturating at 65535 on purpose: a def past that - // bound is beyond every triage threshold, and the attribute's claim ("the body carries - // alternatives") is already made at 1. - d.ppAlt = fnOrMethod ? std::uint16_t( ppAltVal > 65535u ? 65535u : ppAltVal ) : std::uint16_t( 0 ); - // Q4 size smells (SIZE = master variable): physical LOC = span line count (end row − start row + 1); - // param count + max nesting for functions/methods only (0 otherwise, absent in emit). All descriptive. - { - const std::uint32_t startRow = ts_node_start_point( defNode ).row; - const std::uint32_t endRow = ts_node_end_point( spanThroughBody ? body : defNode ).row; // LB-E: rows through the sibling block - d.loc = ( endRow >= startRow ) ? ( endRow - startRow + 1u ) : 1u; - } - d.params = fnOrMethod ? ( le.lang == Lang::Elixir ? elixirParams( defNode, src ) - : le.lang == Lang::Clojure ? clojureParams( defNode, src ) - : paramCountOf( metricNode, literalBound ) ) : std::uint16_t( 0 ); - // LB-E: a testmacroblock's parameter surface is the MACRO's business, not visible here — claim - // inexact so the resolver's arity narrowing never trusts params=0 on a test-title symbol. - // B2.2: the fixed-arity bit and the minimum (fewest arguments a call can pass) come from ONE scan of the list. - // A minimum above the counted params (a literal-bound bare parameter countParams cannot see) is not trusted. - const ParamShape shape = ( fnOrMethod && !isTestMacroBlock && le.lang != Lang::Clojure ) ? cc_paramShape( metricNode, le.lang, kind, src ) : ParamShape{}; - d.arityExact = shape.exact ? std::uint8_t( 1 ) : std::uint8_t( 0 ); - d.paramsMin = shape.minimum <= d.params ? shape.minimum : std::uint16_t( 0 ); - applyAnnotationRename( d, renamed, defNode ); // MACRO-P1: the real function's parameters and start, not the annotation's - // L8: the in-file test-scope bit, for EVERY kind (a `#[cfg(test)] mod` and a `class TestFoo` - // are themselves symbols, and dropping the members while keeping the shell would be a worse - // answer than either). Runs on defNode, whose ancestors are the enclosing scopes. - d.testScope = isTestMacroBlock ? std::uint8_t( 1 ) : std::uint8_t( inFileTestScope( defNode, src, le.lang ) ); // LB-E: a test macro IS the in-file convention - d.maxNest = fnOrMethod ? std::uint8_t( nestVal > 255u ? 255u : nestVal ) : std::uint8_t( 0 ); - // QD-TANGLE (model.h Symbol::steer, ::dispatchShare): 0 off a callable, where complexityOf did not run - d.steer = saturatedTo( steerVal ); - d.deepDispatch = saturatedTo( dispatchVal ); - d.nestArmCut = saturatedTo( nestCutVal ); - // The nesting profile (model.h Symbol::humps/deepLoc). Saturating at 65535 on purpose: a def past - // either bound is beyond every triage threshold, and deepLoc is a floor already, so a clamp there - // stays honest in the direction the attribute already claims. - d.humps = fnOrMethod ? std::uint16_t( humpsVal > 65535u ? 65535u : humpsVal ) : std::uint16_t( 0 ); - d.deepLoc = fnOrMethod ? std::uint16_t( deepVal > 65535u ? 65535u : deepVal ) : std::uint16_t( 0 ); - // essential complexity (model.h Symbol::ev): already saturated inside ev_finalize; 0 for - // non-function kinds and outside evCountedLang, matching the emitters' omission rule. - d.ev = fnOrMethod ? std::uint16_t( evVal > 65535u ? 65535u : evVal ) : std::uint16_t( 0 ); - d.evWhy = fnOrMethod ? evWhyVal : std::array{}; - d.kind = kind; - d.lang = le.lang; - d.name = isTestMacroBlock ? std::string( nameTxt ) : defNameFromCapture( le.lang, nameTxt ); // LB-E: a title is a display string — see testMacroTitleOf - if( defCapSv == "definition.cjsexport" && isCjsModuleExportsItself( nameNode, src ) ) - { // lane js-def-naming: the module's own export function, named by the file's stem (ingest_names.h isCjsModuleExportsItself) - if( fileStem.empty() ) - { - continue; // no path to name it by: no row, as before - } - d.name = std::string( fileStem ); - } - if( le.lang == Lang::Elixir && elixirTarget( roleNode, src ) == "test" ) - { - // Static ExUnit title; interpolation was rejected by elixirKeepCapture. - d.name = "test " + std::string( nameTxt.substr( 1, nameTxt.size() - 2 ) ); - d.testScope = 1; - } - else if( le.lang == Lang::Elixir && !elixirAttribute( roleNode, src ).empty() ) - { - const auto attribute = elixirAttribute( roleNode, src ); - if( elixirTypedAttribute( attribute ) ) - { - const TSNode args = elixirArguments( parentOf( nameNode ) ); - std::uint32_t arity = 0; - for( std::uint32_t i = 0; !ts_node_is_null( args ) && i < ts_node_named_child_count( args ); ++i ) - { - arity += elixirNodeIs( ts_node_named_child( args, i ), "comment" ) ? 0u : 1u; - } - d.name = ( attribute == "callback" || attribute == "macrocallback" ? "@callback " : "@type " ) + elixirFunctionName( nameTxt, arity ); - } - else { d.name = "@" + std::string( nameTxt ); } - } - else if( le.lang == Lang::Elixir && kind == SymKind::Other ) - { - // `defimpl P, for: T` — the @name capture is just the protocol alias, but the module Elixir - // generates is `P.T`, which is what the impl's own defs carry as their scope. - d.name = elixir.moduleName( roleNode ); - if( d.name.empty() ) { continue; } - d.kind = elixirTarget( roleNode, src ) == "defprotocol" ? SymKind::Interface : SymKind::Class; - for( TSNode call : elixir.calls ) - { - const auto keyword = elixirTarget( call, src ); - if( ( keyword == "defstruct" || keyword == "defexception" ) && elixir.scopeOf( call ) == d.name ) { d.kind = SymKind::Struct; break; } - } - } - // Internal linkage (model.h Symbol::internalLinkage): C and C++ only, read off defNode — the node that owns - // the storage class and whose ancestors are the enclosing namespaces (ingest_names.h::cppInternalLinkage). - d.internalLinkage = internalLinkageBit( le.lang, defNode, src ); - // A FUNCTION bound inside another function's body records that function's span (ingest_names.h - // enclosingFunctionScope): graph.h reachableByName ranks it below every def a call outside it can name. - if( full && kind == SymKind::Function && !bindsOutsideItsFunction( roleNode, le.lang ) ) - { - // Descend to the OUTER of the two def nodes: a C-family def's defNode climbed from its declarator (the role - // node) to the function_definition, which must not read as the function enclosing itself; a multi-name - // binding's defNode narrowed to one declarator, whose declaration (the role node) holds no scope node - // and is not a 20k-child list to rescan per name. - const bool defIsOuter = ts_node_start_byte( defNode ) <= ts_node_start_byte( roleNode ) && ts_node_end_byte( defNode ) >= ts_node_end_byte( roleNode ); - const FnScope fnScope = enclosingFunctionScope( root, defIsOuter ? defNode : roleNode ); - d.fnScopeStart = fnScope.start; - d.fnScopeEnd = fnScope.end; - } - if( le.lang == Lang::Cpp ) // canonical scope (E#4): out-of-line `A::b` → "A", else enclosing class/namespace - { - d.scope = qualifierOfDefinition( nameNode, src ); // `Box::grow` (primary) → "Box"; a specialization keeps its id - if( d.scope.empty() ) - { - d.scope = enclosingScopeOf( nameNode, src ); - } - // #150: is this def genuinely INSIDE namespace std, at ANY nesting depth — not just a def - // whose immediate scope happens to spell a segment std also uses? See Symbol::scopeRootsStd. - d.scopeRootsStd = cppDefinitionRootsStd( nameNode, src ) ? std::uint8_t( 1 ) : std::uint8_t( 0 ); - } - else if( enumTableAt( kDefScopeWalkerOfLang, le.lang, DefScopeWalker::None ) != DefScopeWalker::None ) - { // Python, Go, Rust, Kotlin: the language's row in ingest_names.h kDefScopeWalkerOfLang - d.scope = defScopeOf( le.lang, nameNode, src ); - } - else if( le.lang == Lang::Elixir ) - { - d.scope = kind == SymKind::Other ? std::string{} : elixir.scopeOf( roleNode ); - if( keywordHead ) // #355: the match's own @_keyword capture, decided by tags.scm, not a C++ keyword list - { - d.name = elixirFunctionName( nameTxt, d.params ); - // B2.2 for Elixir: a clause's arity IS its parameter count (no variadic form), so `params` - // is call-comparable unless a `\\` default widens the callable to more than one arity. - // cc_paramShape's language gate leaves this at 0, which made every Elixir caller - // unflaggable by --edit-check (test/elixirnamearitycheck.sh arm C: run(x) -> run(x, y) - // must flag run(x) callers; run(x, y \\ 1) must flag none). - d.arityExact = elixirHeadDefaultCount( roleNode, src ) == 0 ? std::uint8_t( 1 ) : std::uint8_t( 0 ); - elixirDefinitionFacts( d, roleNode, src, binds, elixir.keywords ); - if( elixirTarget( roleNode, src ) == "defdelegate" ) - { - RawRef delegated; - delegated.fileId = fileId; delegated.startByte = d.startByte; delegated.line = d.line; - delegated.lang = le.lang; delegated.recv = RecvKind::ElixirModule; - delegated.qualifier = elixir.moduleOf( elixirKeywordValue( roleNode, "to:", src ), roleNode ); - const auto as = nodeTextOf( elixirKeywordValue( roleNode, "as:", src ), src ); - delegated.name = elixirFunctionName( as.starts_with( ":" ) ? as.substr( 1 ) : nameTxt, d.params ); - delegated.argCount = d.params; delegated.argCountKnown = true; - if( !delegated.qualifier.empty() ) { refs.push_back( std::move( delegated ) ); } - } - } - } - else if( le.lang == Lang::Ruby ) - { // enclosing class/module → id= addressability, per-class overload sets, editCheckImplicitReceiver - d.scope = rubyEnclosingScopeOf( nameNode, src ); // (test/rubyscopecheck.sh) - if( kind == SymKind::Method || kind == SymKind::Function ) - { - rubyNoteClassSideDef( defNode, fileId, d.name, src, binds ); // a class object's method (test/rubyclassrecvcheck.sh) - } - } - else if( ( le.lang == Lang::JavaScript || le.lang == Lang::TypeScript ) - && defCapSv == "definition.protomethod" ) - { // only the five built-in ctors: every Foo.prototype.bar gaining sc= would mint a new - // canonical id and move quality baselines (node lib/ has ~163 anonymous protomethods) - const std::string_view ctor = prototypeCtorName( nameNode, src ); - if( isJsTsBuiltinCtor( ctor ) ) - { - d.scope = std::string( ctor ); - } - } - // extent honesty: did the parse RECOVER this def's container or kind? Only asked in a file whose root - // holds an error (fileHasError, one O(1) flag test per file) — see parseRecoveredBits. - d.recovered = fileHasError ? parseRecoveredBits( defNode, kind, le.lang, d.scope.empty() ) : std::uint8_t( 0 ); - defs.push_back( std::move( d ) ); - if( !full ) - { - continue; // TagsCapture::DefinitionsOnly: the reference edges below feed no definition - } - if( kind == SymKind::Class || isStructOrNamedType( kind ) || kind == SymKind::Interface ) - { - // #446: a language on the bases-as-captures port reads its bases through the - // @reference.base reader above (LangFacts::basesAsCaptures; C++ is the first). The - // others keep the walk; C++'s own walk survives for captureSpecializationHeader. - if( !langFacts( le.lang ).basesAsCaptures ) - { - captureBases( defNode, fileId, le.lang, src, refs ); // IS-A: inheritance edges (derived → base) - } - if( defCapSv == "definition.classfactory" ) // lane lego-transitive (M2): the factory's receiver is the base - { - emitBaseRef( jsClassFactoryReceiver( nameNode, src ), fileId, le.lang, src, refs, defNode ); - } - captureFields( defNode, fileId, le.lang, src, refs ); // HAS-A: member-variable type edges (S5-E) - } - else if( kind == SymKind::Macro ) - { - captureMacroBodyCalls( roleNode, fileId, le.lang, src, refs ); // macro-edges: the graph connects THROUGH the macro - if( langFacts( le.lang ).bangMacros ) // Rust: `$crate` exists only where `name!` macros do - { - captureRustTranscriberMacroCalls( roleNode, fileId, src, refs ); // RUST-MACRO-PATH: `$crate::m!` in a transcriber - } - } - } - else if( isRef && full ) + TagsMatch m = readTagsMatch( pass, query, match ); + // Some patterns (e.g. a bare (identifier) @name) carry no @definition/@reference wrapper: a name without a role is + // skipped (avoids turning every identifier into an edge), and so is a role without a name. + if( m.hasName() && m.hasRole() ) { - // An element access: @name is its RECEIVER, and the site names the receiver class's subscript operator - // method (ingest_binds.h subscriptOperatorRef) — never a call by itself (RefRole::Subscript). - if( refCapSv == "reference.subscript" ) - { - if( std::optional sub = subscriptOperatorRef( roleNode, nameNode, fileId, le.lang, src ) ) - { - refs.push_back( std::move( *sub ) ); - } - continue; - } - // H4: a C++ cast keyword is not a call — see isCppCastKeyword. Valid input, skipped, no alert. - if( le.lang == Lang::Cpp && isCppCastKeyword( nameTxt ) ) - { - continue; - } - - // #285: an intrinsic JSX tag (`
`, `

`) is not a call — see isJsxIntrinsicTagIdentifier. - // Valid input, skipped, no alert; a qualified (``) or namespaced (``) - // tag never reaches this test (see that function's note for why). - if( ( le.lang == Lang::TypeScript || le.lang == Lang::JavaScript ) - && isJsxIntrinsicTagIdentifier( roleNode, nameNode, nameTxt ) ) - { - continue; - } - - // using-declaration re-exports (r9 loss bucket 1): @reference.import marks the C++ - // `using ns::name;` tags pattern. The site becomes a role="import" use-site of the target - // (never a call edge — graph.h admits Call+Macro only), and the grammar KEYWORD forms - // (`using namespace ns;` / `using enum E;`) are dropped here at capture time, where the - // query predicate a tags pattern cannot express IS enforceable (see the helper's note). - const bool isImportRef = ( refCapSv == "reference.import" ); - if( isImportRef && usingDeclarationIsDirective( roleNode ) ) - { - continue; - } - - // family 4 / slice 4a: a @reference.mixin capture is Ruby's `include`/`extend`/`prepend` — the shape - // lives in queries/ruby/tags.scm, so the capture IS the language gate and no Lang:: branch is spent - // here. The two guards a tags pattern cannot state (the directive's TEXT, and its POSITION) live in - // the Ruby reader, ingest_ruby.h emitCapturedRubyMixinBase, which takes the language from this call - // site and EXPECTS Ruby: Ruby is the capture's only emitter today, and a second language adds its own - // reader and dispatch here rather than reusing Ruby's. The directive's own CALL reference is a - // separate match, below. - if( refCapSv == "reference.mixin" ) - { - emitCapturedRubyMixinBase( roleNode, nameNode, fileId, le.lang, src, refs ); - continue; - } - - // #446: a @reference.base capture is a base-clause type on the class-def path — - // queries//tags.scm names the clause's type node, so the capture IS the language - // gate. The clause's parent is the class node (emitBaseRef's `self`), the same pairing - // the captureBases walk passed; C++ is the first language on this capture. - if( refCapSv == "reference.base" ) - { - emitBaseRef( nameNode, fileId, le.lang, src, refs, parentOf( roleNode ) ); - continue; - } - - RawRef r; - r.fileId = fileId; - r.startByte = ts_node_start_byte( roleNode ); - r.line = ts_node_start_point( roleNode ).row + 1; // ABS-3: 1-based use-site line for --uses - r.lang = le.lang; - // ABS-3: @reference.call is a call use-site; @reference.import a using-decl re-export. EDGE-PRELUDE-VETO: @reference.macro is a macro - // invocation the grammar spells as one (Rust `name!(..)`): role Macro, so it binds only to an indexed macro of the name (graph.h). - r.role = isImportRef ? RefRole::Import : ( refCapSv == "reference.macro" ? RefRole::Macro : RefRole::Call ); - r.name = finalSegment( nameTxt ); - if( le.lang == Lang::Clojure ) - { - r.qualifier = nodeFieldText( parentOf( nameNode ), NodeField::Namespace, src ); - } - if( le.lang == Lang::Elixir ) - { - r.qualifier = elixir.scopeOf( roleNode ); - if( refCapSv == "reference.attribute" ) - { - r.role = RefRole::Read; r.name = "@" + std::string( nameTxt ); - refs.push_back( std::move( r ) ); - continue; - } - const TSNode target = fieldChild( roleNode, NodeField::Target ); - if( !ts_node_is_null( target ) && kindIs( ts_node_type( target ), "dot" ) ) - { - const TSNode receiver = fieldChild( target, NodeField::Left ); - r.qualifier = elixir.moduleOf( receiver, roleNode ); - if( r.qualifier.empty() ) { continue; } - // `__MODULE__` spelled, or an alias of it (`alias __MODULE__, as: Current`): the receiver names the - // enclosing module, and the reference is re-attributed per implementation of a multi-target defimpl - r.recv = nodeTextOf( receiver, src ).starts_with( "__MODULE__" ) || elixir.selfRelativeAlias( receiver, roleNode ) - ? RecvKind::ElixirSelfModule : RecvKind::ElixirModule; - } - auto [ count, known ] = elixirCallArity( roleNode, nameNode, src ); - if( refCapSv == "reference.operator" ) { count = elixirNodeIs( roleNode, "binary_operator" ) ? 2 : 1; known = true; } - if( !known ) { continue; } - r.argCount = count; r.argCountKnown = true; - r.name = elixirFunctionName( nameTxt, count ); - } - else if( le.lang == Lang::Ruby && rubyCallIsAssignmentTarget( nameNode ) ) - { - r.name.push_back( '=' ); // `obj.name = v` calls `name=`, never the getter `name` (test/rubysettercheck.sh) - } - std::string rustWritten; // RULE3-MEMBER-GUARD fix 4: a Rust path call's qualifier as written, when longer than one segment - if( le.lang == Lang::Cpp ) - { - r.qualifier = qualifierOf( nameNode, src ); // `A::b()` → "A" (E#4 canonical resolve) - // #150: the FULL written chain's root, BEFORE the H4 re-split below overwrites r.qualifier - // with the immediate segment only (`std::ranges::move` loses "std", keeps "ranges") — see - // Reference::qualifierRootsStd and graph.h::keepStdQualifiedCandidates. - r.qualifierRootsStd = cppQualifiedChainRootsStd( nameNode, src ); - cppResplitRefName( r, nameTxt ); // H4 RE-SPLIT at 3+ segments, operator tails, `template` disambiguator - } - else if( langFacts( le.lang ).bangMacros && r.role == RefRole::Macro ) - { - // RUST-MACRO-PATH: `crate::m!`, `axum_core::m!`, `serde_json::json!`: the written path, which graph.h requires to prove the macro - const TSNode parent = parentOf( nameNode ); - if( !ts_node_is_null( parent ) && kindIs( ts_node_type( parent ), "scoped_identifier" ) ) - { - std::string qualifier; - rustMacroPathOf( nodeTextOf( fieldChild( parent, NodeField::Path ), src ), qualifier, rustWritten ); - r.qualifier = qualifier; - } - } - else if( le.lang == Lang::Rust ) - { - r.qualifier = rustQualifierOf( nameNode, src ); // H4: `Widget::new()` → "Widget" - if( r.role == RefRole::Call ) - { - rustWritten = rustWrittenQualifier( nameNode, src ); // the whole written qualifier, set below once the receiver fields are - } - } - - if( !isImportRef && le.lang != Lang::Elixir ) // an import site has no receiver and no argument list — - { // the defaults (RecvKind::None, argCountKnown=false) are the truth - // FE-B: a Java method INVOCATION reads its receiver like every other language (a member call or a bare - // implicit-this call); only a method REFERENCE (`T::m`) keeps issue #74's type-candidate shape. - const bool javaMethodRef = le.lang == Lang::Java && !ts_node_is_null( roleNode ) && kindIs( ts_node_type( roleNode ), "method_reference" ); - RecvShape rs = javaMethodRef - ? javaMethodReferenceReceiver( roleNode, src ) - : receiverOf( nameNode, le.lang, src ); // P2-D: `this`/`self`/`x`/`base.field` shape - r.recv = rs.kind; r.recvVar = rs.var; // → one-hop narrowing in resolve.h - r.setFieldName( std::move( rs.field ) ); // depth-2 intermediate field; "" otherwise - r.viaArrow = rs.viaArrow; // `p->m()`: Rule 2b's smart-pointer pointee needs it - r.memberCall = rs.member; r.memberRoot = rs.root; // FE-A: a Go/JS/TS/Rust member call and its receiver root - r.setMemberPath( std::move( rs.path ) ); r.setMemberCtor( std::move( rs.ctor ) ); // FE-B: the rest of that receiver chain - if( le.lang == Lang::Ruby && r.recv == RecvKind::NamedVar ) - { - r.setFieldName( rubyReceiverWrittenPath( nameNode, r.recvVar, src ) ); // parser version 137: a constant's path as written - } - auto [ ac, ak ] = callArity( nameNode, le.lang, src ); // B2.2: call-site positional arg count - r.argCount = ac; r.argCountKnown = ak; // → arity filter in graph.h - if( langFacts( le.lang ).trailingLambdaScopeFns ) - { - r.trailingLambda = kotlinTrailingLambda( roleNode ); // #155: `x.run { }` / `with( x ) { }` — graph.h FalseEdgeRules' Kotlin arm - } - if( !rustWritten.empty() ) - { - r.setFieldName( std::move( rustWritten ) ); // a Rust path call's whole written qualifier (model.h Reference::fieldName) - } - if( isQueueLang( le.lang ) && isQueueCallName( r.name ) ) - { - if( const std::uint8_t kw = callKeywords( nameNode, src ); kw != 0 ) - { - r.setComposeRel( pyKwTag( kw ) ); // a queue call's keywords, for QueueHops (model.h pyKwTag) - } - } - } - refs.push_back( std::move( r ) ); + captureTagsMatch( pass, m ); } } } @@ -2815,36 +3138,9 @@ void captureTagsFacts( TSQueryCursor* cursor, const LangEntry& le, std::uint32_t if( le.lang == Lang::Elixir ) { elixirExpandImplementations( elixir, defs, firstDefOfFile, binds, firstBindOfFile ); } foldFieldDefs( defs, firstDefOfFile, le.lang ); // member-variable round: owner-less fields drop, Python fields fold to one per (class, name) - // Parser version 121 (test/rubyattrscheck.sh): the Ruby attr family's Var defs. Appended after the - // dead/field folds — neither touches Ruby (no preprocessor; Var is not a Field kind) — and inside the - // same defs window, so the lex build and cache round-trip treat these defs like captured ones. - // Parser version 130 (test/rubybarecallcheck.sh): Ruby's bare-word calls, by Ruby's own local rule, into the - // same refs window — the tags query cannot tell a bare call from a local read (both are an (identifier)). - // Parser version 132 (test/rubytypedrecvcheck.sh): the same walk types each call receiver the file builds, written - // into the call references this window holds; and FactoryBot's factory definitions, into binds. - // Parser version 135 (test/rubyrakejbuildercheck.sh): `helper_method` declarations into binds, and a Jbuilder - // template's `json` — a local, typed JbuilderTemplate — in the refs window. - // Parser version 137 (test/rubyclassrecvcheck.sh): the accessors a `class << self` declares, into binds as singleton - // methods — beside each singleton def, which the def capture above notes. - // Parser version 145 (test/rubyclassrecvcheck.sh): the mixins the class object's lookup reaches — an `extend`, an - // `include` in `class << self` — into binds, beside the inherit reference each mixin already is. if( le.lang == Lang::Ruby ) { - captureRubyDefs( root, fileId, src, defs ); // #339: the Definitions-only walker (attr defs + rendered db/schema.rb columns) - if( !full ) - { - return; // TagsCapture::DefinitionsOnly: the passes below write references and binds only - } - captureRubyBareCalls( root, fileId, src, refs ); - captureRubyFactories( root, fileId, src, binds ); - captureRubyHelperMethods( root, fileId, src, binds ); - captureRubySingletonAccessors( root, fileId, src, binds ); - captureRubyClassMixins( root, fileId, src, binds ); - captureRubyMainMixins( root, fileId, src, binds ); - if( le.ext == kJbuilderExt ) - { - typeRubyJbuilderLocal( fileId, refs ); - } + captureRubyFilePasses( pass ); } } From 48c3e38db100ab11be67705bdcc28e5a5d6701b4 Mon Sep 17 00:00:00 2001 From: joyful-ii-V-I <210578314+joyful-ii-V-I@users.noreply.github.com> Date: Sat, 21 Nov 2026 12:47:02 -0500 Subject: [PATCH 17/44] refactor(ingest): the declarator climb's stop set and wrapper test read through rw::isOneOf qd-range named the two extracted kindIs chains shape clones of isFunctionBoundaryKind and isRubyConstantNode; as tables they are what they are, a set lookup (the climb runs per body-less definition, not per node). Co-Authored-By: Claude Opus 5.5 --- src/ingest_sidecap.h | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/src/ingest_sidecap.h b/src/ingest_sidecap.h index 7473a6980..6e5690e1e 100644 --- a/src/ingest_sidecap.h +++ b/src/ingest_sidecap.h @@ -2233,18 +2233,17 @@ inline bool adoptTestMacroBlock( const TagsPass& pass, TagsMatch& m, DefCodeNode // class_specifier and wrongly grab the whole CLASS body as its span — corrupting spans + ref attribution) — and a C-family // function BODY: a block-scope `Type v(args);` (most-vexing-parse) must not climb up and steal its enclosing function's span. A // real function definition's declarator parents directly to function_definition (found at hop 1), so that never fires for it. -inline bool isDeclaratorClimbStop( const char* pt ) noexcept -{ - return kindIs( pt, "class_specifier" ) || kindIs( pt, "struct_specifier" ) - || kindIs( pt, "field_declaration_list" ) || kindIs( pt, "declaration_list" ) - || kindIs( pt, "namespace_definition" ) || kindIs( pt, "enum_specifier" ) - || kindIs( pt, "translation_unit" ) || kindIs( pt, "source_file" ) // Swift top - || kindIs( pt, "class_body" ) || kindIs( pt, "protocol_body" ) // Swift type bodies - || kindIs( pt, "enum_class_body" ) - || kindIs( pt, "class_interface" ) || kindIs( pt, "class_implementation" ) // ObjC - || kindIs( pt, "implementation_definition" ) || kindIs( pt, "protocol_declaration" ) - || kindIs( pt, "compound_statement" ) || kindIs( pt, "block" ); -} +inline constexpr std::string_view kDeclaratorClimbStops[] = { + "class_specifier", "struct_specifier", + "field_declaration_list", "declaration_list", + "namespace_definition", "enum_specifier", + "translation_unit", "source_file", // Swift top + "class_body", "protocol_body", // Swift type bodies + "enum_class_body", + "class_interface", "class_implementation", // ObjC + "implementation_definition", "protocol_declaration", + "compound_statement", "block", +}; // What the declarator climb found: the span to adopt (null: keep the capture's own), the body it owns, and whether the role node // is a body-less C/C++ type specifier in a function's signature (a type use, never a definition). @@ -2258,8 +2257,7 @@ struct DeclaratorClimb // At a scope stop: the member/decl wrapper the climb came up through (a prototype's span, so the RETURN TYPE is included), else null. inline TSNode declarationWrapperOrNull( TSNode child ) noexcept { - const char* ct = ts_node_type( child ); - return kindIs( ct, "field_declaration" ) || kindIs( ct, "declaration" ) ? child : TSNode{}; + return isOneOf( ts_node_type( child ), { "field_declaration", "declaration" } ) ? child : TSNode{}; } // At the first ancestor owning a body: adopt it when the role node is its signature (outside the body) and not a body-less type @@ -2303,7 +2301,7 @@ inline DeclaratorClimb climbDeclaratorToDefinition( TSNode roleNode, bool bodyle TSNode p = parentOf( roleNode ); for( int guard = 0; !ts_node_is_null( p ) && guard < 4; ++guard ) { - if( isDeclaratorClimbStop( ts_node_type( p ) ) ) + if( isOneOf( ts_node_type( p ), kDeclaratorClimbStops ) ) { return DeclaratorClimb{ .span = declarationWrapperOrNull( child ) }; } From d1ae284fd4af58b95afad00ff72d5e0bc900d7da Mon Sep 17 00:00:00 2001 From: joyful-ii-V-I <210578314+joyful-ii-V-I@users.noreply.github.com> Date: Sat, 21 Nov 2026 12:52:22 -0500 Subject: [PATCH 18/44] refactor(ingest): langidentity ceiling 321 -> 317 (captureTagsFacts' Elixir arms ask the language once) Co-Authored-By: Claude Opus 5.5 --- test/langidentity/ratchet.tsv | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/langidentity/ratchet.tsv b/test/langidentity/ratchet.tsv index 6452c2e66..8cccd6c1c 100644 --- a/test/langidentity/ratchet.tsv +++ b/test/langidentity/ratchet.tsv @@ -23,7 +23,9 @@ # 324 -> 321 (train ge2, the composed tree): qd-unchecked-status + qd-unhandled-arm added two C-family predicates (the enum table's # Cpp/C filter, the C scanner branch) and the composed tree counted 326; quality.h defectSitesOf and cFamilyEnumTable now read # langfacts.h's DefectScan column, so all six defect-shape language tests (four of them main's) left the count. -ceiling 321 +# 321 -> 317 (GE-CAPTURETAGS): captureTagsFacts' three Elixir capture filters and its three Elixir definition-name arms each ask +# the language once, in a named step (ingest_sidecap.h keepLanguageCapture, nameDefinition). +ceiling 317 perlang ingest_elixir.h perlang elixir_resolve.h perlang ingest_clojure.h From 61c19e87aeb8abcce4a83e8797cc4897a255759a Mon Sep 17 00:00:00 2001 From: joyful-ii-V-I <210578314+joyful-ii-V-I@users.noreply.github.com> Date: Sat, 21 Nov 2026 15:50:37 -0500 Subject: [PATCH 19/44] refactor(ingest): captureTagsFacts decides a definition's identity once; one writer per field, one drop protocol Round 2 of the captureTagsFacts great-engineer pass (blind review's top 3): - definitionIdentityOf decides a definition's name and kind before the arms run, in one place: the C++ out-of-line re-seat, the macro-annotation rename, the test-macro title, Clojure's head shape and Elixir's attribute -> Var. TagsMatch is immutable after readTagsMatch. The macro-invocation call site is its own step (emitMacroInvocationCall). - Each RawDef field has one writer: extent (with the annotation rename's start and loc), complexity, parameters (rename and Elixir arityExact included), and the pure indexedNameOf / definitionScopeOf, whose results captureDefinition writes. The Elixir head binds and defdelegate call leave the scope step for emitElixirHeadFacts. - One drop protocol: CaptureFate {Keep, Drop, Emitted} for every step that can end a match. optional is gone. captureTagsMatch documents the order it depends on. The read-only file facts (TagsFile) are split from the output sinks (TagsSinks&), so a signature shows whether the step emits. Byte-identical: every fact is decided as before. Co-Authored-By: Claude Opus 5.5 --- src/ingest_sidecap.h | 983 +++++++++++++++++++++++-------------------- 1 file changed, 528 insertions(+), 455 deletions(-) diff --git a/src/ingest_sidecap.h b/src/ingest_sidecap.h index 6e5690e1e..4a585990b 100644 --- a/src/ingest_sidecap.h +++ b/src/ingest_sidecap.h @@ -1865,25 +1865,6 @@ inline SymKind renamedAnnotationKind( TSNode name ) noexcept return member ? SymKind::Method : SymKind::Function; } -// MACRO-P1: a renamed annotation definition's facts that are the real function's, not the macro's: the parameter list in it is -// the ANNOTATION's (`( mu_ )`), the real one was the empty `()` emptyCallInitName requires, and its span and rows start at -// the real function's own declaration. No-op when nothing was renamed. -inline void applyAnnotationRename( RawDef& d, const AnnotationRename& renamed, TSNode defNode ) noexcept -{ - if( ts_node_is_null( renamed.name ) ) - { - return; - } - d.params = 0; - d.paramsMin = 0; - d.arityExact = 1; - if( !ts_node_is_null( renamed.start ) ) - { - d.startByte = ts_node_start_byte( renamed.start ); - d.loc = ts_node_end_point( defNode ).row - ts_node_start_point( renamed.start ).row + 1u; - } -} - // The two postures of one tags pass. Full: every fact the index keeps. DefinitionsOnly (definitionLinesInBlobs, --whereis on // other refs): the SAME definitions — every step that decides a definition's existence, name, line, kind or scope runs // unchanged — without the work only references, imports and metrics read: the @reference arm, @import emission, @@ -1895,51 +1876,64 @@ inline void applyAnnotationRename( RawDef& d, const AnnotationRename& renamed, T enum class TagsCapture : std::uint8_t { Full, DefinitionsOnly, DefinitionsAndShape }; // ── captureTagsFacts, as named steps (GE-CAPTURETAGS) ──────────────────────────────────────────────────────────────────────── -// One file's pass state (TagsPass), one match's captures read once into a TagsMatch (readTagsMatch), then the capture-time drop -// decisions in order (captureTagsMatch) and the definition or reference arm (captureDefinition / captureReference), each a -// sequence of named steps. Every step runs in the order the single loop body ran it; the outputs are byte-identical. +// One file's facts (TagsFile, read-only) and its output sinks (TagsSinks: a step whose signature takes them emits; one that does +// not is a pure reader). readTagsMatch reads one match's captures ONCE into an immutable TagsMatch; definitionIdentityOf decides a +// definition's name and kind ONCE into an immutable DefIdentity; captureTagsMatch runs the capture-time drop rules in their +// load-bearing order (its own comment lists it); then the definition arm writes each RawDef field in exactly one step, and the +// reference arm qualifies one RawRef. Every fact is decided as the single loop body this replaced decided it: byte-identical output. -// One file's tags pass: the facts every match reads and the sinks it appends to. Built once per file by captureTagsFacts. -struct TagsPass +// One file's facts, read by every step. Nothing here is written during the pass. +struct TagsFile +{ + const LangEntry& le; + std::uint32_t fileId; + std::string_view src; + TSNode root; + const ElixirContext& elixir; // Elixir's per-file module/alias/keyword tables (prepared before the match loop) + std::string_view fileStem; // the name of a bare `module.exports = ` (JS) + bool full; // TagsCapture::Full: references, imports and the def arm's IS-A / HAS-A / macro-body edges too + bool shape; // the callables' cc_walk facts (Full or DefinitionsAndShape) + bool fileHasError; // extent honesty: the recovered-bit walk (parseRecoveredBits) only exists in a file the parser had to recover +}; + +// Where the pass writes. A step that takes a TagsSinks& may append to these; no other step can. +struct TagsSinks { - const LangEntry& le; - std::uint32_t fileId; - std::string_view src; - TSNode root; std::vector& defs; std::vector& refs; std::vector& binds; std::vector& includes; - ExtractShortfall& shortfall; - ElixirContext& elixir; - std::string_view fileStem; // the name of a bare `module.exports = ` (JS) - bool full; // TagsCapture::Full: references, imports and the def arm's IS-A / HAS-A / macro-body edges too - bool shape; // the callables' cc_walk facts (Full or DefinitionsAndShape) - bool fileHasError; // extent honesty: the recovered-bit walk (parseRecoveredBits) only exists in a file the parser had to recover + ExtractShortfall& shortfall; // a capture the pass could not read whole says so here }; -// What one tags match captured. A tags pattern yields one @definition/@reference node plus a child @name: the role capture sets -// kind, the capture's name and roleNode; the @name capture sets the four name facts, and every later re-seat (C++ declarator, -// macro annotation, test-macro title) moves all four at once. +// What a step decided about the match — the ONE drop protocol of this pass. Every step that can end a match returns a fate, and +// its caller stops at the first one that is not Keep. Drop: the match writes nothing more. Emitted: the step wrote the match's own +// fact, and nothing more follows. +enum class CaptureFate : std::uint8_t { Keep, Drop, Emitted }; + +// What one tags match captured, read once by readTagsMatch and never written after. A tags pattern yields one +// @definition/@reference node plus a child @name. struct TagsMatch { - SymKind kind = SymKind::Other; + SymKind kind = SymKind::Other; // the role capture's kind, as the query spelled it (a definition's final kind: DefIdentity) bool isDef = false; bool isRef = false; std::string_view defCap; // the @definition capture's name — dropGatedCapture keys the constant/cjsexport/protomethod gates on it std::string_view refCap; // the @reference capture's name — "reference.import" routes the using-declaration role (r9 loss bucket 1) TSNode roleNode {}; - DefNameFacts name {}; // the @name identifier: its node (for C++ scope/qualifier, E#4), text, start byte and 0-based row + DefNameFacts name {}; // the @name identifier as captured: its node, text, start byte and 0-based row bool keywordHead = false; // #355: the pattern carried @_keyword, a head its tags.scm predicates accepted bool hasRole() const noexcept { return isDef || isRef; } bool hasName() const noexcept { return !ts_node_is_null( name.node ); } - void reseatName( TSNode node, std::string_view text ) noexcept - { - name = DefNameFacts{ node, text, ts_node_start_byte( node ), ts_node_start_point( node ).row }; - } }; +// The four name facts of `node`, spelled `text`. +inline DefNameFacts nameFactsAt( TSNode node, std::string_view text ) noexcept +{ + return DefNameFacts{ node, text, ts_node_start_byte( node ), ts_node_start_point( node ).row }; +} + // A C++ conversion operator's declarator is an `operator_cast` node whose text spans the WHOLE `operator () const` (the // tags query captures the declarator itself — there is no sub-node spanning just `operator bool`). Its name ends at the end of // the `type` field, so the symbol name is `operator bool` / `operator MyType`, not the param list. Symbolic ops @@ -1976,15 +1970,15 @@ inline DefNameFacts capturedNameOf( TSNode node, std::string_view src ) noexcept // #358: an `@import.*` capture, emitted here in capture order, not in a second pass. Matches arrive by start byte and captures // within a match in query order, so a staging vector would produce the identical order while costing an allocation and a drain // block. `import.names` / `import.alias` are one clause's target and its optional alias, paired once the match is read. -inline void noteImportCapture( const TagsPass& pass, std::string_view capSv, TSNode node, TSNode& importNames, TSNode& importAlias ) +inline void noteImportCapture( const TagsFile& file, TagsSinks& sinks, std::string_view capSv, TSNode node, TSNode& importNames, TSNode& importAlias ) { - if( !pass.full ) + if( !file.full ) { return; } if( capSv == "import.path" ) { - emitCapturedImport( node, pass.fileId, pass.le.lang, pass.src, pass.includes, pass.refs, pass.shortfall ); + emitCapturedImport( node, file.fileId, file.le.lang, file.src, sinks.includes, sinks.refs, sinks.shortfall ); } else if( capSv == "import.names" ) { @@ -1998,7 +1992,7 @@ inline void noteImportCapture( const TagsPass& pass, std::string_view capSv, TSN // Walk one match's captures into a TagsMatch: the role node and its capture, the name, the keyword head. The match's imports are // emitted on the way (noteImportCapture), and its import clause's bind (emitCapturedImportBind) after the walk. -inline TagsMatch readTagsMatch( const TagsPass& pass, TSQuery* query, const TSQueryMatch& match ) +inline TagsMatch readTagsMatch( const TagsFile& file, TagsSinks& sinks, TSQuery* query, const TSQueryMatch& match ) { TagsMatch m; TSNode importNames {}; @@ -2037,7 +2031,7 @@ inline TagsMatch readTagsMatch( const TagsPass& pass, TSQuery* query, const TSQu case CapRole::NameOnly: { - if( const DefNameFacts name = capturedNameOf( cap.node, pass.src ); !ts_node_is_null( name.node ) ) + if( const DefNameFacts name = capturedNameOf( cap.node, file.src ); !ts_node_is_null( name.node ) ) { m.name = name; } @@ -2049,73 +2043,126 @@ inline TagsMatch readTagsMatch( const TagsPass& pass, TSQuery* query, const TSQu case CapRole::Import: { - noteImportCapture( pass, capSv, cap.node, importNames, importAlias ); + noteImportCapture( file, sinks, capSv, cap.node, importNames, importAlias ); } break; } } if( !ts_node_is_null( importNames ) ) { - emitCapturedImportBind( importNames, importAlias, pass.fileId, pass.le.lang, pass.src, pass.binds ); + emitCapturedImportBind( importNames, importAlias, file.fileId, file.le.lang, file.src, sinks.binds ); } return m; } -// MACRO-P0 (ingest_names.h): a macro invocation read as a typeless declarator mints no definition of its own; the site is a -// call-shaped use of the macro (model.h retagMacroCallReferences makes it role="macro" when the #define is indexed and its name -// is uniquely a macro). No argument count: the "parameters" are macro arguments. MACRO-P1: when the grammar read the real -// function's own `f()` as a variable (ingest_names.h annotationRenamedName), this definition is the only one f gets — it -// carries f's name, from f's own start (`renamed`). false: the capture ends here (a macro use and nothing renamed behind it). -inline bool keepAfterMacroInvocation( const TagsPass& pass, TagsMatch& m, AnnotationRename& renamed ) +// A definition's identity: the name it is indexed under and its kind, decided once (definitionIdentityOf) and never written after. +struct DefIdentity +{ + DefNameFacts declarator {}; // the @name as declared — C++: the innermost name of a qualified out-of-line declarator (C1) + DefNameFacts name {}; // the name the definition is indexed under: the declarator, the real function behind a macro + // annotation (MACRO-P1) or a test macro block's title (LB-E) + SymKind kind = SymKind::Other; // the definition's kind: the capture's, or the renamed function's, Clojure's head shape, + // Var for an Elixir module attribute. Spans, metrics, scopes and edges read THIS kind; + // only the index row of an Elixir defimpl/defprotocol module shows another (elixirIndexedName) + AnnotationRename renamed {}; // MACRO-P1: the real function's name and start when a macro annotation hid it; null otherwise + bool macroUse = false; // MACRO-P0: the declarator is a macro invocation — a call site of the macro (emitMacroInvocationCall) + CaptureFate fate = CaptureFate::Keep; // Drop: mints no definition — a macro use with no function behind it, a test macro + // block without its parts (dropGatedCapture's own veto, guarded here, not asserted) +}; + +// Decide a definition's name and kind, in one place: +// - C1 (memgraph F1, ingest_names.h cppDefNameReseat): a C++ out-of-line definition is named by the innermost name of its +// qualified declarator. +// - MACRO-P0/P1 (ingest_names.h): a macro invocation read as a typeless declarator mints no definition of its own; when the grammar +// read the real function's own `f()` as a variable (annotationRenamedName), this definition is the only one f gets — it carries +// f's name and kind (renamedAnnotationKind), from f's own start. +// - LB-E testmacroblock: the def is TWO SIBLING nodes (testMacroBlockPartsOf); its name is the title literal (a display string). +// - Clojure: the kind is the head's shape (`defn`, `defmacro`, `defprotocol` …); Elixir: a module attribute (`@doc`, `@type`) is a Var. +// Pure: what a later step drops, it drops on these facts. +inline DefIdentity definitionIdentityOf( const TagsFile& file, const TagsMatch& m ) { - if( !cFamilyMacroInvocationCapture( m.defCap, pass.le.lang, m.name.text, m.roleNode, pass.src ) ) // defCap: set by a @definition capture only + const Lang lang = file.le.lang; + DefIdentity id; + id.kind = m.kind; + const DefNameFacts reseated = cppDefNameReseat( lang == Lang::Cpp, m.name.node, file.src ); // a null node: nothing to re-seat + id.declarator = ts_node_is_null( reseated.node ) ? m.name : reseated; + id.name = id.declarator; + id.macroUse = cFamilyMacroInvocationCapture( m.defCap, lang, id.declarator.text, m.roleNode, file.src ); + if( id.macroUse ) { - return true; + id.renamed = annotationRenamedName( m.roleNode, file.src ); + if( ts_node_is_null( id.renamed.name ) ) + { + id.fate = CaptureFate::Drop; + return id; + } + id.name = nameFactsAt( id.renamed.name, nodeTextOf( id.renamed.name, file.src ) ); + id.kind = renamedAnnotationKind( id.renamed.name ); + } + else if( m.defCap == "definition.testmacroblock" ) + { + const TestMacroBlockParts parts = testMacroBlockPartsOf( m.roleNode, file.src ); + if( !parts.ok ) + { + id.fate = CaptureFate::Drop; + return id; + } + id.name = nameFactsAt( parts.title, testMacroTitleOf( parts.title, file.src ) ); + } + else if( lang == Lang::Clojure ) + { + id.kind = clojureDefinitionShape( m.roleNode, file.src ).kind; + } + else if( lang == Lang::Elixir && m.defCap == "definition.attribute" ) + { + id.kind = SymKind::Var; + } + return id; +} + +// MACRO-P0: a macro invocation's site is a call-shaped use of the macro (model.h retagMacroCallReferences makes it role="macro" when +// the #define is indexed and its name is uniquely a macro). No argument count: the "parameters" are macro arguments. +inline void emitMacroInvocationCall( const TagsFile& file, TagsSinks& sinks, const TagsMatch& m, const DefIdentity& id ) +{ + if( !id.macroUse ) + { + return; } RawRef r; - r.fileId = pass.fileId; + r.fileId = file.fileId; r.startByte = ts_node_start_byte( m.roleNode ); r.line = ts_node_start_point( m.roleNode ).row + 1; - r.lang = pass.le.lang; + r.lang = file.le.lang; r.role = RefRole::Call; - r.name = m.name.text; - pass.refs.push_back( std::move( r ) ); - renamed = annotationRenamedName( m.roleNode, pass.src ); - if( ts_node_is_null( renamed.name ) ) - { - return false; - } - m.reseatName( renamed.name, nodeTextOf( renamed.name, pass.src ) ); - m.kind = renamedAnnotationKind( renamed.name ); - return true; + r.name = id.declarator.text; + sinks.refs.push_back( std::move( r ) ); } -// INDEX-ALIAS-CONST (src/aliasdef.h, the one alias reader): a C++ alias form is a definition unless it is function-local -// (ingest_relations.h insideFunctionBody: a function-local alias is a local name, the local-const rule). std::nullopt: the capture -// is dropped; form None: not an alias definition. -inline std::optional aliasShapeOfCapture( Lang lang, const TagsMatch& m ) +// INDEX-ALIAS-CONST (src/aliasdef.h, the one alias reader): a C++ alias form (`using X = Y;`, a namespace alias) is a definition. +inline bool isAliasDefinition( Lang lang, const TagsMatch& m ) noexcept { - if( !m.isDef || !langFacts( lang ).aliasTargetDefs || m.defCap != "definition.alias" ) + return m.isDef && langFacts( lang ).aliasTargetDefs && m.defCap == "definition.alias"; +} + +// INDEX-ALIAS-CONST: where an alias definition's written target starts when it ENDS the declaration (--defs to=), else 0 (a typedef, +// or no alias). The target is a suffix when every child after it is the `;` or a comment (`using X = Y /* c */ ;` keeps its target; +// the printer drops the comment, defslookup.h aliasTargetText); one cursor walk (infra/tschildren.h). Only `using`/namespace alias +// rows reach the walk (a typedef capture is never definition.alias). +inline std::uint32_t aliasTargetStartOf( const TagsFile& file, const TagsMatch& m ) +{ + if( !isAliasDefinition( file.le.lang, m ) ) { - return AliasShape{}; + return 0u; } - if( insideFunctionBody( m.roleNode ) ) + const AliasShape aliasShape = aliasShapeOf( Lang::Cpp, m.roleNode ); + if( aliasShape.form == AliasForm::None ) { - return std::nullopt; + return 0u; } - return aliasShapeOf( Lang::Cpp, m.roleNode ); -} - -// INDEX-ALIAS-CONST: where an alias's written target starts when it ENDS the declaration (--defs to=), else 0 (a typedef). The -// target is a suffix when every child after it is the `;` or a comment (`using X = Y /* c */ ;` keeps its target; the printer -// drops the comment, defslookup.h aliasTargetText); one cursor walk (infra/tschildren.h). Only `using`/namespace alias rows -// reach here (a typedef capture is never definition.alias). -inline std::uint32_t aliasTargetStartOf( TSNode roleNode, const AliasShape& aliasShape ) -{ const std::uint32_t tEnd = ts_node_end_byte( aliasShape.target ); bool suffix = true; - ChildCursor cursor( roleNode ); - forEachChild( roleNode, cursor.cur, [ & ]( TSNode c ) + ChildCursor cursor( m.roleNode ); + forEachChild( m.roleNode, cursor.cur, [ & ]( TSNode c ) { const char* k = ts_node_type( c ); suffix = ts_node_start_byte( c ) < tEnd || kindIs( k, ";" ) || kindIs( k, "comment" ); @@ -2124,82 +2171,76 @@ inline std::uint32_t aliasTargetStartOf( TSNode roleNode, const AliasShape& alia return suffix ? ts_node_start_byte( aliasShape.target ) : 0u; } -// Elixir's capture filters a tags pattern cannot state: elixirKeepCapture's syntax filters; a bare name is a call only off a pipe -// (bare pipe targets have their own capture) and past lexical variable exclusion; the special-form operators are no calls. -inline bool keepElixirCapture( const TagsPass& pass, const TagsMatch& m ) +// Elixir's capture filters a tags pattern cannot state, on the capture AS CAPTURED (its query kind): elixirKeepCapture's syntax +// filters; a bare name is a call only off a pipe (bare pipe targets have their own capture) and past lexical variable exclusion; +// the special-form operators are no calls. +inline CaptureFate elixirFilterFate( const TagsFile& file, const TagsMatch& m ) { - if( !elixirKeepCapture( m.roleNode, m.name.node, ElixirCaptureRole{ m.isDef, m.kind, m.keywordHead }, pass.src, pass.elixir.keywords ) ) + if( !elixirKeepCapture( m.roleNode, m.name.node, ElixirCaptureRole{ m.isDef, m.kind, m.keywordHead }, file.src, file.elixir.keywords ) ) { - return false; + return CaptureFate::Drop; } if( m.refCap == "reference.bare" ) { const TSNode parent = parentOf( m.name.node ); - const bool pipeTarget = elixirNodeIs( parent, "binary_operator" ) && nodeFieldText( parent, NodeField::Operator, pass.src ) == "|>" + const bool pipeTarget = elixirNodeIs( parent, "binary_operator" ) && nodeFieldText( parent, NodeField::Operator, file.src ) == "|>" && ts_node_eq( fieldChild( parent, NodeField::Right ), m.name.node ); - return !pipeTarget && pass.elixir.bareCall( m.name.node ); + return !pipeTarget && file.elixir.bareCall( m.name.node ) ? CaptureFate::Keep : CaptureFate::Drop; } if( m.refCap == "reference.operator" ) { constexpr std::string_view special[] = { "=", "<-", "\\\\", "::", "|>", "when", "|", "^", "&", "@" }; if( std::find( std::begin( special ), std::end( special ), m.name.text ) != std::end( special ) ) { - return false; + return CaptureFate::Drop; } - const TSNode parent = parentOf( m.roleNode ); - return !( m.name.text == "/" && elixirNodeIs( parent, "unary_operator" ) && nodeFieldText( parent, NodeField::Operator, pass.src ) == "&" ); + const TSNode parent = parentOf( m.roleNode ); + const bool capture = m.name.text == "/" && elixirNodeIs( parent, "unary_operator" ) && nodeFieldText( parent, NodeField::Operator, file.src ) == "&"; + return capture ? CaptureFate::Drop : CaptureFate::Keep; } - return true; + return CaptureFate::Keep; } -// The per-language capture filters (Elixir's, Clojure's); a Clojure definition's kind is its head's shape. -inline bool keepLanguageCapture( const TagsPass& pass, TagsMatch& m ) +// The per-language capture filters: Elixir's, and Clojure's (a definition needs a defining head, a reference must not be a special form). +inline CaptureFate languageFilterFate( const TagsFile& file, const TagsMatch& m ) { - if( pass.le.lang == Lang::Elixir ) + if( file.le.lang == Lang::Elixir ) { - return keepElixirCapture( pass, m ); + return elixirFilterFate( file, m ); } - if( pass.le.lang != Lang::Clojure ) + if( file.le.lang == Lang::Clojure && !clojureKeepCapture( m.roleNode, m.isDef, file.src ) ) { - return true; - } - if( !clojureKeepCapture( m.roleNode, m.isDef, pass.src ) ) - { - return false; - } - if( m.isDef ) - { - m.kind = clojureDefinitionShape( m.roleNode, pass.src ).kind; + return CaptureFate::Drop; } - return true; + return CaptureFate::Keep; } -// A capture inside an inert quote region: call/operator/named-capture candidates are kept as declined facts, never edges. Heads, -// special forms and non-call operators already failed their syntax filters. Bare AST names remain variable-shaped syntax unless -// they explicitly name a function capture. true: the capture was in such a region (consumed here). -inline bool consumeInertQuoteCapture( const TagsPass& pass, const TagsMatch& m ) +// A capture inside an inert quote region ends here: call/operator/named-capture candidates are kept as declined facts, never edges +// (Emitted); every other capture is dropped. Heads, special forms and non-call operators already failed their syntax filters. Bare +// AST names remain variable-shaped syntax unless they explicitly name a function capture. +inline CaptureFate inertQuoteFate( const TagsFile& file, TagsSinks& sinks, const TagsMatch& m ) { - if( !langFacts( pass.le.lang ).hasInertQuoteRegions || !elixirInert( m.roleNode, pass.src ) ) + if( !langFacts( file.le.lang ).hasInertQuoteRegions || !elixirInert( m.roleNode, file.src ) ) { - return false; + return CaptureFate::Keep; } const bool candidate = m.isRef && ( m.refCap == "reference.call" || m.refCap == "reference.operator" - || ( m.refCap == "reference.bare" && pass.elixir.namedCapture( m.name.node ) ) ); + || ( m.refCap == "reference.bare" && file.elixir.namedCapture( m.name.node ) ) ); if( !candidate ) { - return true; + return CaptureFate::Drop; } RawRef r; - r.fileId = pass.fileId; + r.fileId = file.fileId; r.startByte = ts_node_start_byte( m.roleNode ); r.line = m.name.row + 1; r.lang = Lang::Elixir; r.role = RefRole::Inert; - auto [ count, known ] = elixirCallArity( m.roleNode, m.name.node, pass.src ); + auto [ count, known ] = elixirCallArity( m.roleNode, m.name.node, file.src ); if( m.refCap == "reference.operator" ) { count = elixirNodeIs( m.roleNode, "binary_operator" ) ? 2 : 1; known = true; } r.name = known ? elixirFunctionName( m.name.text, count ) : std::string( m.name.text ); - pass.refs.push_back( std::move( r ) ); - return true; + sinks.refs.push_back( std::move( r ) ); + return CaptureFate::Emitted; } // Where a definition's code lives: the node its span covers, its body (null: a declaration), the function literal a name is bound @@ -2209,25 +2250,10 @@ struct DefCodeNodes TSNode defNode {}; TSNode body {}; TSNode literal {}; - bool testMacroBlock = false; // LB-E: the def is TWO SIBLING nodes (testMacroBlockPartsOf) + bool testMacroBlock = false; // LB-E: the def is TWO SIBLING nodes (testMacroBlockPartsOf): the macro statement and its block bool spanThroughBody = false; // the code this symbol owns lives in a SIBLING node: byte/row extents and complexity run through it }; -// LB-E testmacroblock: adopt the sibling compound_statement as the body and the title literal as the name BEFORE the shared -// span/complexity steps. The span's endByte and the loc row window run past defNode's own end (no single node covers both -// siblings). false: not a test macro block after all (dropGatedCapture already vetoed non-candidates — guard, don't assert). -inline bool adoptTestMacroBlock( const TagsPass& pass, TagsMatch& m, DefCodeNodes& span ) -{ - const TestMacroBlockParts parts = testMacroBlockPartsOf( m.roleNode, pass.src ); - if( !parts.ok ) - { - return false; - } - span.body = parts.body; - m.reseatName( parts.title, testMacroTitleOf( parts.title, pass.src ) ); - return true; -} - // The declarator climb's STOP set: a type/namespace/file scope — a function's body never lives above one of these, so reaching // one means the role node is a prototype/declaration with no body (without this, an in-class method declaration would climb into // class_specifier and wrongly grab the whole CLASS body as its span — corrupting spans + ref attribution) — and a C-family @@ -2262,7 +2288,7 @@ inline TSNode declarationWrapperOrNull( TSNode child ) noexcept // At the first ancestor owning a body: adopt it when the role node is its signature (outside the body) and not a body-less type // specifier; a body-less type specifier outside the body is a type use in the signature. -inline DeclaratorClimb bodyOwnerClimb( TSNode owner, TSNode ownerBody, TSNode roleNode, bool bodylessTypeSpec ) +inline DeclaratorClimb adoptBodyOwnerOrTypeUse( TSNode owner, TSNode ownerBody, TSNode roleNode, bool bodylessTypeSpec ) { const bool outsideBody = !spanContains( ownerBody, roleNode ); if( outsideBody && !bodylessTypeSpec ) @@ -2307,7 +2333,7 @@ inline DeclaratorClimb climbDeclaratorToDefinition( TSNode roleNode, bool bodyle } if( const TSNode pb = fieldChild( p, NodeField::Body ); !ts_node_is_null( pb ) ) { - return bodyOwnerClimb( p, pb, roleNode, bodylessTypeSpec ); + return adoptBodyOwnerOrTypeUse( p, pb, roleNode, bodylessTypeSpec ); } child = p; p = parentOf( p ); @@ -2357,84 +2383,110 @@ inline TSNode positionalBodyOf( Lang lang, TSNode defNode ) return body; } -// A definition's span and body. defBodyNodeOf = the `body:` field, PLUS the macro-edges round's one addition: a #define's -// replacement text (`value:` field) is adopted as a macro symbol's body, set before the climb so the climb is skipped for macros -// — PLUS a name bound to a function literal (kFnLiteralBinding): the literal's body, with `literal` the node params/cx/nest read -// from. Grammars whose @definition node already owns the body (class/struct/enum) don't climb. +// A definition's code nodes. defBodyNodeOf = the `body:` field, PLUS the macro-edges round's one addition: a #define's replacement +// text (`value:` field) is adopted as a macro symbol's body, set before the climb so the climb is skipped for macros — PLUS a name +// bound to a function literal (kFnLiteralBinding): the literal's body, with `literal` the node params/cx/nest read from. Grammars +// whose @definition node already owns the body (class/struct/enum) don't climb. LB-E: a test macro block's body is its sibling +// block, so it never climbs either. // // A Var's span is its own declaration — never climb. The climb exists to find a FUNCTION's body; for a var it can only steal a // container's span (a Ruby class-level constant's parent chain is body_statement → class, and class owns a "body" field, so the // climb would hand the constant THE WHOLE CLASS — the exact Rust-method span bug the H4 W3 note describes). No-op for every // pre-existing Var capture (Swift/C#/Go/Python parents hit a scope-stop or the file root before any "body"-owning ancestor — // verified byte-identical on the gate corpora). A Field's span is its own field_declaration / defining assignment — the Var rule, -// same reason. std::nullopt: the capture mints no definition (a test macro block without its parts, a type use in a signature). -inline std::optional definitionSpanOf( const TagsPass& pass, TagsMatch& m ) +// same reason. std::nullopt: no definition — a body-less C/C++ specifier in a function's signature is a type use. +inline std::optional definitionCodeOf( const TagsFile& file, const TagsMatch& m, const DefIdentity& id ) { - const Lang lang = pass.le.lang; - const DefBodyNodes own = lang == Lang::Elixir ? DefBodyNodes{ elixirBody( m.roleNode, pass.src ), {}, m.roleNode } - : defBodyNodeOf( m.roleNode, m.name.node, m.kind, lang ); - DefCodeNodes span; - span.defNode = own.span; - span.body = own.body; - span.literal = own.literal; - span.testMacroBlock = m.defCap == "definition.testmacroblock"; - if( span.testMacroBlock && !adoptTestMacroBlock( pass, m, span ) ) + const Lang lang = file.le.lang; + const DefBodyNodes own = lang == Lang::Elixir ? DefBodyNodes{ elixirBody( m.roleNode, file.src ), {}, m.roleNode } + : defBodyNodeOf( m.roleNode, id.name.node, id.kind, lang ); + DefCodeNodes code; + code.defNode = own.span; + code.body = own.body; + code.literal = own.literal; + code.testMacroBlock = m.defCap == "definition.testmacroblock"; + if( code.testMacroBlock ) { - return std::nullopt; + code.body = testMacroBlockPartsOf( m.roleNode, file.src ).body; // its parts were read whole: definitionIdentityOf } - if( ts_node_is_null( span.body ) && m.kind != SymKind::Var && m.kind != SymKind::Field && lang != Lang::Elixir ) + if( ts_node_is_null( code.body ) && id.kind != SymKind::Var && id.kind != SymKind::Field && lang != Lang::Elixir ) { const DeclaratorClimb climb = climbDeclaratorToDefinition( m.roleNode, isCFamilyTypeSpecifier( lang, m.roleNode ) ); if( climb.typeUseInSignature ) { - return std::nullopt; // a body-less C/C++ specifier in a function's signature: a type use, never a definition + return std::nullopt; } - span.defNode = ts_node_is_null( climb.span ) ? span.defNode : climb.span; - span.body = climb.body; + code.defNode = ts_node_is_null( climb.span ) ? code.defNode : climb.span; + code.body = climb.body; } // MACRO-P1: a prototype adopts its trailing annotation's definition body, its span running THROUGH that sibling - const TSNode ownBody = span.body; - span.body = annotatedSiblingBody( span.body, lang, m.kind, m.roleNode, pass.src ); - bool siblingBody = !ts_node_eq( span.body, ownBody ); - if( ts_node_is_null( span.body ) ) + const TSNode ownBody = code.body; + code.body = annotatedSiblingBody( code.body, lang, id.kind, m.roleNode, file.src ); + bool siblingBody = !ts_node_eq( code.body, ownBody ); + if( ts_node_is_null( code.body ) ) { - span.body = positionalBodyOf( lang, span.defNode ); + code.body = positionalBodyOf( lang, code.defNode ); } // Dart's body is a SIBLING of the signature, so neither defBodyNodeOf nor the climb can find it and the span would stop at the // signature — see dartFollowingBody (ingest_relations.h) for the measurement and for why an abstract member still comes back null. - if( ts_node_is_null( span.body ) && lang == Lang::Dart ) + if( ts_node_is_null( code.body ) && lang == Lang::Dart ) { - span.body = dartFollowingBody( span.defNode ); - siblingBody = !ts_node_is_null( span.body ); + code.body = dartFollowingBody( code.defNode ); + siblingBody = !ts_node_is_null( code.body ); } - span.spanThroughBody = span.testMacroBlock || siblingBody; - return span; + code.spanThroughBody = code.testMacroBlock || siblingBody; + return code; } -// The byte extents: the span (LB-E: through the sibling block), the name, the body. INDEX-ALIAS-CONST: a body-less alias row's -// target start rides bodyByte to the model, which moves it to IngestResult::aliasTargets and keeps the whole declaration as the -// signature (ingest_model.h rawDefIsAliasRow); 0 when the target is not a suffix. -inline void fillDefinitionExtent( RawDef& d, const DefCodeNodes& span, std::uint32_t nameByte, std::uint32_t aliasTargetStart ) noexcept +// The definition's extent — its byte span (LB-E: through the sibling block), name byte, body byte and line count (Q4 size smell: +// physical LOC = span line count). MACRO-P1: a renamed annotation definition's span and rows start at the real function's own +// declaration. INDEX-ALIAS-CONST: a body-less alias row's target start rides bodyByte to the model, which moves it to +// IngestResult::aliasTargets and keeps the whole declaration as the signature (ingest_model.h rawDefIsAliasRow); 0 when the target +// is not a suffix. +inline void fillDefinitionExtent( RawDef& d, const DefCodeNodes& code, const DefIdentity& id, std::uint32_t aliasTargetStart ) noexcept { - d.startByte = ts_node_start_byte( span.defNode ); - d.endByte = span.spanThroughBody ? ts_node_end_byte( span.body ) : ts_node_end_byte( span.defNode ); - d.nameByte = nameByte; - d.bodyByte = ts_node_is_null( span.body ) ? 0u : ts_node_start_byte( span.body ); - if( d.bodyByte == 0 && aliasTargetStart > d.startByte && aliasTargetStart < d.endByte ) + const std::uint32_t spanStart = ts_node_start_byte( code.defNode ); + const TSNode spanEnd = code.spanThroughBody ? code.body : code.defNode; + const TSNode realStart = ts_node_is_null( id.renamed.name ) ? TSNode{} : id.renamed.start; + d.endByte = ts_node_end_byte( spanEnd ); + d.nameByte = id.name.byte; + d.bodyByte = ts_node_is_null( code.body ) ? 0u : ts_node_start_byte( code.body ); + if( d.bodyByte == 0 && aliasTargetStart > spanStart && aliasTargetStart < d.endByte ) { d.bodyByte = aliasTargetStart; // INDEX-ALIAS-CONST: the transport only (ingest_model.h rawDefIsAliasRow) } + if( !ts_node_is_null( realStart ) ) + { + d.startByte = ts_node_start_byte( realStart ); + d.loc = ts_node_end_point( code.defNode ).row - ts_node_start_point( realStart ).row + 1u; + return; + } + const std::uint32_t startRow = ts_node_start_point( code.defNode ).row; + const std::uint32_t endRow = ts_node_end_point( spanEnd ).row; + d.startByte = spanStart; + d.loc = ( endRow >= startRow ) ? ( endRow - startRow + 1u ) : 1u; } -// A callable's cc_walk facts (complexityOf) onto its definition: all 0 off a callable, where complexityOf did not run. The narrower -// fields saturate on purpose — ppalt (model.h Symbol::ppAlt): a def past 65535 is beyond every triage threshold, and the attribute's -// claim ("the body carries alternatives") is already made at 1; the nesting profile (model.h Symbol::humps/deepLoc): deepLoc is a -// floor already, so a clamp there stays honest in the direction the attribute already claims; essential complexity (model.h -// Symbol::ev) is already saturated inside ev_finalize, 0 for non-function kinds and outside evCountedLang, matching the emitters' -// omission rule; QD-TANGLE's steering locals and dispatch share (model.h Symbol::steer, ::dispatchShare). -inline void fillDefinitionComplexity( RawDef& d, const Complexity& c ) noexcept +inline bool isCallableKind( SymKind kind ) noexcept { + return kind == SymKind::Function || kind == SymKind::Method; +} + +// A callable's cc_walk facts (complexityOf) onto its definition. complexityOf runs on a callable only (and only with `shape`); off a +// callable every fact is 0 — the zero Complexity below, which is what keeps ppAlt, maxNest, the nesting profile and ev absent on a +// type. LB-E: a test macro block's body SIBLING is where the code lives — complexityOf walks INSIDE its root node, so handing it +// defNode, the bare macro statement, would count nothing; a literal-bound name measures its LITERAL; every other def measures defNode. +// The narrower fields saturate on purpose — ppalt (model.h Symbol::ppAlt): a def past 65535 is beyond every triage threshold, and the +// attribute's claim ("the body carries alternatives") is already made at 1; the nesting profile (model.h Symbol::humps/deepLoc): +// deepLoc is a floor already, so a clamp there stays honest in the direction the attribute already claims; essential complexity +// (model.h Symbol::ev) is already saturated inside ev_finalize, 0 outside evCountedLang, matching the emitters' omission rule; +// QD-TANGLE's steering locals and dispatch share (model.h Symbol::steer, ::dispatchShare). +inline void fillDefinitionComplexity( RawDef& d, const TagsFile& file, const DefIdentity& id, const DefCodeNodes& code ) +{ + const TSNode measured = code.spanThroughBody ? code.body : ( ts_node_is_null( code.literal ) ? code.defNode : code.literal ); + const Complexity c = isCallableKind( id.kind ) && file.shape ? complexityOf( measured, file.src, file.le.lang ) + : Complexity{ 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, {}, 0u, 0u, 0u }; d.cx = c.cx; d.ccx = c.ccx; d.locals = c.locals; // Phase 1: floor count, C/C++ only (model.h localsCountedLang) — 0 elsewhere, never emitted there @@ -2459,64 +2511,61 @@ inline std::uint16_t definitionParamCount( Lang lang, TSNode defNode, TSNode met return lang == Lang::Clojure ? clojureParams( defNode, src ) : paramCountOf( metricNode, literalBound ); } -// The definition's shape: complexity (LB-E: a testmacroblock's body SIBLING is where the code lives — complexityOf walks INSIDE its -// root node, so handing it defNode, the bare macro statement, would count nothing; a literal-bound name measures its LITERAL; every -// other def measures defNode), Q4 size smells (SIZE = master variable: physical LOC = span line count; param count + max nesting -// for functions/methods only, 0 otherwise, absent in emit — all descriptive), the parameter shape, the in-file test-scope bit. -inline void fillDefinitionShape( const TagsPass& pass, RawDef& d, const TagsMatch& m, const DefCodeNodes& span, const AnnotationRename& renamed ) -{ - const Lang lang = pass.le.lang; - const bool fnOrMethod = ( m.kind == SymKind::Function || m.kind == SymKind::Method ); - const bool literalBound = !ts_node_is_null( span.literal ); - const TSNode metricNode = literalBound ? span.literal : span.defNode; - fillDefinitionComplexity( d, - fnOrMethod && pass.shape ? complexityOf( span.spanThroughBody ? span.body : metricNode, pass.src, lang ) - : Complexity{ 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, {}, 0u, 0u, 0u } ); - const std::uint32_t startRow = ts_node_start_point( span.defNode ).row; - const std::uint32_t endRow = ts_node_end_point( span.spanThroughBody ? span.body : span.defNode ).row; // LB-E: rows through the sibling block - d.loc = ( endRow >= startRow ) ? ( endRow - startRow + 1u ) : 1u; - d.params = fnOrMethod ? definitionParamCount( lang, span.defNode, metricNode, literalBound, pass.src ) : std::uint16_t( 0 ); - // LB-E: a testmacroblock's parameter surface is the MACRO's business, not visible here — claim inexact so the resolver's arity - // narrowing never trusts params=0 on a test-title symbol. B2.2: the fixed-arity bit and the minimum (fewest arguments a call can - // pass) come from ONE scan of the list. A minimum above the counted params (a literal-bound bare parameter countParams cannot - // see) is not trusted. - const ParamShape paramShape = ( fnOrMethod && !span.testMacroBlock && lang != Lang::Clojure ) ? cc_paramShape( metricNode, lang, m.kind, pass.src ) : ParamShape{}; - d.arityExact = paramShape.exact ? std::uint8_t( 1 ) : std::uint8_t( 0 ); - d.paramsMin = paramShape.minimum <= d.params ? paramShape.minimum : std::uint16_t( 0 ); - applyAnnotationRename( d, renamed, span.defNode ); // MACRO-P1: the real function's parameters and start, not the annotation's - // L8: the in-file test-scope bit, for EVERY kind (a `#[cfg(test)] mod` and a `class TestFoo` are themselves symbols, and dropping - // the members while keeping the shell would be a worse answer than either). Runs on defNode, whose ancestors are the enclosing scopes. - d.testScope = span.testMacroBlock ? std::uint8_t( 1 ) : std::uint8_t( inFileTestScope( span.defNode, pass.src, lang ) ); // LB-E: a test macro IS the in-file convention - d.kind = m.kind; - d.lang = lang; +// The definition's parameter surface: how many (functions/methods only, 0 otherwise, absent in emit), the fewest a call can pass +// and whether the count is exact (B2.2: one scan of the list). A minimum above the counted params (a literal-bound bare parameter +// countParams cannot see) is not trusted. LB-E: a test macro block's parameter surface is the MACRO's business, not visible here — +// claimed inexact so the resolver's arity narrowing never trusts params=0 on a test-title symbol. MACRO-P1: a renamed annotation +// definition's list is the ANNOTATION's (`( mu_ )`); the real one was the empty `()` emptyCallInitName requires. B2.2 for an Elixir +// def head: a clause's arity IS its parameter count (no variadic form), so `params` is call-comparable unless a `\\` default widens +// the callable to more than one arity; cc_paramShape's language gate leaves it at 0, which made every Elixir caller unflaggable by +// --edit-check (test/elixirnamearitycheck.sh arm C: run(x) -> run(x, y) must flag run(x) callers; run(x, y \\ 1) must flag none). +inline void fillDefinitionParameters( RawDef& d, const TagsFile& file, const TagsMatch& m, const DefIdentity& id, const DefCodeNodes& code ) +{ + if( !ts_node_is_null( id.renamed.name ) ) + { + d.params = 0; + d.paramsMin = 0; + d.arityExact = 1; + return; + } + const Lang lang = file.le.lang; + const bool callable = isCallableKind( id.kind ); + const bool literalBound = !ts_node_is_null( code.literal ); + const TSNode metricNode = literalBound ? code.literal : code.defNode; + const auto counted = callable ? definitionParamCount( lang, code.defNode, metricNode, literalBound, file.src ) : std::uint16_t( 0 ); + const ParamShape paramShape = ( callable && !code.testMacroBlock && lang != Lang::Clojure ) ? cc_paramShape( metricNode, lang, id.kind, file.src ) : ParamShape{}; + const bool elixirHead = lang == Lang::Elixir && m.keywordHead; + d.params = counted; + d.paramsMin = paramShape.minimum <= counted ? paramShape.minimum : std::uint16_t( 0 ); + d.arityExact = ( elixirHead ? elixirHeadDefaultCount( m.roleNode, file.src ) == 0 : paramShape.exact ) ? std::uint8_t( 1 ) : std::uint8_t( 0 ); } // An Elixir module attribute's definition name: a typed attribute (@type/@callback and kin) is named with its arity, any other // attribute is `@name`. -inline std::string elixirAttributeDefName( std::string_view attribute, const TagsMatch& m ) +inline std::string elixirAttributeDefName( std::string_view attribute, const DefNameFacts& name ) { if( !elixirTypedAttribute( attribute ) ) { - return "@" + std::string( m.name.text ); + return "@" + std::string( name.text ); } - const TSNode args = elixirArguments( parentOf( m.name.node ) ); + const TSNode args = elixirArguments( parentOf( name.node ) ); std::uint32_t arity = 0; for( std::uint32_t i = 0; !ts_node_is_null( args ) && i < ts_node_named_child_count( args ); ++i ) { arity += elixirNodeIs( ts_node_named_child( args, i ), "comment" ) ? 0u : 1u; } - return ( attribute == "callback" || attribute == "macrocallback" ? "@callback " : "@type " ) + elixirFunctionName( m.name.text, arity ); + return ( attribute == "callback" || attribute == "macrocallback" ? "@callback " : "@type " ) + elixirFunctionName( name.text, arity ); } -// `defimpl P, for: T` — the @name capture is just the protocol alias, but the module Elixir generates is `P.T`, which is what the -// impl's own defs carry as their scope. A protocol is an Interface, a module that defines a struct (or exception) a Struct. -inline SymKind elixirModuleKind( const TagsPass& pass, TSNode roleNode, const std::string& module ) +// The kind an Elixir defimpl/defprotocol module is INDEXED as: a protocol is an Interface, a module that defines a struct (or +// exception) a Struct, any other a Class. +inline SymKind elixirModuleKind( const TagsFile& file, TSNode roleNode, const std::string& module ) { - const SymKind kind = elixirTarget( roleNode, pass.src ) == "defprotocol" ? SymKind::Interface : SymKind::Class; - for( TSNode call : pass.elixir.calls ) + const SymKind kind = elixirTarget( roleNode, file.src ) == "defprotocol" ? SymKind::Interface : SymKind::Class; + for( TSNode call : file.elixir.calls ) { - const auto keyword = elixirTarget( call, pass.src ); - if( ( keyword == "defstruct" || keyword == "defexception" ) && pass.elixir.scopeOf( call ) == module ) + const auto keyword = elixirTarget( call, file.src ); + if( ( keyword == "defstruct" || keyword == "defexception" ) && file.elixir.scopeOf( call ) == module ) { return SymKind::Struct; } @@ -2524,49 +2573,76 @@ inline SymKind elixirModuleKind( const TagsPass& pass, TSNode roleNode, const st return kind; } -// Elixir's definition names: a static ExUnit title (interpolation was rejected by elixirKeepCapture), a module attribute, a -// generated module. false: a module with no name to give it. -inline bool nameElixirDefinition( const TagsPass& pass, RawDef& d, const TagsMatch& m ) +inline bool isExUnitTest( const TagsFile& file, const TagsMatch& m ) +{ + return file.le.lang == Lang::Elixir && elixirTarget( m.roleNode, file.src ) == "test"; +} + +// The name a definition is indexed under, and its kind there. Drop: the capture mints no row. +struct IndexedName +{ + std::string name; + SymKind kind = SymKind::Other; + CaptureFate fate = CaptureFate::Keep; +}; + +// An Elixir definition's index name and kind. A def head (#355: the match's own @_keyword capture, decided by tags.scm, not a C++ +// keyword list) is named with its arity (`f/2`, `params`); a static ExUnit title (interpolation was rejected by elixirKeepCapture) is +// `test `; a module attribute is elixirAttributeDefName's; a `defimpl P, for: T` — whose @name capture is just the protocol +// alias — is the module Elixir generates, `P.T`, which is what the impl's own defs carry as their scope (indexed as +// elixirModuleKind's kind; Drop when it has no name). Anything else keeps the capture's name. +inline IndexedName elixirIndexedName( const TagsFile& file, const TagsMatch& m, const DefIdentity& id, std::uint16_t params ) { - if( elixirTarget( m.roleNode, pass.src ) == "test" ) + const bool exUnitTest = isExUnitTest( file, m ); + const std::string_view attribute = exUnitTest ? std::string_view{} : elixirAttribute( m.roleNode, file.src ); + const bool generatedModule = !exUnitTest && attribute.empty() && id.kind == SymKind::Other; + std::string module = generatedModule ? file.elixir.moduleName( m.roleNode ) : std::string{}; + if( generatedModule && module.empty() ) { - d.name = "test " + std::string( m.name.text.substr( 1, m.name.text.size() - 2 ) ); - d.testScope = 1; - return true; + return IndexedName{ .fate = CaptureFate::Drop }; } - if( const std::string_view attribute = elixirAttribute( m.roleNode, pass.src ); !attribute.empty() ) + const SymKind kind = generatedModule ? elixirModuleKind( file, m.roleNode, module ) : id.kind; + if( m.keywordHead ) { - d.name = elixirAttributeDefName( attribute, m ); - return true; + return IndexedName{ elixirFunctionName( id.name.text, params ), kind }; } - if( m.kind != SymKind::Other ) + if( exUnitTest ) { - return true; + return IndexedName{ "test " + std::string( id.name.text.substr( 1, id.name.text.size() - 2 ) ), kind }; } - d.name = pass.elixir.moduleName( m.roleNode ); - if( d.name.empty() ) + if( !attribute.empty() ) { - return false; + return IndexedName{ elixirAttributeDefName( attribute, id.name ), kind }; } - d.kind = elixirModuleKind( pass, m.roleNode, d.name ); - return true; + return IndexedName{ generatedModule ? std::move( module ) : defNameFromCapture( Lang::Elixir, id.name.text ), kind }; } -// The definition's name: the capture's (LB-E: a test title is a display string — see testMacroTitleOf), the file's stem for the -// module's own CommonJS export function (lane js-def-naming, ingest_names.h isCjsModuleExportsItself), Elixir's own. false: the -// capture mints no row (no stem to name an anonymous export by, as before; an unnamed Elixir module). -inline bool nameDefinition( const TagsPass& pass, RawDef& d, const TagsMatch& m, bool testMacroBlock ) +// The definition's index name and kind: the identity's name (LB-E: a test title is a display string — see testMacroTitleOf), the +// file's stem for the module's own CommonJS export function (lane js-def-naming, ingest_names.h isCjsModuleExportsItself; Drop when +// there is no stem to name it by, as before), Elixir's own (elixirIndexedName). +inline IndexedName indexedNameOf( const TagsFile& file, const TagsMatch& m, const DefIdentity& id, const DefCodeNodes& code, std::uint16_t params ) { - d.name = testMacroBlock ? std::string( m.name.text ) : defNameFromCapture( pass.le.lang, m.name.text ); - if( m.defCap == "definition.cjsexport" && isCjsModuleExportsItself( m.name.node, pass.src ) ) + if( file.le.lang == Lang::Elixir ) { - if( pass.fileStem.empty() ) - { - return false; - } - d.name = std::string( pass.fileStem ); + return elixirIndexedName( file, m, id, params ); + } + if( m.defCap == "definition.cjsexport" && isCjsModuleExportsItself( id.name.node, file.src ) ) + { + return file.fileStem.empty() ? IndexedName{ .fate = CaptureFate::Drop } : IndexedName{ std::string( file.fileStem ), id.kind }; + } + return IndexedName{ code.testMacroBlock ? std::string( id.name.text ) : defNameFromCapture( file.le.lang, id.name.text ), id.kind }; +} + +// L8: the in-file test-scope bit, for EVERY kind (a `#[cfg(test)] mod` and a `class TestFoo` are themselves symbols, and dropping +// the members while keeping the shell would be a worse answer than either). Read on defNode, whose ancestors are the enclosing +// scopes. LB-E: a test macro IS the in-file convention; so is an ExUnit `test`. +inline std::uint8_t definitionTestScope( const TagsFile& file, const TagsMatch& m, const DefCodeNodes& code ) +{ + if( code.testMacroBlock || isExUnitTest( file, m ) ) + { + return 1; } - return pass.le.lang != Lang::Elixir || nameElixirDefinition( pass, d, m ); + return std::uint8_t( inFileTestScope( code.defNode, file.src, file.le.lang ) ); } // A FUNCTION bound inside another function's body records that function's span (ingest_names.h enclosingFunctionScope): graph.h @@ -2574,197 +2650,198 @@ inline bool nameDefinition( const TagsPass& pass, RawDef& d, const TagsMatch& m, // defNode climbed from its declarator (the role node) to the function_definition, which must not read as the function enclosing // itself; a multi-name binding's defNode narrowed to one declarator, whose declaration (the role node) holds no scope node and is // not a 20k-child list to rescan per name. -inline void noteEnclosingFunctionScope( const TagsPass& pass, RawDef& d, const TagsMatch& m, TSNode defNode ) +inline void noteEnclosingFunctionScope( RawDef& d, const TagsFile& file, const TagsMatch& m, const DefIdentity& id, TSNode defNode ) { - if( !pass.full || m.kind != SymKind::Function || bindsOutsideItsFunction( m.roleNode, pass.le.lang ) ) + if( !file.full || id.kind != SymKind::Function || bindsOutsideItsFunction( m.roleNode, file.le.lang ) ) { return; } const bool defIsOuter = ts_node_start_byte( defNode ) <= ts_node_start_byte( m.roleNode ) && ts_node_end_byte( defNode ) >= ts_node_end_byte( m.roleNode ); - const FnScope fnScope = enclosingFunctionScope( pass.root, defIsOuter ? defNode : m.roleNode ); + const FnScope fnScope = enclosingFunctionScope( file.root, defIsOuter ? defNode : m.roleNode ); d.fnScopeStart = fnScope.start; d.fnScopeEnd = fnScope.end; } -// `defdelegate f(x), to: M, as: g`: the delegating clause calls M.g with its own arity. -inline void emitElixirDelegate( const TagsPass& pass, const RawDef& d, const TagsMatch& m ) +// A C++ definition's canonical scope (E#4): out-of-line `A::b` → "A" (`Box<T>::grow` (primary) → "Box"; a specialization keeps +// its id), else the enclosing class/namespace. +inline std::string cppDefinitionScope( TSNode nameNode, std::string_view src ) { - RawRef delegated; - delegated.fileId = pass.fileId; delegated.startByte = d.startByte; delegated.line = d.line; - delegated.lang = pass.le.lang; delegated.recv = RecvKind::ElixirModule; - delegated.qualifier = pass.elixir.moduleOf( elixirKeywordValue( m.roleNode, "to:", pass.src ), m.roleNode ); - const auto as = nodeTextOf( elixirKeywordValue( m.roleNode, "as:", pass.src ), pass.src ); - delegated.name = elixirFunctionName( as.starts_with( ":" ) ? as.substr( 1 ) : m.name.text, d.params ); - delegated.argCount = d.params; delegated.argCountKnown = true; - if( !delegated.qualifier.empty() ) { pass.refs.push_back( std::move( delegated ) ); } + std::string scope = qualifierOfDefinition( nameNode, src ); + return scope.empty() ? enclosingScopeOf( nameNode, src ) : scope; } -// An Elixir definition's scope, and for a def head (#355: the match's own @_keyword capture, decided by tags.scm, not a C++ keyword -// list) its arity-qualified name. B2.2 for Elixir: a clause's arity IS its parameter count (no variadic form), so `params` is -// call-comparable unless a `\\` default widens the callable to more than one arity. cc_paramShape's language gate leaves this at 0, -// which made every Elixir caller unflaggable by --edit-check (test/elixirnamearitycheck.sh arm C: run(x) -> run(x, y) must flag -// run(x) callers; run(x, y \\ 1) must flag none). -inline void scopeElixirDefinition( const TagsPass& pass, RawDef& d, const TagsMatch& m ) +// The definition's scope, per language ("" where the language records none). +inline std::string definitionScopeOf( const TagsFile& file, const TagsMatch& m, const DefIdentity& id ) { - d.scope = m.kind == SymKind::Other ? std::string{} : pass.elixir.scopeOf( m.roleNode ); - if( !m.keywordHead ) + const Lang lang = file.le.lang; + if( lang == Lang::Cpp ) { - return; + return cppDefinitionScope( id.name.node, file.src ); + } + if( enumTableAt( kDefScopeWalkerOfLang, lang, DefScopeWalker::None ) != DefScopeWalker::None ) + { // Python, Go, Rust, Kotlin: the language's row in ingest_names.h kDefScopeWalkerOfLang + return defScopeOf( lang, id.name.node, file.src ); } - d.name = elixirFunctionName( m.name.text, d.params ); - d.arityExact = elixirHeadDefaultCount( m.roleNode, pass.src ) == 0 ? std::uint8_t( 1 ) : std::uint8_t( 0 ); - elixirDefinitionFacts( d, m.roleNode, pass.src, pass.binds, pass.elixir.keywords ); - if( elixirTarget( m.roleNode, pass.src ) == "defdelegate" ) + if( lang == Lang::Elixir ) { - emitElixirDelegate( pass, d, m ); + return id.kind == SymKind::Other ? std::string{} : file.elixir.scopeOf( m.roleNode ); + } + if( lang == Lang::Ruby ) + { // enclosing class/module → id= addressability, per-class overload sets, editCheckImplicitReceiver + return rubyEnclosingScopeOf( id.name.node, file.src ); // (test/rubyscopecheck.sh) + } + if( ( lang == Lang::JavaScript || lang == Lang::TypeScript ) && m.defCap == "definition.protomethod" ) + { // only the five built-in ctors: every Foo.prototype.bar gaining sc= would mint a new + // canonical id and move quality baselines (node lib/ has ~163 anonymous protomethods) + const std::string_view ctor = prototypeCtorName( id.name.node, file.src ); + return isJsTsBuiltinCtor( ctor ) ? std::string( ctor ) : std::string{}; } + return std::string{}; } -// A C++ definition's canonical scope (E#4): out-of-line `A::b` → "A", else the enclosing class/namespace. -inline void scopeCppDefinition( RawDef& d, TSNode nameNode, std::string_view src ) +// `defdelegate f(x), to: M, as: g`: the delegating clause calls M.g with its own arity. +inline void emitElixirDelegate( const TagsFile& file, TagsSinks& sinks, const RawDef& d, const TagsMatch& m, const DefIdentity& id ) { - d.scope = qualifierOfDefinition( nameNode, src ); // `Box<T>::grow` (primary) → "Box"; a specialization keeps its id - if( d.scope.empty() ) - { - d.scope = enclosingScopeOf( nameNode, src ); - } - // #150: is this def genuinely INSIDE namespace std, at ANY nesting depth — not just a def - // whose immediate scope happens to spell a segment std also uses? See Symbol::scopeRootsStd. - d.scopeRootsStd = cppDefinitionRootsStd( nameNode, src ) ? std::uint8_t( 1 ) : std::uint8_t( 0 ); + RawRef delegated; + delegated.fileId = file.fileId; delegated.startByte = d.startByte; delegated.line = d.line; + delegated.lang = file.le.lang; delegated.recv = RecvKind::ElixirModule; + delegated.qualifier = file.elixir.moduleOf( elixirKeywordValue( m.roleNode, "to:", file.src ), m.roleNode ); + const auto as = nodeTextOf( elixirKeywordValue( m.roleNode, "as:", file.src ), file.src ); + delegated.name = elixirFunctionName( as.starts_with( ":" ) ? as.substr( 1 ) : id.name.text, d.params ); + delegated.argCount = d.params; delegated.argCountKnown = true; + if( !delegated.qualifier.empty() ) { sinks.refs.push_back( std::move( delegated ) ); } } -// The definition's scope, per language. -inline void scopeDefinition( const TagsPass& pass, RawDef& d, const TagsMatch& m, TSNode defNode ) +// An Elixir def head's own facts, read off the finished definition: its callable (and default-arity) binds, and a defdelegate's call. +inline void emitElixirHeadFacts( const TagsFile& file, TagsSinks& sinks, const RawDef& d, const TagsMatch& m, const DefIdentity& id ) { - const Lang lang = pass.le.lang; - if( lang == Lang::Cpp ) + if( file.le.lang != Lang::Elixir || !m.keywordHead ) { - scopeCppDefinition( d, m.name.node, pass.src ); - } - else if( enumTableAt( kDefScopeWalkerOfLang, lang, DefScopeWalker::None ) != DefScopeWalker::None ) - { // Python, Go, Rust, Kotlin: the language's row in ingest_names.h kDefScopeWalkerOfLang - d.scope = defScopeOf( lang, m.name.node, pass.src ); + return; } - else if( lang == Lang::Elixir ) + elixirDefinitionFacts( d, m.roleNode, file.src, sinks.binds, file.elixir.keywords ); + if( elixirTarget( m.roleNode, file.src ) == "defdelegate" ) { - scopeElixirDefinition( pass, d, m ); - } - else if( lang == Lang::Ruby ) - { // enclosing class/module → id= addressability, per-class overload sets, editCheckImplicitReceiver - d.scope = rubyEnclosingScopeOf( m.name.node, pass.src ); // (test/rubyscopecheck.sh) - if( m.kind == SymKind::Method || m.kind == SymKind::Function ) - { - rubyNoteClassSideDef( defNode, pass.fileId, d.name, pass.src, pass.binds ); // a class object's method (test/rubyclassrecvcheck.sh) - } + emitElixirDelegate( file, sinks, d, m, id ); } - else if( ( lang == Lang::JavaScript || lang == Lang::TypeScript ) && m.defCap == "definition.protomethod" ) - { // only the five built-in ctors: every Foo.prototype.bar gaining sc= would mint a new - // canonical id and move quality baselines (node lib/ has ~163 anonymous protomethods) - const std::string_view ctor = prototypeCtorName( m.name.node, pass.src ); - if( isJsTsBuiltinCtor( ctor ) ) - { - d.scope = std::string( ctor ); - } +} + +// A Ruby method defined on the class object (`def self.m`, `class << self`): its bind (test/rubyclassrecvcheck.sh). +inline void emitRubyClassSideBind( const TagsFile& file, TagsSinks& sinks, const RawDef& d, const DefIdentity& id, TSNode defNode ) +{ + if( file.le.lang == Lang::Ruby && isCallableKind( id.kind ) ) + { + rubyNoteClassSideDef( defNode, file.fileId, d.name, file.src, sinks.binds ); } } -// The reference edges a definition mints (TagsCapture::Full only): a type's IS-A and HAS-A edges, a macro's body calls. -inline void captureDefinitionEdges( const TagsPass& pass, const TagsMatch& m, TSNode defNode ) +// The reference edges a definition mints (TagsCapture::Full only): a type's IS-A and HAS-A edges, a macro's body calls. On the +// identity's kind — an Elixir module indexed as a Class/Struct/Interface is an Other capture here and mints none. +inline void captureDefinitionEdges( const TagsFile& file, TagsSinks& sinks, const TagsMatch& m, const DefIdentity& id, TSNode defNode ) { - const Lang lang = pass.le.lang; - if( m.kind == SymKind::Class || isStructOrNamedType( m.kind ) || m.kind == SymKind::Interface ) + const Lang lang = file.le.lang; + if( id.kind == SymKind::Class || isStructOrNamedType( id.kind ) || id.kind == SymKind::Interface ) { // #446: a language on the bases-as-captures port reads its bases through the // @reference.base reader (LangFacts::basesAsCaptures; C++ is the first). The // others keep the walk; C++'s own walk survives for captureSpecializationHeader. if( !langFacts( lang ).basesAsCaptures ) { - captureBases( defNode, pass.fileId, lang, pass.src, pass.refs ); // IS-A: inheritance edges (derived → base) + captureBases( defNode, file.fileId, lang, file.src, sinks.refs ); // IS-A: inheritance edges (derived → base) } if( m.defCap == "definition.classfactory" ) // lane lego-transitive (M2): the factory's receiver is the base { - emitBaseRef( jsClassFactoryReceiver( m.name.node, pass.src ), pass.fileId, lang, pass.src, pass.refs, defNode ); + emitBaseRef( jsClassFactoryReceiver( id.name.node, file.src ), file.fileId, lang, file.src, sinks.refs, defNode ); } - captureFields( defNode, pass.fileId, lang, pass.src, pass.refs ); // HAS-A: member-variable type edges (S5-E) + captureFields( defNode, file.fileId, lang, file.src, sinks.refs ); // HAS-A: member-variable type edges (S5-E) } - else if( m.kind == SymKind::Macro ) + else if( id.kind == SymKind::Macro ) { - captureMacroBodyCalls( m.roleNode, pass.fileId, lang, pass.src, pass.refs ); // macro-edges: the graph connects THROUGH the macro + captureMacroBodyCalls( m.roleNode, file.fileId, lang, file.src, sinks.refs ); // macro-edges: the graph connects THROUGH the macro if( langFacts( lang ).bangMacros ) // Rust: `$crate` exists only where `name!` macros do { - captureRustTranscriberMacroCalls( m.roleNode, pass.fileId, pass.src, pass.refs ); // RUST-MACRO-PATH: `$crate::m!` in a transcriber + captureRustTranscriberMacroCalls( m.roleNode, file.fileId, file.src, sinks.refs ); // RUST-MACRO-PATH: `$crate::m!` in a transcriber } } } -// The definition arm: span, extents, shape, name, linkage, function scope, scope and parse-recovery bits into one RawDef, then -// (Full) the edges it mints. `renamed`: MACRO-P1's annotation rename; `aliasTargetStart`: INDEX-ALIAS-CONST's written target. -void captureDefinition( const TagsPass& pass, TagsMatch& m, const AnnotationRename& renamed, std::uint32_t aliasTargetStart ) +// The definition arm: one RawDef, each field written by exactly one step — extent, complexity, parameters, name and kind, test scope, +// linkage, enclosing function, scope, parse-recovery bits — then its own binds and calls, the row, and (Full) the edges it mints. +// `aliasTargetStart`: INDEX-ALIAS-CONST's written target (aliasTargetStartOf). +inline void captureDefinition( const TagsFile& file, TagsSinks& sinks, const TagsMatch& m, const DefIdentity& id, std::uint32_t aliasTargetStart ) { - if( pass.le.lang == Lang::Elixir && m.defCap == "definition.attribute" ) { m.kind = SymKind::Var; } - const std::optional<DefCodeNodes> span = definitionSpanOf( pass, m ); - if( !span ) + const std::optional<DefCodeNodes> code = definitionCodeOf( file, m, id ); + if( !code ) { - return; + return; // a body-less C/C++ specifier in a function's signature: a type use, never a definition } RawDef d; - d.fileId = pass.fileId; - d.line = m.name.row + 1; // the identifier's line — most accurate, dedup-stable (a test macro block's: its title's, re-seated above) - fillDefinitionExtent( d, *span, m.name.byte, aliasTargetStart ); - fillDefinitionShape( pass, d, m, *span, renamed ); - if( !nameDefinition( pass, d, m, span->testMacroBlock ) ) + d.fileId = file.fileId; + d.lang = file.le.lang; + d.line = id.name.row + 1; // the identifier's line — most accurate, dedup-stable (a test macro block's: its title's) + fillDefinitionExtent( d, *code, id, aliasTargetStart ); + fillDefinitionComplexity( d, file, id, *code ); + fillDefinitionParameters( d, file, m, id, *code ); + IndexedName indexed = indexedNameOf( file, m, id, *code, d.params ); + if( indexed.fate != CaptureFate::Keep ) { return; } + d.name = std::move( indexed.name ); + d.kind = indexed.kind; + d.testScope = definitionTestScope( file, m, *code ); // Internal linkage (model.h Symbol::internalLinkage): C and C++ only, read off defNode — the node that owns // the storage class and whose ancestors are the enclosing namespaces (ingest_names.h::cppInternalLinkage). - d.internalLinkage = internalLinkageBit( pass.le.lang, span->defNode, pass.src ); - noteEnclosingFunctionScope( pass, d, m, span->defNode ); - scopeDefinition( pass, d, m, span->defNode ); + d.internalLinkage = internalLinkageBit( file.le.lang, code->defNode, file.src ); + noteEnclosingFunctionScope( d, file, m, id, code->defNode ); + d.scope = definitionScopeOf( file, m, id ); + // #150: is this def genuinely INSIDE namespace std, at ANY nesting depth — not just a def + // whose immediate scope happens to spell a segment std also uses? See Symbol::scopeRootsStd. + d.scopeRootsStd = file.le.lang == Lang::Cpp && cppDefinitionRootsStd( id.name.node, file.src ) ? std::uint8_t( 1 ) : std::uint8_t( 0 ); // extent honesty: did the parse RECOVER this def's container or kind? Only asked in a file whose root // holds an error (fileHasError, one O(1) flag test per file) — see parseRecoveredBits. - d.recovered = pass.fileHasError ? parseRecoveredBits( span->defNode, m.kind, pass.le.lang, d.scope.empty() ) : std::uint8_t( 0 ); - pass.defs.push_back( std::move( d ) ); - if( pass.full ) // TagsCapture::DefinitionsOnly: the reference edges feed no definition + d.recovered = file.fileHasError ? parseRecoveredBits( code->defNode, id.kind, file.le.lang, d.scope.empty() ) : std::uint8_t( 0 ); + emitRubyClassSideBind( file, sinks, d, id, code->defNode ); + emitElixirHeadFacts( file, sinks, d, m, id ); + sinks.defs.push_back( std::move( d ) ); + if( file.full ) // TagsCapture::DefinitionsOnly: the reference edges feed no definition { - captureDefinitionEdges( pass, m, span->defNode ); + captureDefinitionEdges( file, sinks, m, id, code->defNode ); } } -// The reference captures that are not a plain use-site. true: consumed here — emitted as their own fact, or dropped. -inline bool consumeSpecialReference( const TagsPass& pass, const TagsMatch& m ) +// The reference captures that are not a plain use-site, each ending the match: an element access names its receiver class's +// subscript operator, a Ruby mixin and a base-clause type are base edges (Emitted); a C++ cast keyword, an intrinsic JSX tag and a +// using-DIRECTIVE are no reference at all (Drop). Keep: a plain use-site. +inline CaptureFate specialReferenceFate( const TagsFile& file, TagsSinks& sinks, const TagsMatch& m ) { - const Lang lang = pass.le.lang; + const Lang lang = file.le.lang; // An element access: @name is its RECEIVER, and the site names the receiver class's subscript operator // method (ingest_binds.h subscriptOperatorRef) — never a call by itself (RefRole::Subscript). if( m.refCap == "reference.subscript" ) { - if( std::optional<RawRef> sub = subscriptOperatorRef( m.roleNode, m.name.node, pass.fileId, lang, pass.src ) ) + std::optional<RawRef> sub = subscriptOperatorRef( m.roleNode, m.name.node, file.fileId, lang, file.src ); + if( !sub ) { - pass.refs.push_back( std::move( *sub ) ); + return CaptureFate::Drop; } - return true; + sinks.refs.push_back( std::move( *sub ) ); + return CaptureFate::Emitted; } // H4: a C++ cast keyword is not a call — see isCppCastKeyword. Valid input, skipped, no alert. - if( lang == Lang::Cpp && isCppCastKeyword( m.name.text ) ) - { - return true; - } // #285: an intrinsic JSX tag (`<div>`, `<h1>`) is not a call — see isJsxIntrinsicTagIdentifier. // Valid input, skipped, no alert; a qualified (`<Foo.Bar />`) or namespaced (`<svg:rect />`) // tag never reaches this test (see that function's note for why). - if( ( lang == Lang::TypeScript || lang == Lang::JavaScript ) && isJsxIntrinsicTagIdentifier( m.roleNode, m.name.node, m.name.text ) ) - { - return true; - } // using-declaration re-exports (r9 loss bucket 1): @reference.import marks the C++ // `using ns::name;` tags pattern. The site becomes a role="import" use-site of the target // (never a call edge — graph.h admits Call+Macro only), and the grammar KEYWORD forms // (`using namespace ns;` / `using enum E;`) are dropped here at capture time, where the // query predicate a tags pattern cannot express IS enforceable (see the helper's note). - if( m.refCap == "reference.import" && usingDeclarationIsDirective( m.roleNode ) ) + if( ( lang == Lang::Cpp && isCppCastKeyword( m.name.text ) ) + || ( ( lang == Lang::TypeScript || lang == Lang::JavaScript ) && isJsxIntrinsicTagIdentifier( m.roleNode, m.name.node, m.name.text ) ) + || ( m.refCap == "reference.import" && usingDeclarationIsDirective( m.roleNode ) ) ) { - return true; + return CaptureFate::Drop; } // family 4 / slice 4a: a @reference.mixin capture is Ruby's `include`/`extend`/`prepend` — the shape // lives in queries/ruby/tags.scm, so the capture IS the language gate and no Lang:: branch is spent @@ -2775,8 +2852,8 @@ inline bool consumeSpecialReference( const TagsPass& pass, const TagsMatch& m ) // separate match. if( m.refCap == "reference.mixin" ) { - emitCapturedRubyMixinBase( m.roleNode, m.name.node, pass.fileId, lang, pass.src, pass.refs ); - return true; + emitCapturedRubyMixinBase( m.roleNode, m.name.node, file.fileId, lang, file.src, sinks.refs ); + return CaptureFate::Emitted; } // #446: a @reference.base capture is a base-clause type on the class-def path — // queries/<lang>/tags.scm names the clause's type node, so the capture IS the language @@ -2784,55 +2861,55 @@ inline bool consumeSpecialReference( const TagsPass& pass, const TagsMatch& m ) // the captureBases walk passed; C++ is the first language on this capture. if( m.refCap == "reference.base" ) { - emitBaseRef( m.name.node, pass.fileId, lang, pass.src, pass.refs, parentOf( m.roleNode ) ); - return true; + emitBaseRef( m.name.node, file.fileId, lang, file.src, sinks.refs, parentOf( m.roleNode ) ); + return CaptureFate::Emitted; } - return false; + return CaptureFate::Keep; } -// An Elixir reference's module, role and arity-qualified name. false: `r` is finished here — an attribute read pushed as its own -// fact, or a call whose module or arity is unknown (dropped). -inline bool qualifyElixirReference( const TagsPass& pass, const TagsMatch& m, RawRef& r ) +// An Elixir reference's module, role and arity-qualified name. Emitted: an attribute read, pushed as its own fact. Drop: a call +// whose module or arity is unknown. Keep: `r` is qualified and goes on. +inline CaptureFate qualifyElixirReference( const TagsFile& file, TagsSinks& sinks, const TagsMatch& m, RawRef& r ) { - r.qualifier = pass.elixir.scopeOf( m.roleNode ); + r.qualifier = file.elixir.scopeOf( m.roleNode ); if( m.refCap == "reference.attribute" ) { r.role = RefRole::Read; r.name = "@" + std::string( m.name.text ); - pass.refs.push_back( std::move( r ) ); - return false; + sinks.refs.push_back( std::move( r ) ); + return CaptureFate::Emitted; } const TSNode target = fieldChild( m.roleNode, NodeField::Target ); if( !ts_node_is_null( target ) && kindIs( ts_node_type( target ), "dot" ) ) { const TSNode receiver = fieldChild( target, NodeField::Left ); - r.qualifier = pass.elixir.moduleOf( receiver, m.roleNode ); - if( r.qualifier.empty() ) { return false; } + r.qualifier = file.elixir.moduleOf( receiver, m.roleNode ); + if( r.qualifier.empty() ) { return CaptureFate::Drop; } // `__MODULE__` spelled, or an alias of it (`alias __MODULE__, as: Current`): the receiver names the // enclosing module, and the reference is re-attributed per implementation of a multi-target defimpl - r.recv = nodeTextOf( receiver, pass.src ).starts_with( "__MODULE__" ) || pass.elixir.selfRelativeAlias( receiver, m.roleNode ) + r.recv = nodeTextOf( receiver, file.src ).starts_with( "__MODULE__" ) || file.elixir.selfRelativeAlias( receiver, m.roleNode ) ? RecvKind::ElixirSelfModule : RecvKind::ElixirModule; } - auto [ count, known ] = elixirCallArity( m.roleNode, m.name.node, pass.src ); + auto [ count, known ] = elixirCallArity( m.roleNode, m.name.node, file.src ); if( m.refCap == "reference.operator" ) { count = elixirNodeIs( m.roleNode, "binary_operator" ) ? 2 : 1; known = true; } - if( !known ) { return false; } + if( !known ) { return CaptureFate::Drop; } r.argCount = count; r.argCountKnown = true; r.name = elixirFunctionName( m.name.text, count ); - return true; + return CaptureFate::Keep; } // A C++ or Rust reference's qualifier as written. Returns RULE3-MEMBER-GUARD fix 4's Rust path-call qualifier as written, when // longer than one segment ("" otherwise) — set by readReceiverFacts once the receiver fields are. -inline std::string qualifyPathReference( const TagsPass& pass, const TagsMatch& m, RawRef& r ) +inline std::string qualifyPathReference( const TagsFile& file, const TagsMatch& m, RawRef& r ) { - const Lang lang = pass.le.lang; + const Lang lang = file.le.lang; std::string rustWritten; if( lang == Lang::Cpp ) { - r.qualifier = qualifierOf( m.name.node, pass.src ); // `A::b()` → "A" (E#4 canonical resolve) + r.qualifier = qualifierOf( m.name.node, file.src ); // `A::b()` → "A" (E#4 canonical resolve) // #150: the FULL written chain's root, BEFORE the H4 re-split below overwrites r.qualifier // with the immediate segment only (`std::ranges::move` loses "std", keeps "ranges") — see // Reference::qualifierRootsStd and graph.h::keepStdQualifiedCandidates. - r.qualifierRootsStd = cppQualifiedChainRootsStd( m.name.node, pass.src ); + r.qualifierRootsStd = cppQualifiedChainRootsStd( m.name.node, file.src ); cppResplitRefName( r, m.name.text ); // H4 RE-SPLIT at 3+ segments, operator tails, `template` disambiguator } else if( langFacts( lang ).bangMacros && r.role == RefRole::Macro ) @@ -2842,16 +2919,16 @@ inline std::string qualifyPathReference( const TagsPass& pass, const TagsMatch& if( !ts_node_is_null( parent ) && kindIs( ts_node_type( parent ), "scoped_identifier" ) ) { std::string qualifier; - rustMacroPathOf( nodeTextOf( fieldChild( parent, NodeField::Path ), pass.src ), qualifier, rustWritten ); + rustMacroPathOf( nodeTextOf( fieldChild( parent, NodeField::Path ), file.src ), qualifier, rustWritten ); r.qualifier = qualifier; } } else if( lang == Lang::Rust ) { - r.qualifier = rustQualifierOf( m.name.node, pass.src ); // H4: `Widget::new()` → "Widget" + r.qualifier = rustQualifierOf( m.name.node, file.src ); // H4: `Widget::new()` → "Widget" if( r.role == RefRole::Call ) { - rustWritten = rustWrittenQualifier( m.name.node, pass.src ); + rustWritten = rustWrittenQualifier( m.name.node, file.src ); } } return rustWritten; @@ -2859,15 +2936,15 @@ inline std::string qualifyPathReference( const TagsPass& pass, const TagsMatch& // A call site's receiver and argument facts (an import site has no receiver and no argument list — the defaults, // RecvKind::None and argCountKnown=false, are the truth there; Elixir's were read by qualifyElixirReference). -inline void readReceiverFacts( const TagsPass& pass, const TagsMatch& m, RawRef& r, std::string rustWritten ) +inline void readReceiverFacts( const TagsFile& file, const TagsMatch& m, RawRef& r, std::string rustWritten ) { - const Lang lang = pass.le.lang; + const Lang lang = file.le.lang; // FE-B: a Java method INVOCATION reads its receiver like every other language (a member call or a bare // implicit-this call); only a method REFERENCE (`T::m`) keeps issue #74's type-candidate shape. const bool javaMethodRef = lang == Lang::Java && !ts_node_is_null( m.roleNode ) && kindIs( ts_node_type( m.roleNode ), "method_reference" ); RecvShape rs = javaMethodRef - ? javaMethodReferenceReceiver( m.roleNode, pass.src ) - : receiverOf( m.name.node, lang, pass.src ); // P2-D: `this`/`self`/`x`/`base.field` shape + ? javaMethodReferenceReceiver( m.roleNode, file.src ) + : receiverOf( m.name.node, lang, file.src ); // P2-D: `this`/`self`/`x`/`base.field` shape r.recv = rs.kind; r.recvVar = rs.var; // → one-hop narrowing in resolve.h r.setFieldName( std::move( rs.field ) ); // depth-2 intermediate field; "" otherwise r.viaArrow = rs.viaArrow; // `p->m()`: Rule 2b's smart-pointer pointee needs it @@ -2875,9 +2952,9 @@ inline void readReceiverFacts( const TagsPass& pass, const TagsMatch& m, RawRef& r.setMemberPath( std::move( rs.path ) ); r.setMemberCtor( std::move( rs.ctor ) ); // FE-B: the rest of that receiver chain if( lang == Lang::Ruby && r.recv == RecvKind::NamedVar ) { - r.setFieldName( rubyReceiverWrittenPath( m.name.node, r.recvVar, pass.src ) ); // parser version 137: a constant's path as written + r.setFieldName( rubyReceiverWrittenPath( m.name.node, r.recvVar, file.src ) ); // parser version 137: a constant's path as written } - auto [ ac, ak ] = callArity( m.name.node, lang, pass.src ); // B2.2: call-site positional arg count + auto [ ac, ak ] = callArity( m.name.node, lang, file.src ); // B2.2: call-site positional arg count r.argCount = ac; r.argCountKnown = ak; // → arity filter in graph.h if( langFacts( lang ).trailingLambdaScopeFns ) { @@ -2889,7 +2966,7 @@ inline void readReceiverFacts( const TagsPass& pass, const TagsMatch& m, RawRef& } if( isQueueLang( lang ) && isQueueCallName( r.name ) ) { - if( const std::uint8_t kw = callKeywords( m.name.node, pass.src ); kw != 0 ) + if( const std::uint8_t kw = callKeywords( m.name.node, file.src ); kw != 0 ) { r.setComposeRel( pyKwTag( kw ) ); // a queue call's keywords, for QueueHops (model.h pyKwTag) } @@ -2897,16 +2974,16 @@ inline void readReceiverFacts( const TagsPass& pass, const TagsMatch& m, RawRef& } // The reference arm (TagsCapture::Full only): a use-site's role, name, qualifier and receiver facts into one RawRef. -void captureReference( const TagsPass& pass, const TagsMatch& m ) +inline void captureReference( const TagsFile& file, TagsSinks& sinks, const TagsMatch& m ) { - if( consumeSpecialReference( pass, m ) ) + if( specialReferenceFate( file, sinks, m ) != CaptureFate::Keep ) { return; } - const Lang lang = pass.le.lang; + const Lang lang = file.le.lang; const bool isImportRef = ( m.refCap == "reference.import" ); RawRef r; - r.fileId = pass.fileId; + r.fileId = file.fileId; r.startByte = ts_node_start_byte( m.roleNode ); r.line = ts_node_start_point( m.roleNode ).row + 1; // ABS-3: 1-based use-site line for --uses r.lang = lang; @@ -2916,11 +2993,11 @@ void captureReference( const TagsPass& pass, const TagsMatch& m ) r.name = finalSegment( m.name.text ); if( lang == Lang::Clojure ) { - r.qualifier = nodeFieldText( parentOf( m.name.node ), NodeField::Namespace, pass.src ); + r.qualifier = nodeFieldText( parentOf( m.name.node ), NodeField::Namespace, file.src ); } if( lang == Lang::Elixir ) { - if( !qualifyElixirReference( pass, m, r ) ) + if( qualifyElixirReference( file, sinks, m, r ) != CaptureFate::Keep ) { return; } @@ -2929,30 +3006,31 @@ void captureReference( const TagsPass& pass, const TagsMatch& m ) { r.name.push_back( '=' ); // `obj.name = v` calls `name=`, never the getter `name` (test/rubysettercheck.sh) } - std::string rustWritten = qualifyPathReference( pass, m, r ); + std::string rustWritten = qualifyPathReference( file, m, r ); if( !isImportRef && lang != Lang::Elixir ) { - readReceiverFacts( pass, m, r, std::move( rustWritten ) ); + readReceiverFacts( file, m, r, std::move( rustWritten ) ); } - pass.refs.push_back( std::move( r ) ); + sinks.refs.push_back( std::move( r ) ); } -// One match with a role and a name, through the capture-time drop decisions in their order, then into the definition or the -// reference arm. -void captureTagsMatch( const TagsPass& pass, TagsMatch& m ) +// One match with a role and a name, through the capture-time rules, then into the definition or the reference arm. The ORDER is +// load-bearing — each rule reads only facts decided before it, and an emitting step must stay on the same side of every drop: +// 1. a C++ specialization header emits its base clause and ends the match; it reads the @name AS CAPTURED (before the C1 re-seat); +// 2. drops that need no identity: a Swift function-local `let`/`var`, a function-local C++ alias; +// 3. a macro invocation's call site is emitted — AFTER (2), whose drops would otherwise leak it — then a definition that mints +// nothing (DefIdentity::fate) ends the match; +// 4. the gated capture classes (dropGatedCapture), on the name as declared; +// 5. the language filters (Elixir, Clojure), on the kind AS CAPTURED (Elixir's attribute→Var is the identity's, for the arm); +// 6. a capture in an inert quote region keeps its call candidates as declined facts and ends the match; +// 7. the definition arm, or (Full only) the reference arm. +inline void captureTagsMatch( const TagsFile& file, TagsSinks& sinks, const TagsMatch& m ) { - const Lang lang = pass.le.lang; - if( captureSpecializationHeader( m.isDef, lang, m.defCap, m.roleNode, m.name.node, pass.fileId, pass.src, pass.refs ) ) + const Lang lang = file.le.lang; + if( captureSpecializationHeader( m.isDef, lang, m.defCap, m.roleNode, m.name.node, file.fileId, file.src, sinks.refs ) ) { return; // a C++ specialization header: its base clause only, never a symbol } - - // C1 (memgraph F1) — see cppDefNameReseat. A null node is "nothing to re-seat". - if( const DefNameFacts reseated = cppDefNameReseat( m.isDef && lang == Lang::Cpp, m.name.node, pass.src ); !ts_node_is_null( reseated.node ) ) - { - m.name = reseated; - } - // F5: drop Swift function-local `let`/`var` bindings — they are not module symbols and, left in, // they steal the enclosing function's call edges (the last local binding above the call sites // becomes the nearest enclosing symbol). roleNode is the `property_declaration`; a `statements` @@ -2961,14 +3039,15 @@ void captureTagsMatch( const TagsPass& pass, TagsMatch& m ) { return; } - - const std::optional<AliasShape> aliasShape = aliasShapeOfCapture( lang, m ); - if( !aliasShape ) + // INDEX-ALIAS-CONST: a function-local alias is a local name (ingest_relations.h insideFunctionBody, the local-const rule) + if( isAliasDefinition( lang, m ) && insideFunctionBody( m.roleNode ) ) { return; } - AnnotationRename renamed {}; - if( !keepAfterMacroInvocation( pass, m, renamed ) ) + + const DefIdentity id = m.isDef ? definitionIdentityOf( file, m ) : DefIdentity{}; // a reference keeps its @name as captured + emitMacroInvocationCall( file, sinks, m, id ); + if( id.fate != CaptureFate::Keep ) { return; } @@ -2976,28 +3055,22 @@ void captureTagsMatch( const TagsPass& pass, TagsMatch& m ) // uninitialized C++ shape, which needs the captured declaration node), JS export/prototype // assignments — in one drop decision (see dropGatedCapture for the per-class rationale and why // none of this can live in the query as a #match?/#eq? predicate). - if( m.isDef && dropGatedCapture( m.defCap, lang, m.name.text, m.name.node, m.roleNode, pass.src ) ) - { - return; - } - const std::uint32_t aliasTargetStart = aliasShape->form != AliasForm::None ? aliasTargetStartOf( m.roleNode, *aliasShape ) : 0u; - - if( !keepLanguageCapture( pass, m ) ) + if( m.isDef && dropGatedCapture( m.defCap, lang, id.declarator.text, id.declarator.node, m.roleNode, file.src ) ) { return; } - if( consumeInertQuoteCapture( pass, m ) ) + if( languageFilterFate( file, m ) != CaptureFate::Keep || inertQuoteFate( file, sinks, m ) != CaptureFate::Keep ) { return; } if( m.isDef ) { - captureDefinition( pass, m, renamed, aliasTargetStart ); + captureDefinition( file, sinks, m, id, aliasTargetStartOf( file, m ) ); } - else if( m.isRef && pass.full ) + else if( m.isRef && file.full ) { - captureReference( pass, m ); + captureReference( file, sinks, m ); } } @@ -3014,22 +3087,22 @@ void captureTagsMatch( const TagsPass& pass, TagsMatch& m ) // methods — beside each singleton def, which the def capture notes. // Parser version 145 (test/rubyclassrecvcheck.sh): the mixins the class object's lookup reaches — an `extend`, an // `include` in `class << self` — into binds, beside the inherit reference each mixin already is. -inline void captureRubyFilePasses( const TagsPass& pass ) +inline void captureRubyFilePasses( const TagsFile& file, TagsSinks& sinks ) { - captureRubyDefs( pass.root, pass.fileId, pass.src, pass.defs ); // #339: the Definitions-only walker (attr defs + rendered db/schema.rb columns) - if( !pass.full ) + captureRubyDefs( file.root, file.fileId, file.src, sinks.defs ); // #339: the Definitions-only walker (attr defs + rendered db/schema.rb columns) + if( !file.full ) { return; // TagsCapture::DefinitionsOnly: the passes below write references and binds only } - captureRubyBareCalls( pass.root, pass.fileId, pass.src, pass.refs ); - captureRubyFactories( pass.root, pass.fileId, pass.src, pass.binds ); - captureRubyHelperMethods( pass.root, pass.fileId, pass.src, pass.binds ); - captureRubySingletonAccessors( pass.root, pass.fileId, pass.src, pass.binds ); - captureRubyClassMixins( pass.root, pass.fileId, pass.src, pass.binds ); - captureRubyMainMixins( pass.root, pass.fileId, pass.src, pass.binds ); - if( pass.le.ext == kJbuilderExt ) + captureRubyBareCalls( file.root, file.fileId, file.src, sinks.refs ); + captureRubyFactories( file.root, file.fileId, file.src, sinks.binds ); + captureRubyHelperMethods( file.root, file.fileId, file.src, sinks.binds ); + captureRubySingletonAccessors( file.root, file.fileId, file.src, sinks.binds ); + captureRubyClassMixins( file.root, file.fileId, file.src, sinks.binds ); + captureRubyMainMixins( file.root, file.fileId, file.src, sinks.binds ); + if( file.le.ext == kJbuilderExt ) { - typeRubyJbuilderLocal( pass.fileId, pass.refs ); + typeRubyJbuilderLocal( file.fileId, sinks.refs ); } } @@ -3073,9 +3146,9 @@ void captureTagsFacts( TSQueryCursor* cursor, const LangEntry& le, std::uint32_t elixir.shortfall = &shortfall; if( le.lang == Lang::Elixir ) { elixir.prepare( cursor, query, root, src, fileId, binds, includes, refs ); } - const TagsPass pass{ .le = le, .fileId = fileId, .src = src, .root = root, .defs = defs, .refs = refs, .binds = binds, .includes = includes, - .shortfall = shortfall, .elixir = elixir, .fileStem = fileStem, .full = mode == TagsCapture::Full, .shape = mode != TagsCapture::DefinitionsOnly, - .fileHasError = ts_node_has_error( root ) }; + const TagsFile file{ .le = le, .fileId = fileId, .src = src, .root = root, .elixir = elixir, .fileStem = fileStem, + .full = mode == TagsCapture::Full, .shape = mode != TagsCapture::DefinitionsOnly, .fileHasError = ts_node_has_error( root ) }; + TagsSinks sinks{ .defs = defs, .refs = refs, .binds = binds, .includes = includes, .shortfall = shortfall }; { PROFILE_SCOPE_DESCRIBE( "ingest/extractFile: tags query exec+captures" ); ts_query_cursor_exec( cursor, query, root ); @@ -3090,12 +3163,12 @@ void captureTagsFacts( TSQueryCursor* cursor, const LangEntry& le, std::uint32_t { continue; } - TagsMatch m = readTagsMatch( pass, query, match ); + const TagsMatch m = readTagsMatch( file, sinks, query, match ); // Some patterns (e.g. a bare (identifier) @name) carry no @definition/@reference wrapper: a name without a role is // skipped (avoids turning every identifier into an edge), and so is a role without a name. if( m.hasName() && m.hasRole() ) { - captureTagsMatch( pass, m ); + captureTagsMatch( file, sinks, m ); } } } @@ -3138,7 +3211,7 @@ void captureTagsFacts( TSQueryCursor* cursor, const LangEntry& le, std::uint32_t if( le.lang == Lang::Ruby ) { - captureRubyFilePasses( pass ); + captureRubyFilePasses( file, sinks ); } } From 6b1f8d680e8949fad72eaf67e1c571feb1277cf8 Mon Sep 17 00:00:00 2001 From: joyful-ii-V-I <210578314+joyful-ii-V-I@users.noreply.github.com> Date: Sat, 21 Nov 2026 15:57:03 -0500 Subject: [PATCH 20/44] refactor(ingest): definition steps spell the callable test and the C++ scope inline (no new clones) qd_range flagged two one-line helpers from the previous commit as clones of existing predicates: isCallableKind (model.h isStructOrNamedType's shape) and cppDefinitionScope (graph.h resolveAllOrOwnerFitted's). Both are inlined at their call sites. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --- src/ingest_sidecap.h | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/src/ingest_sidecap.h b/src/ingest_sidecap.h index 4a585990b..6c67b1004 100644 --- a/src/ingest_sidecap.h +++ b/src/ingest_sidecap.h @@ -2468,11 +2468,6 @@ inline void fillDefinitionExtent( RawDef& d, const DefCodeNodes& code, const Def d.loc = ( endRow >= startRow ) ? ( endRow - startRow + 1u ) : 1u; } -inline bool isCallableKind( SymKind kind ) noexcept -{ - return kind == SymKind::Function || kind == SymKind::Method; -} - // A callable's cc_walk facts (complexityOf) onto its definition. complexityOf runs on a callable only (and only with `shape`); off a // callable every fact is 0 — the zero Complexity below, which is what keeps ppAlt, maxNest, the nesting profile and ev absent on a // type. LB-E: a test macro block's body SIBLING is where the code lives — complexityOf walks INSIDE its root node, so handing it @@ -2485,8 +2480,9 @@ inline bool isCallableKind( SymKind kind ) noexcept inline void fillDefinitionComplexity( RawDef& d, const TagsFile& file, const DefIdentity& id, const DefCodeNodes& code ) { const TSNode measured = code.spanThroughBody ? code.body : ( ts_node_is_null( code.literal ) ? code.defNode : code.literal ); - const Complexity c = isCallableKind( id.kind ) && file.shape ? complexityOf( measured, file.src, file.le.lang ) - : Complexity{ 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, {}, 0u, 0u, 0u }; + const bool callable = id.kind == SymKind::Function || id.kind == SymKind::Method; + const Complexity c = callable && file.shape ? complexityOf( measured, file.src, file.le.lang ) + : Complexity{ 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, {}, 0u, 0u, 0u }; d.cx = c.cx; d.ccx = c.ccx; d.locals = c.locals; // Phase 1: floor count, C/C++ only (model.h localsCountedLang) — 0 elsewhere, never emitted there @@ -2529,7 +2525,7 @@ inline void fillDefinitionParameters( RawDef& d, const TagsFile& file, const Tag return; } const Lang lang = file.le.lang; - const bool callable = isCallableKind( id.kind ); + const bool callable = id.kind == SymKind::Function || id.kind == SymKind::Method; const bool literalBound = !ts_node_is_null( code.literal ); const TSNode metricNode = literalBound ? code.literal : code.defNode; const auto counted = callable ? definitionParamCount( lang, code.defNode, metricNode, literalBound, file.src ) : std::uint16_t( 0 ); @@ -2662,21 +2658,14 @@ inline void noteEnclosingFunctionScope( RawDef& d, const TagsFile& file, const T d.fnScopeEnd = fnScope.end; } -// A C++ definition's canonical scope (E#4): out-of-line `A::b` → "A" (`Box<T>::grow` (primary) → "Box"; a specialization keeps -// its id), else the enclosing class/namespace. -inline std::string cppDefinitionScope( TSNode nameNode, std::string_view src ) -{ - std::string scope = qualifierOfDefinition( nameNode, src ); - return scope.empty() ? enclosingScopeOf( nameNode, src ) : scope; -} - // The definition's scope, per language ("" where the language records none). inline std::string definitionScopeOf( const TagsFile& file, const TagsMatch& m, const DefIdentity& id ) { const Lang lang = file.le.lang; if( lang == Lang::Cpp ) - { - return cppDefinitionScope( id.name.node, file.src ); + { // E#4: out-of-line `A::b` → "A" (`Box<T>::grow` (primary) → "Box"; a specialization keeps its id), else the enclosing class/namespace + std::string qualifier = qualifierOfDefinition( id.name.node, file.src ); + return qualifier.empty() ? enclosingScopeOf( id.name.node, file.src ) : qualifier; } if( enumTableAt( kDefScopeWalkerOfLang, lang, DefScopeWalker::None ) != DefScopeWalker::None ) { // Python, Go, Rust, Kotlin: the language's row in ingest_names.h kDefScopeWalkerOfLang @@ -2729,7 +2718,7 @@ inline void emitElixirHeadFacts( const TagsFile& file, TagsSinks& sinks, const R // A Ruby method defined on the class object (`def self.m`, `class << self`): its bind (test/rubyclassrecvcheck.sh). inline void emitRubyClassSideBind( const TagsFile& file, TagsSinks& sinks, const RawDef& d, const DefIdentity& id, TSNode defNode ) { - if( file.le.lang == Lang::Ruby && isCallableKind( id.kind ) ) + if( file.le.lang == Lang::Ruby && ( id.kind == SymKind::Function || id.kind == SymKind::Method ) ) { rubyNoteClassSideDef( defNode, file.fileId, d.name, file.src, sinks.binds ); } From 76b36a19c2a605adb484c51c419248bcb074863c Mon Sep 17 00:00:00 2001 From: joyful-ii-V-I <210578314+joyful-ii-V-I@users.noreply.github.com> Date: Sat, 21 Nov 2026 16:31:36 -0500 Subject: [PATCH 21/44] refactor(ingest): captureTagsFacts' language rules dispatch once; langidentity ceiling 317 -> 316 The round-2 identity step had added six shared-file language tests (323 > 317 ceiling). They are now asked once each: - DefIdentity carries exUnitTest, decided with the Elixir attribute kind. - languageFilterFate and emitLanguageDefinitionFacts each dispatch with one switch. - The Elixir def-head steps read @_keyword as their gate; queries/elixir/tags.scm is its only pattern. - definitionScopeOf returns DefScope, so C++'s std-rooted bit comes with the C++ scope. The count falls to 316, and the ceiling follows it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --- src/ingest_sidecap.h | 107 +++++++++++++++++++++------------- test/langidentity/ratchet.tsv | 7 ++- 2 files changed, 72 insertions(+), 42 deletions(-) diff --git a/src/ingest_sidecap.h b/src/ingest_sidecap.h index 6c67b1004..b57f748a5 100644 --- a/src/ingest_sidecap.h +++ b/src/ingest_sidecap.h @@ -1922,7 +1922,8 @@ struct TagsMatch std::string_view refCap; // the @reference capture's name — "reference.import" routes the using-declaration role (r9 loss bucket 1) TSNode roleNode {}; DefNameFacts name {}; // the @name identifier as captured: its node, text, start byte and 0-based row - bool keywordHead = false; // #355: the pattern carried @_keyword, a head its tags.scm predicates accepted + bool keywordHead = false; // #355: the pattern carried @_keyword, a head its tags.scm predicates accepted — Elixir's + // def heads: queries/elixir/tags.scm is its only pattern, so the capture IS the language gate bool hasRole() const noexcept { return isDef || isRef; } bool hasName() const noexcept { return !ts_node_is_null( name.node ); } @@ -2066,6 +2067,7 @@ struct DefIdentity // only the index row of an Elixir defimpl/defprotocol module shows another (elixirIndexedName) AnnotationRename renamed {}; // MACRO-P1: the real function's name and start when a macro annotation hid it; null otherwise bool macroUse = false; // MACRO-P0: the declarator is a macro invocation — a call site of the macro (emitMacroInvocationCall) + bool exUnitTest = false; // an ExUnit `test "title"` block: indexed as `test <title>`, in the file's test scope CaptureFate fate = CaptureFate::Keep; // Drop: mints no definition — a macro use with no function behind it, a test macro // block without its parts (dropGatedCapture's own veto, guarded here, not asserted) }; @@ -2077,7 +2079,8 @@ struct DefIdentity // read the real function's own `f()` as a variable (annotationRenamedName), this definition is the only one f gets — it carries // f's name and kind (renamedAnnotationKind), from f's own start. // - LB-E testmacroblock: the def is TWO SIBLING nodes (testMacroBlockPartsOf); its name is the title literal (a display string). -// - Clojure: the kind is the head's shape (`defn`, `defmacro`, `defprotocol` …); Elixir: a module attribute (`@doc`, `@type`) is a Var. +// - Clojure: the kind is the head's shape (`defn`, `defmacro`, `defprotocol` …); Elixir: a module attribute (`@doc`, `@type`) is a +// Var, and an ExUnit `test` block is a test. // Pure: what a later step drops, it drops on these facts. inline DefIdentity definitionIdentityOf( const TagsFile& file, const TagsMatch& m ) { @@ -2113,9 +2116,10 @@ inline DefIdentity definitionIdentityOf( const TagsFile& file, const TagsMatch& { id.kind = clojureDefinitionShape( m.roleNode, file.src ).kind; } - else if( lang == Lang::Elixir && m.defCap == "definition.attribute" ) + else if( lang == Lang::Elixir ) { - id.kind = SymKind::Var; + id.kind = m.defCap == "definition.attribute" ? SymKind::Var : m.kind; + id.exUnitTest = elixirTarget( m.roleNode, file.src ) == "test"; } return id; } @@ -2204,15 +2208,17 @@ inline CaptureFate elixirFilterFate( const TagsFile& file, const TagsMatch& m ) // The per-language capture filters: Elixir's, and Clojure's (a definition needs a defining head, a reference must not be a special form). inline CaptureFate languageFilterFate( const TagsFile& file, const TagsMatch& m ) { - if( file.le.lang == Lang::Elixir ) + switch( file.le.lang ) { + case Lang::Elixir: return elixirFilterFate( file, m ); + + case Lang::Clojure: + return clojureKeepCapture( m.roleNode, m.isDef, file.src ) ? CaptureFate::Keep : CaptureFate::Drop; + + default: + return CaptureFate::Keep; } - if( file.le.lang == Lang::Clojure && !clojureKeepCapture( m.roleNode, m.isDef, file.src ) ) - { - return CaptureFate::Drop; - } - return CaptureFate::Keep; } // A capture inside an inert quote region ends here: call/operator/named-capture candidates are kept as declined facts, never edges @@ -2530,10 +2536,9 @@ inline void fillDefinitionParameters( RawDef& d, const TagsFile& file, const Tag const TSNode metricNode = literalBound ? code.literal : code.defNode; const auto counted = callable ? definitionParamCount( lang, code.defNode, metricNode, literalBound, file.src ) : std::uint16_t( 0 ); const ParamShape paramShape = ( callable && !code.testMacroBlock && lang != Lang::Clojure ) ? cc_paramShape( metricNode, lang, id.kind, file.src ) : ParamShape{}; - const bool elixirHead = lang == Lang::Elixir && m.keywordHead; d.params = counted; d.paramsMin = paramShape.minimum <= counted ? paramShape.minimum : std::uint16_t( 0 ); - d.arityExact = ( elixirHead ? elixirHeadDefaultCount( m.roleNode, file.src ) == 0 : paramShape.exact ) ? std::uint8_t( 1 ) : std::uint8_t( 0 ); + d.arityExact = ( m.keywordHead ? elixirHeadDefaultCount( m.roleNode, file.src ) == 0 : paramShape.exact ) ? std::uint8_t( 1 ) : std::uint8_t( 0 ); } // An Elixir module attribute's definition name: a typed attribute (@type/@callback and kin) is named with its arity, any other @@ -2569,11 +2574,6 @@ inline SymKind elixirModuleKind( const TagsFile& file, TSNode roleNode, const st return kind; } -inline bool isExUnitTest( const TagsFile& file, const TagsMatch& m ) -{ - return file.le.lang == Lang::Elixir && elixirTarget( m.roleNode, file.src ) == "test"; -} - // The name a definition is indexed under, and its kind there. Drop: the capture mints no row. struct IndexedName { @@ -2589,9 +2589,8 @@ struct IndexedName // elixirModuleKind's kind; Drop when it has no name). Anything else keeps the capture's name. inline IndexedName elixirIndexedName( const TagsFile& file, const TagsMatch& m, const DefIdentity& id, std::uint16_t params ) { - const bool exUnitTest = isExUnitTest( file, m ); - const std::string_view attribute = exUnitTest ? std::string_view{} : elixirAttribute( m.roleNode, file.src ); - const bool generatedModule = !exUnitTest && attribute.empty() && id.kind == SymKind::Other; + const std::string_view attribute = id.exUnitTest ? std::string_view{} : elixirAttribute( m.roleNode, file.src ); + const bool generatedModule = !id.exUnitTest && attribute.empty() && id.kind == SymKind::Other; std::string module = generatedModule ? file.elixir.moduleName( m.roleNode ) : std::string{}; if( generatedModule && module.empty() ) { @@ -2602,7 +2601,7 @@ inline IndexedName elixirIndexedName( const TagsFile& file, const TagsMatch& m, { return IndexedName{ elixirFunctionName( id.name.text, params ), kind }; } - if( exUnitTest ) + if( id.exUnitTest ) { return IndexedName{ "test " + std::string( id.name.text.substr( 1, id.name.text.size() - 2 ) ), kind }; } @@ -2632,9 +2631,9 @@ inline IndexedName indexedNameOf( const TagsFile& file, const TagsMatch& m, cons // L8: the in-file test-scope bit, for EVERY kind (a `#[cfg(test)] mod` and a `class TestFoo` are themselves symbols, and dropping // the members while keeping the shell would be a worse answer than either). Read on defNode, whose ancestors are the enclosing // scopes. LB-E: a test macro IS the in-file convention; so is an ExUnit `test`. -inline std::uint8_t definitionTestScope( const TagsFile& file, const TagsMatch& m, const DefCodeNodes& code ) +inline std::uint8_t definitionTestScope( const TagsFile& file, const DefIdentity& id, const DefCodeNodes& code ) { - if( code.testMacroBlock || isExUnitTest( file, m ) ) + if( code.testMacroBlock || id.exUnitTest ) { return 1; } @@ -2658,34 +2657,42 @@ inline void noteEnclosingFunctionScope( RawDef& d, const TagsFile& file, const T d.fnScopeEnd = fnScope.end; } -// The definition's scope, per language ("" where the language records none). -inline std::string definitionScopeOf( const TagsFile& file, const TagsMatch& m, const DefIdentity& id ) +// A definition's enclosing scope as the index records it, and (#150, C++ only) whether that scope chain roots at namespace std. +struct DefScope +{ + std::string name; // "" where the language records none + bool rootsStd = false; // genuinely INSIDE namespace std at ANY nesting depth — not just a scope whose immediate segment + // happens to spell one std also uses (model.h Symbol::scopeRootsStd) +}; + +// The definition's scope, per language. +inline DefScope definitionScopeOf( const TagsFile& file, const TagsMatch& m, const DefIdentity& id ) { const Lang lang = file.le.lang; if( lang == Lang::Cpp ) { // E#4: out-of-line `A::b` → "A" (`Box<T>::grow` (primary) → "Box"; a specialization keeps its id), else the enclosing class/namespace std::string qualifier = qualifierOfDefinition( id.name.node, file.src ); - return qualifier.empty() ? enclosingScopeOf( id.name.node, file.src ) : qualifier; + return DefScope{ qualifier.empty() ? enclosingScopeOf( id.name.node, file.src ) : std::move( qualifier ), cppDefinitionRootsStd( id.name.node, file.src ) }; } if( enumTableAt( kDefScopeWalkerOfLang, lang, DefScopeWalker::None ) != DefScopeWalker::None ) { // Python, Go, Rust, Kotlin: the language's row in ingest_names.h kDefScopeWalkerOfLang - return defScopeOf( lang, id.name.node, file.src ); + return DefScope{ defScopeOf( lang, id.name.node, file.src ) }; } if( lang == Lang::Elixir ) { - return id.kind == SymKind::Other ? std::string{} : file.elixir.scopeOf( m.roleNode ); + return DefScope{ id.kind == SymKind::Other ? std::string{} : file.elixir.scopeOf( m.roleNode ) }; } if( lang == Lang::Ruby ) { // enclosing class/module → id= addressability, per-class overload sets, editCheckImplicitReceiver - return rubyEnclosingScopeOf( id.name.node, file.src ); // (test/rubyscopecheck.sh) + return DefScope{ rubyEnclosingScopeOf( id.name.node, file.src ) }; // (test/rubyscopecheck.sh) } if( ( lang == Lang::JavaScript || lang == Lang::TypeScript ) && m.defCap == "definition.protomethod" ) { // only the five built-in ctors: every Foo.prototype.bar gaining sc= would mint a new // canonical id and move quality baselines (node lib/ has ~163 anonymous protomethods) const std::string_view ctor = prototypeCtorName( id.name.node, file.src ); - return isJsTsBuiltinCtor( ctor ) ? std::string( ctor ) : std::string{}; + return DefScope{ isJsTsBuiltinCtor( ctor ) ? std::string( ctor ) : std::string{} }; } - return std::string{}; + return DefScope{}; } // `defdelegate f(x), to: M, as: g`: the delegating clause calls M.g with its own arity. @@ -2704,7 +2711,7 @@ inline void emitElixirDelegate( const TagsFile& file, TagsSinks& sinks, const Ra // An Elixir def head's own facts, read off the finished definition: its callable (and default-arity) binds, and a defdelegate's call. inline void emitElixirHeadFacts( const TagsFile& file, TagsSinks& sinks, const RawDef& d, const TagsMatch& m, const DefIdentity& id ) { - if( file.le.lang != Lang::Elixir || !m.keywordHead ) + if( !m.keywordHead ) { return; } @@ -2718,12 +2725,34 @@ inline void emitElixirHeadFacts( const TagsFile& file, TagsSinks& sinks, const R // A Ruby method defined on the class object (`def self.m`, `class << self`): its bind (test/rubyclassrecvcheck.sh). inline void emitRubyClassSideBind( const TagsFile& file, TagsSinks& sinks, const RawDef& d, const DefIdentity& id, TSNode defNode ) { - if( file.le.lang == Lang::Ruby && ( id.kind == SymKind::Function || id.kind == SymKind::Method ) ) + if( id.kind == SymKind::Function || id.kind == SymKind::Method ) { rubyNoteClassSideDef( defNode, file.fileId, d.name, file.src, sinks.binds ); } } +// A definition's language-specific binds and calls, read off the finished row (Ruby's class-side methods, Elixir's def heads). +inline void emitLanguageDefinitionFacts( const TagsFile& file, TagsSinks& sinks, const RawDef& d, const TagsMatch& m, const DefIdentity& id, TSNode defNode ) +{ + switch( file.le.lang ) + { + case Lang::Ruby: + { + emitRubyClassSideBind( file, sinks, d, id, defNode ); + } + break; + + case Lang::Elixir: + { + emitElixirHeadFacts( file, sinks, d, m, id ); + } + break; + + default: + break; + } +} + // The reference edges a definition mints (TagsCapture::Full only): a type's IS-A and HAS-A edges, a macro's body calls. On the // identity's kind — an Elixir module indexed as a Class/Struct/Interface is an Other capture here and mints none. inline void captureDefinitionEdges( const TagsFile& file, TagsSinks& sinks, const TagsMatch& m, const DefIdentity& id, TSNode defNode ) @@ -2778,20 +2807,18 @@ inline void captureDefinition( const TagsFile& file, TagsSinks& sinks, const Tag } d.name = std::move( indexed.name ); d.kind = indexed.kind; - d.testScope = definitionTestScope( file, m, *code ); + d.testScope = definitionTestScope( file, id, *code ); // Internal linkage (model.h Symbol::internalLinkage): C and C++ only, read off defNode — the node that owns // the storage class and whose ancestors are the enclosing namespaces (ingest_names.h::cppInternalLinkage). d.internalLinkage = internalLinkageBit( file.le.lang, code->defNode, file.src ); noteEnclosingFunctionScope( d, file, m, id, code->defNode ); - d.scope = definitionScopeOf( file, m, id ); - // #150: is this def genuinely INSIDE namespace std, at ANY nesting depth — not just a def - // whose immediate scope happens to spell a segment std also uses? See Symbol::scopeRootsStd. - d.scopeRootsStd = file.le.lang == Lang::Cpp && cppDefinitionRootsStd( id.name.node, file.src ) ? std::uint8_t( 1 ) : std::uint8_t( 0 ); + DefScope scope = definitionScopeOf( file, m, id ); + d.scope = std::move( scope.name ); + d.scopeRootsStd = scope.rootsStd ? std::uint8_t( 1 ) : std::uint8_t( 0 ); // extent honesty: did the parse RECOVER this def's container or kind? Only asked in a file whose root // holds an error (fileHasError, one O(1) flag test per file) — see parseRecoveredBits. d.recovered = file.fileHasError ? parseRecoveredBits( code->defNode, id.kind, file.le.lang, d.scope.empty() ) : std::uint8_t( 0 ); - emitRubyClassSideBind( file, sinks, d, id, code->defNode ); - emitElixirHeadFacts( file, sinks, d, m, id ); + emitLanguageDefinitionFacts( file, sinks, d, m, id, code->defNode ); sinks.defs.push_back( std::move( d ) ); if( file.full ) // TagsCapture::DefinitionsOnly: the reference edges feed no definition { diff --git a/test/langidentity/ratchet.tsv b/test/langidentity/ratchet.tsv index 8cccd6c1c..bb33ef201 100644 --- a/test/langidentity/ratchet.tsv +++ b/test/langidentity/ratchet.tsv @@ -24,8 +24,11 @@ # Cpp/C filter, the C scanner branch) and the composed tree counted 326; quality.h defectSitesOf and cFamilyEnumTable now read # langfacts.h's DefectScan column, so all six defect-shape language tests (four of them main's) left the count. # 321 -> 317 (GE-CAPTURETAGS): captureTagsFacts' three Elixir capture filters and its three Elixir definition-name arms each ask -# the language once, in a named step (ingest_sidecap.h keepLanguageCapture, nameDefinition). -ceiling 317 +# the language once, in a named step (ingest_sidecap.h languageFilterFate, indexedNameOf). +# 317 -> 316 (GE-CAPTURETAGS round 2): a definition's language rules are decided once (definitionIdentityOf), the language filters +# and the per-language binds dispatch by one switch each (languageFilterFate, emitLanguageDefinitionFacts), the Elixir def-head +# steps read @_keyword (queries/elixir/tags.scm's only) as their gate, and C++'s std-rooted scope comes with its scope (DefScope). +ceiling 316 perlang ingest_elixir.h perlang elixir_resolve.h perlang ingest_clojure.h From 23d6c3640597c457a815f0d56dec6f149d07d064 Mon Sep 17 00:00:00 2001 From: joyful-ii-V-I <210578314+joyful-ii-V-I@users.noreply.github.com> Date: Sat, 21 Nov 2026 16:36:12 -0500 Subject: [PATCH 22/44] refactor(ingest): the Ruby class-side bind is inline in its language arm (no new clone) qd_range flagged emitRubyClassSideBind as a duplication of quality.h recordTangleOf's shape. The bind now sits inline in emitLanguageDefinitionFacts' Ruby case, its only caller. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --- src/ingest_sidecap.h | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/ingest_sidecap.h b/src/ingest_sidecap.h index b57f748a5..89d0d7657 100644 --- a/src/ingest_sidecap.h +++ b/src/ingest_sidecap.h @@ -2722,15 +2722,6 @@ inline void emitElixirHeadFacts( const TagsFile& file, TagsSinks& sinks, const R } } -// A Ruby method defined on the class object (`def self.m`, `class << self`): its bind (test/rubyclassrecvcheck.sh). -inline void emitRubyClassSideBind( const TagsFile& file, TagsSinks& sinks, const RawDef& d, const DefIdentity& id, TSNode defNode ) -{ - if( id.kind == SymKind::Function || id.kind == SymKind::Method ) - { - rubyNoteClassSideDef( defNode, file.fileId, d.name, file.src, sinks.binds ); - } -} - // A definition's language-specific binds and calls, read off the finished row (Ruby's class-side methods, Elixir's def heads). inline void emitLanguageDefinitionFacts( const TagsFile& file, TagsSinks& sinks, const RawDef& d, const TagsMatch& m, const DefIdentity& id, TSNode defNode ) { @@ -2738,7 +2729,10 @@ inline void emitLanguageDefinitionFacts( const TagsFile& file, TagsSinks& sinks, { case Lang::Ruby: { - emitRubyClassSideBind( file, sinks, d, id, defNode ); + if( id.kind == SymKind::Function || id.kind == SymKind::Method ) + { // a method defined on the class object (`def self.m`, `class << self`): its bind (test/rubyclassrecvcheck.sh) + rubyNoteClassSideDef( defNode, file.fileId, d.name, file.src, sinks.binds ); + } } break; From 9686a6c912e1e74aeba4b7ecd9a6ebee69a31399 Mon Sep 17 00:00:00 2001 From: joyful-ii-V-I <210578314+joyful-ii-V-I@users.noreply.github.com> Date: Sat, 21 Nov 2026 18:05:49 -0500 Subject: [PATCH 23/44] refactor(ingest): pin the tags pass's three invariant-backed equivalences; test-macro parts read once Final round on the round-2 blind review: - The three equivalences with 5df5a26be that rest on an invariant are now written down: - dropGatedCapture judges the declarator: ASSUME that a macro use is a function/method capture, whose gate reads only the role node. - defBodyNodeOf may see a test macro's title node: DASSERT that a test macro is never in the fnLiteralBoundTo languages (a query-file fact, so it is not promised). - The keyword-head arityExact rule: a comment that @_keyword is captured by Elixir's query alone. - DefIdentity carries the test macro's body, so testMacroBlockPartsOf runs twice per capture, as before the refactor, not three times. - isCallable names the function/method test at its three sites. captureDefinition reads aliasTargetStartOf itself, so the parameter is gone. definitionCodeOf's type-use drop is a CaptureFate, the pass's one drop shape. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --- src/ingest_sidecap.h | 82 ++++++++++++++++++++++++++++---------------- 1 file changed, 52 insertions(+), 30 deletions(-) diff --git a/src/ingest_sidecap.h b/src/ingest_sidecap.h index 89d0d7657..5cc3ac93f 100644 --- a/src/ingest_sidecap.h +++ b/src/ingest_sidecap.h @@ -2068,6 +2068,7 @@ struct DefIdentity AnnotationRename renamed {}; // MACRO-P1: the real function's name and start when a macro annotation hid it; null otherwise bool macroUse = false; // MACRO-P0: the declarator is a macro invocation — a call site of the macro (emitMacroInvocationCall) bool exUnitTest = false; // an ExUnit `test "title"` block: indexed as `test <title>`, in the file's test scope + TSNode testMacroBody {}; // LB-E: a test macro block's sibling block (its title is `name`); null otherwise CaptureFate fate = CaptureFate::Keep; // Drop: mints no definition — a macro use with no function behind it, a test macro // block without its parts (dropGatedCapture's own veto, guarded here, not asserted) }; @@ -2110,7 +2111,8 @@ inline DefIdentity definitionIdentityOf( const TagsFile& file, const TagsMatch& id.fate = CaptureFate::Drop; return id; } - id.name = nameFactsAt( parts.title, testMacroTitleOf( parts.title, file.src ) ); + id.name = nameFactsAt( parts.title, testMacroTitleOf( parts.title, file.src ) ); + id.testMacroBody = parts.body; } else if( lang == Lang::Clojure ) { @@ -2249,15 +2251,30 @@ inline CaptureFate inertQuoteFate( const TagsFile& file, TagsSinks& sinks, const return CaptureFate::Emitted; } +// A callable definition kind: what complexity, parameters and Ruby's class-side binds are read for. +inline bool isCallable( SymKind kind ) noexcept +{ + switch( kind ) + { + case SymKind::Function: + case SymKind::Method: + return true; + + default: + return false; + } +} + // Where a definition's code lives: the node its span covers, its body (null: a declaration), the function literal a name is bound // to (kFnLiteralBinding: params/cx/nest read from it), and whether the body is a SIBLING the span runs through. struct DefCodeNodes { - TSNode defNode {}; - TSNode body {}; - TSNode literal {}; - bool testMacroBlock = false; // LB-E: the def is TWO SIBLING nodes (testMacroBlockPartsOf): the macro statement and its block - bool spanThroughBody = false; // the code this symbol owns lives in a SIBLING node: byte/row extents and complexity run through it + TSNode defNode {}; + TSNode body {}; + TSNode literal {}; + bool testMacroBlock = false; // LB-E: the def is TWO SIBLING nodes (testMacroBlockPartsOf): the macro statement and its block + bool spanThroughBody = false; // the code this symbol owns lives in a SIBLING node: byte/row extents and complexity run through it + CaptureFate fate = CaptureFate::Keep; // Drop: no definition — a body-less C/C++ specifier in a function's signature is a type use }; // The declarator climb's STOP set: a type/namespace/file scope — a function's body never lives above one of these, so reaching @@ -2400,10 +2417,13 @@ inline TSNode positionalBodyOf( Lang lang, TSNode defNode ) // climb would hand the constant THE WHOLE CLASS — the exact Rust-method span bug the H4 W3 note describes). No-op for every // pre-existing Var capture (Swift/C#/Go/Python parents hit a scope-stop or the file root before any "body"-owning ancestor — // verified byte-identical on the gate corpora). A Field's span is its own field_declaration / defining assignment — the Var rule, -// same reason. std::nullopt: no definition — a body-less C/C++ specifier in a function's signature is a type use. -inline std::optional<DefCodeNodes> definitionCodeOf( const TagsFile& file, const TagsMatch& m, const DefIdentity& id ) +// same reason. Drop (DefCodeNodes::fate): a body-less C/C++ specifier in a function's signature is a type use. +inline DefCodeNodes definitionCodeOf( const TagsFile& file, const TagsMatch& m, const DefIdentity& id ) { const Lang lang = file.le.lang; + // defBodyNodeOf reads the name node only to find a literal a name is bound to (fnLiteralBoundTo); a test macro block, whose name + // node is its title, comes from queries/cpp/tags.scm alone, a language outside that walk. + DASSERT( m.defCap != "definition.testmacroblock" || !extent::inSet( kFnLiteralBinding.langs, lang ), "a test macro block is never literal-bound" ); const DefBodyNodes own = lang == Lang::Elixir ? DefBodyNodes{ elixirBody( m.roleNode, file.src ), {}, m.roleNode } : defBodyNodeOf( m.roleNode, id.name.node, id.kind, lang ); DefCodeNodes code; @@ -2413,14 +2433,14 @@ inline std::optional<DefCodeNodes> definitionCodeOf( const TagsFile& file, const code.testMacroBlock = m.defCap == "definition.testmacroblock"; if( code.testMacroBlock ) { - code.body = testMacroBlockPartsOf( m.roleNode, file.src ).body; // its parts were read whole: definitionIdentityOf + code.body = id.testMacroBody; // its parts were read once, by definitionIdentityOf } if( ts_node_is_null( code.body ) && id.kind != SymKind::Var && id.kind != SymKind::Field && lang != Lang::Elixir ) { const DeclaratorClimb climb = climbDeclaratorToDefinition( m.roleNode, isCFamilyTypeSpecifier( lang, m.roleNode ) ); if( climb.typeUseInSignature ) { - return std::nullopt; + return DefCodeNodes{ .fate = CaptureFate::Drop }; } code.defNode = ts_node_is_null( climb.span ) ? code.defNode : climb.span; code.body = climb.body; @@ -2486,8 +2506,7 @@ inline void fillDefinitionExtent( RawDef& d, const DefCodeNodes& code, const Def inline void fillDefinitionComplexity( RawDef& d, const TagsFile& file, const DefIdentity& id, const DefCodeNodes& code ) { const TSNode measured = code.spanThroughBody ? code.body : ( ts_node_is_null( code.literal ) ? code.defNode : code.literal ); - const bool callable = id.kind == SymKind::Function || id.kind == SymKind::Method; - const Complexity c = callable && file.shape ? complexityOf( measured, file.src, file.le.lang ) + const Complexity c = isCallable( id.kind ) && file.shape ? complexityOf( measured, file.src, file.le.lang ) : Complexity{ 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, {}, 0u, 0u, 0u }; d.cx = c.cx; d.ccx = c.ccx; @@ -2531,13 +2550,14 @@ inline void fillDefinitionParameters( RawDef& d, const TagsFile& file, const Tag return; } const Lang lang = file.le.lang; - const bool callable = id.kind == SymKind::Function || id.kind == SymKind::Method; + const bool callable = isCallable( id.kind ); const bool literalBound = !ts_node_is_null( code.literal ); const TSNode metricNode = literalBound ? code.literal : code.defNode; const auto counted = callable ? definitionParamCount( lang, code.defNode, metricNode, literalBound, file.src ) : std::uint16_t( 0 ); const ParamShape paramShape = ( callable && !code.testMacroBlock && lang != Lang::Clojure ) ? cc_paramShape( metricNode, lang, id.kind, file.src ) : ParamShape{}; d.params = counted; d.paramsMin = paramShape.minimum <= counted ? paramShape.minimum : std::uint16_t( 0 ); + // m.keywordHead is an Elixir def head: @_keyword is captured by queries/elixir/tags.scm alone (TagsMatch::keywordHead) d.arityExact = ( m.keywordHead ? elixirHeadDefaultCount( m.roleNode, file.src ) == 0 : paramShape.exact ) ? std::uint8_t( 1 ) : std::uint8_t( 0 ); } @@ -2729,7 +2749,7 @@ inline void emitLanguageDefinitionFacts( const TagsFile& file, TagsSinks& sinks, { case Lang::Ruby: { - if( id.kind == SymKind::Function || id.kind == SymKind::Method ) + if( isCallable( id.kind ) ) { // a method defined on the class object (`def self.m`, `class << self`): its bind (test/rubyclassrecvcheck.sh) rubyNoteClassSideDef( defNode, file.fileId, d.name, file.src, sinks.binds ); } @@ -2779,44 +2799,43 @@ inline void captureDefinitionEdges( const TagsFile& file, TagsSinks& sinks, cons // The definition arm: one RawDef, each field written by exactly one step — extent, complexity, parameters, name and kind, test scope, // linkage, enclosing function, scope, parse-recovery bits — then its own binds and calls, the row, and (Full) the edges it mints. -// `aliasTargetStart`: INDEX-ALIAS-CONST's written target (aliasTargetStartOf). -inline void captureDefinition( const TagsFile& file, TagsSinks& sinks, const TagsMatch& m, const DefIdentity& id, std::uint32_t aliasTargetStart ) +inline void captureDefinition( const TagsFile& file, TagsSinks& sinks, const TagsMatch& m, const DefIdentity& id ) { - const std::optional<DefCodeNodes> code = definitionCodeOf( file, m, id ); - if( !code ) + const DefCodeNodes code = definitionCodeOf( file, m, id ); + if( code.fate != CaptureFate::Keep ) { - return; // a body-less C/C++ specifier in a function's signature: a type use, never a definition + return; } RawDef d; d.fileId = file.fileId; d.lang = file.le.lang; d.line = id.name.row + 1; // the identifier's line — most accurate, dedup-stable (a test macro block's: its title's) - fillDefinitionExtent( d, *code, id, aliasTargetStart ); - fillDefinitionComplexity( d, file, id, *code ); - fillDefinitionParameters( d, file, m, id, *code ); - IndexedName indexed = indexedNameOf( file, m, id, *code, d.params ); + fillDefinitionExtent( d, code, id, aliasTargetStartOf( file, m ) ); + fillDefinitionComplexity( d, file, id, code ); + fillDefinitionParameters( d, file, m, id, code ); + IndexedName indexed = indexedNameOf( file, m, id, code, d.params ); if( indexed.fate != CaptureFate::Keep ) { return; } d.name = std::move( indexed.name ); d.kind = indexed.kind; - d.testScope = definitionTestScope( file, id, *code ); + d.testScope = definitionTestScope( file, id, code ); // Internal linkage (model.h Symbol::internalLinkage): C and C++ only, read off defNode — the node that owns // the storage class and whose ancestors are the enclosing namespaces (ingest_names.h::cppInternalLinkage). - d.internalLinkage = internalLinkageBit( file.le.lang, code->defNode, file.src ); - noteEnclosingFunctionScope( d, file, m, id, code->defNode ); + d.internalLinkage = internalLinkageBit( file.le.lang, code.defNode, file.src ); + noteEnclosingFunctionScope( d, file, m, id, code.defNode ); DefScope scope = definitionScopeOf( file, m, id ); d.scope = std::move( scope.name ); d.scopeRootsStd = scope.rootsStd ? std::uint8_t( 1 ) : std::uint8_t( 0 ); // extent honesty: did the parse RECOVER this def's container or kind? Only asked in a file whose root // holds an error (fileHasError, one O(1) flag test per file) — see parseRecoveredBits. - d.recovered = file.fileHasError ? parseRecoveredBits( code->defNode, id.kind, file.le.lang, d.scope.empty() ) : std::uint8_t( 0 ); - emitLanguageDefinitionFacts( file, sinks, d, m, id, code->defNode ); + d.recovered = file.fileHasError ? parseRecoveredBits( code.defNode, id.kind, file.le.lang, d.scope.empty() ) : std::uint8_t( 0 ); + emitLanguageDefinitionFacts( file, sinks, d, m, id, code.defNode ); sinks.defs.push_back( std::move( d ) ); if( file.full ) // TagsCapture::DefinitionsOnly: the reference edges feed no definition { - captureDefinitionEdges( file, sinks, m, id, code->defNode ); + captureDefinitionEdges( file, sinks, m, id, code.defNode ); } } @@ -3065,6 +3084,9 @@ inline void captureTagsMatch( const TagsFile& file, TagsSinks& sinks, const Tags // uninitialized C++ shape, which needs the captured declaration node), JS export/prototype // assignments — in one drop decision (see dropGatedCapture for the per-class rationale and why // none of this can live in the query as a #match?/#eq? predicate). + // It judges the name AS DECLARED. Where identity re-named the definition (MACRO-P1) the capture is a function or method, whose + // gate reads the role node only (dropGatedCapture: definition.function's arm; definition.method has none). + ASSUME( !id.macroUse || m.defCap == "definition.function" || m.defCap == "definition.method", "cFamilyMacroInvocationCapture admits these two only" ); if( m.isDef && dropGatedCapture( m.defCap, lang, id.declarator.text, id.declarator.node, m.roleNode, file.src ) ) { return; @@ -3076,7 +3098,7 @@ inline void captureTagsMatch( const TagsFile& file, TagsSinks& sinks, const Tags if( m.isDef ) { - captureDefinition( file, sinks, m, id, aliasTargetStartOf( file, m ) ); + captureDefinition( file, sinks, m, id ); } else if( m.isRef && file.full ) { From dc15bcec899ab97ee59167d68f9cd323c7d80ee6 Mon Sep 17 00:00:00 2001 From: joyful-ii-V-I <210578314+joyful-ii-V-I@users.noreply.github.com> Date: Sat, 21 Nov 2026 18:54:40 -0500 Subject: [PATCH 24/44] =?UTF-8?q?refactor(serialize):=20the=20map=20as=20n?= =?UTF-8?q?amed=20steps=20=E2=80=94=20rows,=20order,=20groups,=20legend,?= =?UTF-8?q?=20head,=20rows=20written?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit rw::serialize was one ~1000-line body whose row loop sat six levels deep and whose selection logic (rank order, top-K cut, code-first pick, file buckets, stem rows, inventory, emit order, honesty gauges) was copied by hand into serializeJson. Both dialects now share the decisions about WHAT a map prints, each made once: mapKeepCount, rankMapRows, decideMapEmitOrder (one MapEmitOrder value read by the bucket order, order= and the inventory placement), groupMapRowsByFile and countMapHonestyGauges (one count decides a header gauge and its legend clause). The XML legend is an ordered list of named clause groups; the head is renderMapStats + renderMapRootTag; a row is writeMapSymbolRow with its attribute runs (rowGuessAttrs, rowRankAttr, BoundedAttrRun for the snprintf-exact truncation, rowEssentialComplexityAttrs). The est_tokens fixpoint is settleEstTokens. compressBody is its two phases, stripCommentsKeepLiterals (one step per token kind: copyStringLiteral / copyQuotedLiteral / skipLineComment / skipBlockComment) and collapseBlankLineRuns, whose first-line flag is now read off the output. Byte-identical: no answer changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --- src/serialize.h | 2651 +++++++++++++++++++++++++---------------------- 1 file changed, 1425 insertions(+), 1226 deletions(-) diff --git a/src/serialize.h b/src/serialize.h index fa6135d59..416e95334 100644 --- a/src/serialize.h +++ b/src/serialize.h @@ -3314,171 +3314,120 @@ inline void dropUnmappedRows( const IngestResult& ing, std::vector<NodeId>& orde std::erase_if( order, [ &ing ]( NodeId id ) noexcept { return ( ing.symbols[ id ].rankFlags & kRankFlagNotNamed ) != 0; } ); } -inline void serialize( std::FILE* out, const IngestResult& ing, const std::vector<float>& rank, - const std::vector<std::uint32_t>& outOff, const std::vector<NodeId>& outTargets, - int topK, bool mostImportantLast = false, - bool metrics = false, const std::vector<std::uint32_t>* fanIn = nullptr, - const std::vector<std::uint32_t>* ambOut = nullptr, bool stable = false, - const std::vector<std::uint8_t>* outProv = nullptr, - // Q-compute per-symbol metrics — surfaced on --metrics ONLY (descriptive facts, never gates). - // All optional (nullptr ⇒ that attribute is omitted); loc/params/nest live on Symbol itself. - const std::vector<std::uint32_t>* cbo = nullptr, // Q5a distinct in-repo dependency targets - const std::vector<std::uint8_t>* tested = nullptr, // Q2 referenced from a test-path file - const std::vector<std::uint32_t>* lcom4 = nullptr, // Q4 class cohesion (kLcom4NA ⇒ omit) - const std::vector<std::uint32_t>* amp = nullptr, // Q2 change-amplification (callers + co-change partners) - const std::vector<std::uint32_t>* unresolvedOut = nullptr, // honesty lever #2: per-symbol lang-filtered - // unresolved calls; summed into `unresolved=N` - const SparseLabels* bind = nullptr, // A4-R5 per-symbol cross-language binding - // label (graph.h g.bindLabel) — JNI decoded - // Java_pkg_Cls_method → "pkg.Cls.method". - // Emitted as bind="…" ONLY when non-empty - // (nullptr/empty-vector default ⇒ zero - // token cost, byte-identical golden map). - bool autoOrder = false, // T3: fill-aware auto important-last (see above) - std::size_t* outEstTokens = nullptr, // --token-budget: hand back the SAME est_tokens the - // header prints (no second counter) — nullptr ⇒ unused - std::size_t extraPayloadTokens = 0, // §H7 (was extraBodyTokens): tokens of - // EVERY block the caller appends after this map — - // <sigs>, <src>, <bodies>, <outline> — each MEASURED - // from its rendered bytes by the caller (main.cpp's - // renderMapPayload) and converted through - // tokensForEmittedBytes. The old name said "body" - // and only --expand ever filled it, which is - // precisely why the four siblings went uncharged. - const MapAnnotations& ann = {}, // how THIS map was produced (see MapAnnotations - // above); defaulted ⇒ byte-identical golden map. - // §B6 M10: keep the files=/symbols=/shown=/order= stanza on the FIRST SCREEN even under - // `stable`. --stable moves it to a TRAILING comment to protect the cacheable prefix, which is - // right for a CLI map a provider KV-caches and wrong for the MCP `analyze` verb, whose result - // is ONE tool payload an agent reads top-down: there the reader met 197 of 6368 symbols with - // no denominator and no order marker until the last line. The stanza is emitted ONCE either - // way (never both places), so no count is stated twice. Only the MCP analyze front door - // passes true; every CLI caller keeps the default and stays byte-identical. - bool statsFirstScreen = false, - // R-E (2026-08-17 harvest, report-memgraph §F6 seconded): the run's OWN root argument, - // single-root callers only (empty ⇒ multi-root — already carries the roots=/<root - // label=…> disclosure above and stays untouched — or a caller that never passes one, e.g. - // a pure sizing pass, where a root= attribute would add bytes nothing reads). Same fact - // --grep's root= states, same helper (sarif.h's rootPrefixOf/rootRelativeUri) — the two - // verbs must not diverge on what "root-relative" means. - std::string_view rootArg = {}, - // Phase 4: the S6-C locality-pin counter (graph.h g.locPinOut) → lpin="K" on the row, header - // locality_pinned=N — both absent when zero, so a pin-free corpus is byte-identical. - const std::vector<std::uint32_t>* locPinOut = nullptr, - // Phase 5: the external-name veto's refusal count (graph.h g.externalCalls) → header external=N, - // absent when zero, so a veto-free corpus is byte-identical. - std::size_t externalCalls = 0, - // Tier 3's per-caller declines (graph.h g.declinedOut) → header declined=N, absent when zero, so a - // corpus where no call reached tier 3 undecided stays byte-identical. - const std::vector<std::uint32_t>* declinedOut = nullptr, - // of those, the calls the builtin-method name gate declined (graph.h g.gateDeclinedCalls) → the - // kDeclinedGateMapLegend clause, absent when zero. - std::size_t gateDeclinedCalls = 0, - // FE-B: Graph::outNameOnly (parallel to outTargets) → via="name" on a <c> row and the via legend - // comment; nullptr/empty ⇒ every edge is evidence-bound and the map is byte-identical. - const std::vector<std::uint8_t>* outNameOnly = nullptr, - // of declined=, the calls the standard-member gate declined (graph.h g.stdMemberDeclinedCalls) → - // the kDeclinedStdMapLegend clause, absent when zero. - std::size_t stdMemberDeclinedCalls = 0, - // of declined=, the Elixir call candidates inside inert quote AST (g.inertDeclinedCalls, #380) → - // the kInertDeclinedMapLegend clause, absent when zero. - std::size_t inertDeclinedCalls = 0 ) -{ - const std::size_t* changedCount = ann.changedCount; - const std::string* mapAtStamp = ann.atStamp; - const std::string* churnWindow = ann.churnWindow; - const std::size_t S = ing.symbols.size(); - // R-E: normalize once, reuse at every <f p=…> row below — rootPrefixOf just strips a trailing '/', so - // this is O(1) work the loop below would otherwise repeat per row. - const std::string rootPrefix = rootArg.empty() ? std::string() : rw::sarif::rootPrefixOf( rootArg ); - const auto pathRel = [ & ]( std::uint32_t fileId ) -> std::string_view - { - return rootArg.empty() ? std::string_view( ing.files[ fileId ] ) : rw::sarif::rootRelativeUri( ing.files[ fileId ], rootPrefix ); - }; +// ── the map, as named steps ────────────────────────────────────────────────────────────────────────────────── +// serialize() (XML) and serializeJson() share the decisions about WHAT a map prints — the row cap, the rank order, the emit +// order, the file groups and the honesty gauges — so the two dialects cannot drift on them; each dialect then writes the +// same groups in its own spelling. Every step below is decided once and handed on as a const value. - // C1-b: `keep` is the row count the map WOULD print, and it depends on topK and S alone — never on the - // ranking. So under in=DIR's stub it is still the honest would_show=, and every step that exists only to - // ORDER and BUCKET rows nobody prints is skipped: the radix sort over S symbols, the files-sized bucket - // allocation, and the fill loop. (The <f> loop below already walked an empty order; this is the work that - // ran to feed it.) - const std::size_t mapS = mapSymbolCount( ing ); // the rows the map can print (dropUnmappedRows below) - const std::size_t keep = std::min<std::size_t>( topK > 0 ? std::size_t( topK ) : mapS, mapS ); - const bool stubbed = ann.stubSymbols; +// C1-b: the row count the map WOULD print. It depends on topK and the printable rows alone — never on the ranking — so under +// in=DIR's stub it is still the honest would_show=. +inline std::size_t mapKeepCount( const IngestResult& ing, int topK ) noexcept +{ + const std::size_t mapS = mapSymbolCount( ing ); // the rows the map can print (dropUnmappedRows) + return std::min<std::size_t>( topK > 0 ? std::size_t( topK ) : mapS, mapS ); +} - // rank order: (rank desc, id asc) — the id tie-break makes the top-K deterministic. +// The rank order the map's rows are drawn from: (rank desc, id asc) — the id tie-break makes the top-K deterministic — less +// the rows the map never prints, with the map scope's code-first pick (MapAnnotations::codeFirstRows) applied to the kept +// prefix; `dataSecCut` is that pick's disclosure. +struct RankedMapRows +{ std::vector<NodeId> order; - if( !stubbed ) + DataSectionsCut dataSecCut; + + // the rows inside the top-K cut: the first `keep` of the order, none under the stub (whose order is empty) + std::span<const NodeId> kept( std::size_t keep ) const noexcept { - order.resize( S ); - for( NodeId i = 0; i < S; ++i ) - { - order[i] = i; - } - sortutil::radixSortByScoreDescId( order, rank ); - dropUnmappedRows( ing, order ); + return { order.data(), std::min( keep, order.size() ) }; } - // The map scope's code-first row pick (MapAnnotations::codeFirstRows): rewrites the kept prefix, returns its disclosure. - const DataSectionsCut dataSecCut = ( ann.codeFirstRows && !stubbed ) ? codeFirstKeep( ing, order, keep ) : DataSectionsCut{}; - - // bucket the kept symbols by file, files ordered by their best (first-seen) rank. - std::vector<std::vector<NodeId>> buckets( stubbed ? 0 : ing.files.size() ); - std::vector<std::uint32_t> fileOrder; - std::vector<char> seen( stubbed ? 0 : ing.files.size(), 0 ); +}; - for( std::size_t k = 0; !stubbed && k < keep; ++k ) +// C1-b: under in=DIR's stub (`stubbed`) the map prints no symbol row, so every step that exists only to ORDER rows nobody +// prints is skipped — the radix sort over every symbol among them — and the order is empty. +inline RankedMapRows rankMapRows( const IngestResult& ing, const std::vector<float>& rank, const MapAnnotations& ann, std::size_t keep, + bool stubbed ) +{ + RankedMapRows ranked; + if( stubbed ) { - const NodeId id = order[k]; - const Symbol& s = ing.symbols[id]; - const std::uint32_t f = s.fileId; - if( !seen[f] ) { seen[f] = 1; fileOrder.push_back( f ); } - buckets[f].push_back( id ); - } - // MAP-STEM: the map scope's one reserved row per shown file (addMapStemRows above); added after the kept rows - const MapStemPick stemPick = stubbed ? MapStemPick{} : pickMapStemRows( ing, ann, buckets, fileOrder ); - const std::vector<NodeId>& stemRows = stemPick.rows; - // D7: the inventory over the files the kept rows did NOT reach (`seen` is exactly the printed <f> groups) - const MapInventory inventory = ( mapInventoryWanted( ing, ann ) && !stubbed ) - ? computeMapInventory( ing, outOff, outTargets, seen, pathRel ) : MapInventory{}; - - // T1/§H7: the byte MODEL. It keeps two jobs and loses one. It still decides the T3 emit order below - // (which has to be decided before any byte exists — see §H7 at estimateTokens) and it still supplies - // the language-weighted bytes/token RATE, the half of it that is actually measured. What it no longer - // does is REPORT the size: the reported est_tokens is computed from the document's emitted bytes in - // PHASE 2 below, because a model of the symbol set cannot see --metrics decoration or an appended - // payload, which is how four different documents came to report one number (§H7). - // T3 note: the auto-order decision keys off the MAP's own estimate, NOT the payload — the fill-order - // heuristic reasons about the map that gets reordered; the appended <bodies>/<sigs>/<src> blocks are - // emitted after and cannot be reordered, so they must not shift the map's primacy/recency decision. - // C1-b: under the stub the map prints NO symbol rows, so the estimate is taken over none of them. It used - // to be taken over `keep` rows the document does not contain, which put an est_tokens= in the header for a - // payload that was not there — and paid a per-symbol pass to compute it. - const TokenEstimate mapEst = estimateTokens( ing, order, stubbed ? 0 : keep, outOff, outTargets ); - const std::size_t mapEstTokens = mapEst.tokens; - - // T3: fill-aware auto important-last. A PURE function of estTokens (itself a pure function of the - // kept symbol set) → deterministic, byte-identical run-to-run. Only engages when the caller opted - // in (autoOrder) AND neither --stable nor an explicit --most-important-last already decided the - // order — an explicit flag always wins, auto-order never overrides a user's stated intent. Does - // NOT trigger on the small default map (test/fixture est_tokens=619, src/ ~10.6K — both far under - // the ~16K threshold) so the golden output is unchanged. - const bool autoFlip = autoOrder && !stable && !mostImportantLast && mapEstTokens > kFillOrderThreshold; - const bool effImportantLast = mostImportantLast || autoFlip; - - // --stable: emit in PATH / symbol-id order (not rank order) so re-running on a slowly-changing repo - // keeps a byte-identical PREFIX → free provider KV-cache hits. Selection stays rank-based (the top-K - // membership is unchanged); only the emit order is stabilized. Takes precedence over --most-important-last. + return ranked; + } + ranked.order.resize( ing.symbols.size() ); + for( NodeId i = 0; i < ranked.order.size(); ++i ) + { + ranked.order[ i ] = i; + } + sortutil::radixSortByScoreDescId( ranked.order, rank ); + dropUnmappedRows( ing, ranked.order ); + ASSUME( keep <= ranked.order.size(), "mapKeepCount caps keep at mapSymbolCount, the rows dropUnmappedRows leaves" ); + if( ann.codeFirstRows ) + { + ranked.dataSecCut = codeFirstKeep( ing, ranked.order, keep ); // rewrites the kept prefix; the size is unchanged + } + return ranked; +} + +// The order a map's rows are WRITTEN in. Selection is always rank-based (the top-K membership never changes); only the emit +// order moves. Decided once, and every order-dependent choice downstream — the bucket order, order=, where the inventory +// tier sits — reads this one value. +enum class MapEmitOrder : std::uint8_t +{ + ImportantFirst, // rank order (the default) + Stable, // --stable: PATH / symbol-id order, so re-running on a slowly-changing repo keeps a byte-identical + // PREFIX → free provider KV-cache hits. Takes precedence over --most-important-last. + ImportantLast, // --most-important-last: the highest-rank file/symbol LAST (some models weight end-of-context more) + ImportantLastAuto, // T3: the fill-aware auto flip to important-last +}; + +// T3: fill-aware auto important-last. A PURE function of the map's modelled tokens (itself a pure function of the kept symbol +// set) → deterministic, byte-identical run-to-run. Only engages when the caller opted in (autoOrder) AND neither --stable nor +// an explicit --most-important-last already decided the order — an explicit flag always wins, auto-order never overrides a +// user's stated intent. Does NOT trigger on the small default map (test/fixture est_tokens=619, src/ ~10.6K — both far under +// the ~16K threshold) so the golden output is unchanged. +// T3 note: the decision keys off the MAP's own estimate, NOT the payload — the fill-order heuristic reasons about the map that +// gets reordered; the appended <bodies>/<sigs>/<src> blocks are emitted after and cannot be reordered, so they must not shift +// the map's primacy/recency decision. +inline MapEmitOrder decideMapEmitOrder( bool stable, bool mostImportantLast, bool autoOrder, std::size_t mapEstTokens ) noexcept +{ if( stable ) { - std::sort( fileOrder.begin(), fileOrder.end(), - [ & ]( std::uint32_t a, std::uint32_t b ) { return ing.files[a] < ing.files[b]; } ); + return MapEmitOrder::Stable; + } + if( mostImportantLast ) + { + return MapEmitOrder::ImportantLast; + } + return ( autoOrder && mapEstTokens > kFillOrderThreshold ) ? MapEmitOrder::ImportantLastAuto : MapEmitOrder::ImportantFirst; +} + +inline bool isImportantLast( MapEmitOrder emitOrder ) noexcept +{ + return emitOrder == MapEmitOrder::ImportantLast || emitOrder == MapEmitOrder::ImportantLastAuto; +} + +// order= marker: T3's auto-flip must be OBSERVABLE, not a silent behaviour change — "important-last(auto:fill)" is distinct +// from the explicit "important-last" so a reader (or a diff) can tell the ordering was the fill-aware heuristic, not a +// requested flag. +inline const char* mapOrderAttr( MapEmitOrder emitOrder ) noexcept +{ + static constexpr const char* kNames[] = { "important-first", "stable", "important-last", "important-last(auto:fill)" }; + return kNames[ std::size_t( emitOrder ) ]; +} + +// Puts the rank-ordered file groups in the emit order: --stable sorts files by path and rows by symbol id (== file+line +// order); important-last reverses both. Order-only; the det-gate still holds. +inline void putMapGroupsInEmitOrder( const IngestResult& ing, MapEmitOrder emitOrder, std::vector<std::vector<NodeId>>& buckets, + std::vector<std::uint32_t>& fileOrder ) +{ + if( emitOrder == MapEmitOrder::Stable ) + { + std::sort( fileOrder.begin(), fileOrder.end(), [ & ]( std::uint32_t a, std::uint32_t b ) { return ing.files[ a ] < ing.files[ b ]; } ); for( std::vector<NodeId>& b : buckets ) { - std::sort( b.begin(), b.end() ); // by symbol id == file+line order (stable) + std::sort( b.begin(), b.end() ); } } - // --most-important-last (explicit) OR T3 auto-flip: emit highest-rank file/symbol LAST (some models - // weight end-of-context more heavily). Order-only; det-gate still holds. - else if( effImportantLast ) + else if( isImportantLast( emitOrder ) ) { std::reverse( fileOrder.begin(), fileOrder.end() ); for( std::vector<NodeId>& b : buckets ) @@ -3486,751 +3435,1105 @@ inline void serialize( std::FILE* out, const IngestResult& ing, const std::vecto std::reverse( b.begin(), b.end() ); } } +} - std::vector<char> esc; +// The printed rows grouped by file. Files are ordered by their best (first-seen) rank, and two row sets are decided over that +// rank-ordered grouping BEFORE it is put in the emit order: MAP-STEM's one reserved stem-namesake row per shown file (added +// to the buckets, after the kept rows) and the D7 inventory over the files the kept rows did NOT reach. Empty under the stub. +struct MapFileGroups +{ + std::vector<std::vector<NodeId>> buckets; // per file id: its printed rows, in emit order + std::vector<std::uint32_t> fileOrder; // the printed <f> groups, in emit order + MapStemPick stemPick; + MapInventory inventory; +}; - // The prov= legend is appended ONLY under --scip (outProv present) so the default header stays - // byte-identical to the pre-overlay output (no golden churn); prov="scip" marks a SCIP-pinned precise edge. - // §A8.7: shown= (in the `stats` comment below) counts overload-MERGED rows individually — rows + - // Σ(overloads-1) == shown — but overloads= itself (overloadsAttr(), above) was absent from this legend, - // the one clause that closes that arithmetic for a reader who has only the map, not the source. - // §H7: the legend is now COMPOSED into a string rather than streamed, because est_tokens can only be - // written once the document it describes has been measured (PHASE 2 below) and the legend's own bytes - // are part of what it describes. - std::string legend = outProv - ? "<!-- ripwire v1 t=fn|method|cls|struct|iface|var|sec|macro(#define;degraded:body-is-replacement-text,edges-cross-expansion) p=path layer=arch-layer(opt) n=name sc=enclosing-scope(absent-if-unscoped;the-full-id-is-p::sc::n-with-p=-from-the-enclosing-f,and-expand/callers/impact/uses-accept-it) k=rank c=call amb=ambiguous-calls(read-source) lpin=calls-pinned-by-locality-prior-alone(a-disclosed-guess;read-source;absent-if-0) overloads=N-same-name-defs-merged-into-this-row(absent-if-1;shown=counts-them-individually,so-rows+sum(overloads-1)=shown) prov=per-EDGE-confidence(orthogonal-to-k):scip(index-pinned;precise)|binding(cross-lang-FFI)|import(ES-named-import;module+export-named)|split(one-arm-of-a-k-way-pick;read-source;these-are-the-edges-amb=-counts)|final-segment(last-name-match;namespace-unchecked)(absent=uniquely-resolved-name-based) hdr:unresolved=calls-with-no-edge-and-no-proof-of-an-outside-target(every-same-named-def-lang-incompatible-or-out-of-the-language-lookup) (edges heuristic) hdr:locality_pinned=sum-of-lpin(absent-if-0) hdr:external=calls-refused-as-bound-outside-the-tree-ON-PROOF(builtin/global/predeclared/C-library-name-without-in-repo-evidence,outside-import/use,super-past-the-tree;no-edge;absent-if-0) r:est_tokens=hdr-copy(none-if-stable) -->" - : "<!-- ripwire v1 t=fn|method|cls|struct|iface|var|sec|macro(#define;degraded:body-is-replacement-text,edges-cross-expansion) p=path layer=arch-layer(opt) n=name sc=enclosing-scope(absent-if-unscoped;the-full-id-is-p::sc::n-with-p=-from-the-enclosing-f,and-expand/callers/impact/uses-accept-it) k=rank c=call amb=ambiguous-calls(read-source) lpin=calls-pinned-by-locality-prior-alone(a-disclosed-guess;read-source;absent-if-0) overloads=N-same-name-defs-merged-into-this-row(absent-if-1;shown=counts-them-individually,so-rows+sum(overloads-1)=shown) hdr:unresolved=calls-with-no-edge-and-no-proof-of-an-outside-target(every-same-named-def-lang-incompatible-or-out-of-the-language-lookup) (edges heuristic) hdr:locality_pinned=sum-of-lpin(absent-if-0) hdr:external=calls-refused-as-bound-outside-the-tree-ON-PROOF(builtin/global/predeclared/C-library-name-without-in-repo-evidence,outside-import/use,super-past-the-tree;no-edge;absent-if-0) r:est_tokens=hdr-copy(none-if-stable) -->"; - // EXTENT HONESTY (src/extentsuspect.h): how many definitions carry extent_suspect= corpus-wide — the header's - // extent_suspect_syms= — and the row + header readings, appended ONLY when that is non-zero, so a corpus with - // nothing flagged keeps every byte of this legend. - // MODULE-SCOPE OWNERS (issue #60): the t="modscope" kind's reading, appended ONLY when the corpus - // actually has one, under the same byte-identity rule as the two clauses below — a corpus with no - // file-scope call keeps every byte of this legend, which is what kept test/printf_parity.manifest's - // --pack-signatures and --around hashes and every est_tokens ceiling where they were. - bool hasModuleScope = false; - for( const Symbol& sym : ing.symbols ) +template <class PathRel> +inline MapFileGroups groupMapRowsByFile( const IngestResult& ing, const MapAnnotations& ann, std::span<const NodeId> kept, bool stubbed, + MapEmitOrder emitOrder, const std::vector<std::uint32_t>& outOff, + const std::vector<NodeId>& outTargets, const PathRel& pathRel ) +{ + MapFileGroups groups; + if( stubbed ) + { + return groups; // C1-b: no files-sized bucket allocation, no fill loop + } + groups.buckets.resize( ing.files.size() ); + std::vector<char> shownFile( ing.files.size(), 0 ); // exactly the printed <f> groups + for( const NodeId id : kept ) + { + const std::uint32_t f = ing.symbols[ id ].fileId; + if( !shownFile[ f ] ) + { + shownFile[ f ] = 1; + groups.fileOrder.push_back( f ); + } + groups.buckets[ f ].push_back( id ); + } + groups.stemPick = pickMapStemRows( ing, ann, groups.buckets, groups.fileOrder ); + if( mapInventoryWanted( ing, ann ) ) { - if( sym.kind == SymKind::ModuleScope ) { hasModuleScope = true; break; } + groups.inventory = computeMapInventory( ing, outOff, outTargets, shownFile, pathRel ); } - if( hasModuleScope ) + putMapGroupsInEmitOrder( ing, emitOrder, groups.buckets, groups.fileOrder ); + return groups; +} + +// The header's honesty gauges, counted once. Each one decides BOTH its header attribute (absent at 0) and, on the XML map, +// the legend clause that defines it — the two can no longer disagree on whether the gauge fired. +// ambiguous = the resolver guessed among >1 in-repo def (read source); unresolved = the callee name IS defined in-repo but +// EVERY def was language-filtered — a plausibly-internal, cross-language-filtered edge (NOT counted for genuine externals like +// stdlib/third-party, whose name has no in-repo def at all). +struct MapHonestyGauges +{ + std::size_t ambiguous = 0; // calls the resolver could not pin to one target + std::size_t unresolved = 0; // calls to an in-repo name, all defs lang-filtered + std::size_t localityPinned = 0; // Phase 4: calls the locality prior ALONE pinned + std::size_t external = 0; // Phase 5: calls refused as bound outside the tree + std::size_t declined = 0; // calls tier 3 declined: no edge, and no guess + std::size_t declinedByGate = 0; // of declined, the builtin-method name gate's + std::size_t declinedByStdMember = 0; // of declined, the standard-member gate's + std::size_t declinedInert = 0; // of declined, the Elixir call candidates inside inert quote AST (#380) + std::size_t extentSuspectSyms = 0; // definitions carrying extent_suspect= (src/extentsuspect.h) + std::size_t macroBlankedFiles = 0; // files whose symbols come from a member-macro re-parse (src/macroreparse.h) + std::size_t nestRefusedFiles = 0; // #157: files the nesting guard refused +}; + +// The graph's resolver counters as an emitter receives them (graph.h g.ambOut / unresolvedOut / locPinOut / declinedOut and +// the call totals); nullptr ⇒ never measured, which reads as zero (counterTotal). +struct MapResolverCounters +{ + const std::vector<std::uint32_t>* ambOut = nullptr; + const std::vector<std::uint32_t>* unresolvedOut = nullptr; + const std::vector<std::uint32_t>* locPinOut = nullptr; + const std::vector<std::uint32_t>* declinedOut = nullptr; + std::size_t externalCalls = 0; + std::size_t gateDeclinedCalls = 0; + std::size_t stdMemberDeclined = 0; + std::size_t inertDeclinedCalls = 0; +}; + +inline MapHonestyGauges countMapHonestyGauges( const IngestResult& ing, const MapResolverCounters& c ) +{ + std::size_t extentSuspect = 0; + for( const Symbol& sym : ing.symbols ) + { + extentSuspect += sym.extentSuspect != 0 ? 1u : 0u; + } + return MapHonestyGauges{ .ambiguous = counterTotal( c.ambOut ), + .unresolved = counterTotal( c.unresolvedOut ), + .localityPinned = counterTotal( c.locPinOut ), + .external = c.externalCalls, + .declined = counterTotal( c.declinedOut ), + .declinedByGate = c.gateDeclinedCalls, + .declinedByStdMember = c.stdMemberDeclined, + .declinedInert = c.inertDeclinedCalls, + .extentSuspectSyms = extentSuspect, + .macroBlankedFiles = macroBlankedFileCount( ing ), + .nestRefusedFiles = ing.crawlSkips.nestRefusedFiles }; +} + +// The per-symbol facts a map row may print, gathered once from the emitter's parameters. Read-only; a nullptr source means +// that attribute is never printed. +struct MapRowSources +{ + const std::vector<float>& rank; + const std::vector<std::uint32_t>& outOff; + const std::vector<NodeId>& outTargets; + const std::vector<std::uint8_t>* outProv; + const std::vector<std::uint8_t>* outNameOnly; + const std::vector<std::uint32_t>* ambOut; + const std::vector<std::uint32_t>* locPinOut; + const SparseLabels* bind; + bool stable; // --stable: no k= (PageRank is globally volatile) + bool metrics; // --metrics: the descriptive Q-compute attributes + const std::vector<std::uint32_t>* fanIn; + const std::vector<std::uint32_t>* cbo; + const std::vector<std::uint8_t>* tested; + const std::vector<std::uint32_t>* lcom4; + const std::vector<std::uint32_t>* amp; +}; + +// ── the XML map's legend, as its ordered clause groups ─────────────────────────────────────────────────────────────── +// §H7: the legend is COMPOSED into a string rather than streamed, because est_tokens can only be written once the document it +// describes has been measured (PHASE 2 in serialize()) and the legend's own bytes are part of what it describes. Every clause +// after the opening dictionary follows one rule: it is appended ONLY when the document carries what it defines, so a map with +// nothing to disclose keeps every byte of the legend. + +// The opening dictionary. The prov= clause is appended ONLY under --scip (outProv present) so the default header stays +// byte-identical to the pre-overlay output (no golden churn); prov="scip" marks a SCIP-pinned precise edge. +// §A8.7: shown= (in the stats comment) counts overload-MERGED rows individually — rows + Σ(overloads-1) == shown — and +// overloads= (overloadsAttr()) is defined here, the one clause that closes that arithmetic for a reader who has only the map. +inline std::string mapOpeningLegend( bool withProv ) +{ + return withProv + ? "<!-- ripwire v1 t=fn|method|cls|struct|iface|var|sec|macro(#define;degraded:body-is-replacement-text,edges-cross-expansion) p=path layer=arch-layer(opt) n=name sc=enclosing-scope(absent-if-unscoped;the-full-id-is-p::sc::n-with-p=-from-the-enclosing-f,and-expand/callers/impact/uses-accept-it) k=rank c=call amb=ambiguous-calls(read-source) lpin=calls-pinned-by-locality-prior-alone(a-disclosed-guess;read-source;absent-if-0) overloads=N-same-name-defs-merged-into-this-row(absent-if-1;shown=counts-them-individually,so-rows+sum(overloads-1)=shown) prov=per-EDGE-confidence(orthogonal-to-k):scip(index-pinned;precise)|binding(cross-lang-FFI)|import(ES-named-import;module+export-named)|split(one-arm-of-a-k-way-pick;read-source;these-are-the-edges-amb=-counts)|final-segment(last-name-match;namespace-unchecked)(absent=uniquely-resolved-name-based) hdr:unresolved=calls-with-no-edge-and-no-proof-of-an-outside-target(every-same-named-def-lang-incompatible-or-out-of-the-language-lookup) (edges heuristic) hdr:locality_pinned=sum-of-lpin(absent-if-0) hdr:external=calls-refused-as-bound-outside-the-tree-ON-PROOF(builtin/global/predeclared/C-library-name-without-in-repo-evidence,outside-import/use,super-past-the-tree;no-edge;absent-if-0) r:est_tokens=hdr-copy(none-if-stable) -->" + : "<!-- ripwire v1 t=fn|method|cls|struct|iface|var|sec|macro(#define;degraded:body-is-replacement-text,edges-cross-expansion) p=path layer=arch-layer(opt) n=name sc=enclosing-scope(absent-if-unscoped;the-full-id-is-p::sc::n-with-p=-from-the-enclosing-f,and-expand/callers/impact/uses-accept-it) k=rank c=call amb=ambiguous-calls(read-source) lpin=calls-pinned-by-locality-prior-alone(a-disclosed-guess;read-source;absent-if-0) overloads=N-same-name-defs-merged-into-this-row(absent-if-1;shown=counts-them-individually,so-rows+sum(overloads-1)=shown) hdr:unresolved=calls-with-no-edge-and-no-proof-of-an-outside-target(every-same-named-def-lang-incompatible-or-out-of-the-language-lookup) (edges heuristic) hdr:locality_pinned=sum-of-lpin(absent-if-0) hdr:external=calls-refused-as-bound-outside-the-tree-ON-PROOF(builtin/global/predeclared/C-library-name-without-in-repo-evidence,outside-import/use,super-past-the-tree;no-edge;absent-if-0) r:est_tokens=hdr-copy(none-if-stable) -->"; +} + +// MODULE-SCOPE OWNERS (issue #60): the t="modscope" kind's reading, ONLY when the corpus actually has one — a corpus with no +// file-scope call keeps every byte of this legend, which is what kept test/printf_parity.manifest's --pack-signatures and +// --around hashes and every est_tokens ceiling where they were. +inline std::string moduleScopeLegend( const IngestResult& ing ) +{ + const bool hasModuleScope = std::any_of( ing.symbols.begin(), ing.symbols.end(), []( const Symbol& sym ) { return sym.kind == SymKind::ModuleScope; } ); + return hasModuleScope ? std::string( kModScopeMapLegend ) : std::string(); +} + +// lane L6: a <c via="impl"> edge's reading, over the rows WRITTEN (fix round 1, N1): only when a kept row or an inventory entry +// has a one-implementor edge — never because one exists elsewhere in the graph. +inline std::string keptImplEdgeLegend( const std::vector<std::uint32_t>& outOff, const std::vector<std::uint8_t>* outProv, + std::span<const NodeId> kept, std::span<const NodeId> inventoryEntries ) +{ + if( outProv == nullptr ) { - legend += kModScopeMapLegend; + return {}; } - // lane L6: a <c via="impl"> edge's reading, under the same absent-at-zero rule over the rows WRITTEN (fix round 1, N1): only - // when a kept row or an inventory entry has a one-implementor edge — never because one exists elsewhere in the graph - if( outProv != nullptr && !stubbed - && ( markedOutAny( outOff, *outProv, std::span<const NodeId>( order.data(), std::min( keep, order.size() ) ), kProvImpl ) - || markedOutAny( outOff, *outProv, std::span<const NodeId>( inventory.entries.data(), inventory.entries.size() ), kProvImpl ) ) ) + if( markedOutAny( outOff, *outProv, kept, kProvImpl ) || markedOutAny( outOff, *outProv, inventoryEntries, kProvImpl ) ) { - legend += "<!-- c:via=impl:the-one-implementor-in-the-tree-of-the-receiver's-interface/trait/abstract-type-owns-the-callee(an-outside-or-macro-made-one-may-exist) -->"; + return "<!-- c:via=impl:the-one-implementor-in-the-tree-of-the-receiver's-interface/trait/abstract-type-owns-the-callee(an-outside-or-macro-made-one-may-exist) -->"; } - // honesty-small-068: the Go named-type kinds' clause, under the same absent-at-zero rule as modscope's above; index-alias-const: - // a C++ (and .h) alias or function-type row (LangFacts::aliasTargetDefs) reads its own clause, so neither language's row is - // explained by the other's + return {}; +} + +// honesty-small-068: the Go named-type kinds' clause; index-alias-const: a C++ (and .h) alias or function-type row +// (LangFacts::aliasTargetDefs) reads its own clause, so neither language's row is explained by the other's. Each only when +// the corpus has such a row. +inline std::string typeKindLegend( const IngestResult& ing ) +{ const auto namedTypeKind = []( const Symbol& sym ) { return sym.kind == SymKind::NamedType || sym.kind == SymKind::Alias || sym.kind == SymKind::FuncType; }; - if( std::any_of( ing.symbols.begin(), ing.symbols.end(), [&]( const Symbol& sym ) { return namedTypeKind( sym ) && !langFacts( sym.lang ).aliasTargetDefs; } ) ) + std::string clauses; + if( std::any_of( ing.symbols.begin(), ing.symbols.end(), [ & ]( const Symbol& sym ) { return namedTypeKind( sym ) && !langFacts( sym.lang ).aliasTargetDefs; } ) ) { - legend += kNamedTypeMapLegend; + clauses += kNamedTypeMapLegend; } - if( std::any_of( ing.symbols.begin(), ing.symbols.end(), [&]( const Symbol& sym ) { return namedTypeKind( sym ) && langFacts( sym.lang ).aliasTargetDefs; } ) ) + if( std::any_of( ing.symbols.begin(), ing.symbols.end(), [ & ]( const Symbol& sym ) { return namedTypeKind( sym ) && langFacts( sym.lang ).aliasTargetDefs; } ) ) { - legend += kCppAliasMapLegend; + clauses += kCppAliasMapLegend; } + return clauses; +} - std::size_t extentSuspectTotal = 0; - for( const Symbol& sym : ing.symbols ) +// The parse-honesty gauges' clauses, each charged only to the map whose header carries the gauge: EXTENT HONESTY +// (src/extentsuspect.h; the row and the header reading), MEMBER-MACRO RE-PARSE (src/macroreparse.h) and #157's nest_refused=. +inline std::string parseHonestyLegend( const MapHonestyGauges& gauges ) +{ + std::string clauses; + if( gauges.extentSuspectSyms > 0 ) { - extentSuspectTotal += sym.extentSuspect != 0 ? 1u : 0u; + clauses += kExtentSuspectRowLegend; + clauses += kExtentSuspectHdrLegend; } - if( extentSuspectTotal > 0 ) + if( gauges.macroBlankedFiles > 0 ) { - legend += kExtentSuspectRowLegend; - legend += kExtentSuspectHdrLegend; + clauses += kMacroBlankedHdrLegend; } - // MEMBER-MACRO RE-PARSE (src/macroreparse.h): files whose symbols come from a re-parse — the header's - // macro_blanked_files= — and its reading, appended ONLY when non-zero, under the same byte-identity rule. - const std::size_t macroBlankedFiles = macroBlankedFileCount( ing ); - if( macroBlankedFiles > 0 ) + if( gauges.nestRefusedFiles > 0 ) { - legend += kMacroBlankedHdrLegend; + clauses += kNestRefusedMapLegend; } - // #157: a file the nesting guard refused before this map was built — the header's nest_refused=, same - // absent-when-zero rule, charged only to the map that carries the attribute. - if( ing.crawlSkips.nestRefusedFiles > 0 ) + return clauses; +} + +// M20: the seeded-verb clause, emitted only on a seeded map (see MapAnnotations::SeedDisclosure). +inline std::string seedLegend( const MapAnnotations::SeedDisclosure& seed ) +{ + if( seed.of.empty() ) { - legend += kNestRefusedMapLegend; + return {}; } - // R-E fix (2026-08-19): root= was added to <r> with nothing defining it — legendcoveragecheck's arm (A) - // named it on nine roster verbs at once (the default map, --around, and every map-* variant share this - // legend). Spelled in THIS legend's own key=meaning dialect rather than as the prose sentence - // graphlegend.h's kRootRelPathsLegend carries: the map legend is the one first screen every run pays for, - // and its whole style is one compact token per attribute. Conditional, so a multi-root map — which emits - // no root= — stays byte-identical and no golden moves for a document the clause would not describe. + std::string clauses = "<!-- of= is the resolved SEED this neighbourhood is centred on; depth= call hops walked and fanout= " + "neighbours kept per hop are its whole boundary, so a row's absence means outside them, not nonexistent. " + "defs= (only when >1) = that NAME has N definitions and the most specific one was walked (a stated language first, else kind, the " + "repo's majority language on a kind tie, then path order: a CODE definition before a doc heading or config key, and a C/C++ declaration without a body yields to " + "the first bodied definition of its scope in that order); qualify with " + "file:name or @FILE:LINE to pick another. -->"; + if( seed.reflang != nullptr ) // D4: the FULL dialect's definition for the anchor pair — legendcoveragecheck (A) flags the --legend=full row when the seed stanza is silent, + { + clauses += std::string( "<!-- reflang=" ) + seed.reflang + ": the language this answer anchored to; reflang-origin=" + seed.reflangOrigin + + ": explicit (the @lang typed), context (the file asked from), client (the editor's languageId) or corpus (the repo's majority language " + "broke a same-kind tie for the front; next= lists every definition). -->"; // charged only when the row carries the attributes (seedBiteLegend's rule); kept short, the verb dict defines the pair in full + } + clauses += seedBiteLegend( seed ); // C2: charged only on a run whose root carries a bite attribute (the at= rule) + // H1: charged only on a run whose root carries unproven_defs= — the same rule, and part of the head est_tokens prices. + clauses += unprovenDefsVerbComment( UnprovenDefsVerb::Around, seed.unprovenDefs > 0, "<!-- ripwire around: " ); + return clauses; +} + +// How THIS map was produced (MapAnnotations and the run's flags), one clause per annotation the root or header carries. +inline std::string runAnnotationLegend( const IngestResult& ing, const MapAnnotations& ann, std::string_view rootArg, bool metrics ) +{ + std::string clauses; + // R-E fix (2026-08-19): root= was added to <r> with nothing defining it — legendcoveragecheck's arm (A) named it on nine + // roster verbs at once (the default map, --around, and every map-* variant share this legend). Spelled in THIS legend's + // own key=meaning dialect rather than as the prose sentence graphlegend.h's kRootRelPathsLegend carries: the map legend is + // the one first screen every run pays for, and its whole style is one compact token per attribute. Conditional, so a + // multi-root map — which emits no root= — stays byte-identical and no golden moves for a document the clause would not describe. if( !rootArg.empty() ) { - legend += "<!-- r:root=crawl-root-every-p=-is-relative-to(single-root-only;absent=>p=is-the-raw-ingest-path) -->"; + clauses += "<!-- r:root=crawl-root-every-p=-is-relative-to(single-root-only;absent=>p=is-the-raw-ingest-path) -->"; } - if( churnWindow != nullptr ) + if( ann.churnWindow != nullptr ) { - legend += churnRankLegendFor( ann.churnRankLabel ); // §A9.6 / P0-4, churn-only (see the constants) + clauses += churnRankLegendFor( ann.churnRankLabel ); // §A9.6 / P0-4, churn-only (see the constants) if( ann.scopedRecent != nullptr ) { - legend += kRecentScopeLegendOpen; // C1-b: in=DIR — the scoped block, its page, and the map stub (present-only) - legend += kNextLegendClause; - legend += kRecentScopeLegendClose; + clauses += kRecentScopeLegendOpen; // C1-b: in=DIR — the scoped block, its page, and the map stub (present-only) + clauses += kNextLegendClause; + clauses += kRecentScopeLegendClose; } } - // §B2.1: the same treatment for authority/hub/rrf. Mutually exclusive with the churn arm by construction - // (main.cpp fills exactly one of the two fields), and null on the default pagerank map ⇒ zero bytes there. + // §B2.1: the same treatment for authority/hub/rrf. Mutually exclusive with the churn arm by construction (main.cpp fills + // exactly one of the two fields), and null on the default pagerank map ⇒ zero bytes there. if( const char* rbLegend = rankByLegendFor( ann.rankByLabel ) ) { - legend += rbLegend; - } - // M20: the seeded-verb clause, emitted only on a seeded map (see MapAnnotations::SeedDisclosure). - if( !ann.seed.of.empty() ) - { - legend += "<!-- of= is the resolved SEED this neighbourhood is centred on; depth= call hops walked and fanout= " - "neighbours kept per hop are its whole boundary, so a row's absence means outside them, not nonexistent. " - "defs= (only when >1) = that NAME has N definitions and the most specific one was walked (a stated language first, else kind, the " - "repo's majority language on a kind tie, then path order: a CODE definition before a doc heading or config key, and a C/C++ declaration without a body yields to " - "the first bodied definition of its scope in that order); qualify with " - "file:name or @FILE:LINE to pick another. -->"; - if( ann.seed.reflang != nullptr ) // D4: the FULL dialect's definition for the anchor pair — legendcoveragecheck (A) flags the --legend=full row when the seed stanza is silent, - legend += std::string( "<!-- reflang=" ) + ann.seed.reflang + ": the language this answer anchored to; reflang-origin=" + ann.seed.reflangOrigin - + ": explicit (the @lang typed), context (the file asked from), client (the editor's languageId) or corpus (the repo's majority language " - "broke a same-kind tie for the front; next= lists every definition). -->"; // charged only when the row carries the attributes (seedBiteLegend's rule); kept short, the verb dict defines the pair in full - legend += seedBiteLegend( ann.seed ); // C2: charged only on a run whose root carries a bite attribute (the at= rule) - // H1: charged only on a run whose root carries unproven_defs= — the same rule, and part of the head est_tokens prices. - legend += unprovenDefsVerbComment( UnprovenDefsVerb::Around, ann.seed.unprovenDefs > 0, "<!-- ripwire around: " ); + clauses += rbLegend; } + clauses += seedLegend( ann.seed ); if( metrics ) { - legend += kMetricsLegend; // §B7.3, metrics-only (ditto) + clauses += kMetricsLegend; // §B7.3, metrics-only (ditto) } - // Beyond the brief, found by the CA4 legend-coverage sweep: `at=` is the ONE root attribute the map can - // emit that no map legend ever defined — §B7.1 fixed exactly this on the quality-delta screen and the map - // is the other surface that prints it. Emitted only on the runs that carry the stamp (map-diff / churn), - // so the default map is untouched and the clause is charged where the attribute is. - if( mapAtStamp != nullptr && !mapAtStamp->empty() ) + // Beyond the brief, found by the CA4 legend-coverage sweep: `at=` is the ONE root attribute the map can emit that no map + // legend ever defined — §B7.1 fixed exactly this on the quality-delta screen and the map is the other surface that prints + // it. Emitted only on the runs that carry the stamp (map-diff / churn), so the default map is untouched and the clause is + // charged where the attribute is. + if( ann.atStamp != nullptr && !ann.atStamp->empty() ) { - legend += kAtStampLegend; + clauses += kAtStampLegend; } if( ann.maxTokensFit != nullptr ) { - legend += kMaxTokensFitLegend; // §B13.4, --max-tokens-only (ditto) - legend += ann.maxTokensFit->isUnmeasured ? kMaxTokensUnmeasuredLegend : ""; // only on the degrade that sets it + clauses += kMaxTokensFitLegend; // §B13.4, --max-tokens-only (ditto) + if( ann.maxTokensFit->isUnmeasured ) + { + clauses += kMaxTokensUnmeasuredLegend; // only on the degrade that sets it + } + } + if( ing.crawlSkips.ignoredFiles > 0 || ing.crawlSkips.ignoredDirs > 0 ) + { + clauses += kIgnoredLegend; // §N6-C — charged to the map that carries it; see kIgnoredLegend } - const bool ignoreCut = ing.crawlSkips.ignoredFiles > 0 || ing.crawlSkips.ignoredDirs > 0; - legend += ignoreCut ? kIgnoredLegend : ""; // §N6-C — charged to the map that carries it; see kIgnoredLegend - // L3 follow-up (CodeRabbit 4053600616): notes.h's ONE marker, spelled identically on every notes-surfacing - // emitter — absent on a clean read (no sidecar, or every line parsed), so a map with nothing to disclose - // stays byte-identical to before this lane. + // L3 follow-up (CodeRabbit 4053600616): notes.h's ONE marker, spelled identically on every notes-surfacing emitter — absent + // on a clean read (no sidecar, or every line parsed), so a map with nothing to disclose stays byte-identical to before this lane. if( ann.notesDegraded ) { - legend += std::string( notes::kNotesDegradedComment ); + clauses += std::string( notes::kNotesDegradedComment ); } + return clauses; +} + +// The row-selection steps' clauses, each charged to the map whose root or rows carry the attribute: the code-first pick's +// data_sections_cut=, MAP-STEM's stem="1" (the rule the run selected) and stem_cut=, and D7's <inv>. +inline std::string rowSelectionLegend( const DataSectionsCut& dataSecCut, const MapFileGroups& groups ) +{ + std::string clauses; if( dataSecCut.cut > 0 ) { - legend += kDataSectionsCutLegend; // charged to the map that carries data_sections_cut= + clauses += kDataSectionsCutLegend; } - if( !stemRows.empty() ) + if( !groups.stemPick.rows.empty() ) { - legend += mapStemTightOn() ? kMapStemLegend : kMapStemLooseLegend; // MAP-STEM: charged to the map that carries stem="1"; the rule the run selected + clauses += mapStemTightOn() ? kMapStemLegend : kMapStemLooseLegend; } - if( stemPick.cut > 0 ) + if( groups.stemPick.cut > 0 ) { - legend += kMapStemCutLegend; // MAP-STEM: charged to the --max-tokens map that carries stem_cut= + clauses += kMapStemCutLegend; } - if( inventory.active ) + if( groups.inventory.active ) { - legend += kMapInventoryLegend; // D7: charged to the map that carries <inv> + clauses += kMapInventoryLegend; } - // W2-F: the pr_iters= / pr_converged= definition, charged to the maps that carry the attributes — empty - // for a lexical or HITS ordering, and the prose half only on the map whose iteration stopped short. - legend += renderDisclosure( ann.prDisclosure, DiscloseAs::LegendComment ); - // header honesty gauges: ambiguous=resolver guessed among >1 in-repo def (read source); unresolved=the callee - // name IS defined in-repo but EVERY def was language-filtered — a plausibly-internal, cross-language-filtered - // edge (NOT counted for genuine externals like stdlib/third-party, whose name has no in-repo def at all). - const std::size_t ambTotal = counterTotal( ambOut ); // calls the resolver could not pin to one target - const std::size_t unresolvedTotal = counterTotal( unresolvedOut ); // calls to an in-repo name, all defs lang-filtered - const std::size_t locPinTotal = counterTotal( locPinOut ); // Phase 4: calls the locality prior ALONE pinned - const std::size_t declinedTotal = counterTotal( declinedOut ); // calls tier 3 declined: no edge, and no guess - legend += declinedTotal > 0 ? kDeclinedMapLegend : ""; // charged to the map that carries declined= - legend += gateDeclinedCalls > 0 ? kDeclinedGateMapLegend : ""; // only where the builtin-method gate declined a call - legend += stdMemberDeclinedCalls > 0 ? kDeclinedStdMapLegend : ""; // only where the standard-member gate declined a call - legend += inertDeclinedCalls > 0 ? kInertDeclinedMapLegend : ""; // only where an Elixir quote declined a call candidate - if( outNameOnly && !stubbed && !ann.viaLegendStripped - && namesOnlyOutAny( outOff, *outNameOnly, std::span<const NodeId>( order.data(), std::min( keep, order.size() ) ) ) ) - { - // FE-B: the reading every other surface carries (graphlegend.h kViaNameLegend), in the map's short spelling — exactly - // when a kept row may print a via="name" <c> (over-approximated by merged overloads, which print one member's edges). - // It also defines a merged row's x=. Not written under the compact posture, whose rewrite strips it (compactlegend.h) - // and whose element-qualified via/x rows restate it: the --max-tokens fit then prices what is delivered. - legend += kMapViaNameLegend; - } - if( outNameOnly && !stubbed && !ann.viaLegendStripped - && markedOutAny( outOff, *outNameOnly, std::span<const NodeId>( order.data(), std::min( keep, order.size() ) ), kEdgeLink ) ) - { - legend += kMapViaLinkLegend; - } - if( outNameOnly && !stubbed && !ann.viaLegendStripped - && markedOutAny( outOff, *outNameOnly, std::span<const NodeId>( order.data(), std::min( keep, order.size() ) ), 0x80 ) ) - { - legend += kMapAnchorMissLegend; + return clauses; +} + +// The tier-3 decline clauses, each charged to the map that carries the count it explains. +inline std::string declineLegend( const MapHonestyGauges& gauges ) +{ + std::string clauses; + if( gauges.declined > 0 ) + { + clauses += kDeclinedMapLegend; // the map carries declined= } - // K51: history_unread='s definition, the LAST leading clause, so it stands right before the <r> root it marks and inside the - // leading block every reader (and legendcoveragecheck's full rows) meets first; absent unless the amp=/churn= walk was unread. - legend += renderHistoryUnread( DiscloseAs::LegendComment ); - // C1 DRIFT FIX (Round C lane B, found by re-reading this header's own output). `precise=` means "how many - // out-edges a SCIP index PINNED", and the emitter's own comment below says it is "emitted ONLY under - // --scip". Both were true when outProv held only {0, 1}. A4-R5 then added value 2 (an FFI binding edge) - // and this counter — `v ? 1 : 0` — silently began reporting binding edges as SCIP-precise: ripwire's own - // default map, with no --scip anywhere, printed `precise=3` for 3 FFI binding edges, which is the exact - // "a surface that quietly guesses" shape docs/ARCHITECTURE.md §4 forbids. It is load-bearing here because - // C1 adds value 3, which would have inflated the same number by every split edge in the corpus. - // The counter now names ONE value, and the attribute is absent at zero (the tool-wide absent-if-0 - // convention that lpin=/external=/locality_pinned= already follow) so a run with no overlay says nothing - // rather than saying `precise=0` about a measurement it never made. - std::size_t preciseTotal = 0; // how many out-edges the SCIP index pinned (value 1 ONLY) - if( outProv ) - { - for( std::uint8_t v : *outProv ) - { - preciseTotal += ( v == 1u ? 1u : 0u ); - } + if( gauges.declinedByGate > 0 ) + { + clauses += kDeclinedGateMapLegend; // the builtin-method gate declined a call } - char precAttr[ 40 ]; precAttr[ 0 ] = '\0'; // emitted only when a SCIP overlay pinned something - if( preciseTotal > 0 ) + if( gauges.declinedByStdMember > 0 ) { - rw::formatTo( precAttr, sizeof( precAttr ), " precise={}", preciseTotal ); + clauses += kDeclinedStdMapLegend; // the standard-member gate declined a call } - // Multi-root workspace (A13): `roots=N` joins the header gauges and a - // `<root l="LABEL" p="PATH"/>` prologue opens <r> — ONLY when N≥2 (single-root output byte-unchanged). - char rootsAttr[ 32 ]; rootsAttr[ 0 ] = '\0'; + if( gauges.declinedInert > 0 ) + { + clauses += kInertDeclinedMapLegend; // an Elixir quote declined a call candidate + } + return clauses; +} + +// FE-B: the readings of a <c> row's via="name", via="link" and anchor="missing", in the map's short spelling (graphlegend.h +// kViaNameLegend carries the long one) — each exactly when a kept row may print it (over-approximated by merged overloads, +// which print one member's edges). via="name"'s clause also defines a merged row's x=. None is written under the compact +// posture (viaLegendStripped), whose rewrite strips them (compactlegend.h) and whose element-qualified via/x rows restate +// them: the --max-tokens fit then prices what is delivered. +inline std::string keptNameEdgeLegend( const std::vector<std::uint32_t>& outOff, const std::vector<std::uint8_t>* outNameOnly, + std::span<const NodeId> kept, bool viaLegendStripped ) +{ + std::string clauses; + if( outNameOnly == nullptr || viaLegendStripped ) + { + return clauses; + } + if( namesOnlyOutAny( outOff, *outNameOnly, kept ) ) + { + clauses += kMapViaNameLegend; + } + if( markedOutAny( outOff, *outNameOnly, kept, kEdgeLink ) ) + { + clauses += kMapViaLinkLegend; + } + if( markedOutAny( outOff, *outNameOnly, kept, 0x80 ) ) + { + clauses += kMapAnchorMissLegend; + } + return clauses; +} + +// ── the XML map's header comment and root tag ──────────────────────────────────────────────────────────────────── + +// C1 DRIFT FIX (Round C lane B, found by re-reading this header's own output). `precise=` means "how many out-edges a SCIP +// index PINNED", emitted ONLY under --scip. Both were true when outProv held only {0, 1}. A4-R5 then added value 2 (an FFI +// binding edge) and a `v ? 1 : 0` counter silently began reporting binding edges as SCIP-precise: ripwire's own default map, +// with no --scip anywhere, printed `precise=3` for 3 FFI binding edges, which is the exact "a surface that quietly guesses" +// shape docs/ARCHITECTURE.md §4 forbids. It is load-bearing because C1 adds value 3, which would have inflated the same number +// by every split edge in the corpus. The counter names ONE value, and the attribute is absent at zero (the tool-wide +// absent-if-0 convention lpin=/external=/locality_pinned= follow) so a run with no overlay says nothing rather than saying +// `precise=0` about a measurement it never made. +inline std::size_t scipPinnedEdgeCount( const std::vector<std::uint8_t>* outProv ) noexcept +{ + return outProv ? std::size_t( std::count( outProv->begin(), outProv->end(), std::uint8_t( 1 ) ) ) : 0; +} + +// The header gauges after the parse-honesty run: what the run covered and what it left out. Each is absent unless its fact +// holds, so a default run over a tree with nothing to disclose stays byte-identical. Composed once per map. +inline std::string mapCoverageAttrs( const IngestResult& ing, const std::vector<std::uint8_t>* outProv, const MapAnnotations& ann ) +{ + std::string attrs; + char buf[ 96 ]; + if( const std::size_t precise = scipPinnedEdgeCount( outProv ); precise > 0 ) + { + rw::formatTo( buf, sizeof( buf ), " precise={}", precise ); // only when a SCIP overlay pinned something + attrs += buf; + } + // Multi-root workspace (A13): `roots=N` joins the header gauges and a `<root label= p=/>` prologue opens <r> — ONLY when + // N≥2 (single-root output byte-unchanged). if( ing.rootLabels.size() >= 2 ) { - rw::formatTo( rootsAttr, sizeof( rootsAttr ), " roots={}", ing.rootLabels.size() ); + rw::formatTo( buf, sizeof( buf ), " roots={}", ing.rootLabels.size() ); + attrs += buf; } - // D6: --map-diff's teleport-seed file count, ONLY when the caller passes changedCount - // (nullptr for every non-map-diff caller ⇒ zero token cost, byte-identical golden map). A clean - // tree reports "changed=0" so the caller can see the teleport degraded to uniform without shelling - // out to git a second time — that map is otherwise byte-identical to the plain default map. - char changedAttr[ 40 ]; changedAttr[ 0 ] = '\0'; - if( changedCount ) + // D6: --map-diff's teleport-seed file count, ONLY when the caller passes changedCount (nullptr for every non-map-diff + // caller ⇒ zero token cost, byte-identical golden map). A clean tree reports "changed=0" so the caller can see the + // teleport degraded to uniform without shelling out to git a second time — that map is otherwise byte-identical to the + // plain default map. + if( ann.changedCount ) { - rw::formatTo( changedAttr, sizeof( changedAttr ), " changed={}", *changedCount ); + rw::formatTo( buf, sizeof( buf ), " changed={}", *ann.changedCount ); + attrs += buf; } - // §P0.5d: how many otherwise-indexable files the crawl dropped for exceeding a per-file size ceiling — - // --max-file-size, or (§B13.1) the .json lane's fixed 256 KB config ceiling that --max-file-size does not - // raise. `--max-file-size=8K` dropped ~296 of ~759 files on this repo and files= reported the survivors as - // if they WERE the corpus. Emitted ONLY when non-zero, per the house rule — absent means nothing was - // skipped, so a default run over a tree with nothing oversized stays byte-identical. - char skippedAttr[ 48 ]; skippedAttr[ 0 ] = '\0'; + // §P0.5d: how many otherwise-indexable files the crawl dropped for exceeding a per-file size ceiling — --max-file-size, or + // (§B13.1) the .json lane's fixed 256 KB config ceiling that --max-file-size does not raise. `--max-file-size=8K` dropped + // ~296 of ~759 files on this repo and files= reported the survivors as if they WERE the corpus. if( !ing.skippedOversize.empty() ) { - rw::formatTo( skippedAttr, sizeof( skippedAttr ), " skipped_oversize={}", ing.skippedOversize.size() ); - } - // §L1: the LANGUAGES this build could not read at all — buildUnindexedAttr carries the whole rule. - const std::string unindexedAttr = buildUnindexedAttr( ing.crawlSkips ); - const std::string ignoredAttr = buildIgnoredAttr( ing.crawlSkips ); // §N6-C, empty unless the ignore rules cut something - const std::string escapedAttr = buildEscapedRootAttr( ing.crawlSkips ); // §SEC1, empty unless a symlink left the root - const std::string memoryAttr = buildMemoryStopAttr( ing, false ) + buildMemoryPeakAttr( ing, false ); // #350, empty unless the memory guard stopped the ingest or the peak passed the limit - // §B13.4: --max-tokens=N asked for a TOKEN count and got a BYTE ceiling. Both numbers, on the map that - // was shaped by them, so the ~10% the headroom leaves unused is a disclosed fact rather than a silent - // one. Emitted ONLY under --max-tokens (nullptr for every other caller ⇒ byte-identical default map). - // §F5: over_ceiling=1 rides the same attr — a cap that can be overshot is not a cap, so where the map's - // fixed floor cannot fit inside fit_bytes the map states that instead of quietly exceeding it. See - // MapAnnotations::MaxTokensFit for the four ways the cap was breached and why the label is monotone. - char fitAttr[ 96 ]; fitAttr[ 0 ] = '\0'; + rw::formatTo( buf, sizeof( buf ), " skipped_oversize={}", ing.skippedOversize.size() ); + attrs += buf; + } + attrs += buildMemoryStopAttr( ing, false ) + buildMemoryPeakAttr( ing, false ); // #350, empty unless the memory guard stopped the ingest or the peak passed the limit + attrs += buildUnindexedAttr( ing.crawlSkips ); // §L1: the LANGUAGES this build could not read at all + attrs += buildIgnoredAttr( ing.crawlSkips ); // §N6-C, empty unless the ignore rules cut something + attrs += buildEscapedRootAttr( ing.crawlSkips ); // §SEC1, empty unless a symlink left the root + // §B13.4: --max-tokens=N asked for a TOKEN count and got a BYTE ceiling. Both numbers, on the map that was shaped by them, + // so the ~10% the headroom leaves unused is a disclosed fact rather than a silent one. §F5: over_ceiling=1 rides the same + // attr — a cap that can be overshot is not a cap, so where the map's fixed floor cannot fit inside fit_bytes the map states + // that instead of quietly exceeding it. See MapAnnotations::MaxTokensFit for the four ways the cap was breached and why + // the label is monotone. if( ann.maxTokensFit != nullptr ) { - rw::formatTo( fitAttr, sizeof( fitAttr ), " max_tokens={} fit_bytes={}{}{}", - ann.maxTokensFit->askedTokens, ann.maxTokensFit->ceilingBytes, - ann.maxTokensFit->isOverCeiling || ann.maxTokensFit->isUnmeasured ? " over_ceiling=1" : "", - ann.maxTokensFit->isUnmeasured ? " fit_unmeasured=1" : "" ); - } - // order= marker: T3's auto-flip must be OBSERVABLE, not a silent behaviour change — "important- - // last(auto:fill)" is distinct from the explicit "important-last" so a reader (or a diff) can tell - // the ordering was the fill-aware heuristic, not a requested flag. - const char* orderAttr = stable ? "stable" - : mostImportantLast ? "important-last" - : autoFlip ? "important-last(auto:fill)" - : "important-first"; - - // ── the HEAD and the TAIL, as BUILDERS ───────────────────────────────────────────────────────────── - // Both state est_tokens, and est_tokens describes the whole document including them, so the digit count - // feeds back into the number: PHASE 2 below iterates these to a fixpoint. buildRecall (recall.h) has the - // identical fixpoint for the identical reason — "the header, last: it REPORTS est_tokens, so it can only - // be written once the payload is measured". Pure functions of estTokens + the attrs computed above. - MapEstimate estimate{ ann.payloadUncharged }; // the est_tokens measurement's DISCLOSE sink — read by the head builders below - const auto buildStats = [ & ]( std::size_t estTokens ) -> std::string - { - // summary preamble: counts so the agent knows the map's scope + est size. §B14 — was `char stats[480]`, - // and the LATENT member of that class: every interpoland is bounded, but the worst-case format width - // is 80 literal bytes + 7×20 (%zu at UINT64_MAX) + 251 (precAttr 39 + rootsAttr 31 + changedAttr 39 + - // skippedAttr 47 + fitAttr 95, each buffer's max strlen) + 25 (`important-last(auto:fill)`) = **496 B**, - // 497 with the NUL, against a 480-byte buffer. It sat at 432/480 on this repo, so it was one new header - // attribute away from truncating — and a cut here deletes the trailing ` -->`, which turns the ENTIRE - // document into one unterminated comment. Composed on std::string, the margin question disappears. - std::string stats = "<!-- files="; - stats += std::to_string( ing.files.size() ); - stats += " symbols="; stats += std::to_string( mapSymbolCount( ing ) ); // the symbols the map ranks - stats += " edges="; stats += std::to_string( outTargets.size() ); - stats += " shown="; stats += std::to_string( ann.stubSymbols ? std::size_t( 0 ) : keep + stemRows.size() ); // C1-b: the stub prints no row - stats += " est_tokens="; stats += std::to_string( estTokens ); - if( estimate.isModelled ) - { - stats += " est_measured=0"; // the number beside it is the model (MapEstimate); absent ⇒ measured - } - stats += " ambiguous="; stats += std::to_string( ambTotal ); - stats += " unresolved="; stats += std::to_string( unresolvedTotal ); - if( locPinTotal > 0 ) // absent when 0 — zero bytes on a pin-free corpus - { - stats += " locality_pinned="; stats += std::to_string( locPinTotal ); - } - if( externalCalls > 0 ) // Phase 5: same absent-when-0 rule - { - stats += " external="; stats += std::to_string( externalCalls ); - } - if( declinedTotal > 0 ) // tier-3 declines: same rule, after external= so no adjacency moves - { - stats += " declined="; stats += std::to_string( declinedTotal ); - } - // The two parse-honesty gauges follow the call-resolution family (ambiguous= .. declined=), in this order, - // so declined= stays adjacent to external= and the resolver's gauges read as one contiguous run. - if( extentSuspectTotal > 0 ) // extent honesty: same absent-when-0 rule - { - stats += " extent_suspect_syms="; stats += std::to_string( extentSuspectTotal ); - } - if( macroBlankedFiles > 0 ) // member-macro re-parse: same absent-when-0 rule - { - stats += " macro_blanked_files="; stats += std::to_string( macroBlankedFiles ); - } - if( ing.crawlSkips.nestRefusedFiles > 0 ) // #157: same absent-when-0 rule, last of the parse-honesty gauges + rw::formatTo( buf, sizeof( buf ), " max_tokens={} fit_bytes={}{}{}", + ann.maxTokensFit->askedTokens, ann.maxTokensFit->ceilingBytes, + ann.maxTokensFit->isOverCeiling || ann.maxTokensFit->isUnmeasured ? " over_ceiling=1" : "", + ann.maxTokensFit->isUnmeasured ? " fit_unmeasured=1" : "" ); + attrs += buf; + } + return attrs; +} + +// The summary preamble: counts so the agent knows the map's scope + est size. §B14 — was `char stats[480]`, one new header +// attribute away from truncating (and a cut here deletes the trailing ` -->`, which turns the ENTIRE document into one +// unterminated comment). Composed on std::string, the margin question disappears. +struct MapStatsFacts +{ + std::size_t files; + std::size_t symbols; // the symbols the map ranks + std::size_t edges; + std::size_t shown; // C1-b: 0 under the stub, which prints no row + const MapHonestyGauges& gauges; + std::string_view coverageAttrs; + const char* orderAttr; +}; + +inline std::string renderMapStats( const MapStatsFacts& f, std::size_t estTokens, bool estModelled ) +{ + const auto gauge = []( std::string& out, std::string_view key, std::size_t value ) + { + if( value > 0 ) // absent when 0 — zero bytes on a corpus where the gauge never fired { - stats += " nest_refused="; stats += std::to_string( ing.crawlSkips.nestRefusedFiles ); + out += key; out += std::to_string( value ); } - stats += precAttr; stats += rootsAttr; stats += changedAttr; stats += skippedAttr; stats += memoryAttr; stats += unindexedAttr; - stats += ignoredAttr; stats += escapedAttr; stats += fitAttr; - stats += " order="; stats += orderAttr; - stats += " -->"; - return stats; }; - // --stable: volatile counts move to a TRAILING comment (out of the cacheable prefix) — unless the caller - // asked for the first-screen placement (§B6 M10, the MCP analyze verb), in which case they stay here and - // the trailing copy is suppressed. Exactly one of the two builders emits `stats`. - const auto buildHead = [ & ]( std::size_t estTokens ) -> std::string + std::string stats = "<!-- files="; + stats += std::to_string( f.files ); + stats += " symbols="; stats += std::to_string( f.symbols ); + stats += " edges="; stats += std::to_string( f.edges ); + stats += " shown="; stats += std::to_string( f.shown ); + stats += " est_tokens="; stats += std::to_string( estTokens ); + if( estModelled ) + { + stats += " est_measured=0"; // the number beside it is the model (MapEstimate); absent ⇒ measured + } + stats += " ambiguous="; stats += std::to_string( f.gauges.ambiguous ); + stats += " unresolved="; stats += std::to_string( f.gauges.unresolved ); + gauge( stats, " locality_pinned=", f.gauges.localityPinned ); + gauge( stats, " external=", f.gauges.external ); // Phase 5 + gauge( stats, " declined=", f.gauges.declined ); // tier-3 declines, after external= so no adjacency moves + // The parse-honesty gauges follow the call-resolution family (ambiguous= .. declined=), in this order, so declined= stays + // adjacent to external= and the resolver's gauges read as one contiguous run. + gauge( stats, " extent_suspect_syms=", f.gauges.extentSuspectSyms ); + gauge( stats, " macro_blanked_files=", f.gauges.macroBlankedFiles ); + gauge( stats, " nest_refused=", f.gauges.nestRefusedFiles ); // #157: last of the parse-honesty gauges + stats += f.coverageAttrs; + stats += " order="; stats += f.orderAttr; + stats += " -->"; + return stats; +} + +// M20: the seeded-verb stanza on <r>, after root= and before the ranker attributes. Absent (and therefore byte-free) on every +// map that had no seed. +inline std::string seedRootAttrs( const MapAnnotations::SeedDisclosure& seed, std::vector<char>& esc ) +{ + if( seed.of.empty() ) { - std::string h = legend; - if( estimate.isModelled ) - { - h += kEstModelledLegend; + return {}; + } + std::string h; + h += " of=\""; h += escapeXml( seed.of, esc ); h += "\""; + h += " depth=\""; h += std::to_string( seed.depth ); h += "\""; + h += " fanout=\""; h += std::to_string( seed.fanout ); h += "\""; + if( seed.defs > 1 ) { h += " defs=\""; h += std::to_string( seed.defs ); h += "\""; } + h += unprovenDefsAttrXml( seed.unprovenDefs ); // H1: beside defs=, the rest of what the seed name resolved to + h += seedBiteAttrs( seed ); // C2: each bound's BITE, right after the bound it qualifies (empty when neither bit) + if( seed.reflang != nullptr ) // D4: after the bite pair, same slot logic — the anchor qualifies the whole seed stanza + { + h += " reflang=\""; h += seed.reflang; + h += "\" reflang-origin=\""; h += seed.reflangOrigin; h += "\""; + if( !seed.nextDefs.empty() ) // the corpus tie's pasteable follow-up, beside the disclosure it belongs to — + { // the ONE next= builder the house keeps (nextverb.h, darkflags/docdrift precedents) + h += nextAttrXml( nextFlag( "--defs=", seed.nextDefs ) ); } - if( !stable || statsFirstScreen ) - { - h += buildStats( estTokens ); - } - // r26-stamp Task A: ` at="..."` ONLY when the caller passed a non-empty stamp (--map-diff); every other - // caller passes nullptr, so the hot default-map path pays a pointer compare, not a git call. at= stays - // FIRST — the `<r at="<sha>` byte sequence gitstampcheck.sh pins is unchanged. - h += "<r"; - if( mapAtStamp != nullptr && !mapAtStamp->empty() ) { h += " at=\""; h += *mapAtStamp; h += "\""; } - // R-E: after at= (so gitstampcheck's `<r at="<sha>` byte sequence is unmoved), same slot --grep uses - // right after its own identifying attributes — the crawl root every <f p=…> below is now RELATIVE to. - if( !rootArg.empty() ) { h += " root=\""; h += escapeXml( rootArg, esc ); h += "\""; } - // M20: the seeded-verb stanza, after root= and before the ranker attributes. Absent (and therefore - // byte-free) on every map that had no seed. - if( !ann.seed.of.empty() ) - { - h += " of=\""; h += escapeXml( ann.seed.of, esc ); h += "\""; - h += " depth=\""; h += std::to_string( ann.seed.depth ); h += "\""; - h += " fanout=\""; h += std::to_string( ann.seed.fanout ); h += "\""; - if( ann.seed.defs > 1 ) { h += " defs=\""; h += std::to_string( ann.seed.defs ); h += "\""; } - h += unprovenDefsAttrXml( ann.seed.unprovenDefs ); // H1: beside defs=, the rest of what the seed name resolved to - h += seedBiteAttrs( ann.seed ); // C2: each bound's BITE, right after the bound it qualifies (empty when neither bit) - if( ann.seed.reflang != nullptr ) // D4: after the bite pair, same slot logic — the anchor qualifies the whole seed stanza - { - h += " reflang=\""; h += ann.seed.reflang; - h += "\" reflang-origin=\""; h += ann.seed.reflangOrigin; h += "\""; - if( !ann.seed.nextDefs.empty() ) // the corpus tie's pasteable follow-up, beside the disclosure it belongs to — - { // the ONE next= builder the house keeps (nextverb.h, darkflags/docdrift precedents) - h += nextAttrXml( nextFlag( "--defs=", ann.seed.nextDefs ) ); - } - } + } + return h; +} + +// What the <r> root tag states besides est_tokens: the provenance stamp in front, the row-selection disclosures behind. +struct MapRootFacts +{ + const MapAnnotations& ann; + std::string_view rootArg; + bool stable; + const DataSectionsCut& dataSecCut; + std::size_t stemCut; +}; + +inline std::string renderMapRootTag( const MapRootFacts& r, std::size_t estTokens, bool estModelled, std::vector<char>& esc ) +{ + const MapAnnotations& ann = r.ann; + // r26-stamp Task A: ` at="..."` ONLY when the caller passed a non-empty stamp (--map-diff); every other caller passes + // nullptr, so the hot default-map path pays a pointer compare, not a git call. at= stays FIRST — the `<r at="<sha>` byte + // sequence gitstampcheck.sh pins is unchanged. + std::string h = "<r"; + if( ann.atStamp != nullptr && !ann.atStamp->empty() ) { h += " at=\""; h += *ann.atStamp; h += "\""; } + // R-E: after at= (so gitstampcheck's `<r at="<sha>` byte sequence is unmoved), same slot --grep uses right after its own + // identifying attributes — the crawl root every <f p=…> below is now RELATIVE to. + if( !r.rootArg.empty() ) { h += " root=\""; h += escapeXml( r.rootArg, esc ); h += "\""; } + h += seedRootAttrs( ann.seed, esc ); + // §A9.6: after at= (so gitstampcheck's `<r at="<sha>` byte sequence is unmoved) — see MapAnnotations. + if( ann.churnWindow != nullptr ) { h += " rank_by=\""; h += ann.churnRankLabel; h += "\" window=\""; h += escapeXml( *ann.churnWindow, esc ); h += "\""; } + // §B2.1: the windowless rankers stamp the same attribute in the same slot. `else if` states the exclusivity the caller + // guarantees, so a future edit that fills both cannot emit rank_by= twice. + else if( ann.rankByLabel != nullptr ) { h += " rank_by=\""; h += ann.rankByLabel; h += "\""; } + // §P8: est_tokens as a MACHINE-READABLE root attribute — a conformant parser may discard comments, so the number a + // budget-aware caller most needs was unreachable from the comment alone. The SAME `estTokens` value (one estimator). + // --stable omits it on the precedent of the k= rank attribute: --stable buys a byte-stable PREFIX, the root element is + // that prefix, and est_tokens is globally volatile. + if( !r.stable ) { char estAttr[ 40 ]; rw::formatTo( estAttr, sizeof( estAttr ), " est_tokens=\"{}\"", estTokens ); h += estAttr; } + if( !r.stable && estModelled ) { h += " est_measured=\"0\""; } // beside the number it qualifies (MapEstimate) + // W2-F: LAST on the root, after est_tokens — the same placement rule counts_floor= follows, so no existing + // attribute-ADJACENCY assertion in test/ can break on it. NOT suppressed under --stable: the iteration count is a property + // of the CORPUS and the ranker, not of the run's size, and a byte-stable prefix that hides "this ranking is unfinished" + // would be a cache optimisation buying silence. + h += renderDisclosure( ann.prDisclosure, DiscloseAs::XmlAttrs ); + // H14 (capture-audit 2026-09-04): --stable's omissions, DECLARED. An agent reading a --stable map (which is what every MCP + // `analyze` call gets) saw rows with no rank attribute and nothing saying the score exists elsewhere. lens= names what is + // missing, so "absent" reads as "not served here", never as "not computed". Gate: test/mcpattrparitycheck.sh, whose lens= + // arm also fails on a stale name. + if( r.stable ) { h += " lens=\"k,est_tokens\""; } + // L3 follow-up (CodeRabbit 4053600616): TRULY last, past every pre-existing attribute — same placement rule as lens= just + // above, so no attribute-adjacency assertion in test/ can break on it. + if( ann.notesDegraded ) { h += notes::kNotesDegradedAttr; } + h += renderHistoryUnread( DiscloseAs::XmlAttrs ); // K51: absent unless the amp=/churn= walk could not be read + // The code-first pick's swaps, last of all (the same placement rule as the two above): absent when nothing was swapped. + if( r.dataSecCut.cut > 0 ) + { + h += " data_sections_cut=\""; h += std::to_string( r.dataSecCut.cut ); h += "\""; + h += nextAttrXml( dataSectionsNext( r.dataSecCut ) ); + } + if( r.stemCut > 0 ) + { + h += " stem_cut=\""; h += std::to_string( r.stemCut ); h += "\""; // MAP-STEM: absent unless a --max-tokens fit left stem rows out + } + h += ">"; // K51: history_unread='s definition rides the leading legend (HISTORY-UNREAD-LEGEND), not behind this tag + return h; +} + +// ── the XML map's rows ─────────────────────────────────────────────────────────────────────────────────────────── + +// amb= (≤ 17 B) then lpin= (≤ 18 B), each absent when 0: "fast guessed K of this symbol's call targets — read source", then +// the disclosed locality pin (Phase 4). The cursor is the OUT POINTER, never a would-have-written length: lpin= is written AT +// the offset the first write ended, so a count an implementation computed rather than wrote would place it inside the +// half-written amb= attribute. Same defect class as BoundedAttrRun below. +inline std::string rowGuessAttrs( const MapRowSources& src, NodeId id ) +{ + char ambs[ 48 ]; ambs[ 0 ] = '\0'; + char* ap = ambs; + char* const ae = ambs + sizeof( ambs ); + if( const std::uint32_t ambK = counterAt( src.ambOut, id ); ambK > 0 ) + { + ap = std::format_to_n( ap, ( ae - ap ) - 1, " amb=\"{}\"", ambK ).out; + *ap = '\0'; + } + if( const std::uint32_t lpinK = counterAt( src.locPinOut, id ); lpinK > 0 ) + { + ap = std::format_to_n( ap, ( ae - ap ) - 1, " lpin=\"{}\"", lpinK ).out; + *ap = '\0'; + } + return ambs; +} + +// PageRank k= is GLOBALLY volatile (any edit perturbs every rank) → omitted in --stable mode so the prefix stays byte-identical +// for unedited files (provider KV-cache hits). Default keeps k=. +inline std::string rowRankAttr( const MapRowSources& src, NodeId id ) +{ + char kbuf[ 24 ]; kbuf[ 0 ] = '\0'; + if( !src.stable ) + { + rw::formatTo( kbuf, sizeof( kbuf ), " k=\"{:.4f}\"", double( src.rank[ id ] ) ); + } + return kbuf; +} + +// A fixed attribute buffer that truncates the way snprintf did, byte for byte. A4-F8: snprintf returns the WOULD-HAVE-written +// length; on truncation `qp += ret` pushed qp PAST the end, then the next size_t(qe-qp) underflowed to a huge size → unbounded +// stack write. So every append is bound by the OUT POINTER, never by a would-have-written length: std::format_to_n's `out` is +// clamped to the n it was given on any implementation; its `size` is a would-have-written count an implementation can get +// wrong. n is (end-qp)-1 so the NUL always lands in bounds — snprintf's "at most S-1 characters plus a terminator". +// +// The obvious-looking rewrite — `qp = std::format_to_n( qp, qe - qp, ... ).out` — is WRONG, and wrong in a way no fixture +// catches: format_to_n( p, S, ... ) writes up to S and terminates nothing. It buys one extra byte of room and drops the +// terminator. Measured 2026-09-09: that version emitted a row carrying amp="1" where every previous release truncated it away, +// on test/ as the corpus — only a differential run against the pre-conversion binary on a REAL tree exposed it. +// std::format_string keeps -Wformat-security's compile-time checking through the member template. +// +// 96 -> 160 (Phase 1, local-variable-indexing, docs/LOCALS_INDEXING.md): the fn/method worst case grew by locals="4294967295" +// locals_floor="1" (38 B) on top of the pre-existing loc+params+nest+cbo+amp+tested run (~88 B) — 96 would silently TRUNCATE +// (safe from a buffer-overrun standpoint, but a truncated attr run is malformed XML, not a degrade worth shipping quietly). +// 160 -> 192 (ppalt disclosure): ppalt="65535" (+14 B) put the summed fn/method worst case within a rounding error of 160; 192 +// restores the same real headroom. The fn/method group and lcom4 are mutually exclusive, so the size covers ONE group's worst case. +class BoundedAttrRun +{ +public: + BoundedAttrRun() noexcept { buf_[ 0 ] = '\0'; } + BoundedAttrRun( const BoundedAttrRun& ) = delete; + BoundedAttrRun& operator=( const BoundedAttrRun& ) = delete; + + template <class... A> + void append( std::format_string<A...> fmt, A&&... args ) + { + char* const end = buf_ + sizeof( buf_ ); + if( at_ < end ) + { + at_ = std::format_to_n( at_, ( end - at_ ) - 1, fmt, std::forward<A>( args )... ).out; + *at_ = '\0'; } - // §A9.6: after at= (so gitstampcheck's `<r at="<sha>` byte sequence is unmoved) — see MapAnnotations. - if( churnWindow != nullptr ) { h += " rank_by=\""; h += ann.churnRankLabel; h += "\" window=\""; h += escapeXml( *churnWindow, esc ); h += "\""; } - // §B2.1: the windowless rankers stamp the same attribute in the same slot. `else if` states the - // exclusivity the caller guarantees, so a future edit that fills both cannot emit rank_by= twice. - else if( ann.rankByLabel != nullptr ) { h += " rank_by=\""; h += ann.rankByLabel; h += "\""; } - // §P8: est_tokens as a MACHINE-READABLE root attribute. The map reported its own size only inside the - // comment above, and a conformant parser may discard comments — so the number a budget-aware caller most - // needs was unreachable. Additive: the comment is kept, and this carries the SAME `estTokens` value - // (one estimator). --stable omits it on the precedent of the k= rank attribute below: --stable buys a - // byte-stable PREFIX, the root element is that prefix, and est_tokens is globally volatile. - if( !stable ) { char estAttr[ 40 ]; rw::formatTo( estAttr, sizeof( estAttr ), " est_tokens=\"{}\"", estTokens ); h += estAttr; } - if( !stable && estimate.isModelled ) { h += " est_measured=\"0\""; } // beside the number it qualifies (MapEstimate) - // W2-F: LAST on the root, after est_tokens — the same placement rule counts_floor= follows, so no - // existing attribute-ADJACENCY assertion in test/ can break on it. Unlike est_tokens this is NOT - // suppressed under --stable: the iteration count is a property of the CORPUS and the ranker, not of - // the run's size, so it does not move between two runs over the same tree, and a byte-stable prefix - // that hides "this ranking is unfinished" would be a cache optimisation buying silence. - h += renderDisclosure( ann.prDisclosure, DiscloseAs::XmlAttrs ); - // H14 (capture-audit 2026-09-04): --stable's omissions, DECLARED. Both are deliberate and both are - // argued for above — k= is globally volatile so dropping it is what buys the byte-stable prefix, and - // est_tokens= follows it for the same reason. But an agent reading a --stable map (which is what - // every MCP `analyze` call gets) saw 185 rows with no rank attribute and nothing saying the score - // exists elsewhere: membership is by PageRank, the emitted order is by file, and the score was - // simply gone. lens= names what is missing, so "absent" reads as "not served here", never as "not - // computed". Gate: test/mcpattrparitycheck.sh, whose lens= arm also fails on a stale name. - if( stable ) { h += " lens=\"k,est_tokens\""; } - // L3 follow-up (CodeRabbit 4053600616): TRULY last, past every pre-existing attribute — same placement - // rule as lens= just above, so no attribute-adjacency assertion in test/ can break on it. - if( ann.notesDegraded ) { h += notes::kNotesDegradedAttr; } - h += renderHistoryUnread( DiscloseAs::XmlAttrs ); // K51: absent unless the amp=/churn= walk could not be read - // The code-first pick's swaps, last of all (the same placement rule as the two above): absent when nothing was swapped. - if( dataSecCut.cut > 0 ) - { - h += " data_sections_cut=\""; h += std::to_string( dataSecCut.cut ); h += "\""; - h += nextAttrXml( dataSectionsNext( dataSecCut ) ); - } - if( stemPick.cut > 0 ) - { - h += " stem_cut=\""; h += std::to_string( stemPick.cut ); h += "\""; // MAP-STEM: absent unless a --max-tokens fit left stem rows out - } - h += ">"; // K51: history_unread='s definition rides the leading legend above (HISTORY-UNREAD-LEGEND), not behind this tag - return h; - }; - const auto buildTail = [ & ]( std::size_t estTokens ) -> std::string + } + const char* c_str() const noexcept { return buf_; } + +private: + char buf_[ 192 ]; + char* at_ = buf_; +}; + +// A function or method row's SHAPE attributes, --metrics only: params= (a floor when countParams saturated), nest= and its +// profile, steer=/tangle=, locals=, ppalt=. Only fns/methods carry them, so a class/sec never carries a 0 it can't have. +inline void appendFnShapeAttrs( BoundedAttrRun& run, const Symbol& s ) +{ + run.append( " params=\"{}\"", unsigned( s.params ) ); + if( s.params == std::numeric_limits<decltype( s.params )>::max() ) { - return ( stable && !statsFirstScreen ) ? buildStats( estTokens ) : std::string{}; - }; + run.append( " params_floor=\"1\"" ); // CR #586: countParams saturates at the field width, so this count is a floor + } + run.append( " nest=\"{}\"", unsigned( s.maxNest ) ); + // The nesting PROFILE beside the max (model.h Symbol::humps/deepLoc). nest= alone cannot distinguish a long run of shallow + // scoped steps from a body that sustains depth. Omitted, never a bare 0, when no region reached quality::kNestBar: that is + // exactly nest < kNestBar, which the row already carries, so absence is lossless rather than a truncation + // (test/nestprofilecheck.sh arm 5 pins the equivalence in both directions). + if( s.humps > 0 ) + { + run.append( " humps=\"{}\" deep=\"{}\" deep_floor=\"1\"", unsigned( s.humps ), unsigned( s.deepLoc ) ); + } + run.append( "{}", tangleMetricAttrs( s, /*json=*/false ) ); // QD-TANGLE: steer= / tangle=, each absent at 0 + // Phase 1 (local-variable-indexing, docs/LOCALS_INDEXING.md): locals= is ABSENT — never a bare "0" — for every def outside + // model.h's localsCountedLang (MVP: C/C++ only), so a reader never mistakes "not counted for this language" for "counted, + // and there are none". locals_floor="1" always rides alongside a present locals=: `int a,b;` counts as ONE + // declaration-statement, not two names (see cc_isCountableLocalDecl's own comment). + if( localsCountedLang( s.lang ) ) + { + run.append( " locals=\"{}\" locals_floor=\"1\"", unsigned( s.locals ) ); + } + // ppalt disclosure: the body carries preproc branches that never coexist at compile time, so this row's structural metrics + // are sums over ALL of them (model.h Symbol::ppAlt). ABSENT when 0 — presence itself is the signal. + if( s.ppAlt > 0 ) + { + run.append( " ppalt=\"{}\"", unsigned( s.ppAlt ) ); + } +} - // ── PHASE 1: render <r>'s CHILDREN into a buffer ──────────────────────────────────────────────────── - // §H7: est_tokens must charge the bytes the document actually carries, not a model of the symbol set — - // the model prices neither --metrics decoration nor an appended payload, which is how one number came to - // stand for five documents. So: measure, decide, then write (the order --recall's emitRecallBudgeted and - // the --for lens's pre-rendered sigs block already impose on themselves). - // - // DEGRADE: an open_memstream failure keeps the whole map — the head goes out FIRST carrying the MODELLED - // estimate (the pre-§H7 number, so this path is no worse than the old behaviour, never a fabricated one) - // and the children stream straight to `out` behind it. - rw::MemoryStream childStream; - std::FILE* const childMem = openChargeStream( childStream ); - if( !childMem ) +// The Q-compute descriptive attributes (loc/params/nest/locals/cbo/lcom4/amp/tested), --metrics only — facts, never gates. +// loc first (SIZE is the master variable); lcom4 only for class-kinds with methods (kLcom4NA = 0xFFFFFFFF omits); tested only +// when 1 (lean output). +inline void appendQMetricAttrs( BoundedAttrRun& run, const Symbol& s, NodeId id, const MapRowSources& src ) +{ + if( s.loc > 0 ) { - DISCLOSE( estimate, MapEstimate::DisclosureWhy::ChargeBufferFailed, "serialize: open_memstream failed — est_tokens reports the MODELLED bytes, not the emitted ones" ); + run.append( " loc=\"{}\"", s.loc ); + } + if( s.kind == SymKind::Function || s.kind == SymKind::Method ) + { + appendFnShapeAttrs( run, s ); + } + if( src.cbo && id < src.cbo->size() ) + { + run.append( " cbo=\"{}\"", ( *src.cbo )[ id ] ); + } + if( src.lcom4 && id < src.lcom4->size() && ( *src.lcom4 )[ id ] != 0xFFFFFFFFu ) + { + run.append( " lcom4=\"{}\"", ( *src.lcom4 )[ id ] ); + } + if( src.amp && id < src.amp->size() ) + { + run.append( " amp=\"{}\"", ( *src.amp )[ id ] ); + } + if( src.tested && id < src.tested->size() && ( *src.tested )[ id ] ) + { + run.append( " tested=\"1\"" ); } +} - const std::size_t modelledTokens = mapEstTokens + extraPayloadTokens; - // The children, as ONE renderer both paths call. This was inline code writing through a writer bound to "the buffer, - // or `out` when the buffer could not open". That serves a failed open, and cannot serve a buffer that opened and then - // lost a write: by then the children were already spent into it, and the only bytes left to print had a hole in them. - std::vector<std::uint32_t> hedgedScratch; // FE-B: writeMapCalleeRows' reused buffer - const auto writeChildren = [ & ]( XmlWriter& w ) +// The row's descriptive attributes as ONE run after its identity attributes: under --metrics with fan-in, in=/out=/cx=/ccx=, +// role="hub" at fan-in ≥ 8 and the Q-compute run first; then amb=/lpin= and k=. Composed in one fixed buffer, as always, so a +// run past its width truncates at the byte it always did. +inline std::string rowDescriptiveAttrs( const Symbol& s, NodeId id, const MapRowSources& src ) +{ + const std::uint32_t outDegree = src.outOff[ id + 1 ] - src.outOff[ id ]; + const std::string guesses = rowGuessAttrs( src, id ); + const std::string rankAttr = rowRankAttr( src, id ); + char attr[ 352 ]; + if( src.metrics && src.fanIn ) { - // §P8 collision: this prologue spelled its LABEL `l=`, the two characters 22 other sites use for a LINE - // NUMBER — including the <f p= …> rows just below. Renamed: the label had exactly two references in the - // tree (both updated here) against 15+ readers of the line-number meaning that must not move. - if( ing.rootLabels.size() >= 2 ) - { // A13 prologue: label → root path, canonical order - for( std::size_t r = 0; r < ing.rootLabels.size(); ++r ) - { - w.write( "<root label=\"" ); w.write( escapeXml( ing.rootLabels[r], esc ) ); - w.write( "\" p=\"" ); w.write( escapeXml( r < ing.rootPaths.size() ? ing.rootPaths[r] : std::string(), esc ) ); - w.write( "\"/>" ); - } - } - writeRecentRows( w, ann, pathRel, esc ); // F3: rank_by=churn-decay's file-level answer, before the symbol map - // C1-b: under in=DIR the symbol map is a DISCLOSED stub (docs/METHODOLOGY.md §9.3) — the caller asked for DIR's - // recent files, not the map. - // - // NOT total=/shown=, which is what this first shipped as. Under pageview.h's vocabulary total= is THE TOTAL - // (rule 2) and capped= always rides beside a shown= (rule 3), and the stub had neither property: it printed - // total="200" — the --top-k PAGE SIZE — on a document whose own header says symbols="18457", with no capped=, - // so the one number it carried was the one number it was not allowed to mean. The stub is not a page of the map - // and it must not borrow the page vocabulary to say so. It says what it IS instead: - // stubbed="1" the symbol map was not rendered at all (the <f> loop walks an empty order below) - // would_show="N" `keep` — the un-stubbed header's own shown=, and shown= counts symbol DEFINITIONS - // individually, not printed rows: the print loop runs collapseOverloadRows() per file - // bucket, so a const/non-const pair that both make the top-K cut prints ONE row carrying - // overloads=2. The row count therefore FOLLOWS from the identity the map legend already - // publishes for shown= — rows+sum(overloads-1)=shown — rather than being reported here. - // Measured on this repo 2026-09-14: shown=200, 193 <s> rows, 7 at overloads=2, 193+7=200. - // IT IS A DEFINITION COUNT AND NOT A CEILING, by owner decision 2026-09-14, and the - // reason is vocabulary: in this tool a floor/ceiling marker means "we could not see - // everything" (counts_floor=, _capped, the truncation disclosures). would_show is EXACT; - // what differs from a reader's guess is the UNIT. Spending an uncertainty marker on a - // unit difference would make "ceiling" mean "exact, but not in the unit you assumed" and - // weaken every honest use of the word elsewhere in the output. Naming the quantity is - // also the stronger claim: a ceiling cannot be inverted, while a definition count plus - // the published identity yields the rows. Reporting post-collapse rows instead — the - // review's original ask — is not available at this site for any price worth paying: - // which definitions survive the cut is a fact about the RANKING, and not ranking is the - // whole point of the stub (no pr_iters= rides its header). Not the corpus total either - // (that is symbols=), so the three cannot be read as each other. - // test/recentscopecheck.sh arms 14a/14b pin the arithmetic. - // Rule 3's own sentence sanctions the shape: "If a verb emits no shown=, it emits no capped= either." - if( ann.stubSymbols ) - { - std::string stub = "<symbols stubbed=\"1\" would_show=\""; // std::string, not a char[]: next= is already-markup (fixedbufsweep's rule) - stub += std::to_string( keep ); // `keep` is computed above from topK and S alone — the count with no ranking behind it - stub += "\""; - stub += nextAttrXml( ann.stubNext ); - stub += "/>"; - w.write( stub ); - } - // D7: the inventory tier rides the LOW-importance end of the document — after the rows, or before them when the - // map is emitted important-last (an explicit flag or the fill-aware auto flip), so the top-ranked rows keep the - // end position that order promises. - const auto writeInventory = [ & ]() - { - if( inventory.active ) - { - writeMapInventoryXml( w, ing, inventory, pathRel, outOff, outTargets, outProv, outNameOnly, esc, hedgedScratch ); - } - }; - const bool inventoryFirst = !stable && effImportantLast; // --stable's path order wins, as it does for the rows - if( inventoryFirst ) - { - writeInventory(); - } - static const std::vector<std::uint32_t> kNoFiles; - for( std::uint32_t f : ann.stubSymbols ? kNoFiles : fileOrder ) - { - w.write( "<f p=\"" ); w.write( escapeXml( pathRel( f ), esc ) ); w.write( "\"" ); - if( const char* fl = builtinLayer( rootRelPath( ing, f ) ); *fl ) { w.write( " layer=\"" ); w.write( fl ); w.write( "\"" ); } // P3 - w.write( ">" ); + BoundedAttrRun qmetrics; + appendQMetricAttrs( qmetrics, s, id, src ); + const std::uint32_t in = ( id < src.fanIn->size() ) ? ( *src.fanIn )[ id ] : 0u; + rw::formatTo( attr, sizeof( attr ), " in=\"{}\" out=\"{}\" cx=\"{}\" ccx=\"{}\"{}{}{}{}", + in, outDegree, s.cx, s.ccx, ( in >= 8 ? " role=\"hub\"" : "" ), qmetrics.c_str(), guesses, rankAttr ); + } + else + { + rw::formatTo( attr, sizeof( attr ), "{}{}", guesses, rankAttr ); + } + return attr; +} - // §P6.3: see collapseOverloadRows() above — const/non-const overload pairs are already folded to - // one representative row per (kind,id) before this loop runs, so the loop body below is unchanged - // shape (no added branch): it just iterates a shorter vector. - const OverloadRows rows = overloadRowsFor( ing, buckets[f], metrics ); // --metrics: one row per definition +// Essential complexity (model.h Symbol::ev), --metrics only. Emitted iff ev >= 2: ev >= 1 for any walked fn/method body, so on +// a row carrying cx= ABSENT means exactly ev == 1 — lossless, and never a bare ev="1" (G4 + the honesty contract point the +// same way). Routed through evCountedLang so an uncovered language (Bash) reads as "not counted", never "counted, 1". +// ev_floor="1" always rides along: noreturn calls, macro-hidden returns and unresolvable gotos are invisible to the syntactic +// walk and can only RAISE the true value. ev_why= is the reason breakdown that keeps §10.1-Option-A honest (a guard-heavy row +// is visibly not a knot). Composed on std::string: ev_why= is variable-length text (fixedbufsweep's rule). +inline std::string rowEssentialComplexityAttrs( const Symbol& s, bool metrics ) +{ + if( !metrics || !( s.kind == SymKind::Function || s.kind == SymKind::Method ) || !evCountedLang( s.lang ) || s.ev < 2u ) + { + return {}; + } + return " ev=\"" + std::to_string( s.ev ) + "\" ev_floor=\"1\" ev_why=\"" + evWhyString( s ) + "\""; +} - for( std::size_t i = 0; i < rows.id.size(); ++i ) - { - const NodeId id = rows.id[i]; - const Symbol& s = ing.symbols[id]; - const std::uint32_t out = outOff[id + 1] - outOff[id]; - w.write( "<s t=\"" ); w.write( symTag( s.kind ) ); - w.write( "\" n=\"" ); w.write( escapeXml( s.name, esc ) ); w.write( "\"" ); // close n="…" here so sc= can follow - - // S6-C / row 6 (2026-09-12): the SHORT id. The canonical SCIP-style id is `path::scope::name`, and - // on a map row the path is the enclosing <f p=> verbatim — 942 of 942 scoped rows on this tree - // repeated it, 11.2% of a flagless map. The row now prints ONLY the segment the wrapper does not - // carry: sc= the enclosing scope. The legend states the composition (id = p::sc::n), the selectors - // keep accepting the composed spelling, and test/scroundtripcheck.sh proves the composed multiset is - // byte-identical to the id= multiset this row used to print. Emitted ONLY when a scope exists — - // exactly when the canonical id differed from the bare name (canonicalId degrades to the name on an - // empty scope), so the row set that carries an identity attribute is unchanged. - writeScopeAttr( w, s, esc ); - if( !stemRows.empty() && std::ranges::binary_search( stemRows, id ) ) - { - w.write( " stem=\"1\"" ); // MAP-STEM: the file's stem-namesake type, added below the top-K cut - } +// One <s> row and its <c> callee rows. +inline void writeMapSymbolRow( XmlWriter& w, const IngestResult& ing, const OverloadRows& rows, std::size_t i, const std::vector<NodeId>& stemRows, + const MapRowSources& src, std::vector<char>& esc, std::vector<std::uint32_t>& scratch ) +{ + const NodeId id = rows.id[ i ]; + const Symbol& s = ing.symbols[ id ]; + w.write( "<s t=\"" ); w.write( symTag( s.kind ) ); + w.write( "\" n=\"" ); w.write( escapeXml( s.name, esc ) ); w.write( "\"" ); // close n="…" here so sc= can follow + // S6-C / row 6 (2026-09-12): the SHORT id. The canonical SCIP-style id is `path::scope::name`, and on a map row the path is + // the enclosing <f p=> verbatim. The row prints ONLY the segment the wrapper does not carry: sc= the enclosing scope. The + // legend states the composition (id = p::sc::n) and test/scroundtripcheck.sh proves the composed multiset is byte-identical + // to the id= multiset this row used to print. Emitted ONLY when a scope exists. + writeScopeAttr( w, s, esc ); + if( !stemRows.empty() && std::ranges::binary_search( stemRows, id ) ) + { + w.write( " stem=\"1\"" ); // MAP-STEM: the file's stem-namesake type, added below the top-K cut + } + w.write( overloadsAttr( rows.overloads[ i ] ) ); // see overloadsAttr() above — empty in the common case + w.write( splitLineAttr( rows, i, s ) ); // --metrics per-definition rows only + // A4-R5: bind="pkg.Cls.method" — the decoded JNI binding label (graph.h g.bindLabel), when this symbol has one. Not + // --metrics-gated: it is an identity fact like id=, not a descriptive stat. Omitted whenever bind is nullptr or the label is + // empty (the overwhelming common case) → zero token cost, byte-identical golden map on non-JNI corpora. + if( const std::string_view label = src.bind ? src.bind->labelOf( id ) : std::string_view{}; !label.empty() ) + { + w.write( " bind=\"" ); w.write( escapeXml( label, esc ) ); w.write( "\"" ); + } + w.write( rowDescriptiveAttrs( s, id, src ) ); + // EXTENT HONESTY (kExtentSuspectRowLegend): the containment checks this row's extent/scope/kind failed. After k= so every + // pre-existing adjacency holds; absent when every check held (clean corpora unchanged). + if( s.extentSuspect != 0 ) + { + w.write( " extent_suspect=\"" ); + w.write( extent::extentSuspectReasons( s.extentSuspect ) ); + w.write( "\"" ); + } + w.write( rowEssentialComplexityAttrs( s, src.metrics ) ); + w.write( ">" ); + writeMapCalleeRows( w, ing, src.outOff[ id ], src.outOff[ id + 1 ], src.outTargets, src.outProv, src.outNameOnly, esc, scratch ); + w.write( "</s>" ); +} - w.write( overloadsAttr( rows.overloads[i] ) ); // see overloadsAttr() above — empty in the common case - w.write( splitLineAttr( rows, i, s ) ); // --metrics per-definition rows only +// One <f> group: the file's path and arch layer (P3), then its rows. §P6.3: const/non-const overload pairs are folded to one +// representative row per (kind,id) by overloadRowsFor() before the rows are written (--metrics: one row per definition). +template <class PathRel> +inline void writeMapFileGroup( XmlWriter& w, const IngestResult& ing, std::uint32_t f, const MapFileGroups& groups, const MapRowSources& src, + const PathRel& pathRel, std::vector<char>& esc, std::vector<std::uint32_t>& scratch ) +{ + w.write( "<f p=\"" ); w.write( escapeXml( pathRel( f ), esc ) ); w.write( "\"" ); + if( const char* fl = builtinLayer( rootRelPath( ing, f ) ); *fl ) { w.write( " layer=\"" ); w.write( fl ); w.write( "\"" ); } // P3 + w.write( ">" ); + const OverloadRows rows = overloadRowsFor( ing, groups.buckets[ f ], src.metrics ); + for( std::size_t i = 0; i < rows.id.size(); ++i ) + { + writeMapSymbolRow( w, ing, rows, i, groups.stemPick.rows, src, esc, scratch ); + } + w.write( "</f>" ); +} - // A4-R5: bind="pkg.Cls.method" — the decoded JNI binding label (graph.h g.bindLabel), when this - // symbol has one. Unconditional (not --metrics-gated): it is an identity fact like id=, not a - // descriptive stat. Omitted whenever bind is nullptr or the per-symbol label is empty (the - // overwhelming common case) → zero token cost, byte-identical golden map on non-JNI corpora. - if( const std::string_view label = bind ? bind->labelOf( id ) : std::string_view{}; !label.empty() ) - { - w.write( " bind=\"" ); w.write( escapeXml( label, esc ) ); w.write( "\"" ); - } +// A13 prologue, multi-root only: label → root path, canonical order. §P8 collision: this prologue spelled its LABEL `l=`, the +// two characters 22 other sites use for a LINE NUMBER — including the <f p= …> rows. Renamed to label=. +inline void writeRootLabelPrologue( XmlWriter& w, const IngestResult& ing, std::vector<char>& esc ) +{ + if( ing.rootLabels.size() < 2 ) + { + return; + } + for( std::size_t r = 0; r < ing.rootLabels.size(); ++r ) + { + w.write( "<root label=\"" ); w.write( escapeXml( ing.rootLabels[r], esc ) ); + w.write( "\" p=\"" ); w.write( escapeXml( r < ing.rootPaths.size() ? ing.rootPaths[r] : std::string(), esc ) ); + w.write( "\"/>" ); + } +} - char ambs[ 48 ]; ambs[ 0 ] = '\0'; // "fast guessed K of this symbol's call targets — read source" - // amb= (≤ 17 B) then lpin= (≤ 18 B) in ONE buffer, each absent when 0. The cursor is the OUT - // POINTER, never a would-have-written length: lpin= is written AT the offset the first write - // ended, so a count an implementation computed rather than wrote would place it inside the - // half-written amb= attribute. Same defect class as the appendf clamps below. - char* ap = ambs; - char* const ae = ambs + sizeof( ambs ); - if( const std::uint32_t ambK = counterAt( ambOut, id ); ambK > 0 ) - { - ap = std::format_to_n( ap, ( ae - ap ) - 1, " amb=\"{}\"", ambK ).out; - *ap = '\0'; - } - if( const std::uint32_t lpinK = counterAt( locPinOut, id ); lpinK > 0 ) // Phase 4: the disclosed locality pin - { - ap = std::format_to_n( ap, ( ae - ap ) - 1, " lpin=\"{}\"", lpinK ).out; - *ap = '\0'; - } +// C1-b: under in=DIR the symbol map is a DISCLOSED stub (docs/METHODOLOGY.md §9.3) — the caller asked for DIR's recent files, +// not the map. +// +// NOT total=/shown=, which is what this first shipped as. Under pageview.h's vocabulary total= is THE TOTAL (rule 2) and +// capped= always rides beside a shown= (rule 3), and the stub had neither property: it printed total="200" — the --top-k PAGE +// SIZE — on a document whose own header says symbols="18457", with no capped=, so the one number it carried was the one +// number it was not allowed to mean. The stub is not a page of the map and it must not borrow the page vocabulary to say so. +// It says what it IS instead: +// stubbed="1" the symbol map was not rendered at all (the stub ranks and groups no row) +// would_show="N" `keep` — the un-stubbed header's own shown=, and shown= counts symbol DEFINITIONS individually, not +// printed rows: the print loop runs collapseOverloadRows() per file bucket, so a const/non-const pair that +// both make the top-K cut prints ONE row carrying overloads=2. The row count therefore FOLLOWS from the +// identity the map legend already publishes for shown= — rows+sum(overloads-1)=shown — rather than being +// reported here. Measured on this repo 2026-09-14: shown=200, 193 <s> rows, 7 at overloads=2, 193+7=200. +// IT IS A DEFINITION COUNT AND NOT A CEILING, by owner decision 2026-09-14, and the reason is vocabulary: +// in this tool a floor/ceiling marker means "we could not see everything" (counts_floor=, _capped, the +// truncation disclosures). would_show is EXACT; what differs from a reader's guess is the UNIT. Naming the +// quantity is also the stronger claim: a ceiling cannot be inverted, while a definition count plus the +// published identity yields the rows. Reporting post-collapse rows instead is not available at this site +// for any price worth paying: which definitions survive the cut is a fact about the RANKING, and not +// ranking is the whole point of the stub (no pr_iters= rides its header). Not the corpus total either +// (that is symbols=), so the three cannot be read as each other. +// test/recentscopecheck.sh arms 14a/14b pin the arithmetic. +// Rule 3's own sentence sanctions the shape: "If a verb emits no shown=, it emits no capped= either." +inline void writeSymbolMapStub( XmlWriter& w, std::size_t keep, std::string_view stubNext ) +{ + std::string stub = "<symbols stubbed=\"1\" would_show=\""; // std::string, not a char[]: next= is already-markup (fixedbufsweep's rule) + stub += std::to_string( keep ); // `keep` depends on topK and the printable rows alone — the count with no ranking behind it + stub += "\""; + stub += nextAttrXml( stubNext ); + stub += "/>"; + w.write( stub ); +} + +// <r>'s children, as ONE renderer serialize()'s measured path and its degrade path both call: the multi-root prologue, F3's +// recent files (rank_by=churn-decay's file-level answer, before the symbol map), the stub or the <f> groups, and the D7 +// inventory tier. The inventory rides the LOW-importance end of the document — after the rows, or before them when the map +// is emitted important-last, so the top-ranked rows keep the end position that order promises. +template <class PathRel> +inline void writeMapChildren( XmlWriter& w, const IngestResult& ing, const MapAnnotations& ann, std::size_t keep, const MapFileGroups& groups, + MapEmitOrder emitOrder, const MapRowSources& src, const PathRel& pathRel, std::vector<char>& esc, + std::vector<std::uint32_t>& scratch ) +{ + writeRootLabelPrologue( w, ing, esc ); + writeRecentRows( w, ann, pathRel, esc ); + if( ann.stubSymbols ) + { + writeSymbolMapStub( w, keep, ann.stubNext ); + } + const auto writeInventory = [ & ]() + { + if( groups.inventory.active ) + { + writeMapInventoryXml( w, ing, groups.inventory, pathRel, src.outOff, src.outTargets, src.outProv, src.outNameOnly, esc, scratch ); + } + }; + const bool inventoryFirst = isImportantLast( emitOrder ); // --stable's path order wins, as it does for the rows + if( inventoryFirst ) + { + writeInventory(); + } + for( const std::uint32_t f : groups.fileOrder ) + { + writeMapFileGroup( w, ing, f, groups, src, pathRel, esc, scratch ); + } + if( !inventoryFirst ) + { + writeInventory(); + } + w.write( "</r>" ); +} - // PageRank k= is GLOBALLY volatile (any edit perturbs every rank) → omit it in --stable mode - // so the prefix stays byte-identical for unedited files (provider KV-cache hits). Default keeps k=. - char kbuf[ 24 ]; kbuf[ 0 ] = '\0'; - if( !stable ) - { - rw::formatTo( kbuf, sizeof( kbuf ), " k=\"{:.4f}\"", double( rank[id] ) ); - } +// The fixpoint: est_tokens covers head + children + tail, and head/tail both PRINT est_tokens, so the digit count feeds back. +// Converges in ≤2 passes in practice (each extra digit moves the estimate by <1 token); the bound is 4, matching recall.h's. +// +// WHAT THE LOOP GUARANTEES (CA4 verifier L4): the LAST built pair is always the pair returned, and ON CONVERGENCE — the number +// stopped moving — that pair's own bytes are exactly the bytes `estTokens` was measured over, so the document's stated number +// describes the document. On the BOUND (4 passes without convergence, not observed on any measured corpus) the head/tail were +// rebuilt from the last `next` while `next` was measured over the PREVIOUS pair's widths, which differ only in the digit count +// of one field: at most a few bytes, i.e. a residual well under one token, and never a fabricated number. The honest statement +// is "converged ⇒ exact; bounded ⇒ within a digit's worth of bytes", not "always exact". +struct SettledHeadTail +{ + std::size_t estTokens = 0; + std::string head; + std::string tail; +}; - // Q-compute descriptive attrs (loc/params/nest/locals/cbo/lcom4/tested), built into a side buffer - // that is appended before the closing '>' of the metrics attr. ALL --metrics-only; absent by - // default so the golden map is byte-identical. params/nest/locals emitted only for fns/methods - // (kind guard) so a class/sec never carries a 0 it can't have; lcom4 only for class-kinds with - // methods (kLcom4NA sentinel omits) — mutually exclusive with the fn/method group, which is why - // the buffer sizing below only has to cover ONE of the two groups' worst case, not both summed. - // 96 -> 160 (Phase 1, local-variable-indexing, docs/LOCALS_INDEXING.md): the fn/method worst - // case grew by locals="4294967295" locals_floor="1" (38 B) on top of the pre-existing - // loc+params+nest+cbo+amp+tested run (~88 B) — 96 would silently TRUNCATE (appendf's qe-clamp - // makes truncation safe from a buffer-overrun standpoint, but a truncated attr run is malformed - // XML, not a degrade worth shipping quietly). 160 -> 192 (ppalt disclosure): ppalt="65535" - // (+14 B) put the summed fn/method worst case within a rounding error of 160; 192 restores the - // same real headroom over the recomputed worst case. - char qbuf[ 192 ]; qbuf[ 0 ] = '\0'; - if( metrics ) - { - char* qp = qbuf; char* const qe = qbuf + sizeof( qbuf ); - // A4-F8: snprintf returns the WOULD-HAVE-written length; on truncation `qp += ret` pushes qp - // PAST qe, then the next size_t(qe-qp) underflows to a huge size → unbounded stack write. Clamp - // qp to qe after every append (once full, further appends write nothing and stay clamped). - // fmt is always a string literal at every call site below — the non-literal warning is - // an artifact of routing it through the lambda parameter - // rw::formatTo reproduces snprintf's contract EXACTLY, so the A4-F8 clamp below is kept - // verbatim: it is applied to the same would-have-written length, and truncation therefore - // happens at the same byte it always did. - // - // The obvious-looking rewrite — `qp = std::format_to_n( qp, qe - qp, ... ).out` — is WRONG, - // and wrong in a way no fixture catches. snprintf( p, S, ... ) writes at most S-1 characters - // PLUS a NUL; format_to_n( p, S, ... ) writes up to S and terminates nothing. It buys one - // extra byte of room and drops the terminator. Measured 2026-09-09: that version emitted a - // row carrying amp="1" where every previous release truncated it away, on test/ as the - // corpus. The byte fence was green throughout — the fixture's attribute strings never reach - // this 80-byte buffer, so only a differential run against the pre-conversion binary on a - // REAL tree exposed it. - // - // What the conversion does keep: -Wformat-security is gone, because std::format_string - // preserves compile-time checking THROUGH the lambda parameter where a const char* fmt - // could not. - const auto appendf = [ & ]< class... A >( std::format_string<A...> fmt, A&&... args ) - { - // Bound by the OUT POINTER, never by a would-have-written length. std::format_to_n's - // `out` is clamped to the n it was given on any implementation; its `size` is a - // would-have-written count that an implementation can get wrong, and this clamp used - // to depend on it. n is (qe-qp)-1 so the NUL below always lands in bounds, which is - // snprintf's "at most S-1 characters plus a terminator", byte for byte. - if( qp < qe ) - { - const auto r = std::format_to_n( qp, ( qe - qp ) - 1, fmt, std::forward<A>( args )... ); - qp = r.out; - *qp = '\0'; - } - }; - // loc: physical line span — always meaningful (SIZE is the master variable — report it first). - if( s.loc > 0 ) - { - appendf( " loc=\"{}\"", s.loc ); - } - const bool isFn = ( s.kind == SymKind::Function || s.kind == SymKind::Method ); - if( isFn ) - { - appendf( " params=\"{}\"", unsigned( s.params ) ); - if( s.params == std::numeric_limits<decltype( s.params )>::max() ) - { - appendf( " params_floor=\"1\"" ); // CR #586: countParams saturates at the field width, so this count is a floor - } - appendf( " nest=\"{}\"", unsigned( s.maxNest ) ); - // The nesting PROFILE beside the max (model.h Symbol::humps/deepLoc). nest= alone cannot - // distinguish a long run of shallow scoped steps from a body that sustains depth — both - // report their deepest line and nothing about how much of the function is that deep. - // Omitted, never a bare 0, when no region reached quality::kNestBar: that is exactly - // nest < kNestBar, which the row already carries, so absence is lossless rather than a - // truncation (test/nestprofilecheck.sh arm 5 pins the equivalence in both directions). - if( s.humps > 0 ) - { - appendf( " humps=\"{}\" deep=\"{}\" deep_floor=\"1\"", unsigned( s.humps ), unsigned( s.deepLoc ) ); - } - appendf( "{}", tangleMetricAttrs( s, /*json=*/false ) ); // QD-TANGLE: steer= / tangle=, each absent at 0 - // Phase 1 (local-variable-indexing, docs/LOCALS_INDEXING.md): locals= is ABSENT — never - // a bare "0" — for every def outside model.h's localsCountedLang (MVP: C/C++ only), so a - // reader never mistakes "not counted for this language" for "counted, and there are none". - // locals_floor="1" always rides alongside a present locals=: `int a,b;` counts as ONE - // declaration-statement, not two names (see cc_isCountableLocalDecl's own comment). - if( localsCountedLang( s.lang ) ) - { - appendf( " locals=\"{}\" locals_floor=\"1\"", unsigned( s.locals ) ); - } - // ppalt disclosure: the body carries preproc branches that never coexist at compile - // time, so this row's structural metrics are sums over ALL of them (model.h Symbol:: - // ppAlt). ABSENT when 0 — presence itself is the signal. - if( s.ppAlt > 0 ) - { - appendf( " ppalt=\"{}\"", unsigned( s.ppAlt ) ); - } - } - if( cbo && id < cbo->size() ) - { - appendf( " cbo=\"{}\"", (*cbo)[id] ); - } - if( lcom4 && id < lcom4->size() && ( *lcom4 )[id] != 0xFFFFFFFFu ) - { // 0xFFFFFFFF = kLcom4NA (graph.h) ⇒ omit - appendf( " lcom4=\"{}\"", (*lcom4)[id] ); - } - if( amp && id < amp->size() ) - { - appendf( " amp=\"{}\"", (*amp)[id] ); - } - if( tested && id < tested->size() && ( *tested )[id] ) - { // omit when 0 (lean output) - appendf( " tested=\"1\"" ); - } - } +template <class BuildHead, class BuildTail> +inline SettledHeadTail settleEstTokens( std::size_t modelledTokens, std::size_t childBytes, double bytesPerToken, std::size_t extraPayloadTokens, + const BuildHead& buildHead, const BuildTail& buildTail ) +{ + SettledHeadTail s{ modelledTokens, buildHead( modelledTokens ), buildTail( modelledTokens ) }; + for( int pass = 0; pass < 4; ++pass ) + { + const std::size_t next = tokensForEmittedBytes( s.head.size() + childBytes + s.tail.size(), bytesPerToken ) + extraPayloadTokens; + if( next == s.estTokens ) + { + break; + } + s.estTokens = next; + s.head = buildHead( next ); + s.tail = buildTail( next ); + } + return s; +} - char attr[ 352 ]; // descriptive metric attrs (fan-in/out/cx/role/amb/lpin + Q-compute qbuf) — facts, never - // gates. The name quote + id= are already written above; this opens with a space. - // The closing '>' is written separately below so the ev run — composed on - // std::string, never a fixed char buffer (fixedbufsweep's own rule: ev_why= is - // variable-length text) — can sit inside the element. - if( metrics && fanIn ) - { - const std::uint32_t in = ( id < fanIn->size() ) ? (*fanIn)[id] : 0u; - rw::formatTo( attr, sizeof( attr ), " in=\"{}\" out=\"{}\" cx=\"{}\" ccx=\"{}\"{}{}{}{}", - in, out, s.cx, s.ccx, ( in >= 8 ? " role=\"hub\"" : "" ), rw::cstr( qbuf ), rw::cstr( ambs ), rw::cstr( kbuf ) ); - } - else - { - rw::formatTo( attr, sizeof( attr ), "{}{}", rw::cstr( ambs ), rw::cstr( kbuf ) ); - } - w.write( attr ); - // EXTENT HONESTY (kExtentSuspectRowLegend): the containment checks this row's extent/scope/kind failed. - // After k= so every pre-existing adjacency holds; absent when every check held (clean corpora unchanged). - if( s.extentSuspect != 0 ) - { - w.write( " extent_suspect=\"" ); - w.write( extent::extentSuspectReasons( s.extentSuspect ) ); - w.write( "\"" ); - } - // Essential complexity (model.h Symbol::ev), --metrics only. Emitted iff ev >= 2: ev >= 1 for any - // walked fn/method body, so on a row carrying cx= ABSENT means exactly ev == 1 — lossless in the - // strictest sense, and never a bare ev="1" (G4 + the honesty contract point the same way). Routed - // through evCountedLang so an uncovered language (Bash) reads as "not counted", never "counted, 1". - // ev_floor="1" always rides along: noreturn calls, macro-hidden returns and unresolvable gotos are - // invisible to the syntactic walk and can only RAISE the true value. ev_why= is the reason - // breakdown that keeps §10.1-Option-A honest (a guard-heavy row is visibly not a knot). - if( metrics && ( s.kind == SymKind::Function || s.kind == SymKind::Method ) && evCountedLang( s.lang ) && s.ev >= 2u ) - { - std::string evRun = " ev=\"" + std::to_string( s.ev ) + "\" ev_floor=\"1\" ev_why=\"" + evWhyString( s ) + "\""; - w.write( evRun ); - } - w.write( ">" ); +inline void serialize( std::FILE* out, const IngestResult& ing, const std::vector<float>& rank, + const std::vector<std::uint32_t>& outOff, const std::vector<NodeId>& outTargets, + int topK, bool mostImportantLast = false, + bool metrics = false, const std::vector<std::uint32_t>* fanIn = nullptr, + const std::vector<std::uint32_t>* ambOut = nullptr, bool stable = false, + const std::vector<std::uint8_t>* outProv = nullptr, + // Q-compute per-symbol metrics — surfaced on --metrics ONLY (descriptive facts, never gates). + // All optional (nullptr ⇒ that attribute is omitted); loc/params/nest live on Symbol itself. + const std::vector<std::uint32_t>* cbo = nullptr, // Q5a distinct in-repo dependency targets + const std::vector<std::uint8_t>* tested = nullptr, // Q2 referenced from a test-path file + const std::vector<std::uint32_t>* lcom4 = nullptr, // Q4 class cohesion (kLcom4NA ⇒ omit) + const std::vector<std::uint32_t>* amp = nullptr, // Q2 change-amplification (callers + co-change partners) + const std::vector<std::uint32_t>* unresolvedOut = nullptr, // honesty lever #2: per-symbol lang-filtered + // unresolved calls; summed into `unresolved=N` + const SparseLabels* bind = nullptr, // A4-R5 per-symbol cross-language binding + // label (graph.h g.bindLabel) — JNI decoded + // Java_pkg_Cls_method → "pkg.Cls.method". + // Emitted as bind="…" ONLY when non-empty + // (nullptr/empty-vector default ⇒ zero + // token cost, byte-identical golden map). + bool autoOrder = false, // T3: fill-aware auto important-last (see above) + std::size_t* outEstTokens = nullptr, // --token-budget: hand back the SAME est_tokens the + // header prints (no second counter) — nullptr ⇒ unused + std::size_t extraPayloadTokens = 0, // §H7 (was extraBodyTokens): tokens of + // EVERY block the caller appends after this map — + // <sigs>, <src>, <bodies>, <outline> — each MEASURED + // from its rendered bytes by the caller (main.cpp's + // renderMapPayload) and converted through + // tokensForEmittedBytes. The old name said "body" + // and only --expand ever filled it, which is + // precisely why the four siblings went uncharged. + const MapAnnotations& ann = {}, // how THIS map was produced (see MapAnnotations + // above); defaulted ⇒ byte-identical golden map. + // §B6 M10: keep the files=/symbols=/shown=/order= stanza on the FIRST SCREEN even under + // `stable`. --stable moves it to a TRAILING comment to protect the cacheable prefix, which is + // right for a CLI map a provider KV-caches and wrong for the MCP `analyze` verb, whose result + // is ONE tool payload an agent reads top-down: there the reader met 197 of 6368 symbols with + // no denominator and no order marker until the last line. The stanza is emitted ONCE either + // way (never both places), so no count is stated twice. Only the MCP analyze front door + // passes true; every CLI caller keeps the default and stays byte-identical. + bool statsFirstScreen = false, + // R-E (2026-08-17 harvest, report-memgraph §F6 seconded): the run's OWN root argument, + // single-root callers only (empty ⇒ multi-root — already carries the roots=/<root + // label=…> disclosure above and stays untouched — or a caller that never passes one, e.g. + // a pure sizing pass, where a root= attribute would add bytes nothing reads). Same fact + // --grep's root= states, same helper (sarif.h's rootPrefixOf/rootRelativeUri) — the two + // verbs must not diverge on what "root-relative" means. + std::string_view rootArg = {}, + // Phase 4: the S6-C locality-pin counter (graph.h g.locPinOut) → lpin="K" on the row, header + // locality_pinned=N — both absent when zero, so a pin-free corpus is byte-identical. + const std::vector<std::uint32_t>* locPinOut = nullptr, + // Phase 5: the external-name veto's refusal count (graph.h g.externalCalls) → header external=N, + // absent when zero, so a veto-free corpus is byte-identical. + std::size_t externalCalls = 0, + // Tier 3's per-caller declines (graph.h g.declinedOut) → header declined=N, absent when zero, so a + // corpus where no call reached tier 3 undecided stays byte-identical. + const std::vector<std::uint32_t>* declinedOut = nullptr, + // of those, the calls the builtin-method name gate declined (graph.h g.gateDeclinedCalls) → the + // kDeclinedGateMapLegend clause, absent when zero. + std::size_t gateDeclinedCalls = 0, + // FE-B: Graph::outNameOnly (parallel to outTargets) → via="name" on a <c> row and the via legend + // comment; nullptr/empty ⇒ every edge is evidence-bound and the map is byte-identical. + const std::vector<std::uint8_t>* outNameOnly = nullptr, + // of declined=, the calls the standard-member gate declined (graph.h g.stdMemberDeclinedCalls) → + // the kDeclinedStdMapLegend clause, absent when zero. + std::size_t stdMemberDeclinedCalls = 0, + // of declined=, the Elixir call candidates inside inert quote AST (g.inertDeclinedCalls, #380) → + // the kInertDeclinedMapLegend clause, absent when zero. + std::size_t inertDeclinedCalls = 0 ) +{ + // R-E: normalize once, reuse at every <f p=…> row — rootPrefixOf just strips a trailing '/'. + const std::string rootPrefix = rootArg.empty() ? std::string() : rw::sarif::rootPrefixOf( rootArg ); + const auto pathRel = [ & ]( std::uint32_t fileId ) -> std::string_view + { + return rootArg.empty() ? std::string_view( ing.files[ fileId ] ) : rw::sarif::rootRelativeUri( ing.files[ fileId ], rootPrefix ); + }; - writeMapCalleeRows( w, ing, outOff[id], outOff[id + 1], outTargets, outProv, outNameOnly, esc, hedgedScratch ); - w.write( "</s>" ); - } - w.write( "</f>" ); + // ── WHICH rows, in WHICH order ────────────────────────────────────────────────────────────────────────────────── + const bool stubbed = ann.stubSymbols; // C1-b: in=DIR's stub prints no symbol row + const std::size_t keep = mapKeepCount( ing, topK ); + const RankedMapRows ranked = rankMapRows( ing, rank, ann, keep, stubbed ); + const std::span<const NodeId> kept = ranked.kept( keep ); + // T1/§H7: the byte MODEL. It decides the T3 emit order (which has to be decided before any byte exists — see §H7 at + // estimateTokens) and supplies the language-weighted bytes/token RATE, the half of it that is actually measured. It no + // longer REPORTS the size: est_tokens is computed from the document's emitted bytes in PHASE 2 below, because a model of + // the symbol set cannot see --metrics decoration or an appended payload. C1-b: under the stub the estimate is taken over + // no rows, since the document contains none. + const TokenEstimate mapEst = estimateTokens( ing, ranked.order, kept.size(), outOff, outTargets ); + const MapEmitOrder emitOrder = decideMapEmitOrder( stable, mostImportantLast, autoOrder, mapEst.tokens ); + const MapFileGroups groups = groupMapRowsByFile( ing, ann, kept, stubbed, emitOrder, outOff, outTargets, pathRel ); + const MapHonestyGauges gauges = countMapHonestyGauges( ing, MapResolverCounters{ .ambOut = ambOut, .unresolvedOut = unresolvedOut, .locPinOut = locPinOut, + .declinedOut = declinedOut, .externalCalls = externalCalls, + .gateDeclinedCalls = gateDeclinedCalls, + .stdMemberDeclined = stdMemberDeclinedCalls, + .inertDeclinedCalls = inertDeclinedCalls } ); + ASSUME( !stubbed || ( kept.empty() && groups.fileOrder.empty() && groups.inventory.entries.empty() ), + "the stub ranks and groups no row, so no kept-row legend clause and no <f> group can fire under it" ); + std::vector<char> esc; + + // ── the legend, clause group by clause group, in the order the reader meets them ────────────────────────────── + std::string legend = mapOpeningLegend( outProv != nullptr ); + legend += moduleScopeLegend( ing ); + legend += keptImplEdgeLegend( outOff, outProv, kept, groups.inventory.entries ); + legend += typeKindLegend( ing ); + legend += parseHonestyLegend( gauges ); + legend += runAnnotationLegend( ing, ann, rootArg, metrics ); + legend += rowSelectionLegend( ranked.dataSecCut, groups ); + // W2-F: the pr_iters= / pr_converged= definition, charged to the maps that carry the attributes — empty for a lexical or + // HITS ordering, and the prose half only on the map whose iteration stopped short. + legend += renderDisclosure( ann.prDisclosure, DiscloseAs::LegendComment ); + legend += declineLegend( gauges ); + legend += keptNameEdgeLegend( outOff, outNameOnly, kept, ann.viaLegendStripped ); + // K51: history_unread='s definition, the LAST leading clause, so it stands right before the <r> root it marks and inside the + // leading block every reader (and legendcoveragecheck's full rows) meets first; absent unless the amp=/churn= walk was unread. + legend += renderHistoryUnread( DiscloseAs::LegendComment ); + + // ── the HEAD and the TAIL, as BUILDERS ───────────────────────────────────────────────────────────────────────── + // Both state est_tokens, and est_tokens describes the whole document including them, so the digit count feeds back into + // the number: PHASE 2 iterates these to a fixpoint (settleEstTokens). buildRecall (recall.h) has the identical fixpoint for + // the identical reason. Pure functions of estTokens, the values decided above and the estimate sink's state. + // --stable: the volatile counts move to a TRAILING comment (out of the cacheable prefix) — unless the caller asked for the + // first-screen placement (§B6 M10, the MCP analyze verb). Exactly one of the two builders emits the stats. + const bool statsTrail = stable && !statsFirstScreen; + const std::string coverageAttrs = mapCoverageAttrs( ing, outProv, ann ); + const MapStatsFacts statsFacts{ .files = ing.files.size(), .symbols = mapSymbolCount( ing ), .edges = outTargets.size(), + .shown = stubbed ? std::size_t( 0 ) : keep + groups.stemPick.rows.size(), + .gauges = gauges, .coverageAttrs = coverageAttrs, .orderAttr = mapOrderAttr( emitOrder ) }; + const MapRootFacts rootFacts{ .ann = ann, .rootArg = rootArg, .stable = stable, .dataSecCut = ranked.dataSecCut, .stemCut = groups.stemPick.cut }; + MapEstimate estimate{ ann.payloadUncharged }; // the est_tokens measurement's DISCLOSE sink — read by the builders + const auto buildHead = [ & ]( std::size_t estTokens ) -> std::string + { + std::string h = legend; + if( estimate.isModelled ) + { + h += kEstModelledLegend; } - if( !inventoryFirst ) + if( !statsTrail ) { - writeInventory(); + h += renderMapStats( statsFacts, estTokens, estimate.isModelled ); } - w.write( "</r>" ); + h += renderMapRootTag( rootFacts, estTokens, estimate.isModelled, esc ); + return h; + }; + const auto buildTail = [ & ]( std::size_t estTokens ) -> std::string + { + return statsTrail ? renderMapStats( statsFacts, estTokens, estimate.isModelled ) : std::string{}; + }; + + // ── PHASE 1: render <r>'s CHILDREN into a buffer ─────────────────────────────────────────────────────────────── + // §H7: est_tokens must charge the bytes the document actually carries, not a model of the symbol set — the model prices + // neither --metrics decoration nor an appended payload, which is how one number came to stand for five documents. So: + // measure, decide, then write (the order --recall's emitRecallBudgeted and the --for lens's pre-rendered sigs block + // already impose on themselves). + const MapRowSources rowSources{ .rank = rank, .outOff = outOff, .outTargets = outTargets, .outProv = outProv, .outNameOnly = outNameOnly, + .ambOut = ambOut, .locPinOut = locPinOut, .bind = bind, .stable = stable, .metrics = metrics, + .fanIn = fanIn, .cbo = cbo, .tested = tested, .lcom4 = lcom4, .amp = amp }; + std::vector<std::uint32_t> hedgedScratch; // FE-B: writeMapCalleeRows' reused buffer + const auto writeChildren = [ & ]( XmlWriter& w ) + { + writeMapChildren( w, ing, ann, keep, groups, emitOrder, rowSources, pathRel, esc, hedgedScratch ); }; - // DEGRADE, one path for both failures: the head goes out FIRST carrying the MODELLED estimate (the pre-§H7 number, so - // no worse than the old behaviour and never a fabricated one), the children stream straight to `out` behind it, then - // the trailing summary. The whole map, uncharged. + // DEGRADE, one path for both failures (a buffer that did not open, or one that opened and then lost a write — by then the + // children were already spent into it, so they are rendered again): the head goes out FIRST carrying the MODELLED estimate + // (the pre-§H7 number, so no worse than the old behaviour and never a fabricated one), the children stream straight to + // `out` behind it, then the trailing summary. The whole map, uncharged. + const std::size_t modelledTokens = mapEst.tokens + extraPayloadTokens; const auto emitModelled = [ & ]() { XmlWriter direct( out ); @@ -4243,17 +4546,19 @@ inline void serialize( std::FILE* out, const IngestResult& ing, const std::vecto *outEstTokens = modelledTokens; } }; + rw::MemoryStream childStream; + std::FILE* const childMem = openChargeStream( childStream ); if( !childMem ) { + DISCLOSE( estimate, MapEstimate::DisclosureWhy::ChargeBufferFailed, "serialize: open_memstream failed — est_tokens reports the MODELLED bytes, not the emitted ones" ); emitModelled(); return; } - // ── PHASE 2: measure, decide, then write ──────────────────────────────────────────────────────────── - // The children go into the buffer, and the writer flushes BEFORE the memstream is finished (its destructor flushes - // again at the end of the block, with nothing left to write). A buffer that did not finish whole means a write was - // lost INSIDE the children (rw::MemoryStream::finish), so those bytes are never printed: the map is rendered again, - // straight to `out`, on the modelled path a failed open takes. + // ── PHASE 2: measure, decide, then write ─────────────────────────────────────────────────────────────────────── + // The children go into the buffer, and the writer flushes BEFORE the memstream is finished (its destructor flushes again at + // the end of the block, with nothing left to write). A buffer that did not finish whole means a write was lost INSIDE the + // children (rw::MemoryStream::finish), so those bytes are never printed: the map is rendered again on the modelled path. { XmlWriter w( childMem ); writeChildren( w ); @@ -4268,44 +4573,16 @@ inline void serialize( std::FILE* out, const IngestResult& ing, const std::vecto return; } const std::string_view childrenStr = children.bytes; // owned by childStream, alive to the end of this function - - // The fixpoint: est_tokens covers head + children + tail, and head/tail both PRINT est_tokens, so the - // digit count feeds back. Converges in ≤2 passes in practice (each extra digit moves the estimate by - // <1 token); the bound is 4, matching recall.h's. - // - // WHAT THE LOOP GUARANTEES (CA4 verifier L4 — the previous wording claimed an equality this loop does not - // deliver): the LAST built pair is always the pair emitted, and ON CONVERGENCE — the `break`, i.e. the - // number stopped moving — that pair's own bytes are exactly the bytes `estTokens` was measured over, so the - // document's stated number describes the document. On the BOUND (4 passes without convergence, not observed - // on any measured corpus) the emitted head/tail were rebuilt from the last `next` while `next` was measured - // over the PREVIOUS pair's widths, which differ only in the digit count of one field: at most a few bytes, - // i.e. a residual well under one token, and never a fabricated number. The honest statement is "converged ⇒ - // exact; bounded ⇒ within a digit's worth of bytes", not "always exact". - std::size_t estTokens = modelledTokens; - std::string head = buildHead( estTokens ); - std::string tail = buildTail( estTokens ); - for( int pass = 0; pass < 4; ++pass ) - { - const std::size_t next = tokensForEmittedBytes( head.size() + childrenStr.size() + tail.size(), - mapEst.bytesPerToken() ) + extraPayloadTokens; - if( next == estTokens ) - { - break; - } - estTokens = next; - head = buildHead( estTokens ); - tail = buildTail( estTokens ); - } + const SettledHeadTail settled = settleEstTokens( modelledTokens, childrenStr.size(), mapEst.bytesPerToken(), extraPayloadTokens, buildHead, buildTail ); if( outEstTokens ) { - *outEstTokens = estTokens; // --token-budget reads THIS value — never a second counter + *outEstTokens = settled.estTokens; // --token-budget reads THIS value — never a second counter } - - std::fwrite( head.data(), 1, head.size(), out ); + std::fwrite( settled.head.data(), 1, settled.head.size(), out ); std::fwrite( childrenStr.data(), 1, childrenStr.size(), out ); - if( !tail.empty() ) + if( !settled.tail.empty() ) { - std::fwrite( tail.data(), 1, tail.size(), out ); + std::fwrite( settled.tail.data(), 1, settled.tail.size(), out ); } } @@ -4680,214 +4957,189 @@ inline std::string docCommentBefore( const std::string& src, std::size_t defStar // that follow stripping (i.e. lines that contained only a comment and are now empty). // // Correctness guarantee: a "//" or "/*" that appears inside a "…" or '…' literal is NEVER treated as -// a comment. We track the lexer state through the following states: -// NORMAL → default; comments and literals start here -// IN_STRING → inside "…"; ends at an unescaped " -// IN_CHAR → inside '…'; ends at an unescaped ' -// IN_RAW → inside R"delim(…)delim" (C++ raw string); ends at )delim" -// IN_LINE_CMT → inside // …; ends at the next \n (the \n is kept so line count is preserved) -// IN_BLK_CMT → inside /* … */; the entire span including markers is consumed +// a comment. The lexer below has one step per token kind it can start on: +// copyStringLiteral "…" (ends at an unescaped "), or a C++ raw string R"delim(…)delim" (ends at )delim") +// copyQuotedLiteral '…' (ends at an unescaped ') +// skipLineComment // … (ends at the next \n, which is kept so the line count is preserved) +// skipBlockComment /* … */ (the entire span including markers is consumed; its newlines are kept) +// and every other character is copied as-is. // // NOTE: does NOT strip the <doc> doc-comment field — that is emitted separately by the call site and // is never passed into this function (only the raw body bytes [sigStartByte, endByte) are compressed). -inline std::string compressBody( std::string_view src ) -{ - // Phase 1: lex out comments, preserving content inside string/char literals. - // - // output: the source with all comment content removed; literal content intact. - // We output character-by-character into `out` for simplicity (the budget-capped - // bodies are not huge — typically <200 KB — so quadratic string appending is fine). - std::string out; - out.reserve( src.size() ); +// Copies a `quote`-delimited literal starting at src[i] (the opening quote) through its closing quote; a backslash escapes +// the next character. Returns the index just past the closing quote (N + 1 when the literal runs off the end, which ends the +// caller's scan the same way). +inline std::size_t copyQuotedLiteral( std::string_view src, std::size_t i, char quote, std::string& out ) +{ const std::size_t N = src.size(); - std::size_t i = 0; - + out += src[ i ]; // the opening quote + ++i; while( i < N ) { - const char c = src[i]; - - // ── String literal "…" ──────────────────────────────────────────────────────────── - if( c == '"' ) + const char sc = src[ i ]; + out += sc; + if( sc == '\\' && i + 1 < N ) { - // Check for C++ raw string R"delim( - if( i >= 1 && src[i - 1] == 'R' && ( i < 2 || src[i - 2] != '\\' ) ) - { - // Raw string: collect delimiter between " and ( - std::size_t j = i + 1; - std::string delim; - while( j < N && src[j] != '(' && src[j] != '\n' ) - { - delim += src[j++]; - } - if( j < N && src[j] == '(' ) - { - // We're inside R"delim(...). Copy everything verbatim until )delim" - const std::string terminator = ")" + delim + "\""; - out += src.substr( i, j - i + 1 ); // R"delim( - i = j + 1; - const std::size_t termLen = terminator.size(); - while( i < N ) - { - if( i + termLen <= N && src.substr( i, termLen ) == terminator ) - { - out += terminator; - i += termLen; - break; - } - out += src[i++]; - } - continue; - } - // Not a raw string (malformed R"... without a paren) — fall through to - // regular string literal handling below. - } - - // Regular double-quoted string literal. - out += c; // emit the opening " - ++i; - while( i < N ) - { - const char sc = src[i]; - out += sc; - if( sc == '\\' && i + 1 < N ) { out += src[++i]; } // escape: skip next char - else if( sc == '"' ) - { - break; // end of string - } - ++i; - } - ++i; // step past the closing " - continue; + out += src[ ++i ]; // escape: copy the next char too } + else if( sc == quote ) + { + break; + } + ++i; + } + return i + 1; // step past the closing quote +} + +// A `"` at src[i] opens a C++ raw string when an unescaped `R` precedes it. +inline bool opensRawString( std::string_view src, std::size_t i ) noexcept +{ + return i >= 1 && src[ i - 1 ] == 'R' && ( i < 2 || src[ i - 2 ] != '\\' ); +} - // ── Char literal '…' ────────────────────────────────────────────────────────────── - if( c == '\'' ) +// Copies a raw string R"delim(…)delim" verbatim from its `"` at src[i]; the `R` was already copied. Returns the index past +// the terminator (or N when it never comes), or nullopt — copying nothing — when no `(` follows the delimiter on its line, +// which is a malformed R"… the caller reads as a regular string literal. +inline std::optional<std::size_t> copyRawStringLiteral( std::string_view src, std::size_t i, std::string& out ) +{ + const std::size_t N = src.size(); + std::size_t j = i + 1; + while( j < N && src[ j ] != '(' && src[ j ] != '\n' ) + { + ++j; + } + if( j >= N || src[ j ] != '(' ) + { + return std::nullopt; + } + const std::string terminator = ")" + std::string( src.substr( i + 1, j - i - 1 ) ) + "\""; + out += src.substr( i, j - i + 1 ); // "delim( + for( i = j + 1; i < N; ++i ) + { + if( src.substr( i, terminator.size() ) == terminator ) { - out += c; // opening ' - ++i; - while( i < N ) - { - const char sc = src[i]; - out += sc; - if( sc == '\\' && i + 1 < N ) { out += src[++i]; } - else if( sc == '\'' ) - { - break; - } - ++i; - } - ++i; - continue; + out += terminator; + return i + terminator.size(); } + out += src[ i ]; + } + return N; +} - // ── Comment detection (only reached OUTSIDE string/char literals) ───────────────── - if( c == '/' && i + 1 < N ) +// A "…" literal from its opening quote: a raw string when it opens one, else a regular escaped string. +inline std::size_t copyStringLiteral( std::string_view src, std::size_t i, std::string& out ) +{ + if( opensRawString( src, i ) ) + { + if( const std::optional<std::size_t> end = copyRawStringLiteral( src, i, out ) ) { - // Line comment: // … — consume to end of line, emit a newline to preserve line count. - if( src[i + 1] == '/' ) - { - while( i < N && src[i] != '\n' ) - { - ++i; - } - // leave the \n to be emitted in the NORMAL branch below - continue; - } - // Block comment: /* … */ — consume entirely (no newline kept; blank lines handle the gap) - if( src[i + 1] == '*' ) - { - i += 2; // skip /* - while( i + 1 < N && !( src[i] == '*' && src[i + 1] == '/' ) ) - { - if( src[i] == '\n' ) - { - out += '\n'; // preserve newlines so line numbers survive - } - ++i; - } - if( i + 1 < N ) - { - i += 2; // skip */ - } - continue; - } + return *end; } + } + return copyQuotedLiteral( src, i, '"', out ); +} - // ── Normal character — emit as-is ───────────────────────────────────────────────── - out += c; +// A // comment from its first slash: consumed up to (not including) the \n, which the caller then copies so the line count +// is preserved. +inline std::size_t skipLineComment( std::string_view src, std::size_t i ) noexcept +{ + while( i < src.size() && src[ i ] != '\n' ) + { ++i; } + return i; +} - // Phase 2: post-process the comment-stripped text: - // (a) Drop lines that are now whitespace-only (previously held only a comment). - // (b) Collapse runs of 3+ blank lines → a single blank line. - // - // "Blank line" = a line whose trimmed content is empty. We preserve lines that have ANY - // non-whitespace content after comment stripping (this keeps intentional blank lines between - // logical blocks — only the *excess* is collapsed). - std::string result; - result.reserve( out.size() ); - - std::size_t pos = 0; - int blanks = 0; // consecutive blank lines seen so far - bool firstLine = true; // suppress leading blanks at the very start of a body - - const std::size_t M = out.size(); - while( pos < M ) +// A /* … */ comment from its first slash: consumed entirely, markers included, but its newlines are kept so line numbers +// survive (the blank-line pass handles the gap). An unterminated comment runs to the last character. +inline std::size_t skipBlockComment( std::string_view src, std::size_t i, std::string& out ) +{ + const std::size_t N = src.size(); + i += 2; // skip /* + while( i + 1 < N && !( src[ i ] == '*' && src[ i + 1 ] == '/' ) ) { - // Find end of line. - std::size_t eol = out.find( '\n', pos ); - if( eol == std::string::npos ) + if( src[ i ] == '\n' ) { - eol = M; + out += '\n'; } + ++i; + } + return i + 1 < N ? i + 2 : i; // skip */ +} - const std::string_view line( out.data() + pos, eol - pos ); - - // Is this line blank (all whitespace)? - bool isBlank = true; - for( char ch : line ) +// Phase 1: the source with all comment content removed and literal content intact. +inline std::string stripCommentsKeepLiterals( std::string_view src ) +{ + std::string out; + out.reserve( src.size() ); + const std::size_t N = src.size(); + std::size_t i = 0; + while( i < N ) + { + const char c = src[ i ]; + const char d = i + 1 < N ? src[ i + 1 ] : '\0'; // the comment openers are read only OUTSIDE string/char literals + if( c == '"' ) { - if( ch != ' ' && ch != '\t' && ch != '\r' ) - { - isBlank = false; - break; - } + i = copyStringLiteral( src, i, out ); } - - if( isBlank ) + else if( c == '\'' ) { - // Suppress leading blank lines at the very start of a body (artifact of stripping - // the opening comment of a function body), and collapse 3+ consecutive blanks. - if( !firstLine ) - { - ++blanks; - } - // Emit at most one blank line (we allow up to 2 accumulated before we start collapsing; - // the spec says "runs of 3+ → single blank", so blanks==1 and blanks==2 are both fine). - if( !firstLine && blanks <= 2 ) - { - result += '\n'; // the blank line itself (the \n that terminated the previous line) - } - // If blanks > 2: suppress (collapse). + i = copyQuotedLiteral( src, i, '\'', out ); + } + else if( c == '/' && d == '/' ) + { + i = skipLineComment( src, i ); + } + else if( c == '/' && d == '*' ) + { + i = skipBlockComment( src, i, out ); } else { - // Non-blank line: reset counter, emit. - blanks = 0; - firstLine = false; - result.append( out.data() + pos, eol - pos ); - if( eol < M ) + out += c; + ++i; + } + } + return out; +} + +// A line whose content is only spaces, tabs and carriage returns. +inline bool isBlankLine( std::string_view line ) noexcept +{ + return std::all_of( line.begin(), line.end(), []( char ch ) { return ch == ' ' || ch == '\t' || ch == '\r'; } ); +} + +// Phase 2: the comment-stripped text's line layout. Lines that are now whitespace-only and come before the first content line +// are dropped (an artifact of stripping the opening comment of a body); after it, at most two consecutive blank lines are +// kept and the rest of a run is dropped. Every line with ANY non-whitespace content is kept, so intentional blank lines between +// logical blocks survive and only the excess is collapsed. Trailing newlines are trimmed (cosmetic). +inline std::string collapseBlankLineRuns( std::string_view text ) +{ + std::string result; + result.reserve( text.size() ); + std::size_t blanks = 0; // consecutive blank lines since the last content line + std::size_t pos = 0; + while( pos < text.size() ) + { + const std::size_t eol = std::min( text.find( '\n', pos ), text.size() ); + const std::string_view line = text.substr( pos, eol - pos ); + if( !isBlankLine( line ) ) + { + blanks = 0; + result.append( line ); + if( eol < text.size() ) { result += '\n'; } } - - pos = ( eol < M ) ? eol + 1 : M; + // `result` is empty exactly until the first content line is copied: a blank line is only ever written after one. + else if( !result.empty() && ++blanks <= 2 ) + { + result += '\n'; // the blank line itself (the \n that terminated the previous line) + } + pos = eol + 1; } - - // Trim a single trailing newline that may have been added (cosmetic). while( !result.empty() && result.back() == '\n' ) { result.pop_back(); @@ -4895,6 +5147,11 @@ inline std::string compressBody( std::string_view src ) return result; } +inline std::string compressBody( std::string_view src ) +{ + return collapseBlankLineRuns( stripCommentsKeepLiterals( src ) ); +} + // --pack-signatures: emit each top-N ranked definition's SIGNATURE (declaration up to // the body), bodies elided — ~70% fewer tokens than raw source while keeping the structural shape. // Grouped by file, capped at budgetBytes. Emitted AFTER </r>, like packSource. With L2: a <doc> child. @@ -11534,6 +11791,30 @@ inline void writeJsonMapHeader( JsonWriter& w, std::string& esc, const JsonMapHe w.write( "]" ); } +// One JSON row's "c" array members: the callee objects over out-edges [from, to), comma-separated. §A4d: prov mirrors the XML +// attribute 1:1 — "scip" for a SCIP-pinned edge, "binding" for a decoded FFI binding, "import" for an ES named-import edge, +// "split" (C1) for one arm of a k-way split the resolver could not choose between, "via":"impl" (L6) for the one implementor. +// outProv parallels outTargets exactly, so index `e` is the same edge. The two dialects MUST spell the same vocabulary: +// test/mcpclidiffcheck.sh is the gate that says so. The "r" rows and the inventory entries share this writer. +inline void writeJsonCalleeObjects( JsonWriter& w, const IngestResult& ing, std::uint32_t from, std::uint32_t to, const std::vector<NodeId>& outTargets, + const std::vector<std::uint8_t>* outProv, const std::vector<std::uint8_t>* outNameOnly, std::string& esc ) +{ + for( std::uint32_t e = from; e < to; ++e ) + { + w.write( e > from ? ",{\"n\":" : "{\"n\":" ); writeJsonStr( w, ing.symbols[ outTargets[ e ] ].name, esc ); + if( outProv && e < outProv->size() && ( *outProv )[ e ] ) + { + w.write( ",\"" ); w.write( provAttrName( ( *outProv )[ e ] ) ); w.write( "\":" ); writeJsonStr( w, provLabel( ( *outProv )[ e ] ), esc ); + } + if( outNameOnly && e < outNameOnly->size() ) + { + writeMapCalleeJsonKind( w, ( *outNameOnly )[ e ] ); + } + w.write( "}" ); + } +} + + // D7: the JSON twin of writeMapInventoryXml — `,"inv":{"listed":L,"unlisted":U,"entry":[{"p":…,"n":…,"c":[…]}], // "ls":[{"p":…,"n":N,"f":[…]}]}` after the "r" array. The callee objects spell exactly what a "r" row's "c" array does. template <class PathRel> @@ -11557,19 +11838,7 @@ inline void writeMapInventoryJson( JsonWriter& w, const IngestResult& ing, const w.write( i ? ",{\"p\":" : "{\"p\":" ); writeJsonStr( w, pathRel( s.fileId ), esc ); w.write( ",\"n\":" ); writeJsonStr( w, s.name, esc ); w.write( ",\"c\":[" ); - for( std::uint32_t e = outOff[ id ]; e < outOff[ id + 1 ]; ++e ) - { - w.write( e > outOff[ id ] ? ",{\"n\":" : "{\"n\":" ); writeJsonStr( w, ing.symbols[ outTargets[ e ] ].name, esc ); - if( outProv && e < outProv->size() && ( *outProv )[ e ] ) - { - w.write( ",\"" ); w.write( provAttrName( ( *outProv )[ e ] ) ); w.write( "\":" ); writeJsonStr( w, provLabel( ( *outProv )[ e ] ), esc ); // L6: "via":"impl" - } - if( outNameOnly && e < outNameOnly->size() ) - { - writeMapCalleeJsonKind( w, ( *outNameOnly )[ e ] ); - } - w.write( "}" ); - } + writeJsonCalleeObjects( w, ing, outOff[ id ], outOff[ id + 1 ], outTargets, outProv, outNameOnly, esc ); w.write( "]}" ); } w.write( "],\"ls\":[" ); @@ -11593,30 +11862,98 @@ inline void writeMapInventoryJson( JsonWriter& w, const IngestResult& ing, const w.write( "]}" ); } -// The default-map JSON sibling of serialize() — same rank/order/bucket logic (kept a deliberate, mechanical -// duplication per the L2 seam decision: a sibling emitter, not a shared-emission refactor of the XML path, -// so the G5 byte-identical-default contract carries zero risk from this addition). Scope: the common single- -// root invocation (metrics, fan-in, ambiguity, cbo/tested/lcom4/amp Q-metrics, stable/most-important-last/ -// auto-order, bind labels, est_tokens, per-edge provenance, the multi-root prologue, and — §B1.2 — the -// at/rank_by/window PROVENANCE STAMP a churn-ranked map carries. NOT covered (documented gap, refused -// upstream by jsonUnsupportedVerb before this is ever reached in those combinations): --map-diff -// (changed=), --expand's appended <bodies> token math (extraBodyTokens). +// One "s" row object: the XML <s> row's facts, key for attribute — the same presence rules (hasScopeAttr, stem rows, the +// overload collapse, absent-at-0 counters), then the "c" callee array. +inline void writeJsonMapRow( JsonWriter& w, const IngestResult& ing, const OverloadRows& rows, std::size_t rowIndex, const std::vector<NodeId>& stemRows, + const MapRowSources& src, std::string& esc ) +{ + char num[ 64 ]; + const NodeId id = rows.id[ rowIndex ]; + const Symbol& s = ing.symbols[ id ]; + w.write( "{\"t\":" ); writeJsonStr( w, symTag( s.kind ), esc ); + w.write( ",\"n\":" ); writeJsonStr( w, s.name, esc ); + if( hasScopeAttr( s ) ) { w.write( ",\"sc\":" ); writeJsonStr( w, s.scope, esc ); } // row 6: the XML sibling's sc=, one presence rule (hasScopeAttr) + if( !stemRows.empty() && std::ranges::binary_search( stemRows, id ) ) { w.write( ",\"stem\":1" ); } // MAP-STEM: the XML sibling's stem="1" + if( rows.overloads[ rowIndex ] > 1 ) + { + rw::formatTo( num, sizeof( num ), ",\"overloads\":{}", rows.overloads[ rowIndex ] ); w.write( num ); + } + w.write( splitLineJson( rows, rowIndex, s ) ); // the XML l= twin: a --metrics row split out of a same-name group + if( const std::string_view label = src.bind ? src.bind->labelOf( id ) : std::string_view{}; !label.empty() ) + { + w.write( ",\"bind\":" ); writeJsonStr( w, label, esc ); + } + if( const std::uint32_t ambK = counterAt( src.ambOut, id ); ambK > 0 ) + { + rw::formatTo( num, sizeof( num ), ",\"amb\":{}", ambK ); w.write( num ); + } + if( const std::uint32_t lpinK = counterAt( src.locPinOut, id ); lpinK > 0 ) // Phase 4: the XML lpin= twin + { + rw::formatTo( num, sizeof( num ), ",\"lpin\":{}", lpinK ); w.write( num ); + } + if( s.extentSuspect != 0 ) // extent honesty: the XML extent_suspect= twin, same reason spelling + { + w.write( ",\"extent_suspect\":" ); writeJsonStr( w, extent::extentSuspectReasons( s.extentSuspect ), esc ); + } + if( !src.stable ) + { + rw::formatTo( num, sizeof( num ), ",\"k\":{:.4f}", double( src.rank[ id ] ) ); w.write( num ); + } + if( src.metrics ) + { + const std::uint32_t outDegree = src.outOff[ id + 1 ] - src.outOff[ id ]; + writeJsonQMetrics( w, JsonQMetrics{ s, id, outDegree, src.fanIn, src.cbo, src.tested, src.lcom4, src.amp } ); + } + w.write( ",\"c\":[" ); + writeJsonCalleeObjects( w, ing, src.outOff[ id ], src.outOff[ id + 1 ], src.outTargets, src.outProv, src.outNameOnly, esc ); + w.write( "]}" ); +} + +// One "r" file object: its path and arch layer, then its rows. §P6.3 / §A4d: const/non-const overloads canonicalize to the +// SAME id, so a bucket straight from the rank order printed two byte-identical JSON objects and a consumer keying on "id" +// silently dropped one. Same collapse the XML path runs (overloadRowsFor), same "overloads" count. +template <class PathRel> +inline void writeJsonMapFileGroup( JsonWriter& w, const IngestResult& ing, std::uint32_t f, const MapFileGroups& groups, const MapRowSources& src, + const PathRel& pathRel, std::string& esc ) +{ + w.write( "{\"p\":" ); writeJsonStr( w, pathRel( f ), esc ); + if( const char* fl = builtinLayer( rootRelPath( ing, f ) ); *fl ) { w.write( ",\"layer\":" ); writeJsonStr( w, fl, esc ); } + w.write( ",\"s\":[" ); + const OverloadRows rows = overloadRowsFor( ing, groups.buckets[ f ], src.metrics ); + for( std::size_t rowIndex = 0; rowIndex < rows.id.size(); ++rowIndex ) + { + if( rowIndex > 0 ) + { + w.write( "," ); + } + writeJsonMapRow( w, ing, rows, rowIndex, groups.stemPick.rows, src, esc ); + } + w.write( "]}" ); +} + +// The default-map JSON sibling of serialize(). It shares serialize()'s decisions about WHAT the map prints — mapKeepCount, +// rankMapRows, decideMapEmitOrder, groupMapRowsByFile, countMapHonestyGauges — and writes the same groups in its own +// spelling, so a defect fixed in one dialect's selection cannot survive in the other's. Scope: the common single-root +// invocation (metrics, fan-in, ambiguity, cbo/tested/lcom4/amp Q-metrics, stable/most-important-last/auto-order, bind labels, +// est_tokens, per-edge provenance, the multi-root prologue, and — §B1.2 — the at/rank_by/window PROVENANCE STAMP a +// churn-ranked map carries. NOT covered (documented gap, refused upstream by jsonUnsupportedVerb before this is ever reached +// in those combinations): --map-diff (changed=), --expand's appended <bodies> token math (extraBodyTokens). // -// §B1.2 — churn was the third XML-only honesty fact this sibling dropped, and the enumeration above used to -// omit it entirely: it read as a complete coverage statement while `--rank-by=churn --json` and -// `--rank-by=pagerank --json` emitted keyset-identical headers. serializeJson now takes the same -// `MapAnnotations` the XML path takes and emits `at`/`rank_by`/`window` from it (writeJsonMapHeader). +// §B1.2 — churn was the third XML-only honesty fact this sibling dropped, and the enumeration above used to omit it entirely: +// it read as a complete coverage statement while `--rank-by=churn --json` and `--rank-by=pagerank --json` emitted +// keyset-identical headers. serializeJson now takes the same `MapAnnotations` the XML path takes and emits +// `at`/`rank_by`/`window` from it (writeJsonMapHeader). // // §A4b/§A4d closed three XML-only honesty attributes that this sibling used to drop SILENTLY: -// * multi-root: the header comment above claimed the combination was "refused upstream by -// jsonUnsupportedVerb" — it never was (no roots-count arm exists there), so a JSON consumer got -// `"p":"src/./svector.h"` with no label→path table and no signal the graph spanned several roots. -// `"roots"`/`"roots_count"` now mirror the XML `roots=` + `<root label= p=/>` prologue exactly. -// * overloads: this emitter never called collapseOverloadRows(), so a const/non-const pair printed TWO -// byte-identical rows and a consumer keying on "id" silently lost one. Collapsed here as in the XML, -// with the same `"overloads":N` (>1 only) discriminator. -// * prov/precise: an edge the SCIP overlay or an FFI binding actually PINNED read identical to a -// name-guessed one. Same absent-unless-present rule as the XML attribute. +// * multi-root: the header comment above claimed the combination was "refused upstream by jsonUnsupportedVerb" — it never +// was (no roots-count arm exists there), so a JSON consumer got `"p":"src/./svector.h"` with no label→path table and no +// signal the graph spanned several roots. `"roots"`/`"roots_count"` now mirror the XML `roots=` + `<root label= p=/>` +// prologue exactly. +// * overloads: this emitter never called collapseOverloadRows(), so a const/non-const pair printed TWO byte-identical rows +// and a consumer keying on "id" silently lost one. Collapsed here as in the XML, with the same `"overloads":N` (>1 only) +// discriminator. +// * prov/precise: an edge the SCIP overlay or an FFI binding actually PINNED read identical to a name-guessed one. Same +// absent-unless-present rule as the XML attribute. inline void serializeJson( std::FILE* out, const IngestResult& ing, const std::vector<float>& rank, const std::vector<std::uint32_t>& outOff, const std::vector<NodeId>& outTargets, int topK, bool mostImportantLast, bool metrics, @@ -11639,87 +11976,28 @@ inline void serializeJson( std::FILE* out, const IngestResult& ing, const std::v const std::vector<std::uint8_t>* outNameOnly = nullptr, // FE-B: same as serialize()'s → "via":"name" std::size_t /*stdMemberDeclinedCalls*/ = 0 ) // serialize()'s legend clause; JSON carries no legend, so unread here { - const std::size_t S = ing.symbols.size(); const std::string rootPrefix = rootArg.empty() ? std::string() : rw::sarif::rootPrefixOf( rootArg ); const auto pathRel = [ & ]( std::uint32_t fileId ) -> std::string_view { return rootArg.empty() ? std::string_view( ing.files[ fileId ] ) : rw::sarif::rootRelativeUri( ing.files[ fileId ], rootPrefix ); }; - std::vector<NodeId> order( S ); - for( NodeId i = 0; i < S; ++i ) - { - order[i] = i; - } - sortutil::radixSortByScoreDescId( order, rank ); - dropUnmappedRows( ing, order ); // serialize()'s rows, same rule - - const std::size_t mapS = mapSymbolCount( ing ); - const std::size_t keep = std::min<std::size_t>( topK > 0 ? std::size_t( topK ) : mapS, mapS ); - const DataSectionsCut dataSecCut = ann.codeFirstRows ? codeFirstKeep( ing, order, keep ) : DataSectionsCut{}; // serialize()'s pick, same rule - - std::vector<std::vector<NodeId>> buckets( ing.files.size() ); - std::vector<std::uint32_t> fileOrder; - std::vector<char> seen( ing.files.size(), 0 ); - for( std::size_t k = 0; k < keep; ++k ) - { - const NodeId id = order[k]; - const std::uint32_t f = ing.symbols[id].fileId; - if( !seen[f] ) { seen[f] = 1; fileOrder.push_back( f ); } - buckets[f].push_back( id ); - } - // MAP-STEM: the XML twin's reserved stem-namesake rows, the same rule over the same buckets - const MapStemPick stemPick = pickMapStemRows( ing, ann, buckets, fileOrder ); - const std::vector<NodeId>& stemRows = stemPick.rows; - // D7: the XML twin's inventory, the same selection (mapinventory.h) over the same printed-file set - const MapInventory inventory = mapInventoryWanted( ing, ann ) ? computeMapInventory( ing, outOff, outTargets, seen, pathRel ) - : MapInventory{}; - - // T1/§H7: SAME byte-model the XML sibling uses, in the same two roles — the fill-order oracle and the - // rate source. The REPORTED est_tokens is measured from the emitted bytes in PHASE 2 below, exactly as - // in serialize(): a defect fixed in one serialization and not the other is how the §H5 dialect - // divergences are born, and this emitter had the identical --metrics under-report (MEASURED: 1780 B - // reported as est_tokens=507, 3.51 B/tok). - const TokenEstimate mapEst = estimateTokens( ing, order, keep, outOff, outTargets ); - const std::size_t mapEstTokens = mapEst.tokens; - - const bool autoFlip = autoOrder && !stable && !mostImportantLast && mapEstTokens > kFillOrderThreshold; - const bool effImportantLast = mostImportantLast || autoFlip; - if( stable ) - { - std::sort( fileOrder.begin(), fileOrder.end(), - [ & ]( std::uint32_t a, std::uint32_t b ) { return ing.files[a] < ing.files[b]; } ); - for( std::vector<NodeId>& b : buckets ) - { - std::sort( b.begin(), b.end() ); - } - } - else if( effImportantLast ) - { - std::reverse( fileOrder.begin(), fileOrder.end() ); - for( std::vector<NodeId>& b : buckets ) - { - std::reverse( b.begin(), b.end() ); - } - } - - const std::size_t ambTotal = counterTotal( ambOut ); - const std::size_t unresolvedTotal = counterTotal( unresolvedOut ); - const std::size_t locPinTotal = counterTotal( locPinOut ); // Phase 4: Σ lpin, the JSON twin of locality_pinned= - const std::size_t declinedTotal = counterTotal( declinedOut ); // Σ declinedOut, the JSON twin of declined= - std::size_t extentSuspectTotal = 0; // extent honesty: the JSON twin of extent_suspect_syms= - for( const Symbol& sym : ing.symbols ) - { - extentSuspectTotal += sym.extentSuspect != 0 ? 1u : 0u; - } - const char* orderAttr = stable ? "stable" - : mostImportantLast ? "important-last" - : autoFlip ? "important-last(auto:fill)" - : "important-first"; - - // ── PHASE 1: render the "r" array into a buffer (§H7 — see serialize()'s PHASE 1 for the full reasoning: - // measure, decide, then write). DEGRADE: an open_memstream failure emits the header FIRST with the - // MODELLED estimate (the pre-§H7 number, never a fabricated one) and streams the array behind it. + // ── WHICH rows, in WHICH order: serialize()'s steps. This dialect has no in=DIR stub; it always prints its rows. ────────── + const std::size_t keep = mapKeepCount( ing, topK ); + const RankedMapRows ranked = rankMapRows( ing, rank, ann, keep, /*stubbed=*/false ); + const std::span<const NodeId> kept = ranked.kept( keep ); + // T1/§H7: SAME byte-model the XML sibling uses, in the same two roles — the fill-order oracle and the rate source. The + // REPORTED est_tokens is measured from the emitted bytes in PHASE 2 below, exactly as in serialize(): this emitter had the + // identical --metrics under-report (MEASURED: 1780 B reported as est_tokens=507, 3.51 B/tok). + const TokenEstimate mapEst = estimateTokens( ing, ranked.order, kept.size(), outOff, outTargets ); + const MapEmitOrder emitOrder = decideMapEmitOrder( stable, mostImportantLast, autoOrder, mapEst.tokens ); + const MapFileGroups groups = groupMapRowsByFile( ing, ann, kept, /*stubbed=*/false, emitOrder, outOff, outTargets, pathRel ); + const MapHonestyGauges gauges = countMapHonestyGauges( ing, MapResolverCounters{ .ambOut = ambOut, .unresolvedOut = unresolvedOut, .locPinOut = locPinOut, + .declinedOut = declinedOut, .externalCalls = externalCalls } ); + + // ── PHASE 1: render the "r" array into a buffer (§H7 — see serialize()'s PHASE 1 for the full reasoning: measure, decide, + // then write). DEGRADE: an open_memstream failure emits the header FIRST with the MODELLED estimate (the pre-§H7 number, + // never a fabricated one) and streams the array behind it. rw::MemoryStream rowsStream; std::FILE* const rowsMem = openChargeStream( rowsStream ); MapEstimate estimate{ ann.payloadUncharged }; @@ -11728,132 +12006,53 @@ inline void serializeJson( std::FILE* out, const IngestResult& ing, const std::v DISCLOSE( estimate, MapEstimate::DisclosureWhy::ChargeBufferFailed, "serializeJson: open_memstream failed — est_tokens reports the MODELLED bytes, not the emitted ones" ); } - // ONE header emitter, used by the degrade write, the size probe and the real write, so the three can - // never disagree on the header's shape. The peak attribute is read here once for all three: a second reading may - // pass the limit the first did not, and the probe would then have priced a shorter header than the one written. + // ONE header emitter, used by the degrade write, the size probe and the real write, so the three can never disagree on the + // header's shape. The peak attribute is read here once for all three: a second reading may pass the limit the first did + // not, and the probe would then have priced a shorter header than the one written. const std::string memoryPeakJson = buildMemoryPeakAttr( ing, true ); std::string esc; const auto emitHeader = [ & ]( std::FILE* dst, std::size_t estTokens ) { JsonWriter hw( dst ); - writeJsonMapHeader( hw, esc, JsonMapHeader{ ing, mapSymbolCount( ing ), outTargets.size(), keep + stemRows.size(), estTokens, ambTotal, - unresolvedTotal, orderAttr, outProv, &ann, rootArg, locPinTotal, externalCalls, declinedTotal, - extentSuspectTotal, macroBlankedFileCount( ing ), ing.crawlSkips.nestRefusedFiles, - estimate.isModelled, dataSecCut, stemPick.cut, memoryPeakJson } ); + writeJsonMapHeader( hw, esc, JsonMapHeader{ ing, mapSymbolCount( ing ), outTargets.size(), keep + groups.stemPick.rows.size(), estTokens, gauges.ambiguous, + gauges.unresolved, mapOrderAttr( emitOrder ), outProv, &ann, rootArg, gauges.localityPinned, gauges.external, + gauges.declined, gauges.extentSuspectSyms, gauges.macroBlankedFiles, gauges.nestRefusedFiles, + estimate.isModelled, ranked.dataSecCut, groups.stemPick.cut, memoryPeakJson } ); hw.write( ",\"r\":[" ); }; - // The "r" array, as ONE renderer both paths call — serialize()'s writeChildren above, for the same reason: a buffer - // that opened and then lost a write has already spent the rows, so the fallback must be able to write them again. + // The "r" array, as ONE renderer both paths call — serialize()'s writeChildren, for the same reason: a buffer that opened and + // then lost a write has already spent the rows, so the fallback must be able to write them again. + const MapRowSources rowSources{ .rank = rank, .outOff = outOff, .outTargets = outTargets, .outProv = outProv, .outNameOnly = outNameOnly, + .ambOut = ambOut, .locPinOut = locPinOut, .bind = bind, .stable = stable, .metrics = metrics, + .fanIn = fanIn, .cbo = cbo, .tested = tested, .lcom4 = lcom4, .amp = amp }; const auto writeRows = [ & ]( JsonWriter& w ) { - char num[ 64 ]; - - bool firstFile = true; - for( std::uint32_t f : fileOrder ) + for( std::size_t i = 0; i < groups.fileOrder.size(); ++i ) { - if( !firstFile ) + if( i > 0 ) { w.write( "," ); } - firstFile = false; - w.write( "{\"p\":" ); writeJsonStr( w, pathRel( f ), esc ); - if( const char* fl = builtinLayer( rootRelPath( ing, f ) ); *fl ) { w.write( ",\"layer\":" ); writeJsonStr( w, fl, esc ); } - w.write( ",\"s\":[" ); - - // §P6.3 / §A4d: const/non-const overloads canonicalize to the SAME id, so a bucket straight from - // `order` printed two byte-identical JSON objects and a consumer keying on "id" silently dropped - // one. Same collapse the XML path runs (collapseOverloadRows above), same "overloads" count. - const OverloadRows rows = overloadRowsFor( ing, buckets[f], metrics ); // the XML path's per-definition rule - - bool firstSym = true; - for( std::size_t rowIndex = 0; rowIndex < rows.id.size(); ++rowIndex ) - { - const NodeId id = rows.id[ rowIndex ]; - if( !firstSym ) - { - w.write( "," ); - } - firstSym = false; - const Symbol& s = ing.symbols[id]; - const std::uint32_t out2= outOff[id + 1] - outOff[id]; - - w.write( "{\"t\":" ); writeJsonStr( w, symTag( s.kind ), esc ); - w.write( ",\"n\":" ); writeJsonStr( w, s.name, esc ); - - if( hasScopeAttr( s ) ) { w.write( ",\"sc\":" ); writeJsonStr( w, s.scope, esc ); } // row 6: the XML sibling's sc=, one presence rule (hasScopeAttr) - if( !stemRows.empty() && std::ranges::binary_search( stemRows, id ) ) { w.write( ",\"stem\":1" ); } // MAP-STEM: the XML sibling's stem="1" - - if( rows.overloads[ rowIndex ] > 1 ) - { rw::formatTo( num, sizeof( num ), ",\"overloads\":{}", rows.overloads[ rowIndex ] ); w.write( num ); } - w.write( splitLineJson( rows, rowIndex, s ) ); // the XML l= twin: a --metrics row split out of a same-name group - - if( const std::string_view label = bind ? bind->labelOf( id ) : std::string_view{}; !label.empty() ) - { w.write( ",\"bind\":" ); writeJsonStr( w, label, esc ); } - - if( const std::uint32_t ambK = counterAt( ambOut, id ); ambK > 0 ) - { rw::formatTo( num, sizeof( num ), ",\"amb\":{}", ambK ); w.write( num ); } - - if( const std::uint32_t lpinK = counterAt( locPinOut, id ); lpinK > 0 ) // Phase 4: the XML lpin= twin - { rw::formatTo( num, sizeof( num ), ",\"lpin\":{}", lpinK ); w.write( num ); } - - if( s.extentSuspect != 0 ) // extent honesty: the XML extent_suspect= twin, same reason spelling - { w.write( ",\"extent_suspect\":" ); writeJsonStr( w, extent::extentSuspectReasons( s.extentSuspect ), esc ); } - - if( !stable ) - { rw::formatTo( num, sizeof( num ), ",\"k\":{:.4f}", double( rank[id] ) ); w.write( num ); } - - if( metrics ) - { - writeJsonQMetrics( w, JsonQMetrics{ s, id, out2, fanIn, cbo, tested, lcom4, amp } ); - } - - w.write( ",\"c\":[" ); - bool firstC = true; - for( std::uint32_t e = outOff[id]; e < outOff[id + 1]; ++e ) - { - if( !firstC ) - { - w.write( "," ); - } - firstC = false; - w.write( "{\"n\":" ); writeJsonStr( w, ing.symbols[ outTargets[e] ].name, esc ); - // §A4d: prov mirrors the XML attribute 1:1 — "scip" for a SCIP-pinned edge, "binding" for a - // decoded FFI binding, "import" for an ES named-import edge, "split" (C1) for one arm of a k-way - // split the resolver could not choose between. outProv parallels outTargets exactly, so index `e` - // is the same edge. The two dialects MUST spell the same vocabulary: test/mcpclidiffcheck.sh is - // the gate that says so. - if( outProv && e < outProv->size() && (*outProv)[e] ) - { - w.write( ",\"" ); w.write( provAttrName( (*outProv)[e] ) ); w.write( "\":" ); writeJsonStr( w, provLabel( (*outProv)[e] ), esc ); // L6: "via":"impl" - } - if( outNameOnly && e < outNameOnly->size() ) - { - writeMapCalleeJsonKind( w, ( *outNameOnly )[e] ); - } - w.write( "}" ); - } - w.write( "]}" ); - } - w.write( "]}" ); + writeJsonMapFileGroup( w, ing, groups.fileOrder[ i ], groups, rowSources, pathRel, esc ); } w.write( "]" ); - if( inventory.active ) + if( groups.inventory.active ) { - writeMapInventoryJson( w, ing, inventory, pathRel, outOff, outTargets, outProv, outNameOnly, esc ); + writeMapInventoryJson( w, ing, groups.inventory, pathRel, outOff, outTargets, outProv, outNameOnly, esc ); } w.write( "}" ); }; // DEGRADE, one path for both failures: the header FIRST with the MODELLED estimate, the array streamed behind it. const auto emitModelled = [ & ]() { - emitHeader( out, mapEstTokens ); + emitHeader( out, mapEst.tokens ); JsonWriter direct( out ); writeRows( direct ); direct.flush(); if( outEstTokens ) { - *outEstTokens = mapEstTokens; + *outEstTokens = mapEst.tokens; } }; if( !rowsMem ) @@ -11892,7 +12091,7 @@ inline void serializeJson( std::FILE* out, const IngestResult& ing, const std::v rw::MemoryStream probe; if( std::FILE* const pm = openChargeStream( probe ) ) { - emitHeader( pm, mapEstTokens ); + emitHeader( pm, mapEst.tokens ); if( const rw::MemoryStreamBytes header = probe.finish(); header.isWhole ) { headerBytes = header.bytes.size(); From d871b97a09feef74faedc9bae801183d66df155c Mon Sep 17 00:00:00 2001 From: joyful-ii-V-I <210578314+joyful-ii-V-I@users.noreply.github.com> Date: Sat, 21 Nov 2026 18:59:18 -0500 Subject: [PATCH 25/44] refactor(serialize): one writer for the roots table, the emit order and gauge clauses as data qd-range on the first commit gated five clone rows. The map's multi-root prologue was a copy of writeMultiRootTable; both now write writeRootLabelRows. The emit order's order= spelling and important-last flag are one traits table (kMapEmitOrderTraits) instead of a predicate shaped like four others. The gauge-to-legend-clause pairs are tables (kParseHonestyClauses, kDeclineClauses) read by gaugeLegend, and the corpus-kind clauses share corpusHasSymbol. The blank line test is find_first_not_of in place. Byte-identical: no answer changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --- src/serialize.h | 198 +++++++++++++++++++++++------------------------- 1 file changed, 96 insertions(+), 102 deletions(-) diff --git a/src/serialize.h b/src/serialize.h index 416e95334..dedcb7cd8 100644 --- a/src/serialize.h +++ b/src/serialize.h @@ -223,29 +223,6 @@ inline std::string_view escapeXml( std::string_view s, std::vector<char>& out ) return std::string_view( out.data(), out.size() ); } -// M12 (capture-audit-2026-09-04, lane L9): under multi-root, every one of the graph-count verbs -// (--callers/--callees/--uses) drops root= (correctly — there IS no single root=) but discloses NOTHING in -// its place, so a reader of `ripwire src test --callers=SYM` has no way to learn what the `<label>/` prefix -// on every p=/id= MEANS. The default map's own prologue already prints exactly this table for exactly this -// reason (below, in serialize()); this is that same shape, factored out so the read verbs can reuse it -// instead of re-deriving it. Lives here (not graphlegend.h, which is included from ABOVE this point in this -// very file) because it needs escapeXml, and emits nothing at all under single-root (rootLabels.size() < 2) -// — this must never move a single byte of single-root output. -inline void writeMultiRootTable( std::FILE* out, const IngestResult& ing ) -{ - if( ing.rootLabels.size() < 2 ) - { - return; - } - std::vector<char> esc; - for( std::size_t r = 0; r < ing.rootLabels.size(); ++r ) - { - rw::emitTo( out, "<root label=\"{}\" p=\"{}\"/>", - std::string( escapeXml( ing.rootLabels[r], esc ) ).c_str(), - std::string( escapeXml( r < ing.rootPaths.size() ? ing.rootPaths[r] : std::string(), esc ) ).c_str() ); - } -} - // The legend clause defining the table above — appended ONLY when it actually rides (multiRoot), the same // presence-matches-emission discipline every other conditional clause in this file follows (and the same // SEPARATE-comment shape kRootRelPathsLegend uses — graphlegend.h — so a caller just concatenates it). @@ -518,6 +495,39 @@ class XmlWriter char m_buf[ kCap ]; }; +// The multi-root label → root path table, canonical order: `<root label= p=/>` per root, nothing under single-root. §P8 +// collision: this prologue spelled its LABEL `l=`, the two characters 22 other sites use for a LINE NUMBER — including the +// map's <f p= …> rows. Renamed to label=. +inline void writeRootLabelRows( XmlWriter& w, const IngestResult& ing, std::vector<char>& esc ) +{ + if( ing.rootLabels.size() < 2 ) + { + return; + } + for( std::size_t r = 0; r < ing.rootLabels.size(); ++r ) + { + w.write( "<root label=\"" ); w.write( escapeXml( ing.rootLabels[r], esc ) ); + w.write( "\" p=\"" ); w.write( escapeXml( r < ing.rootPaths.size() ? ing.rootPaths[r] : std::string(), esc ) ); + w.write( "\"/>" ); + } +} + +// M12 (capture-audit-2026-09-04, lane L9): under multi-root, every one of the graph-count verbs +// (--callers/--callees/--uses) drops root= (correctly — there IS no single root=) but discloses NOTHING in +// its place, so a reader of `ripwire src test --callers=SYM` has no way to learn what the `<label>/` prefix +// on every p=/id= MEANS. The default map's own prologue prints exactly this table for exactly this reason +// (serialize()'s writeMapChildren), and both write it with writeRootLabelRows. Lives here (not graphlegend.h, +// which is included from ABOVE this point in this very file) because it needs escapeXml and XmlWriter, and +// emits nothing at all under single-root (rootLabels.size() < 2) — this must never move a single byte of +// single-root output. +inline void writeMultiRootTable( std::FILE* out, const IngestResult& ing ) +{ + std::vector<char> esc; + XmlWriter w( out ); + writeRootLabelRows( w, ing, esc ); + w.flush(); +} + // L3 field-notes surfacing: attach `<note d="ISO-date"><![CDATA[text]]></note>` children for a symbol or file // `target` (a canonical id, or a path). INERT when `ni == nullptr` (no/empty notes file) → it writes ZERO // bytes, so the whole pipeline stays byte-identical to the pre-feature output on every verb (the L3 inertness @@ -3400,18 +3410,25 @@ inline MapEmitOrder decideMapEmitOrder( bool stable, bool mostImportantLast, boo return ( autoOrder && mapEstTokens > kFillOrderThreshold ) ? MapEmitOrder::ImportantLastAuto : MapEmitOrder::ImportantFirst; } -inline bool isImportantLast( MapEmitOrder emitOrder ) noexcept -{ - return emitOrder == MapEmitOrder::ImportantLast || emitOrder == MapEmitOrder::ImportantLastAuto; -} - +// What each emit order means downstream, as data: its order= spelling and whether the rank order is REVERSED (important-last). // order= marker: T3's auto-flip must be OBSERVABLE, not a silent behaviour change — "important-last(auto:fill)" is distinct // from the explicit "important-last" so a reader (or a diff) can tell the ordering was the fill-aware heuristic, not a // requested flag. -inline const char* mapOrderAttr( MapEmitOrder emitOrder ) noexcept +struct MapEmitOrderTraits +{ + const char* orderAttr; + bool importantLast; +}; +inline constexpr MapEmitOrderTraits kMapEmitOrderTraits[] = { + { "important-first", false }, // ImportantFirst + { "stable", false }, // Stable + { "important-last", true }, // ImportantLast + { "important-last(auto:fill)", true }, // ImportantLastAuto +}; + +inline const MapEmitOrderTraits& traitsOf( MapEmitOrder emitOrder ) noexcept { - static constexpr const char* kNames[] = { "important-first", "stable", "important-last", "important-last(auto:fill)" }; - return kNames[ std::size_t( emitOrder ) ]; + return kMapEmitOrderTraits[ std::size_t( emitOrder ) ]; } // Puts the rank-ordered file groups in the emit order: --stable sorts files by path and rows by symbol id (== file+line @@ -3427,7 +3444,7 @@ inline void putMapGroupsInEmitOrder( const IngestResult& ing, MapEmitOrder emitO std::sort( b.begin(), b.end() ); } } - else if( isImportantLast( emitOrder ) ) + else if( traitsOf( emitOrder ).importantLast ) { std::reverse( fileOrder.begin(), fileOrder.end() ); for( std::vector<NodeId>& b : buckets ) @@ -3571,13 +3588,19 @@ inline std::string mapOpeningLegend( bool withProv ) : "<!-- ripwire v1 t=fn|method|cls|struct|iface|var|sec|macro(#define;degraded:body-is-replacement-text,edges-cross-expansion) p=path layer=arch-layer(opt) n=name sc=enclosing-scope(absent-if-unscoped;the-full-id-is-p::sc::n-with-p=-from-the-enclosing-f,and-expand/callers/impact/uses-accept-it) k=rank c=call amb=ambiguous-calls(read-source) lpin=calls-pinned-by-locality-prior-alone(a-disclosed-guess;read-source;absent-if-0) overloads=N-same-name-defs-merged-into-this-row(absent-if-1;shown=counts-them-individually,so-rows+sum(overloads-1)=shown) hdr:unresolved=calls-with-no-edge-and-no-proof-of-an-outside-target(every-same-named-def-lang-incompatible-or-out-of-the-language-lookup) (edges heuristic) hdr:locality_pinned=sum-of-lpin(absent-if-0) hdr:external=calls-refused-as-bound-outside-the-tree-ON-PROOF(builtin/global/predeclared/C-library-name-without-in-repo-evidence,outside-import/use,super-past-the-tree;no-edge;absent-if-0) r:est_tokens=hdr-copy(none-if-stable) -->"; } +// Whether any symbol of the corpus satisfies `pred` — the presence test behind every corpus-kind legend clause. +template <class Pred> +inline bool corpusHasSymbol( const IngestResult& ing, const Pred& pred ) +{ + return std::any_of( ing.symbols.begin(), ing.symbols.end(), pred ); +} + // MODULE-SCOPE OWNERS (issue #60): the t="modscope" kind's reading, ONLY when the corpus actually has one — a corpus with no // file-scope call keeps every byte of this legend, which is what kept test/printf_parity.manifest's --pack-signatures and // --around hashes and every est_tokens ceiling where they were. inline std::string moduleScopeLegend( const IngestResult& ing ) { - const bool hasModuleScope = std::any_of( ing.symbols.begin(), ing.symbols.end(), []( const Symbol& sym ) { return sym.kind == SymKind::ModuleScope; } ); - return hasModuleScope ? std::string( kModScopeMapLegend ) : std::string(); + return corpusHasSymbol( ing, []( const Symbol& sym ) { return sym.kind == SymKind::ModuleScope; } ) ? std::string( kModScopeMapLegend ) : std::string(); } // lane L6: a <c via="impl"> edge's reading, over the rows WRITTEN (fix round 1, N1): only when a kept row or an inventory entry @@ -3603,38 +3626,54 @@ inline std::string typeKindLegend( const IngestResult& ing ) { const auto namedTypeKind = []( const Symbol& sym ) { return sym.kind == SymKind::NamedType || sym.kind == SymKind::Alias || sym.kind == SymKind::FuncType; }; std::string clauses; - if( std::any_of( ing.symbols.begin(), ing.symbols.end(), [ & ]( const Symbol& sym ) { return namedTypeKind( sym ) && !langFacts( sym.lang ).aliasTargetDefs; } ) ) + if( corpusHasSymbol( ing, [ & ]( const Symbol& sym ) { return namedTypeKind( sym ) && !langFacts( sym.lang ).aliasTargetDefs; } ) ) { clauses += kNamedTypeMapLegend; } - if( std::any_of( ing.symbols.begin(), ing.symbols.end(), [ & ]( const Symbol& sym ) { return namedTypeKind( sym ) && langFacts( sym.lang ).aliasTargetDefs; } ) ) + if( corpusHasSymbol( ing, [ & ]( const Symbol& sym ) { return namedTypeKind( sym ) && langFacts( sym.lang ).aliasTargetDefs; } ) ) { clauses += kCppAliasMapLegend; } return clauses; } -// The parse-honesty gauges' clauses, each charged only to the map whose header carries the gauge: EXTENT HONESTY -// (src/extentsuspect.h; the row and the header reading), MEMBER-MACRO RE-PARSE (src/macroreparse.h) and #157's nest_refused=. -inline std::string parseHonestyLegend( const MapHonestyGauges& gauges ) +// Which legend clause defines which gauge, as data: a clause is charged only to the map whose header carries its gauge (> 0). +struct GaugeClause +{ + std::size_t MapHonestyGauges::* gauge; + std::string_view clause; +}; + +inline std::string gaugeLegend( const MapHonestyGauges& gauges, std::span<const GaugeClause> table ) { std::string clauses; - if( gauges.extentSuspectSyms > 0 ) + for( const GaugeClause& row : table ) { - clauses += kExtentSuspectRowLegend; - clauses += kExtentSuspectHdrLegend; - } - if( gauges.macroBlankedFiles > 0 ) - { - clauses += kMacroBlankedHdrLegend; - } - if( gauges.nestRefusedFiles > 0 ) - { - clauses += kNestRefusedMapLegend; + if( gauges.*row.gauge > 0 ) + { + clauses += row.clause; + } } return clauses; } +// The parse-honesty gauges' clauses: EXTENT HONESTY (src/extentsuspect.h; the row and the header reading), MEMBER-MACRO +// RE-PARSE (src/macroreparse.h) and #157's nest_refused=. +inline constexpr GaugeClause kParseHonestyClauses[] = { + { &MapHonestyGauges::extentSuspectSyms, kExtentSuspectRowLegend }, + { &MapHonestyGauges::extentSuspectSyms, kExtentSuspectHdrLegend }, + { &MapHonestyGauges::macroBlankedFiles, kMacroBlankedHdrLegend }, + { &MapHonestyGauges::nestRefusedFiles, kNestRefusedMapLegend }, +}; + +// The tier-3 decline clauses: declined=, then the builtin-method gate's, the standard-member gate's and the Elixir quote's share. +inline constexpr GaugeClause kDeclineClauses[] = { + { &MapHonestyGauges::declined, kDeclinedMapLegend }, + { &MapHonestyGauges::declinedByGate, kDeclinedGateMapLegend }, + { &MapHonestyGauges::declinedByStdMember, kDeclinedStdMapLegend }, + { &MapHonestyGauges::declinedInert, kInertDeclinedMapLegend }, +}; + // M20: the seeded-verb clause, emitted only on a seeded map (see MapAnnotations::SeedDisclosure). inline std::string seedLegend( const MapAnnotations::SeedDisclosure& seed ) { @@ -3747,29 +3786,6 @@ inline std::string rowSelectionLegend( const DataSectionsCut& dataSecCut, const return clauses; } -// The tier-3 decline clauses, each charged to the map that carries the count it explains. -inline std::string declineLegend( const MapHonestyGauges& gauges ) -{ - std::string clauses; - if( gauges.declined > 0 ) - { - clauses += kDeclinedMapLegend; // the map carries declined= - } - if( gauges.declinedByGate > 0 ) - { - clauses += kDeclinedGateMapLegend; // the builtin-method gate declined a call - } - if( gauges.declinedByStdMember > 0 ) - { - clauses += kDeclinedStdMapLegend; // the standard-member gate declined a call - } - if( gauges.declinedInert > 0 ) - { - clauses += kInertDeclinedMapLegend; // an Elixir quote declined a call candidate - } - return clauses; -} - // FE-B: the readings of a <c> row's via="name", via="link" and anchor="missing", in the map's short spelling (graphlegend.h // kViaNameLegend carries the long one) — each exactly when a kept row may print it (over-approximated by merged overloads, // which print one member's edges). via="name"'s clause also defines a merged row's x=. None is written under the compact @@ -4245,22 +4261,6 @@ inline void writeMapFileGroup( XmlWriter& w, const IngestResult& ing, std::uint3 w.write( "</f>" ); } -// A13 prologue, multi-root only: label → root path, canonical order. §P8 collision: this prologue spelled its LABEL `l=`, the -// two characters 22 other sites use for a LINE NUMBER — including the <f p= …> rows. Renamed to label=. -inline void writeRootLabelPrologue( XmlWriter& w, const IngestResult& ing, std::vector<char>& esc ) -{ - if( ing.rootLabels.size() < 2 ) - { - return; - } - for( std::size_t r = 0; r < ing.rootLabels.size(); ++r ) - { - w.write( "<root label=\"" ); w.write( escapeXml( ing.rootLabels[r], esc ) ); - w.write( "\" p=\"" ); w.write( escapeXml( r < ing.rootPaths.size() ? ing.rootPaths[r] : std::string(), esc ) ); - w.write( "\"/>" ); - } -} - // C1-b: under in=DIR the symbol map is a DISCLOSED stub (docs/METHODOLOGY.md §9.3) — the caller asked for DIR's recent files, // not the map. // @@ -4304,7 +4304,7 @@ inline void writeMapChildren( XmlWriter& w, const IngestResult& ing, const MapAn MapEmitOrder emitOrder, const MapRowSources& src, const PathRel& pathRel, std::vector<char>& esc, std::vector<std::uint32_t>& scratch ) { - writeRootLabelPrologue( w, ing, esc ); + writeRootLabelRows( w, ing, esc ); // A13: the multi-root prologue writeRecentRows( w, ann, pathRel, esc ); if( ann.stubSymbols ) { @@ -4317,7 +4317,7 @@ inline void writeMapChildren( XmlWriter& w, const IngestResult& ing, const MapAn writeMapInventoryXml( w, ing, groups.inventory, pathRel, src.outOff, src.outTargets, src.outProv, src.outNameOnly, esc, scratch ); } }; - const bool inventoryFirst = isImportantLast( emitOrder ); // --stable's path order wins, as it does for the rows + const bool inventoryFirst = traitsOf( emitOrder ).importantLast; // --stable's path order wins, as it does for the rows if( inventoryFirst ) { writeInventory(); @@ -4472,13 +4472,13 @@ inline void serialize( std::FILE* out, const IngestResult& ing, const std::vecto legend += moduleScopeLegend( ing ); legend += keptImplEdgeLegend( outOff, outProv, kept, groups.inventory.entries ); legend += typeKindLegend( ing ); - legend += parseHonestyLegend( gauges ); + legend += gaugeLegend( gauges, kParseHonestyClauses ); legend += runAnnotationLegend( ing, ann, rootArg, metrics ); legend += rowSelectionLegend( ranked.dataSecCut, groups ); // W2-F: the pr_iters= / pr_converged= definition, charged to the maps that carry the attributes — empty for a lexical or // HITS ordering, and the prose half only on the map whose iteration stopped short. legend += renderDisclosure( ann.prDisclosure, DiscloseAs::LegendComment ); - legend += declineLegend( gauges ); + legend += gaugeLegend( gauges, kDeclineClauses ); legend += keptNameEdgeLegend( outOff, outNameOnly, kept, ann.viaLegendStripped ); // K51: history_unread='s definition, the LAST leading clause, so it stands right before the <r> root it marks and inside the // leading block every reader (and legendcoveragecheck's full rows) meets first; absent unless the amp=/churn= walk was unread. @@ -4494,7 +4494,7 @@ inline void serialize( std::FILE* out, const IngestResult& ing, const std::vecto const std::string coverageAttrs = mapCoverageAttrs( ing, outProv, ann ); const MapStatsFacts statsFacts{ .files = ing.files.size(), .symbols = mapSymbolCount( ing ), .edges = outTargets.size(), .shown = stubbed ? std::size_t( 0 ) : keep + groups.stemPick.rows.size(), - .gauges = gauges, .coverageAttrs = coverageAttrs, .orderAttr = mapOrderAttr( emitOrder ) }; + .gauges = gauges, .coverageAttrs = coverageAttrs, .orderAttr = traitsOf( emitOrder ).orderAttr }; const MapRootFacts rootFacts{ .ann = ann, .rootArg = rootArg, .stable = stable, .dataSecCut = ranked.dataSecCut, .stemCut = groups.stemPick.cut }; MapEstimate estimate{ ann.payloadUncharged }; // the est_tokens measurement's DISCLOSE sink — read by the builders const auto buildHead = [ & ]( std::size_t estTokens ) -> std::string @@ -5104,12 +5104,6 @@ inline std::string stripCommentsKeepLiterals( std::string_view src ) return out; } -// A line whose content is only spaces, tabs and carriage returns. -inline bool isBlankLine( std::string_view line ) noexcept -{ - return std::all_of( line.begin(), line.end(), []( char ch ) { return ch == ' ' || ch == '\t' || ch == '\r'; } ); -} - // Phase 2: the comment-stripped text's line layout. Lines that are now whitespace-only and come before the first content line // are dropped (an artifact of stripping the opening comment of a body); after it, at most two consecutive blank lines are // kept and the rest of a run is dropped. Every line with ANY non-whitespace content is kept, so intentional blank lines between @@ -5124,7 +5118,7 @@ inline std::string collapseBlankLineRuns( std::string_view text ) { const std::size_t eol = std::min( text.find( '\n', pos ), text.size() ); const std::string_view line = text.substr( pos, eol - pos ); - if( !isBlankLine( line ) ) + if( line.find_first_not_of( " \t\r" ) != std::string_view::npos ) // the line has content { blanks = 0; result.append( line ); @@ -12015,7 +12009,7 @@ inline void serializeJson( std::FILE* out, const IngestResult& ing, const std::v { JsonWriter hw( dst ); writeJsonMapHeader( hw, esc, JsonMapHeader{ ing, mapSymbolCount( ing ), outTargets.size(), keep + groups.stemPick.rows.size(), estTokens, gauges.ambiguous, - gauges.unresolved, mapOrderAttr( emitOrder ), outProv, &ann, rootArg, gauges.localityPinned, gauges.external, + gauges.unresolved, traitsOf( emitOrder ).orderAttr, outProv, &ann, rootArg, gauges.localityPinned, gauges.external, gauges.declined, gauges.extentSuspectSyms, gauges.macroBlankedFiles, gauges.nestRefusedFiles, estimate.isModelled, ranked.dataSecCut, groups.stemPick.cut, memoryPeakJson } ); hw.write( ",\"r\":[" ); From 3a8bad760d226bba730c8d9e48a431df26bc0c82 Mon Sep 17 00:00:00 2001 From: joyful-ii-V-I <210578314+joyful-ii-V-I@users.noreply.github.com> Date: Sat, 21 Nov 2026 19:03:16 -0500 Subject: [PATCH 26/44] refactor(serialize): the module-scope clause as its presence scan, no one-line any_of wrapper qd-range gated corpusHasSymbol as a clone of notes::sortNotes' one-call shape. The module-scope legend test is its own early-return scan again and the two type-kind tests call std::any_of directly. Byte-identical: no answer changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --- src/serialize.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/serialize.h b/src/serialize.h index dedcb7cd8..89383f328 100644 --- a/src/serialize.h +++ b/src/serialize.h @@ -3588,19 +3588,19 @@ inline std::string mapOpeningLegend( bool withProv ) : "<!-- ripwire v1 t=fn|method|cls|struct|iface|var|sec|macro(#define;degraded:body-is-replacement-text,edges-cross-expansion) p=path layer=arch-layer(opt) n=name sc=enclosing-scope(absent-if-unscoped;the-full-id-is-p::sc::n-with-p=-from-the-enclosing-f,and-expand/callers/impact/uses-accept-it) k=rank c=call amb=ambiguous-calls(read-source) lpin=calls-pinned-by-locality-prior-alone(a-disclosed-guess;read-source;absent-if-0) overloads=N-same-name-defs-merged-into-this-row(absent-if-1;shown=counts-them-individually,so-rows+sum(overloads-1)=shown) hdr:unresolved=calls-with-no-edge-and-no-proof-of-an-outside-target(every-same-named-def-lang-incompatible-or-out-of-the-language-lookup) (edges heuristic) hdr:locality_pinned=sum-of-lpin(absent-if-0) hdr:external=calls-refused-as-bound-outside-the-tree-ON-PROOF(builtin/global/predeclared/C-library-name-without-in-repo-evidence,outside-import/use,super-past-the-tree;no-edge;absent-if-0) r:est_tokens=hdr-copy(none-if-stable) -->"; } -// Whether any symbol of the corpus satisfies `pred` — the presence test behind every corpus-kind legend clause. -template <class Pred> -inline bool corpusHasSymbol( const IngestResult& ing, const Pred& pred ) -{ - return std::any_of( ing.symbols.begin(), ing.symbols.end(), pred ); -} - // MODULE-SCOPE OWNERS (issue #60): the t="modscope" kind's reading, ONLY when the corpus actually has one — a corpus with no // file-scope call keeps every byte of this legend, which is what kept test/printf_parity.manifest's --pack-signatures and // --around hashes and every est_tokens ceiling where they were. -inline std::string moduleScopeLegend( const IngestResult& ing ) +inline std::string_view moduleScopeLegend( const IngestResult& ing ) noexcept { - return corpusHasSymbol( ing, []( const Symbol& sym ) { return sym.kind == SymKind::ModuleScope; } ) ? std::string( kModScopeMapLegend ) : std::string(); + for( const Symbol& sym : ing.symbols ) + { + if( sym.kind == SymKind::ModuleScope ) + { + return kModScopeMapLegend; + } + } + return {}; } // lane L6: a <c via="impl"> edge's reading, over the rows WRITTEN (fix round 1, N1): only when a kept row or an inventory entry @@ -3626,11 +3626,11 @@ inline std::string typeKindLegend( const IngestResult& ing ) { const auto namedTypeKind = []( const Symbol& sym ) { return sym.kind == SymKind::NamedType || sym.kind == SymKind::Alias || sym.kind == SymKind::FuncType; }; std::string clauses; - if( corpusHasSymbol( ing, [ & ]( const Symbol& sym ) { return namedTypeKind( sym ) && !langFacts( sym.lang ).aliasTargetDefs; } ) ) + if( std::any_of( ing.symbols.begin(), ing.symbols.end(), [ & ]( const Symbol& sym ) { return namedTypeKind( sym ) && !langFacts( sym.lang ).aliasTargetDefs; } ) ) { clauses += kNamedTypeMapLegend; } - if( corpusHasSymbol( ing, [ & ]( const Symbol& sym ) { return namedTypeKind( sym ) && langFacts( sym.lang ).aliasTargetDefs; } ) ) + if( std::any_of( ing.symbols.begin(), ing.symbols.end(), [ & ]( const Symbol& sym ) { return namedTypeKind( sym ) && langFacts( sym.lang ).aliasTargetDefs; } ) ) { clauses += kCppAliasMapLegend; } From 4b6575cdccc98ee489021fc908d3733f321ffd41 Mon Sep 17 00:00:00 2001 From: joyful-ii-V-I <210578314+joyful-ii-V-I@users.noreply.github.com> Date: Sat, 21 Nov 2026 20:00:05 -0500 Subject: [PATCH 27/44] refactor(serialize): the map header's coverage attributes composed on std::string fixedbufsweep re-derived the moved precise=/roots=/changed=/skipped_oversize=/ max_tokens= buffers as one unclassified `buf`. Every interpoland is an integer or a fixed literal, so mapCoverageAttrs now composes them on std::string and no fixed buffer is left; the five stale table rows go, and the `p` comment-mention row drops to the one remaining site. Byte-identical: no answer changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --- src/serialize.h | 29 ++++++++++++++--------------- test/fixedbufsweep.sh | 9 +++------ 2 files changed, 17 insertions(+), 21 deletions(-) diff --git a/src/serialize.h b/src/serialize.h index 89383f328..630502c68 100644 --- a/src/serialize.h +++ b/src/serialize.h @@ -3834,18 +3834,15 @@ inline std::size_t scipPinnedEdgeCount( const std::vector<std::uint8_t>* outProv inline std::string mapCoverageAttrs( const IngestResult& ing, const std::vector<std::uint8_t>* outProv, const MapAnnotations& ann ) { std::string attrs; - char buf[ 96 ]; if( const std::size_t precise = scipPinnedEdgeCount( outProv ); precise > 0 ) { - rw::formatTo( buf, sizeof( buf ), " precise={}", precise ); // only when a SCIP overlay pinned something - attrs += buf; + attrs += " precise=" + std::to_string( precise ); // only when a SCIP overlay pinned something } // Multi-root workspace (A13): `roots=N` joins the header gauges and a `<root label= p=/>` prologue opens <r> — ONLY when // N≥2 (single-root output byte-unchanged). if( ing.rootLabels.size() >= 2 ) { - rw::formatTo( buf, sizeof( buf ), " roots={}", ing.rootLabels.size() ); - attrs += buf; + attrs += " roots=" + std::to_string( ing.rootLabels.size() ); } // D6: --map-diff's teleport-seed file count, ONLY when the caller passes changedCount (nullptr for every non-map-diff // caller ⇒ zero token cost, byte-identical golden map). A clean tree reports "changed=0" so the caller can see the @@ -3853,16 +3850,14 @@ inline std::string mapCoverageAttrs( const IngestResult& ing, const std::vector< // plain default map. if( ann.changedCount ) { - rw::formatTo( buf, sizeof( buf ), " changed={}", *ann.changedCount ); - attrs += buf; + attrs += " changed=" + std::to_string( *ann.changedCount ); } // §P0.5d: how many otherwise-indexable files the crawl dropped for exceeding a per-file size ceiling — --max-file-size, or // (§B13.1) the .json lane's fixed 256 KB config ceiling that --max-file-size does not raise. `--max-file-size=8K` dropped // ~296 of ~759 files on this repo and files= reported the survivors as if they WERE the corpus. if( !ing.skippedOversize.empty() ) { - rw::formatTo( buf, sizeof( buf ), " skipped_oversize={}", ing.skippedOversize.size() ); - attrs += buf; + attrs += " skipped_oversize=" + std::to_string( ing.skippedOversize.size() ); } attrs += buildMemoryStopAttr( ing, false ) + buildMemoryPeakAttr( ing, false ); // #350, empty unless the memory guard stopped the ingest or the peak passed the limit attrs += buildUnindexedAttr( ing.crawlSkips ); // §L1: the LANGUAGES this build could not read at all @@ -3873,13 +3868,17 @@ inline std::string mapCoverageAttrs( const IngestResult& ing, const std::vector< // attr — a cap that can be overshot is not a cap, so where the map's fixed floor cannot fit inside fit_bytes the map states // that instead of quietly exceeding it. See MapAnnotations::MaxTokensFit for the four ways the cap was breached and why // the label is monotone. - if( ann.maxTokensFit != nullptr ) + if( const MapAnnotations::MaxTokensFit* fit = ann.maxTokensFit ) { - rw::formatTo( buf, sizeof( buf ), " max_tokens={} fit_bytes={}{}{}", - ann.maxTokensFit->askedTokens, ann.maxTokensFit->ceilingBytes, - ann.maxTokensFit->isOverCeiling || ann.maxTokensFit->isUnmeasured ? " over_ceiling=1" : "", - ann.maxTokensFit->isUnmeasured ? " fit_unmeasured=1" : "" ); - attrs += buf; + attrs += " max_tokens=" + std::to_string( fit->askedTokens ) + " fit_bytes=" + std::to_string( fit->ceilingBytes ); + if( fit->isOverCeiling || fit->isUnmeasured ) + { + attrs += " over_ceiling=1"; + } + if( fit->isUnmeasured ) + { + attrs += " fit_unmeasured=1"; + } } return attrs; } diff --git a/test/fixedbufsweep.sh b/test/fixedbufsweep.sh index 16549d4e9..8888af9fa 100755 --- a/test/fixedbufsweep.sh +++ b/test/fixedbufsweep.sh @@ -188,7 +188,6 @@ TABLE = { ( "src/packtask.h", "bodylessAttr" ): ( 2, "safe", "bodylessAttr[40], TWO call sites, same shape: line 1253 in restatePackTaskBodiesWrapper (issue #60, integration/train-12); line 1758 in the bare-wrapper placeholder branch (t14-cleanup #6) — the section-dropped <bodies> tag that never calls packBodies, so it could not reuse serialize.h's emitter and needed its own copy of the same attribute. Both format ' bodyless=\"{}\"' — 12 B of literal (' bodyless=\"' 11 + '\"' 1) and ONE interpoland, a std::size_t: 20 digits at absolute most, so 32 B against 39 usable + NUL, 7 B of margin. No string interpolation at all — the count is a count, never caller text — so no escaper can sit on either side of the buffer. It is a TABLE row and not NUMERIC_ONLY for arch.h hex[17]'s reason: a buffer that never existed before the std::print conversion has no pre-conversion format to derive a class from. THE ORIGINAL BUFFER WAS DECLARED [32] WHEN IT ARRIVED, which is 1 B short of its own worst case (32 B of text needs 33 with the NUL); formatTo truncates rather than overruns, so the failure mode was a dropped closing quote and a document that stops being well-formed, not a memory breach. Widened to 40 in the same commit as that row; the second site was declared [160]/[40] correctly from the start." ), # ── src/serialize.h ────────────────────────────────────────────────────────────────────────────────── ( "src/serialize.h", "bodylessAttr" ): ( 1, "safe", "bodylessAttr[40] in packBodies (issue #60, integration/train-12): the exact twin of the packtask.h row above — same format, same 12 B of literal, one std::size_t (bodylessCount), 32 B against 39 usable + NUL, 7 B of margin, no string interpoland. Same [32]-on-arrival correction, widened in the same commit." ), - ( "src/serialize.h", "fitAttr" ): ( 1, "safe", "fitAttr[96]: two %zu plus the literal ' over_ceiling=1'." ), ( "src/serialize.h", "attr" ): ( 2, "safe", "attr[352] x2: the per-symbol metric attrs. Widest 26 lit + 4x10 digits + 11 role + qbuf(<=95) + ambs(<=35: amb= + lpin=) + kbuf(<=23) = 230 B." ), ( "src/serialize.h", "tail" ): ( 3, "safe", "tail[192] x3: the <d> row tail. Widest 34 lit+digits + inAttr(<=23) + lens(qbuf, <=79) + pure(9) = 145 B. The third (lane/lean-answers-068, sigRowTail's zero-elision branch) prints cxAttr/ccxAttr/inAttr pre-formatted, each omitted at 0 — never wider than the second." ), ( "src/serialize.h", "hdr" ): ( 14, "safe", "hdr[64] x2 (packBodies/packOutline) (14: arch-honest — packDeps' <f> row for a no-edge file writes includes= and a language tag, hdr[144], one integer + a label of at most 8 B: far under the buffer; 13: train 26b — count-floor-068 replaced the <lego> implementors= header writes, two hdr sites, with string appends): '<b t=\"%s\" l=\"%u\" p=\"' — symTag's fixed vocabulary + a line number. THE ESCAPED PATH IS APPENDED AFTER, on std::string. snprintf-then-append: textbook safe." ), @@ -219,7 +218,7 @@ TABLE = { # A NEW row here still fails the gate until someone adds it, which is the point. When you add one, say which # set it belongs in and why: a string argument makes it a TABLE row, with real prose. NUMERIC_ONLY = { - ( "src/serialize.h", "p" ): 2, + ( "src/serialize.h", "p" ): 1, # GE-SERIALIZE (2026-11-21): the map row's copy of the snprintf( p, S, ... ) comment became BoundedAttrRun's; one comment mention left (the --for lens qbuf) ( "src/degradedscan.h", "hit.errRatio" ): 1, ( "src/dmm.h", "value" ): 1, ( "src/editcheck.h", "callersOpen" ): 1, @@ -262,7 +261,6 @@ NUMERIC_ONLY = { ( "src/serialize.h", "callsHdr" ): 2, ( "src/serialize.h", "cb" ): 1, ( "src/serialize.h", "ccxAttr" ): 1, # lane/lean-answers-068: sigRowTail's zero elision, " ccx=\"{}\"" of one count (<= 17 B of 23) - ( "src/serialize.h", "changedAttr" ): 1, ( "src/serialize.h", "eAttr" ): 1, # lane/for-spine-span-068 (2026-10-04): writeSigHeadWithEnd's ' e="{}"' — 5 B literal + one # std::uint32_t (10 digits) = 15 B against 23 usable + NUL. A count, no %s, nothing escaped. ( "src/serialize.h", "cxAttr" ): 1, # lane/lean-answers-068: the same, " cx=\"{}\"" (<= 16 B of 23) @@ -293,12 +291,9 @@ NUMERIC_ONLY = { # digits = 35 B). A count, no %s, nothing escaped. # lane/hrr (2026-10-18): +1 in the same nb[96] — ' files_first="{}"' (15 B + 20 # digits = 35 B), the head round-robin's moved count. A count, no %s, nothing escaped. - ( "src/serialize.h", "precAttr" ): 1, ( "src/serialize.h", "rankAttr" ): 1, ( "src/serialize.h", "rc" ): 1, - ( "src/serialize.h", "rootsAttr" ): 1, ( "src/serialize.h", "sh" ): 1, - ( "src/serialize.h", "skippedAttr" ): 1, ( "src/serialize.h", "vb" ): 1, ( "src/testmap.h", "buf" ): 6, ( "src/verbs_report.h", "buf" ): 2, @@ -628,6 +623,8 @@ if not bad: # 2026-10-18 (lane/hrr): +1 call/+1 mention/+1 site, rows unchanged (363/248/248/109 -> 364/249/249/109): sigsOpenTag's # nb[96] ' files_first="{}"' (35 B worst case, one size_t, nothing escaped) — re-read and sized before this pin. EXPECTED = { "mentions": 366, "calls": 251, "sites": 251, "rows": 109, "widthforms": 0 } # lane/hrr: +1 nb site (files_first=); arch-honest: +2 (packDeps hb, hdr) +# 2026-11-21 (GE-SERIALIZE): -5 calls/-5 sites/-5 rows (precAttr, rootsAttr, changedAttr, skippedAttr, fitAttr): the map +# header's coverage attributes are composed on std::string in mapCoverageAttrs (serialize.h), no fixed buffer left. # 2026-11-12 (B43 PINNED-SELF-COUNTS): EXPECTED above is now HISTORY, not a pin -- it drifted on #619 (and on every # lane that added one site) while (S1)/(S2) already held the member set both ways: every derived site is a TABLE # row with its multiplicity, and no row is stale. An exact count on top of that only re-pins arithmetic. What (S1)/(S2) From de2e52e9947333c77f808fcc9e08c53d783fd8e1 Mon Sep 17 00:00:00 2001 From: joyful-ii-V-I <210578314+joyful-ii-V-I@users.noreply.github.com> Date: Sun, 22 Nov 2026 00:13:38 -0500 Subject: [PATCH 28/44] refactor(serialize): one MapPlan for both map dialects; the JSON header spells the plan planMap() decides what a map prints once for XML and JSON: symbols= (counted once), the top-K cut, the rank order, the byte model, the emit order, the file groups, the honesty gauges and shown=. The stub is one named MapStubPolicy at each call (XML honours in=DIR's stub, JSON always prints rows), so rankMapRows and groupMapRowsByFile lose their stubbed parameter. The JSON header takes the plan and MapCoverageFacts (precise= via scipPinnedEdgeCount, roots, skipped_oversize; each absent at 0 in both dialects) instead of 21 positional fields, and no longer recounts mapSymbolCount on every emitHeader call. mapCoverageAttrs splits into renderMapCoverageAttrs + mapFitAttrs. --stable's byte-stable prefix is a trait of the emit order (emitOrderTraits().stablePrefix): k= on both row dialects, est_tokens=/lens= on <r>, the trailing stats and the path sort read it, never the flag. emitOrderTraits is an exhaustive switch (-Werror=switch). rowDescriptiveAttrs splits into rowMetricsAttrs + rowResolverGuessAttrs + rowRankAttr, written in the same order (the shared buffer never truncated: 326 B worst case < 351). Byte-identical output. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --- src/serialize.h | 551 ++++++++++++++++++++++-------------------- test/fixedbufsweep.sh | 4 +- 2 files changed, 297 insertions(+), 258 deletions(-) diff --git a/src/serialize.h b/src/serialize.h index 630502c68..6c6852868 100644 --- a/src/serialize.h +++ b/src/serialize.h @@ -3329,12 +3329,11 @@ inline void dropUnmappedRows( const IngestResult& ing, std::vector<NodeId>& orde // order, the file groups and the honesty gauges — so the two dialects cannot drift on them; each dialect then writes the // same groups in its own spelling. Every step below is decided once and handed on as a const value. -// C1-b: the row count the map WOULD print. It depends on topK and the printable rows alone — never on the ranking — so under -// in=DIR's stub it is still the honest would_show=. -inline std::size_t mapKeepCount( const IngestResult& ing, int topK ) noexcept +// C1-b: the row count the map WOULD print. It depends on topK and the printable rows alone (`mapSymbols`, mapSymbolCount: the +// rows dropUnmappedRows leaves) — never on the ranking — so under in=DIR's stub it is still the honest would_show=. +inline std::size_t mapKeepCount( std::size_t mapSymbols, int topK ) noexcept { - const std::size_t mapS = mapSymbolCount( ing ); // the rows the map can print (dropUnmappedRows) - return std::min<std::size_t>( topK > 0 ? std::size_t( topK ) : mapS, mapS ); + return std::min<std::size_t>( topK > 0 ? std::size_t( topK ) : mapSymbols, mapSymbols ); } // The rank order the map's rows are drawn from: (rank desc, id asc) — the id tie-break makes the top-K deterministic — less @@ -3352,16 +3351,11 @@ struct RankedMapRows } }; -// C1-b: under in=DIR's stub (`stubbed`) the map prints no symbol row, so every step that exists only to ORDER rows nobody -// prints is skipped — the radix sort over every symbol among them — and the order is empty. -inline RankedMapRows rankMapRows( const IngestResult& ing, const std::vector<float>& rank, const MapAnnotations& ann, std::size_t keep, - bool stubbed ) +// Not run under in=DIR's stub (planMap): the stub prints no symbol row, so the radix sort over every symbol would order rows +// nobody prints, and the stub's order stays empty. +inline RankedMapRows rankMapRows( const IngestResult& ing, const std::vector<float>& rank, const MapAnnotations& ann, std::size_t keep ) { RankedMapRows ranked; - if( stubbed ) - { - return ranked; - } ranked.order.resize( ing.symbols.size() ); for( NodeId i = 0; i < ranked.order.size(); ++i ) { @@ -3397,20 +3391,30 @@ enum class MapEmitOrder : std::uint8_t // T3 note: the decision keys off the MAP's own estimate, NOT the payload — the fill-order heuristic reasons about the map that // gets reordered; the appended <bodies>/<sigs>/<src> blocks are emitted after and cannot be reordered, so they must not shift // the map's primacy/recency decision. -inline MapEmitOrder decideMapEmitOrder( bool stable, bool mostImportantLast, bool autoOrder, std::size_t mapEstTokens ) noexcept +// The caller's order flags, as asked; decideMapEmitOrder turns them into the one MapEmitOrder everything downstream reads. +struct MapOrderRequest +{ + bool stable = false; // --stable + bool mostImportantLast = false; // --most-important-last + bool autoOrder = false; // T3: the caller opted into the fill-aware flip +}; + +inline MapEmitOrder decideMapEmitOrder( const MapOrderRequest& asked, std::size_t mapEstTokens ) noexcept { - if( stable ) + if( asked.stable ) { return MapEmitOrder::Stable; } - if( mostImportantLast ) + if( asked.mostImportantLast ) { return MapEmitOrder::ImportantLast; } - return ( autoOrder && mapEstTokens > kFillOrderThreshold ) ? MapEmitOrder::ImportantLastAuto : MapEmitOrder::ImportantFirst; + return ( asked.autoOrder && mapEstTokens > kFillOrderThreshold ) ? MapEmitOrder::ImportantLastAuto : MapEmitOrder::ImportantFirst; } -// What each emit order means downstream, as data: its order= spelling and whether the rank order is REVERSED (important-last). +// What each emit order means downstream, as data: its order= spelling, whether the rank order is REVERSED (important-last), +// and whether the map is --stable's byte-stable PREFIX — path/id order, no k= on a row, lens= in place of est_tokens= on <r>, +// and the volatile stats moved to a trailing comment. Every one of those choices reads this trait, never the --stable flag. // order= marker: T3's auto-flip must be OBSERVABLE, not a silent behaviour change — "important-last(auto:fill)" is distinct // from the explicit "important-last" so a reader (or a diff) can tell the ordering was the fill-aware heuristic, not a // requested flag. @@ -3418,17 +3422,20 @@ struct MapEmitOrderTraits { const char* orderAttr; bool importantLast; -}; -inline constexpr MapEmitOrderTraits kMapEmitOrderTraits[] = { - { "important-first", false }, // ImportantFirst - { "stable", false }, // Stable - { "important-last", true }, // ImportantLast - { "important-last(auto:fill)", true }, // ImportantLastAuto + bool stablePrefix; }; -inline const MapEmitOrderTraits& traitsOf( MapEmitOrder emitOrder ) noexcept +// A switch with no default: -Werror=switch makes a new MapEmitOrder a compile error until it has its traits here. +inline MapEmitOrderTraits emitOrderTraits( MapEmitOrder emitOrder ) noexcept { - return kMapEmitOrderTraits[ std::size_t( emitOrder ) ]; + switch( emitOrder ) + { + case MapEmitOrder::ImportantFirst: return { .orderAttr = "important-first", .importantLast = false, .stablePrefix = false }; + case MapEmitOrder::Stable: return { .orderAttr = "stable", .importantLast = false, .stablePrefix = true }; + case MapEmitOrder::ImportantLast: return { .orderAttr = "important-last", .importantLast = true, .stablePrefix = false }; + case MapEmitOrder::ImportantLastAuto: return { .orderAttr = "important-last(auto:fill)", .importantLast = true, .stablePrefix = false }; + } + UNREACHABLE( "a MapEmitOrder outside its four enumerators" ); } // Puts the rank-ordered file groups in the emit order: --stable sorts files by path and rows by symbol id (== file+line @@ -3436,7 +3443,8 @@ inline const MapEmitOrderTraits& traitsOf( MapEmitOrder emitOrder ) noexcept inline void putMapGroupsInEmitOrder( const IngestResult& ing, MapEmitOrder emitOrder, std::vector<std::vector<NodeId>>& buckets, std::vector<std::uint32_t>& fileOrder ) { - if( emitOrder == MapEmitOrder::Stable ) + const MapEmitOrderTraits traits = emitOrderTraits( emitOrder ); + if( traits.stablePrefix ) { std::sort( fileOrder.begin(), fileOrder.end(), [ & ]( std::uint32_t a, std::uint32_t b ) { return ing.files[ a ] < ing.files[ b ]; } ); for( std::vector<NodeId>& b : buckets ) @@ -3444,7 +3452,7 @@ inline void putMapGroupsInEmitOrder( const IngestResult& ing, MapEmitOrder emitO std::sort( b.begin(), b.end() ); } } - else if( traitsOf( emitOrder ).importantLast ) + else if( traits.importantLast ) { std::reverse( fileOrder.begin(), fileOrder.end() ); for( std::vector<NodeId>& b : buckets ) @@ -3456,7 +3464,8 @@ inline void putMapGroupsInEmitOrder( const IngestResult& ing, MapEmitOrder emitO // The printed rows grouped by file. Files are ordered by their best (first-seen) rank, and two row sets are decided over that // rank-ordered grouping BEFORE it is put in the emit order: MAP-STEM's one reserved stem-namesake row per shown file (added -// to the buckets, after the kept rows) and the D7 inventory over the files the kept rows did NOT reach. Empty under the stub. +// to the buckets, after the kept rows) and the D7 inventory over the files the kept rows did NOT reach. Not run under the stub +// (planMap), whose groups stay empty: no files-sized bucket allocation, no fill loop. struct MapFileGroups { std::vector<std::vector<NodeId>> buckets; // per file id: its printed rows, in emit order @@ -3466,15 +3475,10 @@ struct MapFileGroups }; template <class PathRel> -inline MapFileGroups groupMapRowsByFile( const IngestResult& ing, const MapAnnotations& ann, std::span<const NodeId> kept, bool stubbed, - MapEmitOrder emitOrder, const std::vector<std::uint32_t>& outOff, - const std::vector<NodeId>& outTargets, const PathRel& pathRel ) +inline MapFileGroups groupMapRowsByFile( const IngestResult& ing, const MapAnnotations& ann, std::span<const NodeId> kept, MapEmitOrder emitOrder, + const std::vector<std::uint32_t>& outOff, const std::vector<NodeId>& outTargets, const PathRel& pathRel ) { MapFileGroups groups; - if( stubbed ) - { - return groups; // C1-b: no files-sized bucket allocation, no fill loop - } groups.buckets.resize( ing.files.size() ); std::vector<char> shownFile( ing.files.size(), 0 ); // exactly the printed <f> groups for( const NodeId id : kept ) @@ -3550,6 +3554,63 @@ inline MapHonestyGauges countMapHonestyGauges( const IngestResult& ing, const Ma .nestRefusedFiles = ing.crawlSkips.nestRefusedFiles }; } +// Whether in=DIR's stub (MapAnnotations::stubSymbols) replaces the symbol rows. The XML map honours it; the JSON map has no +// stub spelling and always prints its rows. Named once, at the planMap call, so neither dialect re-reads the flag. +enum class MapStubPolicy : std::uint8_t +{ + HonourAnnotation, + AlwaysPrintRows, +}; + +// WHAT a map prints, decided once for both dialects (planMap): the row cap, the rank order, the byte model, the emit order, +// the file groups, the honesty gauges and the shown= count. Each dialect then only spells the plan. +struct MapPlan +{ + bool stubbed = false; // C1-b: in=DIR's stub prints no symbol row (MapStubPolicy) + std::size_t symbolCount = 0; // symbols=: the symbols the map ranks (mapSymbolCount), counted once per map + std::size_t keep = 0; // the top-K cut; under the stub, the would_show= it would have printed + RankedMapRows ranked; // empty under the stub + TokenEstimate mapEst; // the byte MODEL: the T3 order oracle and the bytes/token rate (§H7) + MapEmitOrder emitOrder = MapEmitOrder::ImportantFirst; + MapFileGroups groups; // empty under the stub + MapHonestyGauges gauges; + std::size_t shown = 0; // shown=: the kept rows plus the stem rows; 0 under the stub + + // the rows inside the top-K cut (none under the stub) + std::span<const NodeId> kept() const noexcept { return ranked.kept( keep ); } +}; + +template <class PathRel> +inline MapPlan planMap( const IngestResult& ing, const std::vector<float>& rank, const std::vector<std::uint32_t>& outOff, const std::vector<NodeId>& outTargets, + const MapAnnotations& ann, int topK, const MapOrderRequest& asked, const MapResolverCounters& counters, MapStubPolicy stubPolicy, + const PathRel& pathRel ) +{ + MapPlan plan; + plan.stubbed = stubPolicy == MapStubPolicy::HonourAnnotation && ann.stubSymbols; + plan.symbolCount = mapSymbolCount( ing ); + plan.keep = mapKeepCount( plan.symbolCount, topK ); + if( !plan.stubbed ) + { + plan.ranked = rankMapRows( ing, rank, ann, plan.keep ); + } + // T1/§H7: the byte MODEL. It decides the T3 emit order (which has to be decided before any byte exists — see §H7 at + // estimateTokens) and supplies the language-weighted bytes/token RATE, the half of it that is actually measured. It no + // longer REPORTS the size: each dialect measures est_tokens from its emitted bytes, because a model of the symbol set cannot + // see --metrics decoration or an appended payload. C1-b: under the stub the estimate is taken over no rows. + plan.mapEst = estimateTokens( ing, plan.ranked.order, plan.kept().size(), outOff, outTargets ); + plan.emitOrder = decideMapEmitOrder( asked, plan.mapEst.tokens ); + ASSUME( emitOrderTraits( plan.emitOrder ).stablePrefix == asked.stable, "decideMapEmitOrder returns Stable exactly when --stable was asked" ); + if( !plan.stubbed ) + { + plan.groups = groupMapRowsByFile( ing, ann, plan.kept(), plan.emitOrder, outOff, outTargets, pathRel ); + } + plan.gauges = countMapHonestyGauges( ing, counters ); + plan.shown = plan.stubbed ? 0 : plan.keep + plan.groups.stemPick.rows.size(); + ASSUME( !plan.stubbed || ( plan.kept().empty() && plan.groups.fileOrder.empty() && plan.groups.inventory.entries.empty() ), + "the stub ranks and groups no row, so no kept-row legend clause and no <f> group can fire under it" ); + return plan; +} + // The per-symbol facts a map row may print, gathered once from the emitter's parameters. Read-only; a nullptr source means // that attribute is never printed. struct MapRowSources @@ -3562,8 +3623,8 @@ struct MapRowSources const std::vector<std::uint32_t>* ambOut; const std::vector<std::uint32_t>* locPinOut; const SparseLabels* bind; - bool stable; // --stable: no k= (PageRank is globally volatile) - bool metrics; // --metrics: the descriptive Q-compute attributes + MapEmitOrder emitOrder; // k= is absent on --stable's byte-stable prefix (emitOrderTraits().stablePrefix) + bool metrics; // --metrics: the descriptive Q-compute attributes const std::vector<std::uint32_t>* fanIn; const std::vector<std::uint32_t>* cbo; const std::vector<std::uint8_t>* tested; @@ -3829,20 +3890,35 @@ inline std::size_t scipPinnedEdgeCount( const std::vector<std::uint8_t>* outProv return outProv ? std::size_t( std::count( outProv->begin(), outProv->end(), std::uint8_t( 1 ) ) ) : 0; } -// The header gauges after the parse-honesty run: what the run covered and what it left out. Each is absent unless its fact -// holds, so a default run over a tree with nothing to disclose stays byte-identical. Composed once per map. -inline std::string mapCoverageAttrs( const IngestResult& ing, const std::vector<std::uint8_t>* outProv, const MapAnnotations& ann ) +// What the run covered and what it left out, as the counts both dialects' headers state. Every one is ABSENT at 0 in both +// spellings, so a default run over a tree with nothing to disclose stays byte-identical; each count's presence rule is decided +// here, once, and the renderers only test > 0. +struct MapCoverageFacts +{ + std::size_t scipPinnedEdges = 0; // precise=: the out-edges a SCIP overlay pinned (scipPinnedEdgeCount) + std::size_t multiRootCount = 0; // roots=: the workspace's roots — 0 on a single root (A13: only N≥2 is stated) + std::size_t skippedOversize = 0; // skipped_oversize=: files the crawl dropped for a per-file size ceiling (§P0.5d) +}; + +inline MapCoverageFacts mapCoverageFacts( const IngestResult& ing, const std::vector<std::uint8_t>* outProv ) noexcept +{ + return MapCoverageFacts{ .scipPinnedEdges = scipPinnedEdgeCount( outProv ), + .multiRootCount = ing.rootLabels.size() >= 2 ? ing.rootLabels.size() : 0, + .skippedOversize = ing.skippedOversize.size() }; +} + +// The XML header's coverage attributes after the parse-honesty gauges, composed once per map. +inline std::string renderMapCoverageAttrs( const IngestResult& ing, const MapCoverageFacts& c, const MapAnnotations& ann ) { std::string attrs; - if( const std::size_t precise = scipPinnedEdgeCount( outProv ); precise > 0 ) + if( c.scipPinnedEdges > 0 ) { - attrs += " precise=" + std::to_string( precise ); // only when a SCIP overlay pinned something + attrs += " precise=" + std::to_string( c.scipPinnedEdges ); // only when a SCIP overlay pinned something } - // Multi-root workspace (A13): `roots=N` joins the header gauges and a `<root label= p=/>` prologue opens <r> — ONLY when - // N≥2 (single-root output byte-unchanged). - if( ing.rootLabels.size() >= 2 ) + // Multi-root workspace (A13): `roots=N` joins the header gauges and a `<root label= p=/>` prologue opens <r>. + if( c.multiRootCount > 0 ) { - attrs += " roots=" + std::to_string( ing.rootLabels.size() ); + attrs += " roots=" + std::to_string( c.multiRootCount ); } // D6: --map-diff's teleport-seed file count, ONLY when the caller passes changedCount (nullptr for every non-map-diff // caller ⇒ zero token cost, byte-identical golden map). A clean tree reports "changed=0" so the caller can see the @@ -3855,14 +3931,21 @@ inline std::string mapCoverageAttrs( const IngestResult& ing, const std::vector< // §P0.5d: how many otherwise-indexable files the crawl dropped for exceeding a per-file size ceiling — --max-file-size, or // (§B13.1) the .json lane's fixed 256 KB config ceiling that --max-file-size does not raise. `--max-file-size=8K` dropped // ~296 of ~759 files on this repo and files= reported the survivors as if they WERE the corpus. - if( !ing.skippedOversize.empty() ) + if( c.skippedOversize > 0 ) { - attrs += " skipped_oversize=" + std::to_string( ing.skippedOversize.size() ); + attrs += " skipped_oversize=" + std::to_string( c.skippedOversize ); } attrs += buildMemoryStopAttr( ing, false ) + buildMemoryPeakAttr( ing, false ); // #350, empty unless the memory guard stopped the ingest or the peak passed the limit attrs += buildUnindexedAttr( ing.crawlSkips ); // §L1: the LANGUAGES this build could not read at all attrs += buildIgnoredAttr( ing.crawlSkips ); // §N6-C, empty unless the ignore rules cut something attrs += buildEscapedRootAttr( ing.crawlSkips ); // §SEC1, empty unless a symlink left the root + return attrs; +} + +// The XML header's budget attributes, right after the coverage ones: --max-tokens' asked count and the byte ceiling it became. +inline std::string mapFitAttrs( const MapAnnotations& ann ) +{ + std::string attrs; // §B13.4: --max-tokens=N asked for a TOKEN count and got a BYTE ceiling. Both numbers, on the map that was shaped by them, // so the ~10% the headroom leaves unused is a disclosed fact rather than a silent one. §F5: over_ceiling=1 rides the same // attr — a cap that can be overshot is not a cap, so where the map's fixed floor cannot fit inside fit_bytes the map states @@ -3888,13 +3971,10 @@ inline std::string mapCoverageAttrs( const IngestResult& ing, const std::vector< // unterminated comment). Composed on std::string, the margin question disappears. struct MapStatsFacts { - std::size_t files; - std::size_t symbols; // the symbols the map ranks - std::size_t edges; - std::size_t shown; // C1-b: 0 under the stub, which prints no row - const MapHonestyGauges& gauges; - std::string_view coverageAttrs; - const char* orderAttr; + const MapPlan& plan; // symbols=, shown=, the honesty gauges and order= + std::size_t files; + std::size_t edges; + std::string_view coverageAttrs; // renderMapCoverageAttrs + mapFitAttrs }; inline std::string renderMapStats( const MapStatsFacts& f, std::size_t estTokens, bool estModelled ) @@ -3906,28 +3986,29 @@ inline std::string renderMapStats( const MapStatsFacts& f, std::size_t estTokens out += key; out += std::to_string( value ); } }; + const MapHonestyGauges& g = f.plan.gauges; std::string stats = "<!-- files="; stats += std::to_string( f.files ); - stats += " symbols="; stats += std::to_string( f.symbols ); + stats += " symbols="; stats += std::to_string( f.plan.symbolCount ); stats += " edges="; stats += std::to_string( f.edges ); - stats += " shown="; stats += std::to_string( f.shown ); + stats += " shown="; stats += std::to_string( f.plan.shown ); stats += " est_tokens="; stats += std::to_string( estTokens ); if( estModelled ) { stats += " est_measured=0"; // the number beside it is the model (MapEstimate); absent ⇒ measured } - stats += " ambiguous="; stats += std::to_string( f.gauges.ambiguous ); - stats += " unresolved="; stats += std::to_string( f.gauges.unresolved ); - gauge( stats, " locality_pinned=", f.gauges.localityPinned ); - gauge( stats, " external=", f.gauges.external ); // Phase 5 - gauge( stats, " declined=", f.gauges.declined ); // tier-3 declines, after external= so no adjacency moves + stats += " ambiguous="; stats += std::to_string( g.ambiguous ); + stats += " unresolved="; stats += std::to_string( g.unresolved ); + gauge( stats, " locality_pinned=", g.localityPinned ); + gauge( stats, " external=", g.external ); // Phase 5 + gauge( stats, " declined=", g.declined ); // tier-3 declines, after external= so no adjacency moves // The parse-honesty gauges follow the call-resolution family (ambiguous= .. declined=), in this order, so declined= stays // adjacent to external= and the resolver's gauges read as one contiguous run. - gauge( stats, " extent_suspect_syms=", f.gauges.extentSuspectSyms ); - gauge( stats, " macro_blanked_files=", f.gauges.macroBlankedFiles ); - gauge( stats, " nest_refused=", f.gauges.nestRefusedFiles ); // #157: last of the parse-honesty gauges + gauge( stats, " extent_suspect_syms=", g.extentSuspectSyms ); + gauge( stats, " macro_blanked_files=", g.macroBlankedFiles ); + gauge( stats, " nest_refused=", g.nestRefusedFiles ); // #157: last of the parse-honesty gauges stats += f.coverageAttrs; - stats += " order="; stats += f.orderAttr; + stats += " order="; stats += emitOrderTraits( f.plan.emitOrder ).orderAttr; stats += " -->"; return stats; } @@ -3964,14 +4045,13 @@ struct MapRootFacts { const MapAnnotations& ann; std::string_view rootArg; - bool stable; - const DataSectionsCut& dataSecCut; - std::size_t stemCut; + const MapPlan& plan; // the byte-stable prefix (emit order), data_sections_cut= and stem_cut= }; inline std::string renderMapRootTag( const MapRootFacts& r, std::size_t estTokens, bool estModelled, std::vector<char>& esc ) { - const MapAnnotations& ann = r.ann; + const MapAnnotations& ann = r.ann; + const bool stablePrefix = emitOrderTraits( r.plan.emitOrder ).stablePrefix; // r26-stamp Task A: ` at="..."` ONLY when the caller passed a non-empty stamp (--map-diff); every other caller passes // nullptr, so the hot default-map path pays a pointer compare, not a git call. at= stays FIRST — the `<r at="<sha>` byte // sequence gitstampcheck.sh pins is unchanged. @@ -3990,8 +4070,8 @@ inline std::string renderMapRootTag( const MapRootFacts& r, std::size_t estToken // budget-aware caller most needs was unreachable from the comment alone. The SAME `estTokens` value (one estimator). // --stable omits it on the precedent of the k= rank attribute: --stable buys a byte-stable PREFIX, the root element is // that prefix, and est_tokens is globally volatile. - if( !r.stable ) { char estAttr[ 40 ]; rw::formatTo( estAttr, sizeof( estAttr ), " est_tokens=\"{}\"", estTokens ); h += estAttr; } - if( !r.stable && estModelled ) { h += " est_measured=\"0\""; } // beside the number it qualifies (MapEstimate) + if( !stablePrefix ) { char estAttr[ 40 ]; rw::formatTo( estAttr, sizeof( estAttr ), " est_tokens=\"{}\"", estTokens ); h += estAttr; } + if( !stablePrefix && estModelled ) { h += " est_measured=\"0\""; } // beside the number it qualifies (MapEstimate) // W2-F: LAST on the root, after est_tokens — the same placement rule counts_floor= follows, so no existing // attribute-ADJACENCY assertion in test/ can break on it. NOT suppressed under --stable: the iteration count is a property // of the CORPUS and the ranker, not of the run's size, and a byte-stable prefix that hides "this ranking is unfinished" @@ -4001,20 +4081,20 @@ inline std::string renderMapRootTag( const MapRootFacts& r, std::size_t estToken // `analyze` call gets) saw rows with no rank attribute and nothing saying the score exists elsewhere. lens= names what is // missing, so "absent" reads as "not served here", never as "not computed". Gate: test/mcpattrparitycheck.sh, whose lens= // arm also fails on a stale name. - if( r.stable ) { h += " lens=\"k,est_tokens\""; } + if( stablePrefix ) { h += " lens=\"k,est_tokens\""; } // L3 follow-up (CodeRabbit 4053600616): TRULY last, past every pre-existing attribute — same placement rule as lens= just // above, so no attribute-adjacency assertion in test/ can break on it. if( ann.notesDegraded ) { h += notes::kNotesDegradedAttr; } h += renderHistoryUnread( DiscloseAs::XmlAttrs ); // K51: absent unless the amp=/churn= walk could not be read // The code-first pick's swaps, last of all (the same placement rule as the two above): absent when nothing was swapped. - if( r.dataSecCut.cut > 0 ) + if( const DataSectionsCut& cut = r.plan.ranked.dataSecCut; cut.cut > 0 ) { - h += " data_sections_cut=\""; h += std::to_string( r.dataSecCut.cut ); h += "\""; - h += nextAttrXml( dataSectionsNext( r.dataSecCut ) ); + h += " data_sections_cut=\""; h += std::to_string( cut.cut ); h += "\""; + h += nextAttrXml( dataSectionsNext( cut ) ); } - if( r.stemCut > 0 ) + if( const std::size_t stemCut = r.plan.groups.stemPick.cut; stemCut > 0 ) { - h += " stem_cut=\""; h += std::to_string( r.stemCut ); h += "\""; // MAP-STEM: absent unless a --max-tokens fit left stem rows out + h += " stem_cut=\""; h += std::to_string( stemCut ); h += "\""; // MAP-STEM: absent unless a --max-tokens fit left stem rows out } h += ">"; // K51: history_unread='s definition rides the leading legend (HISTORY-UNREAD-LEGEND), not behind this tag return h; @@ -4026,7 +4106,7 @@ inline std::string renderMapRootTag( const MapRootFacts& r, std::size_t estToken // the disclosed locality pin (Phase 4). The cursor is the OUT POINTER, never a would-have-written length: lpin= is written AT // the offset the first write ended, so a count an implementation computed rather than wrote would place it inside the // half-written amb= attribute. Same defect class as BoundedAttrRun below. -inline std::string rowGuessAttrs( const MapRowSources& src, NodeId id ) +inline std::string rowResolverGuessAttrs( const MapRowSources& src, NodeId id ) { char ambs[ 48 ]; ambs[ 0 ] = '\0'; char* ap = ambs; @@ -4044,12 +4124,12 @@ inline std::string rowGuessAttrs( const MapRowSources& src, NodeId id ) return ambs; } -// PageRank k= is GLOBALLY volatile (any edit perturbs every rank) → omitted in --stable mode so the prefix stays byte-identical -// for unedited files (provider KV-cache hits). Default keeps k=. +// PageRank k= is GLOBALLY volatile (any edit perturbs every rank) → omitted on --stable's byte-stable prefix so the prefix stays +// byte-identical for unedited files (provider KV-cache hits). Default keeps k=. inline std::string rowRankAttr( const MapRowSources& src, NodeId id ) { char kbuf[ 24 ]; kbuf[ 0 ] = '\0'; - if( !src.stable ) + if( !emitOrderTraits( src.emitOrder ).stablePrefix ) { rw::formatTo( kbuf, sizeof( kbuf ), " k=\"{:.4f}\"", double( src.rank[ id ] ) ); } @@ -4163,27 +4243,24 @@ inline void appendQMetricAttrs( BoundedAttrRun& run, const Symbol& s, NodeId id, } } -// The row's descriptive attributes as ONE run after its identity attributes: under --metrics with fan-in, in=/out=/cx=/ccx=, -// role="hub" at fan-in ≥ 8 and the Q-compute run first; then amb=/lpin= and k=. Composed in one fixed buffer, as always, so a -// run past its width truncates at the byte it always did. -inline std::string rowDescriptiveAttrs( const Symbol& s, NodeId id, const MapRowSources& src ) +// The row's --metrics run (only with fan-in): in=/out=/cx=/ccx=, role="hub" at fan-in ≥ 8, then the Q-compute run. +// EQUIVALENCE (GE-SERIALIZE round 2): this run, amb=/lpin= and k= used to share one attr[352] buffer, so a run past its width +// would have truncated across all three. None ever did: the widest is 26 B of literal + 4 × 10 digits + 11 B role + the +// BoundedAttrRun's 191 + amb=/lpin=' 35 + k=' 23 = 326 B < 351 (test/fixedbufsweep.sh's attr row), so writing the three as +// separate writes is byte-identical — and this buffer alone now has 83 B of headroom. +inline std::string rowMetricsAttrs( const Symbol& s, NodeId id, const MapRowSources& src ) { - const std::uint32_t outDegree = src.outOff[ id + 1 ] - src.outOff[ id ]; - const std::string guesses = rowGuessAttrs( src, id ); - const std::string rankAttr = rowRankAttr( src, id ); - char attr[ 352 ]; - if( src.metrics && src.fanIn ) + if( !src.metrics || !src.fanIn ) { - BoundedAttrRun qmetrics; - appendQMetricAttrs( qmetrics, s, id, src ); - const std::uint32_t in = ( id < src.fanIn->size() ) ? ( *src.fanIn )[ id ] : 0u; - rw::formatTo( attr, sizeof( attr ), " in=\"{}\" out=\"{}\" cx=\"{}\" ccx=\"{}\"{}{}{}{}", - in, outDegree, s.cx, s.ccx, ( in >= 8 ? " role=\"hub\"" : "" ), qmetrics.c_str(), guesses, rankAttr ); - } - else - { - rw::formatTo( attr, sizeof( attr ), "{}{}", guesses, rankAttr ); + return {}; } + BoundedAttrRun qmetrics; + appendQMetricAttrs( qmetrics, s, id, src ); + const std::uint32_t in = ( id < src.fanIn->size() ) ? ( *src.fanIn )[ id ] : 0u; + const std::uint32_t outDegree = src.outOff[ id + 1 ] - src.outOff[ id ]; + char attr[ 352 ]; + rw::formatTo( attr, sizeof( attr ), " in=\"{}\" out=\"{}\" cx=\"{}\" ccx=\"{}\"{}{}", + in, outDegree, s.cx, s.ccx, ( in >= 8 ? " role=\"hub\"" : "" ), qmetrics.c_str() ); return attr; } @@ -4228,7 +4305,9 @@ inline void writeMapSymbolRow( XmlWriter& w, const IngestResult& ing, const Over { w.write( " bind=\"" ); w.write( escapeXml( label, esc ) ); w.write( "\"" ); } - w.write( rowDescriptiveAttrs( s, id, src ) ); + w.write( rowMetricsAttrs( s, id, src ) ); // --metrics: in=/out=/cx=/ccx=/role= and the Q-compute run + w.write( rowResolverGuessAttrs( src, id ) ); // amb= / lpin=, each absent at 0 + w.write( rowRankAttr( src, id ) ); // k=, absent on --stable's byte-stable prefix // EXTENT HONESTY (kExtentSuspectRowLegend): the containment checks this row's extent/scope/kind failed. After k= so every // pre-existing adjacency holds; absent when every check held (clean corpora unchanged). if( s.extentSuspect != 0 ) @@ -4297,17 +4376,19 @@ inline void writeSymbolMapStub( XmlWriter& w, std::size_t keep, std::string_view // <r>'s children, as ONE renderer serialize()'s measured path and its degrade path both call: the multi-root prologue, F3's // recent files (rank_by=churn-decay's file-level answer, before the symbol map), the stub or the <f> groups, and the D7 // inventory tier. The inventory rides the LOW-importance end of the document — after the rows, or before them when the map -// is emitted important-last, so the top-ranked rows keep the end position that order promises. +// is emitted important-last, so the top-ranked rows keep the end position that order promises. That placement is the XML +// document's own: <r>'s children are a sequence a reader meets in order, while the JSON map's "inv" is a key of one object, +// where a position carries nothing — so it stays here rather than in MapPlan (moving it would also move JSON bytes). template <class PathRel> -inline void writeMapChildren( XmlWriter& w, const IngestResult& ing, const MapAnnotations& ann, std::size_t keep, const MapFileGroups& groups, - MapEmitOrder emitOrder, const MapRowSources& src, const PathRel& pathRel, std::vector<char>& esc, - std::vector<std::uint32_t>& scratch ) +inline void writeMapChildren( XmlWriter& w, const IngestResult& ing, const MapAnnotations& ann, const MapPlan& plan, const MapRowSources& src, + const PathRel& pathRel, std::vector<char>& esc, std::vector<std::uint32_t>& scratch ) { + const MapFileGroups& groups = plan.groups; writeRootLabelRows( w, ing, esc ); // A13: the multi-root prologue writeRecentRows( w, ann, pathRel, esc ); - if( ann.stubSymbols ) + if( plan.stubbed ) { - writeSymbolMapStub( w, keep, ann.stubNext ); + writeSymbolMapStub( w, plan.keep, ann.stubNext ); } const auto writeInventory = [ & ]() { @@ -4316,7 +4397,7 @@ inline void writeMapChildren( XmlWriter& w, const IngestResult& ing, const MapAn writeMapInventoryXml( w, ing, groups.inventory, pathRel, src.outOff, src.outTargets, src.outProv, src.outNameOnly, esc, scratch ); } }; - const bool inventoryFirst = traitsOf( emitOrder ).importantLast; // --stable's path order wins, as it does for the rows + const bool inventoryFirst = emitOrderTraits( plan.emitOrder ).importantLast; // --stable's path order wins, as it does for the rows if( inventoryFirst ) { writeInventory(); @@ -4444,41 +4525,29 @@ inline void serialize( std::FILE* out, const IngestResult& ing, const std::vecto return rootArg.empty() ? std::string_view( ing.files[ fileId ] ) : rw::sarif::rootRelativeUri( ing.files[ fileId ], rootPrefix ); }; - // ── WHICH rows, in WHICH order ────────────────────────────────────────────────────────────────────────────────── - const bool stubbed = ann.stubSymbols; // C1-b: in=DIR's stub prints no symbol row - const std::size_t keep = mapKeepCount( ing, topK ); - const RankedMapRows ranked = rankMapRows( ing, rank, ann, keep, stubbed ); - const std::span<const NodeId> kept = ranked.kept( keep ); - // T1/§H7: the byte MODEL. It decides the T3 emit order (which has to be decided before any byte exists — see §H7 at - // estimateTokens) and supplies the language-weighted bytes/token RATE, the half of it that is actually measured. It no - // longer REPORTS the size: est_tokens is computed from the document's emitted bytes in PHASE 2 below, because a model of - // the symbol set cannot see --metrics decoration or an appended payload. C1-b: under the stub the estimate is taken over - // no rows, since the document contains none. - const TokenEstimate mapEst = estimateTokens( ing, ranked.order, kept.size(), outOff, outTargets ); - const MapEmitOrder emitOrder = decideMapEmitOrder( stable, mostImportantLast, autoOrder, mapEst.tokens ); - const MapFileGroups groups = groupMapRowsByFile( ing, ann, kept, stubbed, emitOrder, outOff, outTargets, pathRel ); - const MapHonestyGauges gauges = countMapHonestyGauges( ing, MapResolverCounters{ .ambOut = ambOut, .unresolvedOut = unresolvedOut, .locPinOut = locPinOut, - .declinedOut = declinedOut, .externalCalls = externalCalls, - .gateDeclinedCalls = gateDeclinedCalls, - .stdMemberDeclined = stdMemberDeclinedCalls, - .inertDeclinedCalls = inertDeclinedCalls } ); - ASSUME( !stubbed || ( kept.empty() && groups.fileOrder.empty() && groups.inventory.entries.empty() ), - "the stub ranks and groups no row, so no kept-row legend clause and no <f> group can fire under it" ); + // ── WHICH rows, in WHICH order: the plan both dialects share; the XML map honours in=DIR's stub ───────────────────── + const MapPlan plan = planMap( ing, rank, outOff, outTargets, ann, topK, + MapOrderRequest{ .stable = stable, .mostImportantLast = mostImportantLast, .autoOrder = autoOrder }, + MapResolverCounters{ .ambOut = ambOut, .unresolvedOut = unresolvedOut, .locPinOut = locPinOut, + .declinedOut = declinedOut, .externalCalls = externalCalls, + .gateDeclinedCalls = gateDeclinedCalls, .stdMemberDeclined = stdMemberDeclinedCalls, + .inertDeclinedCalls = inertDeclinedCalls }, + MapStubPolicy::HonourAnnotation, pathRel ); std::vector<char> esc; // ── the legend, clause group by clause group, in the order the reader meets them ────────────────────────────── std::string legend = mapOpeningLegend( outProv != nullptr ); legend += moduleScopeLegend( ing ); - legend += keptImplEdgeLegend( outOff, outProv, kept, groups.inventory.entries ); + legend += keptImplEdgeLegend( outOff, outProv, plan.kept(), plan.groups.inventory.entries ); legend += typeKindLegend( ing ); - legend += gaugeLegend( gauges, kParseHonestyClauses ); + legend += gaugeLegend( plan.gauges, kParseHonestyClauses ); legend += runAnnotationLegend( ing, ann, rootArg, metrics ); - legend += rowSelectionLegend( ranked.dataSecCut, groups ); + legend += rowSelectionLegend( plan.ranked.dataSecCut, plan.groups ); // W2-F: the pr_iters= / pr_converged= definition, charged to the maps that carry the attributes — empty for a lexical or // HITS ordering, and the prose half only on the map whose iteration stopped short. legend += renderDisclosure( ann.prDisclosure, DiscloseAs::LegendComment ); - legend += gaugeLegend( gauges, kDeclineClauses ); - legend += keptNameEdgeLegend( outOff, outNameOnly, kept, ann.viaLegendStripped ); + legend += gaugeLegend( plan.gauges, kDeclineClauses ); + legend += keptNameEdgeLegend( outOff, outNameOnly, plan.kept(), ann.viaLegendStripped ); // K51: history_unread='s definition, the LAST leading clause, so it stands right before the <r> root it marks and inside the // leading block every reader (and legendcoveragecheck's full rows) meets first; absent unless the amp=/churn= walk was unread. legend += renderHistoryUnread( DiscloseAs::LegendComment ); @@ -4489,12 +4558,10 @@ inline void serialize( std::FILE* out, const IngestResult& ing, const std::vecto // the identical reason. Pure functions of estTokens, the values decided above and the estimate sink's state. // --stable: the volatile counts move to a TRAILING comment (out of the cacheable prefix) — unless the caller asked for the // first-screen placement (§B6 M10, the MCP analyze verb). Exactly one of the two builders emits the stats. - const bool statsTrail = stable && !statsFirstScreen; - const std::string coverageAttrs = mapCoverageAttrs( ing, outProv, ann ); - const MapStatsFacts statsFacts{ .files = ing.files.size(), .symbols = mapSymbolCount( ing ), .edges = outTargets.size(), - .shown = stubbed ? std::size_t( 0 ) : keep + groups.stemPick.rows.size(), - .gauges = gauges, .coverageAttrs = coverageAttrs, .orderAttr = traitsOf( emitOrder ).orderAttr }; - const MapRootFacts rootFacts{ .ann = ann, .rootArg = rootArg, .stable = stable, .dataSecCut = ranked.dataSecCut, .stemCut = groups.stemPick.cut }; + const bool statsTrail = emitOrderTraits( plan.emitOrder ).stablePrefix && !statsFirstScreen; + const std::string coverageAttrs = renderMapCoverageAttrs( ing, mapCoverageFacts( ing, outProv ), ann ) + mapFitAttrs( ann ); + const MapStatsFacts statsFacts{ .plan = plan, .files = ing.files.size(), .edges = outTargets.size(), .coverageAttrs = coverageAttrs }; + const MapRootFacts rootFacts{ .ann = ann, .rootArg = rootArg, .plan = plan }; MapEstimate estimate{ ann.payloadUncharged }; // the est_tokens measurement's DISCLOSE sink — read by the builders const auto buildHead = [ & ]( std::size_t estTokens ) -> std::string { @@ -4521,18 +4588,18 @@ inline void serialize( std::FILE* out, const IngestResult& ing, const std::vecto // measure, decide, then write (the order --recall's emitRecallBudgeted and the --for lens's pre-rendered sigs block // already impose on themselves). const MapRowSources rowSources{ .rank = rank, .outOff = outOff, .outTargets = outTargets, .outProv = outProv, .outNameOnly = outNameOnly, - .ambOut = ambOut, .locPinOut = locPinOut, .bind = bind, .stable = stable, .metrics = metrics, + .ambOut = ambOut, .locPinOut = locPinOut, .bind = bind, .emitOrder = plan.emitOrder, .metrics = metrics, .fanIn = fanIn, .cbo = cbo, .tested = tested, .lcom4 = lcom4, .amp = amp }; std::vector<std::uint32_t> hedgedScratch; // FE-B: writeMapCalleeRows' reused buffer const auto writeChildren = [ & ]( XmlWriter& w ) { - writeMapChildren( w, ing, ann, keep, groups, emitOrder, rowSources, pathRel, esc, hedgedScratch ); + writeMapChildren( w, ing, ann, plan, rowSources, pathRel, esc, hedgedScratch ); }; // DEGRADE, one path for both failures (a buffer that did not open, or one that opened and then lost a write — by then the // children were already spent into it, so they are rendered again): the head goes out FIRST carrying the MODELLED estimate // (the pre-§H7 number, so no worse than the old behaviour and never a fabricated one), the children stream straight to // `out` behind it, then the trailing summary. The whole map, uncharged. - const std::size_t modelledTokens = mapEst.tokens + extraPayloadTokens; + const std::size_t modelledTokens = plan.mapEst.tokens + extraPayloadTokens; const auto emitModelled = [ & ]() { XmlWriter direct( out ); @@ -4572,7 +4639,7 @@ inline void serialize( std::FILE* out, const IngestResult& ing, const std::vecto return; } const std::string_view childrenStr = children.bytes; // owned by childStream, alive to the end of this function - const SettledHeadTail settled = settleEstTokens( modelledTokens, childrenStr.size(), mapEst.bytesPerToken(), extraPayloadTokens, buildHead, buildTail ); + const SettledHeadTail settled = settleEstTokens( modelledTokens, childrenStr.size(), plan.mapEst.bytesPerToken(), extraPayloadTokens, buildHead, buildTail ); if( outEstTokens ) { *outEstTokens = settled.estTokens; // --token-budget reads THIS value — never a second counter @@ -11496,35 +11563,24 @@ inline void writeJsonQMetrics( JsonWriter& w, const JsonQMetrics& q ) } // The default map's JSON header — the gauge block plus the two prologues that ride on it, in one place so -// "which gauge, in which order, on which condition" is stated once rather than smeared through the emitter. -// The XML sibling states the same set through its `stats` snprintf + the <root> prologue in serialize(). +// "which gauge, in which order, on which condition" is stated once rather than smeared through the emitter. Its counts are the +// plan's and the coverage facts' — the same values the XML header spells (renderMapStats, renderMapCoverageAttrs, +// renderMapRootTag), never a second count. struct JsonMapHeader { - const IngestResult& ing; - std::size_t symbolCount; - std::size_t edgeCount; - std::size_t shownCount; - std::size_t estTokens; - std::size_t ambiguousCount; - std::size_t unresolvedCount; - const char* orderAttr; - const std::vector<std::uint8_t>* outProv; // nullptr ⇒ no precise= (nothing was measured) - const MapAnnotations* ann; // §B1.2: how THIS map was produced — the same at/rank_by/window - // stamp the XML `<r>` element carries. nullptr ⇒ no stamp emitted. - std::string_view rootArg; // R-E: the JSON twin of the XML `<r root="…">` — empty for - // multi-root (its own roots_count/roots table below already - // names every root) or a caller that never passes one. - std::size_t localityPinnedCount = 0; // Phase 4: Σ lpin — "locality_pinned":N, absent when 0 - std::size_t externalCount = 0; // Phase 5: the veto's refusals — "external":N, absent when 0 - std::size_t declinedCount = 0; // tier 3's declines — "declined":N, absent when 0 - std::size_t extentSuspectCount = 0; // extent honesty: "extent_suspect_syms":N, absent when 0 - std::size_t macroBlankedCount = 0; // member-macro re-parse: "macro_blanked_files":N, absent when 0 - std::size_t nestRefusedCount = 0; // #157: "nest_refused":N, the JSON twin of the XML nest_refused=, absent when 0 - bool isEstModelled = false; // MapEstimate: "est_measured":false, absent when measured - DataSectionsCut dataSectionsCut = {}; // the code-first pick's swaps: "data_sections_cut":N + "next", absent at N=0 - std::size_t stemCut = 0; // MAP-STEM: "stem_cut":N, the XML stem_cut=, absent at N=0 - std::string_view memoryPeakJson = {}; // buildMemoryPeakAttr( ing, true ), read ONCE per serializeJson call (the - // peak reading only rises and the seam counts calls); kept last, the struct is filled positionally + const IngestResult& ing; + const MapPlan& plan; // symbols, shown, the honesty gauges, order, data_sections_cut, stem_cut + const MapCoverageFacts& coverage; // precise, skipped_oversize, roots_count + std::size_t edgeCount; + std::size_t estTokens; + bool isEstModelled; // MapEstimate: "est_measured":false, absent when measured + const MapAnnotations& ann; // §B1.2: how THIS map was produced — the same at/rank_by/window stamp the XML `<r>` + // element carries + std::string_view rootArg; // R-E: the JSON twin of the XML `<r root="…">` — empty for multi-root (its own + // roots_count/roots table below already names every root) or a caller that never + // passes one. + std::string_view memoryPeakJson; // buildMemoryPeakAttr( ing, true ), read ONCE per serializeJson call (the peak + // reading only rises and the seam counts calls) }; // §B1.2: the PROVENANCE stamp — the JSON half of the XML `<r at= rank_by= window=>` attributes. Without it @@ -11534,13 +11590,8 @@ struct JsonMapHeader // Same absent-unless-produced rule as the XML: a default map passes no annotations ⇒ zero bytes, byte- // identical output. `changed` (--map-diff) has no arm here on purpose — see the coverage note above // serializeJson: jsonUnsupportedVerb refuses --map-diff before this emitter is ever reached. -inline void writeJsonMapStamp( JsonWriter& w, std::string& esc, const MapAnnotations* ann ) +inline void writeJsonMapStamp( JsonWriter& w, std::string& esc, const MapAnnotations& ann ) { - if( !ann ) - { - return; - } - // §B12.6 (CA4): `at`'s ABSENCE had two meanings inside one dialect. Five JSON emitters (quality-delta, // test-gate, cochange, plan-lanes, the MCP quality_delta twin) write `"at":null` when the root has no // HEAD to anchor to — "we tried, there is nothing" — while this one OMITTED the key in the same state, @@ -11553,32 +11604,32 @@ inline void writeJsonMapStamp( JsonWriter& w, std::string& esc, const MapAnnotat // no churn ranking) emits no key, which is also what the XML does, so the 1:1 attr/key correspondence // holds in every state. The windowless rank_by= stamps (authority/hub/rrf) attempt no anchor and are // deliberately outside the predicate, exactly as they are on the XML side. - const bool didAttemptAtStamp = ( ann->changedCount != nullptr ) || ( ann->churnWindow != nullptr ); + const bool didAttemptAtStamp = ( ann.changedCount != nullptr ) || ( ann.churnWindow != nullptr ); if( didAttemptAtStamp ) { w.write( ",\"at\":" ); - if( ann->atStamp != nullptr && !ann->atStamp->empty() ) + if( ann.atStamp != nullptr && !ann.atStamp->empty() ) { - writeJsonStr( w, *ann->atStamp, esc ); + writeJsonStr( w, *ann.atStamp, esc ); } else { w.write( "null" ); } } - if( ann->churnWindow != nullptr ) + if( ann.churnWindow != nullptr ) { w.write( ",\"rank_by\":" ); // P0-4: which churn ranker — "churn" or "churn-decay" - writeJsonStr( w, ann->churnRankLabel, esc ); + writeJsonStr( w, ann.churnRankLabel, esc ); w.write( ",\"window\":" ); - writeJsonStr( w, *ann->churnWindow, esc ); + writeJsonStr( w, *ann.churnWindow, esc ); } // §B2.1: authority/hub/rrf carry no window, so they stamp rank_by alone — the JSON half of the XML arm // above, symmetric with it, so the two dialects still cannot disagree about how a map was produced. - else if( ann->rankByLabel != nullptr ) + else if( ann.rankByLabel != nullptr ) { w.write( ",\"rank_by\":" ); - writeJsonStr( w, std::string_view( ann->rankByLabel ), esc ); + writeJsonStr( w, std::string_view( ann.rankByLabel ), esc ); } // §C4 — the --max-tokens fit, in the dialect that was missing it. `--max-tokens=N --json` shaped the map and @@ -11595,13 +11646,13 @@ inline void writeJsonMapStamp( JsonWriter& w, std::string& esc, const MapAnnotat // without naming the dialect it was measured against would replace one silence with a false implication. // The XML needs no such key because the XML is the measured dialect. Fixing the SEARCH to measure the // emitted dialect is a main.cpp change and is recorded as a residual, not smuggled in here. - if( ann->maxTokensFit != nullptr ) + if( ann.maxTokensFit != nullptr ) { char fit[ 160 ]; rw::formatTo( fit, sizeof( fit ), ",\"max_tokens\":{},\"fit_bytes\":{},\"fit_measured_in\":\"xml\"{}{}", - ann->maxTokensFit->askedTokens, ann->maxTokensFit->ceilingBytes, - ann->maxTokensFit->isOverCeiling || ann->maxTokensFit->isUnmeasured ? ",\"over_ceiling\":true" : "", - ann->maxTokensFit->isUnmeasured ? ",\"fit_unmeasured\":true" : "" ); + ann.maxTokensFit->askedTokens, ann.maxTokensFit->ceilingBytes, + ann.maxTokensFit->isOverCeiling || ann.maxTokensFit->isUnmeasured ? ",\"over_ceiling\":true" : "", + ann.maxTokensFit->isUnmeasured ? ",\"fit_unmeasured\":true" : "" ); w.write( fit ); } } @@ -11647,55 +11698,56 @@ inline void writeJsonUnindexed( JsonWriter& w, std::string& esc, const CrawlSkip inline void writeJsonMapHeader( JsonWriter& w, std::string& esc, const JsonMapHeader& h ) { + const MapHonestyGauges& g = h.plan.gauges; char hdr[ 256 ]; // the gauge line has 7 size_t fields — wider than the per-symbol scratch rw::formatTo( hdr, sizeof( hdr ), "{{\"files\":{},\"symbols\":{},\"edges\":{},\"shown\":{},\"est_tokens\":{},\"ambiguous\":{},\"unresolved\":{},", - h.ing.files.size(), h.symbolCount, h.edgeCount, h.shownCount, h.estTokens, h.ambiguousCount, h.unresolvedCount ); + h.ing.files.size(), h.plan.symbolCount, h.edgeCount, h.plan.shown, h.estTokens, g.ambiguous, g.unresolved ); w.write( hdr ); if( h.isEstModelled ) { w.write( "\"est_measured\":false," ); // the XML est_measured="0" twin: est_tokens above is the model } // Phase 4: the S6-C locality-pin gauge — same absent-when-zero rule as the XML `locality_pinned=`. - if( h.localityPinnedCount > 0 ) + if( g.localityPinned > 0 ) { - rw::formatTo( hdr, sizeof( hdr ), "\"locality_pinned\":{},", h.localityPinnedCount ); + rw::formatTo( hdr, sizeof( hdr ), "\"locality_pinned\":{},", g.localityPinned ); w.write( hdr ); } // Phase 5: the external-name veto gauge — the JSON twin of the XML `external=`, same absent-when-zero rule. - if( h.externalCount > 0 ) + if( g.external > 0 ) { - rw::formatTo( hdr, sizeof( hdr ), "\"external\":{},", h.externalCount ); + rw::formatTo( hdr, sizeof( hdr ), "\"external\":{},", g.external ); w.write( hdr ); } // tier 3's declines — the JSON twin of the XML `declined=`, same absent-when-zero rule. - if( h.declinedCount > 0 ) + if( g.declined > 0 ) { - rw::formatTo( hdr, sizeof( hdr ), "\"declined\":{},", h.declinedCount ); + rw::formatTo( hdr, sizeof( hdr ), "\"declined\":{},", g.declined ); w.write( hdr ); } // extent honesty: the JSON twin of the XML header's extent_suspect_syms=, same absent-when-zero rule and the // XML header's order (after the call-resolution family, declined included). - if( h.extentSuspectCount > 0 ) + if( g.extentSuspectSyms > 0 ) { - w.write( "\"extent_suspect_syms\":" + std::to_string( h.extentSuspectCount ) + "," ); // composed, not a fixed buffer + w.write( "\"extent_suspect_syms\":" + std::to_string( g.extentSuspectSyms ) + "," ); // composed, not a fixed buffer } // member-macro re-parse: the JSON twin of the XML header's macro_blanked_files=, same absent-when-zero rule. - if( h.macroBlankedCount > 0 ) + if( g.macroBlankedFiles > 0 ) { - w.write( "\"macro_blanked_files\":" + std::to_string( h.macroBlankedCount ) + "," ); + w.write( "\"macro_blanked_files\":" + std::to_string( g.macroBlankedFiles ) + "," ); } // #157: the JSON twin of the XML header's nest_refused=, same absent-when-zero rule. - if( h.nestRefusedCount > 0 ) + if( g.nestRefusedFiles > 0 ) { - w.write( "\"nest_refused\":" + std::to_string( h.nestRefusedCount ) + "," ); + w.write( "\"nest_refused\":" + std::to_string( g.nestRefusedFiles ) + "," ); } // §P0.5d, JSON lane: the size-ceiling disclosure must reach --json consumers too — the XML header // gained skipped_oversize= and a JSON reader (MCP clients most of all) must not be the one audience // still shown the survivors as if they were the corpus. Same absent-when-zero rule as the XML side. - if( !h.ing.skippedOversize.empty() ) + if( h.coverage.skippedOversize > 0 ) { - rw::formatTo( hdr, sizeof( hdr ), "\"skipped_oversize\":{},", h.ing.skippedOversize.size() ); + rw::formatTo( hdr, sizeof( hdr ), "\"skipped_oversize\":{},", h.coverage.skippedOversize ); w.write( hdr ); } w.write( buildMemoryStopAttr( h.ing, true ) ); // #350, JSON lane: empty unless the memory guard stopped the ingest @@ -11711,25 +11763,16 @@ inline void writeJsonMapHeader( JsonWriter& w, std::string& esc, const JsonMapHe } writeJsonUnindexed( w, esc, h.ing.crawlSkips ); // §L1, JSON lane — see its own header - // §A4d: `precise=N` — how many out-edges the SCIP overlay actually pinned. C1 drift fix, the JSON half of - // the XML fix above and by the same argument: this counted every NONZERO provenance value, so an FFI - // binding (2) and now a k-way split arm (3) were both reported as SCIP-precise. Emitted only when the - // count is non-zero (absent ⇒ nothing was pinned, never a fabricated 0 nor a borrowed one). - if( h.outProv ) + // §A4d: `precise=N` — how many out-edges the SCIP overlay actually pinned: the ONE count both dialects state + // (scipPinnedEdgeCount, whose C1 drift note says why it names value 1 alone). Absent at 0 — nothing was pinned, never a + // fabricated 0 nor a borrowed one. + if( h.coverage.scipPinnedEdges > 0 ) { - std::size_t preciseTotal = 0; - for( std::uint8_t v : *h.outProv ) - { - preciseTotal += ( v == 1u ? 1u : 0u ); - } - if( preciseTotal > 0 ) - { - rw::formatTo( hdr, sizeof( hdr ), "\"precise\":{},", preciseTotal ); - w.write( hdr ); - } + rw::formatTo( hdr, sizeof( hdr ), "\"precise\":{},", h.coverage.scipPinnedEdges ); + w.write( hdr ); } w.write( "\"order\":" ); - writeJsonStr( w, h.orderAttr, esc ); + writeJsonStr( w, emitOrderTraits( h.plan.emitOrder ).orderAttr, esc ); // R-E (2026-08-17 harvest): the JSON twin of the XML `<r root="…">` — same condition (single-root only, // multi-root's own roots_count/roots table below already names every root), right after order= like the @@ -11746,29 +11789,29 @@ inline void writeJsonMapHeader( JsonWriter& w, std::string& esc, const JsonMapHe // headers carry the SAME KEYSET for the same run, so this is not an XML-side courtesy — a JSON consumer // (every MCP client) reading a truncated ranking with no key to tell it so is the exact defect the XML // side just closed. Same slot, same absent-means-converged rule. - w.write( renderDisclosure( h.ann->prDisclosure, DiscloseAs::JsonKeys ) ); + w.write( renderDisclosure( h.ann.prDisclosure, DiscloseAs::JsonKeys ) ); w.write( renderHistoryUnread( DiscloseAs::JsonKeys ) ); // K51: the JSON twin of the root's history_unread= (absent unless the amp= walk was unread) // The JSON twin of the XML root's data_sections_cut= / next= (codeFirstKeep): same keys, same absent-at-zero rule. - if( h.dataSectionsCut.cut > 0 ) + if( const DataSectionsCut& cut = h.plan.ranked.dataSecCut; cut.cut > 0 ) { - w.write( ",\"data_sections_cut\":" + std::to_string( h.dataSectionsCut.cut ) + ",\"next\":" ); // composed, not a fixed buffer - writeJsonStr( w, dataSectionsNext( h.dataSectionsCut ), esc ); + w.write( ",\"data_sections_cut\":" + std::to_string( cut.cut ) + ",\"next\":" ); // composed, not a fixed buffer + writeJsonStr( w, dataSectionsNext( cut ), esc ); } - if( h.stemCut > 0 ) + if( const std::size_t stemCut = h.plan.groups.stemPick.cut; stemCut > 0 ) { - w.write( ",\"stem_cut\":" + std::to_string( h.stemCut ) ); // the JSON twin of the XML root's stem_cut= + w.write( ",\"stem_cut\":" + std::to_string( stemCut ) ); // the JSON twin of the XML root's stem_cut= } // §A4b: the multi-root prologue (A13) — `roots_count` joins the header gauges and a // `roots` table maps each label to its root path, ONLY when N≥2 (single-root output byte-unchanged). // Without it every `"p"` in the payload is an unresolvable root-relative fragment. - if( h.ing.rootLabels.size() < 2 ) + if( h.coverage.multiRootCount == 0 ) { return; } - rw::formatTo( hdr, sizeof( hdr ), ",\"roots_count\":{},\"roots\":[", h.ing.rootLabels.size() ); + rw::formatTo( hdr, sizeof( hdr ), ",\"roots_count\":{},\"roots\":[", h.coverage.multiRootCount ); w.write( hdr ); for( std::size_t r = 0; r < h.ing.rootLabels.size(); ++r ) { @@ -11888,7 +11931,7 @@ inline void writeJsonMapRow( JsonWriter& w, const IngestResult& ing, const Overl { w.write( ",\"extent_suspect\":" ); writeJsonStr( w, extent::extentSuspectReasons( s.extentSuspect ), esc ); } - if( !src.stable ) + if( !emitOrderTraits( src.emitOrder ).stablePrefix ) { rw::formatTo( num, sizeof( num ), ",\"k\":{:.4f}", double( src.rank[ id ] ) ); w.write( num ); } @@ -11924,8 +11967,8 @@ inline void writeJsonMapFileGroup( JsonWriter& w, const IngestResult& ing, std:: w.write( "]}" ); } -// The default-map JSON sibling of serialize(). It shares serialize()'s decisions about WHAT the map prints — mapKeepCount, -// rankMapRows, decideMapEmitOrder, groupMapRowsByFile, countMapHonestyGauges — and writes the same groups in its own +// The default-map JSON sibling of serialize(). It shares serialize()'s decisions about WHAT the map prints — one MapPlan +// (planMap) and the same MapCoverageFacts — and writes the same groups in its own // spelling, so a defect fixed in one dialect's selection cannot survive in the other's. Scope: the common single-root // invocation (metrics, fan-in, ambiguity, cbo/tested/lcom4/amp Q-metrics, stable/most-important-last/auto-order, bind labels, // est_tokens, per-edge provenance, the multi-root prologue, and — §B1.2 — the at/rank_by/window PROVENANCE STAMP a @@ -11975,18 +12018,16 @@ inline void serializeJson( std::FILE* out, const IngestResult& ing, const std::v return rootArg.empty() ? std::string_view( ing.files[ fileId ] ) : rw::sarif::rootRelativeUri( ing.files[ fileId ], rootPrefix ); }; - // ── WHICH rows, in WHICH order: serialize()'s steps. This dialect has no in=DIR stub; it always prints its rows. ────────── - const std::size_t keep = mapKeepCount( ing, topK ); - const RankedMapRows ranked = rankMapRows( ing, rank, ann, keep, /*stubbed=*/false ); - const std::span<const NodeId> kept = ranked.kept( keep ); - // T1/§H7: SAME byte-model the XML sibling uses, in the same two roles — the fill-order oracle and the rate source. The - // REPORTED est_tokens is measured from the emitted bytes in PHASE 2 below, exactly as in serialize(): this emitter had the - // identical --metrics under-report (MEASURED: 1780 B reported as est_tokens=507, 3.51 B/tok). - const TokenEstimate mapEst = estimateTokens( ing, ranked.order, kept.size(), outOff, outTargets ); - const MapEmitOrder emitOrder = decideMapEmitOrder( stable, mostImportantLast, autoOrder, mapEst.tokens ); - const MapFileGroups groups = groupMapRowsByFile( ing, ann, kept, /*stubbed=*/false, emitOrder, outOff, outTargets, pathRel ); - const MapHonestyGauges gauges = countMapHonestyGauges( ing, MapResolverCounters{ .ambOut = ambOut, .unresolvedOut = unresolvedOut, .locPinOut = locPinOut, - .declinedOut = declinedOut, .externalCalls = externalCalls } ); + // ── WHICH rows, in WHICH order: serialize()'s plan. This dialect has no in=DIR stub spelling; it always prints its rows. ──── + // The byte model in the plan plays the same two roles as in serialize() — the fill-order oracle and the rate source; the + // REPORTED est_tokens is measured from the emitted bytes in PHASE 2 below (this emitter had the identical --metrics + // under-report: MEASURED 1780 B reported as est_tokens=507, 3.51 B/tok). + const MapPlan plan = planMap( ing, rank, outOff, outTargets, ann, topK, + MapOrderRequest{ .stable = stable, .mostImportantLast = mostImportantLast, .autoOrder = autoOrder }, + MapResolverCounters{ .ambOut = ambOut, .unresolvedOut = unresolvedOut, .locPinOut = locPinOut, + .declinedOut = declinedOut, .externalCalls = externalCalls }, + MapStubPolicy::AlwaysPrintRows, pathRel ); + const MapCoverageFacts coverage = mapCoverageFacts( ing, outProv ); // ── PHASE 1: render the "r" array into a buffer (§H7 — see serialize()'s PHASE 1 for the full reasoning: measure, decide, // then write). DEGRADE: an open_memstream failure emits the header FIRST with the MODELLED estimate (the pre-§H7 number, @@ -12007,45 +12048,43 @@ inline void serializeJson( std::FILE* out, const IngestResult& ing, const std::v const auto emitHeader = [ & ]( std::FILE* dst, std::size_t estTokens ) { JsonWriter hw( dst ); - writeJsonMapHeader( hw, esc, JsonMapHeader{ ing, mapSymbolCount( ing ), outTargets.size(), keep + groups.stemPick.rows.size(), estTokens, gauges.ambiguous, - gauges.unresolved, traitsOf( emitOrder ).orderAttr, outProv, &ann, rootArg, gauges.localityPinned, gauges.external, - gauges.declined, gauges.extentSuspectSyms, gauges.macroBlankedFiles, gauges.nestRefusedFiles, - estimate.isModelled, ranked.dataSecCut, groups.stemPick.cut, memoryPeakJson } ); + writeJsonMapHeader( hw, esc, JsonMapHeader{ .ing = ing, .plan = plan, .coverage = coverage, .edgeCount = outTargets.size(), .estTokens = estTokens, + .isEstModelled = estimate.isModelled, .ann = ann, .rootArg = rootArg, .memoryPeakJson = memoryPeakJson } ); hw.write( ",\"r\":[" ); }; // The "r" array, as ONE renderer both paths call — serialize()'s writeChildren, for the same reason: a buffer that opened and // then lost a write has already spent the rows, so the fallback must be able to write them again. const MapRowSources rowSources{ .rank = rank, .outOff = outOff, .outTargets = outTargets, .outProv = outProv, .outNameOnly = outNameOnly, - .ambOut = ambOut, .locPinOut = locPinOut, .bind = bind, .stable = stable, .metrics = metrics, + .ambOut = ambOut, .locPinOut = locPinOut, .bind = bind, .emitOrder = plan.emitOrder, .metrics = metrics, .fanIn = fanIn, .cbo = cbo, .tested = tested, .lcom4 = lcom4, .amp = amp }; const auto writeRows = [ & ]( JsonWriter& w ) { - for( std::size_t i = 0; i < groups.fileOrder.size(); ++i ) + for( std::size_t i = 0; i < plan.groups.fileOrder.size(); ++i ) { if( i > 0 ) { w.write( "," ); } - writeJsonMapFileGroup( w, ing, groups.fileOrder[ i ], groups, rowSources, pathRel, esc ); + writeJsonMapFileGroup( w, ing, plan.groups.fileOrder[ i ], plan.groups, rowSources, pathRel, esc ); } w.write( "]" ); - if( groups.inventory.active ) + if( plan.groups.inventory.active ) // after "r", always: a key of one object (see writeMapChildren on the XML placement) { - writeMapInventoryJson( w, ing, groups.inventory, pathRel, outOff, outTargets, outProv, outNameOnly, esc ); + writeMapInventoryJson( w, ing, plan.groups.inventory, pathRel, outOff, outTargets, outProv, outNameOnly, esc ); } w.write( "}" ); }; // DEGRADE, one path for both failures: the header FIRST with the MODELLED estimate, the array streamed behind it. const auto emitModelled = [ & ]() { - emitHeader( out, mapEst.tokens ); + emitHeader( out, plan.mapEst.tokens ); JsonWriter direct( out ); writeRows( direct ); direct.flush(); if( outEstTokens ) { - *outEstTokens = mapEst.tokens; + *outEstTokens = plan.mapEst.tokens; } }; if( !rowsMem ) @@ -12084,7 +12123,7 @@ inline void serializeJson( std::FILE* out, const IngestResult& ing, const std::v rw::MemoryStream probe; if( std::FILE* const pm = openChargeStream( probe ) ) { - emitHeader( pm, mapEst.tokens ); + emitHeader( pm, plan.mapEst.tokens ); if( const rw::MemoryStreamBytes header = probe.finish(); header.isWhole ) { headerBytes = header.bytes.size(); @@ -12103,7 +12142,7 @@ inline void serializeJson( std::FILE* out, const IngestResult& ing, const std::v } const std::size_t estTokens = tokensForEmittedBytes( headerBytes + kEstTokensFieldReserve + rowsStr.size(), - mapEst.bytesPerToken() ); + plan.mapEst.bytesPerToken() ); if( outEstTokens ) { *outEstTokens = estTokens; diff --git a/test/fixedbufsweep.sh b/test/fixedbufsweep.sh index 8888af9fa..d11680d6d 100755 --- a/test/fixedbufsweep.sh +++ b/test/fixedbufsweep.sh @@ -188,7 +188,7 @@ TABLE = { ( "src/packtask.h", "bodylessAttr" ): ( 2, "safe", "bodylessAttr[40], TWO call sites, same shape: line 1253 in restatePackTaskBodiesWrapper (issue #60, integration/train-12); line 1758 in the bare-wrapper placeholder branch (t14-cleanup #6) — the section-dropped <bodies> tag that never calls packBodies, so it could not reuse serialize.h's emitter and needed its own copy of the same attribute. Both format ' bodyless=\"{}\"' — 12 B of literal (' bodyless=\"' 11 + '\"' 1) and ONE interpoland, a std::size_t: 20 digits at absolute most, so 32 B against 39 usable + NUL, 7 B of margin. No string interpolation at all — the count is a count, never caller text — so no escaper can sit on either side of the buffer. It is a TABLE row and not NUMERIC_ONLY for arch.h hex[17]'s reason: a buffer that never existed before the std::print conversion has no pre-conversion format to derive a class from. THE ORIGINAL BUFFER WAS DECLARED [32] WHEN IT ARRIVED, which is 1 B short of its own worst case (32 B of text needs 33 with the NUL); formatTo truncates rather than overruns, so the failure mode was a dropped closing quote and a document that stops being well-formed, not a memory breach. Widened to 40 in the same commit as that row; the second site was declared [160]/[40] correctly from the start." ), # ── src/serialize.h ────────────────────────────────────────────────────────────────────────────────── ( "src/serialize.h", "bodylessAttr" ): ( 1, "safe", "bodylessAttr[40] in packBodies (issue #60, integration/train-12): the exact twin of the packtask.h row above — same format, same 12 B of literal, one std::size_t (bodylessCount), 32 B against 39 usable + NUL, 7 B of margin, no string interpoland. Same [32]-on-arrival correction, widened in the same commit." ), - ( "src/serialize.h", "attr" ): ( 2, "safe", "attr[352] x2: the per-symbol metric attrs. Widest 26 lit + 4x10 digits + 11 role + qbuf(<=95) + ambs(<=35: amb= + lpin=) + kbuf(<=23) = 230 B." ), + ( "src/serialize.h", "attr" ): ( 1, "safe", "attr[352]: the per-symbol --metrics run (rowMetricsAttrs). Widest 26 lit + 4x10 digits + 11 role + the BoundedAttrRun (<=191) = 268 B. GE-SERIALIZE round 2 (2026-11-22): was x2 with ambs(<=35) + kbuf(<=23) folded into the same buffer (326 B worst case, never truncated), now written as their own attributes beside it." ), ( "src/serialize.h", "tail" ): ( 3, "safe", "tail[192] x3: the <d> row tail. Widest 34 lit+digits + inAttr(<=23) + lens(qbuf, <=79) + pure(9) = 145 B. The third (lane/lean-answers-068, sigRowTail's zero-elision branch) prints cxAttr/ccxAttr/inAttr pre-formatted, each omitted at 0 — never wider than the second." ), ( "src/serialize.h", "hdr" ): ( 14, "safe", "hdr[64] x2 (packBodies/packOutline) (14: arch-honest — packDeps' <f> row for a no-edge file writes includes= and a language tag, hdr[144], one integer + a label of at most 8 B: far under the buffer; 13: train 26b — count-floor-068 replaced the <lego> implementors= header writes, two hdr sites, with string appends): '<b t=\"%s\" l=\"%u\" p=\"' — symTag's fixed vocabulary + a line number. THE ESCAPED PATH IS APPENDED AFTER, on std::string. snprintf-then-append: textbook safe." ), ( "src/serialize.h", "db" ): ( 1, "safe", "db[64 + kPageDisclosureCap]: <deps files=...> plus pageDisclosure's own capped buffer, sized against that cap by construction." ), @@ -624,7 +624,7 @@ if not bad: # nb[96] ' files_first="{}"' (35 B worst case, one size_t, nothing escaped) — re-read and sized before this pin. EXPECTED = { "mentions": 366, "calls": 251, "sites": 251, "rows": 109, "widthforms": 0 } # lane/hrr: +1 nb site (files_first=); arch-honest: +2 (packDeps hb, hdr) # 2026-11-21 (GE-SERIALIZE): -5 calls/-5 sites/-5 rows (precAttr, rootsAttr, changedAttr, skippedAttr, fitAttr): the map -# header's coverage attributes are composed on std::string in mapCoverageAttrs (serialize.h), no fixed buffer left. +# header's coverage attributes are composed on std::string in renderMapCoverageAttrs / mapFitAttrs (serialize.h), no fixed buffer left. # 2026-11-12 (B43 PINNED-SELF-COUNTS): EXPECTED above is now HISTORY, not a pin -- it drifted on #619 (and on every # lane that added one site) while (S1)/(S2) already held the member set both ways: every derived site is a TABLE # row with its multiplicity, and no row is stale. An exact count on top of that only re-pins arithmetic. What (S1)/(S2) From b5889aa5d9c00005c757f15c96d17ef706c5e185 Mon Sep 17 00:00:00 2001 From: joyful-ii-V-I <210578314+joyful-ii-V-I@users.noreply.github.com> Date: Sun, 22 Nov 2026 02:06:52 -0500 Subject: [PATCH 29/44] refactor(serialize): planMap's two equivalence pins read fields, not calls selfcheckcheck (C) admits only accessor calls inside an ASSUME: the --stable pin compares the decided MapEmitOrder with the flag directly, and the stub pin reads the ranked order itself. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --- src/serialize.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/serialize.h b/src/serialize.h index 6c6852868..ef69685e7 100644 --- a/src/serialize.h +++ b/src/serialize.h @@ -3599,14 +3599,16 @@ inline MapPlan planMap( const IngestResult& ing, const std::vector<float>& rank, // see --metrics decoration or an appended payload. C1-b: under the stub the estimate is taken over no rows. plan.mapEst = estimateTokens( ing, plan.ranked.order, plan.kept().size(), outOff, outTargets ); plan.emitOrder = decideMapEmitOrder( asked, plan.mapEst.tokens ); - ASSUME( emitOrderTraits( plan.emitOrder ).stablePrefix == asked.stable, "decideMapEmitOrder returns Stable exactly when --stable was asked" ); + // Stable is the one order whose traits carry stablePrefix (emitOrderTraits), so every downstream --stable choice that reads + // the trait reads exactly the flag the caller passed. + ASSUME( ( plan.emitOrder == MapEmitOrder::Stable ) == asked.stable, "decideMapEmitOrder returns Stable exactly when --stable was asked" ); if( !plan.stubbed ) { plan.groups = groupMapRowsByFile( ing, ann, plan.kept(), plan.emitOrder, outOff, outTargets, pathRel ); } plan.gauges = countMapHonestyGauges( ing, counters ); plan.shown = plan.stubbed ? 0 : plan.keep + plan.groups.stemPick.rows.size(); - ASSUME( !plan.stubbed || ( plan.kept().empty() && plan.groups.fileOrder.empty() && plan.groups.inventory.entries.empty() ), + ASSUME( !plan.stubbed || ( plan.ranked.order.empty() && plan.groups.fileOrder.empty() && plan.groups.inventory.entries.empty() ), "the stub ranks and groups no row, so no kept-row legend clause and no <f> group can fire under it" ); return plan; } From 8e1c5d3957f5dc6beb9169df28789aaf8d962670 Mon Sep 17 00:00:00 2001 From: joyful-ii-V-I <210578314+joyful-ii-V-I@users.noreply.github.com> Date: Sat, 21 Nov 2026 23:30:25 -0500 Subject: [PATCH 30/44] refactor(lexical): lexicalScoresTiered reads as its named BM25 steps lexicalScoresTiered was one 1045-line body (nest 6, 151 deep lines) whose corpus-statistics membership (statsS / allS / statsOut / unranked) was set at the top and steered branches 800 lines later. It is now an ordered list of steps, each making one named decision: - assignLexCorpusRoles: each unit is counted, statsOut or unranked, decided once (LexCorpusRoles); every later step asks the role instead of combining two masks and a merged copy. - buildLexMatchTable + lightStemVariantsOf: exact terms, then the armed RIPWIRE_QSTEM variants (suffix rules flattened, first-wins dedupe kept). - LexTfTable: the dl/tf accumulator; every write goes through its add/fold members and one field scanner. - addNameAndCalleeFields / addPathField / addBasenameField, then pass 2 from addDocBodyFromPersistedStats or scanDocBodyFields (now on symbolsByFileInIdOrder instead of a hand-rolled CSR). - admitRareStemVariants: the R3 admission decided once (was re-evaluated in three loops); foldAdmittedVariants / foldAdmittedNameDf apply it. - judgeTermMargins: one TermMarginVerdict per term; termKept and the debug lines both read it instead of re-deriving the reason. - tallyBm25Stats + LexTopKPruner + scoreLexCandidates: one scoring loop over the candidates; exhaustive scoring is the same loop with a pruner that never skips (non-candidates keep +0.0f, as before; DASSERT on the tier multiplier range that equivalence rests on). The per-doc BM25 expression is unchanged text (the idf log stays inside the loop: hoisting it would let -ffast-math vectorize and reassociate the sum). Answers are byte-identical (stdout, stderr, rc) on plain builds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --- src/lexical.h | 1769 +++++++++++++++++++++++++------------------------ 1 file changed, 895 insertions(+), 874 deletions(-) diff --git a/src/lexical.h b/src/lexical.h index 4b1e7bb71..88e1dc342 100644 --- a/src/lexical.h +++ b/src/lexical.h @@ -159,7 +159,7 @@ struct LexTermEvidence const std::uint64_t* anyMaskOf( std::size_t sym ) const noexcept { return anyMask.data() + sym * maskWords; } static bool hasBit( const std::uint64_t* mask, std::size_t u ) noexcept { return ( mask[ u / 64 ] >> ( u % 64 ) ) & 1u; } - // BM25's own idf for term u over the `statsCount` symbols the statistics count — the exact expression both scoring branches use, + // BM25's own idf for term u over the `statsCount` symbols the statistics count — the exact expression scoreLexCandidates uses, // so an absent term (df 0) weighs as the rarest possible term and never as nothing. double idf( std::size_t u ) const noexcept { @@ -266,7 +266,7 @@ inline Bm25Params resolveBm25Params() noexcept // The provably-safe per-term impact bound (MaxScore "max contribution"), derived from the SAME (k1,b) the // exact scoring loop uses. idf: this term's IDF. T: the largest weighted tf of this term anywhere in the -// corpus (tfMaxOf[u] at the call site). See lexicalScoresTiered's pruned branch for the full monotonicity +// corpus (tfMaxOf[u] at the call site). See LexTopKPruner for the full monotonicity // proof this bound relies on — it holds for ANY k1 > 0 and ANY b in [0,1], not just the shipped defaults. inline double bm25ImpactBound( double idf, double T, const Bm25Params& p ) noexcept { @@ -535,208 +535,200 @@ inline std::vector<char> notLexRankedMask( const IngestResult& ing ) return mask; } -inline std::vector<float> lexicalScoresTiered( const IngestResult& ing, const std::vector<std::uint32_t>& outOff, - const std::vector<NodeId>& outTargets, std::string_view query, - std::size_t pruneTopK, const std::vector<char>* alwaysExact, - const std::vector<float>* symbolScoreMul, int pathFieldDefaultW = 0, - int basenameFieldDefaultW = 0, std::string_view pathRootPrefix = {}, - LexTermEvidence* evidenceOut = nullptr, // L-W: the term evidence, read back out (see the struct) - const std::vector<char>* statsOut = nullptr ) // units scored but kept OUT of the corpus statistics +// ─── lexicalScoresTiered's steps, in the order it runs them ───────────────────────────────────────────── +// lexicalScoresTiered (below) reads as the list of these steps. Each one makes ONE decision and names it: +// which units the corpus statistics count, which tokens a corpus subtoken can match, what each field adds, +// which stem variants are rare enough to keep, which query terms separate, and which units are scored. + +// TIER STEP — which units the BM25 corpus statistics count. Decided ONCE per call, per unit, as one of three roles: +// kCounted scored, and counted in the statistics: the symbol count, every document frequency, the average length +// kStatsOut scored like any other unit but kept OUT of the statistics (the caller's statsOut — filter.h +// sphinxTxtStatsExclusion). It scores against the whole ranked corpus instead: rankedCount units, its +// term's counted df plus the statsOut df, and the ranked average length. +// kUnranked a kRankFlagNotLexRanked unit (model.h): never scored (0), and no document in either corpus — so a +// Sphinx .txt section scores as it did before HTML units existed. +// An unranked unit that the caller also lists in statsOut is kUnranked: unranked wins. roleOf is EMPTY when every unit +// is kCounted, so a corpus with neither kind pays no per-unit lookup and runs the historical pass byte-for-byte. +struct LexCorpusRoles +{ + enum Role : std::uint8_t + { + kCounted = 0, + kStatsOut = 1, + kUnranked = 2, + }; + + std::vector<std::uint8_t> roleOf; // per unit; empty = every unit kCounted + std::size_t countedCount = 0; // the units the statistics count (the BM25 N of a counted unit) + std::size_t rankedCount = 0; // counted + statsOut: the corpus a statsOut unit scores against + + Role role( std::size_t i ) const noexcept { return roleOf.empty() ? kCounted : Role( roleOf[i] ); } + bool isUnranked( std::size_t i ) const noexcept { return role( i ) == kUnranked; } + bool isStatsOut( std::size_t i ) const noexcept { return role( i ) == kStatsOut; } + // a unit's weight in every corpus statistic: 1 counted, 0 otherwise (statsOut and unranked alike) + int statsWeight( std::size_t i ) const noexcept { return role( i ) == kCounted ? 1 : 0; } +}; + +inline LexCorpusRoles assignLexCorpusRoles( const IngestResult& ing, const std::vector<char>* statsOut ) { - PROFILE_SCOPE_DESCRIBE( "lexical: lexicalScores (BM25 over symbols)" ); const std::size_t S = ing.symbols.size(); - // kRankFlagNotLexRanked units (model.h): out of the statistics like a statsOut unit, and never scored (0 below) - const std::vector<char> unranked = notLexRankedMask( ing ); - std::vector<char> statsOutMerged; - if( !unranked.empty() ) + LexCorpusRoles roles; + for( std::size_t i = 0; i < S; ++i ) { - statsOutMerged = unranked; - for( std::size_t i = 0; statsOut != nullptr && i < statsOut->size() && i < S; ++i ) + const bool listedOut = statsOut != nullptr && i < statsOut->size() && ( *statsOut )[i] != 0; + const auto role = notLexRanked( ing.symbols[i] ) ? LexCorpusRoles::kUnranked + : listedOut ? LexCorpusRoles::kStatsOut + : LexCorpusRoles::kCounted; + if( role != LexCorpusRoles::kCounted && roles.roleOf.empty() ) { - statsOutMerged[i] = char( statsOutMerged[i] | ( *statsOut )[i] ); + roles.roleOf.assign( S, LexCorpusRoles::kCounted ); } - statsOut = &statsOutMerged; - } - const auto isUnranked = [ &unranked ]( std::size_t i ) noexcept { return !unranked.empty() && unranked[i] != 0; }; - // the WHOLE corpus an OUT unit scores against (avgdlAll, allS, dfOut below) is the ranked one: a kRankFlagNotLexRanked - // unit is no document there either, so a Sphinx .txt section scores as it did before HTML units existed - const std::size_t allS = S - std::size_t( std::count( unranked.begin(), unranked.end(), char( 1 ) ) ); - // statsOut (filter.h sphinxTxtStatsExclusion): units SCORED like any other but kept out of the corpus statistics — - // the symbol count, every document frequency and the average length. Null: every unit counts, the historical pass. - const auto statsWeight = [ statsOut ]( std::size_t i ) noexcept -> int - { return ( statsOut != nullptr && i < statsOut->size() && ( *statsOut )[i] != 0 ) ? 0 : 1; }; - std::size_t statsS = S; - if( statsOut != nullptr ) - { - statsS = 0; - for( std::size_t i = 0; i < S; ++i ) + if( role != LexCorpusRoles::kCounted ) { - statsS += std::size_t( statsWeight( i ) ); + roles.roleOf[i] = role; } + roles.countedCount += role == LexCorpusRoles::kCounted ? 1 : 0; + roles.rankedCount += role != LexCorpusRoles::kUnranked ? 1 : 0; } + return roles; +} - // query subtokens — occurrence order preserved (BM25 adds one contribution PER occurrence, as before); - // an empty query scores exactly 0 everywhere (0.0 survives the Section down-weight unchanged) - std::vector<std::string> qToks; - subtokens( query, qToks ); - if( qToks.empty() ) +// One row of a query's match table: a token a corpus subtoken is compared against, and the unique query term whose +// tf/idf row it scores into — itself for an exact term (row m == u), the original term for an LB-3 stem variant. +struct LexMatchTok +{ + std::string tok; + std::uint32_t u; +}; + +// The LB-3 arm S suffix rules for ONE query term, in the order the match table admits them (first-wins): a +// plural/participle query token ("splits", "resolved", "hoisting") cannot exact-match the singular subtoken a +// compound name carries (SplitChunksPlugin → split; resolve.h → resolve) — the measured LB-3 anatomy (bench/r7 + r8, +// three independent confirmations). Candidates only: the 3-byte floor and the first-wins dedupe are the table's. +inline std::vector<std::string> lightStemVariantsOf( const std::string& t ) +{ + const auto isConsonant = []( char c ) { - if( evidenceOut ) - { - *evidenceOut = LexTermEvidence{}; - evidenceOut->symbolCount = S; - evidenceOut->statsCount = S; - } - return std::vector<float>( S, 0.f ); + return c >= 'a' && c <= 'z' && c != 'a' && c != 'e' && c != 'i' && c != 'o' && c != 'u'; + }; + const std::size_t L = t.size(); + const auto ends = [ & ]( std::string_view suf ) { return L >= suf.size() && t.compare( L - suf.size(), suf.size(), suf ) == 0; }; + // a doubled final consonant before the suffix ("flagged", "running"): the undoubled stem is a variant too + const auto doubledBefore = [ & ]( std::size_t suffixLen ) { return t[L - suffixLen - 1] == t[L - suffixLen - 2] && isConsonant( t[L - suffixLen - 1] ); }; + std::vector<std::string> variants; + if( ends( "s" ) && !ends( "ss" ) && L >= 4 ) + { + variants.push_back( t.substr( 0, L - 1 ) ); // splits → split + } + if( ends( "es" ) && L >= 5 ) + { + variants.push_back( t.substr( 0, L - 2 ) ); // classes → class + } + if( ends( "ed" ) && L >= 5 ) + { + variants.push_back( t.substr( 0, L - 1 ) ); // resolved → resolve + variants.push_back( t.substr( 0, L - 2 ) ); // parsed → pars (rarely useful, harmless) + } + if( ends( "ed" ) && L >= 6 && doubledBefore( 2 ) ) + { + variants.push_back( t.substr( 0, L - 3 ) ); // flagged → flag + } + if( ends( "ing" ) && L >= 6 ) + { + variants.push_back( t.substr( 0, L - 3 ) ); // hoisting → hoist + variants.push_back( t.substr( 0, L - 3 ) + "e" ); // caching → cache } + if( ends( "ing" ) && L >= 7 && doubledBefore( 3 ) ) + { + variants.push_back( t.substr( 0, L - 4 ) ); // running → run + } + return variants; +} - // dedupe to the unique terms whose statistics we need — a duplicated query word must not double-count - // tf, but still contributes once PER OCCURRENCE in the scoring loop (uniqueIndexOfQtok maps back) — - // capped (see dedupeQueryTerms above) so a pathologically term-rich query cannot blow up tfFlat's S×terms - // allocation below. - DedupedQueryTerms dedup = dedupeQueryTerms( qToks, kMaxUniqueQueryTerms ); - std::vector<std::string>& uniqueToks = dedup.uniqueToks; - std::vector<std::size_t>& uniqueIndexOfQtok = dedup.uniqueIndexOfQtok; - const std::size_t uniqueCount = uniqueToks.size(); - - // ── LB-3 arm S: conservative query-side stem variants ───────────────────────────────────────────── - // A plural/participle query token ("splits", "resolved", "hoisting") cannot exact-match the singular - // subtoken a compound name carries (SplitChunksPlugin → split; resolve.h → resolve) — the measured - // LB-3 anatomy (bench/r7 + r8, three independent confirmations). Variants are QUERY-side only and - // score into the ORIGINAL token's tf/idf row, so corpus stats and the cache format are untouched. - // ONE shared table drives the scan branch, the persisted-stats branch, and every field pass — - // parity by construction (test/postingscheck.sh; armed arm in test/lb3namecheck.sh). A variant - // string already claimed by an earlier token (or equal to any exact token) is dropped, first-wins, - // so a doc token maps to exactly one row in either branch. RIPWIRE_QSTEM=1 arms it; the shipped - // default stays OFF until the LB-3 acceptance verdict (scratchpad lb3/preregistration.md) lands. - struct LexMatchTok - { - std::string tok; - std::uint32_t u; - }; - std::vector<LexMatchTok> matchToks; - matchToks.reserve( uniqueCount * 2 ); +// THE query's match table: one row per unique exact term (rows 0..uniqueCount, m == u), then — only when RIPWIRE_QSTEM=1 +// arms LB-3 arm S — the terms' light-stem variants as PROVISIONAL rows (m ≥ uniqueCount), each owning its own tf column. +// Variants are QUERY-side only and score into the ORIGINAL token's tf/idf row, so corpus stats and the cache format are +// untouched. ONE shared table drives the scan branch, the persisted-stats branch, and every field pass — parity by +// construction (test/postingscheck.sh; armed arm in test/lb3namecheck.sh). A variant string already claimed by an +// earlier token (or equal to any exact token) is dropped, first-wins, so a doc token maps to exactly one row in either +// branch. The shipped default stays OFF until the LB-3 acceptance verdict (scratchpad lb3/preregistration.md) lands. +// +// IDF guard, rung R3 (LB-3 retry, scratchpad lb3retry/preregistration.md): the un-guarded round measured the failure: +// a corpus-common variant ("split" on webpack) hands its term-frequency mass to every competitor whose doc/body rides +// the same subtoken, displacing currently-hit truths (EVALS §7) — and the mass is BODY frequency (`.split()` call +// sites), which is why the name-carrier bound (rungs R1/R2) measured too low to catch it. So a variant enters the table +// PROVISIONALLY; admission is decided after pass 2 (admitRareStemVariants), when both pass-2 sources have measured +// its doc/body document frequency as the SAME integers. The guard never sees a user's EXACT query token — only derived +// variants — so it structurally cannot drop a truth's own carrier (the LB-1 IDF-floor failure). +inline std::vector<LexMatchTok> buildLexMatchTable( const std::vector<std::string>& uniqueToks ) +{ + const std::size_t uniqueCount = uniqueToks.size(); + std::vector<LexMatchTok> rows; + rows.reserve( uniqueCount * 2 ); for( std::size_t u = 0; u < uniqueCount; ++u ) { - matchToks.push_back( { uniqueToks[u], std::uint32_t( u ) } ); + rows.push_back( { uniqueToks[u], std::uint32_t( u ) } ); } + const char* qstemEnv = std::getenv( "RIPWIRE_QSTEM" ); + if( qstemEnv == nullptr || *qstemEnv != '1' ) { - const char* qstemEnv = std::getenv( "RIPWIRE_QSTEM" ); - const bool qstemOn = qstemEnv != nullptr && *qstemEnv == '1'; - // derived variants are CANDIDATES first: admission into the match table happens only after the - // IDF guard below — the guard sees the deduped candidate set, never the user's exact tokens - std::vector<LexMatchTok> stemCandidates; - const auto pushVariant = [ & ]( std::string v, std::uint32_t u ) - { - if( v.size() < 3 ) - { - return; // sub-3-byte stems are noise, frozen rule - } - for( const LexMatchTok& mt : matchToks ) - { - if( mt.tok == v ) - { - return; // first-wins: string already claimed - } - } - for( const LexMatchTok& cand : stemCandidates ) - { - if( cand.tok == v ) - { - return; // first-wins among candidates too - } - } - stemCandidates.push_back( { std::move( v ), u } ); - }; - const auto isConsonant = []( char c ) - { - return c >= 'a' && c <= 'z' && c != 'a' && c != 'e' && c != 'i' && c != 'o' && c != 'u'; - }; - if( qstemOn ) + return rows; + } + const auto alreadyClaimed = [ &rows ]( const std::string& v ) + { return std::ranges::any_of( rows, [ & ]( const LexMatchTok& row ) { return row.tok == v; } ); }; + for( std::size_t u = 0; u < uniqueCount; ++u ) + { + for( std::string& v : lightStemVariantsOf( uniqueToks[u] ) ) { - for( std::size_t u = 0; u < uniqueCount; ++u ) + if( v.size() >= 3 && !alreadyClaimed( v ) ) // sub-3-byte stems are noise, frozen rule; first-wins { - const std::string& t = uniqueToks[u]; - const std::size_t L = t.size(); - const auto ends = [ & ]( std::string_view suf ) - { return L >= suf.size() && t.compare( L - suf.size(), suf.size(), suf ) == 0; }; - if( ends( "s" ) && !ends( "ss" ) && L >= 4 ) - { - pushVariant( t.substr( 0, L - 1 ), std::uint32_t( u ) ); // splits → split - if( ends( "es" ) && L >= 5 ) - { - pushVariant( t.substr( 0, L - 2 ), std::uint32_t( u ) ); // classes → class - } - } - if( ends( "ed" ) && L >= 5 ) - { - pushVariant( t.substr( 0, L - 1 ), std::uint32_t( u ) ); // resolved → resolve - pushVariant( t.substr( 0, L - 2 ), std::uint32_t( u ) ); // parsed → pars (rarely useful, harmless) - if( L >= 6 && t[L - 3] == t[L - 4] && isConsonant( t[L - 3] ) ) - { - pushVariant( t.substr( 0, L - 3 ), std::uint32_t( u ) ); // flagged → flag - } - } - if( ends( "ing" ) && L >= 6 ) - { - pushVariant( t.substr( 0, L - 3 ), std::uint32_t( u ) ); // hoisting → hoist - pushVariant( t.substr( 0, L - 3 ) + "e", std::uint32_t( u ) ); // caching → cache - if( L >= 7 && t[L - 4] == t[L - 5] && isConsonant( t[L - 4] ) ) - { - pushVariant( t.substr( 0, L - 4 ), std::uint32_t( u ) ); // running → run - } - } + rows.push_back( { std::move( v ), std::uint32_t( u ) } ); } } - // ── IDF guard, rung R3 (LB-3 retry, scratchpad lb3retry/preregistration.md) ────────────────── - // The un-guarded round measured the failure: a corpus-common variant ("split" on webpack) hands - // its term-frequency mass to every competitor whose doc/body rides the same subtoken, displacing - // currently-hit truths (EVALS §7) — and the mass is BODY frequency (`.split()` call sites), which - // is why the name-carrier bound (rungs R1/R2) measured too low to catch it. So every candidate - // enters the match table PROVISIONALLY, owning its own tf column (m ≥ uniqueCount); admission is - // decided AFTER pass 2, when both scoring branches have measured the variant's doc/body document - // frequency as the SAME integers (postings rows on the rich path, the scan's own counts on the - // lean path — parity by construction), and only a corpus-rare variant (df ≤ max(8, S/64)) is - // folded into its original token's row; a common one is discarded untouched. The guard never - // sees a user's EXACT query token — only derived variants — so it structurally cannot drop a - // truth's own carrier (the LB-1 IDF-floor failure). - for( LexMatchTok& cand : stemCandidates ) - { - matchToks.push_back( std::move( cand ) ); - } - } - const std::size_t matchCount = matchToks.size(); - - // P2-3: build the head mask + length buckets for THIS query's match table (see LexHeadIndex above). - const auto matchTokOf = [ & ]( std::size_t m ) -> const std::string& { return matchToks[m].tok; }; - const LexHeadIndex headIndex = buildLexHeadIndex( matchCount, matchTokOf ); - - // per-doc integer stats (SoA): dl[i] = weighted subtoken count, tfFlat[i*matchCount+m] = weighted term - // frequency of match-table row m in doc i. Disarmed, matchCount == uniqueCount and the layout is the - // historical one byte-for-byte; armed, provisional variant columns sit at m ≥ uniqueCount until the - // post-pass-2 guard folds the admitted ones and the array shrinks back to uniqueCount stride. - std::vector<int> dl( S, 0 ); - std::vector<int> tfFlat( S * matchCount, 0 ); - - // Field weights: a query term in a symbol's NAME outranks one in its DOC-COMMENT, which outranks one - // buried in its BODY — so an exactly-named function beats a struct that merely mentions the word, and an - // algorithm beats a comment-dense enum (the "keyword magnet" the review flagged). BM25 tf accumulates - // these weighted contributions; dl is weighted to match, so length normalization stays consistent. - // Doc/body weights are the SHARED constants (lexindex.h) — the index-time stats builder must weigh - // those two fields identically or the postings path would diverge from this scan. - constexpr int kwName = 3, kwCallee = 1, kwDoc = kLexWeightDoc, kwBody = kLexWeightBody; - - // stream one field through the ONE shared state machine (lexindex.h forEachLexSubtoken — the same - // tokenizer subtokens() mirrors and the B0.2 index-time builder uses): a token is a maximal - // alphanumeric run between separators, cut at a lower/digit → Upper transition and at the ACRONYMWord - // seam. Tokens shorter than 2 bytes are dropped, exactly like subtokens(). - // No strings, no maps — just in-place span-vs-query compares. Since 2026-08-19 an all-caps run survives - // as ONE token, so a span's INTERIOR bytes can be uppercase and memcmp alone would miss it; the memcmp - // stays as the fast path (it resolves every ordinary identifier token) and only a span already agreeing - // on length AND head falls through to lexTokenEqualsLowered — the rare acronym case, arm D's seam. - const auto scanTextInto = [ & ]( int* tfRow, int& wtAccum, std::string_view text, int w ) - { - int fieldTokenWt = 0; + } + return rows; +} + +// The per-query BM25 term table every field pass adds into (SoA): dl[i] = doc i's weighted subtoken count (the BM25 +// document length) and tf[i * stride + m] = the weighted term frequency of match-table row m in doc i. Integer counts are +// exact, so fill order is free and the float scoring later runs in strict doc order with the historical expressions. +// Until the stem-variant fold, stride == matchCount and provisional variant columns sit at m ≥ uniqueCount; the fold +// (foldAdmittedVariants) shrinks it back to uniqueCount, the historical layout byte-for-byte. Disarmed, the two are equal. +// +// Every write goes through the four add/fold members below, and every field's evidence through ONE tokenizer: +// scanTextInto streams a field through lexindex.h forEachLexSubtoken (the same state machine subtokens() mirrors and the +// B0.2 index-time builder uses): a token is a maximal alphanumeric run between separators, cut at a lower/digit → Upper +// transition and at the ACRONYMWord seam. Tokens shorter than 2 bytes are dropped, exactly like subtokens(). No strings, +// no maps — just in-place span-vs-query compares through the P2-3 head index (LexHeadIndex above). Since 2026-08-19 an +// all-caps run survives as ONE token, so a span's INTERIOR bytes can be uppercase and memcmp alone would miss it; the +// memcmp stays as the fast path and only a span already agreeing on length AND head falls through to +// lexTokenEqualsLowered — the rare acronym case, arm D's seam. +struct LexTfTable +{ + const std::vector<LexMatchTok>& matchToks; + std::size_t uniqueCount; // rows 0..uniqueCount are the exact query terms + std::size_t stride; // matchToks.size() until the fold, uniqueCount after it + LexHeadIndex headIndex; + std::vector<int> dl; + std::vector<int> tf; + + LexTfTable( std::size_t docCount, const std::vector<LexMatchTok>& rows, std::size_t exactCount ) + : matchToks( rows ), uniqueCount( exactCount ), stride( rows.size() ), + headIndex( buildLexHeadIndex( rows.size(), [ &rows ]( std::size_t m ) -> const std::string& { return rows[m].tok; } ) ), + dl( docCount, 0 ), tf( docCount * rows.size(), 0 ) + { + } + + std::size_t variantCount() const noexcept { return matchToks.size() - uniqueCount; } + int* row( std::size_t doc ) noexcept { return tf.data() + doc * stride; } + const int* row( std::size_t doc ) const noexcept { return tf.data() + doc * stride; } + + // Streams `text` at weight w into a caller-owned tf row and length accumulator (the per-file basename rows use it + // directly; addField is the per-doc form). Exact tokens own rows 0..uniqueCount (m == u there). + void scanTextInto( int* tfRow, int& wtAccum, std::string_view text, int w ) const + { + const auto tokOf = [ this ]( std::size_t m ) -> const std::string& { return matchToks[m].tok; }; + int fieldTokenWt = 0; forEachLexSubtoken( text, [ & ]( std::size_t tokStartByte, std::size_t tokEndByte ) { const std::size_t tokLen = tokEndByte - tokStartByte; @@ -745,824 +737,790 @@ inline std::vector<float> lexicalScoresTiered( const IngestResult& ing, const st return; } fieldTokenWt += w; - const std::size_t m = headIndex.matchRow( text.data() + tokStartByte, tokLen, matchTokOf ); - if( m != LexHeadIndex::kNoRow ) + if( const std::size_t m = headIndex.matchRow( text.data() + tokStartByte, tokLen, tokOf ); m != LexHeadIndex::kNoRow ) { - tfRow[m] += w; // exact tokens own rows 0..uniqueCount (m == u there) + tfRow[m] += w; } } ); wtAccum += fieldTokenWt; - }; - const auto scanField = [ & ]( std::size_t docIndex, std::string_view text, int w ) + } + + void addField( std::size_t doc, std::string_view text, int w ) { scanTextInto( row( doc ), dl[doc], text, w ); } + + // a field scanned once per FILE and shared by every doc in it (pass 1.6): its tf row and its length, added + void addFileField( std::size_t doc, const int* fileRow, int fileWt ) { - scanTextInto( tfFlat.data() + docIndex * matchCount, dl[ docIndex ], text, w ); - }; + int* const tfRow = row( doc ); + for( std::size_t m = 0; m < stride; ++m ) + { + tfRow[m] += fileRow[m]; + } + dl[doc] += fileWt; + } + + // the persisted-stats branch's exact stored integers (B0.2): a doc's doc/body length, and one term's tf + void addStoredLength( std::size_t doc, int length ) { dl[doc] += length; } + void addStoredTf( std::size_t doc, std::size_t m, int count ) { row( doc )[m] += count; } + + // The R3 fold: an admitted variant's column adds into its original term's row, a rejected one's is dropped (its + // evidence — name, callee, path, basename, doc, body — vanishes without touching dl: document length counts all + // subtokens scanned, never matches). The table then has the historical uniqueCount stride. + void foldAdmittedVariants( const std::vector<char>& admitted ) + { + if( variantCount() == 0 ) + { + return; // disarmed: already the historical layout + } + const std::size_t docCount = dl.size(); + std::vector<int> folded( docCount * uniqueCount, 0 ); + for( std::size_t i = 0; i < docCount; ++i ) + { + const int* const src = row( i ); + int* const dst = folded.data() + i * uniqueCount; + std::copy( src, src + uniqueCount, dst ); + for( std::size_t v = 0; v < admitted.size(); ++v ) + { + dst[ matchToks[ uniqueCount + v ].u ] += admitted[v] != 0 ? src[ uniqueCount + v ] : 0; + } + } + tf = std::move( folded ); + stride = uniqueCount; + } +}; + +// ── SIRA term margin (docs/EVALS.md "Corpus-statistics term margin", PRE-REGISTERED 2026-09-05) — the arming ── +// The decision itself needs corpus statistics that do not exist until after pass 2 (judgeTermMargins); all that is +// read here is whether it is armed and at which rung. The result is the k of "a term separates iff idf_u >= k * ln 2", +// k = 1 being the shipped rule and the only rung this round may ship (the ladder is frozen in the registration). +// 0 = disarmed: every step that reads it skips its margin work and the scorer is the historical one byte-for-byte. +inline int termMarginBitsFromEnv() +{ + const char* env = std::getenv( "RIPWIRE_TERMMARGIN" ); + if( env == nullptr || *env == '0' ) + { + return 0; + } + const std::optional<int> bits = envKnob<int>( "RIPWIRE_TERMMARGIN_BITS" ); + return bits ? std::clamp( *bits, 1, 8 ) : 1; +} + +// A field's weight: the caller's lens default, or the RIPWIRE_* calibration knob (clamped 0..8) when set. 0 = the +// field is not scanned at all. +inline int fieldWeightOrEnv( int lensDefaultW, const char* envName ) +{ + if( const std::optional<int> knob = envKnob<int>( envName ) ) + { + return std::clamp( *knob, 0, 8 ); + } + return lensDefaultW; +} - // ── SIRA term margin (docs/EVALS.md "Corpus-statistics term margin", PRE-REGISTERED 2026-09-05) ── - // Arming only. The decision itself needs corpus statistics that do not exist until after pass 2, so - // it lives below the fold; all that happens here is the extra field statistic the decision reads. - // marginBits is the k of "a term separates iff idf_u >= k * ln 2", k = 1 being the shipped rule and - // the only rung this round may ship (the ladder is frozen in the registration). Disarmed, every - // branch this flag guards is skipped and the scorer is the historical one byte-for-byte. - const int marginBits = [] - { - const char* env = std::getenv( "RIPWIRE_TERMMARGIN" ); - if( env == nullptr || *env == '0' ) - { - return 0; - } - const std::optional<int> bits = envKnob<int>( "RIPWIRE_TERMMARGIN_BITS" ); - return bits ? std::clamp( *bits, 1, 8 ) : 1; - }(); - const bool marginArmed = marginBits > 0; - - // nameDf[m] = symbols whose NAME FIELD ALONE carries match-table row m. This is the statistic the - // LB-1 negative is the reason for: that round's IDF floor read document frequency only, and so - // deleted `module` — the truth's OWN name carrier — on a corpus where `module` is everywhere in - // bodies. A term that names between 1 and S/2 symbols separates on the field ripwire weights - // highest (×3) whatever its body mass says, and is kept. Measured HERE, inside pass 1, because - // this is the only point at which the name field's contribution is separable from the callee, doc, - // body, path and basename fields that follow — and because pass 1 runs before the pass-2 branch - // split, so the scan and persisted-stats paths read the identical integers. - std::vector<int> nameDf( marginArmed ? matchCount : 0, 0 ); - // L-W: the name-field mask is separable ONLY here — the callee, path, doc and body fields land in the - // same tf row from the next statement on (the nameDf comment below says the same thing for its count). +// Field weights: a query term in a symbol's NAME outranks one in its DOC-COMMENT, which outranks one buried in its +// BODY — so an exactly-named function beats a struct that merely mentions the word, and an algorithm beats a +// comment-dense enum (the "keyword magnet" the review flagged). BM25 tf accumulates these weighted contributions; dl is +// weighted to match, so length normalization stays consistent. Doc/body weights are the SHARED constants (lexindex.h) — +// the index-time stats builder must weigh those two fields identically or the postings path would diverge from the scan. +inline constexpr int kLexWeightName = 3, kLexWeightCallee = 1; + +// pass 1 — name (×kLexWeightName) + callee-name (×kLexWeightCallee) fields, which need no file text. Two per-unit facts +// are separable ONLY here, after a unit's name field and before its callee, path, doc and body fields land in the same +// tf row, so they are captured here: +// L-W evidenceOut->nameMask, bit u set iff the NAME field alone carried terms[u] (with maskWords; skipped when null) +// SIRA the returned nameDf[m] = ranked units whose NAME FIELD ALONE carries match-table row m (empty when the margin is +// disarmed). This is the statistic the LB-1 negative is the reason for: that round's IDF floor read document +// frequency only, and so deleted `module` — the truth's OWN name carrier — on a corpus where `module` is +// everywhere in bodies. A term that names between 1 and S/2 symbols separates on the field ripwire weights highest +// (×3) whatever its body mass says, and is kept. Pass 1 runs before the pass-2 branch split, so the scan and +// persisted-stats paths read the identical integers. +inline std::vector<int> addNameAndCalleeFields( LexTfTable& table, const IngestResult& ing, const std::vector<std::uint32_t>& outOff, + const std::vector<NodeId>& outTargets, const LexCorpusRoles& roles, bool countNameDf, + LexTermEvidence* evidenceOut ) +{ + const std::size_t S = ing.symbols.size(); + const std::size_t uniqueCount = table.uniqueCount; const std::size_t evidenceWords = ( uniqueCount + 63 ) / 64; if( evidenceOut ) { evidenceOut->maskWords = evidenceWords; evidenceOut->nameMask.assign( S * evidenceWords, 0u ); } - - // pass 1 — name (×kwName) + callee-name (×kwCallee) fields need no file text + std::vector<int> nameDf( countNameDf ? table.stride : 0, 0 ); for( std::size_t i = 0; i < S; ++i ) { - scanField( i, ing.symbols[i].name, kwName ); - if( evidenceOut && !isUnranked( i ) ) + table.addField( i, ing.symbols[i].name, kLexWeightName ); + const int* const nameRow = table.row( i ); // name field only: nothing else has run for this unit yet + if( evidenceOut && !roles.isUnranked( i ) ) { - const int* const nameRow = tfFlat.data() + i * matchCount; // name field only: nothing else has run - std::uint64_t* words = evidenceOut->nameMask.data() + i * evidenceWords; + std::uint64_t* words = evidenceOut->nameMask.data() + i * evidenceWords; for( std::size_t u = 0; u < uniqueCount; ++u ) { - if( nameRow[u] > 0 ) - { - words[ u / 64 ] |= std::uint64_t( 1 ) << ( u % 64 ); - } + words[ u / 64 ] |= nameRow[u] > 0 ? std::uint64_t( 1 ) << ( u % 64 ) : 0u; } } - if( marginArmed ) + for( std::size_t m = 0; m < nameDf.size() && !roles.isUnranked( i ); ++m ) { - const int* const nameRow = tfFlat.data() + i * matchCount; // name field only: nothing else has run - for( std::size_t m = 0; m < matchCount && !isUnranked( i ); ++m ) - { - nameDf[m] += nameRow[m] > 0 ? 1 : 0; - } + nameDf[m] += nameRow[m] > 0 ? 1 : 0; } for( std::uint32_t e = outOff[i]; e < outOff[i + 1]; ++e ) { - scanField( i, ing.symbols[ outTargets[e] ].name, kwCallee ); + table.addField( i, ing.symbols[ outTargets[e] ].name, kLexWeightCallee ); } } + return nameDf; +} - // pass 1.5 — path field (×kwPath): the symbol's file path scanned through the SAME state machine. - // pathFieldDefaultW is the CALLER's lens decision: the RECALL lens (docs) passes 1 — a query naming a - // "readme" / "report" / "paired table" should be able to hit the doc whose PATH says exactly that, and - // bench/recalleval/ is the instrument that measured the +0.03 lenient-MRR / doc-sibling recovery this - // buys (2026-08-03, gate: test/recallevalcheck.sh). The CODE lenses (--for and friends) still pass 0: - // a nonzero default THERE requires the pre-registered locbench acceptance gate - // (bench/locbench/results/r3_pathtok/PREREG.md), unchanged. RIPWIRE_PATHTOK_W overrides either default - // for calibration sweeps only. Paths need no file text, so the pass sits before the branch below and - // runs identically over the scan and persisted-stats paths — postings parity holds by construction and - // the cache format is untouched. - // - // R-R RANKING (2026-08-25): the scanned string is the ROOT-RELATIVE VIEW, never ing.files[f] itself, - // which stays absolute because the emission lane proved it must (g.canonId, Regression::key, every - // pathQualifiedKey and the ingest cache's relForHash compare all key off it). Scanning it verbatim indexed - // every directory ABOVE the corpus as corpus vocabulary — and a directory that spelled a query word - // then matched EVERY document and collapsed that word's idf — so two clones of ONE commit at different - // checkout depths ranked --recall differently: 11 of 42 frozen queries reordered, 5 of them returning a - // different SET of documents (registered + measured in docs/EVALS.md; test/recallrankdepthcheck.sh). - // - // A VIEW, not a move — and the same helper recall.h PRINTS the separator path with, so the scored and - // the printed spelling of a file cannot disagree. rootRelativeUri(p, "") returns p bar a leading "./", - // exactly what a relative-root run already scanned, which is why this is a CONVERGENCE onto the - // already-invariant `ripwire .` rather than a new ranking opinion. Multi-root passes no prefix: - // ing.files already hold "<label>/<root-relative>". +// pass 1.5 — path field (×kwPath): the symbol's file path scanned through the SAME state machine. +// pathFieldDefaultW is the CALLER's lens decision: the RECALL lens (docs) passes 1 — a query naming a +// "readme" / "report" / "paired table" should be able to hit the doc whose PATH says exactly that, and +// bench/recalleval/ is the instrument that measured the +0.03 lenient-MRR / doc-sibling recovery this +// buys (2026-08-03, gate: test/recallevalcheck.sh). The CODE lenses (--for and friends) still pass 0: +// a nonzero default THERE requires the pre-registered locbench acceptance gate +// (bench/locbench/results/r3_pathtok/PREREG.md), unchanged. RIPWIRE_PATHTOK_W overrides either default +// for calibration sweeps only. Paths need no file text, so the pass sits before the pass-2 branch split and +// runs identically over the scan and persisted-stats paths — postings parity holds by construction and +// the cache format is untouched. +// +// R-R RANKING (2026-08-25): the scanned string is the ROOT-RELATIVE VIEW, never ing.files[f] itself, +// which stays absolute because the emission lane proved it must (g.canonId, Regression::key, every +// pathQualifiedKey and the ingest cache's relForHash compare all key off it). Scanning it verbatim indexed +// every directory ABOVE the corpus as corpus vocabulary — and a directory that spelled a query word +// then matched EVERY document and collapsed that word's idf — so two clones of ONE commit at different +// checkout depths ranked --recall differently: 11 of 42 frozen queries reordered, 5 of them returning a +// different SET of documents (registered + measured in docs/EVALS.md; test/recallrankdepthcheck.sh). +// +// A VIEW, not a move — and the same helper recall.h PRINTS the separator path with, so the scored and +// the printed spelling of a file cannot disagree. rootRelativeUri(p, "") returns p bar a leading "./", +// exactly what a relative-root run already scanned, which is why this is a CONVERGENCE onto the +// already-invariant `ripwire .` rather than a new ranking opinion. Multi-root passes no prefix: +// ing.files already hold "<label>/<root-relative>". +inline void addPathField( LexTfTable& table, const IngestResult& ing, int kwPath, std::string_view pathRootPrefix ) +{ + if( kwPath <= 0 ) { - int kwPath = pathFieldDefaultW; - if( const std::optional<int> pathTokW = envKnob<int>( "RIPWIRE_PATHTOK_W" ) ) - { - kwPath = std::clamp( *pathTokW, 0, 8 ); - } - if( kwPath > 0 ) + return; + } + for( std::size_t i = 0; i < ing.symbols.size(); ++i ) + { + if( const std::uint32_t f = ing.symbols[i].fileId; f < ing.files.size() ) { - for( std::size_t i = 0; i < S; ++i ) - { - if( const std::uint32_t f = ing.symbols[i].fileId; f < ing.files.size() ) - { - scanField( i, rw::sarif::rootRelativeUri( ing.files[f], pathRootPrefix ), kwPath ); - } - } + table.addField( i, rw::sarif::rootRelativeUri( ing.files[f], pathRootPrefix ), kwPath ); } } +} - // pass 1.6 — LB-3 arm B: basename-only field (×kwBase). The r3_pathtok retry, narrowed per that - // round's own rejection note (bench/locbench/results/r3_pathtok/PREREG.md): FULL paths lost - // held-out to generic-directory noise, so only the basename is scanned, and the scan is amortized - // per FILE (each basename tokenized once, its row added per symbol) honoring r3's "amortize - // first". Needs no file text → runs before the pass-2 branch split; parity and the cache format - // untouched. RIPWIRE_BASENAME_W (0..8) overrides basenameFieldDefaultW; a nonzero shipped default - // requires the LB-3 acceptance verdict (gate: test/lb3namecheck.sh). - // - // R-R: takes the same root-relative view as pass 1.5. PROVABLY a no-op here — the basename is whatever - // follows the last '/', which the root prefix cannot change — and applied anyway so the two path passes - // cannot drift apart. One reading of ing.files[f], one rule; a future reader who changes one pass finds - // the other already agreeing rather than discovering half the path tokenization was still absolute. +// pass 1.6 — LB-3 arm B: basename-only field (×kwBase). The r3_pathtok retry, narrowed per that +// round's own rejection note (bench/locbench/results/r3_pathtok/PREREG.md): FULL paths lost +// held-out to generic-directory noise, so only the basename is scanned, and the scan is amortized +// per FILE (each basename tokenized once, its row added per symbol) honoring r3's "amortize +// first". Needs no file text → runs before the pass-2 branch split; parity and the cache format +// untouched. RIPWIRE_BASENAME_W (0..8) overrides basenameFieldDefaultW; a nonzero shipped default +// requires the LB-3 acceptance verdict (gate: test/lb3namecheck.sh). +// +// R-R: takes the same root-relative view as pass 1.5. PROVABLY a no-op here — the basename is whatever +// follows the last '/', which the root prefix cannot change — and applied anyway so the two path passes +// cannot drift apart. One reading of ing.files[f], one rule; a future reader who changes one pass finds +// the other already agreeing rather than discovering half the path tokenization was still absolute. +inline void addBasenameField( LexTfTable& table, const IngestResult& ing, int kwBase, std::string_view pathRootPrefix ) +{ + if( kwBase <= 0 ) { - int kwBase = basenameFieldDefaultW; - if( const std::optional<int> baseW = envKnob<int>( "RIPWIRE_BASENAME_W" ) ) - { - kwBase = std::clamp( *baseW, 0, 8 ); - } - if( kwBase > 0 ) + return; + } + const std::size_t fileCount = ing.files.size(); + std::vector<int> fileTf( fileCount * table.stride, 0 ); + std::vector<int> fileWt( fileCount, 0 ); + for( std::size_t f = 0; f < fileCount; ++f ) + { + const std::string_view path = rw::sarif::rootRelativeUri( ing.files[f], pathRootPrefix ); + const std::size_t cut = path.find_last_of( '/' ); + const std::string_view base = cut == std::string_view::npos ? path : path.substr( cut + 1 ); + table.scanTextInto( fileTf.data() + f * table.stride, fileWt[f], base, kwBase ); + } + for( std::size_t i = 0; i < ing.symbols.size(); ++i ) + { + if( const std::uint32_t f = ing.symbols[i].fileId; f < fileCount && fileWt[f] != 0 ) { - const std::size_t fileCount = ing.files.size(); - std::vector<int> fileTf( fileCount * matchCount, 0 ); - std::vector<int> fileWt( fileCount, 0 ); - for( std::size_t f = 0; f < fileCount; ++f ) - { - const std::string_view path = rw::sarif::rootRelativeUri( ing.files[f], pathRootPrefix ); - const std::size_t cut = path.find_last_of( '/' ); - const std::string_view base = cut == std::string_view::npos ? path : path.substr( cut + 1 ); - scanTextInto( fileTf.data() + f * matchCount, fileWt[f], base, kwBase ); - } - for( std::size_t i = 0; i < S; ++i ) - { - const std::uint32_t f = ing.symbols[i].fileId; - if( f >= fileCount || fileWt[f] == 0 ) - { - continue; - } - int* const tfRow = tfFlat.data() + i * matchCount; - const int* const fRow = fileTf.data() + std::size_t( f ) * matchCount; - for( std::size_t m = 0; m < matchCount; ++m ) - { - tfRow[m] += fRow[m]; - } - dl[i] += fileWt[f]; - } + table.addFileField( i, fileTf.data() + std::size_t( f ) * table.stride, fileWt[f] ); } } +} - // per-variant doc/body document frequency, measured by whichever pass-2 branch runs — the guard's - // admission signal (rung R3). Both branches accumulate the same integers, so admission is identical. - const std::size_t variantCount = matchCount - uniqueCount; - std::vector<std::uint32_t> dfVariant( variantCount, 0u ); - - // pass 2 — doc-comment (×kwDoc) + body (×kwBody) evidence. - // - // B0.2 (R1 hypothesis #1): a RICH ingest carries per-symbol weighted subtoken statistics built ONCE at - // parse/cache time — from the SAME byte spans through the SAME state machine — so the per-query work - // here is pure lookups: no file re-read, no corpus re-tokenize (the O(corpus-bytes) per-query term is - // gone). The stored dl/tf values are the exact integers the scan branch would accumulate, and the float - // scoring loop below is shared, so the two branches are byte-identical (test/postingscheck.sh). - if( ing.hasLexStats && ing.lexTokenRowOffsets.size() == S + 1 && ing.lexDocBodyDl.size() == S ) - { - PROFILE_SCOPE_DESCRIBE( "lexical: pass 2 via persisted subtoken stats (cached tf/dl, no corpus re-tokenize)" ); - - // dl first: BM25 length normalization needs EVERY doc's weighted length whether or not it matches - // the query (avgdl sums them all), so this runs unconditionally — exact stored integers. - for( std::size_t i = 0; i < S; ++i ) - { - dl[i] += int( ing.lexDocBodyDl[i] ); - } - - // query-token hashes — the same normalized-lowercase hash index time used, over the FULL match - // table (exact tokens + LB-3 stem variants), each hash mapped to its own tf ROW (a variant's tf - // lands in its provisional column; the post-pass-2 guard decides whether it folds into the - // original token's row) — the same row targeting the scan branch's table walk applies. - // try_emplace keeps the FIRST entry on the astronomically-unlikely 64-bit collision between two - // DISTINCT table strings, so both transfer strategies below agree deterministically. - std::vector<std::uint64_t> matchHash( matchCount ); - HashMap<std::uint64_t, std::uint32_t> rowIndexOfHash; - rowIndexOfHash.reserve( matchCount ); - for( std::size_t m = 0; m < matchCount; ++m ) - { - matchHash[m] = lexSubtokenHash( matchToks[m].tok.data(), matchToks[m].tok.size() ); - rowIndexOfHash.try_emplace( matchHash[m], std::uint32_t( m ) ); - } - - // B0.1 per-file pre-filter: skip a whole file's tf walks when its 512-bit signature excludes every - // query subtoken — no false negatives (dl above is already complete; tf for such a file is provably - // zero), and a false positive just walks the cheap stats rows. Symbol ids are file-contiguous - // (assigned in fileId,line,name order), so the test amortizes to one signature check per file. - const bool useFileSig = ing.lexFileSig.size() == ing.files.size() * kLexFileSigWords; - std::uint32_t lastFileId = kNoNode; - bool lastFileMayMatch = true; - for( std::size_t i = 0; i < S; ++i ) - { - const std::uint32_t rowBegin = ing.lexTokenRowOffsets[i]; - const std::uint32_t rowEnd = ing.lexTokenRowOffsets[ i + 1 ]; - if( rowBegin == rowEnd ) - { - continue; // no doc/body tokens → nothing to transfer - } +// Which pass-2 source an ingest offers: B0.2 (R1 hypothesis #1) — a RICH ingest carries per-symbol weighted subtoken +// statistics built ONCE at parse/cache time, from the SAME byte spans through the SAME state machine, so the per-query +// work is pure lookups: no file re-read, no corpus re-tokenize. The stored dl/tf values are the exact integers the scan +// would accumulate, and the float scoring is shared, so the two sources are byte-identical (test/postingscheck.sh). +inline bool hasPersistedLexStats( const IngestResult& ing ) noexcept +{ + const std::size_t S = ing.symbols.size(); + return ing.hasLexStats && ing.lexTokenRowOffsets.size() == S + 1 && ing.lexDocBodyDl.size() == S; +} - // one membership probe per FILE against the query's subtoken bits (B0.1) - if( const std::uint32_t f = ing.symbols[i].fileId; useFileSig && f < ing.files.size() ) - { - if( f != lastFileId ) - { - lastFileId = f; - lastFileMayMatch = false; - const std::uint64_t* sig = ing.lexFileSig.data() + std::size_t( f ) * kLexFileSigWords; - for( std::size_t m = 0; m < matchCount && !lastFileMayMatch; ++m ) - { - if( sig[lexSigWord( matchHash[m] )] & lexSigBit( matchHash[m] ) ) - { - lastFileMayMatch = true; - } - } - } - if( !lastFileMayMatch ) - { - continue; - } - } +// pass 2 from persisted stats — doc-comment + body evidence as stored integers. Returns, per stem variant, the units +// whose stored doc/body rows carry it (the R3 guard's admission signal; stored rows hold each hash once → one bump per +// unit). The match rows are reached by the same normalized-lowercase hash index time used, over the FULL match table +// (exact tokens + LB-3 stem variants), each hash mapped to its own tf ROW — the same row targeting the scan applies. +// try_emplace keeps the FIRST entry on the astronomically-unlikely 64-bit collision between two DISTINCT table strings, +// so both transfer strategies agree deterministically. +inline std::vector<std::uint32_t> addDocBodyFromPersistedStats( LexTfTable& table, const IngestResult& ing ) +{ + PROFILE_SCOPE_DESCRIBE( "lexical: pass 2 via persisted subtoken stats (cached tf/dl, no corpus re-tokenize)" ); + const std::size_t S = ing.symbols.size(); + const std::size_t matchCount = table.stride; + const std::size_t uniqueCount = table.uniqueCount; + std::vector<std::uint32_t> dfVariant( table.variantCount(), 0u ); + + // dl first: BM25 length normalization needs EVERY doc's weighted length whether or not it matches + // the query (avgdl sums them all), so this runs unconditionally — exact stored integers. + for( std::size_t i = 0; i < S; ++i ) + { + table.addStoredLength( i, int( ing.lexDocBodyDl[i] ) ); + } - // exact tf transfer — walk whichever side is smaller: probe the query map per stored token, or - // binary-search each DISTINCT query hash in the symbol's sorted row. Identical sums either way - // (the map dedupes hash-colliding query tokens for both strategies). - int* const tfRow = tfFlat.data() + i * matchCount; - const std::uint64_t* rowHash = ing.lexTokenHashes.data(); - if( std::size_t( rowEnd - rowBegin ) <= matchCount * 8 ) // ~log2(row) probes vs one map probe per entry - { - for( std::uint32_t e = rowBegin; e < rowEnd; ++e ) - { - if( const auto it = rowIndexOfHash.find( rowHash[e] ); it != rowIndexOfHash.end() ) - { - tfRow[ it->second ] += int( ing.lexTokenTfs[e] ); - if( it->second >= uniqueCount ) - { - ++dfVariant[ it->second - uniqueCount ]; // stored rows hold each hash once → one df bump per symbol - } - } - } - } - else - { - for( const auto& [ hash, m ] : rowIndexOfHash ) // iteration order is score-irrelevant: rows are disjoint per HASH (+= commutes) - { - const std::uint64_t* lo = rowHash + rowBegin; - const std::uint64_t* hi = rowHash + rowEnd; - if( const std::uint64_t* it = std::lower_bound( lo, hi, hash ); it != hi && *it == hash ) - { - tfRow[m] += int( ing.lexTokenTfs[ std::size_t( it - rowHash ) ] ); - if( m >= uniqueCount ) - { - ++dfVariant[ m - uniqueCount ]; - } - } - } - } - } + std::vector<std::uint64_t> matchHash( matchCount ); + HashMap<std::uint64_t, std::uint32_t> rowIndexOfHash; + rowIndexOfHash.reserve( matchCount ); + for( std::size_t m = 0; m < matchCount; ++m ) + { + matchHash[m] = lexSubtokenHash( table.matchToks[m].tok.data(), table.matchToks[m].tok.size() ); + rowIndexOfHash.try_emplace( matchHash[m], std::uint32_t( m ) ); } - else + const auto addStoredTerm = [ & ]( std::size_t i, std::uint32_t m, std::uint32_t storedTf ) { - // scan branch (lean ingests, --no-cache lean verbs, multi-root merges, stubs): CSR file→symbol - // index, then stream ONE file at a time touching only that file's symbols — peak memory is a single - // file's text, not the whole corpus held at once (symbol order within a file is irrelevant: integer - // counts commute exactly). - const std::size_t fileCount = ing.files.size(); - std::vector<std::uint32_t> fileRowOffsets( fileCount + 1, 0 ); - for( std::size_t i = 0; i < S; ++i ) + table.addStoredTf( i, m, int( storedTf ) ); + if( m >= uniqueCount ) { - if( ing.symbols[i].fileId < fileCount ) - { - ++fileRowOffsets[ing.symbols[i].fileId + 1]; - } + ++dfVariant[ m - uniqueCount ]; // stored rows hold each hash once → one df bump per symbol } - for( std::size_t f = 0; f < fileCount; ++f ) + }; + + // B0.1 per-file pre-filter: skip a whole file's tf walks when its 512-bit signature excludes every + // query subtoken — no false negatives (dl above is already complete; tf for such a file is provably + // zero), and a false positive just walks the cheap stats rows. Symbol ids are file-contiguous + // (assigned in fileId,line,name order), so the test amortizes to one signature check per file. + const bool useFileSig = ing.lexFileSig.size() == ing.files.size() * kLexFileSigWords; + const auto fileMayHoldTerm = [ & ]( std::uint32_t f ) + { + const std::uint64_t* sig = ing.lexFileSig.data() + std::size_t( f ) * kLexFileSigWords; + return std::ranges::any_of( matchHash, [ sig ]( std::uint64_t h ) { return ( sig[ lexSigWord( h ) ] & lexSigBit( h ) ) != 0; } ); + }; + std::uint32_t lastFileId = kNoNode; + bool lastFileMayMatch = true; + for( std::size_t i = 0; i < S; ++i ) + { + const std::uint32_t rowBegin = ing.lexTokenRowOffsets[i]; + const std::uint32_t rowEnd = ing.lexTokenRowOffsets[ i + 1 ]; + const std::uint32_t f = ing.symbols[i].fileId; + const bool sigTests = useFileSig && f < ing.files.size(); + if( rowBegin == rowEnd ) { - fileRowOffsets[f + 1] += fileRowOffsets[f]; + continue; // no doc/body tokens → nothing to transfer } - std::vector<std::uint32_t> fileSymbolIds( fileRowOffsets[ fileCount ] ); + if( sigTests && f != lastFileId ) { - std::vector<std::uint32_t> writeCursor( fileRowOffsets.begin(), fileRowOffsets.end() - 1 ); - for( std::size_t i = 0; i < S; ++i ) - { - if( ing.symbols[i].fileId < fileCount ) - { - fileSymbolIds[writeCursor[ing.symbols[i].fileId]++] = std::uint32_t( i ); - } - } + lastFileId = f; // one membership probe per FILE (B0.1) + lastFileMayMatch = fileMayHoldTerm( f ); } - // Files stream across a small worker pool: each worker holds ONE file's text at a time, and a file's - // symbols are touched only by the worker that claimed the file — every dl[i] / tfFlat row has exactly - // ONE writer (no locks needed). Determinism: all pooled writes are exact integer counts and the float - // scoring below stays single-threaded in doc order, so worker scheduling cannot change a byte of - // output (no cross-doc float reductions — the det-gate rule). - // per-(file, variant) doc/body df tallies — a file's tally has exactly ONE writer (the worker - // that claimed the file), merged single-threaded below in file order; integer sums commute, so - // worker scheduling cannot change the totals (the det-gate rule). Sized only when armed. - std::vector<std::uint32_t> dfPerFile( variantCount > 0 ? fileCount * variantCount : 0, 0u ); - const auto scanFileSymbols = [ & ]( std::size_t f, const std::string& src ) - { - const std::string_view sv = src; - std::vector<int> variantTfBefore( variantCount ); - for( std::uint32_t r = fileRowOffsets[f]; r < fileRowOffsets[ f + 1 ]; ++r ) - { - const std::size_t i = fileSymbolIds[r]; - const Symbol& s = ing.symbols[i]; - const std::size_t bodyStart = std::min<std::size_t>( s.sigStartByte, src.size() ); - const std::size_t end = std::min<std::size_t>( s.endByte, src.size() ); - const std::size_t docStart = docCommentStart( src, bodyStart ); - if( variantCount > 0 ) // snapshot the variant columns: df must count ONLY - { // pass-2 (doc/body) growth, never pass-1 name/callee tf - const int* tfRow = tfFlat.data() + i * matchCount + uniqueCount; - std::copy( tfRow, tfRow + variantCount, variantTfBefore.begin() ); - } - if( bodyStart > docStart ) - { - scanField( i, sv.substr( docStart, bodyStart - docStart ), kwDoc ); - } - if( end > bodyStart ) - { - scanField( i, sv.substr( bodyStart, end - bodyStart ), kwBody ); - } - if( variantCount > 0 ) - { - const int* tfRow = tfFlat.data() + i * matchCount + uniqueCount; - for( std::size_t v = 0; v < variantCount; ++v ) - { - if( tfRow[v] > variantTfBefore[v] ) - { - ++dfPerFile[ f * variantCount + v ]; - } - } - } - } - }; - std::atomic<std::size_t> nextFileIndex { 0 }; - const auto fileWorker = [ & ]() noexcept - { - try - { - std::string loadedText; - for( std::size_t f = nextFileIndex.fetch_add( 1 ); f < fileCount; f = nextFileIndex.fetch_add( 1 ) ) - { - if( fileRowOffsets[f] == fileRowOffsets[f + 1] ) - { - continue; // no symbols in this file → skip - } - const std::string* src = lexicalScanText( ing, f, loadedText ); - if( src != nullptr && !src->empty() ) - { - scanFileSymbols( f, *src ); // unreadable/empty → degrade (skip), as before - } - } - } - catch( ... ) // a throw escaping a worker thread is std::terminate — degrade to partial counts instead - { - rw::emitRaw( stderr, "ripwire: lexical scan worker degraded (exception swallowed)\n" ); - } - }; - const std::size_t hwThreadCount = std::thread::hardware_concurrency(); - const std::size_t workerCount = std::min( { hwThreadCount ? hwThreadCount : 1, fileCount ? fileCount : 1, std::size_t( 16 ) } ); - if( workerCount <= 1 ) + if( sigTests && !lastFileMayMatch ) { - fileWorker(); + continue; } - else + + // exact tf transfer — walk whichever side is smaller: probe the query map per stored token, or + // binary-search each DISTINCT query hash in the symbol's sorted row. Identical sums either way + // (the map dedupes hash-colliding query tokens for both strategies). + const std::uint64_t* rowHash = ing.lexTokenHashes.data(); + if( std::size_t( rowEnd - rowBegin ) <= matchCount * 8 ) // ~log2(row) probes vs one map probe per entry { - // symmetric bare scope: workers live exactly as long as the pooled scan - std::vector<std::thread> workers; - workers.reserve( workerCount ); - for( std::size_t w = 0; w < workerCount; ++w ) - { - workers.emplace_back( fileWorker ); - } - for( std::thread& worker : workers ) + for( std::uint32_t e = rowBegin; e < rowEnd; ++e ) { - worker.join(); + if( const auto it = rowIndexOfHash.find( rowHash[e] ); it != rowIndexOfHash.end() ) + { + addStoredTerm( i, it->second, ing.lexTokenTfs[e] ); + } } + continue; } - for( std::size_t f = 0; f < fileCount && variantCount > 0; ++f ) // deterministic df merge, file order + for( const auto& [ hash, m ] : rowIndexOfHash ) // iteration order is score-irrelevant: rows are disjoint per HASH (+= commutes) { - for( std::size_t v = 0; v < variantCount; ++v ) + const std::uint64_t* lo = rowHash + rowBegin; + const std::uint64_t* hi = rowHash + rowEnd; + if( const std::uint64_t* it = std::lower_bound( lo, hi, hash ); it != hi && *it == hash ) { - dfVariant[v] += dfPerFile[ f * variantCount + v ]; + addStoredTerm( i, m, ing.lexTokenTfs[ std::size_t( it - rowHash ) ] ); } } } + return dfVariant; +} + +// pass 2 by scanning (lean ingests, --no-cache lean verbs, multi-root merges, stubs) — doc-comment (×kLexWeightDoc) + +// body (×kLexWeightBody) evidence, streamed ONE file at a time touching only that file's symbols: peak memory is a single +// file's text, not the whole corpus held at once (symbol order within a file is irrelevant: integer counts commute +// exactly). Returns the same per-variant doc/body df the persisted branch returns, from the scan's own counts. +// +// Files stream across a small worker pool: each worker holds ONE file's text at a time, and a file's symbols are touched +// only by the worker that claimed the file — every dl[i] / tf row has exactly ONE writer (no locks needed). Determinism: +// all pooled writes are exact integer counts and the float scoring stays single-threaded in doc order, so worker +// scheduling cannot change a byte of output (no cross-doc float reductions — the det-gate rule). The per-(file, variant) +// df tallies likewise have ONE writer each and merge single-threaded in file order. +inline std::vector<std::uint32_t> scanDocBodyFields( LexTfTable& table, const IngestResult& ing ) +{ + const std::size_t fileCount = ing.files.size(); + const std::size_t variantCount = table.variantCount(); - // ── IDF-guard admission + fold (rung R3) — runs identically after EITHER pass-2 branch ────────── - // A variant whose doc/body document frequency is corpus-common (df > max(8, S/64)) is discarded: - // its provisional column is simply never folded, so its evidence — name, callee, path, basename, - // doc, body — vanishes without touching dl (document length counts all subtokens scanned, never - // matches). An admitted (corpus-rare) variant folds its column into the original token's row, the - // exact integers the un-guarded arm would have accumulated there. The array then shrinks back to - // uniqueCount stride, and everything below — corpus stats, both scoring branches — is untouched - // code operating on the historical layout. - if( variantCount > 0 ) + const SymbolsByFile symbolsOfFile = symbolsByFileInIdOrder( ing, []( const Symbol& ) { return true; } ); + + std::vector<std::uint32_t> dfPerFile( variantCount > 0 ? fileCount * variantCount : 0, 0u ); // sized only when armed + const auto scanFileSymbols = [ & ]( std::size_t f, const std::string& src ) { - const std::uint32_t sOver64 = std::uint32_t( allS / 64 ); // the ranked corpus: an unranked unit does not widen the cap - const std::uint32_t variantCap = sOver64 > 8u ? sOver64 : 8u; - if( std::getenv( "RIPWIRE_QSTEM_DEBUG" ) != nullptr ) + const std::string_view sv = src; + std::vector<int> variantTfBefore( variantCount ); + for( const NodeId i : symbolsOfFile[f] ) { - for( std::size_t v = 0; v < variantCount; ++v ) + const Symbol& s = ing.symbols[i]; + const std::size_t bodyStart = std::min<std::size_t>( s.sigStartByte, src.size() ); + const std::size_t end = std::min<std::size_t>( s.endByte, src.size() ); + const std::size_t docStart = docCommentStart( src, bodyStart ); + const int* const variantTf = table.row( i ) + table.uniqueCount; + // snapshot the variant columns: df must count ONLY pass-2 (doc/body) growth, never pass-1 name/callee tf + std::copy( variantTf, variantTf + variantCount, variantTfBefore.begin() ); + if( bodyStart > docStart ) { - rw::emitTo( stderr, "qstem-guard: \"{}\" df={} cap={} {}\n", - matchToks[ uniqueCount + v ].tok.c_str(), dfVariant[v], variantCap, - dfVariant[v] <= variantCap ? "admitted" : "rejected" ); + table.addField( i, sv.substr( docStart, bodyStart - docStart ), kLexWeightDoc ); } - } - std::vector<int> tfFolded( S * uniqueCount, 0 ); - for( std::size_t i = 0; i < S; ++i ) - { - const int* const src = tfFlat.data() + i * matchCount; - int* const dst = tfFolded.data() + i * uniqueCount; - for( std::size_t u = 0; u < uniqueCount; ++u ) + if( end > bodyStart ) { - dst[u] = src[u]; + table.addField( i, sv.substr( bodyStart, end - bodyStart ), kLexWeightBody ); } for( std::size_t v = 0; v < variantCount; ++v ) { - if( dfVariant[v] <= variantCap ) - { - dst[ matchToks[ uniqueCount + v ].u ] += src[ uniqueCount + v ]; - } + dfPerFile[ f * variantCount + v ] += variantTf[v] > variantTfBefore[v] ? 1u : 0u; } } - tfFlat = std::move( tfFolded ); - if( marginArmed ) + }; + std::atomic<std::size_t> nextFileIndex { 0 }; + const auto fileWorker = [ & ]() noexcept + { + try { - // fold nameDf the SAME way tf just folded, so the margin test below sees one row per unique - // token on either arm. A doc carrying both the exact token and an admitted variant in its - // name is counted twice, so a folded nameDf is a CEILING, not a count — stated rather than - // hidden. It matters only when RIPWIRE_QSTEM is also armed, which ships off. - for( std::size_t v = 0; v < variantCount; ++v ) + std::string loadedText; + for( std::size_t f = nextFileIndex.fetch_add( 1 ); f < fileCount; f = nextFileIndex.fetch_add( 1 ) ) { - if( dfVariant[v] <= variantCap ) + if( symbolsOfFile[f].empty() ) { - nameDf[ matchToks[ uniqueCount + v ].u ] += nameDf[ uniqueCount + v ]; + continue; // no symbols in this file → skip + } + const std::string* src = lexicalScanText( ing, f, loadedText ); + if( src != nullptr && !src->empty() ) + { + scanFileSymbols( f, *src ); // unreadable/empty → degrade (skip), as before } } } + catch( ... ) // a throw escaping a worker thread is std::terminate — degrade to partial counts instead + { + rw::emitRaw( stderr, "ripwire: lexical scan worker degraded (exception swallowed)\n" ); + } + }; + const std::size_t hwThreadCount = std::thread::hardware_concurrency(); + const std::size_t workerCount = std::min( { hwThreadCount ? hwThreadCount : 1, fileCount ? fileCount : 1, std::size_t( 16 ) } ); + if( workerCount <= 1 ) + { + fileWorker(); + } + else + { + // symmetric bare scope: workers live exactly as long as the pooled scan + std::vector<std::thread> workers; + workers.reserve( workerCount ); + for( std::size_t w = 0; w < workerCount; ++w ) + { + workers.emplace_back( fileWorker ); + } + for( std::thread& worker : workers ) + { + worker.join(); + } } - // ── L-W: the term evidence, read off the FINAL tf rows (uniqueCount stride, every field, the fold applied) - // — one S×U integer scan, the same "tf > 0" fact dfreq counts in both scoring branches below. - if( evidenceOut ) + std::vector<std::uint32_t> dfVariant( variantCount, 0u ); + for( std::size_t f = 0; f < fileCount && variantCount > 0; ++f ) // deterministic df merge, file order { - evidenceOut->termsSeenTotal = dedup.uniqueSeenTotal; - evidenceOut->termsCapped = dedup.capped; - evidenceOut->terms.assign( uniqueToks.begin(), uniqueToks.end() ); - evidenceOut->df.assign( uniqueCount, 0u ); - evidenceOut->anyMask.assign( S * evidenceWords, 0u ); - evidenceOut->symbolCount = S; - evidenceOut->statsCount = statsS; - for( std::size_t i = 0; i < S; ++i ) - { - const int* const row = tfFlat.data() + i * uniqueCount; - std::uint64_t* words = evidenceOut->anyMask.data() + i * evidenceWords; - const int w = statsWeight( i ); - for( std::size_t u = 0; u < uniqueCount && !isUnranked( i ); ++u ) - { - if( row[u] > 0 ) - { - evidenceOut->df[u] += std::uint32_t( w ); - words[ u / 64 ] |= std::uint64_t( 1 ) << ( u % 64 ); - } - } + for( std::size_t v = 0; v < variantCount; ++v ) + { + dfVariant[v] += dfPerFile[ f * variantCount + v ]; } } + return dfVariant; +} + +// ── IDF-guard admission (rung R3) — the same decision after EITHER pass-2 source ───────────────────────── +// A variant whose doc/body document frequency is corpus-common (df > max(8, rankedCount/64)) is rejected; a corpus-rare +// one is admitted and folds into its original token's row — the exact integers the un-guarded arm would have +// accumulated there. The cap reads the ranked corpus: an unranked unit does not widen it. Returns one flag per variant +// (empty when disarmed); RIPWIRE_QSTEM_DEBUG prints each verdict on stderr. +inline std::vector<char> admitRareStemVariants( const std::vector<std::uint32_t>& dfVariant, std::size_t rankedCount, + const LexTfTable& table ) +{ + const std::uint32_t sOver64 = std::uint32_t( rankedCount / 64 ); + const std::uint32_t variantCap = sOver64 > 8u ? sOver64 : 8u; + std::vector<char> admitted( dfVariant.size(), 0 ); + for( std::size_t v = 0; v < dfVariant.size(); ++v ) + { + admitted[v] = dfVariant[v] <= variantCap ? 1 : 0; + } + const bool debug = !dfVariant.empty() && std::getenv( "RIPWIRE_QSTEM_DEBUG" ) != nullptr; + for( std::size_t v = 0; v < dfVariant.size() && debug; ++v ) + { + rw::emitTo( stderr, "qstem-guard: \"{}\" df={} cap={} {}\n", table.matchToks[ table.uniqueCount + v ].tok.c_str(), dfVariant[v], + variantCap, admitted[v] != 0 ? "admitted" : "rejected" ); + } + return admitted; +} - // ── SIRA term margin — the decision (docs/EVALS.md, PRE-REGISTERED 2026-09-05) ──────────────────── - // A query term earns its contribution by SEPARATING the target from corpus-level confusers, not by - // looking relevant. BM25's own idf says when that stops being true: at df = S/2, - // idf = ln( (S-n+0.5)/(n+0.5) + 1 ) is exactly ln 2 — one bit, the point at which observing the term - // halves the candidate space. Above it the term carries less than a bit and hands its tf mass to - // whichever document recites it most, which on a natural-language query ("how does the csrf token - // get validated") is the prose, not the answer. This ranker has no query-side stopword list, and a - // corpus-statistics margin test is that idea derived from the tree in front of it rather than - // written down in English — a Rust corpus's `mut` and a Python corpus's `self` are caught by the - // same arithmetic that catches `the`, with nothing language-specific anywhere. - // - // TWO FIELDS, because ONE field is how the LB-1 negative happened. That round's IDF floor read - // document frequency alone and deleted `module` — the truth's own name carrier — flipping a hit to - // a miss (docs/EVALS.md §7). A term that names between 1 and S/2 symbols separates on the field - // this scorer weights highest, whatever its body mass says, so `separatesName` keeps it. A term - // naming NOTHING has no name margin to appeal to; a term naming MORE than half the corpus has no - // margin there either. - // - // THE SOLE-ANCHOR GUARD, and the trap inside it. Suppression is skipped entirely unless a PRESENT, - // non-suppressed term survives it — otherwise a query whose every term is corpus-saturating scores - // zero everywhere, which is the catastrophic shape, not a ranking. "Present" is load-bearing and is - // the subtle half: an ABSENT term (df = 0) has the LARGEST idf in the whole scheme, - // ln( (S+0.5)/0.5 + 1 ), so an implementation that asks "did a higher-idf term survive?" without - // excluding absent terms reads a typo beside the anchor as excellent evidence and drops the anchor. - // Gated: test/termmargincheck.sh arms (b), (c) and (d), each red before this code existed. - // - // KEPT OR DROPPED, never fractionally weighted. A kept term's contribution is the historical - // expression evaluated in the historical order — bit-identical, not merely close — and a dropped - // term's impact cap is 0, so the MaxScore bound stays a valid bound and the pruned and exhaustive - // branches stay byte-identical to each other. `dl` is untouched: a suppressed term's EVIDENCE - // vanishes, the document's length does not, exactly the posture the R3 variant guard already takes. - std::vector<char> termKept( uniqueCount, 1 ); - if( marginArmed ) +// fold nameDf the SAME way the tf table folds, so the margin test sees one row per unique token on either arm. A doc +// carrying both the exact token and an admitted variant in its name is counted twice, so a folded nameDf is a CEILING, +// not a count — stated rather than hidden. It matters only when RIPWIRE_QSTEM is also armed, which ships off. +inline void foldAdmittedNameDf( std::vector<int>& nameDf, const std::vector<char>& admitted, const LexTfTable& table ) +{ + for( std::size_t v = 0; v < admitted.size() && !nameDf.empty(); ++v ) + { + nameDf[ table.matchToks[ table.uniqueCount + v ].u ] += admitted[v] != 0 ? nameDf[ table.uniqueCount + v ] : 0; + } +} + +// ── L-W: the term evidence, read off the FINAL tf rows (uniqueCount stride, every field, the fold applied) — one S×U +// integer scan, the same "tf > 0" fact the document frequency counts when scoring. (nameMask was captured in pass 1.) +inline void recordTermEvidence( LexTermEvidence& evidence, const LexTfTable& table, const LexCorpusRoles& roles, const DedupedQueryTerms& dedup ) +{ + const std::size_t S = table.dl.size(); + const std::size_t uniqueCount = table.uniqueCount; + const std::size_t evidenceWords = evidence.maskWords; + evidence.termsSeenTotal = dedup.uniqueSeenTotal; + evidence.termsCapped = dedup.capped; + evidence.terms.assign( dedup.uniqueToks.begin(), dedup.uniqueToks.end() ); + evidence.df.assign( uniqueCount, 0u ); + evidence.anyMask.assign( S * evidenceWords, 0u ); + evidence.symbolCount = S; + evidence.statsCount = roles.countedCount; + for( std::size_t i = 0; i < S; ++i ) { - // df in fixed doc order over the folded rows — the same integers both pass-2 branches produced - std::vector<int> dfMargin( uniqueCount, 0 ); - for( std::size_t i = 0; i < S; ++i ) + const int* const row = table.row( i ); + std::uint64_t* words = evidence.anyMask.data() + i * evidenceWords; + const int w = roles.statsWeight( i ); + for( std::size_t u = 0; u < uniqueCount && !roles.isUnranked( i ); ++u ) { - const int* const tfRow = tfFlat.data() + i * uniqueCount; - const int w = statsWeight( i ); - for( std::size_t u = 0; u < uniqueCount; ++u ) - { - dfMargin[u] += tfRow[u] > 0 ? w : 0; - } + evidence.df[u] += row[u] > 0 ? std::uint32_t( w ) : 0u; + words[ u / 64 ] |= row[u] > 0 ? std::uint64_t( 1 ) << ( u % 64 ) : 0u; } - // "separates" at k bits: idf_u >= k*ln2 ⇔ (S-n+0.5)/(n+0.5) + 1 >= 2^k ⇔ n <= (S+0.5)/2^k - 0.5, - // which at k = 1 is exactly n <= S/2. Evaluated in doubles from integer inputs, so it is a pure - // function of (S, n, k) and cannot vary run to run. - const double separationCut = ( double( statsS ) + 0.5 ) / std::exp2( double( marginBits ) ) - 0.5; - std::vector<char> suppressible( uniqueCount, 0 ); - std::size_t presentCount = 0, survivorCount = 0; + } +} + +// ── SIRA term margin — the decision (docs/EVALS.md, PRE-REGISTERED 2026-09-05) ──────────────────── +// A query term earns its contribution by SEPARATING the target from corpus-level confusers, not by +// looking relevant. BM25's own idf says when that stops being true: at df = S/2, +// idf = ln( (S-n+0.5)/(n+0.5) + 1 ) is exactly ln 2 — one bit, the point at which observing the term +// halves the candidate space. Above it the term carries less than a bit and hands its tf mass to +// whichever document recites it most, which on a natural-language query ("how does the csrf token +// get validated") is the prose, not the answer. This ranker has no query-side stopword list, and a +// corpus-statistics margin test is that idea derived from the tree in front of it rather than +// written down in English — a Rust corpus's `mut` and a Python corpus's `self` are caught by the +// same arithmetic that catches `the`, with nothing language-specific anywhere. +// +// TWO FIELDS, because ONE field is how the LB-1 negative happened. That round's IDF floor read +// document frequency alone and deleted `module` — the truth's own name carrier — flipping a hit to +// a miss (docs/EVALS.md §7). A term that names between 1 and S/2 symbols separates on the field +// this scorer weights highest, whatever its body mass says, so the name margin keeps it. A term +// naming NOTHING has no name margin to appeal to; a term naming MORE than half the corpus has no +// margin there either. +// +// THE SOLE-ANCHOR GUARD, and the trap inside it. Suppression is skipped entirely unless a PRESENT, +// non-suppressed term survives it — otherwise a query whose every term is corpus-saturating scores +// zero everywhere, which is the catastrophic shape, not a ranking. "Present" is load-bearing and is +// the subtle half: an ABSENT term (df = 0) has the LARGEST idf in the whole scheme, +// ln( (S+0.5)/0.5 + 1 ), so an implementation that asks "did a higher-idf term survive?" without +// excluding absent terms reads a typo beside the anchor as excellent evidence and drops the anchor. +// Gated: test/termmargincheck.sh arms (b), (c) and (d), each red before this code existed. +// +// KEPT OR DROPPED, never fractionally weighted. A kept term's contribution is the historical +// expression evaluated in the historical order — bit-identical, not merely close — and a dropped +// term's impact cap is 0, so the MaxScore bound stays a valid bound and the pruned and exhaustive +// modes stay byte-identical to each other. `dl` is untouched: a suppressed term's EVIDENCE +// vanishes, the document's length does not, exactly the posture the R3 variant guard already takes. +// +// Each present term gets ONE verdict, decided here; termKept and the RIPWIRE_TERMMARGIN_DEBUG lines both read it. +enum class TermMarginVerdict : std::uint8_t +{ + kAbsent, // df 0: contributes nothing, survives nothing + kDocSeparates, // kept: its document frequency alone is under the cut + kNameSeparates, // kept: it names between 1 and cut units (the LB-1 protection) + kSoleAnchor, // would be suppressed, but no present term survives — suppression withheld for the whole query + kSuppressed, +}; + +// Returns termKept per unique term: all 1 when the margin is disarmed (marginBits 0). +inline std::vector<char> judgeTermMargins( const LexTfTable& table, const LexCorpusRoles& roles, const std::vector<int>& nameDf, int marginBits, + const std::vector<std::string>& uniqueToks ) +{ + const std::size_t uniqueCount = table.uniqueCount; + std::vector<char> termKept( uniqueCount, 1 ); + if( marginBits <= 0 ) + { + return termKept; + } + // df in fixed doc order over the folded rows — the same integers both pass-2 sources produced + std::vector<int> dfMargin( uniqueCount, 0 ); + for( std::size_t i = 0; i < table.dl.size(); ++i ) + { + const int* const tfRow = table.row( i ); + const int w = roles.statsWeight( i ); for( std::size_t u = 0; u < uniqueCount; ++u ) { - if( dfMargin[u] == 0 ) - { - continue; // absent: contributes nothing, survives nothing - } - ++presentCount; - const bool separatesDoc = double( dfMargin[u] ) <= separationCut; - const bool separatesName = nameDf[u] > 0 && double( nameDf[u] ) <= separationCut; - suppressible[u] = ( !separatesDoc && !separatesName ) ? 1 : 0; - survivorCount += suppressible[u] == 0 ? 1 : 0; + dfMargin[u] += tfRow[u] > 0 ? w : 0; } - const bool applySuppression = survivorCount > 0; // the sole-anchor guard - for( std::size_t u = 0; u < uniqueCount; ++u ) + } + // "separates" at k bits: idf_u >= k*ln2 ⇔ (S-n+0.5)/(n+0.5) + 1 >= 2^k ⇔ n <= (S+0.5)/2^k - 0.5, + // which at k = 1 is exactly n <= S/2. Evaluated in doubles from integer inputs, so it is a pure + // function of (S, n, k) and cannot vary run to run. + const double separationCut = ( double( roles.countedCount ) + 0.5 ) / std::exp2( double( marginBits ) ) - 0.5; + std::vector<TermMarginVerdict> verdict( uniqueCount, TermMarginVerdict::kAbsent ); + std::size_t presentCount = 0, survivorCount = 0; + for( std::size_t u = 0; u < uniqueCount; ++u ) + { + const bool separatesDoc = double( dfMargin[u] ) <= separationCut; + const bool separatesName = nameDf[u] > 0 && double( nameDf[u] ) <= separationCut; + verdict[u] = dfMargin[u] == 0 ? TermMarginVerdict::kAbsent + : separatesDoc ? TermMarginVerdict::kDocSeparates + : separatesName ? TermMarginVerdict::kNameSeparates + : TermMarginVerdict::kSuppressed; + presentCount += dfMargin[u] > 0 ? 1 : 0; + survivorCount += verdict[u] == TermMarginVerdict::kDocSeparates || verdict[u] == TermMarginVerdict::kNameSeparates ? 1 : 0; + } + const bool applySuppression = survivorCount > 0; // the sole-anchor guard + for( std::size_t u = 0; u < uniqueCount; ++u ) + { + if( verdict[u] == TermMarginVerdict::kSuppressed && !applySuppression ) { - termKept[u] = ( applySuppression && suppressible[u] != 0 ) ? 0 : 1; + verdict[u] = TermMarginVerdict::kSoleAnchor; } - if( std::getenv( "RIPWIRE_TERMMARGIN_DEBUG" ) != nullptr ) + termKept[u] = verdict[u] == TermMarginVerdict::kSuppressed ? 0 : 1; + } + if( std::getenv( "RIPWIRE_TERMMARGIN_DEBUG" ) != nullptr ) + { + static constexpr const char* kVerdictText[] = { "absent", "kept (doc-separates)", "kept (name-separates)", "kept (sole-anchor)", + "SUPPRESSED" }; + for( std::size_t u = 0; u < uniqueCount; ++u ) { - for( std::size_t u = 0; u < uniqueCount; ++u ) - { - const char* verdict = "absent"; - if( dfMargin[u] > 0 ) - { - if( termKept[u] == 0 ) - { - verdict = "SUPPRESSED"; - } - else if( !applySuppression && suppressible[u] != 0 ) - { - verdict = "kept (sole-anchor)"; - } - else if( double( dfMargin[u] ) <= separationCut ) - { - verdict = "kept (doc-separates)"; - } - else - { - verdict = "kept (name-separates)"; - } - } - rw::emitTo( stderr, "term-margin: \"{}\" df={}/{} nameDf={} bits={} {}\n", - uniqueToks[u].c_str(), dfMargin[u], statsS, nameDf[u], marginBits, verdict ); - } - rw::emitTo( stderr, "term-margin: {} present, {} survive, suppression {}\n", - presentCount, survivorCount, applySuppression ? "applied" : "withheld (sole-anchor)" ); + rw::emitTo( stderr, "term-margin: \"{}\" df={}/{} nameDf={} bits={} {}\n", uniqueToks[u].c_str(), dfMargin[u], roles.countedCount, + nameDf[u], marginBits, kVerdictText[ std::size_t( verdict[u] ) ] ); } + rw::emitTo( stderr, "term-margin: {} present, {} survive, suppression {}\n", presentCount, survivorCount, + applySuppression ? "applied" : "withheld (sole-anchor)" ); } + return termKept; +} - // corpus stats — avgdl accumulates in the SAME doc order as before (identical doubles); dfreq[u] = - // number of docs containing unique query token u (w ≥ 1, so tf > 0 ⇔ the old docs[i] contained it) - // statsOut: the counted units' average (the same doc order: identical doubles when every unit counts) scores the - // counted units; an OUT unit scores against the whole corpus (avgdlAll, S, its df plus dfOut), as with no statsOut. - double avgdl = 0, avgdlAll = 0; +// The corpus statistics BM25 scores against, tallied in ONE pass over the final tf rows in ascending doc id. +// avgdl accumulates in the historical doc order (integer sums: exact in any order anyway). dfreq[u] = COUNTED units +// containing unique query token u (w ≥ 1, so tf > 0 ⇔ the old docs[i] contained it); dfOut[u] = statsOut units carrying +// it (all 0 with no statsOut). A counted unit scores with (countedCount, dfreq, avgdlCounted); a statsOut unit against +// the whole ranked corpus (rankedCount, dfreq + dfOut, avgdlRanked), as with no statsOut. +struct LexBm25Stats +{ + std::vector<int> dfreq; + std::vector<int> dfOut; + std::vector<int> tfMaxOf; // per term, its largest weighted tf anywhere — the MaxScore bound's T + std::vector<std::uint32_t> candidateIds; // ascending: every unit with any tf > 0 + double avgdlCounted = 0; + double avgdlRanked = 0; +}; + +inline LexBm25Stats tallyBm25Stats( const LexTfTable& table, const LexCorpusRoles& roles ) +{ + const std::size_t S = table.dl.size(); + const std::size_t uniqueCount = table.uniqueCount; + LexBm25Stats st; + st.dfreq.assign( uniqueCount, 0 ); + st.dfOut.assign( uniqueCount, 0 ); + st.tfMaxOf.assign( uniqueCount, 0 ); + st.candidateIds.reserve( 1024 ); for( std::size_t i = 0; i < S; ++i ) { - avgdl += statsWeight( i ) != 0 ? dl[i] : 0; - avgdlAll += isUnranked( i ) ? 0 : dl[i]; - } - avgdl /= double( statsS ? statsS : 1 ); - avgdlAll /= double( allS ? allS : 1 ); - std::vector<int> dfOut( uniqueCount, 0 ); // per term, the OUT units carrying it (all 0 with no statsOut) - const auto countOut = [ & ]( const int* tfRow ) - { + st.avgdlCounted += roles.statsWeight( i ) != 0 ? table.dl[i] : 0; + st.avgdlRanked += roles.isUnranked( i ) ? 0 : table.dl[i]; + const int* const tfRow = table.row( i ); + const int w = roles.statsWeight( i ); + const int out = roles.isStatsOut( i ) ? 1 : 0; + bool any = false; for( std::size_t u = 0; u < uniqueCount; ++u ) { - dfOut[u] += tfRow[u] > 0 ? 1 : 0; + const bool carries = tfRow[u] > 0; + st.dfreq[u] += carries ? w : 0; + st.dfOut[u] += carries ? out : 0; + st.tfMaxOf[u] = std::max( st.tfMaxOf[u], tfRow[u] ); + any = any || carries; } - }; - - const Bm25Params bm25Params = resolveBm25Params(); // A4: the ONE definition — see above - const double k1 = bm25Params.k1, b = bm25Params.b; - std::vector<float> score( S, 0.f ); - - // ── H2 (B0 round 2): MaxScore-style safe pruning — only when the caller opted in AND the env - // escape hatch is off. The exhaustive branch below is the pre-H2 code, byte-for-byte. - const bool pruneActive = pruneTopK > 0 && std::getenv( "RIPWIRE_NO_PRUNE" ) == nullptr; - if( pruneActive ) - { - // one pass: candidates (any tf > 0 — every other doc scores EXACTLY the same +0.0f either way), - // exact dfreq, and the per-term max weighted tf the impact bound needs. Ascending doc id. - std::vector<int> dfreq( uniqueCount, 0 ); - std::vector<int> tfMaxOf( uniqueCount, 0 ); - std::vector<std::uint32_t> candidateIds; - candidateIds.reserve( 1024 ); - for( std::size_t i = 0; i < S; ++i ) - { - const int* tfRow = tfFlat.data() + i * uniqueCount; - bool any = false; - const int w = statsWeight( i ); - if( w == 0 && !isUnranked( i ) ) - { - countOut( tfRow ); - } - for( std::size_t u = 0; u < uniqueCount; ++u ) - { - if( tfRow[u] > 0 ) - { - dfreq[u] += w; - if( tfRow[u] > tfMaxOf[u] ) - { - tfMaxOf[u] = tfRow[u]; - } - any = true; - } - } - if( any ) - { - candidateIds.push_back( std::uint32_t( i ) ); - } + if( any ) + { + st.candidateIds.push_back( std::uint32_t( i ) ); } + } + st.avgdlCounted /= double( roles.countedCount ? roles.countedCount : 1 ); + st.avgdlRanked /= double( roles.rankedCount ? roles.rankedCount : 1 ); + return st; +} - // ── the PROVABLY-SAFE per-term impact bound (the MaxScore "max contribution") ──────────────── - // A term u's contribution to any doc is idf_u × tf(k1+1)/(tf + k1(1−b+b·dl/avgdl)). Two exact - // monotonicities bound it: it INCREASES in tf (so tf ≤ T := tfMaxOf[u], the largest weighted tf - // of u anywhere in the corpus) and DECREASES in dl (dl ≥ 0 ⇒ the mixed factor ≥ 1−b), giving - // contribution ≤ idf_u × T(k1+1)/(T + k1(1−b)) in REAL arithmetic. - // In IEEE doubles each side is computed with ≤ 7 rounded ops (relative error ≤ 7·2⁻⁵³ ≈ 8e-16), - // so the ×(1+1e-9) slack — six orders of magnitude above the worst accumulated rounding, and - // likewise above the U·2⁻⁵³ summation error of the per-doc bound sum below — makes the COMPUTED - // cap strictly ≥ the COMPUTED contribution. The Section ×0.30 down-weight and the §P4 tier - // multiplier (both (0,1], shrink-only) only shrink a real score, never the bound. - // Hence: bound < θ ⇒ computed score < θ, unconditionally. - // capOcc folds in the query-occurrence multiplicity (BM25 adds one contribution PER occurrence). - std::vector<double> capOcc( uniqueCount, 0.0 ); - { - std::vector<int> occCount( uniqueCount, 0 ); - for( std::size_t qi = 0; qi < qToks.size(); ++qi ) - { - if( uniqueIndexOfQtok[qi] == DedupedQueryTerms::kDroppedTerm ) - { - continue; // capped past kMaxUniqueQueryTerms — owns no row, no contribution - } - ++occCount[uniqueIndexOfQtok[qi]]; - } - for( std::size_t u = 0; u < uniqueCount; ++u ) - { - if( dfreq[u] + dfOut[u] == 0 || termKept[u] == 0 ) - { - continue; // never contributes anywhere — a suppressed term's cap stays 0, and a cap of - // 0 bounds a contribution of 0, so the MaxScore proof below is unchanged - } - const int n = dfreq[u]; - const int nAll = n + dfOut[u]; // an OUT unit's idf: the larger of the two bounds the contribution - const double idfIn = n > 0 ? std::log( ( double( statsS ) - n + 0.5 ) / ( n + 0.5 ) + 1.0 ) : 0.0; - const double idfAll = dfOut[u] > 0 ? std::log( ( double( allS ) - nAll + 0.5 ) / ( nAll + 0.5 ) + 1.0 ) : 0.0; - const double idf = std::max( idfIn, idfAll ); - const double T = double( tfMaxOf[u] ); - const double cap1 = bm25ImpactBound( idf, T, bm25Params ); // A4: shared bound, same (k1,b) - capOcc[u] = cap1 * double( occCount[u] ); - } +// ── H2 (B0 round 2): MaxScore-style SAFE early termination, decided once ──────────────────────────────── +// Armed only when the caller opted in (pruneTopK > 0: it consumes only the top-pruneTopK ranked units, plus +// `alwaysExact` — e.g. every interface packLego may surface) AND the RIPWIRE_NO_PRUNE escape hatch is off (the +// postingscheck equivalence gate flips it). Disarmed, skips() is always false and the scorer is exhaustive. +// +// The PROVABLY-SAFE per-term impact bound (the MaxScore "max contribution"): a term u's contribution to any doc is +// idf_u × tf(k1+1)/(tf + k1(1−b+b·dl/avgdl)). Two exact monotonicities bound it: it INCREASES in tf (so tf ≤ T := +// tfMaxOf[u], the largest weighted tf of u anywhere in the corpus) and DECREASES in dl (dl ≥ 0 ⇒ the mixed factor +// ≥ 1−b), giving +// contribution ≤ idf_u × T(k1+1)/(T + k1(1−b)) in REAL arithmetic. +// In IEEE doubles each side is computed with ≤ 7 rounded ops (relative error ≤ 7·2⁻⁵³ ≈ 8e-16), so the ×(1+1e-9) +// slack — six orders of magnitude above the worst accumulated rounding, and likewise above the U·2⁻⁵³ summation +// error of the per-doc bound sum — makes the COMPUTED cap strictly ≥ the COMPUTED contribution. The Section ×0.30 +// down-weight and the §P4 tier multiplier (both (0,1], shrink-only) only shrink a real score, never the bound. +// Hence: bound < θ ⇒ computed score < θ, unconditionally. capOcc folds in the query-occurrence multiplicity (BM25 +// adds one contribution PER occurrence). +// +// θ = K-th best exact score seen so far (min-heap; grows monotonically). θ at skip time ≤ final θ ≤ the true K-th +// best overall, and skipping needs bound < θ STRICTLY, so a skipped doc's true score is strictly below the final +// K-th score — it cannot enter the top-K even via the (score desc, id asc) tie-break. Docs are visited in ascending id +// (determinism). Safety is absolute, not approximate: the emitted top-K set, their EXACT scores, and their +// (score desc, id asc) order are byte-identical to exhaustive scoring. +class LexTopKPruner +{ +public: + LexTopKPruner( std::size_t pruneTopK, const std::vector<char>* alwaysExact, const LexBm25Stats& st, const LexCorpusRoles& roles, + const DedupedQueryTerms& dedup, const std::vector<char>& termKept, const Bm25Params& bm25Params ) + : topK_( std::getenv( "RIPWIRE_NO_PRUNE" ) == nullptr ? pruneTopK : 0 ), alwaysExact_( alwaysExact ) + { + if( topK_ == 0 ) + { + return; } - - // top-K threshold θ = K-th best exact score seen so far (min-heap; grows monotonically). θ at - // skip time ≤ final θ ≤ the true K-th best overall, and skipping needs bound < θ STRICTLY, so a - // skipped doc's true score is strictly below the final K-th score — it cannot enter the top-K - // even via the (score desc, id asc) tie-break. Docs are processed in ascending id (determinism). - std::vector<double> heap; // min-heap over exact final scores - heap.reserve( pruneTopK ); - double theta = -1.0; // scores are ≥ 0 ⇒ no skips until K docs scored - for( const std::uint32_t i : candidateIds ) + heap_.reserve( topK_ ); + const std::size_t uniqueCount = st.dfreq.size(); + std::vector<int> occCount( uniqueCount, 0 ); + for( const std::size_t u : dedup.uniqueIndexOfQtok ) { - const int* tfRow = tfFlat.data() + std::size_t( i ) * uniqueCount; - - // cheap upper bound: adds only, fixed u-ascending order (deterministic) - double ub = 0.0; - for( std::size_t u = 0; u < uniqueCount; ++u ) - { - if( tfRow[u] > 0 ) - { - ub += capOcc[u]; - } - } - if( isUnranked( i ) ) - { - continue; // a kRankFlagNotLexRanked unit scores 0, the value a skipped symbol keeps - } - const bool mustScore = alwaysExact && i < alwaysExact->size() && (*alwaysExact)[i] != 0; - if( !mustScore && ub < theta ) - { - continue; // provably cannot enter the top-K → skip - } - - // exact score — the IDENTICAL expressions, in the IDENTICAL order, as the exhaustive branch - const bool outI = statsWeight( i ) == 0; - const double Si = outI ? double( allS ) : double( statsS ); - const double avgI = outI ? avgdlAll : avgdl; - double sc = 0; - for( std::size_t qi = 0; qi < qToks.size(); ++qi ) - { - const std::size_t u = uniqueIndexOfQtok[qi]; - if( u == DedupedQueryTerms::kDroppedTerm ) - { - continue; // capped past kMaxUniqueQueryTerms — owns no row, no contribution - } - const int tf = tfRow[u]; - if( tf == 0 || termKept[u] == 0 ) - { - continue; // termKept is all-1 disarmed, so this reads as the historical `tf == 0` - } - const int n = dfreq[u] + ( outI ? dfOut[u] : 0 ); - const double idf = std::log( ( Si - n + 0.5 ) / ( n + 0.5 ) + 1.0 ); - sc += idf * ( tf * ( k1 + 1.0 ) ) / ( tf + k1 * ( 1.0 - b + b * dl[i] / ( avgI > 0 ? avgI : 1.0 ) ) ); - } - if( ing.symbols[i].kind == SymKind::Section ) - { - sc *= 0.30; - } - if( symbolScoreMul && i < symbolScoreMul->size() ) + if( u != DedupedQueryTerms::kDroppedTerm ) // capped past kMaxUniqueQueryTerms — owns no row, no contribution { - sc *= double( ( *symbolScoreMul )[i] ); // §P4 tier down-weight — shrink-only, bound-safe + ++occCount[u]; } - score[i] = float( sc ); - - if( heap.size() < pruneTopK ) - { - heap.push_back( sc ); - std::push_heap( heap.begin(), heap.end(), std::greater<double>{} ); - if( heap.size() == pruneTopK ) - { - theta = heap.front(); - } - } - else if( sc > heap.front() ) + } + capOcc_.assign( uniqueCount, 0.0 ); + for( std::size_t u = 0; u < uniqueCount; ++u ) + { + if( st.dfreq[u] + st.dfOut[u] == 0 || termKept[u] == 0 ) { - std::pop_heap( heap.begin(), heap.end(), std::greater<double>{} ); - heap.back() = sc; - std::push_heap( heap.begin(), heap.end(), std::greater<double>{} ); - theta = heap.front(); + continue; // never contributes anywhere — a suppressed term's cap stays 0, and a cap of + // 0 bounds a contribution of 0, so the MaxScore proof above is unchanged } + const int n = st.dfreq[u]; + const int nAll = n + st.dfOut[u]; // an OUT unit's idf: the larger of the two bounds the contribution + const double idfIn = n > 0 ? std::log( ( double( roles.countedCount ) - n + 0.5 ) / ( n + 0.5 ) + 1.0 ) : 0.0; + const double idfAll = st.dfOut[u] > 0 ? std::log( ( double( roles.rankedCount ) - nAll + 0.5 ) / ( nAll + 0.5 ) + 1.0 ) : 0.0; + const double idf = std::max( idfIn, idfAll ); + const double cap1 = bm25ImpactBound( idf, double( st.tfMaxOf[u] ), bm25Params ); // A4: shared bound, same (k1,b) + capOcc_[u] = cap1 * double( occCount[u] ); } - return score; } - std::vector<int> dfreq( uniqueCount, 0 ); - for( std::size_t i = 0; i < S; ++i ) + // true iff unit i provably cannot enter the top-K: its bound (adds only, fixed u-ascending order) is below θ + bool skips( std::uint32_t i, const int* tfRow ) const { - const int w = statsWeight( i ); - if( w == 0 && !isUnranked( i ) ) + if( topK_ == 0 || ( alwaysExact_ && i < alwaysExact_->size() && ( *alwaysExact_ )[i] != 0 ) ) { - countOut( tfFlat.data() + i * uniqueCount ); + return false; } - for( std::size_t u = 0; u < uniqueCount; ++u ) + double ub = 0.0; + for( std::size_t u = 0; u < capOcc_.size(); ++u ) { - if( tfFlat[i * uniqueCount + u] > 0 ) + if( tfRow[u] > 0 ) { - dfreq[u] += w; + ub += capOcc_[u]; } } + return ub < theta_; } - for( std::size_t i = 0; i < S; ++i ) + void record( double sc ) { - if( isUnranked( i ) ) + if( topK_ == 0 ) + { + return; + } + if( heap_.size() < topK_ ) + { + heap_.push_back( sc ); + std::push_heap( heap_.begin(), heap_.end(), std::greater<double>{} ); + theta_ = heap_.size() == topK_ ? heap_.front() : theta_; + return; + } + if( sc > heap_.front() ) + { + std::pop_heap( heap_.begin(), heap_.end(), std::greater<double>{} ); + heap_.back() = sc; + std::push_heap( heap_.begin(), heap_.end(), std::greater<double>{} ); + theta_ = heap_.front(); + } + } + +private: + std::size_t topK_; + const std::vector<char>* alwaysExact_; + std::vector<double> capOcc_; + std::vector<double> heap_; // min-heap over exact final scores + double theta_ = -1.0; // scores are ≥ 0 ⇒ no skips until K units scored +}; + +// The exact BM25 score of every candidate the pruner does not rule out — the historical expressions in the historical +// order (one contribution PER query occurrence, ascending qi; a kept term only, and termKept is all-1 disarmed). Every +// other unit keeps the +0.0f the vector starts with, which is exactly what exhaustive scoring computes for it: +// - a non-candidate has no tf > 0 for any term, so its sum is +0.0, and the Section ×0.30 and the §P4 tier multiplier +// keep it +0.0 because every multiplier is in (0,1] (filter.h rankTierSymbolMultipliersShaped; the DASSERT below); +// - a kRankFlagNotLexRanked unit (model.h) scores 0; +// - a pruned unit provably cannot enter the top-K the caller consumes (LexTopKPruner). +// So the exhaustive mode needs no loop of its own: it is this loop with a pruner that never skips. +inline std::vector<float> scoreLexCandidates( const IngestResult& ing, const LexTfTable& table, const LexBm25Stats& st, const LexCorpusRoles& roles, + const DedupedQueryTerms& dedup, const std::vector<char>& termKept, const Bm25Params& bm25Params, + LexTopKPruner& pruner, const std::vector<float>* symbolScoreMul ) +{ + DASSERT( symbolScoreMul == nullptr || std::ranges::all_of( *symbolScoreMul, []( float mul ) { return mul > 0.f && mul <= 1.f; } ), + "a tier multiplier outside (0,1] would score a non-candidate unit other than +0.0f and break the MaxScore bound" ); + const std::vector<std::size_t>& uniqueIndexOfQtok = dedup.uniqueIndexOfQtok; + const std::vector<int>& dl = table.dl; + const double k1 = bm25Params.k1, b = bm25Params.b; + std::vector<float> score( dl.size(), 0.f ); + for( const std::uint32_t i : st.candidateIds ) + { + const int* tfRow = table.row( i ); + if( roles.isUnranked( i ) || pruner.skips( i, tfRow ) ) { - continue; // a kRankFlagNotLexRanked unit scores 0 (model.h) + continue; } - const bool outI = statsWeight( i ) == 0; - const double Si = outI ? double( allS ) : double( statsS ); - const double avgI = outI ? avgdlAll : avgdl; + const bool outI = roles.isStatsOut( i ); + const double Si = outI ? double( roles.rankedCount ) : double( roles.countedCount ); + const double avgI = outI ? st.avgdlRanked : st.avgdlCounted; double sc = 0; - for( std::size_t qi = 0; qi < qToks.size(); ++qi ) + for( std::size_t qi = 0; qi < uniqueIndexOfQtok.size(); ++qi ) { const std::size_t u = uniqueIndexOfQtok[qi]; if( u == DedupedQueryTerms::kDroppedTerm ) { - continue; // capped past kMaxUniqueQueryTerms — owns no row, no contribution + continue; // capped past kMaxUniqueQueryTerms — owns no row, no contribution } - const int tf = tfFlat[ i * uniqueCount + u ]; + const int tf = tfRow[u]; if( tf == 0 || termKept[u] == 0 ) { continue; // old: docs[i].find( qt ) == end — termKept is all-1 disarmed, so this is that } - const int n = dfreq[u] + ( outI ? dfOut[u] : 0 ); + const int n = st.dfreq[u] + ( outI ? st.dfOut[u] : 0 ); const double idf = std::log( ( Si - n + 0.5 ) / ( n + 0.5 ) + 1.0 ); sc += idf * ( tf * ( k1 + 1.0 ) ) / ( tf + k1 * ( 1.0 - b + b * dl[i] / ( avgI > 0 ? avgI : 1.0 ) ) ); } @@ -1574,15 +1532,78 @@ inline std::vector<float> lexicalScoresTiered( const IngestResult& ing, const st } if( symbolScoreMul && i < symbolScoreMul->size() ) { - sc *= double( ( *symbolScoreMul )[i] ); // §P4 tier down-weight (same factor as the pruned branch) + sc *= double( ( *symbolScoreMul )[i] ); // §P4 tier down-weight — shrink-only, bound-safe } score[i] = float( sc ); + pruner.record( sc ); } return score; } +// BM25 score of `query` against each symbol's doc (name subtokens + callees' names + DOC-COMMENT & BODY +// text). Returns a per-symbol score vector (size = symbols.size()). Cold path: one query. The steps above, in order. +inline std::vector<float> lexicalScoresTiered( const IngestResult& ing, const std::vector<std::uint32_t>& outOff, + const std::vector<NodeId>& outTargets, std::string_view query, + std::size_t pruneTopK, const std::vector<char>* alwaysExact, + const std::vector<float>* symbolScoreMul, int pathFieldDefaultW = 0, + int basenameFieldDefaultW = 0, std::string_view pathRootPrefix = {}, + LexTermEvidence* evidenceOut = nullptr, // L-W: the term evidence, read back out (see the struct) + const std::vector<char>* statsOut = nullptr ) // units scored but kept OUT of the corpus statistics +{ + PROFILE_SCOPE_DESCRIBE( "lexical: lexicalScores (BM25 over symbols)" ); + const std::size_t S = ing.symbols.size(); + const LexCorpusRoles roles = assignLexCorpusRoles( ing, statsOut ); + + // query subtokens — occurrence order preserved (BM25 adds one contribution PER occurrence, as before); + // an empty query scores exactly 0 everywhere (0.0 survives the Section down-weight unchanged) + std::vector<std::string> qToks; + subtokens( query, qToks ); + if( qToks.empty() ) + { + if( evidenceOut ) + { + *evidenceOut = LexTermEvidence{}; + evidenceOut->symbolCount = S; + evidenceOut->statsCount = S; // no term, so no idf ever reads it + } + return std::vector<float>( S, 0.f ); + } + + // dedupe to the unique terms whose statistics we need — a duplicated query word must not double-count + // tf, but still contributes once PER OCCURRENCE in the scoring loop (uniqueIndexOfQtok maps back) — + // capped (see dedupeQueryTerms above) so a pathologically term-rich query cannot blow up the tf table's + // S×terms allocation below. + const DedupedQueryTerms dedup = dedupeQueryTerms( qToks, kMaxUniqueQueryTerms ); + const std::vector<LexMatchTok> matchToks = buildLexMatchTable( dedup.uniqueToks ); + LexTfTable table( S, matchToks, dedup.uniqueToks.size() ); + + // the fields, weakest dependence first: name + callee (pass 1), path (1.5) and basename (1.6) need no file text, + // so they run before the pass-2 source split; then doc-comment + body (pass 2) from whichever source the ingest has + const int marginBits = termMarginBitsFromEnv(); + std::vector<int> nameDf = addNameAndCalleeFields( table, ing, outOff, outTargets, roles, /*countNameDf=*/marginBits > 0, evidenceOut ); + addPathField( table, ing, fieldWeightOrEnv( pathFieldDefaultW, "RIPWIRE_PATHTOK_W" ), pathRootPrefix ); + addBasenameField( table, ing, fieldWeightOrEnv( basenameFieldDefaultW, "RIPWIRE_BASENAME_W" ), pathRootPrefix ); + const std::vector<std::uint32_t> dfVariant = hasPersistedLexStats( ing ) ? addDocBodyFromPersistedStats( table, ing ) : scanDocBodyFields( table, ing ); + + // what the corpus statistics decide: which stem variants stay, then which query terms separate + const std::vector<char> admitted = admitRareStemVariants( dfVariant, roles.rankedCount, table ); + table.foldAdmittedVariants( admitted ); + foldAdmittedNameDf( nameDf, admitted, table ); + if( evidenceOut ) + { + recordTermEvidence( *evidenceOut, table, roles, dedup ); + } + const std::vector<char> termKept = judgeTermMargins( table, roles, nameDf, marginBits, dedup.uniqueToks ); + + // score: corpus statistics, then every candidate the MaxScore pruner (armed only on request) does not rule out + const LexBm25Stats stats = tallyBm25Stats( table, roles ); + const Bm25Params bm25Params = resolveBm25Params(); // A4: the ONE definition — see above + LexTopKPruner pruner( pruneTopK, alwaysExact, stats, roles, dedup, termKept, bm25Params ); + return scoreLexCandidates( ing, table, stats, roles, dedup, termKept, bm25Params, pruner, symbolScoreMul ); +} + // the un-tiered contract every pre-§P4 caller keeps (evals, exemplar, --recall): same arity as always, -// byte-identical scores (a null multiplier is the identity in both scoring branches above). +// byte-identical scores (a null multiplier is the identity in scoreLexCandidates above, pruned or exhaustive). inline std::vector<float> lexicalScores( const IngestResult& ing, const std::vector<std::uint32_t>& outOff, const std::vector<NodeId>& outTargets, std::string_view query, std::size_t pruneTopK = 0, const std::vector<char>* alwaysExact = nullptr, From 739151ce9583581509d08f7b257b448f8a471a1a Mon Sep 17 00:00:00 2001 From: joyful-ii-V-I <210578314+joyful-ii-V-I@users.noreply.github.com> Date: Sat, 21 Nov 2026 23:40:16 -0500 Subject: [PATCH 31/44] refactor(lexical): the BM25 (k1, b) travel with the corpus statistics they score with tallyBm25Stats resolves them (still after the term-margin step, so knob warnings keep their order) and LexTopKPruner and scoreLexCandidates read them from LexBm25Stats instead of a separate parameter. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --- src/lexical.h | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/lexical.h b/src/lexical.h index 88e1dc342..d6b086e9d 100644 --- a/src/lexical.h +++ b/src/lexical.h @@ -1320,7 +1320,8 @@ inline std::vector<char> judgeTermMargins( const LexTfTable& table, const LexCor return termKept; } -// The corpus statistics BM25 scores against, tallied in ONE pass over the final tf rows in ascending doc id. +// The corpus statistics BM25 scores against, tallied in ONE pass over the final tf rows in ascending doc id, and the +// (k1, b) it scores with (A4: resolveBm25Params, the ONE definition the impact bound reads too). // avgdl accumulates in the historical doc order (integer sums: exact in any order anyway). dfreq[u] = COUNTED units // containing unique query token u (w ≥ 1, so tf > 0 ⇔ the old docs[i] contained it); dfOut[u] = statsOut units carrying // it (all 0 with no statsOut). A counted unit scores with (countedCount, dfreq, avgdlCounted); a statsOut unit against @@ -1333,6 +1334,7 @@ struct LexBm25Stats std::vector<std::uint32_t> candidateIds; // ascending: every unit with any tf > 0 double avgdlCounted = 0; double avgdlRanked = 0; + Bm25Params params = kBm25Default; }; inline LexBm25Stats tallyBm25Stats( const LexTfTable& table, const LexCorpusRoles& roles ) @@ -1367,6 +1369,7 @@ inline LexBm25Stats tallyBm25Stats( const LexTfTable& table, const LexCorpusRole } st.avgdlCounted /= double( roles.countedCount ? roles.countedCount : 1 ); st.avgdlRanked /= double( roles.rankedCount ? roles.rankedCount : 1 ); + st.params = resolveBm25Params(); return st; } @@ -1396,7 +1399,7 @@ class LexTopKPruner { public: LexTopKPruner( std::size_t pruneTopK, const std::vector<char>* alwaysExact, const LexBm25Stats& st, const LexCorpusRoles& roles, - const DedupedQueryTerms& dedup, const std::vector<char>& termKept, const Bm25Params& bm25Params ) + const DedupedQueryTerms& dedup, const std::vector<char>& termKept ) : topK_( std::getenv( "RIPWIRE_NO_PRUNE" ) == nullptr ? pruneTopK : 0 ), alwaysExact_( alwaysExact ) { if( topK_ == 0 ) @@ -1426,7 +1429,7 @@ class LexTopKPruner const double idfIn = n > 0 ? std::log( ( double( roles.countedCount ) - n + 0.5 ) / ( n + 0.5 ) + 1.0 ) : 0.0; const double idfAll = st.dfOut[u] > 0 ? std::log( ( double( roles.rankedCount ) - nAll + 0.5 ) / ( nAll + 0.5 ) + 1.0 ) : 0.0; const double idf = std::max( idfIn, idfAll ); - const double cap1 = bm25ImpactBound( idf, double( st.tfMaxOf[u] ), bm25Params ); // A4: shared bound, same (k1,b) + const double cap1 = bm25ImpactBound( idf, double( st.tfMaxOf[u] ), st.params ); // A4: shared bound, same (k1,b) capOcc_[u] = cap1 * double( occCount[u] ); } } @@ -1488,14 +1491,14 @@ class LexTopKPruner // - a pruned unit provably cannot enter the top-K the caller consumes (LexTopKPruner). // So the exhaustive mode needs no loop of its own: it is this loop with a pruner that never skips. inline std::vector<float> scoreLexCandidates( const IngestResult& ing, const LexTfTable& table, const LexBm25Stats& st, const LexCorpusRoles& roles, - const DedupedQueryTerms& dedup, const std::vector<char>& termKept, const Bm25Params& bm25Params, - LexTopKPruner& pruner, const std::vector<float>* symbolScoreMul ) + const DedupedQueryTerms& dedup, const std::vector<char>& termKept, LexTopKPruner& pruner, + const std::vector<float>* symbolScoreMul ) { DASSERT( symbolScoreMul == nullptr || std::ranges::all_of( *symbolScoreMul, []( float mul ) { return mul > 0.f && mul <= 1.f; } ), "a tier multiplier outside (0,1] would score a non-candidate unit other than +0.0f and break the MaxScore bound" ); const std::vector<std::size_t>& uniqueIndexOfQtok = dedup.uniqueIndexOfQtok; const std::vector<int>& dl = table.dl; - const double k1 = bm25Params.k1, b = bm25Params.b; + const double k1 = st.params.k1, b = st.params.b; std::vector<float> score( dl.size(), 0.f ); for( const std::uint32_t i : st.candidateIds ) { @@ -1596,10 +1599,9 @@ inline std::vector<float> lexicalScoresTiered( const IngestResult& ing, const st const std::vector<char> termKept = judgeTermMargins( table, roles, nameDf, marginBits, dedup.uniqueToks ); // score: corpus statistics, then every candidate the MaxScore pruner (armed only on request) does not rule out - const LexBm25Stats stats = tallyBm25Stats( table, roles ); - const Bm25Params bm25Params = resolveBm25Params(); // A4: the ONE definition — see above - LexTopKPruner pruner( pruneTopK, alwaysExact, stats, roles, dedup, termKept, bm25Params ); - return scoreLexCandidates( ing, table, stats, roles, dedup, termKept, bm25Params, pruner, symbolScoreMul ); + const LexBm25Stats stats = tallyBm25Stats( table, roles ); + LexTopKPruner pruner( pruneTopK, alwaysExact, stats, roles, dedup, termKept ); + return scoreLexCandidates( ing, table, stats, roles, dedup, termKept, pruner, symbolScoreMul ); } // the un-tiered contract every pre-§P4 caller keeps (evals, exemplar, --recall): same arity as always, From b6ae53e9f828e641b9be583700a1a6501e18ca4f Mon Sep 17 00:00:00 2001 From: joyful-ii-V-I <210578314+joyful-ii-V-I@users.noreply.github.com> Date: Sun, 22 Nov 2026 01:46:36 -0500 Subject: [PATCH 32/44] refactor(lexical): the BM25 fold phase is a type, and margin arming and idf are decided once Blind-review follow-up on lexicalScoresTiered's named steps (verdict BETTER): - The tf table before the stem-variant fold (LexMatchTfTable: match-row stride, the provisional variant columns, nameDf and the per-variant doc/body df) and after it (LexTermTfTable: one row per unique query term) are separate types. The fold consumes the first and returns the second, folding tf rows and nameDf with the same row fold. The stale post-fold variantCount() and the mutable stride are gone: every step after the fold takes the post-fold type. - Whether the SIRA term margin is armed is one LexTermMargin, read once from the environment and carried by the table. Pass 1's nameDf count, the fold and judgeTermMargins all ask margin.armed(), replacing a bool parameter, nameDf.empty() and marginBits <= 0. - Names say what the passes produce: addNameAndCalleeFieldsCapturingNameHits, addDocBodyFieldsFromPersistedStats / addDocBodyFieldsByFileScan (behind addDocBodyFields), both filling the table's variantDocDf for admitRareStemVariants. - recordTermEvidence computes the mask width itself (LexTermEvidence::maskWordsFor) and asserts that pass 1 captured the name mask at that width. - idf is computed once per term and role in LexBm25Stats (idfCounted / idfRanked, through the one bm25Idf expression). The scoring loop, the MaxScore bound and LexTermEvidence::idf read it, so none re-derives which corpus a unit scores against. No answer changes: fire321 0/321, md5 12/12 on arm64 (also with RIPWIRE_QSTEM=1 and RIPWIRE_TERMMARGIN=1), identity set 75/75. Under -ffast-math, byte identity is a codegen fact; the x86-64-v3 legs are CI's. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --- src/lexical.h | 356 ++++++++++++++++++++++++++++++-------------------- 1 file changed, 216 insertions(+), 140 deletions(-) diff --git a/src/lexical.h b/src/lexical.h index d6b086e9d..e7e8e1900 100644 --- a/src/lexical.h +++ b/src/lexical.h @@ -139,6 +139,15 @@ inline bool holdsSubtokenWord( std::string_view text, const std::vector<std::str // anyMask per symbol, bit u set iff it carried terms[u] in any field (the final row, after the fold) // Masks are maskWords 64-bit words per symbol (maskWords = ceil(terms/64)): a pasted stack trace with a // hundred unique terms is tracked in full, nothing silently dropped from the share. +// +// BM25's idf for a term carried by n of the N units the corpus statistics count — the ONE spelling of the expression: +// the scorer's per-term table (LexBm25Stats), its MaxScore bound and the evidence below all read it. An absent term +// (n = 0) weighs as the rarest possible term, ln( (N+0.5)/0.5 + 1 ), never as nothing. +inline double bm25Idf( double N, double n ) noexcept +{ + return std::log( ( N - n + 0.5 ) / ( n + 0.5 ) + 1.0 ); +} + struct LexTermEvidence { std::vector<std::string> terms; @@ -156,16 +165,12 @@ struct LexTermEvidence std::size_t termsSeenTotal = 0; bool termsCapped = false; - const std::uint64_t* anyMaskOf( std::size_t sym ) const noexcept { return anyMask.data() + sym * maskWords; } - static bool hasBit( const std::uint64_t* mask, std::size_t u ) noexcept { return ( mask[ u / 64 ] >> ( u % 64 ) ) & 1u; } + static constexpr std::size_t maskWordsFor( std::size_t termCount ) noexcept { return ( termCount + 63 ) / 64; } + const std::uint64_t* anyMaskOf( std::size_t sym ) const noexcept { return anyMask.data() + sym * maskWords; } + static bool hasBit( const std::uint64_t* mask, std::size_t u ) noexcept { return ( mask[ u / 64 ] >> ( u % 64 ) ) & 1u; } - // BM25's own idf for term u over the `statsCount` symbols the statistics count — the exact expression scoreLexCandidates uses, - // so an absent term (df 0) weighs as the rarest possible term and never as nothing. - double idf( std::size_t u ) const noexcept - { - const double n = double( df[u] ); - return std::log( ( double( statsCount ) - n + 0.5 ) / ( n + 0.5 ) + 1.0 ); - } + // BM25's own idf for term u over the `statsCount` symbols the statistics count (bm25Idf, the scorer's expression) + double idf( std::size_t u ) const noexcept { return bm25Idf( double( statsCount ), double( df[u] ) ); } }; // docCommentStart moved to lexindex.h (B0.2): the index-time stats builder must scan the EXACT spans this @@ -689,13 +694,54 @@ inline std::vector<LexMatchTok> buildLexMatchTable( const std::vector<std::strin return rows; } -// The per-query BM25 term table every field pass adds into (SoA): dl[i] = doc i's weighted subtoken count (the BM25 -// document length) and tf[i * stride + m] = the weighted term frequency of match-table row m in doc i. Integer counts are -// exact, so fill order is free and the float scoring later runs in strict doc order with the historical expressions. -// Until the stem-variant fold, stride == matchCount and provisional variant columns sit at m ≥ uniqueCount; the fold -// (foldAdmittedVariants) shrinks it back to uniqueCount, the historical layout byte-for-byte. Disarmed, the two are equal. +// ── SIRA term margin (docs/EVALS.md "Corpus-statistics term margin", PRE-REGISTERED 2026-09-05) — the arming ── +// The decision itself needs corpus statistics that do not exist until after pass 2 (judgeTermMargins); all that is +// read here is whether it is armed and at which rung, ONCE per query: the tf tables carry it, pass 1 counts nameDf +// only when it is armed, the fold folds nameDf only then, and judgeTermMargins decides only then — one predicate. +// bits is the k of "a term separates iff idf_u >= k * ln 2", k = 1 being the shipped rule and the only rung this round +// may ship (the ladder is frozen in the registration). 0 = disarmed: the scorer is the historical one byte-for-byte. +struct LexTermMargin +{ + int bits = 0; + bool armed() const noexcept { return bits > 0; } +}; + +inline LexTermMargin termMarginFromEnv() +{ + const char* env = std::getenv( "RIPWIRE_TERMMARGIN" ); + if( env == nullptr || *env == '0' ) + { + return {}; + } + const std::optional<int> bits = envKnob<int>( "RIPWIRE_TERMMARGIN_BITS" ); + return { bits ? std::clamp( *bits, 1, 8 ) : 1 }; +} + +// The per-query BM25 term table AFTER the stem-variant fold — the historical layout, one row per unique query term: +// dl[i] = doc i's weighted subtoken count (the BM25 document length), tf[i * uniqueCount + u] = the weighted term +// frequency of unique term u in doc i, and nameDf[u] = the term margin's name-field document frequency (empty when the +// margin is disarmed). Every step from the term evidence on reads THIS type, and the only way to make one is the fold +// (LexMatchTfTable::foldAdmittedVariants below), so no later step can see a provisional variant column or a match-row +// stride. Integer counts are exact, so the float scoring later runs in strict doc order with the historical expressions. +struct LexTermTfTable +{ + std::size_t uniqueCount = 0; + std::vector<int> dl; + std::vector<int> tf; + std::vector<int> nameDf; + LexTermMargin margin; + + std::size_t docCount() const noexcept { return dl.size(); } + const int* row( std::size_t doc ) const noexcept { return tf.data() + doc * uniqueCount; } +}; + +// The same table BEFORE the fold, while the field passes add into it: one row per MATCH-table row (tf[i * matchCount() + m]), +// so the LB-3 stem variants sit in provisional columns m ≥ uniqueCount (none when RIPWIRE_QSTEM is off, and then the fold +// is a move). Beside tf it keeps the two per-row facts only the field passes can see: nameDf (pass 1, the name field +// alone; sized only when the margin is armed) and variantDocDf (pass 2, the units whose doc/body fields carry each +// variant — the R3 admission signal). The fold consumes the table and turns all of it into a LexTermTfTable at once. // -// Every write goes through the four add/fold members below, and every field's evidence through ONE tokenizer: +// Every write goes through the add members below, and every field's evidence through ONE tokenizer: // scanTextInto streams a field through lexindex.h forEachLexSubtoken (the same state machine subtokens() mirrors and the // B0.2 index-time builder uses): a token is a maximal alphanumeric run between separators, cut at a lower/digit → Upper // transition and at the ACRONYMWord seam. Tokens shorter than 2 bytes are dropped, exactly like subtokens(). No strings, @@ -703,25 +749,30 @@ inline std::vector<LexMatchTok> buildLexMatchTable( const std::vector<std::strin // all-caps run survives as ONE token, so a span's INTERIOR bytes can be uppercase and memcmp alone would miss it; the // memcmp stays as the fast path and only a span already agreeing on length AND head falls through to // lexTokenEqualsLowered — the rare acronym case, arm D's seam. -struct LexTfTable +struct LexMatchTfTable { const std::vector<LexMatchTok>& matchToks; - std::size_t uniqueCount; // rows 0..uniqueCount are the exact query terms - std::size_t stride; // matchToks.size() until the fold, uniqueCount after it + std::size_t uniqueCount; // rows 0..uniqueCount are the exact query terms, the rest stem variants + LexTermMargin margin; LexHeadIndex headIndex; std::vector<int> dl; std::vector<int> tf; + std::vector<int> nameDf; // per match row: ranked units whose NAME field alone carries it + std::vector<std::uint32_t> variantDocDf; // per stem variant: units whose doc/body fields carry it - LexTfTable( std::size_t docCount, const std::vector<LexMatchTok>& rows, std::size_t exactCount ) - : matchToks( rows ), uniqueCount( exactCount ), stride( rows.size() ), + LexMatchTfTable( std::size_t docCount, const std::vector<LexMatchTok>& rows, std::size_t exactCount, LexTermMargin termMargin ) + : matchToks( rows ), uniqueCount( exactCount ), margin( termMargin ), headIndex( buildLexHeadIndex( rows.size(), [ &rows ]( std::size_t m ) -> const std::string& { return rows[m].tok; } ) ), - dl( docCount, 0 ), tf( docCount * rows.size(), 0 ) + dl( docCount, 0 ), tf( docCount * rows.size(), 0 ), nameDf( termMargin.armed() ? rows.size() : 0, 0 ), + variantDocDf( rows.size() - exactCount, 0u ) { + DASSERT( exactCount <= rows.size(), "the match table lists the exact query terms first, then their stem variants" ); } + std::size_t matchCount() const noexcept { return matchToks.size(); } std::size_t variantCount() const noexcept { return matchToks.size() - uniqueCount; } - int* row( std::size_t doc ) noexcept { return tf.data() + doc * stride; } - const int* row( std::size_t doc ) const noexcept { return tf.data() + doc * stride; } + int* row( std::size_t doc ) noexcept { return tf.data() + doc * matchCount(); } + const int* row( std::size_t doc ) const noexcept { return tf.data() + doc * matchCount(); } // Streams `text` at weight w into a caller-owned tf row and length accumulator (the per-file basename rows use it // directly; addField is the per-doc form). Exact tokens own rows 0..uniqueCount (m == u there). @@ -751,7 +802,7 @@ struct LexTfTable void addFileField( std::size_t doc, const int* fileRow, int fileWt ) { int* const tfRow = row( doc ); - for( std::size_t m = 0; m < stride; ++m ) + for( std::size_t m = 0; m < matchCount(); ++m ) { tfRow[m] += fileRow[m]; } @@ -762,47 +813,66 @@ struct LexTfTable void addStoredLength( std::size_t doc, int length ) { dl[doc] += length; } void addStoredTf( std::size_t doc, std::size_t m, int count ) { row( doc )[m] += count; } - // The R3 fold: an admitted variant's column adds into its original term's row, a rejected one's is dropped (its - // evidence — name, callee, path, basename, doc, body — vanishes without touching dl: document length counts all - // subtokens scanned, never matches). The table then has the historical uniqueCount stride. - void foldAdmittedVariants( const std::vector<char>& admitted ) + // pass 1, right after a ranked doc's NAME field and before any other field lands in its row: count its name hits + // into nameDf — only while the term margin is armed (nameDf is unsized otherwise) + void countNameFieldDf( std::size_t doc ) { - if( variantCount() == 0 ) + if( !margin.armed() ) + { + return; + } + const int* const nameRow = row( doc ); + for( std::size_t m = 0; m < matchCount(); ++m ) { - return; // disarmed: already the historical layout + nameDf[m] += nameRow[m] > 0 ? 1 : 0; } + } + + // The R3 fold, one flag per variant (admitRareStemVariants): an admitted variant's column adds into its original + // term's row, a rejected one's is dropped (its evidence — name, callee, path, basename, doc, body — vanishes without + // touching dl: document length counts all subtokens scanned, never matches). nameDf folds the SAME way, so the margin + // test sees one row per unique term on either arm. A doc carrying both the exact token and an admitted variant in its + // name is counted twice, so a folded nameDf is a CEILING, not a count — stated rather than hidden. It matters only + // when RIPWIRE_QSTEM and the margin are both armed, and both ship off. + LexTermTfTable foldAdmittedVariants( const std::vector<char>& admitted ) && + { + DASSERT( admitted.size() == variantCount(), "one admission flag per stem variant" ); const std::size_t docCount = dl.size(); - std::vector<int> folded( docCount * uniqueCount, 0 ); + LexTermTfTable terms; + terms.uniqueCount = uniqueCount; + terms.margin = margin; + terms.dl = std::move( dl ); + if( variantCount() == 0 ) + { + terms.tf = std::move( tf ); // disarmed: already the historical layout + terms.nameDf = std::move( nameDf ); + return terms; + } + terms.tf.assign( docCount * uniqueCount, 0 ); for( std::size_t i = 0; i < docCount; ++i ) { - const int* const src = row( i ); - int* const dst = folded.data() + i * uniqueCount; - std::copy( src, src + uniqueCount, dst ); - for( std::size_t v = 0; v < admitted.size(); ++v ) - { - dst[ matchToks[ uniqueCount + v ].u ] += admitted[v] != 0 ? src[ uniqueCount + v ] : 0; - } + foldRowInto( terms.tf.data() + i * uniqueCount, row( i ), admitted ); } - tf = std::move( folded ); - stride = uniqueCount; + if( margin.armed() ) + { + terms.nameDf.assign( uniqueCount, 0 ); + foldRowInto( terms.nameDf.data(), nameDf.data(), admitted ); + } + return terms; } -}; -// ── SIRA term margin (docs/EVALS.md "Corpus-statistics term margin", PRE-REGISTERED 2026-09-05) — the arming ── -// The decision itself needs corpus statistics that do not exist until after pass 2 (judgeTermMargins); all that is -// read here is whether it is armed and at which rung. The result is the k of "a term separates iff idf_u >= k * ln 2", -// k = 1 being the shipped rule and the only rung this round may ship (the ladder is frozen in the registration). -// 0 = disarmed: every step that reads it skips its margin work and the scorer is the historical one byte-for-byte. -inline int termMarginBitsFromEnv() -{ - const char* env = std::getenv( "RIPWIRE_TERMMARGIN" ); - if( env == nullptr || *env == '0' ) +private: + // one match-width row (tf, or nameDf) into a unique-width one: the exact columns copied, each admitted variant's + // column added into its term's + void foldRowInto( int* dst, const int* src, const std::vector<char>& admitted ) const { - return 0; + std::copy( src, src + uniqueCount, dst ); + for( std::size_t v = 0; v < admitted.size(); ++v ) + { + dst[ matchToks[ uniqueCount + v ].u ] += admitted[v] != 0 ? src[ uniqueCount + v ] : 0; + } } - const std::optional<int> bits = envKnob<int>( "RIPWIRE_TERMMARGIN_BITS" ); - return bits ? std::clamp( *bits, 1, 8 ) : 1; -} +}; // A field's weight: the caller's lens default, or the RIPWIRE_* calibration knob (clamped 0..8) when set. 0 = the // field is not scanned at all. @@ -824,27 +894,26 @@ inline constexpr int kLexWeightName = 3, kLexWeightCallee = 1; // pass 1 — name (×kLexWeightName) + callee-name (×kLexWeightCallee) fields, which need no file text. Two per-unit facts // are separable ONLY here, after a unit's name field and before its callee, path, doc and body fields land in the same -// tf row, so they are captured here: -// L-W evidenceOut->nameMask, bit u set iff the NAME field alone carried terms[u] (with maskWords; skipped when null) -// SIRA the returned nameDf[m] = ranked units whose NAME FIELD ALONE carries match-table row m (empty when the margin is -// disarmed). This is the statistic the LB-1 negative is the reason for: that round's IDF floor read document +// tf row, so this pass also captures which terms each unit's NAME carries ("name hits"), two ways: +// L-W evidenceOut->nameMask, bit u set iff the NAME field alone carried terms[u] (skipped when evidenceOut is null) +// SIRA table.nameDf[m] = ranked units whose NAME FIELD ALONE carries match-table row m (only when the margin is +// armed). This is the statistic the LB-1 negative is the reason for: that round's IDF floor read document // frequency only, and so deleted `module` — the truth's OWN name carrier — on a corpus where `module` is // everywhere in bodies. A term that names between 1 and S/2 symbols separates on the field ripwire weights highest // (×3) whatever its body mass says, and is kept. Pass 1 runs before the pass-2 branch split, so the scan and // persisted-stats paths read the identical integers. -inline std::vector<int> addNameAndCalleeFields( LexTfTable& table, const IngestResult& ing, const std::vector<std::uint32_t>& outOff, - const std::vector<NodeId>& outTargets, const LexCorpusRoles& roles, bool countNameDf, - LexTermEvidence* evidenceOut ) +inline void addNameAndCalleeFieldsCapturingNameHits( LexMatchTfTable& table, const IngestResult& ing, const std::vector<std::uint32_t>& outOff, + const std::vector<NodeId>& outTargets, const LexCorpusRoles& roles, + LexTermEvidence* evidenceOut ) { const std::size_t S = ing.symbols.size(); const std::size_t uniqueCount = table.uniqueCount; - const std::size_t evidenceWords = ( uniqueCount + 63 ) / 64; + const std::size_t evidenceWords = LexTermEvidence::maskWordsFor( uniqueCount ); if( evidenceOut ) { evidenceOut->maskWords = evidenceWords; evidenceOut->nameMask.assign( S * evidenceWords, 0u ); } - std::vector<int> nameDf( countNameDf ? table.stride : 0, 0 ); for( std::size_t i = 0; i < S; ++i ) { table.addField( i, ing.symbols[i].name, kLexWeightName ); @@ -857,16 +926,15 @@ inline std::vector<int> addNameAndCalleeFields( LexTfTable& table, const IngestR words[ u / 64 ] |= nameRow[u] > 0 ? std::uint64_t( 1 ) << ( u % 64 ) : 0u; } } - for( std::size_t m = 0; m < nameDf.size() && !roles.isUnranked( i ); ++m ) + if( !roles.isUnranked( i ) ) { - nameDf[m] += nameRow[m] > 0 ? 1 : 0; + table.countNameFieldDf( i ); // SIRA nameDf, armed only } for( std::uint32_t e = outOff[i]; e < outOff[i + 1]; ++e ) { table.addField( i, ing.symbols[ outTargets[e] ].name, kLexWeightCallee ); } } - return nameDf; } // pass 1.5 — path field (×kwPath): the symbol's file path scanned through the SAME state machine. @@ -893,7 +961,7 @@ inline std::vector<int> addNameAndCalleeFields( LexTfTable& table, const IngestR // exactly what a relative-root run already scanned, which is why this is a CONVERGENCE onto the // already-invariant `ripwire .` rather than a new ranking opinion. Multi-root passes no prefix: // ing.files already hold "<label>/<root-relative>". -inline void addPathField( LexTfTable& table, const IngestResult& ing, int kwPath, std::string_view pathRootPrefix ) +inline void addPathField( LexMatchTfTable& table, const IngestResult& ing, int kwPath, std::string_view pathRootPrefix ) { if( kwPath <= 0 ) { @@ -920,27 +988,27 @@ inline void addPathField( LexTfTable& table, const IngestResult& ing, int kwPath // follows the last '/', which the root prefix cannot change — and applied anyway so the two path passes // cannot drift apart. One reading of ing.files[f], one rule; a future reader who changes one pass finds // the other already agreeing rather than discovering half the path tokenization was still absolute. -inline void addBasenameField( LexTfTable& table, const IngestResult& ing, int kwBase, std::string_view pathRootPrefix ) +inline void addBasenameField( LexMatchTfTable& table, const IngestResult& ing, int kwBase, std::string_view pathRootPrefix ) { if( kwBase <= 0 ) { return; } const std::size_t fileCount = ing.files.size(); - std::vector<int> fileTf( fileCount * table.stride, 0 ); + std::vector<int> fileTf( fileCount * table.matchCount(), 0 ); std::vector<int> fileWt( fileCount, 0 ); for( std::size_t f = 0; f < fileCount; ++f ) { const std::string_view path = rw::sarif::rootRelativeUri( ing.files[f], pathRootPrefix ); const std::size_t cut = path.find_last_of( '/' ); const std::string_view base = cut == std::string_view::npos ? path : path.substr( cut + 1 ); - table.scanTextInto( fileTf.data() + f * table.stride, fileWt[f], base, kwBase ); + table.scanTextInto( fileTf.data() + f * table.matchCount(), fileWt[f], base, kwBase ); } for( std::size_t i = 0; i < ing.symbols.size(); ++i ) { if( const std::uint32_t f = ing.symbols[i].fileId; f < fileCount && fileWt[f] != 0 ) { - table.addFileField( i, fileTf.data() + std::size_t( f ) * table.stride, fileWt[f] ); + table.addFileField( i, fileTf.data() + std::size_t( f ) * table.matchCount(), fileWt[f] ); } } } @@ -955,19 +1023,18 @@ inline bool hasPersistedLexStats( const IngestResult& ing ) noexcept return ing.hasLexStats && ing.lexTokenRowOffsets.size() == S + 1 && ing.lexDocBodyDl.size() == S; } -// pass 2 from persisted stats — doc-comment + body evidence as stored integers. Returns, per stem variant, the units -// whose stored doc/body rows carry it (the R3 guard's admission signal; stored rows hold each hash once → one bump per -// unit). The match rows are reached by the same normalized-lowercase hash index time used, over the FULL match table +// pass 2 from persisted stats — doc-comment + body evidence as stored integers, and table.variantDocDf: per stem variant, +// the units whose stored doc/body rows carry it (the R3 guard's admission signal; stored rows hold each hash once → one +// bump per unit). The match rows are reached by the same normalized-lowercase hash index time used, over the FULL match table // (exact tokens + LB-3 stem variants), each hash mapped to its own tf ROW — the same row targeting the scan applies. // try_emplace keeps the FIRST entry on the astronomically-unlikely 64-bit collision between two DISTINCT table strings, // so both transfer strategies agree deterministically. -inline std::vector<std::uint32_t> addDocBodyFromPersistedStats( LexTfTable& table, const IngestResult& ing ) +inline void addDocBodyFieldsFromPersistedStats( LexMatchTfTable& table, const IngestResult& ing ) { PROFILE_SCOPE_DESCRIBE( "lexical: pass 2 via persisted subtoken stats (cached tf/dl, no corpus re-tokenize)" ); const std::size_t S = ing.symbols.size(); - const std::size_t matchCount = table.stride; + const std::size_t matchCount = table.matchCount(); const std::size_t uniqueCount = table.uniqueCount; - std::vector<std::uint32_t> dfVariant( table.variantCount(), 0u ); // dl first: BM25 length normalization needs EVERY doc's weighted length whether or not it matches // the query (avgdl sums them all), so this runs unconditionally — exact stored integers. @@ -989,7 +1056,7 @@ inline std::vector<std::uint32_t> addDocBodyFromPersistedStats( LexTfTable& tabl table.addStoredTf( i, m, int( storedTf ) ); if( m >= uniqueCount ) { - ++dfVariant[ m - uniqueCount ]; // stored rows hold each hash once → one df bump per symbol + ++table.variantDocDf[ m - uniqueCount ]; // stored rows hold each hash once → one df bump per symbol } }; @@ -1050,20 +1117,19 @@ inline std::vector<std::uint32_t> addDocBodyFromPersistedStats( LexTfTable& tabl } } } - return dfVariant; } // pass 2 by scanning (lean ingests, --no-cache lean verbs, multi-root merges, stubs) — doc-comment (×kLexWeightDoc) + // body (×kLexWeightBody) evidence, streamed ONE file at a time touching only that file's symbols: peak memory is a single // file's text, not the whole corpus held at once (symbol order within a file is irrelevant: integer counts commute -// exactly). Returns the same per-variant doc/body df the persisted branch returns, from the scan's own counts. +// exactly). Fills the same table.variantDocDf the persisted branch fills, from the scan's own counts. // // Files stream across a small worker pool: each worker holds ONE file's text at a time, and a file's symbols are touched // only by the worker that claimed the file — every dl[i] / tf row has exactly ONE writer (no locks needed). Determinism: // all pooled writes are exact integer counts and the float scoring stays single-threaded in doc order, so worker // scheduling cannot change a byte of output (no cross-doc float reductions — the det-gate rule). The per-(file, variant) // df tallies likewise have ONE writer each and merge single-threaded in file order. -inline std::vector<std::uint32_t> scanDocBodyFields( LexTfTable& table, const IngestResult& ing ) +inline void addDocBodyFieldsByFileScan( LexMatchTfTable& table, const IngestResult& ing ) { const std::size_t fileCount = ing.files.size(); const std::size_t variantCount = table.variantCount(); @@ -1143,15 +1209,24 @@ inline std::vector<std::uint32_t> scanDocBodyFields( LexTfTable& table, const In } } - std::vector<std::uint32_t> dfVariant( variantCount, 0u ); for( std::size_t f = 0; f < fileCount && variantCount > 0; ++f ) // deterministic df merge, file order { for( std::size_t v = 0; v < variantCount; ++v ) { - dfVariant[v] += dfPerFile[ f * variantCount + v ]; + table.variantDocDf[v] += dfPerFile[ f * variantCount + v ]; } } - return dfVariant; +} + +// pass 2 — doc-comment (×kLexWeightDoc) + body (×kLexWeightBody), from whichever source the ingest has (hasPersistedLexStats) +inline void addDocBodyFields( LexMatchTfTable& table, const IngestResult& ing ) +{ + if( hasPersistedLexStats( ing ) ) + { + addDocBodyFieldsFromPersistedStats( table, ing ); + return; + } + addDocBodyFieldsByFileScan( table, ing ); } // ── IDF-guard admission (rung R3) — the same decision after EITHER pass-2 source ───────────────────────── @@ -1159,9 +1234,9 @@ inline std::vector<std::uint32_t> scanDocBodyFields( LexTfTable& table, const In // one is admitted and folds into its original token's row — the exact integers the un-guarded arm would have // accumulated there. The cap reads the ranked corpus: an unranked unit does not widen it. Returns one flag per variant // (empty when disarmed); RIPWIRE_QSTEM_DEBUG prints each verdict on stderr. -inline std::vector<char> admitRareStemVariants( const std::vector<std::uint32_t>& dfVariant, std::size_t rankedCount, - const LexTfTable& table ) +inline std::vector<char> admitRareStemVariants( const LexMatchTfTable& table, std::size_t rankedCount ) { + const std::vector<std::uint32_t>& dfVariant = table.variantDocDf; const std::uint32_t sOver64 = std::uint32_t( rankedCount / 64 ); const std::uint32_t variantCap = sOver64 > 8u ? sOver64 : 8u; std::vector<char> admitted( dfVariant.size(), 0 ); @@ -1178,24 +1253,16 @@ inline std::vector<char> admitRareStemVariants( const std::vector<std::uint32_t> return admitted; } -// fold nameDf the SAME way the tf table folds, so the margin test sees one row per unique token on either arm. A doc -// carrying both the exact token and an admitted variant in its name is counted twice, so a folded nameDf is a CEILING, -// not a count — stated rather than hidden. It matters only when RIPWIRE_QSTEM is also armed, which ships off. -inline void foldAdmittedNameDf( std::vector<int>& nameDf, const std::vector<char>& admitted, const LexTfTable& table ) -{ - for( std::size_t v = 0; v < admitted.size() && !nameDf.empty(); ++v ) - { - nameDf[ table.matchToks[ table.uniqueCount + v ].u ] += admitted[v] != 0 ? nameDf[ table.uniqueCount + v ] : 0; - } -} - -// ── L-W: the term evidence, read off the FINAL tf rows (uniqueCount stride, every field, the fold applied) — one S×U -// integer scan, the same "tf > 0" fact the document frequency counts when scoring. (nameMask was captured in pass 1.) -inline void recordTermEvidence( LexTermEvidence& evidence, const LexTfTable& table, const LexCorpusRoles& roles, const DedupedQueryTerms& dedup ) +// ── L-W: the term evidence, read off the FINAL tf rows (LexTermTfTable: every field, the fold applied) — one S×U +// integer scan, the same "tf > 0" fact the document frequency counts when scoring. nameMask is pass 1's +// (addNameAndCalleeFieldsCapturingNameHits), sized for the same term count — asserted, not assumed. +inline void recordTermEvidence( LexTermEvidence& evidence, const LexTermTfTable& table, const LexCorpusRoles& roles, const DedupedQueryTerms& dedup ) { - const std::size_t S = table.dl.size(); + const std::size_t S = table.docCount(); const std::size_t uniqueCount = table.uniqueCount; - const std::size_t evidenceWords = evidence.maskWords; + const std::size_t evidenceWords = LexTermEvidence::maskWordsFor( uniqueCount ); + DASSERT( evidence.maskWords == evidenceWords && evidence.nameMask.size() == S * evidenceWords, + "pass 1 captures the name mask for the same symbols and terms before the evidence is recorded" ); evidence.termsSeenTotal = dedup.uniqueSeenTotal; evidence.termsCapped = dedup.capped; evidence.terms.assign( dedup.uniqueToks.begin(), dedup.uniqueToks.end() ); @@ -1258,19 +1325,18 @@ enum class TermMarginVerdict : std::uint8_t kSuppressed, }; -// Returns termKept per unique term: all 1 when the margin is disarmed (marginBits 0). -inline std::vector<char> judgeTermMargins( const LexTfTable& table, const LexCorpusRoles& roles, const std::vector<int>& nameDf, int marginBits, - const std::vector<std::string>& uniqueToks ) +// Returns termKept per unique term: all 1 when the margin is disarmed. +inline std::vector<char> judgeTermMargins( const LexTermTfTable& table, const LexCorpusRoles& roles, const std::vector<std::string>& uniqueToks ) { const std::size_t uniqueCount = table.uniqueCount; std::vector<char> termKept( uniqueCount, 1 ); - if( marginBits <= 0 ) + if( !table.margin.armed() ) { return termKept; } // df in fixed doc order over the folded rows — the same integers both pass-2 sources produced std::vector<int> dfMargin( uniqueCount, 0 ); - for( std::size_t i = 0; i < table.dl.size(); ++i ) + for( std::size_t i = 0; i < table.docCount(); ++i ) { const int* const tfRow = table.row( i ); const int w = roles.statsWeight( i ); @@ -1282,13 +1348,13 @@ inline std::vector<char> judgeTermMargins( const LexTfTable& table, const LexCor // "separates" at k bits: idf_u >= k*ln2 ⇔ (S-n+0.5)/(n+0.5) + 1 >= 2^k ⇔ n <= (S+0.5)/2^k - 0.5, // which at k = 1 is exactly n <= S/2. Evaluated in doubles from integer inputs, so it is a pure // function of (S, n, k) and cannot vary run to run. - const double separationCut = ( double( roles.countedCount ) + 0.5 ) / std::exp2( double( marginBits ) ) - 0.5; + const double separationCut = ( double( roles.countedCount ) + 0.5 ) / std::exp2( double( table.margin.bits ) ) - 0.5; std::vector<TermMarginVerdict> verdict( uniqueCount, TermMarginVerdict::kAbsent ); std::size_t presentCount = 0, survivorCount = 0; for( std::size_t u = 0; u < uniqueCount; ++u ) { const bool separatesDoc = double( dfMargin[u] ) <= separationCut; - const bool separatesName = nameDf[u] > 0 && double( nameDf[u] ) <= separationCut; + const bool separatesName = table.nameDf[u] > 0 && double( table.nameDf[u] ) <= separationCut; verdict[u] = dfMargin[u] == 0 ? TermMarginVerdict::kAbsent : separatesDoc ? TermMarginVerdict::kDocSeparates : separatesName ? TermMarginVerdict::kNameSeparates @@ -1312,7 +1378,7 @@ inline std::vector<char> judgeTermMargins( const LexTfTable& table, const LexCor for( std::size_t u = 0; u < uniqueCount; ++u ) { rw::emitTo( stderr, "term-margin: \"{}\" df={}/{} nameDf={} bits={} {}\n", uniqueToks[u].c_str(), dfMargin[u], roles.countedCount, - nameDf[u], marginBits, kVerdictText[ std::size_t( verdict[u] ) ] ); + table.nameDf[u], table.margin.bits, kVerdictText[ std::size_t( verdict[u] ) ] ); } rw::emitTo( stderr, "term-margin: {} present, {} survive, suppression {}\n", presentCount, survivorCount, applySuppression ? "applied" : "withheld (sole-anchor)" ); @@ -1325,21 +1391,28 @@ inline std::vector<char> judgeTermMargins( const LexTfTable& table, const LexCor // avgdl accumulates in the historical doc order (integer sums: exact in any order anyway). dfreq[u] = COUNTED units // containing unique query token u (w ≥ 1, so tf > 0 ⇔ the old docs[i] contained it); dfOut[u] = statsOut units carrying // it (all 0 with no statsOut). A counted unit scores with (countedCount, dfreq, avgdlCounted); a statsOut unit against -// the whole ranked corpus (rankedCount, dfreq + dfOut, avgdlRanked), as with no statsOut. +// the whole ranked corpus (rankedCount, dfreq + dfOut, avgdlRanked), as with no statsOut. That choice is made HERE, +// once per term and role: idfCounted / idfRanked (bm25Idf over each role's N and df) and avgdlOf(role) are what the +// scorer and the MaxScore bound read, so neither re-derives which corpus a unit scores against. struct LexBm25Stats { std::vector<int> dfreq; std::vector<int> dfOut; std::vector<int> tfMaxOf; // per term, its largest weighted tf anywhere — the MaxScore bound's T std::vector<std::uint32_t> candidateIds; // ascending: every unit with any tf > 0 + std::vector<double> idfCounted; // per term, a counted unit's idf: bm25Idf( countedCount, dfreq ) + std::vector<double> idfRanked; // per term, a statsOut unit's idf: bm25Idf( rankedCount, dfreq + dfOut ) double avgdlCounted = 0; double avgdlRanked = 0; Bm25Params params = kBm25Default; + + double idfOf( std::size_t u, bool statsOut ) const noexcept { return statsOut ? idfRanked[u] : idfCounted[u]; } + double avgdlOf( bool statsOut ) const noexcept { return statsOut ? avgdlRanked : avgdlCounted; } }; -inline LexBm25Stats tallyBm25Stats( const LexTfTable& table, const LexCorpusRoles& roles ) +inline LexBm25Stats tallyBm25Stats( const LexTermTfTable& table, const LexCorpusRoles& roles ) { - const std::size_t S = table.dl.size(); + const std::size_t S = table.docCount(); const std::size_t uniqueCount = table.uniqueCount; LexBm25Stats st; st.dfreq.assign( uniqueCount, 0 ); @@ -1369,6 +1442,13 @@ inline LexBm25Stats tallyBm25Stats( const LexTfTable& table, const LexCorpusRole } st.avgdlCounted /= double( roles.countedCount ? roles.countedCount : 1 ); st.avgdlRanked /= double( roles.rankedCount ? roles.rankedCount : 1 ); + st.idfCounted.resize( uniqueCount ); + st.idfRanked.resize( uniqueCount ); + for( std::size_t u = 0; u < uniqueCount; ++u ) + { + st.idfCounted[u] = bm25Idf( double( roles.countedCount ), double( st.dfreq[u] ) ); + st.idfRanked[u] = bm25Idf( double( roles.rankedCount ), double( st.dfreq[u] + st.dfOut[u] ) ); + } st.params = resolveBm25Params(); return st; } @@ -1398,8 +1478,8 @@ inline LexBm25Stats tallyBm25Stats( const LexTfTable& table, const LexCorpusRole class LexTopKPruner { public: - LexTopKPruner( std::size_t pruneTopK, const std::vector<char>* alwaysExact, const LexBm25Stats& st, const LexCorpusRoles& roles, - const DedupedQueryTerms& dedup, const std::vector<char>& termKept ) + LexTopKPruner( std::size_t pruneTopK, const std::vector<char>* alwaysExact, const LexBm25Stats& st, const DedupedQueryTerms& dedup, + const std::vector<char>& termKept ) : topK_( std::getenv( "RIPWIRE_NO_PRUNE" ) == nullptr ? pruneTopK : 0 ), alwaysExact_( alwaysExact ) { if( topK_ == 0 ) @@ -1424,10 +1504,9 @@ class LexTopKPruner continue; // never contributes anywhere — a suppressed term's cap stays 0, and a cap of // 0 bounds a contribution of 0, so the MaxScore proof above is unchanged } - const int n = st.dfreq[u]; - const int nAll = n + st.dfOut[u]; // an OUT unit's idf: the larger of the two bounds the contribution - const double idfIn = n > 0 ? std::log( ( double( roles.countedCount ) - n + 0.5 ) / ( n + 0.5 ) + 1.0 ) : 0.0; - const double idfAll = st.dfOut[u] > 0 ? std::log( ( double( roles.rankedCount ) - nAll + 0.5 ) / ( nAll + 0.5 ) + 1.0 ) : 0.0; + // the larger of the two roles' idf bounds the contribution; a role no unit carrying u plays contributes 0 + const double idfIn = st.dfreq[u] > 0 ? st.idfCounted[u] : 0.0; + const double idfAll = st.dfOut[u] > 0 ? st.idfRanked[u] : 0.0; const double idf = std::max( idfIn, idfAll ); const double cap1 = bm25ImpactBound( idf, double( st.tfMaxOf[u] ), st.params ); // A4: shared bound, same (k1,b) capOcc_[u] = cap1 * double( occCount[u] ); @@ -1490,7 +1569,7 @@ class LexTopKPruner // - a kRankFlagNotLexRanked unit (model.h) scores 0; // - a pruned unit provably cannot enter the top-K the caller consumes (LexTopKPruner). // So the exhaustive mode needs no loop of its own: it is this loop with a pruner that never skips. -inline std::vector<float> scoreLexCandidates( const IngestResult& ing, const LexTfTable& table, const LexBm25Stats& st, const LexCorpusRoles& roles, +inline std::vector<float> scoreLexCandidates( const IngestResult& ing, const LexTermTfTable& table, const LexBm25Stats& st, const LexCorpusRoles& roles, const DedupedQueryTerms& dedup, const std::vector<char>& termKept, LexTopKPruner& pruner, const std::vector<float>* symbolScoreMul ) { @@ -1508,8 +1587,7 @@ inline std::vector<float> scoreLexCandidates( const IngestResult& ing, const Lex continue; } const bool outI = roles.isStatsOut( i ); - const double Si = outI ? double( roles.rankedCount ) : double( roles.countedCount ); - const double avgI = outI ? st.avgdlRanked : st.avgdlCounted; + const double avgI = st.avgdlOf( outI ); double sc = 0; for( std::size_t qi = 0; qi < uniqueIndexOfQtok.size(); ++qi ) { @@ -1523,8 +1601,7 @@ inline std::vector<float> scoreLexCandidates( const IngestResult& ing, const Lex { continue; // old: docs[i].find( qt ) == end — termKept is all-1 disarmed, so this is that } - const int n = st.dfreq[u] + ( outI ? st.dfOut[u] : 0 ); - const double idf = std::log( ( Si - n + 0.5 ) / ( n + 0.5 ) + 1.0 ); + const double idf = st.idfOf( u, outI ); sc += idf * ( tf * ( k1 + 1.0 ) ) / ( tf + k1 * ( 1.0 - b + b * dl[i] / ( avgI > 0 ? avgI : 1.0 ) ) ); } // Markdown headings (sec) compete on name-match with code; down-weight so a doc stays FINDABLE but @@ -1578,30 +1655,29 @@ inline std::vector<float> lexicalScoresTiered( const IngestResult& ing, const st // S×terms allocation below. const DedupedQueryTerms dedup = dedupeQueryTerms( qToks, kMaxUniqueQueryTerms ); const std::vector<LexMatchTok> matchToks = buildLexMatchTable( dedup.uniqueToks ); - LexTfTable table( S, matchToks, dedup.uniqueToks.size() ); + LexMatchTfTable fields( S, matchToks, dedup.uniqueToks.size(), termMarginFromEnv() ); // the fields, weakest dependence first: name + callee (pass 1), path (1.5) and basename (1.6) need no file text, // so they run before the pass-2 source split; then doc-comment + body (pass 2) from whichever source the ingest has - const int marginBits = termMarginBitsFromEnv(); - std::vector<int> nameDf = addNameAndCalleeFields( table, ing, outOff, outTargets, roles, /*countNameDf=*/marginBits > 0, evidenceOut ); - addPathField( table, ing, fieldWeightOrEnv( pathFieldDefaultW, "RIPWIRE_PATHTOK_W" ), pathRootPrefix ); - addBasenameField( table, ing, fieldWeightOrEnv( basenameFieldDefaultW, "RIPWIRE_BASENAME_W" ), pathRootPrefix ); - const std::vector<std::uint32_t> dfVariant = hasPersistedLexStats( ing ) ? addDocBodyFromPersistedStats( table, ing ) : scanDocBodyFields( table, ing ); - - // what the corpus statistics decide: which stem variants stay, then which query terms separate - const std::vector<char> admitted = admitRareStemVariants( dfVariant, roles.rankedCount, table ); - table.foldAdmittedVariants( admitted ); - foldAdmittedNameDf( nameDf, admitted, table ); + addNameAndCalleeFieldsCapturingNameHits( fields, ing, outOff, outTargets, roles, evidenceOut ); + addPathField( fields, ing, fieldWeightOrEnv( pathFieldDefaultW, "RIPWIRE_PATHTOK_W" ), pathRootPrefix ); + addBasenameField( fields, ing, fieldWeightOrEnv( basenameFieldDefaultW, "RIPWIRE_BASENAME_W" ), pathRootPrefix ); + addDocBodyFields( fields, ing ); + + // what the corpus statistics decide: which stem variants stay (the fold leaves one row per query term), then + // which query terms separate + const std::vector<char> admitted = admitRareStemVariants( fields, roles.rankedCount ); + const LexTermTfTable terms = std::move( fields ).foldAdmittedVariants( admitted ); if( evidenceOut ) { - recordTermEvidence( *evidenceOut, table, roles, dedup ); + recordTermEvidence( *evidenceOut, terms, roles, dedup ); } - const std::vector<char> termKept = judgeTermMargins( table, roles, nameDf, marginBits, dedup.uniqueToks ); + const std::vector<char> termKept = judgeTermMargins( terms, roles, dedup.uniqueToks ); // score: corpus statistics, then every candidate the MaxScore pruner (armed only on request) does not rule out - const LexBm25Stats stats = tallyBm25Stats( table, roles ); - LexTopKPruner pruner( pruneTopK, alwaysExact, stats, roles, dedup, termKept ); - return scoreLexCandidates( ing, table, stats, roles, dedup, termKept, pruner, symbolScoreMul ); + const LexBm25Stats stats = tallyBm25Stats( terms, roles ); + LexTopKPruner pruner( pruneTopK, alwaysExact, stats, dedup, termKept ); + return scoreLexCandidates( ing, terms, stats, roles, dedup, termKept, pruner, symbolScoreMul ); } // the un-tiered contract every pre-§P4 caller keeps (evals, exemplar, --recall): same arity as always, From 914c4045d08e71e6e6ad23e8a9a1a6b490679aee Mon Sep 17 00:00:00 2001 From: joyful-ii-V-I <210578314+joyful-ii-V-I@users.noreply.github.com> Date: Sun, 22 Nov 2026 03:32:37 -0500 Subject: [PATCH 33/44] showcase: the 11-20 capture stays main's; the train re-records once at its tip Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --- docs/captures/COMMANDS_showcase_2026-11-20.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/captures/COMMANDS_showcase_2026-11-20.md b/docs/captures/COMMANDS_showcase_2026-11-20.md index b32febb29..a3f728743 100644 --- a/docs/captures/COMMANDS_showcase_2026-11-20.md +++ b/docs/captures/COMMANDS_showcase_2026-11-20.md @@ -5981,7 +5981,7 @@ ripwire: --run-timeout=SECONDS modifies --run-trace — pass it too (e.g. ripwir *The session legend dictionary the MCP server serves as ripwire://legend-dict/full — one definition per line, headed by its dictv= version; no corpus needed. =roster lists the completeness attributes it defines.* ````` -ripwire legend dictionary ripwire.dict/v1 dictv=6ad237691d743450 entries=1178 +ripwire legend dictionary ripwire.dict/v1 dictv=c40ddf725e4befcb entries=1177 <about legend="ref" dict= dictv=>: this LAST child is only the legend pointer; the root keeps every attribute it carries inline, unchanged (schema=, each count, cut and floor); rows follow it; legend="ref": a definition is sent once per session (this dictionary's core, or the first answer that needs … [line truncated: 80 more bytes on this line] schema=ripwire.KEY/v1: the line ripwire.KEY/v1 below reads the answer's rows window: shown= total= capped= has_more= next_offset= offset= limit= page a list (capped=1 cut; next_offset= pastes as offset=) From 3e2054168853567277f8bc815c498b1f8c4e16bf Mon Sep 17 00:00:00 2001 From: joyful-ii-V-I <210578314+joyful-ii-V-I@users.noreply.github.com> Date: Sun, 22 Nov 2026 03:58:03 -0500 Subject: [PATCH 34/44] Re-record the showcase once on the composed GE train 3 tip; re-pin qschemetrip The 11-22 capture is recorded once on the clean composed tree (main b576a95e3 + the five members); docs/COMMANDS.md is rebuilt from it. qschemetrip.hash re-pinned with UPDATE_GOLDEN=1 from the composed build (RE-PIN LOG entry). printf_parity.manifest and the legend dictionary pair are unchanged by the regen. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --- docs/COMMANDS.md | 799 +- docs/captures/COMMANDS_showcase_2026-11-22.md | 7881 +++++++++++++++++ test/qschemetrip.hash | 2 +- test/qschemetripcheck.sh | 4 + 4 files changed, 8279 insertions(+), 407 deletions(-) create mode 100644 docs/captures/COMMANDS_showcase_2026-11-22.md diff --git a/docs/COMMANDS.md b/docs/COMMANDS.md index 74156ca55..c8ab567c2 100644 --- a/docs/COMMANDS.md +++ b/docs/COMMANDS.md @@ -9,7 +9,7 @@ python3 docs/docs_commands_build.py --bin build/ripwire The flag surface below is read from `ripwire --help`, so it cannot disagree with the shipped binary. `test/docscommandscheck.sh` fails if it ever does — in either direction. -Sample output is lifted from a real recorded run (`docs/captures/COMMANDS_showcase_2026-11-21.md`), trimmed to the first few lines and +Sample output is lifted from a real recorded run (`docs/captures/COMMANDS_showcase_2026-11-22.md`), trimmed to the first few lines and scrubbed of local paths. It is illustrative, not a golden: run the command yourself for the current shape. @@ -72,10 +72,10 @@ $ ./build/ripwire . --top-k=5 <!-- t=modscope=a-file's-MODULE-SCOPE(n=<file-scope>):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 --> <!-- t=type|alias|functype=a-Go-named-type-by-its-written-form:type=a-defined-type-whose-WRITTEN-form-is-not-a-struct/iface/func-literal(type-N-string;type-W-Pair-too,whatever-Pair-is-underneath),alias=type-A=B,functype=type-F-func(...) --> <!-- t=alias|functype-in-C++-and-.h:alias=using-X=Y(also-templated-or-class-scope)or-namespace-L=lib(defs=X-prints-its-written-target-as-to=),functype=a-typedef-of-a-function-or-function-pointer-type(typedef-void(*F)(int));other-typedefs-read-t=struct --> -<!-- files=4842 symbols=44689 edges=44883 shown=5 est_tokens=4130 ambiguous=3960 unresolved=20090 locality_pinned=14 external=12459 declined=45292 extent_suspect_syms=12 macro_blanked_files=7 skipped_oversize=15 unindexed="txt:85,tsv:54,mod:33,xml:33,jsonl:26,scm:25" unindexed_exts=23 order=important-first --> -<r schema="ripwire.map/v1" root="." est_tokens="4130" pr_iters="38"> +<!-- files=4852 symbols=45031 edges=45381 shown=5 est_tokens=4159 ambiguous=3984 unresolved=20100 locality_pinned=14 external=12460 declined=45307 extent_suspect_syms=12 macro_blanked_files=7 skipped_oversize=15 unindexed="txt:85,tsv:54,mod:33,xml:33,jsonl:26,scm:25" unindexed_exts=23 order=important-first --> +<r schema="ripwire.map/v1" root="." est_tokens="4159" pr_iters="37"> <f p="src/infra/nodekind.h" layer="infra"> -<s t="fn" n="kindIs" sc="rw" k="0.0031"> +<s t="fn" n="kindIs" sc="rw" k="0.0032"> </s> </f> <f p="src/ingest_metrics.h"> @@ -108,10 +108,10 @@ $ ./build/ripwire . --top-k=5 --no-inventory <!-- t=modscope=a-file's-MODULE-SCOPE(n=<file-scope>):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 --> <!-- t=type|alias|functype=a-Go-named-type-by-its-written-form:type=a-defined-type-whose-WRITTEN-form-is-not-a-struct/iface/func-literal(type-N-string;type-W-Pair-too,whatever-Pair-is-underneath),alias=type-A=B,functype=type-F-func(...) --> <!-- t=alias|functype-in-C++-and-.h:alias=using-X=Y(also-templated-or-class-scope)or-namespace-L=lib(defs=X-prints-its-written-target-as-to=),functype=a-typedef-of-a-function-or-function-pointer-type(typedef-void(*F)(int));other-typedefs-read-t=struct --> -<!-- files=4842 symbols=44689 edges=44883 shown=5 est_tokens=1206 ambiguous=3960 unresolved=20090 locality_pinned=14 external=12459 declined=45292 extent_suspect_syms=12 macro_blanked_files=7 skipped_oversize=15 unindexed="txt:85,tsv:54,mod:33,xml:33,jsonl:26,scm:25" unindexed_exts=23 order=important-first --> -<r schema="ripwire.map/v1" root="." est_tokens="1206" pr_iters="38"> +<!-- files=4852 symbols=45031 edges=45381 shown=5 est_tokens=1206 ambiguous=3984 unresolved=20100 locality_pinned=14 external=12460 declined=45307 extent_suspect_syms=12 macro_blanked_files=7 skipped_oversize=15 unindexed="txt:85,tsv:54,mod:33,xml:33,jsonl:26,scm:25" unindexed_exts=23 order=important-first --> +<r schema="ripwire.map/v1" root="." est_tokens="1206" pr_iters="37"> <f p="src/infra/nodekind.h" layer="infra"> -<s t="fn" n="kindIs" sc="rw" k="0.0031"> +<s t="fn" n="kindIs" sc="rw" k="0.0032"> </s> </f> <f p="src/ingest_metrics.h"> @@ -142,10 +142,10 @@ $ ./build/ripwire . --max-tokens=1500 <!-- t=modscope=a-file's-MODULE-SCOPE(n=<file-scope>):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 --> <!-- t=type|alias|functype=a-Go-named-type-by-its-written-form:type=a-defined-type-whose-WRITTEN-form-is-not-a-struct/iface/func-literal(type-N-string;type-W-Pair-too,whatever-Pair-is-underneath),alias=type-A=B,functype=type-F-func(...) --> <!-- t=alias|functype-in-C++-and-.h:alias=using-X=Y(also-templated-or-class-scope)or-namespace-L=lib(defs=X-prints-its-written-target-as-to=),functype=a-typedef-of-a-function-or-function-pointer-type(typedef-void(*F)(int));other-typedefs-read-t=struct --> -<!-- files=4842 symbols=44689 edges=44883 shown=1 est_tokens=1122 ambiguous=3960 unresolved=20090 locality_pinned=14 external=12459 declined=45292 extent_suspect_syms=12 macro_blanked_files=7 skipped_oversize=15 unindexed="txt:85,tsv:54,mod:33,xml:33,jsonl:26,scm:25" unindexed_exts=23 max_tokens=1500 fit_bytes=3186 over_ceiling=1 order=important-first --> -<r schema="ripwire.map/v1" root="." est_tokens="1122" pr_iters="38"> +<!-- files=4852 symbols=45031 edges=45381 shown=1 est_tokens=1122 ambiguous=3984 unresolved=20100 locality_pinned=14 external=12460 declined=45307 extent_suspect_syms=12 macro_blanked_files=7 skipped_oversize=15 unindexed="txt:85,tsv:54,mod:33,xml:33,jsonl:26,scm:25" unindexed_exts=23 max_tokens=1500 fit_bytes=3186 over_ceiling=1 order=important-first --> +<r schema="ripwire.map/v1" root="." est_tokens="1122" pr_iters="37"> <f p="src/infra/nodekind.h" layer="infra"> -<s t="fn" n="kindIs" sc="rw" k="0.0031"> +<s t="fn" n="kindIs" sc="rw" k="0.0032"> </s> </f> </r> @@ -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 <!-- ripwire map schema=ripwire.map/v1: the ranked map WITHHELD whole, no rows: withheld=1 marks this record, withheld_est_tokens= the map's price, over budget= (the token budget asked); rerun with a larger token budget, or max-tokens to shape a map that fits. --> -<r schema="ripwire.map/v1" withheld_est_tokens="10570" budget="100" withheld="1"/> +<r schema="ripwire.map/v1" withheld_est_tokens="10597" budget="100" withheld="1"/> ``` **Shaped by:** `--top-k`, `--max-tokens`, `--for`, `--sections`, `--recall`, `--handoff`, `--pr-context`, `--from-trace` @@ -225,14 +225,14 @@ _Name-shaped query: the router picks name-exact BM25 (header says which/why)._ ``` $ ./build/ripwire . --for="rankGraphTeleport" -<ctx task="rankGraphTeleport" route="name-exact(rankGraphTeleport); anchors: rankGraphTeleport(src/graph.h)" root="." confidence="high" margin_pct="45" at="ed47f82e8" doc_mentions="2" schema="ripwire.for/v1" bundle="auto" bodies="1" doc_mentions_capped="1" doc_mentions_total="14" est_tokens="2165"> +<ctx task="rankGraphTeleport" route="name-exact(rankGraphTeleport); anchors: rankGraphTeleport(src/graph.h)" root="." confidence="high" margin_pct="45" at="914c4045d" doc_mentions="2" schema="ripwire.for/v1" bundle="auto" bodies="1" doc_mentions_capped="1" doc_mentions_total="14" est_tokens="2165"> <!-- ripwire for schema=ripwire.for/v1: bundle=/bodies=/reason= the body posture; d: cx= ccx= complexity, in= callers (absent cx/ccx/in = 0), churn= amp= change, clone= tested= 1, sc= scope, id=p::sc::n; total= shown= capped=1 if cut; task= the query; d pure=1 const/constexpr sig, next= the follow-up to paste; route= name-exact(X)|subtoken+body[:broad|:declined]; confidence=/margin_pct= head score drop (low=flat); b t= n= p= l= full bodies, c n= l= p= callee signatures (p= if not b's); callers of=: the one function's 1-hop callers, s t= n= sc= p=file:line (n=Owner.name folds sc= on a member; sites_at= its calls as [file:]line, sites_total= if cut; via=name by name only), shown= of total=; d=2 rows: their callers (via=name if every path has a by-name hop), shown_d2= of d2= (d2_capped=1 if cut, else 0); capped=1 if cut; floors; next= the radius; windows=1: the radius call lists only a first page of next_total= rows (the impact verb's own count, a floor), so no page is pointed at: next= lists them all, columnar; t p= file outside sigs (weaker), t sym= its top symbols not in sigs/syms (a pointer, not the answer), r= rank (gap = trimmed); t order: code files first, then doc files (a code question); d e= its last line (absent=unknown, never 0; l= the name's line); c prov=split: a resolver split arm; may be another arm's (NOT a claim the edge is false) [doc mentions: 2 docs, 1 symbol; doc_mentions=] [floor: kept 3 of 40] --> <!-- root= is the crawl root; p= below is RELATIVE to it (single-root only; absent => p= is ingest's own path, unchanged); at=this commit(+dirty). [cut: doc_mentions_capped="1" doc_mentions_total="14" — an indexing cap dropped content not shown here] est_tokens= prices this bundle in tokens --> <sigs> <d l="14921" e="14949" n="rankGraphTeleport" sc="rw" p="src/graph.h" cx="5" ccx="8" in="7" churn="732" amp="990" r="1" next="--expand=src/graph.h:rankGraphTeleport"> <doc>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 (edges</doc>inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>&am … [line truncated: 31 more bytes on this line] <d l="501" n="The convergence disclosure contract" sc="rank — Personalized PageRank" p="docs/ARCHITECTURE.md" churn="79" amp="202" r="2">#### The convergence disclosure contract</d> -<d l="6391" n="Wave-2 adversarial verification (2026-08-19) — six probes against `aa97c9e`" sc="6. Correctness and quality instruments" p="docs/EVALS.md" churn="1178" amp="1393" r="3">### Wave-2 adversarial verification (2026-08-19) — six probes against `aa97c9e`</d> +<d l="6401" n="Wave-2 adversarial verification (2026-08-19) — six probes against `aa97c9e`" sc="6. Correctness and quality instruments" p="docs/EVALS.md" churn="1179" amp="1396" r="3">### Wave-2 adversarial verification (2026-08-19) — six probes against `aa97c9e`</d> </sigs> <tail total="3" shown="3" capped="0"> <t p="src/graph.h"/> @@ -262,14 +262,14 @@ _Restore the <lego>/<compose> sections the --for bundle collapses to a counted s ``` $ ./build/ripwire . --for="tree-sitter parse of a source file" --sections=lego,compose -<ctx task="tree-sitter parse of a source file" route="subtoken+body" root="." confidence="low" margin_pct="0" at="ed47f82e8" doc_mentions="1" schema="ripwire.for/v1" bundle="compact" bodies="0" reason="compact-route" budget_bytes="7500" est_tokens="10588"> +<ctx task="tree-sitter parse of a source file" route="subtoken+body" root="." confidence="low" margin_pct="0" at="914c4045d" doc_mentions="1" schema="ripwire.for/v1" bundle="compact" bodies="0" reason="compact-route" budget_bytes="7500" est_tokens="10590"> <!-- ripwire for schema=ripwire.for/v1: bundle=/bodies=/reason= the body posture; d: cx= ccx= complexity, in= callers (absent cx/ccx/in = 0), churn= amp= change, clone= tested= 1, sc= scope, id=p::sc::n; total= shown= capped=1 if cut; task= the query; d pure=1 const/constexpr sig, next= the follow-up to paste; d same_as=N: doc+sig text as row n=N (not repeated); route= name-exact(X)|subtoken+body[:broad|:declined]; confidence=/margin_pct= head score drop (low=flat); h l= p= n=, c n= l= p= (p= if not h's; same-named joined, shown= counts them), noedge= no callee resolved; fold kind=bodies: b t= n= p= l= top ranked rows' whole bodies, not the answer; served= of total= in budget_bytes=; slice/skip p= n= l=; skip bytes= next=; a skip makes sigs next= it, sigs_next= the signatures-only re-call; d mem= an owner's direct member names only, by the index (question words first, then owner's file, path, line, name), mem_more= names cut; t p= file outside sigs (weaker), t sym= its top symbols not in sigs/syms (a pointer, not the answer), r= rank (gap = trimmed); t order: code files first, then doc files (a code question); t page rows go on to file-page row 160 (code question: 160 code rows, docs within row 160); past page 0 (code question: past 40 code rows, a doc past row 40) listed last, head files skipped; past 120 of those p= only, p_only= counts them; t folded=class=N: N p= only rows of that class (doc|config|script|testdata|other) not listed, next= pages to them; field name= type= owner= rel=: a member of owner=, rel=creates held by value, uses by reference/pointer; iface implementors=N: types implementing it, m= its method contract; d e= its last line (absent=unknown, never 0; l= the name's line) [doc mentions: 1 doc, 1 symbol; doc_mentions=] --> <!-- root= is the crawl root; p= below is RELATIVE to it (single-root only; absent => p= is ingest's own path, unchanged); at=this commit(+dirty). [budget_bytes= is the default BYTE target this ranked payload was shaped toward: row text shortens toward it, no row of the ranked head is removed for it (sigs past_target=)] [sigs capped=1 with shown=total: rows shrunk, none dropped] [sigs past_target=K: the last K rows are past the budget_bytes target, served because they are rows of the ranked head; none is cut] [sigs next=: one call serving all total= rows uncut] [docs_dropped=N: N shown rows have a doc comment not printed (r>24 always, r5..24 if capped)] [files_first=N: N rows moved so r=1..8 are distinct files' best rows, score order, a repeated name once; same rows; fold, hops keep score order]; iface implementors=N counts every type an extends/implements clause binds to it (the lego verb's count), never the rows listed: shown_implementors=K only K impl rows here (implementors_capped=1), implementors_next= lists all; implementors_floor=1 an extends clause spelled like it bound nowhere, so N may be short (not proof of another), floor_next= lists every extends site est_tokens= prices this bundle in tokens --> <sigs shown="40" total="40" capped="1" past_target="7" docs_dropped="24" files_first="7" next="--for='tree-sitter parse of a source file' --signatures-only --token-budget=5400"> <d l="28" e="63" n="topLevelEvidence" sc="rw::pythonrunner" p="src/pythonrunner.h" cx="4" ccx="3" in="2" churn="5" amp="15" r="1" next="--expand=src/pythonrunner.h:topLevelEvidence">inline bool topLevelEvidence( std::string_view source, const TSLanguage* language, const Predicate& predicate )</d … [line truncated: 1 more bytes on this line] <d l="45" e="45" n="kDefaultMaxFileBytes" sc="rw" p="src/ingest.h" churn="72" amp="185" pure="1" r="2"> <doc>The crawl's per-file byte ceiling. A text file larger than this is skipped: at this size it is o…</doc>constexpr std::size_t kDefaultMaxFileBytes = 4u * 1024u * 1024u</d> -<d l="1247" e="1255" n="parseTree" p="src/ingest_sidecap.h" cx="1" in="4" churn="181" amp="364" tested="1" r="3">TSTree* parseTree( TSParser* parser, std::string_view src )</d> +<d l="1247" e="1255" n="parseTree" p="src/ingest_sidecap.h" cx="1" in="4" churn="188" amp="364" tested="1" r="3">TSTree* parseTree( TSParser* parser, std::string_view src )</d> <d l="594" e="669" n="doctorProbeGrammars" p="src/verbs_doctor.h" cx="7" ccx="17" in="1" churn="51" amp="150" r="4"> <doc>Exercise every registered grammar and its embedded query, reporting loaded and expected totals</doc>inline DoctorGrammarProbe doctorProbeGrammars()</d> ... [21 more line(s); run it to see the whole thing] @@ -289,14 +289,14 @@ _T3 opt-out: the signatures-only lens (no auto bodies, no bundle="auto" attribut ``` $ ./build/ripwire . --for="rankGraphTeleport" --signatures-only -<ctx task="rankGraphTeleport" route="name-exact(rankGraphTeleport); anchors: rankGraphTeleport(src/graph.h)" root="." confidence="high" margin_pct="45" at="ed47f82e8" doc_mentions="2" schema="ripwire.for/v1" doc_mentions_capped="1" doc_mentions_total="14" est_tokens="959"> +<ctx task="rankGraphTeleport" route="name-exact(rankGraphTeleport); anchors: rankGraphTeleport(src/graph.h)" root="." confidence="high" margin_pct="45" at="914c4045d" doc_mentions="2" schema="ripwire.for/v1" doc_mentions_capped="1" doc_mentions_total="14" est_tokens="959"> <!-- ripwire for schema=ripwire.for/v1: bundle=/bodies=/reason= the body posture; d: cx= ccx= complexity, in= callers (absent cx/ccx/in = 0), churn= amp= change, clone= tested= 1, sc= scope, id=p::sc::n; total= shown= capped=1 if cut; task= the query; d pure=1 const/constexpr sig, next= the follow-up to paste; route= name-exact(X)|subtoken+body[:broad|:declined]; confidence=/margin_pct= head score drop (low=flat); t p= file outside sigs (weaker), t sym= its top symbols not in sigs/syms (a pointer, not the answer), r= rank (gap = trimmed); t order: code files first, then doc files (a code question); d e= its last line (absent=unknown, never 0; l= the name's line) [doc mentions: 2 docs, 1 symbol; doc_mentions=] [floor: kept 3 of 40] --> <!-- root= is the crawl root; p= below is RELATIVE to it (single-root only; absent => p= is ingest's own path, unchanged); at=this commit(+dirty). [cut: doc_mentions_capped="1" doc_mentions_total="14" — an indexing cap dropped content not shown here] est_tokens= prices this bundle in tokens --> <sigs> <d l="14921" e="14949" n="rankGraphTeleport" sc="rw" p="src/graph.h" cx="5" ccx="8" in="7" churn="732" amp="990" r="1" next="--expand=src/graph.h:rankGraphTeleport"> <doc>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 (edges</doc>inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>&am … [line truncated: 31 more bytes on this line] <d l="501" n="The convergence disclosure contract" sc="rank — Personalized PageRank" p="docs/ARCHITECTURE.md" churn="79" amp="202" r="2">#### The convergence disclosure contract</d> -<d l="6391" n="Wave-2 adversarial verification (2026-08-19) — six probes against `aa97c9e`" sc="6. Correctness and quality instruments" p="docs/EVALS.md" churn="1178" amp="1393" r="3">### Wave-2 adversarial verification (2026-08-19) — six probes against `aa97c9e`</d> +<d l="6401" n="Wave-2 adversarial verification (2026-08-19) — six probes against `aa97c9e`" sc="6. Correctness and quality instruments" p="docs/EVALS.md" churn="1179" amp="1396" r="3">### Wave-2 adversarial verification (2026-08-19) — six probes against `aa97c9e`</d> </sigs> <tail total="3" shown="3" capped="0"> <t p="src/graph.h"/> @@ -324,14 +324,14 @@ _Opt OUT of compact conceptual serving: restore the rank-first auto <bodies> wal ``` $ ./build/ripwire . --for="tree-sitter parse of a source file" --auto-bodies -<ctx task="tree-sitter parse of a source file" route="subtoken+body" root="." confidence="low" margin_pct="0" at="ed47f82e8" doc_mentions="1" schema="ripwire.for/v1" bundle="auto" bodies="5" budget_bytes="7500" est_tokens="10291"> +<ctx task="tree-sitter parse of a source file" route="subtoken+body" root="." confidence="low" margin_pct="0" at="914c4045d" doc_mentions="1" schema="ripwire.for/v1" bundle="auto" bodies="5" budget_bytes="7500" est_tokens="10293"> <!-- ripwire for schema=ripwire.for/v1: bundle=/bodies=/reason= the body posture; d: cx= ccx= complexity, in= callers (absent cx/ccx/in = 0), churn= amp= change, clone= tested= 1, sc= scope, id=p::sc::n; total= shown= capped=1 if cut; task= the query; d pure=1 const/constexpr sig, next= the follow-up to paste; d same_as=N: doc+sig text as row n=N (not repeated); route= name-exact(X)|subtoken+body[:broad|:declined]; confidence=/margin_pct= head score drop (low=flat); b t= n= p= l= full bodies, c n= l= p= callee signatures (p= if not b's); t p= file outside sigs (weaker), t sym= its top symbols not in sigs/syms (a pointer, not the answer), r= rank (gap = trimmed); t order: code files first, then doc files (a code question); t page rows go on to file-page row 160 (code question: 160 code rows, docs within row 160); past page 0 (code question: past 40 code rows, a doc past row 40) listed last, head files skipped; past 120 of those p= only, p_only= counts them; t folded=class=N: N p= only rows of that class (doc|config|script|testdata|other) not listed, next= pages to them; d e= its last line (absent=unknown, never 0; l= the name's line) [doc mentions: 1 doc, 1 symbol; doc_mentions=] --> <!-- root= is the crawl root; p= below is RELATIVE to it (single-root only; absent => p= is ingest's own path, unchanged); at=this commit(+dirty). [budget_bytes= is the default BYTE target this ranked payload was shaped toward: row text shortens toward it, no row of the ranked head is removed for it (sigs past_target=)] [sigs capped=1 with shown=total: rows shrunk, none dropped] [sigs past_target=K: the last K rows are past the budget_bytes target, served because they are rows of the ranked head; none is cut] [sigs next=: one call serving all total= rows uncut] [docs_dropped=N: N shown rows have a doc comment not printed (r>24 always, r5..24 if capped)] [files_first=N: N rows moved so r=1..8 are distinct files' best rows, score order, a repeated name once; same rows; fold, hops keep score order]; lego/compose collapse to a counted stub by default (a disclosed cut): total= that section's own pre-cap row count, shown="0" capped="1" (nothing rendered here), next= names the sections=lego,compose flag that restores both sections byte-identically in one call est_tokens= prices this bundle in tokens --> <sigs shown="40" total="40" capped="1" past_target="7" docs_dropped="24" files_first="7" next="--for='tree-sitter parse of a source file' --signatures-only --token-budget=5400"> <d l="28" e="63" n="topLevelEvidence" sc="rw::pythonrunner" p="src/pythonrunner.h" cx="4" ccx="3" in="2" churn="5" amp="15" r="1" next="--expand=src/pythonrunner.h:topLevelEvidence">inline bool topLevelEvidence( std::string_view source, const TSLanguage* language, const Predicate& predicate )</d … [line truncated: 1 more bytes on this line] <d l="45" e="45" n="kDefaultMaxFileBytes" sc="rw" p="src/ingest.h" churn="72" amp="185" pure="1" r="2"> <doc>The crawl's per-file byte ceiling. A text file larger than this is skipped: at this size it is o…</doc>constexpr std::size_t kDefaultMaxFileBytes = 4u * 1024u * 1024u</d> -<d l="1247" e="1255" n="parseTree" p="src/ingest_sidecap.h" cx="1" in="4" churn="181" amp="364" tested="1" r="3">TSTree* parseTree( TSParser* parser, std::string_view src )</d> +<d l="1247" e="1255" n="parseTree" p="src/ingest_sidecap.h" cx="1" in="4" churn="188" amp="364" tested="1" r="3">TSTree* parseTree( TSParser* parser, std::string_view src )</d> <d l="594" e="669" n="doctorProbeGrammars" p="src/verbs_doctor.h" cx="7" ccx="17" in="1" churn="51" amp="150" r="4"> <doc>Exercise every registered grammar and its embedded query, reporting loaded and expected totals</doc>inline DoctorGrammarProbe doctorProbeGrammars()</d> ... [21 more line(s); run it to see the whole thing] @@ -356,7 +356,7 @@ _Same query with routing forced OFF (plain subtoken+body BM25) — contrast with ``` $ ./build/ripwire . --for="rankGraphTeleport" --no-route -<ctx task="rankGraphTeleport" root="." confidence="low" margin_pct="0" at="ed47f82e8" doc_mentions="6" schema="ripwire.for/v1" bundle="auto" bodies="4" budget_bytes="7500" doc_mentions_capped="1" doc_mentions_total="22" est_tokens="10976"> +<ctx task="rankGraphTeleport" root="." confidence="low" margin_pct="0" at="914c4045d" doc_mentions="6" schema="ripwire.for/v1" bundle="auto" bodies="4" budget_bytes="7500" doc_mentions_capped="1" doc_mentions_total="22" est_tokens="10974"> <!-- ripwire for schema=ripwire.for/v1: bundle=/bodies=/reason= the body posture; d: cx= ccx= complexity, in= callers (absent cx/ccx/in = 0), churn= amp= change, clone= tested= 1, sc= scope, id=p::sc::n; total= shown= capped=1 if cut; task= the query; d pure=1 const/constexpr sig, next= the follow-up to paste; confidence=/margin_pct= head score drop (low=flat); b t= n= p= l= full bodies, c n= l= p= callee signatures (p= if not b's); t p= file outside sigs (weaker), t sym= its top symbols not in sigs/syms (a pointer, not the answer), r= rank (gap = trimmed); t order: code files first, then doc files (a code question); t page rows go on to file-page row 160 (code question: 160 code rows, docs within row 160); past page 0 (code question: past 40 code rows, a doc past row 40) listed last, head files skipped; past 120 of those p= only, p_only= counts them; t folded=class=N: N p= only rows of that class (doc|config|script|testdata|other) not listed, next= pages to them; field name= type= owner= rel=: a member of owner=, rel=creates held by value, uses by reference/pointer; d e= its last line (absent=unknown, never 0; l= the name's line); c prov=split: a resolver split arm; may be another arm's (NOT a claim the edge is false) [doc mentions: 6 docs, 3 symbols; doc_mentions=] --> <!-- root= is the crawl root; p= below is RELATIVE to it (single-root only; absent => p= is ingest's own path, unchanged); at=this commit(+dirty). [budget_bytes= is the default BYTE target this ranked payload was shaped toward: row text shortens toward it, no row of the ranked head is removed for it (sigs past_target=)] [sigs capped=1 with shown=total: rows shrunk, none dropped] [sigs past_target=K: the last K rows are past the budget_bytes target, served because they are rows of the ranked head; none is cut] [sigs next=: one call serving all total= rows uncut] [docs_dropped=N: N shown rows have a doc comment not printed (r>24 always, r5..24 if capped)] [cut: doc_mentions_capped="1" doc_mentions_total="22" — an indexing cap dropped content not shown here] est_tokens= prices this bundle in tokens --> <sigs shown="40" total="40" capped="1" past_target="14" docs_dropped="25" next="--for=rankGraphTeleport --signatures-only --no-route --token-budget=6700"> @@ -366,7 +366,7 @@ $ ./build/ripwire . --for="rankGraphTeleport" --no-route <doc>uniform-teleport PageRank (the default). A kRankFlagNotNamed unit (model.h) has no edge and a 0 …</doc>inline RankedGraph rankGraph( const Graph& g, float alpha = 0.85f )</d> <d l="105" e="109" n="storedDefaultRank" sc="rw::warmsnap" p="src/warmsnap_graph.h" cx="1" in="3" churn="2" amp="33" r="3"> <doc>The default map's PageRank — uniform teleport, the one rank that is a function of the Graph al…</doc>inline std::optional<RankedGraph>& storedDefaultRank() noexcept</d> -<d l="1471" e="1510" n="churnRankedGraph" p="src/main.cpp" cx="10" ccx="12" in="1" churn="509" amp="664" r="4">inline ChurnRanking churnRankedGraph( const MainDispatch& d )</d> +<d l="1472" e="1511" n="churnRankedGraph" p="src/main.cpp" cx="10" ccx="12" in="1" churn="514" amp="669" r="4">inline ChurnRanking churnRankedGraph( const MainDispatch& d )</d> ... [20 more line(s); run it to see the whole thing] ``` @@ -388,14 +388,14 @@ _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 -<ctx task="tree-sitter parse of a source file" route="subtoken+body" root="." confidence="low" margin_pct="0" at="ed47f82e8" doc_mentions="1" schema="ripwire.for/v1" bundle="compact" bodies="0" reason="compact-route" budget_bytes="7500" est_tokens="10086"> +<ctx task="tree-sitter parse of a source file" route="subtoken+body" root="." confidence="low" margin_pct="0" at="914c4045d" doc_mentions="1" schema="ripwire.for/v1" bundle="compact" bodies="0" reason="compact-route" budget_bytes="7500" est_tokens="10088"> <!-- ripwire for schema=ripwire.for/v1: bundle=/bodies=/reason= the body posture; d: cx= ccx= complexity, in= callers (absent cx/ccx/in = 0), churn= amp= change, clone= tested= 1, sc= scope, id=p::sc::n; total= shown= capped=1 if cut; task= the query; d pure=1 const/constexpr sig, next= the follow-up to paste; d same_as=N: doc+sig text as row n=N (not repeated); route= name-exact(X)|subtoken+body[:broad|:declined]; confidence=/margin_pct= head score drop (low=flat); h l= p= n=, c n= l= p= (p= if not h's; same-named joined, shown= counts them), noedge= no callee resolved; fold kind=bodies: b t= n= p= l= top ranked rows' whole bodies, not the answer; served= of total= in budget_bytes=; slice/skip p= n= l=; skip bytes= next=; a skip makes sigs next= it, sigs_next= the signatures-only re-call; d mem= an owner's direct member names only, by the index (question words first, then owner's file, path, line, name), mem_more= names cut; t p= file outside sigs (weaker), t sym= its top symbols not in sigs/syms (a pointer, not the answer), r= rank (gap = trimmed); t order: code files first, then doc files (a code question); t page rows go on to file-page row 160 (code question: 160 code rows, docs within row 160); past page 0 (code question: past 40 code rows, a doc past row 40) listed last, head files skipped; past 120 of those p= only, p_only= counts them; t folded=class=N: N p= only rows of that class (doc|config|script|testdata|other) not listed, next= pages to them; d e= its last line (absent=unknown, never 0; l= the name's line) [adaptive: kept 40 of 40 - no relevance cliff (broad query saturates the score); capped at the ceiling] [doc mentions: 1 doc, 1 symbol; doc_mentions=] --> <!-- root= is the crawl root; p= below is RELATIVE to it (single-root only; absent => p= is ingest's own path, unchanged); at=this commit(+dirty). [budget_bytes= is the default BYTE target this ranked payload was shaped toward: row text shortens toward it, no row of the ranked head is removed for it (sigs past_target=)] [sigs capped=1 with shown=total: rows shrunk, none dropped] [sigs past_target=K: the last K rows are past the budget_bytes target, served because they are rows of the ranked head; none is cut] [sigs next=: one call serving all total= rows uncut] [docs_dropped=N: N shown rows have a doc comment not printed (r>24 always, r5..24 if capped)] [files_first=N: N rows moved so r=1..8 are distinct files' best rows, score order, a repeated name once; same rows; fold, hops keep score order]; lego/compose collapse to a counted stub by default (a disclosed cut): total= that section's own pre-cap row count, shown="0" capped="1" (nothing rendered here), next= names the sections=lego,compose flag that restores both sections byte-identically in one call est_tokens= prices this bundle in tokens --> <sigs shown="40" total="40" capped="1" past_target="7" docs_dropped="24" files_first="7" next="--for='tree-sitter parse of a source file' --signatures-only --adaptive --token-budget=5400"> <d l="28" e="63" n="topLevelEvidence" sc="rw::pythonrunner" p="src/pythonrunner.h" cx="4" ccx="3" in="2" churn="5" amp="15" r="1" next="--expand=src/pythonrunner.h:topLevelEvidence">inline bool topLevelEvidence( std::string_view source, const TSLanguage* language, const Predicate& predicate )</d … [line truncated: 1 more bytes on this line] <d l="45" e="45" n="kDefaultMaxFileBytes" sc="rw" p="src/ingest.h" churn="72" amp="185" pure="1" r="2"> <doc>The crawl's per-file byte ceiling. A text file larger than this is skipped: at this size it is o…</doc>constexpr std::size_t kDefaultMaxFileBytes = 4u * 1024u * 1024u</d> -<d l="1247" e="1255" n="parseTree" p="src/ingest_sidecap.h" cx="1" in="4" churn="181" amp="364" tested="1" r="3">TSTree* parseTree( TSParser* parser, std::string_view src )</d> +<d l="1247" e="1255" n="parseTree" p="src/ingest_sidecap.h" cx="1" in="4" churn="188" amp="364" tested="1" r="3">TSTree* parseTree( TSParser* parser, std::string_view src )</d> <d l="594" e="669" n="doctorProbeGrammars" p="src/verbs_doctor.h" cx="7" ccx="17" in="1" churn="51" amp="150" r="4"> <doc>Exercise every registered grammar and its embedded query, reporting loaded and expected totals</doc>inline DoctorGrammarProbe doctorProbeGrammars()</d> ... [21 more line(s); run it to see the whole thing] @@ -419,11 +419,11 @@ _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 -<ctx task="why does src/lexical.h chooseForRanker pick name-exact BM25" route="subtoken+body" root="." confidence="low" margin_pct="0" at="ed47f82e8" doc_mentions="2" schema="ripwire.for/v1" bundle="compact" bodies="0" reason="compact-route" budget_bytes="7500" doc_mentions_capped="1" doc_mentions_t … [line truncated: 28 more bytes on this line] +<ctx task="why does src/lexical.h chooseForRanker pick name-exact BM25" route="subtoken+body" root="." confidence="low" margin_pct="0" at="914c4045d" doc_mentions="2" schema="ripwire.for/v1" bundle="compact" bodies="0" reason="compact-route" budget_bytes="7500" doc_mentions_capped="1" doc_mentions_t … [line truncated: 28 more bytes on this line] <!-- ripwire for schema=ripwire.for/v1: bundle=/bodies=/reason= the body posture; d: cx= ccx= complexity, in= callers (absent cx/ccx/in = 0), churn= amp= change, clone= tested= 1, sc= scope, id=p::sc::n; total= shown= capped=1 if cut; task= the query; d pure=1 const/constexpr sig, next= the follow-up to paste; route= name-exact(X)|subtoken+body[:broad|:declined]; confidence=/margin_pct= head score drop (low=flat); h l= p= n=, c n= l= p= (p= if not h's; same-named joined, shown= counts them), noedge= no callee resolved; h qword= its name (case-folded, leading _#$@ dropped) equals that question word (by name, not resolved, not the only one), first, calls to 100 (capped=1 next= all); qword_cut= owners not so served, next= the first; fold kind=bodies: b t= n= p= l= top ranked rows' whole bodies, not the answer; served= of total= in budget_bytes=; slice/skip p= n= l=; skip bytes= next=; a skip makes sigs next= it, sigs_next= the signatures-only re-call; t p= file outside sigs (weaker), t sym= its top symbols not in sigs/syms (a pointer, not the answer), r= rank (gap = trimmed); t tsym= up to 2 more file symbols named by a task word (a name match); t order: code files first, then doc files (a code question); t page rows go on to file-page row 160 (code question: 160 code rows, docs within row 160); past page 0 (code question: past 40 code rows, a doc past row 40) listed last, head files skipped; past 120 of those p= only, p_only= counts them; t folded=class=N: N p= only rows of that class (doc|config|script|testdata|other) not listed, next= pages to them; d layer=: built-in arch layer (game|infra|render|math|audio|ai|test) from a dir name in p=; d e= its last line (absent=unknown, never 0; l= the name's line); c prov=split: a resolver split arm; may be another arm's (NOT a claim the edge is false) [doc mentions: 2 docs, 1 symbol; doc_mentions=] --> <!-- root= is the crawl root; p= below is RELATIVE to it (single-root only; absent => p= is ingest's own path, unchanged); at=this commit(+dirty). [budget_bytes= is the default BYTE target this ranked payload was shaped toward: row text shortens toward it, no row of the ranked head is removed for it (sigs past_target=)] [sigs capped=1 with shown=total: rows shrunk, none dropped] [sigs past_target=K: the last K rows are past the budget_bytes target, served because they are rows of the ranked head; none is cut] [sigs sigs_next=: one call serving all total= rows uncut] [docs_dropped=N: N shown rows have a doc comment not printed (r>24 always, r5..24 if capped)] [cut: doc_mentions_capped="1" doc_mentions_total="3" — an indexing cap dropped content not shown here]; lego/compose collapse to a counted stub by default (a disclosed cut): total= that section's own pre-cap row count, shown="0" capped="1" (nothing rendered here), next= names the sections=lego,compose flag that restores both sections byte-identically in one call est_tokens= prices this bundle in tokens --> -<sigs shown="40" total="40" capped="1" past_target="12" docs_dropped="30" sigs_next="--for='why does src/lexical.h chooseForRanker pick name-exact BM25' --signatures-only --no-mention-boost --token-budget=6400" next="--expand=src/eval.h:716:runEvalRetrieval"> -<d l="1916" e="1922" n="lexicalScoresNameExactRanked" sc="rw" p="src/lexical.h" cx="1" in="4" churn="92" amp="153" r="1" next="--expand=src/lexical.h:lexicalScoresNameExactRanked"> +<sigs shown="40" total="40" capped="1" past_target="14" docs_dropped="30" sigs_next="--for='why does src/lexical.h chooseForRanker pick name-exact BM25' --signatures-only --no-mention-boost --token-budget=6400" next="--expand=src/eval.h:716:runEvalRetrieval"> +<d l="2015" e="2021" n="lexicalScoresNameExactRanked" sc="rw" p="src/lexical.h" cx="1" in="4" churn="95" amp="153" r="1" next="--expand=src/lexical.h:lexicalScoresNameExactRanked"> <doc>The name-exact ranker AS THE RETRIEVAL LENS SERVES IT: whole-name BM25 plus the definition-over-…</doc>inline std::vector<float> lexicalScoresNameExactRanked( const IngestResult& ing, std::string_view query, const std::vector<float>* symbolScoreMul )</d> <d l="158" e="169" n="printEvalRankerNote" sc="rw" p="src/eval.h" cx="1" in="1" churn="18" amp="52" r="2"> <doc>P11.12: the interpretive footer for --eval's ranker table, pulled into its own function so the 9…</doc>inline void printEvalRankerNote()</d> @@ -449,16 +449,15 @@ _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 -<ctx task="quality delta acks ledger rubber stamp" route="subtoken+body" root="." confidence="low" margin_pct="0" at="ed47f82e8" schema="ripwire.for/v1" bundle="compact" bodies="0" reason="compact-route" budget_bytes="7500" est_tokens="11733"> -<!-- ripwire for schema=ripwire.for/v1: bundle=/bodies=/reason= the body posture; d: cx= ccx= complexity, in= callers (absent cx/ccx/in = 0), churn= amp= change, clone= tested= 1, sc= scope, id=p::sc::n; total= shown= capped=1 if cut; task= the query; d pure=1 const/constexpr sig, next= the follow-up to paste; route= name-exact(X)|subtoken+body[:broad|:declined]; confidence=/margin_pct= head score drop (low=flat); h l= p= n=, c n= l= p= (p= if not h's; same-named joined, shown= counts them), noedge= no callee resolved; h calls capped=1 next= the call listing every callee; fold kind=bodies: b t= n= p= l= top ranked rows' whole bodies, not the answer; served= of total= in budget_bytes=; slice/skip p= n= l=; skip bytes= next=; a skip makes sigs next= it, sigs_next= the signatures-only re-call; t p= file outside sigs (weaker), t sym= its top symbols not in sigs/syms (a pointer, not the answer), r= rank (gap = trimmed); t order: code files first, then doc files (a code question); t page rows go on to file-page row 160 (code question: 160 code rows, docs within row 160); past page 0 (code question: past 40 code rows, a doc past row 40) listed last, head files skipped; past 120 of those p= only, p_only= counts them; t folded=class=N: N p= only rows of that class (doc|config|script|testdata|other) not listed, next= pages to them; d e= its last line (absent=unknown, never 0; l= the name's line); c via=name: that callee matched by name alone, receiver unproven (NOT a claim the edge is false); c prov=split: a resolver split arm; may be another arm's (NOT a claim the edge is false) --> +<ctx task="quality delta acks ledger rubber stamp" route="subtoken+body" root="." confidence="low" margin_pct="0" at="914c4045d" schema="ripwire.for/v1" bundle="compact" bodies="0" reason="compact-route" budget_bytes="7500" est_tokens="11923"> +<!-- ripwire for schema=ripwire.for/v1: bundle=/bodies=/reason= the body posture; d: cx= ccx= complexity, in= callers (absent cx/ccx/in = 0), churn= amp= change, clone= tested= 1, sc= scope, id=p::sc::n; total= shown= capped=1 if cut; task= the query; d pure=1 const/constexpr sig, next= the follow-up to paste; route= name-exact(X)|subtoken+body[:broad|:declined]; confidence=/margin_pct= head score drop (low=flat); h l= p= n=, c n= l= p= (p= if not h's; same-named joined, shown= counts them), noedge= no callee resolved; h calls capped=1 next= the call listing every callee; fold kind=bodies: b t= n= p= l= top ranked rows' whole bodies, not the answer; served= of total= in budget_bytes=; slice/skip p= n= l=; skip bytes= next=; a skip makes sigs next= it, sigs_next= the signatures-only re-call; d mem= an owner's direct member names only, by the index (question words first, then owner's file, path, line, name), mem_more= names cut; t p= file outside sigs (weaker), t sym= its top symbols not in sigs/syms (a pointer, not the answer), r= rank (gap = trimmed); t order: code files first, then doc files (a code question); t page rows go on to file-page row 160 (code question: 160 code rows, docs within row 160); past page 0 (code question: past 40 code rows, a doc past row 40) listed last, head files skipped; past 120 of those p= only, p_only= counts them; t folded=class=N: N p= only rows of that class (doc|config|script|testdata|other) not listed, next= pages to them; d e= its last line (absent=unknown, never 0; l= the name's line); c prov=split: a resolver split arm; may be another arm's (NOT a claim the edge is false) --> <!-- root= is the crawl root; p= below is RELATIVE to it (single-root only; absent => p= is ingest's own path, unchanged); at=this commit(+dirty). [budget_bytes= is the default BYTE target this ranked payload was shaped toward: row text shortens toward it, no row of the ranked head is removed for it (sigs past_target=)] [sigs capped=1 with shown=total: rows shrunk, none dropped] [sigs past_target=K: the last K rows are past the budget_bytes target, served because they are rows of the ranked head; none is cut] [sigs sigs_next=: one call serving all total= rows uncut] [docs_dropped=N: N shown rows have a doc comment not printed (r>24 always, r5..24 if capped)] [files_first=N: N rows moved so r=1..8 are distinct files' best rows, score order, a repeated name once; same rows; fold, hops keep score order]; lego/compose collapse to a counted stub by default (a disclosed cut): total= that section's own pre-cap row count, shown="0" capped="1" (nothing rendered here), next= names the sections=lego,compose flag that restores both sections byte-identically in one call est_tokens= prices this bundle in tokens --> -<sigs shown="40" total="40" capped="1" past_target="11" docs_dropped="26" files_first="28" sigs_next="--for='quality delta acks ledger rubber stamp' --signatures-only --no-doc-mention --token-budget=6000" next="--expand=src/mcpverbs.h:4905:computeQualityDelta"> -<d l="2386" e="2407" n="refPairStaleAcks" p="src/verbs_quality.h" cx="6" ccx="6" in="1" churn="200" amp="309" r="1" next="--expand=src/verbs_quality.h:refPairStaleAcks"> -<doc>L2 stale acks in the range form. A changed-files answer holds no whole target tree to check the …</doc>std::vector<rw::quality::StaleAck> refPairStaleAcks( const gtl::btree_map<std::string, rw::quality::AckRecord>& acks, const RefPairDelta& refs )</d> -<d l="4905" e="4984" n="computeQualityDelta" sc="rw" p="src/mcpverbs.h" cx="5" ccx="5" in="1" churn="675" amp="692" r="2">inline QualityDeltaOutcome computeQualityDelta( const std::string& root )</d> -<d l="10777" e="10792" n="staleByKindValue" sc="quality" p="src/quality.h" cx="5" ccx="7" in="2" churn="686" amp="871" r="3">inline std::string staleByKindValue( const std::vector<StaleAck>& staleAcks )</d> -<d l="2529" e="2531" n="kAtStampLegend" sc="rw" p="src/serialize.h" churn="515" amp="626" pure="1" r="4">inline constexpr const char* kAtStampLegend = "<!-- at= is the git commit these numbers were computed at</d> -... [22 more line(s); run it to see the whole thing] +<sigs shown="40" total="40" capped="1" past_target="12" docs_dropped="27" files_first="38" sigs_next="--for='quality delta acks ledger rubber stamp' --signatures-only --no-doc-mention --token-budget=6300" next="--expand=src/verbs_quality.h:2776:refuseUnmatchedAckOnly"> +<d l="2846" e="2890" n="runQualityAckWrite" p="src/verbs_quality.h" cx="8" ccx="8" in="1" churn="209" amp="312" r="1" next="--expand=src/verbs_quality.h:runQualityAckWrite"> +<doc>WRITE ACKS — the --quality-ack arm: fold the VISIBLE findings --ack-only selects into the ledg…</doc>int runQualityAckWrite( const rw::Config& cfg, const rw::quality::Scope& scope, const QdPartition& part, DeltaBasis& basis, const std::string& acksFile )</d> +<d l="4905" e="4984" n="computeQualityDelta" sc="rw" p="src/mcpverbs.h" cx="5" ccx="5" in="1" churn="676" amp="692" r="2">inline QualityDeltaOutcome computeQualityDelta( const std::string& root )</d> +<d l="10866" e="10881" n="staleByKindValue" sc="quality" p="src/quality.h" cx="5" ccx="7" in="2" churn="693" amp="874" r="3">inline std::string staleByKindValue( const std::vector<StaleAck>& staleAcks )</d> +... [23 more line(s); run it to see the whole thing] ``` **Caveats (stated by the binary):** @@ -479,7 +478,7 @@ _Interface -> implementors view: every existing impl of the named interface; the $ ./build/ripwire . --lego=Vehicle <ctx schema="ripwire.lego/v1" root="."> <!-- ripwire lego schema=ripwire.lego/v1: ONE interface/base type: <iface n= p= defs= implementors=>, its <m> method contract, every implementor. counts_floor=1: every count is a FLOOR, never a total. graph_ambiguous=/graph_unresolved=: resolver gauge. graph_unindexed=N: N files no grammar could read (the map header's unindexed=); their calls raise neither gauge. root=: p= relative to it. methods=0 caveat=not-extracted-for-lang: no <m> contract read for this language. --> -<lego graph_ambiguous="3960" graph_unresolved="20090" graph_unindexed="313" counts_floor="1"> +<lego graph_ambiguous="3984" graph_unresolved="20100" graph_unindexed="313" counts_floor="1"> <iface n="Vehicle" p="test/legofix/vehicle.rs" methods="0" caveat="not-extracted-for-lang" defs="1" implementors="2"> <impl n="Car" p="test/legofix/vehicle.rs:12"/> <impl n="Bike" p="test/legofix/vehicle.rs:13"/> @@ -510,7 +509,7 @@ _The repo's best-in-class instance to imitate before writing new code (picked by $ ./build/ripwire . --exemplar="format byte sizes for humans" <!-- ripwire exemplar schema=ripwire.exemplar/v1: the best-in-class instance of kind= for the task, chosen by role: n= p= in= ccx= tested=, <bodies> <b> to imitate. window: shown= total= capped= (capped=1 cut). root=: p= relative to it. candidates=N: instances of kind= under the ccx ceiling the pick was ranked from. low_confidence=1: weak task-to-kind match, fell back to fn unless off_task=1; pass a kind (fn|method|class...). b t= l=: the body's … [line truncated: 25 more bytes on this line] -<exemplar schema="ripwire.exemplar/v1" kind="fn" candidates="21023" n="kindIs" p="src/infra/nodekind.h:46" in="441" ccx="3" root="." tested="1" low_confidence="1"> +<exemplar schema="ripwire.exemplar/v1" kind="fn" candidates="21230" n="kindIs" p="src/infra/nodekind.h:46" in="445" ccx="3" root="." tested="1" low_confidence="1"> <bodies shown="1" total="1" capped="0"> <b t="fn" l="46" p="src/infra/nodekind.h" n="kindIs"> <![CDATA[inline bool kindIs( const char* t, const char ( &lit )[N] ) noexcept @@ -539,9 +538,9 @@ _Most relevant DOCS' full bodies (markdown only) — recall what is already writ ``` $ ./build/ripwire . --recall="quality delta gating exit codes" -ripwire recall — "quality delta gating exit codes" — 142 relevant of 355 document files, best-first — total=142 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 +ripwire recall — "quality delta gating exit codes" — 146 relevant of 359 document files, best-first — total=146 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 21.960) ━━ [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.925) ━━ [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. @@ -604,25 +603,20 @@ and both are yours, because the file you write is the only thing that sets them: **Try it** -_The directory-as-knowledge-base pattern: --recall pointed at a 1479764-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 1503096-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._ ``` $ ./build/ripwire <scratch>/aux/kbcorpus --recall="field affinity cache line data layout which fields are read together" --top-k=3 --max-tokens=1200 -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 +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 -━━ commands.md (relevance 36.174) ━━ [sections: 1 of 166 selected (196 in doc), section-granular; whole doc 638928 B; lines="567-592"; dropped_by_budget=165] [truncated: 1854 of 4284 bytes] -#### Pattern: a directory of dumped tool output as a knowledge base +━━ commands.md (relevance 33.748) ━━ [sections: 1 of 166 selected (196 in doc), section-granular; whole doc 639182 B; lines="3910-3914"; dropped_by_budget=165] [truncated: 1865 of 7797 bytes] +### `--field-affinity[=STRUCT]` -**Answers:** can `--recall` serve as a zero-setup knowledge base over dumped tool output — a -`git log`, an API response dump, a fetched doc, `<tool> --help` text — sitting in a scratch -directory, instead of a source repo? +**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. -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: +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] -... [17 more line(s); run it to see the whole thing] +(capped: 1 of 2 relevant document files omitted — raise --max-tokens/budget_tokens or narrow the query for 1 more (~2548-byte budget)) ``` ### `--tree` @@ -638,7 +632,7 @@ _File-by-file orientation map (top symbols per file)._ ``` $ ./build/ripwire . --tree <!-- ripwire tree schema=ripwire.tree/v1: each file with its top 3 symbols by rank, files by best symbol: <file p= symbols=> of <s t= n=>; of files= indexed, files_unlisted= have none. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). symbols_capped=: 1 = cut. root=: p= relative to it. pr_iters=N: PageRank iterations. shown_symbols=: <s> rows printed. next=: the one pasteable follow-up. --> -<tree schema="ripwire.tree/v1" files="4842" files_unlisted="108" shown="80" capped="1" total="4734" has_more="1" next_offset="80" offset="0" limit="0" pr_iters="38" root="." shown_symbols="232" symbols_capped="1" next="--tree --offset=80"> +<tree schema="ripwire.tree/v1" files="4852" files_unlisted="108" shown="80" capped="1" total="4744" has_more="1" next_offset="80" offset="0" limit="0" pr_iters="37" root="." shown_symbols="232" symbols_capped="1" next="--tree --offset=80"> <file p="src/infra/nodekind.h" symbols="1"> <s t="fn" n="kindIs"/> </file> @@ -713,7 +707,7 @@ $ ./build/ripwire . --order=stable --top-k=5 <!-- t=modscope=a-file's-MODULE-SCOPE(n=<file-scope>):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 --> <!-- t=type|alias|functype=a-Go-named-type-by-its-written-form:type=a-defined-type-whose-WRITTEN-form-is-not-a-struct/iface/func-literal(type-N-string;type-W-Pair-too,whatever-Pair-is-underneath),alias=type-A=B,functype=type-F-func(...) --> <!-- t=alias|functype-in-C++-and-.h:alias=using-X=Y(also-templated-or-class-scope)or-namespace-L=lib(defs=X-prints-its-written-target-as-to=),functype=a-typedef-of-a-function-or-function-pointer-type(typedef-void(*F)(int));other-typedefs-read-t=struct --> -<r schema="ripwire.map/v1" root="." pr_iters="38" lens="k,est_tokens"> +<r schema="ripwire.map/v1" root="." pr_iters="37" lens="k,est_tokens"> <f p="src/infra/Diagnostics.h" layer="infra"> <s t="macro" n="RW_ASSUME_"> <c n="RW_CHECK_"/> @@ -744,10 +738,10 @@ $ ./build/ripwire . --no-stable --top-k=3 <!-- t=modscope=a-file's-MODULE-SCOPE(n=<file-scope>):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 --> <!-- t=type|alias|functype=a-Go-named-type-by-its-written-form:type=a-defined-type-whose-WRITTEN-form-is-not-a-struct/iface/func-literal(type-N-string;type-W-Pair-too,whatever-Pair-is-underneath),alias=type-A=B,functype=type-F-func(...) --> <!-- t=alias|functype-in-C++-and-.h:alias=using-X=Y(also-templated-or-class-scope)or-namespace-L=lib(defs=X-prints-its-written-target-as-to=),functype=a-typedef-of-a-function-or-function-pointer-type(typedef-void(*F)(int));other-typedefs-read-t=struct --> -<!-- files=4842 symbols=44689 edges=44883 shown=3 est_tokens=4060 ambiguous=3960 unresolved=20090 locality_pinned=14 external=12459 declined=45292 extent_suspect_syms=12 macro_blanked_files=7 skipped_oversize=15 unindexed="txt:85,tsv:54,mod:33,xml:33,jsonl:26,scm:25" unindexed_exts=23 order=important-first --> -<r schema="ripwire.map/v1" root="." est_tokens="4060" pr_iters="38"> +<!-- files=4852 symbols=45031 edges=45381 shown=3 est_tokens=4089 ambiguous=3984 unresolved=20100 locality_pinned=14 external=12460 declined=45307 extent_suspect_syms=12 macro_blanked_files=7 skipped_oversize=15 unindexed="txt:85,tsv:54,mod:33,xml:33,jsonl:26,scm:25" unindexed_exts=23 order=important-first --> +<r schema="ripwire.map/v1" root="." est_tokens="4089" pr_iters="37"> <f p="src/infra/nodekind.h" layer="infra"> -<s t="fn" n="kindIs" sc="rw" k="0.0031"> +<s t="fn" n="kindIs" sc="rw" k="0.0032"> </s> </f> <f p="src/ingest_metrics.h"> @@ -778,7 +772,7 @@ $ ./build/ripwire . --around=rankGraphTeleport <!-- t=type|alias|functype=a-Go-named-type-by-its-written-form:type=a-defined-type-whose-WRITTEN-form-is-not-a-struct/iface/func-literal(type-N-string;type-W-Pair-too,whatever-Pair-is-underneath),alias=type-A=B,functype=type-F-func(...) --> <!-- t=alias|functype-in-C++-and-.h:alias=using-X=Y(also-templated-or-class-scope)or-namespace-L=lib(defs=X-prints-its-written-target-as-to=),functype=a-typedef-of-a-function-or-function-pointer-type(typedef-void(*F)(int));other-typedefs-read-t=struct --> <!-- a bound BIT this walk, so raising it would return more: depth_truncated=1 means at least one symbol one hop past depth= is absent; fanout_cut=N means N distinct symbols were dropped by the fanout= cap and appear NOWHERE here (exact, not a floor: a neighbour another hub re-admitted is not counted). Neither attribute is emitted when its bound cut nothing, so absent means that bound did not bind and raising it returns nothing new. The knobs are around-depth=N and around-fanout=K. --> -<!-- files=4842 symbols=44689 edges=44883 shown=12 est_tokens=3402 ambiguous=3960 unresolved=20090 locality_pinned=14 external=12459 declined=45292 extent_suspect_syms=12 macro_blanked_files=7 skipped_oversize=15 unindexed="txt:85,tsv:54,mod:33,xml:33,jsonl:26,scm:25" unindexed_exts=23 order=important-first --> +<!-- files=4852 symbols=45031 edges=45381 shown=12 est_tokens=3402 ambiguous=3984 unresolved=20100 locality_pinned=14 external=12460 declined=45307 extent_suspect_syms=12 macro_blanked_files=7 skipped_oversize=15 unindexed="txt:85,tsv:54,mod:33,xml:33,jsonl:26,scm:25" unindexed_exts=23 order=important-first --> <r schema="ripwire.around/v1" root="." of="rankGraphTeleport" depth="1" fanout="32" depth_truncated="1" est_tokens="3402"> <f p="src/graph.h"> <s t="fn" n="rankGraphTeleport" sc="rw" amb="1" k="1.0000"> @@ -828,7 +822,7 @@ _What SYM calls (1-hop out-edges)._ ``` $ ./build/ripwire . --callees=rankGraphTeleport <!-- ripwire callees schema=ripwire.callees/v1: 1-hop CALLEES of of= (defs= matched, count= distinct symbols): <s t= n= p= role= tested=>. counts_floor=1: every count is a FLOOR, never a total. graph_ambiguous=/graph_unresolved=: resolver gauge. graph_unindexed=N: N files no grammar could read (the map header's unindexed=); their calls raise neither gauge. stdm n= calls=: of declined_calls=, calls named like a standard-type member of their language (C++ container/string/optional/smart pointer, Rust collection/string/Option/Result; n=) on a receiver no rule tied to an in-tree class (Rust: one of an in-tree type no rule typed too: a generic bound, dyn or impl Trait, a type alias, a glob of a glob, a tuple-struct field, a non-plain pattern, behind Option / Result / Rc / Arc / RefCell / Cell / Mutex / RwLock); no edge or row (may be the std member). root=: p= relative to it. prov=scip|binding|import|split|final-segment: how that <c> edge bound (absent: one unique name); split = one arm of an amb= pick; final-segment = a qualified type matched by last name only. <s tested=1>: a non-test row an indexed test transitively reaches (absent otherwise, never 0). declined_calls=K: K call sites left unbound, in no count; <dc n= l=|in= p= cands=K via=declined>: one such call SITE (callees: called name, line; callers: calling def, file:line); NOT an edge or a caller/callee claim; cands=K: K in-tree defs it could have meant (K may be 1), the resolver proved none; not a claim this call reaches any of them. dc gate=: builtin or std, a name gate declined it; side, a Ruby call whose in-reach defs answer on the other side of self. next=: the one pasteable follow-up. hop_tested=/hop_untested=: count= split by whether an indexed test reaches the row (in-process calls only). --> -<callees schema="ripwire.callees/v1" of="rankGraphTeleport" defs="1" count="4" root="." hop_tested="3" hop_untested="1" declined_calls="6" graph_ambiguous="3960" graph_unresolved="20090" graph_unindexed="313" counts_floor="1" next="--expand=rankGraphTeleport"> +<callees schema="ripwire.callees/v1" of="rankGraphTeleport" defs="1" count="4" root="." hop_tested="3" hop_untested="1" declined_calls="6" graph_ambiguous="3984" graph_unresolved="20100" graph_unindexed="313" counts_floor="1" next="--expand=rankGraphTeleport"> <s t="fn" n="biasPrior" p="src/graph.h:14880"/> <s t="macro" n="PROFILE_SCOPE_DESCRIBE" p="src/infra/profileScope.h:1282" role="macro" tested="1" prov="split"/> <s t="macro" n="PROFILE_SCOPE_DESCRIBE" p="src/infra/profileScope.h:1296" role="macro" tested="1" prov="split"/> @@ -863,16 +857,16 @@ _The resolvable use-sites (call/read/write/import/extends) with file:line; count ``` $ ./build/ripwire . --uses=rankGraphTeleport <!-- ripwire uses schema=ripwire.uses/v1: resolvable use-sites of of=: <u role=call|macro|read|write|import|extends|type p=file:line in_id=>. counts_floor=1: every count is a FLOOR, never a total. graph_ambiguous=/graph_unresolved=: resolver gauge. graph_unindexed=N: N files no grammar could read (the map header's unindexed=); their calls raise neither gauge. root=: p= relative to it. defs=N: definitions the selector matched; qualify file:name to narrow the call sites. external=1: of= has no definition in the indexed tree under any spelling (stdlib/third-party). count=N: unhedged use-site rows (a floor). --> -<uses schema="ripwire.uses/v1" of="rankGraphTeleport" defs="1" external="0" count="9" root="." graph_ambiguous="3960" graph_unresolved="20090" graph_unindexed="313" counts_floor="1"> +<uses schema="ripwire.uses/v1" of="rankGraphTeleport" defs="1" external="0" count="9" root="." graph_ambiguous="3984" graph_unresolved="20100" graph_unindexed="313" counts_floor="1"> <u role="call" p="src/mcpindex.h:1340" in_id="src/mcpindex.h::rw::getIndex"/> <u role="call" p="src/graph.h:14968" in_id="src/graph.h::rw::rankGraph"/> <u role="call" p="src/graph.h:15684" in_id="src/graph.h::rw::anchoredLexicalRank"/> <u role="call" p="src/eval.h:328" in_id="src/eval.h::rw::runEval"/> -<u role="call" p="src/main.cpp:1446" in_id="churnDecayRanking"/> -<u role="call" p="src/main.cpp:1485" in_id="churnRankedGraph"/> +<u role="call" p="src/main.cpp:1447" in_id="churnDecayRanking"/> <u role="call" p="src/main.cpp:1486" in_id="churnRankedGraph"/> -<u role="call" p="src/main.cpp:1500" in_id="churnRankedGraph"/> -<u role="call" p="src/main.cpp:1878" in_id="runDefaultMap"/> +<u role="call" p="src/main.cpp:1487" in_id="churnRankedGraph"/> +<u role="call" p="src/main.cpp:1501" in_id="churnRankedGraph"/> +<u role="call" p="src/main.cpp:1879" in_id="runDefaultMap"/> </uses> ``` @@ -897,17 +891,17 @@ _Composable node-set query: functions within 2 caller-hops of rankGraphTeleport. ``` $ ./build/ripwire . --graph-query='and(callers(name("rankGraphTeleport"),2),kind(all,fn))' <!-- ripwire graph-query schema=ripwire.graph-query/v1: graph-query expression over the symbol graph: <s t= n= p=> matching rows. window: shown= capped= (capped=1 cut). counts_floor=1: every count is a FLOOR, never a total. graph_ambiguous=/graph_unresolved=: resolver gauge. graph_unindexed=N: N files no grammar could read (the map header's unindexed=); their calls raise neither gauge. root=: p= relative to it. pr_iters=N: PageRank iterations. expr=: the expression as given; count=: symbols it matched (rows page by shown=/total=). --> -<query schema="ripwire.graph-query/v1" expr="and(callers(name("rankGraphTeleport"),2),kind(all,fn))" count="59" shown="59" capped="0" graph_ambiguous="3960" graph_unresolved="20090" graph_unindexed="313" counts_floor="1" root="." pr_iters="38"> +<query schema="ripwire.graph-query/v1" expr="and(callers(name("rankGraphTeleport"),2),kind(all,fn))" count="59" shown="59" capped="0" graph_ambiguous="3984" graph_unresolved="20100" graph_unindexed="313" counts_floor="1" root="." pr_iters="37"> <s t="fn" n="getIndex" p="src/mcpindex.h:1224"/> <s t="fn" n="rankGraph" p="src/graph.h:14964"/> <s t="fn" n="anchoredLexicalRank" p="src/graph.h:15633"/> <s t="fn" n="emitCommunitiesReport" p="src/verbs_report.h:2732"/> <s t="fn" n="emitCommunityDrill" p="src/verbs_report.h:2893"/> <s t="fn" n="computeLensRanking" p="src/verbs_for.h:115"/> -<s t="fn" n="dispatchMainBody" p="src/main.cpp:4653"/> -<s t="fn" n="postCheckJsonBuilt" p="src/mcpedit.h:1119"/> +<s t="fn" n="dispatchMainBody" p="src/main.cpp:4711"/> <s t="fn" n="buildGraphRecorded" p="src/warmsnap_graph.h:448"/> -<s t="fn" n="fetchBody" p="src/mcpverbs.h:5901"/> +<s t="fn" n="postCheckJsonBuilt" p="src/mcpedit.h:1120"/> +<s t="fn" n="fetchBody" p="src/mcpverbs.h:5902"/> <s t="fn" n="runEvalRetrieval" p="src/eval.h:716"/> <s t="fn" n="runEvalMined" p="src/eval.h:1089"/> ... [17 more line(s); run it to see the whole thing] @@ -934,19 +928,19 @@ _Names referenced but never defined in-corpus (stdlib/third-party surface). The ``` $ ./build/ripwire . --external-surface <!-- ripwire external-surface schema=ripwire.external-surface/v1: names used but never defined in the index: <x n= lang= refs= calls=>. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). next=: the one pasteable follow-up. names=N: distinct external names (the x rows' total). builtins_excluded=N: sh BUILTIN rows (echo printf cd exit test ...) dropped from names=; the include-builtins flag keeps them. --> -<external-surface schema="ripwire.external-surface/v1" names="3744" builtins_excluded="21" shown="100" capped="1" total="3744" has_more="1" next_offset="100" offset="0" limit="0" next="--external-surface --offset=100"> -<x n="grep" lang="sh" refs="18010" calls="18010"/> -<x n="cat" lang="sh" refs="3639" calls="3639"/> -<x n="tr" lang="sh" refs="2771" calls="2771"/> -<x n="python3" lang="sh" refs="2437" calls="2437"/> -<x n="sed" lang="sh" refs="2252" calls="2252"/> -<x n="string_view" lang="cpp" refs="1541" calls="1541"/> -<x n="to_string" lang="cpp" refs="1396" calls="1396"/> -<x n="wc" lang="sh" refs="1207" calls="1207"/> -<x n="ts_node_is_null" lang="cpp" refs="1177" calls="1177"/> -<x n="print" lang="py" refs="1090" calls="1090"/> -<x n="mktemp" lang="sh" refs="1035" calls="1035"/> -<x n="dirname" lang="sh" refs="1013" calls="1013"/> +<external-surface schema="ripwire.external-surface/v1" names="3750" builtins_excluded="21" shown="100" capped="1" total="3750" has_more="1" next_offset="100" offset="0" limit="0" next="--external-surface --offset=100"> +<x n="grep" lang="sh" refs="18055" calls="18055"/> +<x n="cat" lang="sh" refs="3645" calls="3645"/> +<x n="tr" lang="sh" refs="2782" calls="2782"/> +<x n="python3" lang="sh" refs="2440" calls="2440"/> +<x n="sed" lang="sh" refs="2257" calls="2257"/> +<x n="string_view" lang="cpp" refs="1545" calls="1545"/> +<x n="to_string" lang="cpp" refs="1391" calls="1391"/> +<x n="wc" lang="sh" refs="1212" calls="1212"/> +<x n="ts_node_is_null" lang="cpp" refs="1182" calls="1182"/> +<x n="print" lang="py" refs="1091" calls="1091"/> +<x n="mktemp" lang="sh" refs="1038" calls="1038"/> +<x n="dirname" lang="sh" refs="1016" calls="1016"/> ... [17 more line(s); run it to see the whole thing] ``` @@ -969,13 +963,13 @@ _Shortest directed call-path SRC -> DST. CHANGED: now reports from_p/to_p/from_d ``` $ ./build/ripwire . --path=main,rankGraphTeleport <!-- ripwire path schema=ripwire.path/v1: one DIRECTED call path from= to to=, each <s t= n= p=> a hop; reachable=0 hops=0 when none shown. alts_capped=: 1 = cut. counts_floor=1: every count is a FLOOR, never a total. graph_ambiguous=/graph_unresolved=: resolver gauge. graph_unindexed=N: N files no grammar could read (the map header's unindexed=); their calls raise neither gauge. root=: p= relative to it. next=: the one pasteable follow-up. s site=: a call of this row's name in the row above (arity fit, then owner, first); by name, not proof. s sites=N: N such lines. s call=: its text, <=3 lines/120 B, U+2026=cut; pair 1 only. s sig=: this row's signature, <=160 B; pair 1 only. alts side=from|to of=: further definitions that endpoint's name binds, not printed above (the pick is not provably unique): <d p= sel= class=>, sel= pastes as that endpoint. alts shown_alts=K defs=N: K of the other rows shown; alts_capped=1 they are cut; next= pages the rest. from_p=/to_p=: the definitions from= and to= were bound to. from_defs=/to_defs=: definitions of each name, all searched; above 1, qualify file:name. --> -<path schema="ripwire.path/v1" from="main" to="rankGraphTeleport" from_p="src/main.cpp:4509" to_p="src/graph.h:14921" from_defs="189" to_defs="1" reachable="1" hops="6" next="--expand=src/main.cpp:4564:finishMainRun" root="." graph_ambiguous="3960" graph_unresolved="20090" graph_unindexed="313" coun … [line truncated: 13 more bytes on this line] -<s t="fn" n="main" p="src/main.cpp:4509"/> -<s t="fn" n="finishMainRun" p="src/main.cpp:4564" site="src/main.cpp:4558" call="const int rc = finishMainRun( cfg, argv );" sig="static int finishMainRun( const rw::Config& cfg, char** argv )"/> -<s t="fn" n="runWithCompactLegend" p="src/main.cpp:4377" site="src/main.cpp:4567" call="const int rc = runWithCompactLegend( cfg, argv );" sig="static int runWithCompactLegend( const rw::Config& cfg, char** argv )"/> -<s t="fn" n="dispatchMain" p="src/main.cpp:6267" site="src/main.cpp:4388" sites="4" call="return dispatchMain( cfg, argv );" sig="static int dispatchMain( const rw::Config& cfg, char** argv )"/> -<s t="fn" n="dispatchMainBody" p="src/main.cpp:4653" site="src/main.cpp:6271" call="return dispatchMainBody( cfg, argv );" sig="static int dispatchMainBody( const rw::Config& cfg, char** argv )"/> -<s t="fn" n="runDefaultMap" p="src/main.cpp:1758" site="src/main.cpp:6028" sites="2" call="return runDefaultMap( dsp );" sig="int runDefaultMap( const MainDispatch& d )"/> +<path schema="ripwire.path/v1" from="main" to="rankGraphTeleport" from_p="src/main.cpp:4563" to_p="src/graph.h:14921" from_defs="189" to_defs="1" reachable="1" hops="6" next="--expand=src/main.cpp:4622:finishMainRun" root="." graph_ambiguous="3984" graph_unresolved="20100" graph_unindexed="313" coun … [line truncated: 13 more bytes on this line] +<s t="fn" n="main" p="src/main.cpp:4563"/> +<s t="fn" n="finishMainRun" p="src/main.cpp:4622" site="src/main.cpp:4616" call="const int rc = finishMainRun( cfg, argv );" sig="static int finishMainRun( const rw::Config& cfg, char** argv )"/> +<s t="fn" n="runWithCompactLegend" p="src/main.cpp:4384" site="src/main.cpp:4625" call="const int rc = runWithCompactLegend( cfg, argv );" sig="static int runWithCompactLegend( const rw::Config& cfg, char** argv )"/> +<s t="fn" n="dispatchMain" p="src/main.cpp:6325" site="src/main.cpp:4395" sites="4" call="return dispatchMain( cfg, argv );" sig="static int dispatchMain( const rw::Config& cfg, char** argv )"/> +<s t="fn" n="dispatchMainBody" p="src/main.cpp:4711" site="src/main.cpp:6329" call="return dispatchMainBody( cfg, argv );" sig="static int dispatchMainBody( const rw::Config& cfg, char** argv )"/> +<s t="fn" n="runDefaultMap" p="src/main.cpp:1759" site="src/main.cpp:6086" sites="2" call="return runDefaultMap( dsp );" sig="int runDefaultMap( const MainDispatch& d )"/> ... [20 more line(s); run it to see the whole thing] ``` @@ -998,9 +992,9 @@ $ ./build/ripwire . --defs=main,rankGraphTeleport <d n="main" t="fn" p="docs/docs_commands_build.py:900" sel="docs/docs_commands_build.py:main" lang="py" class="source" in="1"/> <d n="main" t="fn" p="scripts/changelog_assemble.py:170" sel="scripts/changelog_assemble.py:main" lang="py" class="source" in="1"/> <d n="main" t="fn" p="scripts/merge_resolve.py:208" sel="scripts/merge_resolve.py:main" lang="py" class="source" in="1"/> -<d n="main" t="fn" p="scripts/optremarks.py:286" sel="scripts/optremarks.py:main" lang="py" class="source" in="1"/> +<d n="main" t="fn" p="scripts/optremarks.py:289" sel="scripts/optremarks.py:main" lang="py" class="source" in="1"/> <d n="main" t="fn" p="scripts/tidyadvisory_diff.py:313" sel="scripts/tidyadvisory_diff.py:main" lang="py" class="source" in="1"/> -<d n="main" t="fn" p="src/main.cpp:4509" sel="src/main.cpp:main" lang="cpp" class="source" in="0"/> +<d n="main" t="fn" p="src/main.cpp:4563" sel="src/main.cpp:main" lang="cpp" class="source" in="0"/> <d n="main" t="fn" p="src/tsprobe.cpp:70" sel="src/tsprobe.cpp:main" lang="cpp" class="source" in="0"/> <d n="main" t="fn" p="bench/agentloop/analyze.py:345" sel="bench/agentloop/analyze.py:main" lang="py" class="test" in="1"/> <d n="main" t="fn" p="bench/agentloop/backfill_claude_transcripts.py:104" sel="bench/agentloop/backfill_claude_transcripts.py:main" lang="py" class="test" in="1"/> @@ -1021,7 +1015,7 @@ _Minimal connecting subgraph over 3 symbols (finds shared-caller joins)._ ``` $ ./build/ripwire . --connect=rankGraphTeleport,runEval,getIndex <!-- ripwire connect schema=ripwire.connect/v1: minimal joining subgraph: <g> groups, <t> terminals, <s connects=> joins, <e f= t=> edges, <unconnected>. counts_floor=1: every count is a FLOOR, never a total. graph_ambiguous=/graph_unresolved=: resolver gauge. graph_unindexed=N: N files no grammar could read (the map header's unindexed=); their calls raise neither gauge. est_tokens=: price as emitted (an upper bound under compact). root=: p= relative to it. hub_floor=D: connects= >= D is hub=1, vacuous. nodes=N: symbols printed, terminals plus joins (a floor). radius=N: undirected hop bound searched (default 6, max 12); raise it with connect-radius=N. e site=: a call of t= in f= (arity fit, then owner, first); by name, not proof. e call=: its text, <=3 lines/120 B, U+2026=cut. e sig=: t='s signature, <=160 B, once per callee. terminals=/groups=/edges=: task symbols resolved, connected groups (g), e edges printed. t n= / s n=: a terminal's / a join's symbol name. --> -<connect schema="ripwire.connect/v1" terminals="3" nodes="3" edges="2" radius="6" groups="1" est_tokens="754" hub_floor="301" root="." graph_ambiguous="3960" graph_unresolved="20090" graph_unindexed="313" counts_floor="1"> +<connect schema="ripwire.connect/v1" terminals="3" nodes="3" edges="2" radius="6" groups="1" est_tokens="754" hub_floor="302" root="." graph_ambiguous="3984" graph_unresolved="20100" graph_unindexed="313" counts_floor="1"> <g terminals="3"> <t n="runEval" t="fn" p="src/eval.h:171"/> <t n="rankGraphTeleport" t="fn" p="src/graph.h:14921"/> @@ -1133,7 +1127,7 @@ _Test files that transitively reach the changed file._ ``` $ ./build/ripwire . --affected=src/graph.h <!-- ripwire affected schema=ripwire.affected/v1: test files that transitively reach the changed files/symbols: <test p= partner= hops= run=> in evidence order (order= partners=); seeded_by= the reading taken. counts_floor=1: every count is a FLOOR, never a total. graph_ambiguous=/graph_unresolved=: resolver gauge. graph_unindexed=N: N files no grammar could read (the map header's unindexed=); their calls raise neither gauge. run_unknown=1: no runner derivable (a guess would be worse). root=: p= relative to it. seeds=N: symbols the argument matched; only those outside test files seed the caller walk. seed_test_files=N: matched files that are TESTS; listed to run (seed_kind=test), never walk seeds. tests=N: test files listed to run (the rows). reached=N: symbols the transitive caller walk reached from the seeds (seeds excluded). script_gates_unmodelled=N: test/*.sh runners; their subprocess reach is unmodelled, never in tests=/reached=. run_first=N: the first N test files have the most direct evidence (changed/partner/hops=1, else nearest hops=); not a skip list. changed=: the files/symbols argument as given. --> -<affected schema="ripwire.affected/v1" changed="src/graph.h" seeded_by="file" seeds="849" seed_test_files="0" tests="11" reached="1017" script_gates_unmodelled="949" run_first="3" order="evidence" partners="0" root="." graph_ambiguous="3960" graph_unresolved="20090" graph_unindexed="313" counts_floo … [line truncated: 6 more bytes on this line] +<affected schema="ripwire.affected/v1" changed="src/graph.h" seeded_by="file" seeds="849" seed_test_files="0" tests="11" reached="1036" script_gates_unmodelled="952" run_first="3" order="evidence" partners="0" root="." graph_ambiguous="3984" graph_unresolved="20100" graph_unindexed="313" counts_floo … [line truncated: 6 more bytes on this line] <test p="test/connectcore_harness.cpp" hops="1" run="bash test/connectcorecheck.sh"/> <test p="test/cppqualtmplfix/member.cpp" hops="1" run="bash test/cppqualcheck.sh"/> <test p="test/verify_csr.cpp" hops="1" run="bash test/a9disclosurecheck.sh"/> @@ -1194,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: ed47f82e8 +at: 914c4045d (0 changed files — working tree is clean, nothing to analyze) ``` @@ -1213,18 +1207,18 @@ _The continuation packet for the NEXT session: <verified> disk truth (branch/sha ``` $ ./build/ripwire . --handoff <!-- ripwire handoff schema=ripwire.handoff/v1: continuation packet for the NEXT session: <verified changed= blast_files=>, <tests n=>, <heuristic n= candidates=>, <note>, <doc p=>. window: capped= (capped=1 cut). est_tokens=: price as emitted (an upper bound under compact). at=: commit+dirty+shallow. root=: p= relative to it. branch=/subject=: the checked out branch and HEAD commit subject; gitok=0: the git diff probe failed, changed counts are floors. cochange_window=/cochange_commits=: the git window the cochange rows were mined in and the commits it held (0: could not look). doc s=: lexical score of that plan/design doc for the branch+subject query. note target=/txt=: a committed notes row on this work (symbol id or path) and its text; a suggestion. --> -<handoff schema="ripwire.handoff/v1" at="ed47f82e8" root="." branch="integration/train-1118a-r" subject="refactor(argtypepick): the depth-zero pointer test reads topLevelTokenIs in place (quality-delta)" gitok="1" est_tokens="903"> +<handoff schema="ripwire.handoff/v1" at="914c4045d" root="." branch="integration/train-ge3" subject="showcase: the 11-20 capture stays main's; the train re-records once at its tip" gitok="1" est_tokens="889"> <verified changed="0" blast_files="0"> <tests n="0"> </tests> </verified> -<heuristic n="6" candidates="343" capped="1" cochange_window="18mo@HEAD" cochange_commits="7953"> +<heuristic n="6" candidates="345" capped="1" cochange_window="18mo@HEAD" cochange_commits="8003"> <note target="src/infra/Diagnostics.h" txt="ASSUME_NO_ALIAS is an optimizer fact in release (separate_storage) only where the compiler consumes it: clang 18+ by default, LLVM 17/AppleClang 16 via the CMake -mllvm flag (scalars only), GCC never (debug check only); never on two members of one object; … [line truncated: 57 more bytes on this line] <note target="test/manifestcheck.sh" txt="README.md's single '<N> gate scripts' claim (~line 1305) is NOT enforced — the derived-vs-stated sibling loop here covers docs/EVALS.md only. It drifted 407→451 unnoticed (fixed 2026-08-23). To close: grep both files ('file:line … [line truncated: 47 more bytes on this line] -<doc p="skills/ripwire-orient/SKILL.md" s="9.422"/> -<doc p="bench/skillrater/results/2026-09-07/arms/desc_A.md" s="9.110"/> -<doc p="skills/ripwire-fresh-eyes/SKILL.md" s="9.027"/> -<doc p="skills/ripwire-quality-bar/quality-metrics.md" s="8.784"/> +<doc p="CHANGELOG.md" s="13.474"/> +<doc p="docs/EVALS.md" s="10.567"/> +<doc p="bench/locbench/results/r1cpp_anchorhop/GATE_DECISION_r1cpp.md" s="9.495"/> +<doc p="bench/locbench/results/vt2_pooling_freestat/FREESTAT.md" s="9.337"/> </heuristic> ... [1 more line(s); run it to see the whole thing] ``` @@ -1248,7 +1242,7 @@ _Pre-PR gate on a CLEAN tree: no obligations, exit 0._ ``` $ ./build/ripwire . --test-gate <!-- ripwire test-gate schema=ripwire.test-gate/v1: tests <t p= changed= partner= hops= run=> + untested blast radius <u sym= p= l= ccx=>; exit 4 while either exists. tests_capped=/untested_capped=: 1 = cut. counts_floor=1: every count is a FLOOR, never a total. graph_ambiguous=/graph_unresolved=: resolver gauge. graph_unindexed=N: N files no grammar could read (the map header's unindexed=); their calls raise neither gauge. at=: commit+dirty+shallow. next=: the one pasteable follow-up. impacted=N: symbols that transitively call the change (changed symbols excluded). shown_tests=/shown_untested=: t rows and u rows printed, two independent counts. script_gates_unmodelled=N: test/*.sh runners in the corpus, a path count; not call-graph modelled. script_gates_registered=N: shell gates test/regression.sh registers as suite members. script_gates_mapped=N: registered gates with exact dependency evidence (literal paths or RIPWIRE_TEST_DEPS). script_gates_unresolved_dynamic=N: registered gates with no mappable deps; they may cover the change unlisted. ccx_bar=N: the cognitive-complexity bar a u row's ccx= is read against. untested_modscope=N: <file-scope> owners excluded from untested= (#324, uncallable); still in impacted=. tests=/untested=: tests to run (t total) / impacted symbols no test reaches (u total). --> -<test-gate schema="ripwire.test-gate/v1" changed="0" impacted="0" tests="0" untested="0" untested_modscope="0" shown_tests="0" tests_capped="0" shown_untested="0" untested_capped="0" script_gates_unmodelled="949" script_gates_registered="883" script_gates_mapped="291" script_gates_unresolved_dynamic … [line truncated: 136 more bytes on this line] +<test-gate schema="ripwire.test-gate/v1" changed="0" impacted="0" tests="0" untested="0" untested_modscope="0" shown_tests="0" tests_capped="0" shown_untested="0" untested_capped="0" script_gates_unmodelled="952" script_gates_registered="886" script_gates_mapped="292" script_gates_unresolved_dynamic … [line truncated: 136 more bytes on this line] </test-gate> ``` @@ -1273,7 +1267,7 @@ _Literal trigram-indexed search. Each hit carries its MATCHED line as the <hit> $ ./build/ripwire . --grep=DISCLOSE <!-- ripwire grep schema=ripwire.grep/v1: literal/regex scan grouped by file: <f p=> <hit l= in=>CDATA text</hit> (<b>/<a> context around it); complete=1 only for an exhaustive literal scan (beside pattern_meta=, of the literal reading only); <unindexed> = off-index. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). c … [line truncated: 2304 more bytes on this line] -<grep pattern="DISCLOSE" schema="ripwire.grep/v1" root="." files="291" hits="991" shown="100" capped="1" total="991" has_more="1" next_offset="100" offset="0" limit="0" hits_capped="0" suppressed_comment="159" suppressed_string="4" tier_parsed="77" tier_unclassified="770" tier_budget="bytes" tier_fi … [line truncated: 202 more bytes on this line] +<grep pattern="DISCLOSE" schema="ripwire.grep/v1" root="." files="292" hits="993" shown="100" capped="1" total="993" has_more="1" next_offset="100" offset="0" limit="0" hits_capped="0" suppressed_comment="159" suppressed_string="4" tier_parsed="77" tier_unclassified="771" tier_budget="bytes" tier_fi … [line truncated: 202 more bytes on this line] <f p=".coderabbit.yaml"> <hit l="33" in="path_instructions" occ="2"> <![CDATA[ A degrade path uses DISCLOSE( sink, why ), never ASSUME(false): a one-argument DISCLOSE( msg ) is a debug trace]]> @@ -1302,7 +1296,7 @@ _Same search with one line of source context either side._ $ ./build/ripwire . --grep=DISCLOSE --grep-context=1 <!-- ripwire grep schema=ripwire.grep/v1: literal/regex scan grouped by file: <f p=> <hit l= in=>CDATA text</hit> (<b>/<a> context around it); complete=1 only for an exhaustive literal scan (beside pattern_meta=, of the literal reading only); <unindexed> = off-index. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). c … [line truncated: 2197 more bytes on this line] -<grep pattern="DISCLOSE" schema="ripwire.grep/v1" root="." files="291" hits="991" shown="100" capped="1" total="991" has_more="1" next_offset="100" offset="0" limit="0" hits_capped="0" suppressed_comment="159" suppressed_string="4" tier_parsed="77" tier_unclassified="770" tier_budget="bytes" tier_fi … [line truncated: 202 more bytes on this line] +<grep pattern="DISCLOSE" schema="ripwire.grep/v1" root="." files="292" hits="993" shown="100" capped="1" total="993" has_more="1" next_offset="100" offset="0" limit="0" hits_capped="0" suppressed_comment="159" suppressed_string="4" tier_parsed="77" tier_unclassified="771" tier_budget="bytes" tier_fi … [line truncated: 202 more bytes on this line] <f p=".coderabbit.yaml"> <hit l="33" in="path_instructions" occ="2"> <b> @@ -1331,17 +1325,17 @@ _Boolean grep: hits where BOTH literals share the matched line (--grep-scope=lin $ ./build/ripwire . --grep=DISCLOSE --and=cache <!-- ripwire grep schema=ripwire.grep/v1: literal/regex scan grouped by file: <f p=> <hit l= in=>CDATA text</hit> (<b>/<a> context around it); complete=1 only for an exhaustive literal scan (beside pattern_meta=, of the literal reading only); <unindexed> = 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] -<grep pattern="DISCLOSE" schema="ripwire.grep/v1" root="." terms="DISCLOSE +cache" scope="line" terms_suppressed="1139" files="10" hits="31" shown="31" capped="0" hits_capped="0" suppressed_comment="2" suppressed_string="8" tier_parsed="14" tier_unclassified="0" corpus_oversize="15" corpus_pruned_di … [line truncated: 121 more bytes on this line] +<grep pattern="DISCLOSE" schema="ripwire.grep/v1" root="." terms="DISCLOSE +cache" scope="line" terms_suppressed="1141" files="10" hits="31" shown="31" capped="0" hits_capped="0" suppressed_comment="2" suppressed_string="8" tier_parsed="14" tier_unclassified="0" corpus_oversize="15" corpus_pruned_di … [line truncated: 121 more bytes on this line] <f p="src/ingest_cache.h"> -<hit l="2317" in="openCacheFrame" n="6"> +<hit l="2321" in="openCacheFrame" n="6"> <![CDATA[ DISCLOSE( Diagnostics::answerUnchanged, "a rejected cache is rebuilt from source: this run parses and answers byte-identically",]]> -<at l="2325" in="openCacheFrame"/> -<at l="2333" in="openCacheFrame"/> -<at l="2405" in="openCacheFrame"/> -<at l="2571" in="ByteR::fitsBelow"/> -<at l="3004" in="readFileRecord"/> +<at l="2329" in="openCacheFrame"/> +<at l="2337" in="openCacheFrame"/> +<at l="2409" in="openCacheFrame"/> +<at l="2575" in="ByteR::fitsBelow"/> +<at l="3008" in="readFileRecord"/> </hit> -<hit l="2365" in="openCacheFrame" n="6"> +<hit l="2369" in="openCacheFrame" n="6"> <![CDATA[ DISCLOSE( Diagnostics::answerUnchanged, "a rejected cache is rebuilt from source: this run parses and answers byte-identically",]]> ... [17 more line(s); run it to see the whole thing] ``` @@ -1360,7 +1354,7 @@ _Drop every hit in a file that ALSO contains the --not literal anywhere (file sc $ ./build/ripwire . --grep=DISCLOSE --not=test --grep-scope=file <!-- ripwire grep schema=ripwire.grep/v1: literal/regex scan grouped by file: <f p=> <hit l= in=>CDATA text</hit> (<b>/<a> context around it); complete=1 only for an exhaustive literal scan (beside pattern_meta=, of the literal reading only); <unindexed> = 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: 1589 more bytes on this line] -<grep pattern="DISCLOSE" schema="ripwire.grep/v1" root="." terms="DISCLOSE -test" scope="file" terms_suppressed="1129" files="6" hits="18" shown="18" capped="0" hits_capped="0" suppressed_comment="31" suppressed_string="3" tier_parsed="25" tier_unclassified="0" corpus_oversize="15" corpus_pruned_dir … [line truncated: 123 more bytes on this line] +<grep pattern="DISCLOSE" schema="ripwire.grep/v1" root="." terms="DISCLOSE -test" scope="file" terms_suppressed="1131" files="6" hits="18" shown="18" capped="0" hits_capped="0" suppressed_comment="31" suppressed_string="3" tier_parsed="25" tier_unclassified="0" corpus_oversize="15" corpus_pruned_dir … [line truncated: 123 more bytes on this line] <f p="src/commentcoherence.h" parse_degraded="1"> <hit l="216" in="rw::computeCommentCoherence"> <![CDATA[ DISCLOSE( scan, CommentCoherenceScan::DisclosureWhy::UnreadableFile, "comment-coherence: an indexed file could not be read — its functions are absent from the report" );]]> @@ -1391,7 +1385,7 @@ _Drop every hit in a file that ALSO contains the --not literal anywhere (file sc $ ./build/ripwire . --grep=DISCLOSE --not=test --grep-scope=file <!-- ripwire grep schema=ripwire.grep/v1: literal/regex scan grouped by file: <f p=> <hit l= in=>CDATA text</hit> (<b>/<a> context around it); complete=1 only for an exhaustive literal scan (beside pattern_meta=, of the literal reading only); <unindexed> = 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: 1589 more bytes on this line] -<grep pattern="DISCLOSE" schema="ripwire.grep/v1" root="." terms="DISCLOSE -test" scope="file" terms_suppressed="1129" files="6" hits="18" shown="18" capped="0" hits_capped="0" suppressed_comment="31" suppressed_string="3" tier_parsed="25" tier_unclassified="0" corpus_oversize="15" corpus_pruned_dir … [line truncated: 123 more bytes on this line] +<grep pattern="DISCLOSE" schema="ripwire.grep/v1" root="." terms="DISCLOSE -test" scope="file" terms_suppressed="1131" files="6" hits="18" shown="18" capped="0" hits_capped="0" suppressed_comment="31" suppressed_string="3" tier_parsed="25" tier_unclassified="0" corpus_oversize="15" corpus_pruned_dir … [line truncated: 123 more bytes on this line] <f p="src/commentcoherence.h" parse_degraded="1"> <hit l="216" in="rw::computeCommentCoherence"> <![CDATA[ DISCLOSE( scan, CommentCoherenceScan::DisclosureWhy::UnreadableFile, "comment-coherence: an indexed file could not be read — its functions are absent from the report" );]]> @@ -1424,7 +1418,7 @@ _Span tiers off: the exhaustive view — the comment and string hits the default $ ./build/ripwire . --grep=DISCLOSE --grep-in=any <!-- ripwire grep schema=ripwire.grep/v1: literal/regex scan grouped by file: <f p=> <hit l= in=>CDATA text</hit> (<b>/<a> context around it); complete=1 only for an exhaustive literal scan (beside pattern_meta=, of the literal reading only); <unindexed> = off-index. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). h … [line truncated: 1741 more bytes on this line] -<grep pattern="DISCLOSE" schema="ripwire.grep/v1" root="." files="314" hits="1151" shown="100" capped="1" total="1151" has_more="1" next_offset="100" offset="0" limit="0" hits_capped="0" corpus_oversize="15" corpus_pruned_dirs="7" unindexed_hits="15" unindexed_files_scanned="327" unindexed_files_ski … [line truncated: 62 more bytes on this line] +<grep pattern="DISCLOSE" schema="ripwire.grep/v1" root="." files="315" hits="1153" shown="100" capped="1" total="1153" has_more="1" next_offset="100" offset="0" limit="0" hits_capped="0" corpus_oversize="15" corpus_pruned_dirs="6" unindexed_hits="15" unindexed_files_scanned="327" unindexed_files_ski … [line truncated: 62 more bytes on this line] <f p=".coderabbit.yaml"> <hit l="33" in="path_instructions" occ="2"> <![CDATA[ A degrade path uses DISCLOSE( sink, why ), never ASSUME(false): a one-argument DISCLOSE( msg ) is a debug trace]]> @@ -1460,7 +1454,7 @@ _h= on each editable enclosing-symbol row: a freshness-pinned identity an edit v $ ./build/ripwire . --grep=DISCLOSE --handles <!-- ripwire grep schema=ripwire.grep/v1: literal/regex scan grouped by file: <f p=> <hit l= in=>CDATA text</hit> (<b>/<a> context around it); complete=1 only for an exhaustive literal scan (beside pattern_meta=, of the literal reading only); <unindexed> = off-index. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). c … [line truncated: 2417 more bytes on this line] -<grep pattern="DISCLOSE" schema="ripwire.grep/v1" root="." files="291" hits="991" shown="100" capped="1" total="991" has_more="1" next_offset="100" offset="0" limit="0" hits_capped="0" suppressed_comment="159" suppressed_string="4" tier_parsed="77" tier_unclassified="770" tier_budget="bytes" tier_fi … [line truncated: 202 more bytes on this line] +<grep pattern="DISCLOSE" schema="ripwire.grep/v1" root="." files="292" hits="993" shown="100" capped="1" total="993" has_more="1" next_offset="100" offset="0" limit="0" hits_capped="0" suppressed_comment="159" suppressed_string="4" tier_parsed="77" tier_unclassified="771" tier_budget="bytes" tier_fi … [line truncated: 202 more bytes on this line] <f p=".coderabbit.yaml"> <hit l="33" in="path_instructions" occ="2"> <![CDATA[ A degrade path uses DISCLOSE( sink, why ), never ASSUME(false): a one-argument DISCLOSE( msg ) is a debug trace]]> @@ -1545,14 +1539,14 @@ $ ./build/ripwire . --query="teleport pagerank" --top-k=5 <!-- t=modscope=a-file's-MODULE-SCOPE(n=<file-scope>):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 --> <!-- t=type|alias|functype=a-Go-named-type-by-its-written-form:type=a-defined-type-whose-WRITTEN-form-is-not-a-struct/iface/func-literal(type-N-string;type-W-Pair-too,whatever-Pair-is-underneath),alias=type-A=B,functype=type-F-func(...) --> <!-- t=alias|functype-in-C++-and-.h:alias=using-X=Y(also-templated-or-class-scope)or-namespace-L=lib(defs=X-prints-its-written-target-as-to=),functype=a-typedef-of-a-function-or-function-pointer-type(typedef-void(*F)(int));other-typedefs-read-t=struct --> -<!-- files=4842 symbols=44689 edges=44883 shown=5 est_tokens=1513 ambiguous=3960 unresolved=20090 locality_pinned=14 external=12459 declined=45292 extent_suspect_syms=12 macro_blanked_files=7 skipped_oversize=15 unindexed="txt:85,tsv:54,mod:33,xml:33,jsonl:26,scm:25" unindexed_exts=23 order=important-first --> +<!-- files=4852 symbols=45031 edges=45381 shown=5 est_tokens=1513 ambiguous=3984 unresolved=20100 locality_pinned=14 external=12460 declined=45307 extent_suspect_syms=12 macro_blanked_files=7 skipped_oversize=15 unindexed="txt:85,tsv:54,mod:33,xml:33,jsonl:26,scm:25" unindexed_exts=23 order=important-first --> <r schema="ripwire.query/v1" root="." est_tokens="1513"> <f p="src/serialize.h"> -<s t="var" n="kChurnRankLegend" sc="rw" k="19.7850"> +<s t="var" n="kChurnRankLegend" sc="rw" k="19.7955"> </s> </f> <f p="src/mcpverbs.h"> -<s t="fn" n="rankByText" sc="rw" k="15.5248"> +<s t="fn" n="rankByText" sc="rw" k="15.5254"> <c n="takeRank"/> ... [17 more line(s); run it to see the whole thing] ``` @@ -1575,7 +1569,7 @@ _Importance-weighted detail: FULL bodies for top-2, signatures for the rest._ ``` $ ./build/ripwire . --for="pagerank power iteration" --detail=2 -<ctx task="pagerank power iteration" route="subtoken+body" root="." confidence="high" margin_pct="22" at="ed47f82e8" doc_mentions="4" schema="ripwire.for/v1" budget_bytes="7500" doc_mentions_capped="1" doc_mentions_total="14" est_tokens="7383"> +<ctx task="pagerank power iteration" route="subtoken+body" root="." confidence="high" margin_pct="22" at="914c4045d" doc_mentions="4" schema="ripwire.for/v1" budget_bytes="7500" doc_mentions_capped="1" doc_mentions_total="14" est_tokens="7389"> <!-- ripwire for schema=ripwire.for/v1: bundle=/bodies=/reason= the body posture; d: cx= ccx= complexity, in= callers (absent cx/ccx/in = 0), churn= amp= change, clone= tested= 1, sc= scope, id=p::sc::n; total= shown= capped=1 if cut; task= the query; d pure=1 const/constexpr sig, next= the follow-up to paste; d same_as=N: doc+sig text as row n=N (not repeated); route= name-exact(X)|subtoken+body[:broad|:declined]; confidence=/margin_pct= head score drop (low=flat); t p= file outside sigs (weaker), t sym= its top symbols not in sigs/syms (a pointer, not the answer), r= rank (gap = trimmed); t tsym= up to 2 more file symbols named by a task word (a name match); t order: code files first, then doc files (a code question); t page rows go on to file-page row 160 (code question: 160 code rows, docs within row 160); past page 0 (code question: past 40 code rows, a doc past row 40) listed last, head files skipped; past 120 of those p= only, p_only= counts them; t folded=class=N: N p= only rows of that class (doc|config|script|testdata|other) not listed, next= pages to them; d layer=: built-in arch layer (game|infra|render|math|audio|ai|test) from a dir name in p=; d e= its last line (absent=unknown, never 0; l= the name's line) [doc mentions: 4 docs, 2 symbols; doc_mentions=] --> <!-- root= is the crawl root; p= below is RELATIVE to it (single-root only; absent => p= is ingest's own path, unchanged); at=this commit(+dirty). [budget_bytes= is the default BYTE target this ranked payload was shaped toward: row text shortens toward it, no row of the ranked head is removed for it (sigs past_target=)] [sigs capped=1 with shown=total: rows shrunk, none dropped] [sigs past_target=K: the last K rows are past the budget_bytes target, served because they are rows of the ranked head; none is cut] [sigs next=: one call serving all total= rows uncut] [docs_dropped=N: N shown rows have a doc comment not printed (r>24 always, r5..24 if capped)] [docs_after_code=N: N doc rows of the shown set moved below its code rows; same rows, reordered, none added or removed; a question naming docs keeps score order] [files_first=N: N rows moved so r=1..8 are distinct files' best rows, score order, a repeated name once; same rows; fold, hops keep score order] [cut: doc_mentions_capped="1" doc_mentions_total="14" — an indexing cap dropped content not shown here]; lego/compose collapse to a counted stub by default (a disclosed cut): total= that section's own pre-cap row count, shown="0" capped="1" (nothing rendered here), next= names the sections=lego,compose flag that restores both sections byte-identically in one call est_tokens= prices this bundle in tokens --> <sigs shown="40" total="40" capped="1" past_target="14" docs_dropped="25" docs_after_code="5" files_first="7" next="--for='pagerank power iteration' --signatures-only --token-budget=6200"> @@ -1612,10 +1606,10 @@ $ ./build/ripwire . --pack-signatures --top-k=10 <!-- t=modscope=a-file's-MODULE-SCOPE(n=<file-scope>):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 --> <!-- t=type|alias|functype=a-Go-named-type-by-its-written-form:type=a-defined-type-whose-WRITTEN-form-is-not-a-struct/iface/func-literal(type-N-string;type-W-Pair-too,whatever-Pair-is-underneath),alias=type-A=B,functype=type-F-func(...) --> <!-- t=alias|functype-in-C++-and-.h:alias=using-X=Y(also-templated-or-class-scope)or-namespace-L=lib(defs=X-prints-its-written-target-as-to=),functype=a-typedef-of-a-function-or-function-pointer-type(typedef-void(*F)(int));other-typedefs-read-t=struct --> -<!-- files=4842 symbols=44689 edges=44883 shown=10 est_tokens=6092 ambiguous=3960 unresolved=20090 locality_pinned=14 external=12459 declined=45292 extent_suspect_syms=12 macro_blanked_files=7 skipped_oversize=15 unindexed="txt:85,tsv:54,mod:33,xml:33,jsonl:26,scm:25" unindexed_exts=23 order=important-first --> -<r root="." est_tokens="6930" pr_iters="38"> +<!-- files=4852 symbols=45031 edges=45381 shown=10 est_tokens=6092 ambiguous=3984 unresolved=20100 locality_pinned=14 external=12460 declined=45307 extent_suspect_syms=12 macro_blanked_files=7 skipped_oversize=15 unindexed="txt:85,tsv:54,mod:33,xml:33,jsonl:26,scm:25" unindexed_exts=23 order=important-first --> +<r root="." est_tokens="6930" pr_iters="37"> <f p="src/infra/nodekind.h" layer="infra"> -<s t="fn" n="kindIs" sc="rw" k="0.0031"> +<s t="fn" n="kindIs" sc="rw" k="0.0032"> </s> </f> <f p="src/ingest_metrics.h"> @@ -1705,21 +1699,15 @@ _Comments stripped + blank runs collapsed — compressBody is the function that ``` $ ./build/ripwire . --expand=compressBody --top-k=0 --compress -<ctx schema="ripwire.expand/v1" root="." est_tokens="1920"> +<ctx schema="ripwire.expand/v1" root="." est_tokens="906"> <!-- ripwire expand schema=ripwire.expand/v1: full bodies: <bodies shown= total= capped=> of <b t= l= p= n= sibs= sibs_total= sibs_capped= inc=>; <calls> <c n= l= p=> 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. inc_total=N: the file's true include/import count; inc= lists the first 2 … [line truncated: 200 more bytes on this line] <bodies shown="1" total="1" capped="0" compress="1"> -<b t="fn" l="4693" p="src/serialize.h" n="compressBody" sibs="<file-scope>,xmlSafeByte,xmlScrubIsLossy,xmlControlCharRef,eraseAbsentClause,spliceClauseAfter,kXmlEscapeByteset,escapeXml,writeMultiRootTable,kMultiRootTableLegend,multiRootTableLegend,xmlCommentText,ctxRootOpen,ctxRootOpenParts,ct … [line truncated: 2007 more bytes on this line] +<b t="fn" l="5212" p="src/serialize.h" n="compressBody" sibs="<file-scope>,xmlSafeByte,xmlScrubIsLossy,xmlControlCharRef,eraseAbsentClause,spliceClauseAfter,kXmlEscapeByteset,escapeXml,kMultiRootTableLegend,multiRootTableLegend,xmlCommentText,ctxRootOpen,ctxRootOpenParts,ctxRootJsonScrubKeys,c … [line truncated: 2003 more bytes on this line] <![CDATA[inline std::string compressBody( std::string_view src ) { - - - std::string out; - out.reserve( src.size() ); - - const std::size_t N = src.size(); - std::size_t i = 0; -... [17 more line(s); run it to see the whole thing] + return collapseBlankLineRuns( stripCommentsKeepLiterals( src ) ); +}]]><calls total="2"><c n="stripCommentsKeepLiterals" l="5140">inline std::string stripCommentsKeepLiterals( std::string_view src )</c><c n="collapseBlankLineRuns" l="5179">inline std::string collapseBlankLineRuns( std::string_view text )</c></calls></b></bodies></ctx> ``` **Shaped by:** `--for` @@ -1777,10 +1765,10 @@ $ ./build/ripwire . --expand=readAckRecords --top-k=0 --no-redact <!-- ripwire expand schema=ripwire.expand/v1: full bodies: <bodies shown= total= capped=> of <b t= l= p= n= sibs= sibs_total= sibs_capped= inc=>; <calls> <c n= l= p=> 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. <c via="name">: that callee matched by name alone (receiver unproven); it … [line truncated: 410 more bytes on this line] <bodies shown="3" total="3" capped="0"> -<b t="fn" l="9254" p="src/quality.h" n="readAckRecords" sibs="<file-scope>,kBaselineFile,kMinCloneTokens,kCcxBar,kLocBar,kNestBar,kParamBar,kShortHorizonDays,kShortHorizonMinCommits,kReusedHelperMinFanin,kMinorCcxDelta,kMinorLocDelta,kMinorParamDelta,kMaterialGrowthPct,kSubBarGrowthPct,subBarG … [line truncated: 1751 more bytes on this line] +<b t="fn" l="9289" p="src/quality.h" n="readAckRecords" sibs="<file-scope>,kBaselineFile,kMinCloneTokens,kCcxBar,kLocBar,kNestBar,kParamBar,kShortHorizonDays,kShortHorizonMinCommits,kReusedHelperMinFanin,kMinorCcxDelta,kMinorLocDelta,kMinorParamDelta,kMaterialGrowthPct,kSubBarGrowthPct,subBarG … [line truncated: 1751 more bytes on this line] <![CDATA[inline gtl::btree_map<std::string, AckRecord> readAckRecords( const std::string& path, std::size_t& badLines );]]> </b> -<b t="fn" l="9256" p="src/quality.h" n="readAckRecords" sibs="<file-scope>,kBaselineFile,kMinCloneTokens,kCcxBar,kLocBar,kNestBar,kParamBar,kShortHorizonDays,kShortHorizonMinCommits,kReusedHelperMinFanin,kMinorCcxDelta,kMinorLocDelta,kMinorParamDelta,kMaterialGrowthPct,kSubBarGrowthPct,subBarG … [line truncated: 1751 more bytes on this line] +<b t="fn" l="9291" p="src/quality.h" n="readAckRecords" sibs="<file-scope>,kBaselineFile,kMinCloneTokens,kCcxBar,kLocBar,kNestBar,kParamBar,kShortHorizonDays,kShortHorizonMinCommits,kReusedHelperMinFanin,kMinorCcxDelta,kMinorLocDelta,kMinorParamDelta,kMaterialGrowthPct,kSubBarGrowthPct,subBarG … [line truncated: 1751 more bytes on this line] <![CDATA[inline gtl::btree_map<std::string, AckRecord> readAckRecords( const std::string& path ) { std::size_t ignored = 0; @@ -1810,14 +1798,14 @@ $ ./build/ripwire . --metrics --top-k=10 <!-- t=modscope=a-file's-MODULE-SCOPE(n=<file-scope>):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 --> <!-- t=type|alias|functype=a-Go-named-type-by-its-written-form:type=a-defined-type-whose-WRITTEN-form-is-not-a-struct/iface/func-literal(type-N-string;type-W-Pair-too,whatever-Pair-is-underneath),alias=type-A=B,functype=type-F-func(...) --> <!-- t=alias|functype-in-C++-and-.h:alias=using-X=Y(also-templated-or-class-scope)or-namespace-L=lib(defs=X-prints-its-written-target-as-to=),functype=a-typedef-of-a-function-or-function-pointer-type(typedef-void(*F)(int));other-typedefs-read-t=struct --> -<!-- files=4842 symbols=44689 edges=44883 shown=10 est_tokens=5169 ambiguous=3960 unresolved=20090 locality_pinned=14 external=12459 declined=45292 extent_suspect_syms=12 macro_blanked_files=7 skipped_oversize=15 unindexed="txt:85,tsv:54,mod:33,xml:33,jsonl:26,scm:25" unindexed_exts=23 order=important-first --> -<r schema="ripwire.metrics/v1" root="." est_tokens="5169" pr_iters="38"> +<!-- files=4852 symbols=45031 edges=45381 shown=10 est_tokens=5198 ambiguous=3984 unresolved=20100 locality_pinned=14 external=12460 declined=45307 extent_suspect_syms=12 macro_blanked_files=7 skipped_oversize=15 unindexed="txt:85,tsv:54,mod:33,xml:33,jsonl:26,scm:25" unindexed_exts=23 order=important-first --> +<r schema="ripwire.metrics/v1" root="." est_tokens="5198" pr_iters="37"> <f p="src/infra/nodekind.h" layer="infra"> -<s t="fn" n="kindIs" sc="rw" in="441" out="0" cx="3" ccx="3" role="hub" loc="11" params="2" nest="2" locals="0" locals_floor="1" cbo="0" amp="454" tested="1" k="0.0031" ev="3" ev_floor="1" ev_why="guard-return:1"> +<s t="fn" n="kindIs" sc="rw" in="445" out="0" cx="3" ccx="3" role="hub" loc="11" params="2" nest="2" locals="0" locals_floor="1" cbo="0" amp="458" tested="1" k="0.0032" ev="3" ev_floor="1" ev_why="guard-return:1"> </s> </f> <f p="src/ingest_metrics.h"> -<s t="fn" n="nodeTextOf" in="207" out="0" cx="4" ccx="3" role="hub" loc="9" params="2" nest="1" locals="2" locals_floor="1" cbo="0" amp="351" tested="1" k="0.0021" ev="2" ev_floor="1" ev_why="guard-return:1"> +<s t="fn" n="nodeTextOf" in="210" out="0" cx="4" ccx="3" role="hub" loc="9" params="2" nest="1" locals="2" locals_floor="1" cbo="0" amp="354" tested="1" k="0.0021" ev="2" ev_floor="1" ev_why="guard-return:1"> </s> </f> ... [17 more line(s); run it to see the whole thing] @@ -1844,10 +1832,10 @@ _File->file dependency graph (god-files, cycles)._ ``` $ ./build/ripwire . --deps <!-- ripwire deps schema=ripwire.deps/v1: file-to-file include/import view, heaviest cone first: <f p= afferent= includes= instab= transitive=>, <health>, <godfiles>, <cycles>. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). graph_partial=1: measured over resolved edges; unresolved imports could add, merge or remove cycles and change ratios. no_file_edges=LANGS: this build resolves almost none of these languages' imports to files (Go only across go.mod replace); counts over them (ca/ce and violations= of the arch verb) are floors over the resolved edges only, and a coupling number absent beside it is unknown, not zero. unmeasured_files=N: files in the no_file_edges= languages; an edge to or from them is in a count only where this build resolved it. masked_files=N: no_file_edges= files, left out of dep_files=/ccd/nccd/shape and propagation_cost (an edgeless one would count as a cone of one; one with an edge has only a floor). health cyclic_files=N: dep_files= files inside an include cycle (all cycles, not only the listed ones); absent at 0. health containment_edges=N: Rust mod x; pairs whose only directive is the declaration, out of transitive=/cycles/ccd/shape, in Ca/Ce. root=: p= relative to it. files=N: files with at least one include/import directive; this listing's denominator (health files= = corpus). violations=N: edges into a file more unstable by over 0.05 (Martin I); only the worst 12 are listed. from=: the including file of a stable-deps violation; it depends on the more unstable to=. gap=: instab of to= minus instab of from=, project includes only; worst first. godfiles f layer=: built-in arch layer (game|infra|render|math|audio|ai|test) from a dir name in p=; absent if none. layer=test only for a file under a test directory whose dependents are all test paths, by path. health dep_files=N: dependency-capable files (dep_langs=), the ccd/acd/nccd denominator. health dep_langs=: the languages dep_files= counts; compare its numbers across builds only when equal. ccd=/acd=/nccd=: Lakos: sum of per-file transitive cones (self incl) / per file / over a balanced tree's. health shape=: tangled when cyclic_files= is 1 in 20 of dep_files= or more, else nccd= below 1 horizontal, from 1 vertical (a heuristic). health lazy_edges=N: in-closure (lazy) include pairs kept OUT of cones, cycles and ccd; absent at 0. cycle size=/cost=: files in that include cycle / size squared, the cycle's share of ccd=. cycle cut=/cutrefs=: SUGGESTED edge to break it (fewest directives) / that edge's directive count; nothing cut. inc t=: one include/import target as written; one with no edge did not resolve to an indexed file. --> -<deps schema="ripwire.deps/v1" files="1865" shown="40" capped="1" total="1865" has_more="1" next_offset="40" offset="0" limit="0" root="." no_file_edges="go,swift,java,cs,php,dart,kt,gd,clj" unmeasured_files="407" graph_partial="1"> -<health files="4842" dep_files="3798" ccd="22704" acd="6.0" nccd="0.55" shape="horizontal" cyclic_files="15" masked_files="393" lazy_edges="82" containment_edges="147" dep_langs="cpp,py,ts,go,rs,swift,objc,js,sh,java,rb,cs,c,php,lua,ex,kt"/> -<godfiles total="951" shown="12" capped="1"> -<f p="test/lib/clean-env.sh" afferent="285" layer="test"/> +<deps schema="ripwire.deps/v1" files="1871" shown="40" capped="1" total="1871" has_more="1" next_offset="40" offset="0" limit="0" root="." no_file_edges="go,swift,java,cs,php,dart,kt,gd,clj" unmeasured_files="407" graph_partial="1"> +<health files="4852" dep_files="3804" ccd="23035" acd="6.1" nccd="0.56" shape="horizontal" cyclic_files="15" masked_files="393" lazy_edges="82" containment_edges="147" dep_langs="cpp,py,ts,go,rs,swift,objc,js,sh,java,rb,cs,c,php,lua,ex,kt"/> +<godfiles total="954" shown="12" capped="1"> +<f p="test/lib/clean-env.sh" afferent="288" layer="test"/> <f p="src/model.h" afferent="144"/> <f p="src/infra/emit.h" afferent="101" layer="infra"/> <f p="src/infra/sortutil.h" afferent="89" layer="infra"/> @@ -1855,7 +1843,7 @@ $ ./build/ripwire . --deps <f p="src/serialize.h" afferent="75"/> <f p="src/graph.h" afferent="74"/> <f p="src/nextverb.h" afferent="43"/> -<f p="src/infra/os.h" afferent="41" layer="infra"/> +<f p="src/infra/os.h" afferent="42" layer="infra"/> <f p="src/filter.h" afferent="40"/> ... [17 more line(s); run it to see the whole thing] ``` @@ -1881,18 +1869,18 @@ _Complexity x recent git churn (maintenance pain)._ $ ./build/ripwire . --hotspots <!-- ripwire hotspots schema=ripwire.hotspots/v1: maintenance pain = churn x ccx over window=: <f p= churn= ccx= score= top= top_ccx= top_l=>; unranked_*= no churn/complexity. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). at=: commit+dirty+shallow. root=: p= relative to it. files=/ranked=: files in the window / those with both churn and complexity; ranked + unranked_no_churn + unranked_no_complexity = files. unranked_no_churn=/unranked_no_complexity=: files left out for no commit in window= / no measured complexity. --> <!-- extent_suspect_syms=K on a row = K of the file's functions failed an extent/scope containment check (the map, the bundles and the skipped verb mark each one, reasons and all) and are LEFT OUT of that row's ccx=, score= and top=, so its ccx= is a FLOOR of the file's true sum rather than a total. unranked_extent_suspect= counts files with commits whose every scorable function was left out that way (or whose trusted remainder scores 0), so ranked= + unranked_no_churn= + unranked_no_complexity= + unranked_extent_suspect= = files= exactly. Absent = nothing excluded. --> -<hotspots schema="ripwire.hotspots/v1" window="12mo@HEAD" files="4842" ranked="1118" unranked_no_churn="0" unranked_no_complexity="3722" unranked_extent_suspect="2" shown="40" capped="1" total="1118" has_more="1" next_offset="40" offset="0" limit="0" root="." at="ed47f82e8"> +<hotspots schema="ripwire.hotspots/v1" window="12mo@HEAD" files="4852" ranked="1122" unranked_no_churn="0" unranked_no_complexity="3728" unranked_extent_suspect="2" shown="40" capped="1" total="1122" has_more="1" next_offset="40" offset="0" limit="0" root="." at="914c4045d"> <f p="src/graph.h" churn="732" ccx="6723" score="4921236" top="buildGraph" top_ccx="1979" top_l="10846"/> -<f p="src/quality.h" churn="686" ccx="2631" score="1804866" top="computeDelta" top_ccx="316" top_l="11887"/> -<f p="src/serialize.h" churn="515" ccx="2718" score="1399770" top="serialize" top_ccx="319" top_l="3317"/> -<f p="src/mcpverbs.h" churn="675" ccx="1369" score="924075" top="runBatchSub" top_ccx="142" top_l="6334"/> -<f p="src/main.cpp" churn="509" ccx="1356" score="690204" top="dispatchMainBody" top_ccx="513" top_l="4653"/> +<f p="src/quality.h" churn="693" ccx="2657" score="1841301" top="computeDelta" top_ccx="318" top_l="12009"/> +<f p="src/serialize.h" churn="521" ccx="2407" score="1254047" top="packSignatures" top_ccx="235" top_l="6525"/> +<f p="src/mcpverbs.h" churn="676" ccx="1369" score="925444" top="runBatchSub" top_ccx="142" top_l="6335"/> +<f p="src/main.cpp" churn="514" ccx="1372" score="705208" top="dispatchMainBody" top_ccx="513" top_l="4711"/> <f p="src/verbs_for.h" churn="422" ccx="1358" score="573076" top="runForLensPass" top_ccx="706" top_l="3606"/> <f p="src/resolve.h" churn="222" ccx="2566" score="569652" top="buildPreciseIncludeAdjWithContext" top_ccx="103" top_l="5588"/> -<f p="src/cli.h" churn="650" ccx="682" score="443300" top="parseArgs" top_ccx="214" top_l="5740"/> +<f p="src/cli.h" churn="651" ccx="682" score="443982" top="parseArgs" top_ccx="214" top_l="5740"/> <f p="src/ingest_binds.h" churn="152" ccx="2607" score="396264" top="bindsVisitNode" top_ccx="103" top_l="7848"/> <f p="src/verbs_navigate.h" churn="340" ccx="1038" score="352920" top="runVerify" top_ccx="144" top_l="2297"/> -<f p="src/verbs_quality.h" churn="200" ccx="956" score="191200" top="runQualityDelta" top_ccx="323" top_l="2587"/> +<f p="src/receiverevidence.h" churn="119" ccx="1613" score="191947" top="bareClassAt" top_ccx="77" top_l="784"/> ... [17 more line(s); run it to see the whole thing] ``` @@ -1909,17 +1897,17 @@ _Token-normalized duplicate bodies._ ``` $ ./build/ripwire . --clones <!-- ripwire clones schema=ripwire.clones/v1: similar normalized-token bodies: <group type=2|3 gid= tokens= n= similarity=> of <f n= p=>; 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, call-sequence. --> -<clones schema="ripwire.clones/v1" groups="176" type3="937" exempt_groups="755" idiom_groups="61" demoted_groups="30" clone_groups="465" dup_loc="8959" total_loc="333295" dup_pct="2.7" shown="80" capped="1" total="1113" has_more="1" next_offset="80" offset="0" limit="0" root="."> +<clones schema="ripwire.clones/v1" groups="176" type3="942" exempt_groups="759" idiom_groups="61" demoted_groups="30" clone_groups="468" dup_loc="8996" total_loc="333518" dup_pct="2.7" shown="80" capped="1" total="1118" has_more="1" next_offset="80" offset="0" limit="0" root="."> <group type="2" gid="50" tokens="338" n="3"> <f n="rw_is_ripwire_call" p="hooks/ripwire-claude-route.sh:187"/> <f n="rw_is_ripwire_call" p="hooks/ripwire-codex-route.sh:104"/> <f n="rw_is_ripwire_call" p="hooks/ripwire-nudge.sh:623"/> </group> -<group type="2" gid="287" tokens="213" n="2" exempt="shell-runner"> +<group type="2" gid="289" tokens="213" n="2" exempt="shell-runner"> <f n="call_sites" p="test/declinecheck.sh:116"/> <f n="call_sites" p="test/usesselectorcheck.sh:55"/> </group> -<group type="2" gid="389" tokens="211" n="4" exempt="shell-runner"> +<group type="2" gid="390" tokens="211" n="4" exempt="shell-runner"> <f n="batch_sub" p="test/mcpclidiffcheck.sh:64"/> <f n="batch_sub" p="test/mcptranchecheck.sh:55"/> ... [17 more line(s); run it to see the whole thing] @@ -1940,15 +1928,15 @@ _Per-function size ranking, largest Halstead volume/token entropy/lines first ``` $ ./build/ripwire . --biggest-first --limit=8 <!-- ripwire readability schema=ripwire.readability/v1: Posnett/Hindle/Devanbu lens, largest Halstead volume first (a size proxy): <fn p= n= lines= toks= ops= vocab= vol= ent= posnett=>. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). root=: p= relative to it. functions=N: functions and methods measured (bodyless declarations are not). --> -<readability schema="ripwire.readability/v1" functions="25060" shown="8" capped="1" total="25060" has_more="1" next_offset="8" offset="0" limit="8" root="."> +<readability schema="ripwire.readability/v1" functions="25297" shown="8" capped="1" total="25297" has_more="1" next_offset="8" offset="0" limit="8" root="."> <fn p="src/graph.h:10846" n="buildGraph" lines="4026" toks="25074" ops="16029" vocab="1325" vol="260061.9" ent="6.83" posnett="0.000"/> <fn p="src/verbs_for.h:3606" n="runForLensPass" lines="1984" toks="12389" ops="7572" vocab="925" vol="122072.7" ent="6.60" posnett="0.000"/> <fn p="src/mcp.h:1151" n="dispatchMcpLine" lines="1852" toks="9460" ops="6010" vocab="832" vol="91766.2" ent="6.57" posnett="0.000"/> -<fn p="src/main.cpp:4653" n="dispatchMainBody" lines="1610" toks="8076" ops="5175" vocab="751" vol="77147.4" ent="6.43" posnett="0.000"/> +<fn p="src/main.cpp:4711" n="dispatchMainBody" lines="1610" toks="8076" ops="5175" vocab="751" vol="77147.4" ent="6.43" posnett="0.000"/> <fn p="test/forbodyslotfix/src/c/render.c:7" n="render_screen" lines="176" toks="9485" ops="6322" vocab="181" vol="71136.0" ent="4.54" posnett="0.000"/> -<fn p="src/main.cpp:1758" n="runDefaultMap" lines="1187" toks="6552" ops="4029" vocab="528" vol="59258.9" ent="6.46" posnett="0.000"/> -<fn p="src/lexical.h:538" n="lexicalScoresTiered" lines="1045" toks="6320" ops="4015" vocab="389" vol="54374.9" ent="6.36" posnett="0.000"/> +<fn p="src/main.cpp:1759" n="runDefaultMap" lines="1187" toks="6552" ops="4029" vocab="528" vol="59258.9" ent="6.46" posnett="0.000"/> <fn p="src/packtask.h:1448" n="packTaskBundleText" lines="841" toks="5926" ops="3619" vocab="534" vol="53693.7" ent="6.57" posnett="0.000"/> +<fn p="src/quality.h:12009" n="computeDelta" lines="941" toks="5288" ops="3370" vocab="381" vol="45337.4" ent="6.33" posnett="0.000"/> </readability> ``` @@ -1973,7 +1961,7 @@ _Per function, the non-local MUTABLE state it can reach (transitively), most wri ``` $ ./build/ripwire . --nonlocal-state --limit=8 <!-- ripwire nonlocal-state schema=ripwire.nonlocal-state/v1: per function, the non-local MUTABLE state it reaches: <fn p= n= writes= reads=> over <cell n= p= dir= via=> rows. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). cells_capped=: 1 = cut. counts_floor=1: every count is a FLOOR, never a total. graph_ambiguous=/graph_unresolved=: resolver gauge. graph_unindexed=N: N files no grammar could read (the map header's unindexed=); their calls raise neither gauge. root=: p= relative to it. cells=N: mutable non-local cells found in the corpus (globals, statics, Python module globals; FLOOR). functions=N: functions reaching at least one cell, directly or via callees (all rows, before paging). direct_writes=/direct_reads=: the writes=/reads= cells this function's OWN body writes/reads. cells_total=N: distinct cells reached (read and written counts once); at most 12 cell rows print. at=/at_dir=: one own-body use site (may be more) and what own-body sites do (can be narrower than dir=). shown_cells=N: cell rows printed of cells_total= (cap 12); cells_capped=1 on the row is the cut. unanalyzed_langs=/unanalyzed_files=: indexed languages (and their files) this lens skips; NOT zero cells. --> -<nonlocal_state schema="ripwire.nonlocal-state/v1" cells="1163" functions="1450" shown="8" capped="1" total="1450" has_more="1" next_offset="8" offset="0" limit="8" graph_ambiguous="3960" graph_unresolved="20090" graph_unindexed="313" counts_floor="1" unanalyzed_langs="c,go,rust,javascript,typescrip … [line truncated: 108 more bytes on this line] +<nonlocal_state schema="ripwire.nonlocal-state/v1" cells="1175" functions="1521" shown="8" capped="1" total="1521" has_more="1" next_offset="8" offset="0" limit="8" graph_ambiguous="3984" graph_unresolved="20100" graph_unindexed="313" counts_floor="1" unanalyzed_langs="c,go,rust,javascript,typescrip … [line truncated: 108 more bytes on this line] <fn p="bench/bench_svector_wave.cpp:346" n="main" writes="8" reads="14" direct_writes="0" direct_reads="4" cells_total="14" shown_cells="12" cells_capped="1"> <cell n="kNames" p="bench/bench_svector_wave.cpp:98" dir="rw" at="bench/bench_svector_wave.cpp:358" at_dir="r"/> <cell n="kPush" p="bench/bench_svector_wave.cpp:99" dir="rw" at="bench/bench_svector_wave.cpp:358" at_dir="r"/> @@ -2008,7 +1996,7 @@ _The family join: per function, which of four orthogonal evidence families fire, ``` $ ./build/ripwire . --ensemble --limit=8 <!-- ripwire ensemble schema=ripwire.ensemble/v1: four orthogonal evidence families joined, ranked by DISTINCT families fired (no composite score): <s p= n= fam= of= fired=>. window: total= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). syms_capped=/files_capped=: 1 = cut. at=: commit+dirty+shallow. root=: p= relative to it. eligible=N: functions and methods with a body, the denominator; ranked + no_family = eligible. no_family=N: eligible symbols where no family fired. bar_ccx=/bar_loc=/bar_nest=/bar_params=: absolute structural bars: cognitive cx, lines, nesting, params. rcut=N: ranks the worst readability decile covers (1 to 40); rrank= inside it fires structural. rmeasured=N: functions the readability lens measured. hcut=N: file ranks the worst churn decile covers (1 to 40); hrank= inside it fires historical. hranked=N: files with any in-window commit; 0 = historical family unavailable. cfiles=N: indexed files the confusion (atom) pack can read: C/C++/ObjC/CUDA. cscope=N: eligible symbols in those files; 0 = confusion family unavailable. lscope=N: eligible symbols in a language the naming pack reads; 0 = lexical family unavailable. shown_syms=N: symbol rows printed; the rest page with offset=next_offset. shown_files=N: file rows printed (fixed cap 20, not paged); files_capped=1 = rows dropped. e f=: the fired family: structural, lexical, confusion or historical. why=: the measurements that crossed, space separated; rule*N = that rule fired N times. top=: the file's most corroborated symbol (most families on one symbol). top_l=: that symbol's line. top_fam=N: families fired on top=, the stronger claim; file rows rank by it. union_fam=N: distinct families firing anywhere in the file (weaker: may be different symbols). union=: the names of those families. syms=N: symbols in the file where at least one family fired. families=N: evidence families joined; ranked=N: symbols at least one fired on; window=: the git span the historical family read. --> -<ensemble schema="ripwire.ensemble/v1" families="4" eligible="25060" ranked="9270" no_family="15790" bar_ccx="15" bar_loc="60" bar_nest="4" bar_params="5" rcut="40" rmeasured="25060" hcut="40" hranked="4842" window="12mo" cfiles="1127" cscope="13886" lscope="25060" shown_syms="8" syms_capped="1" sho … [line truncated: 118 more bytes on this line] +<ensemble schema="ripwire.ensemble/v1" families="4" eligible="25297" ranked="9452" no_family="15845" bar_ccx="15" bar_loc="60" bar_nest="4" bar_params="5" rcut="40" rmeasured="25297" hcut="40" hranked="4852" window="12mo" cfiles="1130" cscope="14092" lscope="25297" shown_syms="8" syms_capped="1" sho … [line truncated: 118 more bytes on this line] <s p="src/gitmine.h:1797" n="addRootFilesToGitPathIndex" fam="4" of="4" fired="structural,lexical,confusion,historical"> <e f="structural" why="ccx=25 ev=6"/> <e f="lexical" why="naming-wordy"/> @@ -2019,7 +2007,7 @@ $ ./build/ripwire . --ensemble --limit=8 <e f="structural" why="ccx=24 ev=2"/> <e f="lexical" why="naming-confusable"/> <e f="confusion" why="atom-nested-ternary*4"/> -<e f="historical" why="hrank=19 churn=241"/> +<e f="historical" why="hrank=19 churn=242"/> </s> ... [17 more line(s); run it to see the whole thing] ``` @@ -2039,7 +2027,7 @@ _THE single wide-angle quality read: six families in one pass, an eligible/ranke ``` $ ./build/ripwire . --quality-panel <!-- ripwire quality-panel schema=ripwire.quality-panel/v1: every quality family in ONE report, ranked by distinct families fired: <s p= n= fam= of= fired= join=>; bar_*= thresholds. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). at=: commit+dirty+shallow. root=: p= relative to it. preset=: strict (5 stable families, cut 2), default (6, cut 2), lenient (6, cut 1); selects, never weights. families=6: evidence families: structural lexical confusion historical colocation state. enabled=/enabled_n=: the families this preset COUNTS, and how many. cut=N: distinct enabled families that must fire for a row to rank. cut_reachable=0: cut= exceeds the evaluable families (of=); a corpus fact, never a clean bill of health. eligible=N: functions/methods with a body; ranked= + below_cut= + no_family= = eligible=, always. ranked=N: rows that met the cut (total=); only shown= print, page with offset=. below_cut=N: fired at least one enabled family, but fewer than cut=. no_family=N: no enabled family fired; unavailable= families were never measured. bar_ccx=/bar_loc=/bar_nest=/bar_params=: absolute bars: cognitive complexity, lines, nesting, params. rcut=/rmeasured=: readability decile width (rrank= under it fires) / functions measured. hcut=/hranked=: file churn decile width / files with an in-window commit (hranked=0 voids historical). window=: the git churn window hrank= and churn= are counted over (RELATIVE to this corpus). ccut=/cranked=: colocation decile width / functions reading any outside definition (0 voids it). cfiles=/cscope=: files the confusion atom rules read / eligible symbols in them. lscope=N: symbols the lexical naming rules read. sfiles=/sscope=: files the state lens reads / symbols in them. cells=N: non-local mutable cells the state lens found. tested_scope=N: symbols an indexed test reaches; at 0 no row can carry join=deep+untested. deep_untested=N: rows carrying join=deep+untested across the WHOLE set, not just this page. e f=: the fired family this evidence row belongs to. counted=1: this preset counts the family toward fam=; 0 = fired, not counted. why=: the measurements that crossed (rule*N fired N times; hrank=/churn= are the file's, inherited). --> -<quality_panel schema="ripwire.quality-panel/v1" preset="default" families="6" enabled="structural,lexical,confusion,historical,colocation,state" enabled_n="6" cut="2" cut_reachable="1" eligible="25060" ranked="1415" below_cut="8282" no_family="15363" bar_ccx="15" bar_loc="60" bar_nest="4" bar_param … [line truncated: 335 more bytes on this line] +<quality_panel schema="ripwire.quality-panel/v1" preset="default" families="6" enabled="structural,lexical,confusion,historical,colocation,state" enabled_n="6" cut="2" cut_reachable="1" eligible="25297" ranked="1458" below_cut="8442" no_family="15397" bar_ccx="15" bar_loc="60" bar_nest="4" bar_param … [line truncated: 335 more bytes on this line] <s p="src/gitmine.h:1797" n="addRootFilesToGitPathIndex" fam="4" of="6" fired="structural,lexical,confusion,historical"> <e f="structural" counted="1" why="ccx=25 ev=6"/> <e f="lexical" counted="1" why="naming-wordy"/> @@ -2076,13 +2064,13 @@ _The local-reasoning lens: to understand this symbol, how much must you know tha ``` $ ./build/ripwire . --context-ratio --limit=8 <!-- ripwire context-ratio schema=ripwire.context-ratio/v1: LOCAL-REASONING lens: the share of a unit's context outside its file: <s p= n= sites= ents_out= ent_ratio= read_ratio=>. window: total= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). syms_capped=/files_capped=/defs_capped=: 1 = cut. counts_floor=1: every count is a FLOOR, never a total. root=: p= relative to it. units=N: symbols measured (the s row population). file_units=N: files measured (the f row population). defs_per_name_cap=N: most defs one name adds (lowest ids); defs_capped=1 = cut, ents=/rtok= floors. body_bytes_per_token=: the bytes-per-token rate rtok= is estimated at. shown_syms=N: symbol rows printed; the rest page with offset=next_offset. shown_files=N: file rows printed (fixed cap 40, not paged); files_capped=1 = rows dropped. ents=N: distinct in-corpus defs its reference sites resolve to, by name (a FLOOR). files=N: distinct files holding those defs (a FLOOR). files_out=N: of files=, those other than the unit's own file. rtok=N: est. tokens of every resolved def, what a reader must read. rtok_out=N: the part of rtok= defined outside the unit's own file. ext=N: referenced names with no in-corpus def; mostly locals/params, NOT external deps; in neither ratio. amb_names=N: referenced names with 2+ defs, each counted (per name; not the map's per-call amb=). ents=N: distinct in-corpus defs the file's sites resolve to (a FLOOR; a union, not the sum of s rows). files=N: distinct files holding those defs (a FLOOR). files_out=N: of files=, those other than this file. rtok=N: est. tokens of every resolved def, what a reader must read. rtok_out=N: the part of rtok= defined outside this file. ext=N: referenced names with no in-corpus def; mostly locals/params, NOT external deps; in neither ratio. amb_names=N: referenced names with 2+ defs, each counted (per name; not the map's per-call amb=). s t=: the unit's kind (fn|cls|...). --> -<contextratio schema="ripwire.context-ratio/v1" units="37239" file_units="4108" defs_per_name_cap="8" body_bytes_per_token="3.80" shown_syms="8" syms_capped="1" shown_files="40" files_capped="1" total="37239" has_more="1" next_offset="8" offset="0" limit="8" defs_capped="1" counts_floor="1" root="." … [line truncated: 1 more bytes on this line] -<s p="src/main.cpp:4653" n="dispatchMainBody" t="fn" sites="1195" ents="272" ents_out="246" ent_ratio="0.904" files="82" files_out="81" rtok="272890" rtok_out="236620" read_ratio="0.867" ext="133" amb_names="33"/> -<s p="src/mcpverbs.h:4905" n="computeQualityDelta" t="fn" sites="78" ents="47" ents_out="43" ent_ratio="0.915" files="20" files_out="19" rtok="98257" rtok_out="97386" read_ratio="0.991" ext="10" amb_names="8"/> -<s p="src/mcp.h:1151" n="dispatchMcpLine" t="fn" sites="1368" ents="248" ents_out="222" ent_ratio="0.895" files="52" files_out="51" rtok="93876" rtok_out="88770" read_ratio="0.946" ext="167" amb_names="22"/> -<s p="src/mcpverbs.h:5432" n="editCheckText" t="fn" sites="37" ents="44" ents_out="44" ent_ratio="1.000" files="28" files_out="28" rtok="86575" rtok_out="86575" read_ratio="1.000" ext="4" amb_names="8"/> -<s p="src/main.cpp:1758" n="runDefaultMap" t="fn" sites="1101" ents="155" ents_out="143" ent_ratio="0.923" files="47" files_out="46" rtok="89704" rtok_out="85005" read_ratio="0.948" ext="148" amb_names="18"/> -<s p="src/editpreview.h:342" n="run" t="fn" sites="127" ents="67" ents_out="63" ent_ratio="0.940" files="31" files_out="30" rtok="82699" rtok_out="80376" read_ratio="0.972" ext="31" amb_names="9"/> +<contextratio schema="ripwire.context-ratio/v1" units="37573" file_units="4114" defs_per_name_cap="8" body_bytes_per_token="3.80" shown_syms="8" syms_capped="1" shown_files="40" files_capped="1" total="37573" has_more="1" next_offset="8" offset="0" limit="8" defs_capped="1" counts_floor="1" root="." … [line truncated: 1 more bytes on this line] +<s p="src/main.cpp:4711" n="dispatchMainBody" t="fn" sites="1195" ents="275" ents_out="249" ent_ratio="0.905" files="84" files_out="83" rtok="259872" rtok_out="223425" read_ratio="0.860" ext="133" amb_names="33"/> +<s p="src/mcpverbs.h:4905" n="computeQualityDelta" t="fn" sites="78" ents="48" ents_out="44" ent_ratio="0.917" files="21" files_out="20" rtok="98317" rtok_out="97446" read_ratio="0.991" ext="10" amb_names="8"/> +<s p="src/mcp.h:1151" n="dispatchMcpLine" t="fn" sites="1368" ents="248" ents_out="222" ent_ratio="0.895" files="52" files_out="51" rtok="93914" rtok_out="88808" read_ratio="0.946" ext="167" amb_names="22"/> +<s p="src/mcpverbs.h:5433" n="editCheckText" t="fn" sites="37" ents="45" ents_out="45" ent_ratio="1.000" files="29" files_out="29" rtok="86588" rtok_out="86588" read_ratio="1.000" ext="4" amb_names="8"/> +<s p="src/editpreview.h:342" n="run" t="fn" sites="127" ents="68" ents_out="64" ent_ratio="0.941" files="32" files_out="31" rtok="83028" rtok_out="80705" read_ratio="0.972" ext="31" amb_names="9"/> +<s p="src/mcpindex.h:1224" n="getIndex" t="fn" sites="174" ents="91" ents_out="72" ent_ratio="0.791" files="26" files_out="25" rtok="82532" rtok_out="78774" read_ratio="0.954" ext="20" amb_names="13"/> ... [23 more line(s); run it to see the whole thing] ``` @@ -2107,9 +2095,9 @@ _Score the naming-* rules against this repo's own rename history: proxy=old/(old ``` $ ./build/ripwire . --naming-calibration <!-- ripwire naming-calibration schema=ripwire.naming-calibration/v1: naming lint rules scored against this repo's OWN rename history (a noisy proxy): <r n= old= new= fired= proxy=>. at=: commit+dirty+shallow. probed=0: no history to mine, nothing scored (r= says why); 1 = the git walk ran. pairs=N: labelled rename pairs that survived the join, the SAMPLE SIZE; a small one means nothing. candidates=N: raw substitutions mined from the patch stream before the join; FLOOR when truncated=1. commits=N: non-merge commits walked (the walk stops at 40000). hunks=N: diff hunks with content on both sides. wide_hunks=N: hunks DROPPED for exceeding the 24-line per-side pairing cap; never mined. drop_old_alive=N: candidates dropped: the old spelling is still an indexed name. drop_new_absent=N: candidates dropped: the new spelling is no eligible indexed symbol at HEAD. drop_ambiguous=N: candidates dropped: a name on both sides of several (split, rework, revert). drop_old_skipped=N: candidates dropped: the lens skips the old spelling, no rule could fire. scope=group-rule: the rule judges co-visible names, which one pair cannot evidence; unscored, not 0/0. o=/n=: one labelled pair's old (abandoned) and new (chosen) spelling. sup=N: distinct hunks that showed this substitution. p at=: path:line of the symbol the pair joined to, not a commit (the root at= is). old_fires=: rules that fired on the old spelling; absent when none. new_fires=: rules that fired on the new spelling; absent when none. --> -<naming-calibration schema="ripwire.naming-calibration/v1" probed="1" pairs="212" candidates="3125" commits="7353" hunks="146506" wide_hunks="1530" drop_old_alive="896" drop_new_absent="1823" drop_ambiguous="194" drop_old_skipped="0" at="ed47f82e8"> +<naming-calibration schema="ripwire.naming-calibration/v1" probed="1" pairs="218" candidates="3155" commits="7404" hunks="147753" wide_hunks="1597" drop_old_alive="905" drop_new_absent="1837" drop_ambiguous="195" drop_old_skipped="0" at="914c4045d"> <r n="naming-short" old="2" new="4" fired="6" proxy="0.333"/> -<r n="naming-wordy" old="1" new="0" fired="1" proxy="1.000"/> +<r n="naming-wordy" old="1" new="1" fired="2" proxy="0.500"/> <r n="naming-series" scope="group-rule"/> <r n="naming-underscore" old="0" new="0" fired="0"/> <r n="naming-case" old="0" new="1" fired="1" proxy="0.000"/> @@ -2142,11 +2130,11 @@ _The corpus's OWN case-convention vote per (language, kind) group; off-conventio ``` $ ./build/ripwire . --naming-consistency --limit=8 <!-- ripwire naming-consistency schema=ripwire.naming-consistency/v1: the corpus's case-convention vote per (language, kind): <g lang= kind= style= agree= total=>, <f p= n= propose=> outliers. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). root=: p= relative to it. component_exempt=N: PascalCase .tsx/.jsx functions (read as JSX components by extension alone), kept out of voting and flagging. groups=N: (language, kind) groups with at least one styled name. candidates=N: multi-token styled names scanned. decided=N: groups whose leading style cleared both the sample and agreement floors. flagged=N: off-convention names in decided groups (the f rows). g why=insufficient-sample|no-clear-convention: which bar a style=UNAVAILABLE group missed. --> -<naming-consistency schema="ripwire.naming-consistency/v1" groups="32" candidates="19286" decided="11" flagged="794" component_exempt="8" shown="8" capped="1" total="794" has_more="1" next_offset="8" offset="0" limit="8" root="."> -<g lang="cpp" kind="fn" style="camel" agree="10560" total="11181"/> -<g lang="cpp" kind="var" style="camel" agree="2390" total="2411"/> -<g lang="py" kind="fn" style="snake" agree="1436" total="1486"/> -<g lang="py" kind="var" style="UNAVAILABLE" why="no-clear-convention" total="552"/> +<naming-consistency schema="ripwire.naming-consistency/v1" groups="32" candidates="19493" decided="11" flagged="799" component_exempt="8" shown="8" capped="1" total="799" has_more="1" next_offset="8" offset="0" limit="8" root="."> +<g lang="cpp" kind="fn" style="camel" agree="10732" total="11358"/> +<g lang="cpp" kind="var" style="camel" agree="2403" total="2424"/> +<g lang="py" kind="fn" style="snake" agree="1439" total="1489"/> +<g lang="py" kind="var" style="UNAVAILABLE" why="no-clear-convention" total="562"/> <g lang="ts" kind="fn" style="camel" agree="302" total="313"/> <g lang="ts" kind="var" style="UNAVAILABLE" why="insufficient-sample" total="5"/> <g lang="go" kind="fn" style="UNAVAILABLE" why="no-clear-convention" total="113"/> @@ -2179,8 +2167,8 @@ _The opt-in --lint modifier: naming predicates over LOCAL variable names too, C/ ``` $ ./build/ripwire . --lint --naming-locals <!-- ripwire lint schema=ripwire.lint/v1: AST-only checks, facts not gates: <rule name= count= shown_rows= rows_capped= count_capped=> of <f rule= p= in=>. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). findings_capped=/rows_capped=/count_capped=: 1 = cut. counts_floor=1: every count is a FLOOR, never a total. root=: p= relative to it. findings=N: findings over the printed rules; a floor when findings_capped=1. findings_next=: the call counting the floored rules' rest (count_capped=1 rules only, 10x per-rule budget). --> -<lint schema="ripwire.lint/v1" findings="10505" shown="628" capped="1" total="10505" has_more="1" next_offset="628" offset="0" limit="0" counts_floor="1" findings_capped="1" findings_next="--lint --naming-locals --lint-select=magic-number --lint-max-per-rule=50000" naming_locals="1" root="."> -<rule name="c-style-cast" count="760" shown_rows="28" rows_capped="1"/> +<lint schema="ripwire.lint/v1" findings="10481" shown="628" capped="1" total="10481" has_more="1" next_offset="628" offset="0" limit="0" counts_floor="1" findings_capped="1" findings_next="--lint --naming-locals --lint-select=magic-number --lint-max-per-rule=50000" naming_locals="1" root="."> +<rule name="c-style-cast" count="761" shown_rows="28" rows_capped="1"/> <rule name="goto" count="17" shown_rows="0" rows_capped="1"/> <rule name="do-while" count="20" shown_rows="0" rows_capped="1"/> <rule name="unsafe-c-fn" count="0" shown_rows="0" rows_capped="0"/> @@ -2214,13 +2202,13 @@ _Functions WITH a doc comment, most name-restating first: c_coeff (high = the co ``` $ ./build/ripwire . --comment-coherence --limit=8 <!-- ripwire comment-coherence schema=ripwire.comment-coherence/v1: two comment/name content measures per documented function, most name-restating first: <fn p= n= c_coeff= cic=>. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). root=: p= relative to it. documented=N: functions with a doc comment, measured (the rows); a FLOOR when unreadable_files= shows. no_comment=N: eligible symbols with no measurable comment; UNAVAILABLE, never scored as zero. words=/restate=: comment word count (c_coeff= denominator, stopwords kept) / words matching a name word. c_terms=/i_terms=/shared=: comment term set / identifiers the body uses / overlap; cic= shared over union. --> -<comment_coherence schema="ripwire.comment-coherence/v1" documented="7636" no_comment="17424" shown="8" capped="1" total="7636" has_more="1" next_offset="8" offset="0" limit="8" root="."> +<comment_coherence schema="ripwire.comment-coherence/v1" documented="7779" no_comment="17518" shown="8" capped="1" total="7779" has_more="1" next_offset="8" offset="0" limit="8" root="."> <fn p="src/infra/os.h:637" n="socket" c_coeff="1.000" words="1" restate="1" cic="0.000" c_terms="1" i_terms="5" shared="0"/> <fn p="src/lsp.h:540" n="lspLocationJson" c_coeff="1.000" words="1" restate="1" cic="0.000" c_terms="1" i_terms="26" shared="0"/> <fn p="src/query.h:262" n="sourceAll" c_coeff="1.000" words="1" restate="1" cic="0.000" c_terms="1" i_terms="12" shared="0"/> <fn p="src/warmsnap.h:791" n="recordTree" c_coeff="1.000" words="2" restate="2" cic="0.023" c_terms="2" i_terms="88" shared="2"/> <fn p="src/warmsnap.h:847" n="replayTree" c_coeff="1.000" words="2" restate="2" cic="0.028" c_terms="2" i_terms="71" shared="2"/> -<fn p="src/verbs_quality.h:3367" n="runDmm" c_coeff="1.000" words="1" restate="1" cic="0.029" c_terms="1" i_terms="35" shared="1"/> +<fn p="src/verbs_quality.h:3605" n="runDmm" c_coeff="1.000" words="1" restate="1" cic="0.029" c_terms="1" i_terms="35" shared="1"/> <fn p="src/infra/dynamic_map.hpp:1955" n="erase_rec" c_coeff="1.000" words="1" restate="1" cic="0.048" c_terms="1" i_terms="21" shared="1"/> <fn p="test/verify_os_win32_logic.cpp:249" n="WidePath: separators, the Git Bash drive spelling, and nothing else rewritten" c_coeff="1.000" words="2" restate="2" cic="0.133" c_terms="2" i_terms="15" shared="2"/> </comment_coherence> @@ -2247,16 +2235,16 @@ _Files that change together in git (hidden coupling)._ ``` $ ./build/ripwire . --cochange <!-- ripwire cochange schema=ripwire.cochange/v1: files that change together in git: <pair a= b= together= deg= conf_ab= conf_ba= surprising=>, or for of= <f p= together= conf_rev=>. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). at=: commit+dirty+shallow. root=: p= relative to it. pairs=N: file pairs with 3+ shared commits in window= (after min_recur), surprising or not. sub_windows=N: equal-commit-count slices of window=; the denominator of recur=. driver=a|b: the side whose changes best imply the other's, look there first; absent on a tie. recur=K: slices of sub_windows= the pair co-changed in; 1 = one burst, not a standing coupling. --> -<cochange schema="ripwire.cochange/v1" pairs="5692" window="18mo@HEAD" sub_windows="3" shown="30" capped="1" total="5692" has_more="1" next_offset="30" offset="0" limit="0" root="." at="ed47f82e8"> -<pair a="test/headsnapcachecheck.sh" b="test/qsnapcachecheck.sh" together="5" deg="1.00" conf_ab="1.00" conf_ba="0.83" driver="a" recur="3" surprising="1"/> +<cochange schema="ripwire.cochange/v1" pairs="5714" window="18mo@HEAD" sub_windows="3" shown="30" capped="1" total="5714" has_more="1" next_offset="30" offset="0" limit="0" root="." at="914c4045d"> <pair a="src/aliasdef.h" b="src/ingest_sidecap.h" together="5" deg="1.00" conf_ab="1.00" conf_ba="0.03" driver="a" recur="1" surprising="1"/> +<pair a="test/headsnapcachecheck.sh" b="test/qsnapcachecheck.sh" together="5" deg="1.00" conf_ab="1.00" conf_ba="0.83" driver="a" recur="3" surprising="1"/> <pair a="src/cli.h" b="src/handoffwindow.h" together="4" deg="1.00" conf_ab="0.01" conf_ba="1.00" driver="b" recur="1" surprising="1"/> <pair a="src/main.cpp" b="src/warmsnap_model.h" together="4" deg="1.00" conf_ab="0.01" conf_ba="1.00" driver="b" recur="1" surprising="1"/> -<pair a="src/layout.h" b="test/layoutfix/attrfields.h" together="4" deg="1.00" conf_ab="0.11" conf_ba="1.00" driver="b" recur="1" surprising="1"/> <pair a="src/foraliashop.h" b="src/verbs_navigate.h" together="4" deg="1.00" conf_ab="1.00" conf_ba="0.01" driver="a" recur="1" surprising="1"/> -<pair a="src/verbs_report.h" b="test/fileset_unit.cpp" together="3" deg="1.00" conf_ab="0.03" conf_ba="1.00" driver="b" recur="1" surprising="1"/> -<pair a="src/fieldaffinity.h" b="test/accessshapefix/walks.cpp" together="3" deg="1.00" conf_ab="0.33" conf_ba="1.00" driver="b" recur="1" surprising="1"/> -<pair a="test/arityfix/argtype/buf.cc" b="test/arityfix/argtype/watermark.cc" together="3" deg="1.00" conf_ab="1.00" conf_ba="1.00" recur="1" surprising="1"/> +<pair a="src/layout.h" b="test/layoutfix/attrfields.h" together="4" deg="1.00" conf_ab="0.11" conf_ba="1.00" driver="b" recur="1" surprising="1"/> +<pair a="src/ingest_valuerefs.h" b="src/pydottedpath.h" together="3" deg="1.00" conf_ab="0.04" conf_ba="1.00" driver="b" recur="1" surprising="1"/> +<pair a="test/pincensuscheck.sh" b="test/scipjoincheck.sh" together="3" deg="1.00" conf_ab="0.38" conf_ba="1.00" driver="b" recur="2" surprising="1"/> +<pair a="test/grepcheck.sh" b="test/grepcontextcheck.sh" together="3" deg="1.00" conf_ab="0.50" conf_ba="1.00" driver="b" recur="1" surprising="1"/> ... [22 more line(s); run it to see the whole thing] ``` @@ -2279,16 +2267,16 @@ _Only pairs whose co-change RECURS in 2+ sub-windows of the mined window (sub_wi ``` $ ./build/ripwire . --cochange --cochange-recur=2 <!-- ripwire cochange schema=ripwire.cochange/v1: files that change together in git: <pair a= b= together= deg= conf_ab= conf_ba= surprising=>, or for of= <f p= together= conf_rev=>. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). at=: commit+dirty+shallow. root=: p= relative to it. pairs=N: file pairs with 3+ shared commits in window= (after min_recur), surprising or not. sub_windows=N: equal-commit-count slices of window=; the denominator of recur=. driver=a|b: the side whose changes best imply the other's, look there first; absent on a tie. recur=K: slices of sub_windows= the pair co-changed in; 1 = one burst, not a standing coupling. --> -<cochange schema="ripwire.cochange/v1" pairs="3662" window="18mo@HEAD" sub_windows="3" min_recur="2" shown="30" capped="1" total="3662" has_more="1" next_offset="30" offset="0" limit="0" root="." at="ed47f82e8"> +<cochange schema="ripwire.cochange/v1" pairs="3652" window="18mo@HEAD" sub_windows="3" min_recur="2" shown="30" capped="1" total="3652" has_more="1" next_offset="30" offset="0" limit="0" root="." at="914c4045d"> <pair a="test/headsnapcachecheck.sh" b="test/qsnapcachecheck.sh" together="5" deg="1.00" conf_ab="1.00" conf_ba="0.83" driver="a" recur="3" surprising="1"/> -<pair a="test/pincensuscheck.sh" b="test/scipjoincheck.sh" together="3" deg="1.00" conf_ab="0.38" conf_ba="1.00" driver="b" recur="2" surprising="1"/> +<pair a="src/binstale.h" b="src/crossref.h" together="3" deg="1.00" conf_ab="1.00" conf_ba="0.03" driver="a" recur="2" surprising="1"/> +<pair a="bench/scip_match_diag.py" b="bench/scip_pin_precision.py" together="3" deg="1.00" conf_ab="1.00" conf_ba="0.60" driver="a" recur="2" surprising="1"/> +<pair a="test/cachesplitcheck.sh" b="test/portablecachecheck.sh" together="3" deg="1.00" conf_ab="0.75" conf_ba="1.00" driver="b" recur="3" surprising="1"/> <pair a="test/mcpslicecheck.sh" b="test/mcpverbscheck.sh" together="3" deg="1.00" conf_ab="1.00" conf_ba="0.16" driver="a" recur="2" surprising="1"/> +<pair a="test/elixircheck.sh" b="test/elixirsemanticcheck.sh" together="3" deg="1.00" conf_ab="0.13" conf_ba="1.00" driver="b" recur="2" surprising="1"/> <pair a="test/gatecountcheck.sh" b="test/manifestcheck.sh" together="3" deg="1.00" conf_ab="1.00" conf_ba="0.23" driver="a" recur="2" surprising="1"/> +<pair a="test/pincensuscheck.sh" b="test/scipjoincheck.sh" together="3" deg="1.00" conf_ab="0.38" conf_ba="1.00" driver="b" recur="2" surprising="1"/> <pair a="test/luacheck.sh" b="test/phpcheck.sh" together="3" deg="1.00" conf_ab="0.75" conf_ba="1.00" driver="b" recur="2" surprising="1"/> -<pair a="test/gatecountcheck.sh" b="test/regression.sh" together="3" deg="1.00" conf_ab="1.00" conf_ba="0.00" driver="a" recur="2" surprising="1"/> -<pair a="src/binstale.h" b="src/crossref.h" together="3" deg="1.00" conf_ab="1.00" conf_ba="0.03" driver="a" recur="2" surprising="1"/> -<pair a="test/elixircheck.sh" b="test/elixirsemanticcheck.sh" together="3" deg="1.00" conf_ab="0.13" conf_ba="1.00" driver="b" recur="2" surprising="1"/> -<pair a="test/cachesplitcheck.sh" b="test/portablecachecheck.sh" together="3" deg="1.00" conf_ab="0.75" conf_ba="1.00" driver="b" recur="3" surprising="1"/> ... [22 more line(s); run it to see the whole thing] ``` @@ -2305,7 +2293,7 @@ _Modularity-violation GROUPS instead of pairs: "X co-changes with {A,B,C}, none ``` $ ./build/ripwire . --cochange --cochange-groups <!-- ripwire cochange schema=ripwire.cochange/v1: files that change together in git: <pair a= b= together= deg= conf_ab= conf_ba= surprising=>, or for of= <f p= together= conf_rev=>. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). no_file_edges=LANGS: this build resolves almost none of these languages' imports to files (Go only across go.mod replace); counts over them (ca/ce and violations= of the arch verb) are floors over the resolved edges only, and a coupling number absent beside it is unknown, not zero. unknown_pairs=N: pairs left out of groups= because surprising= is unknown for them, not 0; drop the cochange-groups flag to list them. at=: commit+dirty+shallow. root=: p= relative to it. sub_windows=N: equal-commit-count slices of window=; the denominator of recur=. recur=K: slices of sub_windows= the pair co-changed in; 1 = one burst, not a standing coupling. no_file_edges=LANGS: with unknown_pairs=N, pairs whose side imports are almost never resolved to files and none links them are in no group; groups= may be low. --> -<cochange schema="ripwire.cochange/v1" groups="158" pairs_covered="1310" cover="greedy" window="18mo@HEAD" sub_windows="3" no_file_edges="java" unknown_pairs="1" shown="30" capped="1" total="158" has_more="1" next_offset="30" offset="0" limit="0" root="." at="ed47f82e8"> +<cochange schema="ripwire.cochange/v1" groups="159" pairs_covered="1313" cover="greedy" window="18mo@HEAD" sub_windows="3" no_file_edges="java" unknown_pairs="1" shown="30" capped="1" total="159" has_more="1" next_offset="30" offset="0" limit="0" root="." at="914c4045d"> <group core="src/cli.h" partners="84"> <f p="src/abicheck.h" together="5" recur="3" conf_core="0.01"/> <f p="src/arch.h" together="7" recur="3" conf_core="0.01"/> @@ -2313,7 +2301,7 @@ $ ./build/ripwire . --cochange --cochange-groups <f p="src/codexdoctor.h" together="3" recur="2" conf_core="0.00"/> <f p="src/columnar.h" together="5" recur="3" conf_core="0.01"/> <f p="src/commentcoherence.h" together="3" recur="1" conf_core="0.00"/> -<f p="src/compactlegend.h" together="151" recur="3" conf_core="0.24"/> +<f p="src/compactlegend.h" together="152" recur="3" conf_core="0.24"/> <f p="src/contextratio.h" together="4" recur="1" conf_core="0.01"/> <f p="src/countfloor.h" together="4" recur="2" conf_core="0.01"/> <f p="src/crossref.h" together="25" recur="3" conf_core="0.04"/> @@ -2334,18 +2322,18 @@ _Hotspots scoped to RECENT churn (the regression lens)._ ``` $ ./build/ripwire . --hotspots --since="2 weeks ago" <!-- ripwire hotspots schema=ripwire.hotspots/v1: maintenance pain = churn x ccx over window=: <f p= churn= ccx= score= top= top_ccx= top_l=>; unranked_*= no churn/complexity. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). at=: commit+dirty+shallow. root=: p= relative to it. files=/ranked=: files in the window / those with both churn and complexity; ranked + unranked_no_churn + unranked_no_complexity = files. unranked_no_churn=/unranked_no_complexity=: files left out for no commit in window= / no measured complexity. --> -<hotspots schema="ripwire.hotspots/v1" window="2 weeks ago" files="4842" ranked="436" unranked_no_churn="3959" unranked_no_complexity="447" shown="40" capped="1" total="436" has_more="1" next_offset="40" offset="0" limit="0" root="." at="ed47f82e8"> -<f p="src/graph.h" churn="125" ccx="6723" score="840375" top="buildGraph" top_ccx="1979" top_l="10846"/> -<f p="src/quality.h" churn="100" ccx="2631" score="263100" top="computeDelta" top_ccx="316" top_l="11887"/> -<f p="src/serialize.h" churn="58" ccx="2718" score="157644" top="serialize" top_ccx="319" top_l="3317"/> -<f p="src/mcpverbs.h" churn="101" ccx="1369" score="138269" top="runBatchSub" top_ccx="142" top_l="6334"/> -<f p="src/verbs_for.h" churn="84" ccx="1358" score="114072" top="runForLensPass" top_ccx="706" top_l="3606"/> -<f p="src/resolve.h" churn="30" ccx="2566" score="76980" top="buildPreciseIncludeAdjWithContext" top_ccx="103" top_l="5588"/> -<f p="src/verbs_quality.h" churn="63" ccx="956" score="60228" top="runQualityDelta" top_ccx="323" top_l="2587"/> -<f p="src/cli.h" churn="86" ccx="682" score="58652" top="parseArgs" top_ccx="214" top_l="5740"/> -<f p="src/main.cpp" churn="40" ccx="1356" score="54240" top="dispatchMainBody" top_ccx="513" top_l="4653"/> -<f p="src/ingest_binds.h" churn="20" ccx="2607" score="52140" top="bindsVisitNode" top_ccx="103" top_l="7848"/> -<f p="src/receiverevidence.h" churn="32" ccx="1611" score="51552" top="bareClassAt" top_ccx="77" top_l="784"/> +<hotspots schema="ripwire.hotspots/v1" window="2 weeks ago" files="4852" ranked="440" unranked_no_churn="3966" unranked_no_complexity="446" shown="40" capped="1" total="440" has_more="1" next_offset="40" offset="0" limit="0" root="." at="914c4045d"> +<f p="src/graph.h" churn="123" ccx="6723" score="826929" top="buildGraph" top_ccx="1979" top_l="10846"/> +<f p="src/quality.h" churn="106" ccx="2657" score="281642" top="computeDelta" top_ccx="318" top_l="12009"/> +<f p="src/mcpverbs.h" churn="98" ccx="1369" score="134162" top="runBatchSub" top_ccx="142" top_l="6335"/> +<f p="src/serialize.h" churn="54" ccx="2407" score="129978" top="packSignatures" top_ccx="235" top_l="6525"/> +<f p="src/verbs_for.h" churn="76" ccx="1358" score="103208" top="runForLensPass" top_ccx="706" top_l="3606"/> +<f p="src/resolve.h" churn="29" ccx="2566" score="74414" top="buildPreciseIncludeAdjWithContext" top_ccx="103" top_l="5588"/> +<f p="src/main.cpp" churn="45" ccx="1372" score="61740" top="dispatchMainBody" top_ccx="513" top_l="4711"/> +<f p="src/cli.h" churn="81" ccx="682" score="55242" top="parseArgs" top_ccx="214" top_l="5740"/> +<f p="src/verbs_quality.h" churn="72" ccx="761" score="54792" top="runQualityViews" top_ccx="122" top_l="4027"/> +<f p="src/receiverevidence.h" churn="33" ccx="1613" score="53229" top="bareClassAt" top_ccx="77" top_l="784"/> +<f p="src/ingest_binds.h" churn="19" ccx="2607" score="49533" top="bindsVisitNode" top_ccx="103" top_l="7848"/> <f p="src/verbs_navigate.h" churn="45" ccx="1038" score="46710" top="runVerify" top_ccx="144" top_l="2297"/> ... [17 more line(s); run it to see the whole thing] ``` @@ -2377,7 +2365,7 @@ $ ./build/ripwire . --arch=test/archfix/rules.txt <m path=".codex-plugin" ca="0" ce="0" types="0" abstract="0" I="0.00" A="0.00" D="1.00" zone="n/a" reachable="1" isolated="1"/> <m path=".github" ca="0" ce="0" types="0" abstract="0" I="0.00" A="0.00" D="1.00" zone="n/a" reachable="1" isolated="1"/> <m path=".github/workflows" ca="0" ce="0" types="0" abstract="0" I="0.00" A="0.00" D="1.00" zone="n/a" reachable="1" isolated="1"/> -<m path="bench" ca="0" ce="1" types="24" abstract="2" I="1.00" A="0.08" D="0.08" zone="ok" reachable="1"/> +<m path="bench" ca="0" ce="1" types="25" abstract="2" I="1.00" A="0.08" D="0.08" zone="ok" reachable="1"/> <m path="bench/agentloop" ca="0" ce="0" types="0" abstract="0" I="0.00" A="0.00" D="1.00" zone="n/a" reachable="1" isolated="1"/> <m path="bench/agentloop/editsuite" ca="0" ce="0" types="0" abstract="0" I="0.00" A="0.00" D="1.00" zone="n/a" reachable="1" isolated="1"/> <m path="bench/agentloop/editsuite/fixture" ca="0" ce="0" types="2" abstract="0" I="0.00" A="0.00" D="1.00" zone="pain" reachable="1" isolated="1"/> @@ -2409,7 +2397,7 @@ $ ./build/ripwire . --arch=test/archfix/rules.txt <m path=".codex-plugin" ca="0" ce="0" types="0" abstract="0" I="0.00" A="0.00" D="1.00" zone="n/a" reachable="1" isolated="1"/> <m path=".github" ca="0" ce="0" types="0" abstract="0" I="0.00" A="0.00" D="1.00" zone="n/a" reachable="1" isolated="1"/> <m path=".github/workflows" ca="0" ce="0" types="0" abstract="0" I="0.00" A="0.00" D="1.00" zone="n/a" reachable="1" isolated="1"/> -<m path="bench" ca="0" ce="1" types="24" abstract="2" I="1.00" A="0.08" D="0.08" zone="ok" reachable="1"/> +<m path="bench" ca="0" ce="1" types="25" abstract="2" I="1.00" A="0.08" D="0.08" zone="ok" reachable="1"/> <m path="bench/agentloop" ca="0" ce="0" types="0" abstract="0" I="0.00" A="0.00" D="1.00" zone="n/a" reachable="1" isolated="1"/> <m path="bench/agentloop/editsuite" ca="0" ce="0" types="0" abstract="0" I="0.00" A="0.00" D="1.00" zone="n/a" reachable="1" isolated="1"/> <m path="bench/agentloop/editsuite/fixture" ca="0" ce="0" types="2" abstract="0" I="0.00" A="0.00" D="1.00" zone="pain" reachable="1" isolated="1"/> @@ -2436,7 +2424,7 @@ $ ./build/ripwire . --arch=test/archfix/rules.txt <m path=".codex-plugin" ca="0" ce="0" types="0" abstract="0" I="0.00" A="0.00" D="1.00" zone="n/a" reachable="1" isolated="1"/> <m path=".github" ca="0" ce="0" types="0" abstract="0" I="0.00" A="0.00" D="1.00" zone="n/a" reachable="1" isolated="1"/> <m path=".github/workflows" ca="0" ce="0" types="0" abstract="0" I="0.00" A="0.00" D="1.00" zone="n/a" reachable="1" isolated="1"/> -<m path="bench" ca="0" ce="1" types="24" abstract="2" I="1.00" A="0.08" D="0.08" zone="ok" reachable="1"/> +<m path="bench" ca="0" ce="1" types="25" abstract="2" I="1.00" A="0.08" D="0.08" zone="ok" reachable="1"/> <m path="bench/agentloop" ca="0" ce="0" types="0" abstract="0" I="0.00" A="0.00" D="1.00" zone="n/a" reachable="1" isolated="1"/> <m path="bench/agentloop/editsuite" ca="0" ce="0" types="0" abstract="0" I="0.00" A="0.00" D="1.00" zone="n/a" reachable="1" isolated="1"/> <m path="bench/agentloop/editsuite/fixture" ca="0" ce="0" types="2" abstract="0" I="0.00" A="0.00" D="1.00" zone="pain" reachable="1" isolated="1"/> @@ -2459,8 +2447,8 @@ _Built-in AST checks (c-cast, goto, unsafe-c-fn, ...)._ ``` $ ./build/ripwire . --lint <!-- ripwire lint schema=ripwire.lint/v1: AST-only checks, facts not gates: <rule name= count= shown_rows= rows_capped= count_capped=> of <f rule= p= in=>. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). findings_capped=/rows_capped=/count_capped=: 1 = cut. counts_floor=1: every count is a FLOOR, never a total. root=: p= relative to it. findings=N: findings over the printed rules; a floor when findings_capped=1. findings_next=: the call counting the floored rules' rest (count_capped=1 rules only, 10x per-rule budget). --> -<lint schema="ripwire.lint/v1" findings="8624" shown="667" capped="1" total="8624" has_more="1" next_offset="667" offset="0" limit="0" counts_floor="1" findings_capped="1" findings_next="--lint --lint-select=magic-number --lint-max-per-rule=50000" root="."> -<rule name="c-style-cast" count="760" shown_rows="79" rows_capped="1"/> +<lint schema="ripwire.lint/v1" findings="8638" shown="667" capped="1" total="8638" has_more="1" next_offset="667" offset="0" limit="0" counts_floor="1" findings_capped="1" findings_next="--lint --lint-select=magic-number --lint-max-per-rule=50000" root="."> +<rule name="c-style-cast" count="761" shown_rows="79" rows_capped="1"/> <rule name="goto" count="17" shown_rows="0" rows_capped="1"/> <rule name="do-while" count="20" shown_rows="0" rows_capped="1"/> <rule name="unsafe-c-fn" count="0" shown_rows="0" rows_capped="0"/> @@ -2568,8 +2556,8 @@ _DROP two families, applied after selection; the raw select=/ignore= you passed ``` $ ./build/ripwire . --lint --lint-ignore=naming-,cache- <!-- ripwire lint schema=ripwire.lint/v1: AST-only checks, facts not gates: <rule name= count= shown_rows= rows_capped= count_capped=> of <f rule= p= in=>. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). findings_capped=/rows_capped=/count_capped=: 1 = cut. counts_floor=1: every count is a FLOOR, never a total. root=: p= relative to it. findings=N: findings over the printed rules; a floor when findings_capped=1. findings_next=: the call counting the floored rules' rest (count_capped=1 rules only, 10x per-rule budget). --> -<lint schema="ripwire.lint/v1" findings="2954" shown="713" capped="1" total="2954" has_more="1" next_offset="713" offset="0" limit="0" counts_floor="1" findings_capped="1" findings_next="--lint --lint-select=magic-number --lint-max-per-rule=50000" selected="22 of 39" ignore="naming-,cache-" root="." … [line truncated: 1 more bytes on this line] -<rule name="c-style-cast" count="760" shown_rows="127" rows_capped="1"/> +<lint schema="ripwire.lint/v1" findings="2953" shown="713" capped="1" total="2953" has_more="1" next_offset="713" offset="0" limit="0" counts_floor="1" findings_capped="1" findings_next="--lint --lint-select=magic-number --lint-max-per-rule=50000" selected="22 of 39" ignore="naming-,cache-" root="." … [line truncated: 1 more bytes on this line] +<rule name="c-style-cast" count="761" shown_rows="127" rows_capped="1"/> <rule name="goto" count="17" shown_rows="0" rows_capped="1"/> <rule name="do-while" count="20" shown_rows="0" rows_capped="1"/> <rule name="unsafe-c-fn" count="0" shown_rows="0" rows_capped="0"/> @@ -2682,19 +2670,19 @@ _Cluster the call graph into cohesive modules._ ``` $ ./build/ripwire . --communities <!-- ripwire communities schema=ripwire.communities/v1: call-graph modules (Louvain): <community id= size= dir= label=> of <member t= n= p=>; drill= the verb taking a row's id=; shown_modules=/shown_bridges= <community>/<bridge> rows listed; bridges= community pairs joined by a call edge; isolated= symbols with no call edge: isolated_doc= doc sections, isolated_decl= other bodyless, isolated_header= other header defs, isolated_source= the rest; modules= modules of 2+ symbols; connected_singletons= 1-symbol modules with a call edge; symbols= indexed symbols. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). modules_capped=/bridges_capped=: 1 = cut. counts_floor=1: every count is a FLOOR, never a total. graph_ambiguous=/graph_unresolved=: resolver gauge. graph_unindexed=N: N files no grammar could read (the map header's unindexed=); their calls raise neither gauge. root=: p= relative to it. pr_iters=N: PageRank iterations. <bridge a= b=>: two module ids joined by call edges. from_label=/to_label=: the label= of a=/b=. <bridge edges=>: call edges between the two, either direction. --> -<communities schema="ripwire.communities/v1" drill="--community=ID" modules="5152" shown_modules="30" modules_capped="1" bridges="8425" shown_bridges="12" bridges_capped="1" isolated="20966" isolated_decl="5792" isolated_header="3547" isolated_source="4560" isolated_doc="7067" connected_singletons=" … [line truncated: 193 more bytes on this line] -<community id="6904" size="1842" dir="src" label="src::emitTo@infra/emit.h:53:2760 [write,run,emit]" shown="5" capped="1"> -<member t="fn" n="relForHash" p="src/model.h:2722"/> -<member t="macro" n="RW_ASSUME_" p="src/infra/Diagnostics.h:328"/> -<member t="macro" n="RW_ASSUME_" p="src/infra/Diagnostics.h:370"/> -<member t="macro" n="ASSUME" p="src/infra/Diagnostics.h:392"/> +<communities schema="ripwire.communities/v1" drill="--community=ID" modules="5247" shown_modules="30" modules_capped="1" bridges="8832" shown_bridges="12" bridges_capped="1" isolated="21074" isolated_decl="5832" isolated_header="3601" isolated_source="4566" isolated_doc="7075" connected_singletons=" … [line truncated: 193 more bytes on this line] +<community id="6925" size="1652" dir="src" label="src::emitTo@infra/emit.h:53:2760 [write,run,emit]" shown="5" capped="1"> <member t="macro" n="EXPECTS" p="src/infra/Diagnostics.h:393"/> +<member t="fn" n="escapeXml" p="src/serialize.h:185"/> +<member t="fn" n="formatTo" p="src/infra/emit.h:141"/> +<member t="fn" n="emitTo" p="src/infra/emit.h:53"/> +<member t="fn" n="emitTo" p="src/infra/emit.h:78"/> </community> -<community id="6949" size="720" dir="src" label="src::kindIs@infra/nodekind.h:46:3271 [push,emit,read]" shown="5" capped="1"> +<community id="6970" size="733" dir="src" label="src::kindIs@infra/nodekind.h:46:3271 [push,emit,read]" shown="5" capped="1"> <member t="fn" n="kindIs" p="src/infra/nodekind.h:46"/> <member t="fn" n="nodeTextOf" p="src/ingest_metrics.h:161"/> +<member t="fn" n="enumTableAt" p="src/infra/enumcount.h:106"/> <member t="fn" n="fieldChild" p="src/infra/fieldid.h:223"/> -<member t="fn" n="forEachChild" p="src/infra/tschildren.h:89"/> ... [17 more line(s); run it to see the whole thing] ``` @@ -2713,7 +2701,7 @@ _Drill into ONE call-graph community by id — the drill= the --communities outp ``` $ ./build/ripwire . --community=0 <!-- ripwire community schema=ripwire.community/v1: ONE module id=: <member t= n= p=> ranked members, its <bridge> edges; size= the TRUE count; dir= its members' most common directory (a top-level file's own path); label= dir::name@file:line:byte of its top fan-in member (non-accessors first) [up to 3 top name verbs]; bridges= modules a call edge joins to it; partition= module count incl. singletons (ids 0..partition-1); modules= those of 2+ symbols; shown_bridges= <bridge> rows listed. window: shown= capped= (capped=1 cut). bridges_capped=: 1 = cut. counts_floor=1: every count is a FLOOR, never a total. graph_ambiguous=/graph_unresolved=: resolver gauge. graph_unindexed=N: N files no grammar could read (the map header's unindexed=); their calls raise neither gauge. root=: p= relative to it. pr_iters=N: PageRank iterations. --> -<community schema="ripwire.community/v1" id="0" size="1" dir=".coderabbit.yaml" label=".coderabbit.yaml::reviews@.coderabbit.yaml:12:928" bridges="0" shown_bridges="0" bridges_capped="0" partition="26118" modules="5152" shown="1" capped="0" pr_iters="38" root="." graph_ambiguous="3960" graph_unresol … [line truncated: 51 more bytes on this line] +<community schema="ripwire.community/v1" id="0" size="1" dir=".coderabbit.yaml" label=".coderabbit.yaml::reviews@.coderabbit.yaml:12:928" bridges="0" shown_bridges="0" bridges_capped="0" partition="26321" modules="5247" shown="1" capped="0" pr_iters="37" root="." graph_ambiguous="3984" graph_unresol … [line truncated: 51 more bytes on this line] <member t="sec" n="reviews" p=".coderabbit.yaml:12"/> </community> ``` @@ -2738,19 +2726,19 @@ _Nested module hierarchy (multi-level Louvain) + cross-module bridges — shown_ ``` $ ./build/ripwire . --zoom <!-- ripwire zoom schema=ripwire.zoom/v1: nested module hierarchy: <module level= id= size= dir= shown= capped=> of <member t= n= p=>; symbols= = isolated= + size= of all top_modules=. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). levels_capped=: 1 = cut. counts_floor=1: every count is a FLOOR, never a total. graph_ambiguous=/graph_unresolved=: resolver gauge. graph_unindexed=N: N files no grammar could read (the map header's unindexed=); their calls raise neither gauge. pr_iters=N: PageRank iterations. shown_levels=N: of levels= printed; levels_capped=1 deeper ones unprinted. children=K: K child modules below the shown_levels= cut, unprinted. next=: the one pasteable follow-up. --> -<zoom schema="ripwire.zoom/v1" levels="5" shown_levels="2" levels_capped="1" top_modules="1687" symbols="44690" isolated="20966" shown="40" capped="1" total="1687" has_more="1" next_offset="40" offset="0" limit="0" pr_iters="38" graph_ambiguous="3960" graph_unresolved="20090" graph_unindexed="313" c … [line truncated: 42 more bytes on this line] -<module level="4" id="1818" size="11370" dir="./src"> -<module level="3" id="1819" size="11310" dir="./src" children="29"> +<zoom schema="ripwire.zoom/v1" levels="5" shown_levels="2" levels_capped="1" top_modules="1689" symbols="45032" isolated="21074" shown="40" capped="1" total="1689" has_more="1" next_offset="40" offset="0" limit="0" pr_iters="37" graph_ambiguous="3984" graph_unresolved="20100" graph_unindexed="313" c … [line truncated: 42 more bytes on this line] +<module level="4" id="1818" size="11567" dir="./src"> +<module level="3" id="1819" size="11038" dir="./src" children="23"> </module> -<module level="3" id="6771" size="60" dir="./src" children="2"> +<module level="3" id="1831" size="469" dir="./src/infra" children="6"> </module> +<module level="3" id="6790" size="60" dir="./src" children="2"> </module> -<module level="4" id="6309" size="2949" dir="./test"> -<module level="3" id="6310" size="2949" dir="./test" children="12"> +</module> +<module level="4" id="6327" size="2959" dir="./test"> +<module level="3" id="6329" size="2959" dir="./test" children="12"> </module> </module> -<module level="4" id="1572" size="569" dir="./bench/agentloop"> -<module level="3" id="1635" size="421" dir="./test" children="7"> ... [17 more line(s); run it to see the whole thing] ``` @@ -2775,16 +2763,16 @@ $ ./build/ripwire . --report # ripwire architecture report -4842 files · 44690 symbols · 44883 edges · 5152 modules (20966 call-graph isolated) +4852 files · 45032 symbols · 45381 edges · 5247 modules (21074 call-graph isolated) Root: `.` -Call-graph isolate provenance: 5792 declaration, 3547 header, 4560 source, 7067 document; 0 connected Louvain singletons +Call-graph isolate provenance: 5832 declaration, 3601 header, 4566 source, 7075 document; 0 connected Louvain singletons -## Modules (call-graph clusters; showing 12 of 5152) -- **src::emitTo@infra/emit.h:53:2760 [write,run,emit]** — 1842 symbols -- **src::kindIs@infra/nodekind.h:46:3271 [push,emit,read]** — 720 symbols -- **src::DISCLOSE@infra/Diagnostics.h:622:43913 [read,scan,collect]** — 385 symbols +## Modules (call-graph clusters; showing 12 of 5247) +- **src::emitTo@infra/emit.h:53:2760 [write,run,emit]** — 1652 symbols +- **src::kindIs@infra/nodekind.h:46:3271 [push,emit,read]** — 733 symbols +- **src::DISCLOSE@infra/Diagnostics.h:622:43913 [read,scan,run]** — 375 symbols ... [17 more line(s); run it to see the whole thing] ``` @@ -2801,13 +2789,13 @@ _Cross-module call seams no test reaches. NOW carries seam_pairs/shown/capped._ ``` $ ./build/ripwire . --seams <!-- ripwire seams schema=ripwire.seams/v1: cross-directory call edges NO test reaches: <seam from= to= untested= shown= capped=> of <edge caller= p= callee= cp=>. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). counts_floor=1: every count is a FLOOR, never a total. graph_ambiguous=/graph_unresolved=: resolver gauge. graph_unindexed=N: N files no grammar could read (the map header's unindexed=); their calls raise neither gauge. root=: p= relative to it. pr_iters=N: PageRank iterations. modules=N: directories holding indexed symbols (a module = parent dir). bridges=N: cross-directory call edges, tested or not; untested= is those no test reaches. test_files=N: test files whose calls seed the reach; 0 means every seam reads untested. seam_pairs=N: directed dir pairs with an untested edge (the seam rows' total). doc_links=N: cross-directory links between two document sections, not in bridges= or untested= (no test exercises a document link); absent at 0. <file-scope> (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. --> -<seams schema="ripwire.seams/v1" modules="1411" bridges="6202" untested="3204" doc_links="90" test_files="3935" seam_pairs="45" shown="20" capped="1" total="45" has_more="1" next_offset="20" offset="0" limit="0" pr_iters="38" root="." graph_ambiguous="3960" graph_unresolved="20090" graph_unindexed=" … [line truncated: 22 more bytes on this line] -<seam from="src" to="src/infra" untested="3015" shown="5" capped="1"> -<edge caller="jsonStr" p="src/serialize.h:11022" callee="escapeMcp" cp="src/infra/jsonesc.h:247"/> +<seams schema="ripwire.seams/v1" modules="1411" bridges="6264" untested="3248" doc_links="90" test_files="3938" seam_pairs="47" shown="20" capped="1" total="47" has_more="1" next_offset="20" offset="0" limit="0" pr_iters="37" root="." graph_ambiguous="3984" graph_unresolved="20100" graph_unindexed=" … [line truncated: 22 more bytes on this line] +<seam from="src" to="src/infra" untested="3057" shown="5" capped="1"> +<edge caller="jsonStr" p="src/serialize.h:11341" callee="escapeMcp" cp="src/infra/jsonesc.h:247"/> <edge caller="baseNameOf" p="src/mention.h:338" callee="afterLast" cp="src/infra/namesplit.h:193"/> <edge caller="appendNextValueXml" p="src/nextverb.h:50" callee="utf8SeqLen" cp="src/infra/jsonesc.h:59"/> +<edge caller="tokensForEmittedBytes" p="src/serialize.h:1325" callee="ASSUME" cp="src/infra/Diagnostics.h:392"/> <edge caller="jsonEscape" p="src/mcpjson.h:865" callee="escapeMcp" cp="src/infra/jsonesc.h:247"/> -<edge caller="tokensForEmittedBytes" p="src/serialize.h:1315" callee="ASSUME" cp="src/infra/Diagnostics.h:392"/> </seam> <seam from="bench" to="src/infra" untested="78" shown="5" capped="1"> <edge caller="infraSortSmall" p="bench/bench_radix_ab.cpp:73" callee="sortKeySmall" cp="src/infra/radixSort.h:91"/> @@ -2832,15 +2820,15 @@ $ ./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<br/>14900"] - n106["src/infra<br/>1685"] + n105["src<br/>15178"] + n106["src/infra<br/>1687"] end subgraph sg1 ["test"] - n107["test<br/>7002"] + n107["test<br/>7030"] n750["test/legochargefix<br/>546"] n472["test/fixtures/recallpassage<br/>314"] n491["test/fnslotcpp2<br/>285"] - n913["test/lib<br/>260"] + n913["test/lib<br/>262"] n712["test/ifacepeelfix/cpp<br/>206"] n1260["test/slotjoinfix<br/>182"] ... [17 more line(s); run it to see the whole thing] @@ -2861,7 +2849,7 @@ _Bus-factor: recency-weighted author ownership per file._ ``` $ ./build/ripwire . --owners <!-- ripwire owners schema=ripwire.owners/v1: recency-weighted author ownership (half-life 6mo): <f p= authors= bf= top= share=>; bf=1 = one person holds it. at=: commit+dirty+shallow. root=: p= relative to it. files=N: files analysed. files=N: single-author files folded into this one row; detail=1 lists each. --> -<owners schema="ripwire.owners/v1" files="4842" root="." at="ed47f82e8"> +<owners schema="ripwire.owners/v1" files="4852" root="." at="914c4045d"> <uniform authors="1" bf="1" share="1.00" files="3755"/> <f p=".coderabbit.yaml" authors="2" bf="0" top="<author>" share="0.59"/> <f p=".github/pargates-shard-weights.json" authors="3" bf="0" top="<author>" share="0.49"/> @@ -2892,7 +2880,7 @@ _Internal functions with no caller found in the index — a name-based graph rea ``` $ ./build/ripwire . --dead-code=src <!-- ripwire dead-code schema=ripwire.dead-code/v1: internal-linkage functions with no caller found in the index (not a confidence score): <d n= t= p= l=>; filter= path component. window: shown= total= (capped=1 cut). counts_floor=1: every count is a FLOOR, never a total. graph_ambiguous=/graph_unresolved=: resolver gauge. graph_unindexed=N: N files no grammar could read (the map header's unindexed=); their calls raise neither gauge. value-ref-excluded=N: internal functions kept off because a table, field or argument in another function or at file scope holds them (matched by name, not a proven call); a floor. root=: p= relative to it. evidence=: the rule every row met, internal linkage and no caller in the index; verify before deleting. register-macro-excluded=N: symbols skipped as self-registering test/bench macros (TEST, BENCHMARK...) or Rust #[test]; a floor. exported linkage=exported evidence=no-non-test-caller: PUBLIC free functions of the filtered files with no non-test caller in the graph, <e> rows after d/to; not dead, not in count=, code outside the tree may call them (zero means none found here); total= found, shown= printed (capped=1 rows cut), files= read of files_total= filtered files holding a non-internal free function with no non-test caller (first by path; total=0 can follow), unseen=N a floor on text files unread, unseen_by= the cap or failure behind each, extra=skipped verdicts fixed by indexed files so unindexed ones unread (counts, at= are floors). e n= t= p= l= v=unused no mention in any text file under the root outside its def (prose docs not read)|test-only only tests|file-only same-file words only|unknown why= names what may reach it: string (__all__, getattr, a registry key)|value|framework (decorator, hook)|import (re-export)|barrel|api|name|by-name|declined|built-name|dispatch|members|manifest|in-file|unimported|unseen; tests= text= str= imp= same= word counts, defs= overloads, at= sites to read. count=N: candidates meeting evidence= (a floor). --> -<dead-code schema="ripwire.dead-code/v1" count="1" evidence="internal-linkage+zero-callers" register-macro-excluded="0" value-ref-excluded="10" filter="src" root="." graph_ambiguous="3960" graph_unresolved="20090" graph_unindexed="313" counts_floor="1"> +<dead-code schema="ripwire.dead-code/v1" count="1" evidence="internal-linkage+zero-callers" register-macro-excluded="0" value-ref-excluded="10" filter="src" root="." graph_ambiguous="3984" graph_unresolved="20100" graph_unindexed="313" counts_floor="1"> <d n="unused_helper" t="fn" p="test/archmetricsfix/src/orphan/util.cpp" l="1"/> <exported linkage="exported" evidence="no-non-test-caller" total="9" shown="9" files="1" files_total="1" unseen="1" unseen_by="size=1,total=0,files=0,read=0,walk=0"> <e n="Unique" t="cls" p="src/infra/os_win32.cpp" l="85" v="unknown" defs="3" why="name,members,unseen" text="7" same="13" at="src/pincensus.h:57,src/pincensus.h:83"/> @@ -2967,8 +2955,8 @@ _The same run, the same clone, the folded rows printed back: each stale acknowle ``` $ ./build/ripwire . --quality-delta --show-stale -<!-- ripwire quality-delta schema=ripwire.quality-delta/v1: only what the change made WORSE vs baseline=: regressions= minor= gating=; <r kind= sym= p= was= now= gating= bar=>, <sa> acked. value-ref-excluded=N: internal functions kept off because a table, field or argument in another function or at file scope holds them (matched by name, not a proven call); a floor. at=: commit+dirty+shallow. stale=N: ack ledger rows whose target no longer applies (sa rows); never gating. preexisting-worse=N: regressions on symbols that existed at baseline; they gate when major. new-symbol=N: NEW code; new-symbol rows never gate, except defect-shape format-arity or a ceiling= row. register-macro-excluded=N: symbols skipped: self-registering test/bench macros or Rust #[test]; a floor. declined-call-excluded=N: symbols kept out of dead-code only because a declined call may mean them; a floor. api-new-surface=N: new PUBLIC symbols; a count, never gates, not in regressions=. renames=/rename_window_commits=: git rename pairs read over that many commits, to re-file baseline and acks. acked_by_rename=/acked_by_content=: acked= suppressions matched via git renames / an equal body hash. renames_window_truncated=1: history is deeper than the rename window, older renames unread. acked=N: findings suppressed by the ack ledger, listed as sa rows; never gating. sa key=/why=: the stale ack's ledger hash / target-gone (names nothing now) or finding-gone (no longer fires). --> -<quality-delta schema="ripwire.quality-delta/v1" baseline="git-HEAD" regressions="0" minor="0" acked="0" stale="196" preexisting-worse="0" new-symbol="0" gating="0" register-macro-excluded="63" api-new-surface="0" at="ed47f82e8+dirty" renames="68" rename_window_commits="400" acked_by_rename="0" acke … [line truncated: 99 more bytes on this line] +<!-- ripwire quality-delta schema=ripwire.quality-delta/v1: only what the change made WORSE vs baseline=: regressions= minor= gating=; <r kind= sym= p= was= now= gating= bar=>, <sa> acked. value-ref-excluded=N: internal functions kept off because a table, field or argument in another function or at file scope holds them (matched by name, not a proven call); a floor. at=: commit+dirty+shallow. stale=N: ack ledger rows whose target no longer applies (sa rows); never gating. preexisting-worse=N: regressions on symbols that existed at baseline; they gate when major. new-symbol=N: NEW code; new-symbol rows never gate, except defect-shape format-arity, ceiling=, tangle. register-macro-excluded=N: symbols skipped: self-registering test/bench macros or Rust #[test]; a floor. declined-call-excluded=N: symbols kept out of dead-code only because a declined call may mean them; a floor. api-new-surface=N: new PUBLIC symbols; a count, never gates, not in regressions=. renames=/rename_window_commits=: git rename pairs read over that many commits, to re-file baseline and acks. acked_by_rename=/acked_by_content=: acked= suppressions matched via git renames / an equal body hash. renames_window_truncated=1: history is deeper than the rename window, older renames unread. acked=N: findings suppressed by the ack ledger, listed as sa rows; never gating. sa key=/why=: the stale ack's ledger hash / target-gone (names nothing now) or finding-gone (no longer fires). --> +<quality-delta schema="ripwire.quality-delta/v1" baseline="git-HEAD" regressions="0" minor="0" acked="0" stale="203" preexisting-worse="0" new-symbol="0" gating="0" register-macro-excluded="63" api-new-surface="0" at="914c4045d+dirty" renames="68" rename_window_commits="400" acked_by_rename="0" acke … [line truncated: 99 more bytes on this line] <sa kind="api-surface" key="0123456789abcdef" why="target-gone"/> <sa kind="api-surface" key="085e3d408c2c4a35" why="target-gone"/> <sa kind="api-surface" key="155d74d341a49f3c" why="target-gone"/> @@ -2996,8 +2984,8 @@ _The regression-free answer on a clone whose ledger holds stale acknowledgements ``` $ ./build/ripwire . --quality-delta -<!-- ripwire quality-delta schema=ripwire.quality-delta/v1: only what the change made WORSE vs baseline=: regressions= minor= gating=; <r kind= sym= p= was= now= gating= bar=>, <sa> acked. value-ref-excluded=N: internal functions kept off because a table, field or argument in another function or at file scope holds them (matched by name, not a proven call); a floor. at=: commit+dirty+shallow. stale=N: ack ledger rows whose target no longer applies (sa rows); never gating. stale_by_kind=: stale= split by ack kind (kind:N,...); the sa rows are collapsed. stale_next=: the call printing the sa rows and the full header. preexisting-worse=N: regressions on symbols that existed at baseline; they gate when major. new-symbol=N: NEW code; new-symbol rows never gate, except defect-shape format-arity or a ceiling= row. register-macro-excluded=N: symbols skipped: self-registering test/bench macros or Rust #[test]; a floor. declined-call-excluded=N: symbols kept out of dead-code only because a declined call may mean them; a floor. api-new-surface=N: new PUBLIC symbols; a count, never gates, not in regressions=. renames=/rename_window_commits=: git rename pairs read over that many commits, to re-file baseline and acks. acked_by_rename=/acked_by_content=: acked= suppressions matched via git renames / an equal body hash. renames_window_truncated=1: history is deeper than the rename window, older renames unread. acked=N: findings suppressed by the ack ledger, listed as sa rows; never gating. --> -<quality-delta schema="ripwire.quality-delta/v1" baseline="git-HEAD" regressions="0" minor="0" acked="0" stale="196" preexisting-worse="0" new-symbol="0" gating="0" register-macro-excluded="63" api-new-surface="0" at="ed47f82e8+dirty" renames="68" rename_window_commits="400" acked_by_rename="0" acke … [line truncated: 298 more bytes on this line] +<!-- ripwire quality-delta schema=ripwire.quality-delta/v1: only what the change made WORSE vs baseline=: regressions= minor= gating=; <r kind= sym= p= was= now= gating= bar=>, <sa> acked. value-ref-excluded=N: internal functions kept off because a table, field or argument in another function or at file scope holds them (matched by name, not a proven call); a floor. at=: commit+dirty+shallow. stale=N: ack ledger rows whose target no longer applies (sa rows); never gating. stale_by_kind=: stale= split by ack kind (kind:N,...); the sa rows are collapsed. stale_next=: the call printing the sa rows and the full header. preexisting-worse=N: regressions on symbols that existed at baseline; they gate when major. new-symbol=N: NEW code; new-symbol rows never gate, except defect-shape format-arity, ceiling=, tangle. register-macro-excluded=N: symbols skipped: self-registering test/bench macros or Rust #[test]; a floor. declined-call-excluded=N: symbols kept out of dead-code only because a declined call may mean them; a floor. api-new-surface=N: new PUBLIC symbols; a count, never gates, not in regressions=. renames=/rename_window_commits=: git rename pairs read over that many commits, to re-file baseline and acks. acked_by_rename=/acked_by_content=: acked= suppressions matched via git renames / an equal body hash. renames_window_truncated=1: history is deeper than the rename window, older renames unread. acked=N: findings suppressed by the ack ledger, listed as sa rows; never gating. --> +<quality-delta schema="ripwire.quality-delta/v1" baseline="git-HEAD" regressions="0" minor="0" acked="0" stale="203" preexisting-worse="0" new-symbol="0" gating="0" register-macro-excluded="63" api-new-surface="0" at="914c4045d+dirty" renames="68" rename_window_commits="400" acked_by_rename="0" acke … [line truncated: 298 more bytes on this line] </quality-delta> ``` @@ -3021,8 +3009,8 @@ _The regression-free answer on a clone whose ledger holds stale acknowledgements ``` $ ./build/ripwire . --quality-delta -<!-- ripwire quality-delta schema=ripwire.quality-delta/v1: only what the change made WORSE vs baseline=: regressions= minor= gating=; <r kind= sym= p= was= now= gating= bar=>, <sa> acked. value-ref-excluded=N: internal functions kept off because a table, field or argument in another function or at file scope holds them (matched by name, not a proven call); a floor. at=: commit+dirty+shallow. stale=N: ack ledger rows whose target no longer applies (sa rows); never gating. stale_by_kind=: stale= split by ack kind (kind:N,...); the sa rows are collapsed. stale_next=: the call printing the sa rows and the full header. preexisting-worse=N: regressions on symbols that existed at baseline; they gate when major. new-symbol=N: NEW code; new-symbol rows never gate, except defect-shape format-arity or a ceiling= row. register-macro-excluded=N: symbols skipped: self-registering test/bench macros or Rust #[test]; a floor. declined-call-excluded=N: symbols kept out of dead-code only because a declined call may mean them; a floor. api-new-surface=N: new PUBLIC symbols; a count, never gates, not in regressions=. renames=/rename_window_commits=: git rename pairs read over that many commits, to re-file baseline and acks. acked_by_rename=/acked_by_content=: acked= suppressions matched via git renames / an equal body hash. renames_window_truncated=1: history is deeper than the rename window, older renames unread. acked=N: findings suppressed by the ack ledger, listed as sa rows; never gating. --> -<quality-delta schema="ripwire.quality-delta/v1" baseline="git-HEAD" regressions="0" minor="0" acked="0" stale="196" preexisting-worse="0" new-symbol="0" gating="0" register-macro-excluded="63" api-new-surface="0" at="ed47f82e8+dirty" renames="68" rename_window_commits="400" acked_by_rename="0" acke … [line truncated: 298 more bytes on this line] +<!-- ripwire quality-delta schema=ripwire.quality-delta/v1: only what the change made WORSE vs baseline=: regressions= minor= gating=; <r kind= sym= p= was= now= gating= bar=>, <sa> acked. value-ref-excluded=N: internal functions kept off because a table, field or argument in another function or at file scope holds them (matched by name, not a proven call); a floor. at=: commit+dirty+shallow. stale=N: ack ledger rows whose target no longer applies (sa rows); never gating. stale_by_kind=: stale= split by ack kind (kind:N,...); the sa rows are collapsed. stale_next=: the call printing the sa rows and the full header. preexisting-worse=N: regressions on symbols that existed at baseline; they gate when major. new-symbol=N: NEW code; new-symbol rows never gate, except defect-shape format-arity, ceiling=, tangle. register-macro-excluded=N: symbols skipped: self-registering test/bench macros or Rust #[test]; a floor. declined-call-excluded=N: symbols kept out of dead-code only because a declined call may mean them; a floor. api-new-surface=N: new PUBLIC symbols; a count, never gates, not in regressions=. renames=/rename_window_commits=: git rename pairs read over that many commits, to re-file baseline and acks. acked_by_rename=/acked_by_content=: acked= suppressions matched via git renames / an equal body hash. renames_window_truncated=1: history is deeper than the rename window, older renames unread. acked=N: findings suppressed by the ack ledger, listed as sa rows; never gating. --> +<quality-delta schema="ripwire.quality-delta/v1" baseline="git-HEAD" regressions="0" minor="0" acked="0" stale="203" preexisting-worse="0" new-symbol="0" gating="0" register-macro-excluded="63" api-new-surface="0" at="914c4045d+dirty" renames="68" rename_window_commits="400" acked_by_rename="0" acke … [line truncated: 298 more bytes on this line] </quality-delta> ``` @@ -3046,8 +3034,8 @@ _A ref range run for two of the thirteen kinds only: the named kinds' rows are e ``` $ ./build/ripwire . --quality-delta=HEAD~1..HEAD --quality-kinds=complexity,dead-code -<!-- ripwire quality-delta schema=ripwire.quality-delta/v1: only what the change made WORSE vs baseline=: regressions= minor= gating=; <r kind= sym= p= was= now= gating= bar=>, <sa> acked. value-ref-excluded=N: internal functions kept off because a table, field or argument in another function or at file scope holds them (matched by name, not a proven call); a floor. stale=N: ack ledger rows whose target no longer applies (sa rows); never gating. stale_by_kind=: stale= split by ack kind (kind:N,...); the sa rows are collapsed. stale_next=: the call printing the sa rows and the full header. preexisting-worse=N: regressions on symbols that existed at baseline; they gate when major. new-symbol=N: NEW code; new-symbol rows never gate, except defect-shape format-arity or a ceiling= row. register-macro-excluded=N: symbols skipped: self-registering test/bench macros or Rust #[test]; a floor. declined-call-excluded=N: symbols kept out of dead-code only because a declined call may mean them; a floor. api-new-surface=N: new PUBLIC symbols; a count, never gates, not in regressions=. renames=/rename_window_commits=: git rename pairs read over that many commits, to re-file baseline and acks. acked_by_rename=/acked_by_content=: acked= suppressions matched via git renames / an equal body hash. kinds_skipped=: kinds NOT run, so none of their rows is here and every count covers the rest; a count only they feed is absent. skipped_why=selector (the caller chose; stale acks judged for those kinds only) | memory (see ingest_scope=) | selector,memory (both). acked=N: findings suppressed by the ack ledger, listed as sa rows; never gating. base_ref=/target_ref=: the two resolved full shas a range compared (committed trees; at= omitted). churn=unavailable: range form; short-horizon-churn cannot be measured, so its silence is not no churn. --> -<quality-delta schema="ripwire.quality-delta/v1" baseline="ref-pair" regressions="0" minor="0" acked="0" stale="24" preexisting-worse="0" new-symbol="0" gating="0" register-macro-excluded="63" api-new-surface="0" base_ref="884327d7401e7d88b1d8f795f1d0570b37e724a0" target_ref="ed47f82e8e99f2e241aa3c5 … [line truncated: 449 more bytes on this line] +<!-- ripwire quality-delta schema=ripwire.quality-delta/v1: only what the change made WORSE vs baseline=: regressions= minor= gating=; <r kind= sym= p= was= now= gating= bar=>, <sa> acked. value-ref-excluded=N: internal functions kept off because a table, field or argument in another function or at file scope holds them (matched by name, not a proven call); a floor. stale=N: ack ledger rows whose target no longer applies (sa rows); never gating. stale_by_kind=: stale= split by ack kind (kind:N,...); the sa rows are collapsed. stale_next=: the call printing the sa rows and the full header. preexisting-worse=N: regressions on symbols that existed at baseline; they gate when major. new-symbol=N: NEW code; new-symbol rows never gate, except defect-shape format-arity, ceiling=, tangle. register-macro-excluded=N: symbols skipped: self-registering test/bench macros or Rust #[test]; a floor. declined-call-excluded=N: symbols kept out of dead-code only because a declined call may mean them; a floor. api-new-surface=N: new PUBLIC symbols; a count, never gates, not in regressions=. renames=/rename_window_commits=: git rename pairs read over that many commits, to re-file baseline and acks. acked_by_rename=/acked_by_content=: acked= suppressions matched via git renames / an equal body hash. kinds_skipped=: kinds NOT run, so none of their rows is here and every count covers the rest; a count only they feed is absent. skipped_why=selector (the caller chose; stale acks judged for those kinds only) | memory (see ingest_scope=) | selector,memory (both). acked=N: findings suppressed by the ack ledger, listed as sa rows; never gating. base_ref=/target_ref=: the two resolved full shas a range compared (committed trees; at= omitted). churn=unavailable: range form; short-horizon-churn cannot be measured, so its silence is not no churn. --> +<quality-delta schema="ripwire.quality-delta/v1" baseline="ref-pair" regressions="0" minor="0" acked="0" stale="26" preexisting-worse="0" new-symbol="0" gating="0" register-macro-excluded="63" api-new-surface="0" base_ref="b6ae53e9f828e641b9be583700a1a6501e18ca4f" target_ref="914c4045d08e71e6e6ad23e … [line truncated: 449 more bytes on this line] </quality-delta> ``` @@ -3070,7 +3058,7 @@ _The Delta Maintainability Model scalar for the WORKING TREE vs HEAD — recorde ``` $ ./build/ripwire . --dmm <!-- ripwire dmm schema=ripwire.dmm/v1: Delta Maintainability Model base=→target=: dmm= good/(good+bad) units by size_metric=; <p k= dmm= good= bad= d_low= d_high=>. at=: commit+dirty+shallow. available=0: no score at all (dmm=UNAVAILABLE, reason= says why); never read as 1.000 or 0.000. combine=pooled: root dmm= is summed good over summed good+bad of the 3 properties (ripwire's own). low_loc=/low_cx=/low_params=: a unit is LOW risk at or under these lines / cyclomatic / params. base_units=/base_volume=/target_units=/target_volume=: units with a body and their line span per side. reason=: why no score (no unit's size, complexity or params moved; a tree failed to parse ...). --> -<dmm schema="ripwire.dmm/v1" base="ed47f82e8e99f2e241aa3c58ee7d59ba0f002072" target="working-tree" at="ed47f82e8" available="0" combine="pooled" size_metric="physical-loc" low_loc="15" low_cx="5" low_params="2" dmm="UNAVAILABLE" good="0" bad="0" base_units="25060" base_volume="333295" target_units=" … [line truncated: 147 more bytes on this line] +<dmm schema="ripwire.dmm/v1" base="914c4045d08e71e6e6ad23e8a9a1a6b490679aee" target="working-tree" at="914c4045d" available="0" combine="pooled" size_metric="physical-loc" low_loc="15" low_cx="5" low_params="2" dmm="UNAVAILABLE" good="0" bad="0" base_units="25297" base_volume="333518" target_units=" … [line truncated: 147 more bytes on this line] <p k="size" dmm="UNAVAILABLE" good="0" bad="0" d_low="0" d_high="0"/> <p k="complexity" dmm="UNAVAILABLE" good="0" bad="0" d_low="0" d_high="0"/> <p k="interfacing" dmm="UNAVAILABLE" good="0" bad="0" d_low="0" d_high="0"/> @@ -3139,8 +3127,8 @@ _OWNERSHIP partition for a shared tree: every regression here lives in src/infra ``` $ ./build/ripwire . --quality-delta --scope=src/graph.h -<!-- ripwire quality-delta schema=ripwire.quality-delta/v1: only what the change made WORSE vs baseline=: regressions= minor= gating=; <r kind= sym= p= was= now= gating= bar=>, <sa> acked. value-ref-excluded=N: internal functions kept off because a table, field or argument in another function or at file scope holds them (matched by name, not a proven call); a floor. at=: commit+dirty+shallow. stale=N: ack ledger rows whose target no longer applies (sa rows); never gating. preexisting-worse=N: regressions on symbols that existed at baseline; they gate when major. new-symbol=N: NEW code; new-symbol rows never gate, except defect-shape format-arity or a ceiling= row. register-macro-excluded=N: symbols skipped: self-registering test/bench macros or Rust #[test]; a floor. declined-call-excluded=N: symbols kept out of dead-code only because a declined call may mean them; a floor. api-new-surface=N: new PUBLIC symbols; a count, never gates, not in regressions=. renames=/rename_window_commits=: git rename pairs read over that many commits, to re-file baseline and acks. acked_by_rename=/acked_by_content=: acked= suppressions matched via git renames / an equal body hash. renames_window_truncated=1: history is deeper than the rename window, older renames unread. r surface=: the api-surface tier, new-symbol or contract-change. acked=N: findings suppressed by the ack ledger, listed as sa rows; never gating. r sev=minor: a small numeric delta, counted in minor=, never gating (absent: major). r origin=new-symbol: a finding on NEW code; moved: its body left another name or file, never gating (absent: preexisting-worse). sa key=/why=: the stale ack's ledger hash / target-gone (names nothing now) or finding-gone (no longer fires). r members=/tokens=: a duplication row's clone group (member ids) / their shared normalized-token count. --> -<quality-delta schema="ripwire.quality-delta/v1" baseline="git-HEAD" regressions="0" minor="0" acked="0" stale="195" preexisting-worse="0" new-symbol="0" gating="0" register-macro-excluded="63" api-new-surface="2" at="ed47f82e8+dirty" renames="68" rename_window_commits="400" acked_by_rename="0" acke … [line truncated: 156 more bytes on this line] +<!-- ripwire quality-delta schema=ripwire.quality-delta/v1: only what the change made WORSE vs baseline=: regressions= minor= gating=; <r kind= sym= p= was= now= gating= bar=>, <sa> acked. value-ref-excluded=N: internal functions kept off because a table, field or argument in another function or at file scope holds them (matched by name, not a proven call); a floor. at=: commit+dirty+shallow. stale=N: ack ledger rows whose target no longer applies (sa rows); never gating. preexisting-worse=N: regressions on symbols that existed at baseline; they gate when major. new-symbol=N: NEW code; new-symbol rows never gate, except defect-shape format-arity, ceiling=, tangle. register-macro-excluded=N: symbols skipped: self-registering test/bench macros or Rust #[test]; a floor. declined-call-excluded=N: symbols kept out of dead-code only because a declined call may mean them; a floor. api-new-surface=N: new PUBLIC symbols; a count, never gates, not in regressions=. renames=/rename_window_commits=: git rename pairs read over that many commits, to re-file baseline and acks. acked_by_rename=/acked_by_content=: acked= suppressions matched via git renames / an equal body hash. renames_window_truncated=1: history is deeper than the rename window, older renames unread. r surface=: the api-surface tier, new-symbol or contract-change. acked=N: findings suppressed by the ack ledger, listed as sa rows; never gating. r sev=minor: a small numeric delta, counted in minor=, never gating (absent: major). r origin=new-symbol: a finding on NEW code; moved: its body left another name or file, never gating (absent: preexisting-worse). sa key=/why=: the stale ack's ledger hash / target-gone (names nothing now) or finding-gone (no longer fires). r members=/tokens=: a duplication row's clone group (member ids) / their shared normalized-token count. --> +<quality-delta schema="ripwire.quality-delta/v1" baseline="git-HEAD" regressions="0" minor="0" acked="0" stale="202" preexisting-worse="0" new-symbol="0" gating="0" register-macro-excluded="63" api-new-surface="2" at="914c4045d+dirty" renames="68" rename_window_commits="400" acked_by_rename="0" acke … [line truncated: 156 more bytes on this line] <out-of-scope n="9" would-gate="4" note="not yours - do not ack: these rows lie outside the scope this run named. They are disclosed rather than hidden, they never gate this exit code, and the ack refuses to write them."> <r kind="api-surface" sym="src/infra/sortutil.h::rw::sortutil::nonNegativeFloatDescKey" was="1" now="2" surface="contract-change" p="src/infra/sortutil.h:122"/> <r kind="complexity" sym="src/infra/sortutil.h::rw::sortutil::lessByScoreDescId" was="1" now="67" bar="15" p="src/infra/sortutil.h:62"/> @@ -3170,13 +3158,13 @@ _Fast per-symbol post-edit contract check vs git HEAD (unchanged on a clean tree ``` $ ./build/ripwire . --edit-check=rankGraphTeleport <!-- ripwire edit-check schema=ripwire.edit-check/v1: sym='s contract NOW vs HEAD: status=unchanged|new-symbol|contract-change; <c n= p= incompatible=1 sites_l=> callers. counts_floor=1: every count is a FLOOR, never a total. graph_ambiguous=/graph_unresolved=: resolver gauge. graph_unindexed=N: N files no grammar could read (the map header's unindexed=); their calls raise neither gauge. est_tokens=: price as emitted (an upper bound under compact). at=: commit+dirty+shallow. root=: p= relative to it. next=: the one pasteable follow-up. defs=N: overloads at this site (same file, scope, name) folded into one contract; params compared by MAX. callers=N: callers of sym= (the c rows' total; a floor). t=: sym='s kind (fn|cls|...). --> -<edit-check schema="ripwire.edit-check/v1" sym="rankGraphTeleport" t="fn" p="src/graph.h:14921" status="unchanged" defs="1" callers="7" incompatible="0" at="ed47f82e8" graph_ambiguous="3960" graph_unresolved="20090" graph_unindexed="313" counts_floor="1" root="." next="--test-gate=src/graph.h" est_t … [line truncated: 12 more bytes on this line] +<edit-check schema="ripwire.edit-check/v1" sym="rankGraphTeleport" t="fn" p="src/graph.h:14921" status="unchanged" defs="1" callers="7" incompatible="0" at="914c4045d" graph_ambiguous="3984" graph_unresolved="20100" graph_unindexed="313" counts_floor="1" root="." next="--test-gate=src/graph.h" est_t … [line truncated: 12 more bytes on this line] <c n="runEval" p="src/eval.h:171"/> <c n="rankGraph" p="src/graph.h:14964"/> <c n="anchoredLexicalRank" p="src/graph.h:15633"/> -<c n="churnDecayRanking" p="src/main.cpp:1432"/> -<c n="churnRankedGraph" p="src/main.cpp:1471"/> -<c n="runDefaultMap" p="src/main.cpp:1758"/> +<c n="churnDecayRanking" p="src/main.cpp:1433"/> +<c n="churnRankedGraph" p="src/main.cpp:1472"/> +<c n="runDefaultMap" p="src/main.cpp:1759"/> <c n="getIndex" p="src/mcpindex.h:1224"/> </edit-check> ``` @@ -3224,7 +3212,7 @@ $ ./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:118","l":[127]}, {"n":"radixSortByScoreDescId","p":"src/infra/sortutil.h:133","l":[193]}], -"graph_ambiguous":3960,"graph_unresolved":20090,"graph_unindexed":313,"counts_floor":true},"tests_to_run":[{"p":"test/verify_radix.cpp","hops":1,"run":"bash test/greptiercheck.sh"}, +"graph_ambiguous":3984,"graph_unresolved":20100,"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/connectcore_harness.cpp","hops":2,"run":"bash test/connectcorecheck.sh"}, {"p":"test/forrowfeatures_unit.cpp","hops":2,"run":"bash test/forrowfeaturescheck.sh"}, @@ -3250,7 +3238,7 @@ _Insert immediately AFTER one uniquely-resolved definition; replaced_bytes=0 bec ``` $ ./build/ripwire . --insert-after-symbol=lessByScoreDescId --edit-payload=<scratch>/aux/payload_note.h {"applied":"insert_after_symbol","symbol":"lessByScoreDescId","file":"src/infra/sortutil.h","span":{"start":3136,"end":3224},"lines":{"start":69,"end":71},"replaced_bytes":0,"old_file_bytes":9174,"new_file_bytes":9262,"file_eol":"lf","eol_normalized":false,"trailing_newline_folded":true,"separator_p … [line truncated: 650 more bytes on this line] -"graph_ambiguous":3960,"graph_unresolved":20090,"graph_unindexed":313,"counts_floor":true},"tests_to_run":[{"p":"test/verify_radix.cpp","hops":1,"run":"bash test/greptiercheck.sh"}, +"graph_ambiguous":3984,"graph_unresolved":20100,"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/connectcore_harness.cpp","hops":2,"run":"bash test/connectcorecheck.sh"}, {"p":"test/forrowfeatures_unit.cpp","hops":2,"run":"bash test/forrowfeaturescheck.sh"}, @@ -3308,7 +3296,7 @@ $ ./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:118","l":[127]}, {"n":"radixSortByScoreDescId","p":"src/infra/sortutil.h:133","l":[193]}], -"graph_ambiguous":3960,"graph_unresolved":20090,"graph_unindexed":313,"counts_floor":true},"tests_to_run":[{"p":"test/verify_radix.cpp","hops":1,"run":"bash test/greptiercheck.sh"}, +"graph_ambiguous":3984,"graph_unresolved":20100,"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/connectcore_harness.cpp","hops":2,"run":"bash test/connectcorecheck.sh"}, {"p":"test/forrowfeatures_unit.cpp","hops":2,"run":"bash test/forrowfeaturescheck.sh"}, @@ -3377,11 +3365,11 @@ _The same plan committed: per-file locks, re-verify-before-write, atomic rename, ``` $ ./build/ripwire . --edit-plan=<scratch>/aux/edit_plan.json --apply -{"schema":"ripwire.edit-plan/v1","mode":"apply","edits":1,"files":1,"callers_union":4,"graph_ambiguous":3960,"graph_unresolved":20090,"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":3984,"graph_unresolved":20100,"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: 585 more bytes on this line] {"n":"benchAdaptive","p":"bench/bench_radix_ab.cpp:157","l":[162]}, {"n":"radixSortNonNegativeFloatsDesc","p":"src/infra/sortutil.h:120","l":[129]}, {"n":"radixSortByScoreDescId","p":"src/infra/sortutil.h:135","l":[195]}], -"graph_ambiguous":3960,"graph_unresolved":20090,"graph_unindexed":313,"counts_floor":true}}]} +"graph_ambiguous":3984,"graph_unresolved":20100,"graph_unindexed":313,"counts_floor":true},"memory_ceiling":"suspended for this check (the write is committed, so a refusal here could not be reported and a retry could insert twice); the 10649 MiB limit was not reached"}]} ``` **Shaped by:** `--edit-check` @@ -3427,7 +3415,7 @@ _Bare --slice=SYM: the INVENTORY of sliceable locals (<v n= l= t=/>), so a calle ``` $ ./build/ripwire . --slice=rankGraphTeleport <!-- ripwire slice schema=ripwire.slice/v1: name-based def-use rows of one variable in one definition: <s l= k=def|use|both|scope t= [b= pp= rd=]> (rd= reaching-def lines per reach=cfg|linear), <v n= l= t=> inventory; steps=/depth= flow. at=: commit+dirty+shallow. root=: p= relative to it. sym=/lang=: the sliced definition's name and language; p= is its file:line. vars=N: sliceable local bindings in the definition, one v row each; name one to slice it. counts=as-classified: defs=/uses=/vars=/steps= count what the name classifier rowed; neither floors nor totals. --> -<slice sym="rankGraphTeleport" p="src/graph.h:14921" t="fn" lang="cpp" schema="ripwire.slice/v1" vars="14" at="ed47f82e8" root="." counts="as-classified"> +<slice sym="rankGraphTeleport" p="src/graph.h:14921" t="fn" lang="cpp" schema="ripwire.slice/v1" vars="14" at="914c4045d" root="." counts="as-classified"> <v n="alpha" l="14921" t="param"/> <v n="g" l="14921" t="param"/> <v n="p" l="14921" t="param"/> @@ -3464,7 +3452,7 @@ _Forward flow: which statements the seed's value reaches, at the default depth b ``` $ ./build/ripwire . --slice=rankGraphTeleport:teleport --slice-flow=fwd <!-- ripwire slice schema=ripwire.slice/v1: name-based def-use rows of one variable in one definition: <s l= k=def|use|both|scope t= [b= pp= rd=]> (rd= reaching-def lines per reach=cfg|linear), <v n= l= t=> inventory; steps=/depth= flow. at=: commit+dirty+shallow. root=: p= relative to it. sym=/lang=: the sliced definition's name and language; p= is its file:line. order=defuse: seed s rows (no v=) ranked among these rows by def-use coverage (distinct local names on the line) desc, then line; not source order, not a whole-function ranking (measured at chance — docs/EVALS.md) — flow s rows (v=) keep their (d=,l=,v=) order. counts=as-classified: defs=/uses=/vars=/steps= count what the name classifier rowed; neither floors nor totals. --> -<slice sym="rankGraphTeleport" p="src/graph.h:14921" t="fn" lang="cpp" schema="ripwire.slice/v1" var="teleport" defs="1" uses="3" reach="cfg" flow="fwd" depth="8" steps="7" order="defuse" at="ed47f82e8" root="." counts="as-classified"> +<slice sym="rankGraphTeleport" p="src/graph.h:14921" t="fn" lang="cpp" schema="ripwire.slice/v1" var="teleport" defs="1" uses="3" reach="cfg" flow="fwd" depth="8" steps="7" order="defuse" at="914c4045d" root="." counts="as-classified"> <s l="14944" k="use" t="call-arg" rd="14926"> <![CDATA[run = pageRankDouble( g.inEdges, g.wOutDeg, teleport, rankDouble, PageRankConfig{ .alpha = double( alpha ) } );]]> </s> @@ -3545,7 +3533,7 @@ _No-LLM review-evidence bundle for the working-tree diff (clean tree = empty)._ ``` $ ./build/ripwire . --pr-context <!-- ripwire pr-context schema=ripwire.pr-context/v1: review bundle per changed file vs base=: symbols, callers, blast radius, tests, owners. counts_floor=1: every count is a FLOOR, never a total. graph_ambiguous=/graph_unresolved=: resolver gauge. graph_unindexed=N: N files no grammar could read (the map header's unindexed=); their calls raise neither gauge. 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). 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). files=N: changed files in the diff (shown= of them listed). --> -<pr-context schema="ripwire.pr-context/v1" base="working-tree" root="." direction="worktree-since-head" files="0" skipped_mode_only="0" budget_tokens="8000" est_tokens="584" trim_level="0" truncated="none" budget_default="1" at="ed47f82e8" graph_ambiguous="3960" graph_unresolved="20090" graph_uninde … [line truncated: 27 more bytes on this line] +<pr-context schema="ripwire.pr-context/v1" base="working-tree" root="." direction="worktree-since-head" files="0" skipped_mode_only="0" budget_tokens="8000" est_tokens="584" trim_level="0" truncated="none" budget_default="1" at="914c4045d" graph_ambiguous="3984" graph_unresolved="20100" graph_uninde … [line truncated: 27 more bytes on this line] <!-- no changed files in the index (clean tree, or the diff touched only non-indexed files) --> </pr-context> ``` @@ -3571,11 +3559,11 @@ _Pairwise cross-arm conflict sites + suggested landing order (any committish sha ``` $ ./build/ripwire . --merge-scout=HEAD~2,HEAD~1 <!-- ripwire merge-scout schema=ripwire.merge-scout/v1: cross-branch overlap of arms= refs: <arm ref= base= changed= head_conflicts=>, <pair a= b= conflicts= risks=>, <landing order=>. at=: commit+dirty+shallow. head=: the HEAD commit, bare 9-hex sha (at= adds +dirty). ok=1 on an arm row means the comparison RAN, so changed=/head_conflicts= are real and may legitimately be 0 (an empty but materialized tree is a real index); ok=0 means it did not run at all. no-work note=: arm compared and has no divergent work vs its merge base, so no landing slot. --> -<merge-scout schema="ripwire.merge-scout/v1" arms="2" head="ed47f82e8" at="ed47f82e8"> -<arm ref="HEAD~2" base="6e23f5805" ok="1" changed="0" head_conflicts="0"> +<merge-scout schema="ripwire.merge-scout/v1" arms="2" head="914c4045d" at="914c4045d"> +<arm ref="HEAD~2" base="739151ce9" ok="1" changed="0" head_conflicts="0"> <no-work note="no divergent work vs merge-base — see --stray-content"/> </arm> -<arm ref="HEAD~1" base="884327d74" ok="1" changed="0" head_conflicts="0"> +<arm ref="HEAD~1" base="b6ae53e9f" ok="1" changed="0" head_conflicts="0"> <no-work note="no divergent work vs merge-base — see --stray-content"/> </arm> <pair a="HEAD~2" b="HEAD~1" conflicts="0" risks="0"/> @@ -3650,7 +3638,7 @@ _A second selection, the `fix/` ref family, picked at capture time from the refs ``` $ ./build/ripwire . --stray-content=fix/ <!-- ripwire stray-content schema=ripwire.stray-content/v1: per local ref, lines/symbols NOT in HEAD: <ref ok= v= base= stray=>; 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. unknown=N: refs that could not be analysed (v=unknown, e.g. no merge base); never counted merged. --> -<stray-content schema="ripwire.stray-content/v1" head="ed47f82e8" head_ref="integration/train-1118a-r" refs="1" blobs="0" unmerged="0" superseded="0" merged="1" unknown="0" filter="fix/" at="ed47f82e8"> +<stray-content schema="ripwire.stray-content/v1" head="914c4045d" head_ref="integration/train-ge3" refs="1" blobs="0" unmerged="0" superseded="0" merged="1" unknown="0" filter="fix/" at="914c4045d"> </stray-content> ``` @@ -3675,19 +3663,19 @@ _Select the genuinely-unmerged refs of the `lane/` ref family and feed them to m ``` $ ./build/ripwire . --stray-content=lane/ --plan <!-- ripwire landing-plan schema=ripwire.landing-plan/v1: stranded-work landing order across refs, fewest conflicts first. at=: commit+dirty+shallow. --> -<landing-plan schema="ripwire.landing-plan/v1" head="ed47f82e8" refs="490" unmerged="59" superseded="25" merged="406" undetermined="0" scouted="1" bounded="58" scout-ok="1" at="ed47f82e8"> +<landing-plan schema="ripwire.landing-plan/v1" head="914c4045d" refs="499" unmerged="61" superseded="29" merged="409" undetermined="0" scouted="1" bounded="60" scout-ok="1" at="914c4045d"> <ref name="lane/arise-result" v="unmerged" stray="16331" files="18" scouted="1"/> <ref name="lane/margin-rescore" v="unmerged" stray="13921" files="13" scouted="0"/> -<ref name="lane/recv-xfile" v="unmerged" stray="9252" files="34" scouted="0"/> -<ref name="lane/py-local-bind" v="unmerged" stray="7075" files="8" scouted="0"/> +<ref name="lane/recv-xfile" v="unmerged" stray="9251" files="34" scouted="0"/> +<ref name="lane/py-local-bind" v="unmerged" stray="7081" files="8" scouted="0"/> <ref name="lane/served-syms-result" v="unmerged" stray="6346" files="9" scouted="0"/> <ref name="lane/orient-narrow-v3" v="unmerged" stray="3273" files="46" scouted="0"/> <ref name="lane/for-howitworks-067" v="unmerged" stray="3247" files="39" scouted="0"/> <ref name="lane/m1-lookback-harness" v="unmerged" stray="3164" files="14" scouted="0"/> <ref name="lane/orient-map-067" v="unmerged" stray="2475" files="40" scouted="0"/> <ref name="lane/parse-budget-det" v="unmerged" stray="2396" files="64" scouted="0"/> -<ref name="lane/xs-1119-d2-pin" v="unmerged" stray="2293" files="31" scouted="0"/> -<ref name="lane/import-proved-splits" v="unmerged" stray="2275" files="30" scouted="0"/> +<ref name="lane/xs-1119-d2-pin" v="unmerged" stray="2298" files="31" scouted="0"/> +<ref name="lane/qual-ns-call-bind" v="unmerged" stray="2288" files="30" scouted="0"/> ... [17 more line(s); run it to see the whole thing] ``` @@ -3711,8 +3699,8 @@ _Cross-branch ABI-break gate over the `lane/` ref family: struct byte-contract d ``` $ ./build/ripwire . --stray-content=lane/ --abi <!-- ripwire abi schema=ripwire.abi/v1: cross-branch ABI-break gate: each local branch's structs on paths it authored (its diff from its merge base with HEAD), laid out lexically, compared with HEAD's; a match is omitted; exit 2 on a drift. head_ref= HEAD's branch, refs= branches read, candidates= structs HEAD declares and locates, compared= sites modelled on both sides, blobs= git blobs read; dropped= listed rows past the 12-per-ref cap; head_only= sites on paths only HEAD changed (out of scope); unmodelable= sites skipped: HEAD's copy has no model; unrelated= refs with no merge base, never compared, also in quiet=; broken_refs= refs with a drift; quiet= refs with no row (none differed or none compared); excluded_refs= refs with unlisted kinds only. window: shown= capped= (capped=1 cut). at=: commit+dirty+shallow. root=: p= relative to it. ref name= tip= date=: a branch with rows, its tip commit and date; shown=/capped=/head_only= and kind counts are its own. struct n= p= l= kind= head_size=: a struct, its file and line at HEAD, sizeof there. kind=drift: the byte contract differs (the kind that exits 2); unknown: the ref's copy could not be modelled, never read as same; absent: the ref does not define it at that path. drift= unknown= absent= count them on abi and ref; each row is on one kind count (absent at 0): their sum is the row total. ref_size= size_delta=: sizeof on the ref and its distance from head_size=, only where the ref's copy was sized; size_delta=0 is the same size, not the same layout. d n= a= b=: a differing field as type@offset at HEAD (a=) and on the ref (b=), or absent. ref_caveat k= d=: why the ref's copy is unmodelled: kind, detail. head_caveat k= d=: a limit of HEAD's own model of the struct: kind, detail. head-moved=N: the ref's copy equals its merge base's, so HEAD changed; counted, listed under detail=1. --> -<abi schema="ripwire.abi/v1" head_ref="integration/train-1118a-r" refs="490" candidates="3034" compared="11818" blobs="868" shown="46" capped="0" dropped="0" head_only="1088114" unmodelable="4118" unrelated="0" broken_refs="19" quiet="414" excluded_refs="50" at="ed47f82e8" drift="32" unknown="11" ab … [line truncated: 36 more bytes on this line] -<ref name="lane/for-tonly" tip="07f6c870d" date="2026-10-29" shown="4" capped="0" head_only="2254" drift="4" head-moved="38"> +<abi schema="ripwire.abi/v1" head_ref="integration/train-ge3" refs="499" candidates="3078" compared="12715" blobs="896" shown="68" capped="0" dropped="0" head_only="1113101" unmodelable="4371" unrelated="0" broken_refs="26" quiet="415" excluded_refs="49" at="914c4045d" drift="52" unknown="13" absent … [line truncated: 32 more bytes on this line] +<ref name="lane/for-tonly" tip="07f6c870d" date="2026-10-29" shown="4" capped="0" head_only="2275" drift="4" head-moved="60"> <struct n="ForLensJsonInputs" p="src/verbs_for.h" l="464" kind="drift" head_size="232" ref_size="216" size_delta="16"> <d n="graph" a="const rw::Graph*@208" b="absent"/> <d n="signaturesOnly" a="bool@216" b="absent"/> @@ -3721,7 +3709,7 @@ $ ./build/ripwire . --stray-content=lane/ --abi <head_caveat k="reference-member" d="ing: a reference member's storage is unspecified"/> <ref_caveat k="reference-member" d="ing: a reference member's storage is unspecified"/> </struct> -<struct n="SigRowSpelling" p="src/serialize.h" l="6170" kind="drift" head_size="2" ref_size="16" size_delta="14"> +<struct n="SigRowSpelling" p="src/serialize.h" l="6489" kind="drift" head_size="2" ref_size="16" size_delta="14"> <d n="foldRepeatedText" a="bool@1" b="absent"/> <d n="testOnlyCallers" a="absent" b="const std::vector<std::uint8_t>*@8"/> ... [17 more line(s); run it to see the whole thing] @@ -3745,15 +3733,14 @@ _Which ref's tree defines or mentions SYM — HEAD first, then every local branc ``` $ ./build/ripwire . --whereis=rankGraphTeleport -<!-- ripwire whereis schema=ripwire.whereis/v1: every LOCAL ref whose tree holds sym= (refs_scanned=, blobs=), HEAD first: <hit ref= tip= date= p= l= kind= t=>. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). at=: commit+dirty+shallow. next=: the one pasteable follow-up. refs_omitted=K: past the ref window (512 refs; whereis: 2097152 tree entries) the newest refs by committer date were read; K older local branches were not, in no count or row (a ref-name SUBSTR filter picks which; detail=1 reads all). hits=N: occurrences in HEAD plus every scanned local ref's full tree (the total rows). on-head=1|0: whether HEAD's tree holds it; 0 beside hits = it lives only on a branch. head_labels=index: HEAD kind= from the parsed index; lexical: text heuristic. ref_labels=parsed: another ref's kind= from the index's own tags parse of its blob (one per blob and path; HEAD's own blob takes HEAD's labels); a blob with no line a loose lexical test calls worth parsing is not parsed and its rows read ref; kind=text: such a line no parse read, never a def. unparsed blobs=N: other refs' blobs holding a line worth parsing that no parse read (past the runaway guard, or the parser could not finish); those lines read kind=text; next= lifts the guard. unparsed rows=N: the kind=text rows those blobs gave. hit t_bytes=N: t= previews an N-byte line (over 300 B): 200 B at most, its first bytes cut on a UTF-8 boundary plus an ellipsis. t_cut rows=N: rows of this page whose t= is a preview (each carries t_bytes=); next= replays this page (same listing, window, rows) with every line whole. more hits=N: rows after this page; page on with offset=next_offset. head_date=: a hit without tip= date= has tip= at=, date= this. --> -<whereis schema="ripwire.whereis/v1" sym="rankGraphTeleport" on-head="1" refs_scanned="374" blobs="10148" hits="2650371" head_labels="index" refs_omitted="268" shown="60" capped="1" total="2650371" has_more="1" next_offset="60" offset="0" limit="0" ref_labels="parsed" head_date="2026-11-21" at="ed47 … [line truncated: 7 more bytes on this line] -<unparsed blobs="409" rows="1939" next="--whereis=rankGraphTeleport --detail=1"/> -<t_cut rows="4" next="--whereis=rankGraphTeleport --whereis-listing=all --whereis-full-text"/> +<!-- ripwire whereis schema=ripwire.whereis/v1: every LOCAL ref whose tree holds sym= (refs_scanned=, blobs=), HEAD first: <hit ref= tip= date= p= l= kind= t=>. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). at=: commit+dirty+shallow. next=: the one pasteable follow-up. refs_omitted=K: past the ref window (512 refs; whereis: 2097152 tree entries) the newest refs by committer date were read; K older local branches were not, in no count or row (a ref-name SUBSTR filter picks which; detail=1 reads all). hits=N: occurrences in HEAD plus every scanned local ref's full tree (the total rows). on-head=1|0: whether HEAD's tree holds it; 0 beside hits = it lives only on a branch. head_labels=index: HEAD kind= from the parsed index; lexical: text heuristic. ref_labels=parsed: another ref's kind= from the index's own tags parse of its blob (one per blob and path; HEAD's own blob takes HEAD's labels); a blob with no line a loose lexical test calls worth parsing is not parsed and its rows read ref; kind=text: such a line no parse read, never a def. unparsed blobs=N: other refs' blobs holding a line worth parsing that no parse read (past the runaway guard, or the parser could not finish); those lines read kind=text; next= lifts the guard. unparsed rows=N: the kind=text rows those blobs gave. hit refs=N: N scanned refs hold this same definition (or kind=text) line (path + text); printed once for the first by name, whose ref= tip= date= l= it carries; defs page only, absent = one ref; hits= counts every copy, listing=all prints each. folded=N: def (or text) rows of other refs a listed row's refs= stands for; shown + more + folded + refs count = hits on the first page. more hits=N: rows after this page; page on with offset=next_offset. listing=defs|refs: only those kind= rows listed (defs: def and text); under defs <refs count=N next=> counts the kind=ref rows and next= lists them; the window counts listed rows; default: defs if it lists more defs than all, else if shorter; a def the parser does not model (define_method, setattr, assignment) is a counted ref. head_date=: a hit without tip= date= has tip= at=, date= this. --> +<whereis schema="ripwire.whereis/v1" sym="rankGraphTeleport" on-head="1" refs_scanned="373" blobs="10151" hits="2701870" head_labels="index" refs_omitted="282" shown="60" capped="1" total="146" has_more="1" next_offset="60" offset="0" limit="0" listing="defs" folded="1786" ref_labels="parsed" head_d … [line truncated: 32 more bytes on this line] +<unparsed blobs="404" rows="1923" next="--whereis=rankGraphTeleport --detail=1"/> <hit ref="HEAD" p="src/graph.h" l="14921" kind="def" t="inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>& p, float alpha = 0.85f )"/> -<hit ref="HEAD" p="present/deck5_ripwire_build.js" l="1269" kind="ref" t="s.addText("$ ripwire . --callers=rankGraphTeleport", { x: 8.68, y: 2.1, w: 3.8, h: 0.3, fontFace: MONO, fontSize: 10, color: MUTED, margin: 0 });"/> -<hit ref="HEAD" p="present/deck5_ripwire_build.js" l="1271" kind="ref" t="{ text: "<callers of=\"rankGraphTeleport\"\n defs=\"1\" count=\"7\" ", options: { color: TEXT } },"/> -<hit ref="HEAD" p="present/deck5_ripwire_build.js" l="1285" kind="ref" t_bytes="478" t=""- The --callers example: `ripwire . --callers=rankGraphTeleport` answered defs=\"1\" count=\"6\" counts_floor=\"1\", with runEval and rankGraph as its first two rows, on main 4 … [line truncated: 26 more bytes on this line] -... [23 more line(s); run it to see the whole thing] +<hit ref="community/pr433" tip="fafb3f267" date="2026-10-29" p="src/graph.h" l="11991" kind="text" refs="365" t="inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>& p, float alpha = 0.85f )"/> +<hit ref="community/pr433" tip="fafb3f267" date="2026-10-29" p="docs/EVALS.md" l="14331" kind="text" refs="315" t="- **(i) Static.** A's diff leaves `priorwt::weight`, graph.h:4378, `biasPrior`, `rankGraphTeleport`, `rankGraph` and `diffTeleport` byte-unchanged. `rankDefaultMap`'s call sit … [line truncated: 26 more bytes on this line] +<hit ref="community/pr433" tip="fafb3f267" date="2026-10-29" p="docs/EVALS.md" l="14449" kind="text" refs="315" t="- Gate S (i): `priorwt::weight`, the `priorWeight` assignment, `biasPrior`, `rankGraphTeleport`, `rankGraph`, `diffTeleport`"/> +... [24 more line(s); run it to see the whole thing] ``` **Shaped by:** `--no-redact`, `--whereis-full-text`, `--whereis-listing`, `--with-history`, `--legend`, `--limit` @@ -3777,8 +3764,8 @@ _The same page with every t= line whole: the page above previews each line over ``` $ ./build/ripwire . --whereis=rankGraphTeleport --whereis-listing=all --whereis-full-text <!-- ripwire whereis schema=ripwire.whereis/v1: every LOCAL ref whose tree holds sym= (refs_scanned=, blobs=), HEAD first: <hit ref= tip= date= p= l= kind= t=>. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). at=: commit+dirty+shallow. next=: the one pasteable follow-up. refs_omitted=K: past the ref window (512 refs; whereis: 2097152 tree entries) the newest refs by committer date were read; K older local branches were not, in no count or row (a ref-name SUBSTR filter picks which; detail=1 reads all). hits=N: occurrences in HEAD plus every scanned local ref's full tree (the total rows). on-head=1|0: whether HEAD's tree holds it; 0 beside hits = it lives only on a branch. head_labels=index: HEAD kind= from the parsed index; lexical: text heuristic. ref_labels=parsed: another ref's kind= from the index's own tags parse of its blob (one per blob and path; HEAD's own blob takes HEAD's labels); a blob with no line a loose lexical test calls worth parsing is not parsed and its rows read ref; kind=text: such a line no parse read, never a def. unparsed blobs=N: other refs' blobs holding a line worth parsing that no parse read (past the runaway guard, or the parser could not finish); those lines read kind=text; next= lifts the guard. unparsed rows=N: the kind=text rows those blobs gave. more hits=N: rows after this page; page on with offset=next_offset. head_date=: a hit without tip= date= has tip= at=, date= this. --> -<whereis schema="ripwire.whereis/v1" sym="rankGraphTeleport" on-head="1" refs_scanned="374" blobs="10148" hits="2650371" head_labels="index" refs_omitted="268" shown="60" capped="1" total="2650371" has_more="1" next_offset="60" offset="0" limit="0" ref_labels="parsed" head_date="2026-11-21" at="ed47 … [line truncated: 7 more bytes on this line] -<unparsed blobs="409" rows="1939" next="--whereis=rankGraphTeleport --whereis-listing=all --detail=1"/> +<whereis schema="ripwire.whereis/v1" sym="rankGraphTeleport" on-head="1" refs_scanned="373" blobs="10151" hits="2701870" head_labels="index" refs_omitted="282" shown="60" capped="1" total="2701870" has_more="1" next_offset="60" offset="0" limit="0" ref_labels="parsed" head_date="2026-11-22" at="914c … [line truncated: 7 more bytes on this line] +<unparsed blobs="404" rows="1923" next="--whereis=rankGraphTeleport --whereis-listing=all --detail=1"/> <hit ref="HEAD" p="src/graph.h" l="14921" kind="def" t="inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>& p, float alpha = 0.85f )"/> <hit ref="HEAD" p="present/deck5_ripwire_build.js" l="1269" kind="ref" t="s.addText("$ ripwire . --callers=rankGraphTeleport", { x: 8.68, y: 2.1, w: 3.8, h: 0.3, fontFace: MONO, fontSize: 10, color: MUTED, margin: 0 });"/> <hit ref="HEAD" p="present/deck5_ripwire_build.js" l="1271" kind="ref" t="{ text: "<callers of=\"rankGraphTeleport\"\n defs=\"1\" count=\"7\" ", options: { color: TEXT } },"/> @@ -3806,8 +3793,8 @@ _The whole hit list asked for by name: under the same 60-row cap HEAD's referenc ``` $ ./build/ripwire . --whereis=rankGraphTeleport --whereis-listing=all <!-- ripwire whereis schema=ripwire.whereis/v1: every LOCAL ref whose tree holds sym= (refs_scanned=, blobs=), HEAD first: <hit ref= tip= date= p= l= kind= t=>. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). at=: commit+dirty+shallow. next=: the one pasteable follow-up. refs_omitted=K: past the ref window (512 refs; whereis: 2097152 tree entries) the newest refs by committer date were read; K older local branches were not, in no count or row (a ref-name SUBSTR filter picks which; detail=1 reads all). hits=N: occurrences in HEAD plus every scanned local ref's full tree (the total rows). on-head=1|0: whether HEAD's tree holds it; 0 beside hits = it lives only on a branch. head_labels=index: HEAD kind= from the parsed index; lexical: text heuristic. ref_labels=parsed: another ref's kind= from the index's own tags parse of its blob (one per blob and path; HEAD's own blob takes HEAD's labels); a blob with no line a loose lexical test calls worth parsing is not parsed and its rows read ref; kind=text: such a line no parse read, never a def. unparsed blobs=N: other refs' blobs holding a line worth parsing that no parse read (past the runaway guard, or the parser could not finish); those lines read kind=text; next= lifts the guard. unparsed rows=N: the kind=text rows those blobs gave. hit t_bytes=N: t= previews an N-byte line (over 300 B): 200 B at most, its first bytes cut on a UTF-8 boundary plus an ellipsis. t_cut rows=N: rows of this page whose t= is a preview (each carries t_bytes=); next= replays this page (same listing, window, rows) with every line whole. more hits=N: rows after this page; page on with offset=next_offset. head_date=: a hit without tip= date= has tip= at=, date= this. --> -<whereis schema="ripwire.whereis/v1" sym="rankGraphTeleport" on-head="1" refs_scanned="374" blobs="10148" hits="2650371" head_labels="index" refs_omitted="268" shown="60" capped="1" total="2650371" has_more="1" next_offset="60" offset="0" limit="0" ref_labels="parsed" head_date="2026-11-21" at="ed47 … [line truncated: 7 more bytes on this line] -<unparsed blobs="409" rows="1939" next="--whereis=rankGraphTeleport --whereis-listing=all --detail=1"/> +<whereis schema="ripwire.whereis/v1" sym="rankGraphTeleport" on-head="1" refs_scanned="373" blobs="10151" hits="2701870" head_labels="index" refs_omitted="282" shown="60" capped="1" total="2701870" has_more="1" next_offset="60" offset="0" limit="0" ref_labels="parsed" head_date="2026-11-22" at="914c … [line truncated: 7 more bytes on this line] +<unparsed blobs="404" rows="1923" next="--whereis=rankGraphTeleport --whereis-listing=all --detail=1"/> <t_cut rows="4" next="--whereis=rankGraphTeleport --whereis-listing=all --whereis-full-text"/> <hit ref="HEAD" p="src/graph.h" l="14921" kind="def" t="inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>& p, float alpha = 0.85f )"/> <hit ref="HEAD" p="present/deck5_ripwire_build.js" l="1269" kind="ref" t="s.addText("$ ripwire . --callers=rankGraphTeleport", { x: 8.68, y: 2.1, w: 3.8, h: 0.3, fontFace: MONO, fontSize: 10, color: MUTED, margin: 0 });"/> @@ -3839,7 +3826,7 @@ $ ./build/ripwire . --flags <!-- ripwire flags schema=ripwire.flags/v1: BUILT but DARK: <gate name= kind=compile|cmake|env default= dark= regions=/loc=(#if only) reads= p= l=> with <read p= l=> sites. writes_capped=/reads_capped=: 1 = cut. next=: the one pasteable follow-up. gates=/dark_gates=: gate rows (never cut) / those whose default keeps the guarded code out of the build. compile=/cmake=/env=: gates by kind: ifndef/define header gate, CMake option(), getenv read. files=N: files this verb scanned for gates (source + CMakeLists), wider than the map's corpus. --> <!-- BASH: a parameter expansion in a .sh/.bash/.zsh file is an env read (kind="env") unless the same file assigned that name before it (lexical order in one file: no flow, no source following). An assignment takes effect where its command ends, so X="${X:-d}" or a quoted value spanning lines still reads the caller's X. Each Bash read row carries form= (required for :? and ?, default for :-, unset-default for -, settest for + and :+ and a -n/-z operand of [, [[ or test, assign for := and =, plain for $X and ${X}); colon="1" when the colon spelling makes an EMPTY value count as unset (colon="0" when not, absent when the expansion has no operator); default= the literal default word, possibly empty; test="n" or "z" when the read is the operand of that test. writes= on a gate counts, and write rows list, every Bash assignment of the name anywhere in the repo (X=, export X=, local, declare, readonly, read, for, mapfile, getopts, printf -v, := expansions, and the REPLY, OPTARG or MAPFILE that read, select, getopts and mapfile set themselves; not a prefix X=v cmd, which reaches only that command). A local, or a declare inside a function, hides reads only to the end of that function; a write inside $( ) or ( ) only to that subshell's end; an element write X[i]= hides only subscripted ${X[i]} reads, never the scalar $X. Write rows are paged like the reads (shown_writes= writes_capped= and more writes= as for reads). ambient="1": a name Bash or the login always sets (BASH_*, PWD, HOME, PATH, RANDOM and the like), never unsupplied. generated_skipped=N on the root: shell files this verb read but did not harvest because a GENERATED and DO NOT EDIT banner opens them. nesting_cut=N on the root: shell files where an expansion nested more than 32 deep inside another's word (${A:-${B:-…}}) was not read past that depth, so a read there may be missing. --> <!-- ROWS AND WHAT IS NEVER CUT: the gate rows ARE the answer this verb was asked for and are never windowed, capped or paged, and gates/dark_gates/compile/cmake/env/files on the root plus regions/loc/reads/dark on every gate are counted over the FULL set before any cap exists. What pages is the read SITES under one gate, at 8 a gate by default: a gate whose sites were cut says shown_reads= (the rows this run printed) with reads_capped="1", against the reads= total already on the same element, and the more reads= child keeps naming the remainder. The pair is emitted ONLY on a gate that was cut, never as a capped="0" on the gates that fit. limit=N raises the per gate cap (offset=M skips that many sites in every gate), detail lifts it entirely, and next= on the root is the exact pasteable invocation that shows every site this run dropped. --> -<flags schema="ripwire.flags/v1" gates="492" dark_gates="483" compile="13" cmake="13" env="466" files="4851" generated_skipped="1" next="--flags --limit=879"> +<flags schema="ripwire.flags/v1" gates="494" dark_gates="485" compile="13" cmake="13" env="468" files="4861" generated_skipped="1" next="--flags --limit=882"> <gate name="FIXTURE_DARK_FEATURE" kind="compile" default="0" dark="1" regions="2" loc="13" reads="2" p="test/flagsfix/wiringFlags.h" l="10"> <read p="test/flagsfix/feature.cpp" l="10"/> <read p="test/flagsfix/sub/nested.cpp" l="5"/> @@ -3920,8 +3907,8 @@ _The cache-locality lens over every aggregate: fields READ TOGETHER but declared ``` $ ./build/ripwire . --field-affinity <!-- ripwire field-affinity schema=ripwire.field-affinity/v1: fields read together but declared far apart vs 64-byte lines: <s n= p=> structs, <pair a= b= fns= dist=>, <finding k= f= g=>. window: shown= capped= (capped=1 cut). counts_floor=1: every count is a FLOOR, never a total. root=: p= relative to it. block=64: ASSUMED cache-line bytes; all geometry (dist= wt= ln= lines= findings) is against it. model=lp64-approx: sizes/offsets are the layout verb's LP64 standard-layout MODEL, not the real ABI. weighting=fanin-floor: w= sums 1 + fan-in per co-accessing fn; a reachability proxy, not a frequency. aggregates=N: C-family structs/classes the layout model located a body for (the scanned universe). files=N: C-family files declaring at least one struct/class the modelling pass visited. fns_scanned=N: C-family functions/methods with a readable body scanned for dot/arrow member accesses. accesses=N: member-access sites tied to one aggregate field (FLOOR: bare in-method names uncounted). amb_skipped=N: access sites REFUSED, not guessed: 2+ aggregates declare that field name; in no count here. structs=N: aggregates with 1+ attributed access; the top 20 by sepcost= print (shown=/capped=). findings=N: split-line + straddle findings over ALL structs=, not just the printed rows. min_fns=2: a pair fires split-line only when co-accessed by this many distinct functions. as_loops=N: for-loops the static advance-shape pass classified corpus-wide; report-only, never ranks. as_index=/as_chase=/as_mixed=/as_unknown=: as_loops= by advance shape (chase = pointer chase). agg=: the aggregate keyword (struct, class ...). modeled=1: layout model placed the fields; 0 = affinity only, no geometry, no finding (why= says why). fields=N: fields declared (before the touched-only filter). touched=N: fields with 1+ attributed access; at most 32 f rows print. pairs=N: co-accessed field pairs in all; at most 12 pair rows print (most fns= first). sepcost=: sum over measured pairs of fns x (1 - wt); the struct ranking key. findings=N: this struct's findings, every one printed. size=/align=/lines=: modeled sizeof, alignment, cache lines spanned (modeled=1 only). acc=N: member-access sites attributed to this field (FLOOR). sz=B: the field's modeled size in bytes (absent when the model could not size it). off=/ln=: modeled byte offset and its cache line (off/64); placed=0 instead when the model refused. w=: sum of 1 + fan-in over the co-accessing functions; a static reachability proxy, never a frequency. wt=: separation weight (64 - dist)/64, 0.00 = the two can never share a line; measured=0 instead when unplaced. wt=0.00: split-line fires only when the pair can never share a 64-byte line. w=: the split-line pair's 1 + fan-in weight sum (proxy); straddle rows carry none. off=/sz=/crosses=: straddle field offset, size, and the line its last byte lands on (lines start at off/64). fanin=N: this function's caller count (the w= proxy input). touched=N: distinct fields of this struct the function touches (named in f=); at most 8 fn rows of fns= print. scope=: the function's PROFILE_SCOPE description (first 120 chars), a counter to confirm with. scopes=N: distinct PROFILE_SCOPEs among the co-accessing functions (the scope children). status=: instrumented (a scope exists to measure) or uninstrumented (no witness yet). counter=: the hardware counter to compare across the two layouts. hint=: how to add the missing instrumentation (uninstrumented only). as_stem_ambiguous=/as_stem_unowned=/as_stem_nonptr=: chase names REFUSED - 2+ owners / no owner / owner type has no pointer marker. --> -<fieldaffinity schema="ripwire.field-affinity/v1" block="64" model="lp64-approx" counts_floor="1" weighting="fanin-floor" aggregates="3034" files="609" fns_scanned="14916" accesses="15557" amb_skipped="51538" structs="1135" shown="20" capped="1" findings="1126" min_fns="2" as_loops="4583" as_index=" … [line truncated: 78 more bytes on this line] -<s n="Graph" p="src/graph.h" l="100" agg="struct" modeled="1" fields="48" touched="40" fns="168" pairs="780" sepcost="2307.62" findings="641" size="1536" align="8" lines="24"> +<fieldaffinity schema="ripwire.field-affinity/v1" block="64" model="lp64-approx" counts_floor="1" weighting="fanin-floor" aggregates="3078" files="611" fns_scanned="15130" accesses="15723" amb_skipped="52588" structs="1159" shown="20" capped="1" findings="934" min_fns="2" as_loops="4574" as_index="9 … [line truncated: 77 more bytes on this line] +<s n="Graph" p="src/graph.h" l="100" agg="struct" modeled="1" fields="48" touched="33" fns="161" pairs="528" sepcost="1458.50" findings="427" size="1536" align="8" lines="24"> <f n="inEdges" acc="136" fns="61" sz="48" off="0" ln="0"/> <f n="wOutDeg" acc="36" fns="31" sz="24" off="48" ln="0"/> <f n="outVals" acc="9" fns="6" sz="24" off="120" ln="1"/> @@ -3930,9 +3917,9 @@ $ ./build/ripwire . --field-affinity <f n="scipEdgesPinned" acc="1" fns="1" sz="8" off="224" ln="3"/> <f n="baseOutsideClauses" acc="13" fns="8" sz="24" off="280" ln="4"/> <f n="rubyMainMixins" acc="5" fns="5" sz="24" off="304" ln="4"/> -<f n="ambOut" acc="29" fns="16" sz="24" off="352" ln="5"/> -<f n="unresolvedOut" acc="28" fns="15" sz="24" off="376" ln="5"/> -<f n="locPinOut" acc="13" fns="7" sz="24" off="400" ln="6"/> +<f n="unindexedFiles" acc="8" fns="8" sz="8" off="424" ln="6"/> +<f n="rubyBasesUnscoped" acc="7" fns="7" sz="8" off="432" ln="6"/> +<f n="importAdj" acc="7" fns="5" sz="48" off="440" ln="6"/> ... [17 more line(s); run it to see the whole thing] ``` @@ -3955,16 +3942,16 @@ _Which of this repo's doc claims are now false. CHANGED: row attribute at= renam ``` $ ./build/ripwire . --doc-drift <!-- ripwire doc-drift schema=ripwire.doc-drift/v1: markdown anchors that no longer hold: <doc p=> of <a k= l= c= why= ref= want= got= tgt=>; unchecked/dated rows disclose the rest. failed_capped=/weak_capped=: 1 = cut. at=: commit+dirty+shallow. next=: the one pasteable follow-up. docs=N: markdown docs scanned for anchors; docs minus clean = the doc rows. clean=N: docs with no failed anchor (drift and dated 0); not proof every anchor was checked. checked=N: anchors verified against the index; checked + unchecked = anchors. prose=N: value anchors dropped as prose (name not in code); subtracted from anchors=, never checked. corpus=N: files the anchors were checked against (index + config/build exts); 0 = no anchor shape, no scan. drift=/dated=: anchors that no longer hold / anchors skipped as dated (unverifiable by date). unchecked=N: anchors not proved (the unchecked rows give each reason); checked + unchecked = anchors. doc shown_failed=/failed_total=: a rows printed / all failed anchors (drift+dated); cut at 12, detail=1 lifts. a kind=/rec=: dated-record, an author-dated failed anchor in dated= / its evidence: line|block|title|stamp. a sym=: the symbol the doc names on that file:line; line-moved = that symbol no longer spans the line. more weak=N: w rows of this group withheld; shown_weak + N = its n=; detail=1 lists all. shown_weak=N: w rows printed of n= (cut at 12 a doc, weak_capped=1); detail=1 lists all. w resolves-to=: the indexed symbol spanning that line; not proof it is the one the doc meant. unchecked r=/note=: why n= anchors were not proved, and what was still checked for them. dated r=/note=: the dating mark that moved n= failed anchors into dated= instead of drift=. --> -<doc-drift schema="ripwire.doc-drift/v1" docs="352" clean="317" anchors="8237" checked="3898" unchecked="4339" drift="91" dated="135" prose="26" corpus="5008" at="ed47f82e8" next="--doc-drift --detail=1"> +<doc-drift schema="ripwire.doc-drift/v1" docs="356" clean="321" anchors="8252" checked="3910" unchecked="4342" drift="91" dated="136" prose="26" corpus="5018" at="914c4045d" next="--doc-drift --detail=1"> <doc p="docs/research/answer-completeness.md" anchors="187" checked="84" drift="16" dated="0" shown_failed="12" failed_capped="1" failed_total="16"> <a k="file-line" l="341" c="25" why="line-moved" ref="src/pageview.h:292" sym="pageDisclosure" got="(file scope)" tgt="src/pageview.h:351"/> -<a k="file-line" l="349" c="99" why="line-moved" ref="src/serialize.h:4169" sym="kForLensDefaultTopN" got="serialize" tgt="src/serialize.h:1101"/> -<a k="file-line" l="353" c="89" why="line-moved" ref="src/serialize.h:4435" sym="kForPayloadBudgetBytes" got="packSource" tgt="src/serialize.h:990"/> -<a k="file-line" l="356" c="42" why="line-moved" ref="src/serialize.h:1010" sym="kForFileTailShownCap" got="forRunawayGuardNote" tgt="src/serialize.h:1178"/> -<a k="file-line" l="358" c="89" why="line-moved" ref="src/serialize.h:5481" sym="kForAnchorBodyBudgetBytes" got="(file scope)" tgt="src/serialize.h:1154"/> -<a k="file-line" l="360" c="88" why="line-moved" ref="src/serialize.h:5800" sym="kForCompactSurfaceBudgetBytes" got="SigsCutReport" tgt="src/serialize.h:1273"/> -<a k="file-line" l="366" c="43" why="line-moved" ref="src/serialize.h:6534" sym="kWithGraphNodeCap" got="packSignatures" tgt="src/serialize.h:9754"/> -<a k="file-line" l="367" c="51" why="line-moved" ref="src/forpage.h:287" sym="kForPageRowsDefault" got="forCandidatePageDoc" tgt="src/forpage.h:75"/> +<a k="file-line" l="349" c="99" why="line-moved" ref="src/serialize.h:4169" sym="kForLensDefaultTopN" got="append" tgt="src/serialize.h:1111"/> +<a k="file-line" l="353" c="89" why="line-moved" ref="src/serialize.h:4435" sym="kForPayloadBudgetBytes" got="settleEstTokens" tgt="src/serialize.h:1000"/> +<a k="file-line" l="356" c="42" why="line-moved" ref="src/serialize.h:1010" sym="kForFileTailShownCap" got="(file scope)" tgt="src/serialize.h:1188"/> +<a k="file-line" l="358" c="89" why="line-moved" ref="src/serialize.h:5481" sym="kForAnchorBodyBudgetBytes" got="(file scope)" tgt="src/serialize.h:1164"/> +<a k="file-line" l="360" c="88" why="line-moved" ref="src/serialize.h:5800" sym="kForCompactSurfaceBudgetBytes" got="(file scope)" tgt="src/serialize.h:1283"/> +<a k="file-line" l="366" c="43" why="line-moved" ref="src/serialize.h:6534" sym="kWithGraphNodeCap" got="packSignatures" tgt="src/serialize.h:10073"/> +<a k="file-line" l="367" c="51" why="line-moved" ref="src/forpage.h:287" sym="kForPageRowsDefault" got="forCandidatePageDoc" tgt="src/forpage.h:76"/> ... [20 more line(s); run it to see the whole thing] ``` @@ -3989,16 +3976,16 @@ _Which of this repo's doc claims are now false. CHANGED: row attribute at= renam ``` $ ./build/ripwire . --doc-drift <!-- ripwire doc-drift schema=ripwire.doc-drift/v1: markdown anchors that no longer hold: <doc p=> of <a k= l= c= why= ref= want= got= tgt=>; unchecked/dated rows disclose the rest. failed_capped=/weak_capped=: 1 = cut. at=: commit+dirty+shallow. next=: the one pasteable follow-up. docs=N: markdown docs scanned for anchors; docs minus clean = the doc rows. clean=N: docs with no failed anchor (drift and dated 0); not proof every anchor was checked. checked=N: anchors verified against the index; checked + unchecked = anchors. prose=N: value anchors dropped as prose (name not in code); subtracted from anchors=, never checked. corpus=N: files the anchors were checked against (index + config/build exts); 0 = no anchor shape, no scan. drift=/dated=: anchors that no longer hold / anchors skipped as dated (unverifiable by date). unchecked=N: anchors not proved (the unchecked rows give each reason); checked + unchecked = anchors. doc shown_failed=/failed_total=: a rows printed / all failed anchors (drift+dated); cut at 12, detail=1 lifts. a kind=/rec=: dated-record, an author-dated failed anchor in dated= / its evidence: line|block|title|stamp. a sym=: the symbol the doc names on that file:line; line-moved = that symbol no longer spans the line. more weak=N: w rows of this group withheld; shown_weak + N = its n=; detail=1 lists all. shown_weak=N: w rows printed of n= (cut at 12 a doc, weak_capped=1); detail=1 lists all. w resolves-to=: the indexed symbol spanning that line; not proof it is the one the doc meant. unchecked r=/note=: why n= anchors were not proved, and what was still checked for them. dated r=/note=: the dating mark that moved n= failed anchors into dated= instead of drift=. --> -<doc-drift schema="ripwire.doc-drift/v1" docs="352" clean="317" anchors="8237" checked="3898" unchecked="4339" drift="91" dated="135" prose="26" corpus="5008" at="ed47f82e8" next="--doc-drift --detail=1"> +<doc-drift schema="ripwire.doc-drift/v1" docs="356" clean="321" anchors="8252" checked="3910" unchecked="4342" drift="91" dated="136" prose="26" corpus="5018" at="914c4045d" next="--doc-drift --detail=1"> <doc p="docs/research/answer-completeness.md" anchors="187" checked="84" drift="16" dated="0" shown_failed="12" failed_capped="1" failed_total="16"> <a k="file-line" l="341" c="25" why="line-moved" ref="src/pageview.h:292" sym="pageDisclosure" got="(file scope)" tgt="src/pageview.h:351"/> -<a k="file-line" l="349" c="99" why="line-moved" ref="src/serialize.h:4169" sym="kForLensDefaultTopN" got="serialize" tgt="src/serialize.h:1101"/> -<a k="file-line" l="353" c="89" why="line-moved" ref="src/serialize.h:4435" sym="kForPayloadBudgetBytes" got="packSource" tgt="src/serialize.h:990"/> -<a k="file-line" l="356" c="42" why="line-moved" ref="src/serialize.h:1010" sym="kForFileTailShownCap" got="forRunawayGuardNote" tgt="src/serialize.h:1178"/> -<a k="file-line" l="358" c="89" why="line-moved" ref="src/serialize.h:5481" sym="kForAnchorBodyBudgetBytes" got="(file scope)" tgt="src/serialize.h:1154"/> -<a k="file-line" l="360" c="88" why="line-moved" ref="src/serialize.h:5800" sym="kForCompactSurfaceBudgetBytes" got="SigsCutReport" tgt="src/serialize.h:1273"/> -<a k="file-line" l="366" c="43" why="line-moved" ref="src/serialize.h:6534" sym="kWithGraphNodeCap" got="packSignatures" tgt="src/serialize.h:9754"/> -<a k="file-line" l="367" c="51" why="line-moved" ref="src/forpage.h:287" sym="kForPageRowsDefault" got="forCandidatePageDoc" tgt="src/forpage.h:75"/> +<a k="file-line" l="349" c="99" why="line-moved" ref="src/serialize.h:4169" sym="kForLensDefaultTopN" got="append" tgt="src/serialize.h:1111"/> +<a k="file-line" l="353" c="89" why="line-moved" ref="src/serialize.h:4435" sym="kForPayloadBudgetBytes" got="settleEstTokens" tgt="src/serialize.h:1000"/> +<a k="file-line" l="356" c="42" why="line-moved" ref="src/serialize.h:1010" sym="kForFileTailShownCap" got="(file scope)" tgt="src/serialize.h:1188"/> +<a k="file-line" l="358" c="89" why="line-moved" ref="src/serialize.h:5481" sym="kForAnchorBodyBudgetBytes" got="(file scope)" tgt="src/serialize.h:1164"/> +<a k="file-line" l="360" c="88" why="line-moved" ref="src/serialize.h:5800" sym="kForCompactSurfaceBudgetBytes" got="(file scope)" tgt="src/serialize.h:1283"/> +<a k="file-line" l="366" c="43" why="line-moved" ref="src/serialize.h:6534" sym="kWithGraphNodeCap" got="packSignatures" tgt="src/serialize.h:10073"/> +<a k="file-line" l="367" c="51" why="line-moved" ref="src/forpage.h:287" sym="kForPageRowsDefault" got="forCandidatePageDoc" tgt="src/forpage.h:76"/> ... [20 more line(s); run it to see the whole thing] ``` @@ -4022,16 +4009,16 @@ _Same report, with git history splitting stale mentions into deleted-by-commit v ``` $ ./build/ripwire . --doc-drift --with-history <!-- ripwire doc-drift schema=ripwire.doc-drift/v1: markdown anchors that no longer hold: <doc p=> of <a k= l= c= why= ref= want= got= tgt=>; unchecked/dated rows disclose the rest. failed_capped=/weak_capped=: 1 = cut. at=: commit+dirty+shallow. next=: the one pasteable follow-up. docs=N: markdown docs scanned for anchors; docs minus clean = the doc rows. clean=N: docs with no failed anchor (drift and dated 0); not proof every anchor was checked. checked=N: anchors verified against the index; checked + unchecked = anchors. prose=N: value anchors dropped as prose (name not in code); subtracted from anchors=, never checked. corpus=N: files the anchors were checked against (index + config/build exts); 0 = no anchor shape, no scan. drift=/dated=: anchors that no longer hold / anchors skipped as dated (unverifiable by date). unchecked=N: anchors not proved (the unchecked rows give each reason); checked + unchecked = anchors. doc shown_failed=/failed_total=: a rows printed / all failed anchors (drift+dated); cut at 12, detail=1 lifts. a kind=/rec=: dated-record, an author-dated failed anchor in dated= / its evidence: line|block|title|stamp. a sym=: the symbol the doc names on that file:line; line-moved = that symbol no longer spans the line. more weak=N: w rows of this group withheld; shown_weak + N = its n=; detail=1 lists all. shown_weak=N: w rows printed of n= (cut at 12 a doc, weak_capped=1); detail=1 lists all. w resolves-to=: the indexed symbol spanning that line; not proof it is the one the doc meant. unchecked r=/note=: why n= anchors were not proved, and what was still checked for them. dated r=/note=: the dating mark that moved n= failed anchors into dated= instead of drift=. --> -<doc-drift schema="ripwire.doc-drift/v1" docs="352" clean="323" anchors="8237" checked="3876" unchecked="4361" drift="78" dated="126" prose="26" corpus="5008" at="ed47f82e8" next="--doc-drift --detail=1"> -<history probed="1" head="ed47f82e8" commits="7353" removed-names="58930"/> +<doc-drift schema="ripwire.doc-drift/v1" docs="356" clean="327" anchors="8252" checked="3888" unchecked="4364" drift="78" dated="127" prose="26" corpus="5018" at="914c4045d" next="--doc-drift --detail=1"> +<history probed="1" head="914c4045d" commits="7404" removed-names="59523"/> <doc p="docs/research/answer-completeness.md" anchors="187" checked="84" drift="16" dated="0" shown_failed="12" failed_capped="1" failed_total="16"> <a k="file-line" l="341" c="25" why="line-moved" ref="src/pageview.h:292" sym="pageDisclosure" got="(file scope)" tgt="src/pageview.h:351"/> -<a k="file-line" l="349" c="99" why="line-moved" ref="src/serialize.h:4169" sym="kForLensDefaultTopN" got="serialize" tgt="src/serialize.h:1101"/> -<a k="file-line" l="353" c="89" why="line-moved" ref="src/serialize.h:4435" sym="kForPayloadBudgetBytes" got="packSource" tgt="src/serialize.h:990"/> -<a k="file-line" l="356" c="42" why="line-moved" ref="src/serialize.h:1010" sym="kForFileTailShownCap" got="forRunawayGuardNote" tgt="src/serialize.h:1178"/> -<a k="file-line" l="358" c="89" why="line-moved" ref="src/serialize.h:5481" sym="kForAnchorBodyBudgetBytes" got="(file scope)" tgt="src/serialize.h:1154"/> -<a k="file-line" l="360" c="88" why="line-moved" ref="src/serialize.h:5800" sym="kForCompactSurfaceBudgetBytes" got="SigsCutReport" tgt="src/serialize.h:1273"/> -<a k="file-line" l="366" c="43" why="line-moved" ref="src/serialize.h:6534" sym="kWithGraphNodeCap" got="packSignatures" tgt="src/serialize.h:9754"/> +<a k="file-line" l="349" c="99" why="line-moved" ref="src/serialize.h:4169" sym="kForLensDefaultTopN" got="append" tgt="src/serialize.h:1111"/> +<a k="file-line" l="353" c="89" why="line-moved" ref="src/serialize.h:4435" sym="kForPayloadBudgetBytes" got="settleEstTokens" tgt="src/serialize.h:1000"/> +<a k="file-line" l="356" c="42" why="line-moved" ref="src/serialize.h:1010" sym="kForFileTailShownCap" got="(file scope)" tgt="src/serialize.h:1188"/> +<a k="file-line" l="358" c="89" why="line-moved" ref="src/serialize.h:5481" sym="kForAnchorBodyBudgetBytes" got="(file scope)" tgt="src/serialize.h:1164"/> +<a k="file-line" l="360" c="88" why="line-moved" ref="src/serialize.h:5800" sym="kForCompactSurfaceBudgetBytes" got="(file scope)" tgt="src/serialize.h:1283"/> +<a k="file-line" l="366" c="43" why="line-moved" ref="src/serialize.h:6534" sym="kWithGraphNodeCap" got="packSignatures" tgt="src/serialize.h:10073"/> ... [20 more line(s); run it to see the whole thing] ``` @@ -4056,7 +4043,7 @@ _The house PLAN/DESIGN format's STRUCTURE check — never semantics; exit 2 when ``` $ ./build/ripwire . --plan-lint=test/planlintfix/wave.md <!-- ripwire plan-lint schema=ripwire.plan-lint/v1: structural lint of a plan document: each finding names the section and the rule. at=: commit+dirty+shallow. file=/dialect=: the plan read and whether the PLAN dialect was detected (dialect=0: nothing to lint). cards=/ledger=: card rows found / whether the doc carries a ledger (ledger_line= names its line). git=1: git was available, so the staleness read ran; stale_commits=N: a waiting card N commits behind HEAD is stale. gating=N: findings that fail the plan (exit 2); the rest are advisory. --> -<plan-lint schema="ripwire.plan-lint/v1" file="test/planlintfix/wave.md" dialect="1" cards="3" ledger="1" ledger_line="21" at="ed47f82e8" git="1" stale_commits="20" gating="3"> +<plan-lint schema="ripwire.plan-lint/v1" file="test/planlintfix/wave.md" dialect="1" cards="3" ledger="1" ledger_line="21" at="914c4045d" git="1" stale_commits="20" gating="3"> <card id="T1" line="10" status="check" tline="12"/> <card id="T2" line="14" status="cross" tline="16"/> <card id="T5" line="18" status="missing" tline="19" why="unlaunched" gating="1"/> @@ -4095,8 +4082,8 @@ 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<float> 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:1760 - #3 0x102e01a44 in main src/main.cpp:4511 + #2 0x102e11f30 in runDefaultMap(MainDispatch const&) src/main.cpp:1761 + #3 0x102e01a44 in main src/main.cpp:4565 #4 0x1a2b3c0dc in start+0x9dc (dyld:arm64e+0x60dc) ==41337==ABORTING ``` @@ -4123,7 +4110,7 @@ _A command that exits 0: a minimal success record (exit, measured duration, disc $ ./build/ripwire . --run-trace="true" <ctx schema="ripwire.from-trace/v1" task="run-trace: true"> <!-- ripwire from-trace schema=ripwire.from-trace/v1: trace frames mapped to indexed symbols, innermost first; the innermost in-corpus body included. task=: the trace source this bundle maps, verbatim (a file path, stdin, or an MCP label). run exit=: the command's OWN exit code; signal=: the signal that killed it; timed_out=1: the timeout_s= cap did. run duration_ms=: wall clock, MEASURED, not deterministic; timeout_s=: the cap it ran under. run lines=: non-empty captured lines; bytes=: the whole capture; dropped_bytes=: middle bytes the cap dropped. --> -<run exit="0" duration_ms="57" timeout_s="600" lines="0" bytes="0"/> +<run exit="0" duration_ms="137" timeout_s="600" lines="0" bytes="0"/> </ctx> ``` @@ -4213,7 +4200,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" -<ctx schema="ripwire.pack-task/v1" task="add a new output format flag to the CLI" route="subtoken+body:declined(add;207-carriers,70-defs)" root="." est_tokens="3150" budget_tokens="6000"> +<ctx schema="ripwire.pack-task/v1" task="add a new output format flag to the CLI" route="subtoken+body:declined(add;218-carriers,70-defs)" root="." est_tokens="3150" budget_tokens="6000"> <!-- ripwire pack-task schema=ripwire.pack-task/v1: one-call task bundle for task= under budget_tokens=: <sigs> <d n= sc= l= p=> ranking, <far> <s t= n= p=> ranked but over 1 hop out (of_top= ranked rows) > <bodies> @@ -4250,10 +4237,10 @@ _Fan-out form: one shared core + 3 per-agent slices carved along call-graph comm ``` $ ./build/ripwire . --pack-task="add a new output format flag to the CLI" --partition=3 -<ctx-partitions schema="ripwire.pack-task/v1" partitions="3" requested="3" core_symbols="6" surface="42" modules="20" split="0" budget_per_agent_tokens="6000" core_budget_tokens="2040" partition_budget_tokens="3960" total_bytes="20857" overlap_mean="0.006" overlap_max="0.017" shared_symbols="1" unio … [line truncated: 36 more bytes on this line] +<ctx-partitions schema="ripwire.pack-task/v1" partitions="3" requested="3" core_symbols="6" surface="42" modules="23" split="0" budget_per_agent_tokens="6000" core_budget_tokens="2040" partition_budget_tokens="3960" total_bytes="20871" overlap_mean="0.010" overlap_max="0.031" shared_symbols="2" unio … [line truncated: 36 more bytes on this line] <!-- ripwire pack-task schema=ripwire.pack-task/v1: N minimally overlapping agent bundles carved along call-graph communities plus one shared core; each <bundle> wraps a <ctx>; bundle role=core|partition i= symbols= modules= bytes= tokens=: one agent's ctx, symbols= ids assigned, bytes= its size; tokens= = est_tokens= = bytes/2.36 (flat, the densest rate; the inner ctx est_tokens= is language-weighted). Inner ctx task= root= budget_tokens= dropped_positive=: the task, p= base, the slice's token target, ranked candidates its budget cut. of_top=: rows ranked (far) / bodies (callers); s rel=caller|callee shared=: 1-hop edge, bodies reached (absent at 1). window: shown= total= capped= (capped=1 cut). run_unknown=1: no runner derivable (a guess would be worse). est_tokens=: price as emitted (an upper bound under compact). <d r=N>: rank N in this ranking, rows in r= order. <d cx= ccx=>: cyclomatic/cognitive complexity. <d in=N>: N callers in the index (absent: not measured). route=: the ranker: name-exact(X) = the task names symbol X (anchors: its evidence), subtoken+body = conceptual BM25 (:broad = 1-2 plain words, plain rg may also win; :declined(...) = a name hit refused as a common name). sc=: enclosing scope; the full id is p::sc::n (p= of the row or its <f>) and selectors take it. next=: the one pasteable follow-up. pure=1: const/constexpr signature (Swift: non-mutating) and no transitive side effect found; a hint. partitions=/requested=: partitions carved / asked for. modules=/split=: call-graph groups found / cuts forced to split one. core_symbols=/surface=: ids in the shared core / core plus the assignable remainder. budget_per_agent_tokens=: one agent's budget, core_budget_tokens= plus partition_budget_tokens=. total_bytes=N: bytes of all bundles together. overlap_mean=/overlap_max=: pairwise Jaccard over the ids partitions name, before trimming. shared_symbols=/union_symbols=: ids two or more partitions name / ids any partition names. core_overlap=: share of the core surface a partition reaches anyway. c p=: the file a body callee's l= is in, printed when it is not the b row's own (no p=: the b's file). --> <bundle role="core" symbols="6" bytes="2738" tokens="1160" est_tokens="1160"> -<ctx task="add a new output format flag to the CLI" route="subtoken+body:declined(add;207-carriers,70-defs)" root="." dropped_positive="2" est_tokens="938" budget_tokens="2040"> +<ctx task="add a new output format flag to the CLI" route="subtoken+body:declined(add;218-carriers,70-defs)" root="." dropped_positive="2" est_tokens="938" budget_tokens="2040"> <!-- slice budget=4332 bytes (2040-token target, ceiling 4814) | ranking: capped | bodies: kept 2 of 6 (capped) | callers: kept 1 of 11 | notes: none | tests: none | far: none --> <sigs shown="4" total="6" capped="1"> <d l="3288" n="printUsage" sc="rw" p="src/cli.h" cx="1" ccx="0" in="1" r="1" next="--expand=src/cli.h:printUsage"> @@ -4283,7 +4270,7 @@ _Task lens + a compact Mermaid flowchart of the top anchors' 1-hop edges._ ``` $ ./build/ripwire . --for="pagerank power iteration" --with-graph -<ctx task="pagerank power iteration" route="subtoken+body" root="." confidence="high" margin_pct="22" at="ed47f82e8" doc_mentions="4" schema="ripwire.for/v1" bundle="compact" bodies="0" reason="compact-route" budget_bytes="7500" doc_mentions_capped="1" doc_mentions_total="14" est_tokens="8305"> +<ctx task="pagerank power iteration" route="subtoken+body" root="." confidence="high" margin_pct="22" at="914c4045d" doc_mentions="4" schema="ripwire.for/v1" bundle="compact" bodies="0" reason="compact-route" budget_bytes="7500" doc_mentions_capped="1" doc_mentions_total="14" est_tokens="8311"> <!-- ripwire for schema=ripwire.for/v1: bundle=/bodies=/reason= the body posture; d: cx= ccx= complexity, in= callers (absent cx/ccx/in = 0), churn= amp= change, clone= tested= 1, sc= scope, id=p::sc::n; total= shown= capped=1 if cut; task= the query; d pure=1 const/constexpr sig, next= the follow-up to paste; d same_as=N: doc+sig text as row n=N (not repeated); route= name-exact(X)|subtoken+body[:broad|:declined]; confidence=/margin_pct= head score drop (low=flat); h l= p= n=, c n= l= p= (p= if not h's; same-named joined, shown= counts them), noedge= no callee resolved; fold kind=bodies: b t= n= p= l= top ranked rows' whole bodies, not the answer; served= of total= in budget_bytes=; slice/skip p= n= l=; skip bytes= next=; a skip makes sigs next= it, sigs_next= the signatures-only re-call; d mem= an owner's direct member names only, by the index (question words first, then owner's file, path, line, name), mem_more= names cut; t p= file outside sigs (weaker), t sym= its top symbols not in sigs/syms (a pointer, not the answer), r= rank (gap = trimmed); t tsym= up to 2 more file symbols named by a task word (a name match); t order: code files first, then doc files (a code question); t page rows go on to file-page row 160 (code question: 160 code rows, docs within row 160); past page 0 (code question: past 40 code rows, a doc past row 40) listed last, head files skipped; past 120 of those p= only, p_only= counts them; t folded=class=N: N p= only rows of that class (doc|config|script|testdata|other) not listed, next= pages to them; d layer=: built-in arch layer (game|infra|render|math|audio|ai|test) from a dir name in p=; d e= its last line (absent=unknown, never 0; l= the name's line); c prov=split: a resolver split arm; may be another arm's (NOT a claim the edge is false) [doc mentions: 4 docs, 2 symbols; doc_mentions=] --> <!-- root= is the crawl root; p= below is RELATIVE to it (single-root only; absent => p= is ingest's own path, unchanged); at=this commit(+dirty). [budget_bytes= is the default BYTE target this ranked payload was shaped toward: row text shortens toward it, no row of the ranked head is removed for it (sigs past_target=)] [sigs capped=1 with shown=total: rows shrunk, none dropped] [sigs past_target=K: the last K rows are past the budget_bytes target, served because they are rows of the ranked head; none is cut] [sigs sigs_next=: one call serving all total= rows uncut] [docs_dropped=N: N shown rows have a doc comment not printed (r>24 always, r5..24 if capped)] [docs_after_code=N: N doc rows of the shown set moved below its code rows; same rows, reordered, none added or removed; a question naming docs keeps score order] [files_first=N: N rows moved so r=1..8 are distinct files' best rows, score order, a repeated name once; same rows; fold, hops keep score order] [cut: doc_mentions_capped="1" doc_mentions_total="14" — an indexing cap dropped content not shown here]; lego/compose collapse to a counted stub by default (a disclosed cut): total= that section's own pre-cap row count, shown="0" capped="1" (nothing rendered here), next= names the sections=lego,compose flag that restores both sections byte-identically in one call est_tokens= prices this bundle in tokens --> <sigs shown="40" total="40" capped="1" past_target="14" docs_dropped="25" docs_after_code="5" files_first="7" sigs_next="--for='pagerank power iteration' --signatures-only --token-budget=6200" next="--expand=src/prconverge.h:73:renderDisclosure"> @@ -4361,14 +4348,14 @@ _Environment self-check: binary staleness, grammars, cache dir, git, tracked-bin ``` $ ./build/ripwire . --doctor <!-- ripwire doctor schema=ripwire.doctor/v1: setup health: <c n= ok=> checks; exit 1 when one fails. at=: commit+dirty+shallow. n=: the check's name (binary-path, grammars, cache-dir, git, tree-sitter, index-cache, layout ...). loaded=/expected=: grammars whose tags query compiled / grammars compiled in; a shortfall fails the row. dir=: the per-user cache directory scanned (TMPDIR/XDG_CACHE_HOME ladder); unwritable fails the row. blobs=N: ripwire cache blobs in dir=; the scan stops at 4096 (blobs_floor=1 then). bytes=N: total size in bytes of the blobs counted (short when truncated=1). many=1: more than 50 blobs; an eviction-sanity flag, informational, never fails the row. truncated=1: cache-dir, blob scan cut (cap or I/O error); tracked-binaries, scan SKIPPED, stale=0 unmeasured. locks=N: advisory edit-lock files under locks/; unheld ones over a day old are swept on a cache write. volatile=: this row's attributes that read LIVE machine state; a determinism diff strips them, never the row. git=0|1: git runs from PATH; 0 fails the row (churn verbs need it). repo=0|1: the root is inside a git work tree; 0 is a diagnosis, not a failure. history=0|1: the repo has at least one commit; head= prints only when it does. head=: HEAD's short sha (9 hex, the at= width). core_abi=/cpp_grammar_abi=: tree-sitter core language ABI / the C++ grammar's ABI; informational. languages=N: distinct compiled-in grammars (the grammars row's expected=). tracked=N: git ls-files count, printed even when truncated=1 (over 20000 files skips the scan). binaries=N: tracked paths that sniff as binary content. non_git=1: no git history to compare; the row passes unscanned. stale=N: tracked binaries committed before a same-dir same-stem source changed; any fails the row. cache_version=/parser_ver_lean=/parser_ver_rich=/artifact_arch=: index identity; reuse needs all four. rich_verbs=: the verbs that consume the rich artifact (rich=); every other verb reads the lean one. source=: auto (per-root blob), cache-flag (named by the cache flag) or disabled (no-cache: nothing read). lean_path=/rich_path=: the artifact files checked; one path when the cache flag named it. lean=/rich=: can THIS binary open that artifact (ok, absent, parser-version ...); format, never freshness. fsmonitor=: the checkout's core.fsmonitor at startup: unset, builtin, off, or hook (a command git runs). neutralised=1: a hook fsmonitor was overridden to false for this run; 0 when none was needed. filter_drivers=N: filter drivers the repository's own config defines; filter_scope= local|all, filter_pinned= 1 (run with an empty command) or refused. state=: layout records agree, disagree (mixed binary: rebuild clean-first), not-checked or no-records. checked=1: the cross-unit layout comparison ran; 0 = under two comparable records. units=N: translation units that registered a layout record. types=N: layout types recorded (only those registered in src/model.h); omitted on state=disagree. checks=/passed=: checks run / how many passed; exit 1 when passed= is below checks=. built_from=: the commit this binary was built from; at= is the tree HEAD now, a mismatch is normal. self=/which=: this binary's path and the one which ripwire finds on PATH; which_version= is the version line that one prints when they differ. on_path=0|1: whether a ripwire is on PATH; 0 fails the row and hint= carries the export line. same_file=1: the PATH copy is this very file (same device and inode). same_bytes=1: a different file with identical content, a copied install (ok); 0 fails the row; unknown: a file was unreadable; the row fails unverified (hint= names it). self_mtime=/self_size=/which_mtime=/which_size=: epoch mtime and byte size of each binary. hint=: the row's verdict and fix in plain text (which binary is stale, what to run). --> -<doctor schema="ripwire.doctor/v1" checks="9" passed="8" at="ed47f82e8" built_from="ed47f82e8"> -<c n="binary-path" ok="0" self="./build/ripwire" which="<path>" on_path="1" same_file="0" same_bytes="0" self_mtime="1795263330" self_size="65729128" which_mtime="1793517843" which_size="58197960" which_version="ri … [line truncated: 531 more bytes on this line] +<doctor schema="ripwire.doctor/v1" checks="9" passed="8" at="914c4045d" built_from="914c4045d"> +<c n="binary-path" ok="0" self="./build/ripwire" which="<path>" on_path="1" same_file="0" same_bytes="0" self_mtime="1795336538" self_size="65732168" which_mtime="1793517843" which_size="58197960" which_version="ripw … [line truncated: 525 more bytes on this line] <c n="grammars" ok="1" loaded="27" expected="27"/> -<c n="cache-dir" ok="1" dir="<tmp>" blobs="164" bytes="2297750260" many="1" truncated="0" locks="274" volatile="blobs,blobs_floor,bytes,many,truncated,locks"/> -<c n="git" ok="1" git="1" repo="1" history="1" head="ed47f82e8"/> +<c n="cache-dir" ok="1" dir="<tmp>" blobs="213" bytes="2000864999" many="1" truncated="0" locks="225" volatile="blobs,blobs_floor,bytes,many,truncated,locks"/> +<c n="git" ok="1" git="1" repo="1" history="1" head="914c4045d"/> <c n="tree-sitter" ok="1" core_abi="15" cpp_grammar_abi="14" languages="27"/> -<c n="tracked-binaries" ok="1" tracked="5586" binaries="33" non_git="0" truncated="0" stale="0"/> -<c n="index-cache" ok="1" cache_version="54" parser_ver_lean="335" parser_ver_rich="336" artifact_arch="16" rich_verbs="for,uses,metrics,exemplar,context-ratio,nonlocal-state,quality-panel,verify,eval-retrieval,eval-mined,eval-skills" source="auto" lean_path="<tmp> … [line truncated: 219 more bytes on this line] +<c n="tracked-binaries" ok="1" tracked="5597" binaries="33" non_git="0" truncated="0" stale="0"/> +<c n="index-cache" ok="1" cache_version="54" parser_ver_lean="337" parser_ver_rich="338" artifact_arch="16" rich_verbs="for,uses,metrics,exemplar,context-ratio,nonlocal-state,quality-panel,verify,eval-retrieval,eval-mined,eval-skills" source="auto" lean_path="<tmp> … [line truncated: 219 more bytes on this line] <c n="git-config-trust" ok="1" fsmonitor="unset" neutralised="0" filter_drivers="0"/> <c n="layout" ok="1" state="agree" checked="1" units="2" types="12"/> </doctor> @@ -4395,14 +4382,14 @@ _--doctor plus a LIVE integration inspection for one agent: PATH binary, install ``` $ ./build/ripwire . --doctor --agent=claude <!-- ripwire doctor schema=ripwire.doctor/v1: setup health: <c n= ok=> checks; exit 1 when one fails. at=: commit+dirty+shallow. n=: the check's name (binary-path, grammars, cache-dir, git, tree-sitter, index-cache, layout ...). agent=: the agent named by the agent flag; its live-integration c rows follow the built-in checks. loaded=/expected=: grammars whose tags query compiled / grammars compiled in; a shortfall fails the row. dir=: the per-user cache directory scanned (TMPDIR/XDG_CACHE_HOME ladder); unwritable fails the row. blobs=N: ripwire cache blobs in dir=; the scan stops at 4096 (blobs_floor=1 then). bytes=N: total size in bytes of the blobs counted (short when truncated=1). many=1: more than 50 blobs; an eviction-sanity flag, informational, never fails the row. truncated=1: cache-dir, blob scan cut (cap or I/O error); tracked-binaries, scan SKIPPED, stale=0 unmeasured. locks=N: advisory edit-lock files under locks/; unheld ones over a day old are swept on a cache write. volatile=: this row's attributes that read LIVE machine state; a determinism diff strips them, never the row. git=0|1: git runs from PATH; 0 fails the row (churn verbs need it). repo=0|1: the root is inside a git work tree; 0 is a diagnosis, not a failure. history=0|1: the repo has at least one commit; head= prints only when it does. head=: HEAD's short sha (9 hex, the at= width). core_abi=/cpp_grammar_abi=: tree-sitter core language ABI / the C++ grammar's ABI; informational. languages=N: distinct compiled-in grammars (the grammars row's expected=). tracked=N: git ls-files count, printed even when truncated=1 (over 20000 files skips the scan). binaries=N: tracked paths that sniff as binary content. non_git=1: no git history to compare; the row passes unscanned. stale=N: tracked binaries committed before a same-dir same-stem source changed; any fails the row. cache_version=/parser_ver_lean=/parser_ver_rich=/artifact_arch=: index identity; reuse needs all four. rich_verbs=: the verbs that consume the rich artifact (rich=); every other verb reads the lean one. source=: auto (per-root blob), cache-flag (named by the cache flag) or disabled (no-cache: nothing read). lean_path=/rich_path=: the artifact files checked; one path when the cache flag named it. lean=/rich=: can THIS binary open that artifact (ok, absent, parser-version ...); format, never freshness. fsmonitor=: the checkout's core.fsmonitor at startup: unset, builtin, off, or hook (a command git runs). neutralised=1: a hook fsmonitor was overridden to false for this run; 0 when none was needed. filter_drivers=N: filter drivers the repository's own config defines; filter_scope= local|all, filter_pinned= 1 (run with an empty command) or refused. state=: layout records agree, disagree (mixed binary: rebuild clean-first), not-checked or no-records. checked=1: the cross-unit layout comparison ran; 0 = under two comparable records. units=N: translation units that registered a layout record. types=N: layout types recorded (only those registered in src/model.h); omitted on state=disagree. checks=/passed=: checks run / how many passed; exit 1 when passed= is below checks=. built_from=: the commit this binary was built from; at= is the tree HEAD now, a mismatch is normal. self=/which=: this binary's path and the one which ripwire finds on PATH; which_version= is the version line that one prints when they differ. on_path=0|1: whether a ripwire is on PATH; 0 fails the row and hint= carries the export line. same_file=1: the PATH copy is this very file (same device and inode). same_bytes=1: a different file with identical content, a copied install (ok); 0 fails the row; unknown: a file was unreadable; the row fails unverified (hint= names it). self_mtime=/self_size=/which_mtime=/which_size=: epoch mtime and byte size of each binary. hint=: the row's verdict and fix in plain text (which binary is stale, what to run). --> -<doctor schema="ripwire.doctor/v1" checks="12" passed="10" agent="claude" at="ed47f82e8" built_from="ed47f82e8"> -<c n="binary-path" ok="0" self="./build/ripwire" which="<path>" on_path="1" same_file="0" same_bytes="0" self_mtime="1795263330" self_size="65729128" which_mtime="1793517843" which_size="58197960" which_version="ri … [line truncated: 531 more bytes on this line] +<doctor schema="ripwire.doctor/v1" checks="12" passed="10" agent="claude" at="914c4045d" built_from="914c4045d"> +<c n="binary-path" ok="0" self="./build/ripwire" which="<path>" on_path="1" same_file="0" same_bytes="0" self_mtime="1795336538" self_size="65732168" which_mtime="1793517843" which_size="58197960" which_version="ripw … [line truncated: 525 more bytes on this line] <c n="grammars" ok="1" loaded="27" expected="27"/> -<c n="cache-dir" ok="1" dir="<tmp>" blobs="182" bytes="2367798715" many="1" truncated="0" locks="274" volatile="blobs,blobs_floor,bytes,many,truncated,locks"/> -<c n="git" ok="1" git="1" repo="1" history="1" head="ed47f82e8"/> +<c n="cache-dir" ok="1" dir="<tmp>" blobs="234" bytes="2071316293" many="1" truncated="0" locks="225" volatile="blobs,blobs_floor,bytes,many,truncated,locks"/> +<c n="git" ok="1" git="1" repo="1" history="1" head="914c4045d"/> <c n="tree-sitter" ok="1" core_abi="15" cpp_grammar_abi="14" languages="27"/> -<c n="tracked-binaries" ok="1" tracked="5586" binaries="33" non_git="0" truncated="0" stale="0"/> -<c n="index-cache" ok="1" cache_version="54" parser_ver_lean="335" parser_ver_rich="336" artifact_arch="16" rich_verbs="for,uses,metrics,exemplar,context-ratio,nonlocal-state,quality-panel,verify,eval-retrieval,eval-mined,eval-skills" source="auto" lean_path="<tmp> … [line truncated: 219 more bytes on this line] +<c n="tracked-binaries" ok="1" tracked="5597" binaries="33" non_git="0" truncated="0" stale="0"/> +<c n="index-cache" ok="1" cache_version="54" parser_ver_lean="337" parser_ver_rich="338" artifact_arch="16" rich_verbs="for,uses,metrics,exemplar,context-ratio,nonlocal-state,quality-panel,verify,eval-retrieval,eval-mined,eval-skills" source="auto" lean_path="<tmp> … [line truncated: 219 more bytes on this line] <c n="git-config-trust" ok="1" fsmonitor="unset" neutralised="0" filter_drivers="0"/> <c n="layout" ok="1" state="agree" checked="1" units="2" types="12"/> <c n="claude-binary" ok="0" on_path="1" same_file="0" copied_heuristic="0" hint="reinstall the current build so Claude Code shell calls and this doctor resolve the same ripwire binary"/> @@ -4431,7 +4418,7 @@ $ ./build/ripwire . --skipped <!-- why=extent-suspect on an <h> row = the file holds extent_suspect_syms= definitions whose extent, scope or kind FAILED a containment check (the map and bundle rows carry the reasons as extent_suspect=: name, head, scope, error); joined to the parse-health reasons comma-separated, and rowed even when the parse itself is clean. extent_suspect_files= on the root counts such rows. Nothing is dropped. --> <!-- why=macro-blanked on an <h> row = this file's symbols come from a SECOND parse. Its first parse held error bytes, so macro_blanked= semicolon-less ALL-CAPS function-like macro invocations, each alone on its line directly inside a class/struct/union body (a shape the C-family grammars misread as a field missing its semicolon, letting one body swallow what follows it), were replaced by spaces with every offset and line unchanged, and that re-parse was adopted because it held STRICTLY FEWER error bytes; names, spans and bodies still read the original bytes. err=, err_ratio= and degraded-parse on such a row describe the ADOPTED parse: a row without degraded-parse parsed clean once blanked. A blanked invocation stays a use of the macro name for the uses verb (role=type, as the unrepaired parse recorded it) but is no call edge, and identifiers inside its parentheses are not recorded. macro_blanked_files= on the root counts such rows. Nothing is dropped. --> <!-- why=use-bounds-blanked on an <h> row = this Rust file's symbols come from a SECOND parse. Its first parse held error bytes, so use_bounds_blanked= precise-capturing bounds (a use<..> list on an impl Trait, which this build's Rust grammar predates) were replaced by spaces with every offset and line unchanged, and that re-parse was adopted because it held STRICTLY FEWER error bytes; names, spans and bodies still read the original bytes. A use<..> list names only generic parameters and lifetimes already in scope, so no definition, call or type use is lost. err=, err_ratio= and degraded-parse on such a row describe the ADOPTED parse. use_bounds_blanked_files= on the root counts such rows. Nothing is dropped. --> -<skipped indexed="4842" oversize="15" excluded="0" unsupported_ext="313" excluded_dirs="0" pruned_dirs="7" ignored="0" ignored_dirs="0" ignore_mode="git" degraded_parse="192" minified_suspect="4" extent_suspect_files="4" macro_blanked_files="7" use_bounds_blanked_files="2" unmeasured="41" max_file_s … [line truncated: 67 more bytes on this line] +<skipped indexed="4852" oversize="15" excluded="0" unsupported_ext="313" excluded_dirs="0" pruned_dirs="6" ignored="0" ignored_dirs="0" ignore_mode="git" degraded_parse="192" minified_suspect="4" extent_suspect_files="4" macro_blanked_files="7" use_bounds_blanked_files="2" unmeasured="41" max_file_s … [line truncated: 67 more bytes on this line] <f p="bench/locbench/full560.json" why="oversize" bytes="679702" limit="262144"/> <f p="bench/locbench/results/r1_anchorhop/heldout_baseline_release.json" why="oversize" bytes="365776" limit="262144"/> <f p="bench/locbench/results/r1_anchorhop/heldout_candidate_release.json" why="oversize" bytes="365761" limit="262144"/> @@ -4520,14 +4507,14 @@ $ ./build/ripwire . --rank-by=churn --top-k=5 <!-- t=modscope=a-file's-MODULE-SCOPE(n=<file-scope>):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 --> <!-- t=type|alias|functype=a-Go-named-type-by-its-written-form:type=a-defined-type-whose-WRITTEN-form-is-not-a-struct/iface/func-literal(type-N-string;type-W-Pair-too,whatever-Pair-is-underneath),alias=type-A=B,functype=type-F-func(...) --> <!-- t=alias|functype-in-C++-and-.h:alias=using-X=Y(also-templated-or-class-scope)or-namespace-L=lib(defs=X-prints-its-written-target-as-to=),functype=a-typedef-of-a-function-or-function-pointer-type(typedef-void(*F)(int));other-typedefs-read-t=struct --> -<!-- files=4842 symbols=44689 edges=44883 shown=5 est_tokens=1268 ambiguous=3960 unresolved=20090 locality_pinned=14 external=12459 declined=45292 extent_suspect_syms=12 macro_blanked_files=7 skipped_oversize=15 unindexed="txt:85,tsv:54,mod:33,xml:33,jsonl:26,scm:25" unindexed_exts=23 order=important-first --> -<r schema="ripwire.map/v1" at="ed47f82e8" root="." rank_by="churn" window="18mo@HEAD" est_tokens="1268" pr_iters="21"> +<!-- files=4852 symbols=45031 edges=45381 shown=5 est_tokens=1268 ambiguous=3984 unresolved=20100 locality_pinned=14 external=12460 declined=45307 extent_suspect_syms=12 macro_blanked_files=7 skipped_oversize=15 unindexed="txt:85,tsv:54,mod:33,xml:33,jsonl:26,scm:25" unindexed_exts=23 order=important-first --> +<r schema="ripwire.map/v1" at="914c4045d" root="." rank_by="churn" window="18mo@HEAD" est_tokens="1268" pr_iters="22"> <f p="src/resolve.h"> -<s t="method" n="appendUint" sc="Narrower" k="0.0039"> +<s t="method" n="appendUint" sc="Narrower" k="0.0038"> </s> </f> <f p="src/infra/enumcount.h" layer="infra"> -<s t="fn" n="enumTableAt" sc="rw" k="0.0033"> +<s t="fn" n="enumTableAt" sc="rw" k="0.0034"> </s> </f> ... [10 more line(s); run it to see the whole thing] @@ -4548,25 +4535,25 @@ a trailing slash is ignored; absolute paths and '..' are refused). The global <r **Try it** -_Scope the recent-changes answer to ONE directory. The global <recent> block stays byte-identical, a second <recent scope="src"> 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 <symbols stubbed="1" would_show= next=/> 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._ +_Scope the recent-changes answer to ONE directory. The global <recent> block stays byte-identical, a second <recent scope="src"> 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 <symbols stubbed="1" would_show= next=/> 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. This page holds 2 row(s), not the usual 3: no change window on this branch held enough src/ files for a larger page to cut, so the generator fell back to a smaller one (see chooseInWindow)._ ``` -$ ./build/ripwire . --rank-by=churn-decay --since=HEAD~9 --exclude=test --exclude=docs --exclude=skills --exclude=changelog.d --in=src --limit=3 +$ ./build/ripwire . --rank-by=churn-decay --since=HEAD~12 --exclude=test --exclude=docs --exclude=skills --exclude=changelog.d --in=src --limit=2 <!-- ripwire map schema=ripwire.map/v1: ranked symbol map: <f p= layer=> groups <s t= n= sc= k= amb=> rows (k= rank), <c n=> resolved callees; the header comment is data. window: capped= has_more= next_offset= (capped=1 cut; next_offset= pastes as offset=). est_tokens=: price as emitted (an upper bound under compact). at=: commit+dirty+shallow. root=: p= relative to it. rank_by=: the ranker behind k=. window=: the git span mined. declined=K: K calls left unbound (no evidence chose one def). external=K: K calls proven outside the tree, no edge. locality_pinned=K: K calls pinned by locality alone (a guess). <recent n= of=>: the n= newest-touched of of= touched files; <rc age_d=> days since its last commit, w= decayed weight. merge_bombs_skipped=N: N commits touching more than 100 INDEXED files skipped, uncounted; a file only they touched is absent; the window's count, so the global block only. <recent scope=DIR>: a second block riding when the global one does, DIR's files only (p= root-relative); of= is its total; capped=/has_more=/next_offset=/offset=/limit= page it, next= is that page. <symbols stubbed=1 would_show=N next=>: the symbol map in= did not ask for was not rendered; N is that run's own shown= — definitions counted individually as shown= counts them, so its rows follow from rows+sum(overloads-1)=shown (not the header's symbols= corpus count); next= fetches it. 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. next=: the one pasteable follow-up. --> <!-- t=modscope=a-file's-MODULE-SCOPE(n=<file-scope>):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 --> <!-- t=alias|functype-in-C++-and-.h:alias=using-X=Y(also-templated-or-class-scope)or-namespace-L=lib(defs=X-prints-its-written-target-as-to=),functype=a-typedef-of-a-function-or-function-pointer-type(typedef-void(*F)(int));other-typedefs-read-t=struct --> -<!-- files=645 symbols=22744 edges=30621 shown=0 est_tokens=1520 ambiguous=2740 unresolved=5501 locality_pinned=9 external=8322 declined=40015 skipped_oversize=15 unindexed="tsv:43,txt:26,scm:25,jsonl:23,expected:15,lock:7" unindexed_exts=12 order=important-first --> -<r schema="ripwire.map/v1" at="ed47f82e8" root="." rank_by="churn-decay" window="HEAD~9 half-life=90d" est_tokens="1520"> -<recent n="5" of="5" merge_bombs_skipped="0"> -<rc p="src/argtypepick.h" age_d="0" w="3"/> -<rc p="src/graph.h" age_d="0" w="1.99"/> -<rc p="src/resolve.h" age_d="0" w="1.99"/> -<rc p="src/ingest_cache.h" age_d="0" w="0.997"/> -<rc p="src/quality.h" age_d="0" w="0.997"/> +<!-- files=648 symbols=23039 edges=31083 shown=0 est_tokens=1467 ambiguous=2764 unresolved=5488 locality_pinned=9 external=8312 declined=40001 skipped_oversize=15 unindexed="tsv:43,txt:26,scm:25,jsonl:23,expected:15,lock:7" unindexed_exts=12 order=important-first --> +<r schema="ripwire.map/v1" at="914c4045d" root="." rank_by="churn-decay" window="HEAD~12 half-life=90d" est_tokens="1467"> +<recent n="3" of="3" merge_bombs_skipped="0"> +<rc p="src/serialize.h" age_d="0" w="6"/> +<rc p="src/lexical.h" age_d="0" w="3"/> +<rc p="src/ingest_sidecap.h" age_d="0" w="2"/> </recent> -<recent scope="src" n="3" of="5" capped="1" has_more="1" next_offset="3" offset="0" limit="3" next="--rank-by=churn-decay --since=HEAD~9 --exclude=test --exclude=docs --exclude=skills --exclude=changelog.d --in=src --offset=3 --limit=3"> -<rc p="src/argtypepick.h" age_d="0" w="3"/> -... [5 more line(s); run it to see the whole thing] +<recent scope="src" n="2" of="3" capped="1" has_more="1" next_offset="2" offset="0" limit="2" next="--rank-by=churn-decay --since=HEAD~12 --exclude=test --exclude=docs --exclude=skills --exclude=changelog.d --in=src --offset=2 --limit=2"> +<rc p="src/serialize.h" age_d="0" w="6"/> +<rc p="src/lexical.h" age_d="0" w="3"/> +</recent> +... [2 more line(s); run it to see the whole thing] ``` **Shaped by:** `--external-surface`, `--doctor`, `--legend`, `--max-memory` @@ -4627,8 +4614,8 @@ _The same gating report under --legend=full — same rows, same exit 2; the defa ``` $ ./build/ripwire . --quality-delta --legend=full -<!-- ripwire quality-delta: only what a change made WORSE against the floor baseline= names below. Descriptive: weigh and fix the real ones, do not game the number (a wrong abstraction beats a low score). THIRTEEN KINDS, and kind= on every row names which one: complexity over the ccx bar, verbosity (LOC), nesting, params, duplication, dead-code, api-surface (new public contract drift), error-masking, short-horizon-churn, new-clone-of-reused-helper, placeholder (added stub/TODO), defect-shape (defect= names it), tangle (a long function's nesting, deep share and steering locals; report-only). THREE independent axes, in this order: (1) acked findings are suppressed entirely (acked= counts them); (2) ORIGIN — a finding on a symbol that EXISTED at the baseline is preexisting-worse (no origin attribute), one that exists only because the code is NEW carries origin="new-symbol"; (3) MATERIALITY — a small numeric delta is sev="minor", and minor= counts them. EXIT 2 fires only on preexisting-worse AND major, the gating= count; new-symbol rows never gate, except defect-shape format-arity and a new function at the ceiling, so exit 0 is NOT a verdict on them — nothing that existed got worse, but the new debt is yours: read them. Clone kinds are new-symbol only when EVERY member is new; short-horizon-churn is preexisting by construction. preexisting-worse= and new-symbol= partition regressions=. stale= is a FOURTH axis, never gating and never counted in regressions=: rows in the .ripwire_quality_acks ledger whose target no longer applies. api-new-surface= COUNTS the new PUBLIC symbols (never gates, not in regressions=, printed even at zero). register-macro-excluded= is a FLOOR, not a finding: symbols this run excluded from the dead-code kind because their own definition is a registered self-registering test/benchmark macro call. Never gates, never counted in regressions=, printed even at zero (zero: none excluded, not a skipped check). A gating row's next= is the one pasteable follow-up: expand on FILE:NAME, the body to fix (a duplication row names a SET and carries none). bar= on a complexity/verbosity/nesting/params row is the threshold now= is judged against (ccx 15, loc 60, nest 4, params 5). baseline="git-HEAD" means no sidecar existed, so the working tree was auto-compared against the HEAD tree — anything already committed cannot appear. at= is the git commit (plus a dirty marker when the working tree differs) this list was computed at. The registered families are doctest/Catch2 TEST_CASE, GoogleTest TEST/TEST_F/TEST_P, Google Benchmark BENCHMARK, plus any name a .ripwire_config register_macros= line adds; each registers itself through a static initializer the call graph cannot see, so zero in-edges on one is not evidence of anything. Rust #[test] and #[tokio::test] functions count too: the test harness calls them, and no call in the tree names them. declined-call-excluded= is a FLOOR, not a finding: symbols this run kept out of the dead-code kind only because a call the resolver declined to bind (the map's declined=) could have meant them. Never gates; absent at zero. value-ref-excluded= is a FLOOR, not a finding: symbols this run kept out of the dead-code kind only because a table, field, argument or registering decorator holds them as a VALUE (matched by name; it is not a proven call; the callers verb lists the sites; @classmethod-style wrappers do not count), the --dead-code verb's own rule. Never gates; absent at zero. IDENTITY across a rename or a move: a finding is keyed path::scope::name, which a rename would destroy, so the baseline and the .ripwire_quality_acks ledger are both re-filed into the CURRENT tree's identity before either is read, by two EXACT mechanisms — git's own rename record, and equality of a whitespace-and-name-scrubbed body hash — never a similarity heuristic. renames= is how many rename pairs were read (with no ledger, only the uncommitted renames or the A..B range, and the family appears only when one was read), rename_window_commits= how deep the commit window went, acked_by_rename= and acked_by_content= how many of the acked= suppressions each mechanism is responsible for. Three appear ONLY when true, so an absent one is not a silent no: renames_window_truncated= (history is deeper than the window), renames_truncated= (the pair cap was hit), renames_ambiguous= (an ancestor two current symbols both claim — refused rather than guessed). ORIGIN reads the re-filed baseline too, so a regression carried in with a rename is judged preexisting-worse and GATES instead of slipping through as new-symbol. FLOORS, stated because silence here would read as a guarantee: the two clone kinds key on a member-SET hash and are NOT re-filed, so a clone ack still dies on a rename (a clone group itself is held across a file rename git recorded); ORIGIN follows the rename record and an unchanged body (whitespace and its own name aside): a function keeps its identity across a rename or move git recorded no rename for when its body did not change; one whose body also changed reads as new-symbol, or as moved (never gating) when it is over a bar and nearly unchanged. Each sa row carries key= (the ack identity as stored) and why=, which is target-gone (the key names no symbol or group any more) or finding-gone (the target survived, this kind just does not fire on it). sym= and p=path:line name WHICH ack it is, and are present exactly when the key still names a live symbol: on every finding-gone row, on none of the target-gone rows (there is nothing left to name), and on neither clone kind — a clone key hashes a member SET that no single symbol carries, so those rows are unnameable by construction rather than guessed at. Hygiene disclosure only — the ledger file is never auto-edited. ROWS: sym= is the canonical id the finding regressed on; was= and now= carry the before/after value for the numeric kinds; p="path:line" is the locator (root-relative; the first-sorting member for the clone kinds; omitted, never faked, when none resolves). churn= and surface= are per-kind classification facets (short-horizon-churn's self/ambient split; api-surface's new-symbol/contract-change tier). churn= facets never gate alone: the kind gates only on 2+ COMMITTED in-window rewrites of the edited lines. Every row the header's gating= counter counts also carries a gating attribute set to 1 — marked positively, never by the ABSENCE of sev or origin. CLONE ROWS name the whole group rather than one symbol: members= is the member list and tokens= its shared normalized-token count (the same per-group pair the clones verb reports). idiom= names a RECOGNIZED BODY SHAPE every member spells, from a closed set of five (threshold-ladder, switch-name-table, builder-chain, one-statement, call-sequence). idiom= alone changes nothing; a group that ALSO shares no non-keyword identifier between any two members, sits in pairwise-distinct enclosing contexts, and stays under 80 normalized tokens is an idiom COLLISION rather than a copy, and is reported minor instead of gating. Break any one of those and it gates as before, idiom= and all: two bucketing ladders over the SAME enum are a copy. The shape is read off the body's token stream and not a parse tree, so a macro-assembled body classifies as whatever its raw tokens spell — the name is printed so a reader can overrule it. --> -<quality-delta baseline="git-HEAD" regressions="9" minor="1" acked="0" stale="195" preexisting-worse="6" new-symbol="3" gating="5" register-macro-excluded="63" api-new-surface="2" at="ed47f82e8+dirty" renames="68" rename_window_commits="400" acked_by_rename="0" acked_by_content="0" renames_window_tr … [line truncated: 65 more bytes on this line] +<!-- ripwire quality-delta: only what a change made WORSE against the floor baseline= names below. Descriptive: weigh and fix the real ones, do not game the number (a wrong abstraction beats a low score). THIRTEEN KINDS, and kind= on every row names which one: complexity over the ccx bar, verbosity (LOC), nesting, params, duplication, dead-code, api-surface (new public contract drift), error-masking, short-horizon-churn, new-clone-of-reused-helper, placeholder (added stub/TODO), defect-shape (defect= names it), tangle (a long function's nesting, deep share and steering locals). THREE independent axes, in this order: (1) acked findings are suppressed entirely (acked= counts them); (2) ORIGIN — a finding on a symbol that EXISTED at the baseline is preexisting-worse (no origin attribute), one that exists only because the code is NEW carries origin="new-symbol"; (3) MATERIALITY — a small numeric delta is sev="minor", and minor= counts them. EXIT 2 fires only on preexisting-worse AND major, the gating= count; new-symbol rows never gate, except defect-shape format-arity, a new function at the ceiling and a tangled new function, so exit 0 is NOT a verdict on them — nothing that existed got worse, but the new debt is yours: read them. Clone kinds are new-symbol only when EVERY member is new; short-horizon-churn is preexisting by construction. preexisting-worse= and new-symbol= partition regressions=. stale= is a FOURTH axis, never gating and never counted in regressions=: rows in the .ripwire_quality_acks ledger whose target no longer applies. api-new-surface= COUNTS the new PUBLIC symbols (never gates, not in regressions=, printed even at zero). register-macro-excluded= is a FLOOR, not a finding: symbols this run excluded from the dead-code kind because their own definition is a registered self-registering test/benchmark macro call. Never gates, never counted in regressions=, printed even at zero (zero: none excluded, not a skipped check). A gating row's next= is the one pasteable follow-up: expand on FILE:NAME, the body to fix (a duplication row names a SET and carries none). bar= on a complexity/verbosity/nesting/params row is the threshold now= is judged against (ccx 15, loc 60, nest 4, params 5). baseline="git-HEAD" means no sidecar existed, so the working tree was auto-compared against the HEAD tree — anything already committed cannot appear. at= is the git commit (plus a dirty marker when the working tree differs) this list was computed at. The registered families are doctest/Catch2 TEST_CASE, GoogleTest TEST/TEST_F/TEST_P, Google Benchmark BENCHMARK, plus any name a .ripwire_config register_macros= line adds; each registers itself through a static initializer the call graph cannot see, so zero in-edges on one is not evidence of anything. Rust #[test] and #[tokio::test] functions count too: the test harness calls them, and no call in the tree names them. declined-call-excluded= is a FLOOR, not a finding: symbols this run kept out of the dead-code kind only because a call the resolver declined to bind (the map's declined=) could have meant them. Never gates; absent at zero. value-ref-excluded= is a FLOOR, not a finding: symbols this run kept out of the dead-code kind only because a table, field, argument or registering decorator holds them as a VALUE (matched by name; it is not a proven call; the callers verb lists the sites; @classmethod-style wrappers do not count), the --dead-code verb's own rule. Never gates; absent at zero. IDENTITY across a rename or a move: a finding is keyed path::scope::name, which a rename would destroy, so the baseline and the .ripwire_quality_acks ledger are both re-filed into the CURRENT tree's identity before either is read, by two EXACT mechanisms — git's own rename record, and equality of a whitespace-and-name-scrubbed body hash — never a similarity heuristic. renames= is how many rename pairs were read (with no ledger, only the uncommitted renames or the A..B range, and the family appears only when one was read), rename_window_commits= how deep the commit window went, acked_by_rename= and acked_by_content= how many of the acked= suppressions each mechanism is responsible for. Three appear ONLY when true, so an absent one is not a silent no: renames_window_truncated= (history is deeper than the window), renames_truncated= (the pair cap was hit), renames_ambiguous= (an ancestor two current symbols both claim — refused rather than guessed). ORIGIN reads the re-filed baseline too, so a regression carried in with a rename is judged preexisting-worse and GATES instead of slipping through as new-symbol. FLOORS, stated because silence here would read as a guarantee: the two clone kinds key on a member-SET hash and are NOT re-filed, so a clone ack still dies on a rename (a clone group itself is held across a file rename git recorded); ORIGIN follows the rename record and an unchanged body (whitespace and its own name aside): a function keeps its identity across a rename or move git recorded no rename for when its body did not change; one whose body also changed reads as new-symbol, or as moved (never gating) when it is over a bar and nearly unchanged. Each sa row carries key= (the ack identity as stored) and why=, which is target-gone (the key names no symbol or group any more) or finding-gone (the target survived, this kind just does not fire on it). sym= and p=path:line name WHICH ack it is, and are present exactly when the key still names a live symbol: on every finding-gone row, on none of the target-gone rows (there is nothing left to name), and on neither clone kind — a clone key hashes a member SET that no single symbol carries, so those rows are unnameable by construction rather than guessed at. Hygiene disclosure only — the ledger file is never auto-edited. ROWS: sym= is the canonical id the finding regressed on; was= and now= carry the before/after value for the numeric kinds; p="path:line" is the locator (root-relative; the first-sorting member for the clone kinds; omitted, never faked, when none resolves). churn= and surface= are per-kind classification facets (short-horizon-churn's self/ambient split; api-surface's new-symbol/contract-change tier). churn= facets never gate alone: the kind gates only on 2+ COMMITTED in-window rewrites of the edited lines. Every row the header's gating= counter counts also carries a gating attribute set to 1 — marked positively, never by the ABSENCE of sev or origin. CLONE ROWS name the whole group rather than one symbol: members= is the member list and tokens= its shared normalized-token count (the same per-group pair the clones verb reports). idiom= names a RECOGNIZED BODY SHAPE every member spells, from a closed set of five (threshold-ladder, switch-name-table, builder-chain, one-statement, call-sequence). idiom= alone changes nothing; a group that ALSO shares no non-keyword identifier between any two members, sits in pairwise-distinct enclosing contexts, and stays under 80 normalized tokens is an idiom COLLISION rather than a copy, and is reported minor instead of gating. Break any one of those and it gates as before, idiom= and all: two bucketing ladders over the SAME enum are a copy. The shape is read off the body's token stream and not a parse tree, so a macro-assembled body classifies as whatever its raw tokens spell — the name is printed so a reader can overrule it. --> +<quality-delta baseline="git-HEAD" regressions="9" minor="1" acked="0" stale="202" preexisting-worse="6" new-symbol="3" gating="5" register-macro-excluded="63" api-new-surface="2" at="914c4045d+dirty" renames="68" rename_window_commits="400" acked_by_rename="0" acked_by_content="0" renames_window_tr … [line truncated: 65 more bytes on this line] <r kind="api-surface" sym="src/infra/sortutil.h::rw::sortutil::nonNegativeFloatDescKey" was="1" now="2" surface="contract-change" p="src/infra/sortutil.h:122" gating="1" next="--expand=src/infra/sortutil.h:nonNegativeFloatDescKey"/> <r kind="complexity" sym="src/infra/sortutil.h::rw::sortutil::lessByScoreDescId" was="1" now="67" bar="15" p="src/infra/sortutil.h:62" gating="1" next="--expand=src/infra/sortutil.h:lessByScoreDescId"/> <r kind="dead-code" sym="src/infra/sortutil.h::rw::sortutil::nonNegativeFloatAscKeyCopy" origin="new-symbol" p="src/infra/sortutil.h:132"/> @@ -4723,7 +4710,7 @@ _The family join: per function, which of four orthogonal evidence families fire, ``` $ ./build/ripwire . --ensemble --limit=8 <!-- ripwire ensemble schema=ripwire.ensemble/v1: four orthogonal evidence families joined, ranked by DISTINCT families fired (no composite score): <s p= n= fam= of= fired=>. window: total= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). syms_capped=/files_capped=: 1 = cut. at=: commit+dirty+shallow. root=: p= relative to it. eligible=N: functions and methods with a body, the denominator; ranked + no_family = eligible. no_family=N: eligible symbols where no family fired. bar_ccx=/bar_loc=/bar_nest=/bar_params=: absolute structural bars: cognitive cx, lines, nesting, params. rcut=N: ranks the worst readability decile covers (1 to 40); rrank= inside it fires structural. rmeasured=N: functions the readability lens measured. hcut=N: file ranks the worst churn decile covers (1 to 40); hrank= inside it fires historical. hranked=N: files with any in-window commit; 0 = historical family unavailable. cfiles=N: indexed files the confusion (atom) pack can read: C/C++/ObjC/CUDA. cscope=N: eligible symbols in those files; 0 = confusion family unavailable. lscope=N: eligible symbols in a language the naming pack reads; 0 = lexical family unavailable. shown_syms=N: symbol rows printed; the rest page with offset=next_offset. shown_files=N: file rows printed (fixed cap 20, not paged); files_capped=1 = rows dropped. e f=: the fired family: structural, lexical, confusion or historical. why=: the measurements that crossed, space separated; rule*N = that rule fired N times. top=: the file's most corroborated symbol (most families on one symbol). top_l=: that symbol's line. top_fam=N: families fired on top=, the stronger claim; file rows rank by it. union_fam=N: distinct families firing anywhere in the file (weaker: may be different symbols). union=: the names of those families. syms=N: symbols in the file where at least one family fired. families=N: evidence families joined; ranked=N: symbols at least one fired on; window=: the git span the historical family read. --> -<ensemble schema="ripwire.ensemble/v1" families="4" eligible="25060" ranked="9270" no_family="15790" bar_ccx="15" bar_loc="60" bar_nest="4" bar_params="5" rcut="40" rmeasured="25060" hcut="40" hranked="4842" window="12mo" cfiles="1127" cscope="13886" lscope="25060" shown_syms="8" syms_capped="1" sho … [line truncated: 118 more bytes on this line] +<ensemble schema="ripwire.ensemble/v1" families="4" eligible="25297" ranked="9452" no_family="15845" bar_ccx="15" bar_loc="60" bar_nest="4" bar_params="5" rcut="40" rmeasured="25297" hcut="40" hranked="4852" window="12mo" cfiles="1130" cscope="14092" lscope="25297" shown_syms="8" syms_capped="1" sho … [line truncated: 118 more bytes on this line] <s p="src/gitmine.h:1797" n="addRootFilesToGitPathIndex" fam="4" of="4" fired="structural,lexical,confusion,historical"> <e f="structural" why="ccx=25 ev=6"/> <e f="lexical" why="naming-wordy"/> @@ -4734,7 +4721,7 @@ $ ./build/ripwire . --ensemble --limit=8 <e f="structural" why="ccx=24 ev=2"/> <e f="lexical" why="naming-confusable"/> <e f="confusion" why="atom-nested-ternary*4"/> -<e f="historical" why="hrank=19 churn=241"/> +<e f="historical" why="hrank=19 churn=242"/> </s> ... [17 more line(s); run it to see the whole thing] ``` @@ -4761,8 +4748,8 @@ $ ./build/ripwire . --exclude=present --exclude=bench --top-k=5 <!-- t=modscope=a-file's-MODULE-SCOPE(n=<file-scope>):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 --> <!-- t=type|alias|functype=a-Go-named-type-by-its-written-form:type=a-defined-type-whose-WRITTEN-form-is-not-a-struct/iface/func-literal(type-N-string;type-W-Pair-too,whatever-Pair-is-underneath),alias=type-A=B,functype=type-F-func(...) --> <!-- t=alias|functype-in-C++-and-.h:alias=using-X=Y(also-templated-or-class-scope)or-namespace-L=lib(defs=X-prints-its-written-target-as-to=),functype=a-typedef-of-a-function-or-function-pointer-type(typedef-void(*F)(int));other-typedefs-read-t=struct --> -<!-- files=4571 symbols=40330 edges=43354 shown=5 est_tokens=4067 ambiguous=3907 unresolved=19135 locality_pinned=14 external=9816 declined=42905 extent_suspect_syms=12 macro_blanked_files=7 unindexed="txt:64,mod:33,xml:33,scm:25,tsv:11,cmake:5" unindexed_exts=18 order=important-first --> -<r schema="ripwire.map/v1" root="." est_tokens="4067" pr_iters="38"> +<!-- files=4581 symbols=40657 edges=43844 shown=5 est_tokens=4096 ambiguous=3931 unresolved=19137 locality_pinned=14 external=9813 declined=42896 extent_suspect_syms=12 macro_blanked_files=7 unindexed="txt:64,mod:33,xml:33,scm:25,tsv:11,cmake:5" unindexed_exts=18 order=important-first --> +<r schema="ripwire.map/v1" root="." est_tokens="4096" pr_iters="38"> <f p="src/infra/nodekind.h" layer="infra"> <s t="fn" n="kindIs" sc="rw" k="0.0034"> </s> @@ -4792,10 +4779,10 @@ $ ./build/ripwire . --map-diff --top-k=5 <!-- t=modscope=a-file's-MODULE-SCOPE(n=<file-scope>):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 --> <!-- t=type|alias|functype=a-Go-named-type-by-its-written-form:type=a-defined-type-whose-WRITTEN-form-is-not-a-struct/iface/func-literal(type-N-string;type-W-Pair-too,whatever-Pair-is-underneath),alias=type-A=B,functype=type-F-func(...) --> <!-- t=alias|functype-in-C++-and-.h:alias=using-X=Y(also-templated-or-class-scope)or-namespace-L=lib(defs=X-prints-its-written-target-as-to=),functype=a-typedef-of-a-function-or-function-pointer-type(typedef-void(*F)(int));other-typedefs-read-t=struct --> -<!-- files=4842 symbols=44689 edges=44883 shown=5 est_tokens=1322 ambiguous=3960 unresolved=20090 locality_pinned=14 external=12459 declined=45292 extent_suspect_syms=12 macro_blanked_files=7 changed=0 skipped_oversize=15 unindexed="txt:85,tsv:54,mod:33,xml:33,jsonl:26,scm:25" unindexed_exts=23 order=important-first --> -<r schema="ripwire.map-diff/v1" at="ed47f82e8" root="." est_tokens="1322" pr_iters="38"> +<!-- files=4852 symbols=45031 edges=45381 shown=5 est_tokens=1322 ambiguous=3984 unresolved=20100 locality_pinned=14 external=12460 declined=45307 extent_suspect_syms=12 macro_blanked_files=7 changed=0 skipped_oversize=15 unindexed="txt:85,tsv:54,mod:33,xml:33,jsonl:26,scm:25" unindexed_exts=23 order=important-first --> +<r schema="ripwire.map-diff/v1" at="914c4045d" root="." est_tokens="1322" pr_iters="37"> <f p="src/infra/nodekind.h" layer="infra"> -<s t="fn" n="kindIs" sc="rw" k="0.0031"> +<s t="fn" n="kindIs" sc="rw" k="0.0032"> </s> </f> <f p="src/ingest_metrics.h"> @@ -4826,10 +4813,10 @@ $ ./build/ripwire . --cache=<scratch>/aux/warm2.ripwirecache --top-k=3 <!-- t=modscope=a-file's-MODULE-SCOPE(n=<file-scope>):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 --> <!-- t=type|alias|functype=a-Go-named-type-by-its-written-form:type=a-defined-type-whose-WRITTEN-form-is-not-a-struct/iface/func-literal(type-N-string;type-W-Pair-too,whatever-Pair-is-underneath),alias=type-A=B,functype=type-F-func(...) --> <!-- t=alias|functype-in-C++-and-.h:alias=using-X=Y(also-templated-or-class-scope)or-namespace-L=lib(defs=X-prints-its-written-target-as-to=),functype=a-typedef-of-a-function-or-function-pointer-type(typedef-void(*F)(int));other-typedefs-read-t=struct --> -<!-- files=4842 symbols=44689 edges=44883 shown=3 est_tokens=4060 ambiguous=3960 unresolved=20090 locality_pinned=14 external=12459 declined=45292 extent_suspect_syms=12 macro_blanked_files=7 skipped_oversize=15 unindexed="txt:85,tsv:54,mod:33,xml:33,jsonl:26,scm:25" unindexed_exts=23 order=important-first --> -<r schema="ripwire.map/v1" root="." est_tokens="4060" pr_iters="38"> +<!-- files=4852 symbols=45031 edges=45381 shown=3 est_tokens=4089 ambiguous=3984 unresolved=20100 locality_pinned=14 external=12460 declined=45307 extent_suspect_syms=12 macro_blanked_files=7 skipped_oversize=15 unindexed="txt:85,tsv:54,mod:33,xml:33,jsonl:26,scm:25" unindexed_exts=23 order=important-first --> +<r schema="ripwire.map/v1" root="." est_tokens="4089" pr_iters="37"> <f p="src/infra/nodekind.h" layer="infra"> -<s t="fn" n="kindIs" sc="rw" k="0.0031"> +<s t="fn" n="kindIs" sc="rw" k="0.0032"> </s> </f> <f p="src/ingest_metrics.h"> @@ -4876,10 +4863,10 @@ $ ./build/ripwire . --no-cache --top-k=3 <!-- t=modscope=a-file's-MODULE-SCOPE(n=<file-scope>):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 --> <!-- t=type|alias|functype=a-Go-named-type-by-its-written-form:type=a-defined-type-whose-WRITTEN-form-is-not-a-struct/iface/func-literal(type-N-string;type-W-Pair-too,whatever-Pair-is-underneath),alias=type-A=B,functype=type-F-func(...) --> <!-- t=alias|functype-in-C++-and-.h:alias=using-X=Y(also-templated-or-class-scope)or-namespace-L=lib(defs=X-prints-its-written-target-as-to=),functype=a-typedef-of-a-function-or-function-pointer-type(typedef-void(*F)(int));other-typedefs-read-t=struct --> -<!-- files=4842 symbols=44689 edges=44883 shown=3 est_tokens=4060 ambiguous=3960 unresolved=20090 locality_pinned=14 external=12459 declined=45292 extent_suspect_syms=12 macro_blanked_files=7 skipped_oversize=15 unindexed="txt:85,tsv:54,mod:33,xml:33,jsonl:26,scm:25" unindexed_exts=23 order=important-first --> -<r schema="ripwire.map/v1" root="." est_tokens="4060" pr_iters="38"> +<!-- files=4852 symbols=45031 edges=45381 shown=3 est_tokens=4089 ambiguous=3984 unresolved=20100 locality_pinned=14 external=12460 declined=45307 extent_suspect_syms=12 macro_blanked_files=7 skipped_oversize=15 unindexed="txt:85,tsv:54,mod:33,xml:33,jsonl:26,scm:25" unindexed_exts=23 order=important-first --> +<r schema="ripwire.map/v1" root="." est_tokens="4089" pr_iters="37"> <f p="src/infra/nodekind.h" layer="infra"> -<s t="fn" n="kindIs" sc="rw" k="0.0031"> +<s t="fn" n="kindIs" sc="rw" k="0.0032"> </s> </f> <f p="src/ingest_metrics.h"> @@ -4907,10 +4894,10 @@ $ ./build/ripwire . --no-ignore --top-k=3 <!-- t=modscope=a-file's-MODULE-SCOPE(n=<file-scope>):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 --> <!-- t=type|alias|functype=a-Go-named-type-by-its-written-form:type=a-defined-type-whose-WRITTEN-form-is-not-a-struct/iface/func-literal(type-N-string;type-W-Pair-too,whatever-Pair-is-underneath),alias=type-A=B,functype=type-F-func(...) --> <!-- t=alias|functype-in-C++-and-.h:alias=using-X=Y(also-templated-or-class-scope)or-namespace-L=lib(defs=X-prints-its-written-target-as-to=),functype=a-typedef-of-a-function-or-function-pointer-type(typedef-void(*F)(int));other-typedefs-read-t=struct --> -<!-- files=4842 symbols=44689 edges=44883 shown=3 est_tokens=4060 ambiguous=3960 unresolved=20090 locality_pinned=14 external=12459 declined=45292 extent_suspect_syms=12 macro_blanked_files=7 skipped_oversize=15 unindexed="txt:85,tsv:54,mod:33,xml:33,jsonl:26,scm:25" unindexed_exts=23 order=important-first --> -<r schema="ripwire.map/v1" root="." est_tokens="4060" pr_iters="38"> +<!-- files=4852 symbols=45031 edges=45381 shown=3 est_tokens=4089 ambiguous=3984 unresolved=20100 locality_pinned=14 external=12460 declined=45307 extent_suspect_syms=12 macro_blanked_files=7 skipped_oversize=15 unindexed="txt:85,tsv:54,mod:33,xml:33,jsonl:26,scm:25" unindexed_exts=23 order=important-first --> +<r schema="ripwire.map/v1" root="." est_tokens="4089" pr_iters="37"> <f p="src/infra/nodekind.h" layer="infra"> -<s t="fn" n="kindIs" sc="rw" k="0.0031"> +<s t="fn" n="kindIs" sc="rw" k="0.0032"> </s> </f> <f p="src/ingest_metrics.h"> @@ -4943,14 +4930,14 @@ $ ./build/ripwire . --max-file-size=8K --top-k=3 <!-- t=modscope=a-file's-MODULE-SCOPE(n=<file-scope>):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 --> <!-- t=type|alias|functype=a-Go-named-type-by-its-written-form:type=a-defined-type-whose-WRITTEN-form-is-not-a-struct/iface/func-literal(type-N-string;type-W-Pair-too,whatever-Pair-is-underneath),alias=type-A=B,functype=type-F-func(...) --> <!-- t=alias|functype-in-C++-and-.h:alias=using-X=Y(also-templated-or-class-scope)or-namespace-L=lib(defs=X-prints-its-written-target-as-to=),functype=a-typedef-of-a-function-or-function-pointer-type(typedef-void(*F)(int));other-typedefs-read-t=struct --> -<!-- files=3580 symbols=14068 edges=4646 shown=3 est_tokens=2003 ambiguous=387 unresolved=1204 locality_pinned=5 external=1256 declined=1468 extent_suspect_syms=12 macro_blanked_files=7 skipped_oversize=1277 unindexed="txt:85,tsv:54,mod:33,xml:33,jsonl:26,scm:25" unindexed_exts=23 order=important-first --> -<r schema="ripwire.map/v1" root="." est_tokens="2003" pr_iters="38"> +<!-- files=3587 symbols=14120 edges=4669 shown=3 est_tokens=2016 ambiguous=387 unresolved=1221 locality_pinned=5 external=1256 declined=1485 extent_suspect_syms=12 macro_blanked_files=7 skipped_oversize=1280 unindexed="txt:85,tsv:54,mod:33,xml:33,jsonl:26,scm:25" unindexed_exts=23 order=important-first --> +<r schema="ripwire.map/v1" root="." est_tokens="2016" pr_iters="38"> <f p="test/forcallerhopfix/d2inherit/pycap/m.py" layer="test"> <s t="fn" n="post_entry" sc="Ledger" k="0.0017"> </s> </f> <f p="test/forcallerhopfix/c/fan.c" layer="test"> -<s t="fn" n="fan_target" k="0.0017"> +<s t="fn" n="fan_target" k="0.0016"> </s> </f> ... [17 more line(s); run it to see the whole thing] @@ -5023,10 +5010,10 @@ $ ./build/ripwire . --pin-census=<scratch>/aux/pin_census.tsv --top-k=3 <!-- t=modscope=a-file's-MODULE-SCOPE(n=<file-scope>):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 --> <!-- t=type|alias|functype=a-Go-named-type-by-its-written-form:type=a-defined-type-whose-WRITTEN-form-is-not-a-struct/iface/func-literal(type-N-string;type-W-Pair-too,whatever-Pair-is-underneath),alias=type-A=B,functype=type-F-func(...) --> <!-- t=alias|functype-in-C++-and-.h:alias=using-X=Y(also-templated-or-class-scope)or-namespace-L=lib(defs=X-prints-its-written-target-as-to=),functype=a-typedef-of-a-function-or-function-pointer-type(typedef-void(*F)(int));other-typedefs-read-t=struct --> -<!-- files=4842 symbols=44689 edges=44883 shown=3 est_tokens=4060 ambiguous=3960 unresolved=20090 locality_pinned=14 external=12459 declined=45292 extent_suspect_syms=12 macro_blanked_files=7 skipped_oversize=15 unindexed="txt:85,tsv:54,mod:33,xml:33,jsonl:26,scm:25" unindexed_exts=23 order=important-first --> -<r schema="ripwire.map/v1" root="." est_tokens="4060" pr_iters="38"> +<!-- files=4852 symbols=45031 edges=45381 shown=3 est_tokens=4089 ambiguous=3984 unresolved=20100 locality_pinned=14 external=12460 declined=45307 extent_suspect_syms=12 macro_blanked_files=7 skipped_oversize=15 unindexed="txt:85,tsv:54,mod:33,xml:33,jsonl:26,scm:25" unindexed_exts=23 order=important-first --> +<r schema="ripwire.map/v1" root="." est_tokens="4089" pr_iters="37"> <f p="src/infra/nodekind.h" layer="infra"> -<s t="fn" n="kindIs" sc="rw" k="0.0031"> +<s t="fn" n="kindIs" sc="rw" k="0.0032"> </s> </f> <f p="src/ingest_metrics.h"> @@ -5048,7 +5035,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.107+ged47f82e8"},"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.110+g914c4045d"},"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] @@ -5074,11 +5061,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.107+ged47f82e8"},"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":"<!-- ripwire whereis schema=ripwire.whereis/v1: every LOCAL ref whose tree holds sym= (refs_scanned=, blobs=), HEAD first: <hit ref= tip= date= p= l= kind= t=>. window: shown= total= capped= has_more= next_offset= offset= limit= (ca … [line truncated: 13902 more bytes on this line] -"_index":"[index: files=4842 symbols=44690 hash=cf158cec]","_fresh":"ok"}} +{"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2025-11-25","serverInfo":{"name":"ripwire","version":"0.6.10-dev.110+g914c4045d"},"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":"<!-- ripwire whereis schema=ripwire.whereis/v1: every LOCAL ref whose tree holds sym= (refs_scanned=, blobs=), HEAD first: <hit ref= tip= date= p= l= kind= t=>. window: shown= total= capped= has_more= next_offset= offset= limit= (ca … [line truncated: 20711 more bytes on this line] +"_index":"[index: files=4852 symbols=45032 hash=8e5a0414]","_fresh":"ok"}} {"jsonrpc":"2.0","id":3,"result":{"content":[{"type":"text","text":"<!-- ripwire whereis schema=ripwire.whereis/v1: every LOCAL ref whose tree holds sym= (refs_scanned=, blobs=), HEAD first: <hit ref= tip= date= p= l= kind= t=>. window: shown= capped= (capped=1 cut). at=: commit+dirty+shallow. next= … [line truncated: 2425 more bytes on this line] -"_index":"[index: files=4842 symbols=44690 hash=cf158cec]","_fresh":"ok"}} +"_index":"[index: files=4852 symbols=45032 hash=8e5a0414]","_fresh":"ok"}} ``` ### `--mcp-tools=LIST` @@ -5093,9 +5080,9 @@ _--mcp-tools=core: the server lists only the core profile's tools (explore, batc ``` $ ./build/ripwire '%s\n' '{"jsonrpc":"2.0","id":1,"method":"initialize"}' '{"jsonrpc":"2.0","id":2,"method":"tools/list"}' | ./build/ripwire --mcp --mcp-tools=core -{"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2025-11-25","serverInfo":{"name":"ripwire","version":"0.6.10-dev.107+ged47f82e8"},"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.110+g914c4045d"},"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: 870 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: 869 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] ... [5 more line(s); run it to see the whole thing] ``` @@ -5182,14 +5169,14 @@ _Self-eval: co-change recall vs BM25._ $ ./build/ripwire . --eval ripwire --eval (co-change recovery, averaged over 80 historical commits) ranker recall@5 recall@10 recall@20 - ripwire 10.2% 10.3% 17.3% - BM25 12.1% 14.7% 16.6% - BM25sub 12.5% 15.4% 19.5% - BM25body 9.0% 12.8% 22.9% - fused 8.6% 11.9% 19.1% - anchored 9.0% 12.8% 21.1% - same-dir 1.2% 1.4% 2.4% - random 0.1% 0.2% 0.4% <- floor (random ranking over F=4842 files) + ripwire 5.8% 6.0% 12.0% + BM25 9.0% 9.8% 11.6% + BM25sub 10.1% 11.3% 12.8% + BM25body 10.1% 14.5% 27.4% + fused 3.8% 9.2% 16.9% + anchored 9.9% 14.5% 25.3% + same-dir 0.8% 0.8% 2.1% + random 0.1% 0.2% 0.4% <- floor (random ranking over F=4852 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 / @@ -5212,19 +5199,19 @@ _Known-item retrieval eval: MRR + recall@k per ranker per query mode._ ``` $ ./build/ripwire . --eval-retrieval ripwire --eval-retrieval (known-item, 4000 doc-commented symbols; gold is in-corpus by construction) - sample: population=12148 scored=4000 rule=smallest-key CAPPED — a SUBSET, not the population + sample: population=12348 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.659 52.6% 82.2% 87.4% - subtoken doc-phrase 0.882 85.9% 90.3% 91.4% - name-exact name 0.876 79.6% 93.8% 96.1% + subtoken name 0.658 52.3% 82.2% 87.4% + subtoken doc-phrase 0.883 86.0% 90.4% 91.5% + name-exact name 0.877 79.7% 93.9% 96.1% name-exact doc-phrase 0.008 0.3% 1.1% 1.6% - anchored name 0.664 53.8% 81.0% 86.0% - anchored doc-phrase 0.875 85.0% 89.9% 90.7% - routed name 0.878 79.8% 93.9% 96.3% - routed doc-phrase 0.880 85.9% 90.0% 91.2% + anchored name 0.663 53.7% 81.0% 86.0% + anchored doc-phrase 0.876 85.1% 90.0% 90.8% + routed name 0.879 79.9% 94.0% 96.3% + routed doc-phrase 0.881 86.0% 90.2% 91.2% ... [6 more line(s); run it to see the whole thing] ``` @@ -5270,7 +5257,7 @@ _Version + short build info._ ``` $ ./build/ripwire --version -ripwire 0.6.10-dev.107+ged47f82e8 (dev, AppleClang 21.0.0.21000101, emit=std::print, built_from=ed47f82e8) +ripwire 0.6.10-dev.110+g914c4045d (dev, AppleClang 21.0.0.21000101, emit=std::print, built_from=914c4045d) ``` **Shaped by:** `--verify`, `--no-redact`, `--metrics`, `--deps`, `--naming-locals`, `--arch`, `--dry-run`, `--flags` diff --git a/docs/captures/COMMANDS_showcase_2026-11-22.md b/docs/captures/COMMANDS_showcase_2026-11-22.md new file mode 100644 index 000000000..8ff359281 --- /dev/null +++ b/docs/captures/COMMANDS_showcase_2026-11-22.md @@ -0,0 +1,7881 @@ +# ripwire — every verb, run for real + +- **Date:** 2026-11-22 (regenerated capture; supersedes any older `docs/captures/COMMANDS_showcase_*.md`) +- **Lives in `docs/captures/`** — a directory the crawl/retrieval lenses SKIP (`kCrawlSkipDirs`, src/ingest.h): a generated doc that quotes every verb's output out-scores the source for any query about the tool and was measured at 77% of `--recall` on this repo when it sat at the root. `test/argvdiffcheck.sh` harvests its `## `-heading command lines as differential vectors — keep that format. +- **Version:** `ripwire 0.6.10-dev.110+g914c4045d (dev, AppleClang 21.0.0.21000101, emit=std::print, built_from=914c4045d)` +- **Repo:** the ripwire repo @ `914c4045d` — **CLEAN — `git status --porcelain` is empty**. The diff-aware verbs (`--situ`/`--test-gate`/`--quality-delta`/`--pr-context`/`--map-diff`/`--edit-check`) answer a question about the WORKING TREE, so that condition is part of their answer and every one of their captions below states which tree it recorded against. A clean tree is the honest default for a showcase, so they appear TWICE: once here on the clean tree (their empty/exit-0 shape) and once in the final section against a throwaway `git clone --local` sandbox carrying one deliberate regression, so their real gating shapes are visible without writing a byte into the read-only repo. +- **Corpus:** the ripwire repo itself (dogfood), via `./build/ripwire` +- **Sandbox diff** (the last section only): `.ripwire_notes | 2 ++ + .ripwire_quality_acks | 1 + + src/infra/sortutil.h | 31 ++++++++++++++++++++++++++++--- + 3 files changed, 31 insertions(+), 3 deletions(-)` — one preexisting function made deeply nested, one function's arity changed 1 -> 2, one copy-paste duplicate helper, one new 8-parameter public function. + +**How to read the blocks:** ripwire's real XML output is minified — often ONE long line. For scanability, long minified lines are displayed re-wrapped with a line break at every tag seam (`><`). Header COMMENT lines (the legends) always appear in full — they are exempt from the per-line cut; any OTHER display line over 300 bytes is cut with a `… [line truncated: N more bytes]` marker, which can hit a long root element or row. `--plan-lanes` emits JSON and is re-wrapped at object seams the same way. Long outputs are cut to their first ~30 display lines with a `… [N more display lines; full output is M bytes]` marker giving the true size. Exit codes are recorded when non-zero; wall time when >1s. + +**Not run (and why):** `ripwire <git-url>` (network clone), `--legend-have` (a per-CALLER handshake — the caller names the legend dictionary version it already holds — so a one-shot capture has nothing to hold and nothing to show; gated by `test/legendhavecheck.sh`), `--listen` / `--mcp-token` / `--allow-remote-edits` (the HTTP-server posture; `--mcp` itself IS captured in its own section as a one-shot stdio JSON-RPC exchange, and `wrap claude` shows the wiring), `--arch --baseline[-update]` (state writer against the read-only repo — `--note-add` / `--quality-baseline` / `--quality-ack` / the three edit verbs / `--edit-plan` ARE shown, inside the throwaway sandbox clone; `--index-out` / `--pin-census` write to scratch), `--eval-mined` (needs a `minedpair.jsonl` artifact from `bench/mine_traces.py`; none present in the tree), `--refetch` (git-url only), `--lsp` / `--lsp-langmap` (the editor transport and its language-map config — their one-shot dialogues, including every map and hint arm, are gated by `test/lspcheck.sh`, not by showcase blocks), `--max-memory` (the memory guard is silent on this repo by construction; its stops are gated by `test/memguardcheck.sh`), `--force` (wrap-only modifier), `--deadline-ms` (a timing modifier on `--help-task`: a warm index prints exactly the `--help-task` blocks shown only when it finishes within the deadline (a warm run past it abstains as well), and the cold abstention depends on wall-clock timing; gated by `test/helptaskdeadlinecheck.sh`), `--scan-skills` bare form (would sweep `~/.claude/skills`; the explicit-DIR form is shown instead), `--help` (217 lines — read it from the binary). + + +--- + +# understand a codebase cold + +## `./build/ripwire .` + +*The default ranked symbol map — start here when landing cold in a repo.* + +**wall time: 2.84s** + +````` +<!-- ripwire map schema=ripwire.map/v1: ranked symbol map: <f p= layer=> groups <s t= n= sc= k= amb=> rows (k= rank), <c n=> resolved callees; the header comment is data. est_tokens=: price as emitted (an upper bound under compact). root=: p= relative to it. pr_iters=N: PageRank iterations. data_sections_cut=N: N data Sections (headings, data keys) swapped out of this top-K for lower-ranked code rows; next= pages them first. <inv listed= unlisted=>: files the ranked rows show / do not (sum = files=), each named or counted below. <entry p= n=>: 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. <ls p= n= f=>: 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. overloads=N: N same-name defs merged in this row; shown= counts each. prov=scip|binding|import|split|final-segment: how that <c> 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. <c via="name">: that callee matched by name alone (receiver unproven); it does NOT mean the edge is false. <c x=N>: N same-named via=name rows merged; callees=FILE:SYM lists all. sc=: enclosing scope; the full id is p::sc::n (p= of the row or its <f>) and selectors take it. amb=K: K calls split over several defs. next=: the one pasteable follow-up. --> +<!-- t=modscope=a-file's-MODULE-SCOPE(n=<file-scope>):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 --> +<!-- t=type|alias|functype=a-Go-named-type-by-its-written-form:type=a-defined-type-whose-WRITTEN-form-is-not-a-struct/iface/func-literal(type-N-string;type-W-Pair-too,whatever-Pair-is-underneath),alias=type-A=B,functype=type-F-func(...) --> +<!-- t=alias|functype-in-C++-and-.h:alias=using-X=Y(also-templated-or-class-scope)or-namespace-L=lib(defs=X-prints-its-written-target-as-to=),functype=a-typedef-of-a-function-or-function-pointer-type(typedef-void(*F)(int));other-typedefs-read-t=struct --> +<!-- stem="1": the class/struct/interface a file is named for (2+ name words, all in the file name), added after the file's top-K rows because the rank cut left it out (no kept row dropped; counted in shown=) --> +<!-- files=4852 symbols=45031 edges=45381 shown=205 est_tokens=10597 ambiguous=3984 unresolved=20100 locality_pinned=14 external=12460 declined=45307 extent_suspect_syms=12 macro_blanked_files=7 skipped_oversize=15 unindexed="txt:85,tsv:54,mod:33,xml:33,jsonl:26,scm:25" unindexed_exts=23 order=important-first --> +<r schema="ripwire.map/v1" root="." est_tokens="10597" pr_iters="37" data_sections_cut="1" next="--graph-query='kind(all,sec)' --offset=0 --limit=200"> +<f p="src/infra/nodekind.h" layer="infra"> +<s t="fn" n="kindIs" sc="rw" k="0.0032"> +</s> +</f> +<f p="src/ingest_metrics.h"> +<s t="fn" n="nodeTextOf" k="0.0021"> +</s> +</f> +<f p="src/infra/namesplit.h" layer="infra"> +<s t="fn" n="isIdentChar" sc="namesplit" k="0.0020"> +</s> +<s t="fn" n="afterLast" sc="namesplit" k="0.0006"> +<c n="EXPECTS"/> +</s> +<s t="fn" n="isIdentStart" sc="namesplit" k="0.0003"> +<c n="isIdentChar"/> +</s> +</f> +<f p="src/model.h"> +<s t="fn" n="relForHash" sc="rw" k="0.0019"> +</s> +<s t="fn" n="rootRelPath" sc="rw" k="0.0017"> +<c n="relForHash"/> +… [765 more display lines; full output is 26303 bytes on 1 raw line(s)] +````` + +## `./build/ripwire . --top-k=5` + +*Same map, capped to the 5 highest-ranked symbols.* + +**wall time: 1.01s** + +````` +<!-- ripwire map schema=ripwire.map/v1: ranked symbol map: <f p= layer=> groups <s t= n= sc= k= amb=> rows (k= rank), <c n=> resolved callees; the header comment is data. est_tokens=: price as emitted (an upper bound under compact). root=: p= relative to it. pr_iters=N: PageRank iterations. <inv listed= unlisted=>: files the ranked rows show / do not (sum = files=), each named or counted below. <entry p= n=>: 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. <ls p= n= f=>: 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 <c> 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. sc=: enclosing scope; the full id is p::sc::n (p= of the row or its <f>) and selectors take it. --> +<!-- t=modscope=a-file's-MODULE-SCOPE(n=<file-scope>):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 --> +<!-- t=type|alias|functype=a-Go-named-type-by-its-written-form:type=a-defined-type-whose-WRITTEN-form-is-not-a-struct/iface/func-literal(type-N-string;type-W-Pair-too,whatever-Pair-is-underneath),alias=type-A=B,functype=type-F-func(...) --> +<!-- t=alias|functype-in-C++-and-.h:alias=using-X=Y(also-templated-or-class-scope)or-namespace-L=lib(defs=X-prints-its-written-target-as-to=),functype=a-typedef-of-a-function-or-function-pointer-type(typedef-void(*F)(int));other-typedefs-read-t=struct --> +<!-- files=4852 symbols=45031 edges=45381 shown=5 est_tokens=4159 ambiguous=3984 unresolved=20100 locality_pinned=14 external=12460 declined=45307 extent_suspect_syms=12 macro_blanked_files=7 skipped_oversize=15 unindexed="txt:85,tsv:54,mod:33,xml:33,jsonl:26,scm:25" unindexed_exts=23 order=important-first --> +<r schema="ripwire.map/v1" root="." est_tokens="4159" pr_iters="37"> +<f p="src/infra/nodekind.h" layer="infra"> +<s t="fn" n="kindIs" sc="rw" k="0.0032"> +</s> +</f> +<f p="src/ingest_metrics.h"> +<s t="fn" n="nodeTextOf" k="0.0021"> +</s> +</f> +<f p="src/infra/namesplit.h" layer="infra"> +<s t="fn" n="isIdentChar" sc="namesplit" k="0.0020"> +</s> +</f> +<f p="src/model.h"> +<s t="fn" n="relForHash" sc="rw" k="0.0019"> +</s> +</f> +<f p="src/infra/Diagnostics.h" layer="infra"> +<s t="macro" n="RW_ASSUME_" k="0.0018"> +<c n="RW_CHECK_"/> +</s> +</f> +<inv listed="5" unlisted="4847"> +<entry p="scripts/changelog_assemble.py" n="main"> +<c n="repoRoot"/> +… [91 more display lines; full output is 10369 bytes on 1 raw line(s)] +````` + +## `./build/ripwire . --top-k=5 --no-inventory` + +*The same capped map without its inventory tier: --top-k=5 leaves files out, so the default map appends <inv listed= unlisted=> (program entries, and the files the ranked rows left out) after its rows; --no-inventory drops that tier, and the ranked rows are the same.* + +````` +<!-- ripwire map schema=ripwire.map/v1: ranked symbol map: <f p= layer=> groups <s t= n= sc= k= amb=> rows (k= rank), <c n=> resolved callees; the header comment is data. est_tokens=: price as emitted (an upper bound under compact). root=: p= relative to it. pr_iters=N: PageRank iterations. 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. 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. sc=: enclosing scope; the full id is p::sc::n (p= of the row or its <f>) and selectors take it. --> +<!-- t=modscope=a-file's-MODULE-SCOPE(n=<file-scope>):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 --> +<!-- t=type|alias|functype=a-Go-named-type-by-its-written-form:type=a-defined-type-whose-WRITTEN-form-is-not-a-struct/iface/func-literal(type-N-string;type-W-Pair-too,whatever-Pair-is-underneath),alias=type-A=B,functype=type-F-func(...) --> +<!-- t=alias|functype-in-C++-and-.h:alias=using-X=Y(also-templated-or-class-scope)or-namespace-L=lib(defs=X-prints-its-written-target-as-to=),functype=a-typedef-of-a-function-or-function-pointer-type(typedef-void(*F)(int));other-typedefs-read-t=struct --> +<!-- files=4852 symbols=45031 edges=45381 shown=5 est_tokens=1206 ambiguous=3984 unresolved=20100 locality_pinned=14 external=12460 declined=45307 extent_suspect_syms=12 macro_blanked_files=7 skipped_oversize=15 unindexed="txt:85,tsv:54,mod:33,xml:33,jsonl:26,scm:25" unindexed_exts=23 order=important-first --> +<r schema="ripwire.map/v1" root="." est_tokens="1206" pr_iters="37"> +<f p="src/infra/nodekind.h" layer="infra"> +<s t="fn" n="kindIs" sc="rw" k="0.0032"> +</s> +</f> +<f p="src/ingest_metrics.h"> +<s t="fn" n="nodeTextOf" k="0.0021"> +</s> +</f> +<f p="src/infra/namesplit.h" layer="infra"> +<s t="fn" n="isIdentChar" sc="namesplit" k="0.0020"> +</s> +</f> +<f p="src/model.h"> +<s t="fn" n="relForHash" sc="rw" k="0.0019"> +</s> +</f> +<f p="src/infra/Diagnostics.h" layer="infra"> +<s t="macro" n="RW_ASSUME_" k="0.0018"> +<c n="RW_CHECK_"/> +</s> +</f> +</r> +````` + +## `./build/ripwire . --top-k=0 --expand=rankGraphTeleport` + +*NEW since the last capture: --top-k=0 means PAYLOAD-ONLY — no ranked map rides along with the body you asked for.* + +````` +<ctx schema="ripwire.expand/v1" root="." est_tokens="1227"> +<!-- ripwire expand schema=ripwire.expand/v1: full bodies: <bodies shown= total= capped=> of <b t= l= p= n= sibs= sibs_total= sibs_capped= inc=>; <calls> +<c n= l= p=> 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. inc_total=N: the file's true include/import count; inc= lists the first 2 … [line truncated: 303 more bytes on this line] +<bodies shown="1" total="1" capped="0"> +<b t="fn" l="14921" p="src/graph.h" n="rankGraphTeleport" sibs="<file-scope>,DeclinedSiteKind,kNoDeclinedList,ProvenSite,operator<=>,provenSiteCountsFor,Graph,localityKeyAt,ImplementorRow,implementorClosure,LegoClosure,LegoClosureWalk,LegoClosureWalk,take,boundOf,add,expand,legoImplement … [line truncated: 1657 more bytes on this line] +<![CDATA[inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>& p, float alpha = 0.85f ) +{ + PROFILE_SCOPE_DESCRIBE( "rankGraph: PageRank (power iteration)" ); + const std::vector<float> pw = biasPrior( g, p ); + const std::size_t N = pw.size(); + std::vector<double> teleport( pw.begin(), pw.end() ); + std::vector<double> rankDouble( N, 0.0 ); + PageRankRun run{}; // an N == 0 graph never enters the kernel: { 0, converged } — see PageRankRun + if( N ) + { + double teleportMass = 0.0; + for( const double value : teleport ) + { + teleportMass += value; + } + if( teleportMass > 0.0 ) + { + const double inverseMass = 1.0 / teleportMass; + for( double& value : teleport ) + { + value *= inverseMass; + } + } + run = pageRankDouble( g.inEdges, g.wOutDeg, teleport, rankDouble, PageRankConfig{ .alpha = double( alpha ) } ); + } + std::vector<float> 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 }; +}]]><calls total="4"><c n="biasPrior" l="14880">inline std::vector<float> biasPrior( const Graph& g, const std::vector<float>& p )</c><c n="PROFILE_SCOPE_DESCRIBE" l="1282" p="src/infra/profileScope.h">#define PROFILE_SCOPE_DESCRIBE( desc )</c><c n="PROFILE_SCOPE_DESCRIBE" l="129 … [line truncated: 368 more bytes on this line] +````` + +## `./build/ripwire . --top-k=0` + +*--top-k=0 with NO payload verb asked for — REFUSES (exit 1) naming the payload verbs, never an empty map.* + +**exit code: 1** + +````` +(empty) +````` + +stderr: + +````` +ripwire: --top-k=0 means "no ranked map, payload only" — pass a payload verb (--expand=SYM / --outline=SYM / --pack-signatures / --pack-top-n=N), or use --top-k=1 for the smallest map +````` + +## `./build/ripwire . --max-tokens=1500` + +*SHAPE the map to fit ~1500 tokens (binary-search top-K).* + +````` +<!-- ripwire map schema=ripwire.map/v1: ranked symbol map: <f p= layer=> groups <s t= n= sc= k= amb=> rows (k= rank), <c n=> resolved callees; the header comment is data. est_tokens=: price as emitted (an upper bound under compact). over_ceiling=1: budget not met. root=: p= relative to it. pr_iters=N: PageRank iterations. 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. max_tokens=/fit_bytes=: tokens asked/the byte cap applied. 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. sc=: enclosing scope; the full id is p::sc::n (p= of the row or its <f>) and selectors take it. --> +<!-- t=modscope=a-file's-MODULE-SCOPE(n=<file-scope>):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 --> +<!-- t=type|alias|functype=a-Go-named-type-by-its-written-form:type=a-defined-type-whose-WRITTEN-form-is-not-a-struct/iface/func-literal(type-N-string;type-W-Pair-too,whatever-Pair-is-underneath),alias=type-A=B,functype=type-F-func(...) --> +<!-- t=alias|functype-in-C++-and-.h:alias=using-X=Y(also-templated-or-class-scope)or-namespace-L=lib(defs=X-prints-its-written-target-as-to=),functype=a-typedef-of-a-function-or-function-pointer-type(typedef-void(*F)(int));other-typedefs-read-t=struct --> +<!-- files=4852 symbols=45031 edges=45381 shown=1 est_tokens=1122 ambiguous=3984 unresolved=20100 locality_pinned=14 external=12460 declined=45307 extent_suspect_syms=12 macro_blanked_files=7 skipped_oversize=15 unindexed="txt:85,tsv:54,mod:33,xml:33,jsonl:26,scm:25" unindexed_exts=23 max_tokens=1500 fit_bytes=3186 over_ceiling=1 order=important-first --> +<r schema="ripwire.map/v1" root="." est_tokens="1122" pr_iters="37"> +<f p="src/infra/nodekind.h" layer="infra"> +<s t="fn" n="kindIs" sc="rw" k="0.0032"> +</s> +</f> +</r> +````` + +## `./build/ripwire . --token-budget=100` + +*GATE form: exit 3 if the map's own est_tokens exceeds the budget (over-budget failure shape).* + +**exit code: 3** + +````` +<!-- ripwire map schema=ripwire.map/v1: the ranked map WITHHELD whole, no rows: withheld=1 marks this record, withheld_est_tokens= the map's price, over budget= (the token budget asked); rerun with a larger token budget, or max-tokens to shape a map that fits. --> +<r schema="ripwire.map/v1" withheld_est_tokens="10597" budget="100" withheld="1"/> +````` + +stderr: + +````` +ripwire: --token-budget exceeded: withheld_est_tokens=10597 > 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: 5.80s** + +````` +<ctx task="incremental cache invalidation when a file content hash changes" route="subtoken+body" root="." confidence="low" margin_pct="0" at="914c4045d" doc_mentions="5" schema="ripwire.for/v1" bundle="compact" bodies="0" reason="compact-route" budget_bytes="7500" doc_mentions_capped="1" doc_mentio … [line truncated: 31 more bytes on this line] +<!-- ripwire for schema=ripwire.for/v1: bundle=/bodies=/reason= the body posture; d: cx= ccx= complexity, in= callers (absent cx/ccx/in = 0), churn= amp= change, clone= tested= 1, sc= scope, id=p::sc::n; total= shown= capped=1 if cut; task= the query; d pure=1 const/constexpr sig, next= the follow-up to paste; route= name-exact(X)|subtoken+body[:broad|:declined]; confidence=/margin_pct= head score drop (low=flat); h l= p= n=, c n= l= p= (p= if not h's; same-named joined, shown= counts them), noedge= no callee resolved; h calls capped=1 next= the call listing every callee; fold kind=bodies: b t= n= p= l= top ranked rows' whole bodies, not the answer; served= of total= in budget_bytes=; slice/skip p= n= l=; skip bytes= next=; a skip makes sigs next= it, sigs_next= the signatures-only re-call; d mem= an owner's direct member names only, by the index (question words first, then owner's file, path, line, name), mem_more= names cut; t p= file outside sigs (weaker), t sym= its top symbols not in sigs/syms (a pointer, not the answer), r= rank (gap = trimmed); t order: code files first, then doc files (a code question); t page rows go on to file-page row 160 (code question: 160 code rows, docs within row 160); past page 0 (code question: past 40 code rows, a doc past row 40) listed last, head files skipped; past 120 of those p= only, p_only= counts them; t folded=class=N: N p= only rows of that class (doc|config|script|testdata|other) not listed, next= pages to them; d layer=: built-in arch layer (game|infra|render|math|audio|ai|test) from a dir name in p=; d e= its last line (absent=unknown, never 0; l= the name's line); c via=name: that callee matched by name alone, receiver unproven (NOT a claim the edge is false) [doc mentions: 5 docs, 3 symbols; doc_mentions=] --> +<!-- root= is the crawl root; p= below is RELATIVE to it (single-root only; absent => p= is ingest's own path, unchanged); at=this commit(+dirty). [budget_bytes= is the default BYTE target this ranked payload was shaped toward: row text shortens toward it, no row of the ranked head is removed for it (sigs past_target=)] [sigs capped=1 with shown=total: rows shrunk, none dropped] [sigs past_target=K: the last K rows are past the budget_bytes target, served because they are rows of the ranked head; none is cut] [sigs next=: one call serving all total= rows uncut] [docs_dropped=N: N shown rows have a doc comment not printed (r>24 always, r5..24 if capped)] [files_first=N: N rows moved so r=1..8 are distinct files' best rows, score order, a repeated name once; same rows; fold, hops keep score order] [cut: doc_mentions_capped="1" doc_mentions_total="6" — an indexing cap dropped content not shown here]; lego/compose collapse to a counted stub by default (a disclosed cut): total= that section's own pre-cap row count, shown="0" capped="1" (nothing rendered here), next= names the sections=lego,compose flag that restores both sections byte-identically in one call est_tokens= prices this bundle in tokens --> +<sigs shown="40" total="40" capped="1" past_target="14" docs_dropped="31" files_first="15" next="--for='incremental cache invalidation when a file content hash changes' --signatures-only --token-budget=6600"> +<d l="153" e="153" n="kCacheMagic" p="src/ingest_cache.h" churn="392" amp="641" pure="1" r="1" next="--expand=src/ingest_cache.h:kCacheMagic"> +<doc>incremental cache (--cache): per-file content hash + raw facts so a re-run re-parses ONLY c…</doc>constexpr std::uint32_t kCacheMagic = 0x4b505443</d> +<d l="3124" e="3124" n="kHeadSnapCacheScheme" sc="quality" p="src/quality.h" churn="693" amp="872" pure="1" r="2"> +<doc>and every file whose content hash differs is re-parsed — so a stale or foreign blob self-heals…</doc>constexpr std::uint32_t kHeadSnapCacheScheme = 1</d> +<d l="779" e="786" n="mcpRebuildBaseline" sc="rw" p="src/mcpindex.h" cx="2" ccx="1" in="1" churn="59" amp="145" r="3">inline McpRebuildBaseline mcpRebuildBaseline( const McpIndex& ix, bool isIncrementalPass )</d> +<d l="364" e="381" n="noteFactlessMiss" p="src/ingest_parsepool.h" cx="3" ccx="2" in="1" churn="75" amp="189" tested="1" r="4">inline void noteFactlessMiss( ParsePoolShared& sh, std::size_t fileId, bool nestRefused ) noexcept</d> +<d l="400" e="449" n="probeCachedRecord" p="src/ingest_prewarm.h" cx="15" ccx="11" in="1" churn="25" amp="82" tested="1" r="5">inline CachedRecordVerdict probeCachedRecord( const PrewarmMissPass& pass, std::size_t fi, const CachedRecordHead& record, std::string& bytes )</d> +<d l="944" e="957" n="setTreeKey" sc="rw::warmsnap" p="src/warmsnap.h" cx="2" ccx="1" in="1" churn="8" amp="55" tested="1" r="6">inline void setTreeKey( Session& s, const std::vector<std::string>& files, std::string_view rootDir, const std::vector<std::uint64_t>& hashes, cons … [line truncated: 20 more bytes on this line] +<d l="277" e="306" n="ingestCommitTree" sc="rw::dmm" p="src/dmm.h" cx="6" ccx="5" in="1" churn="16" amp="77" r="7">inline bool ingestCommitTree( const std::string& root, const std::string& sha, const std::vector<std::string>& excludes, std::size_t maxFileBytes, IngestResult& ou … [line truncated: 7 more bytes on this line] +<d l="25" e="25" n="kFnv1aLegacySeed64" sc="rw::hashutil" p="src/infra/hashutil.h" layer="infra" churn="7" amp="49" pure="1" r="8">inline constexpr std::uint64_t kFnv1aLegacySeed64 = 1469598103934665603ull</d> +<d l="495" e="577" n="McpIndex" sc="McpIndex" p="src/mcpindex.h" churn="59" amp="144" r="9"> +<doc>persistent in-memory index (parse once, reuse across MCP calls) ---- The MCP server is long-live…</doc>struct McpIndex</d> +<d l="1224" e="1399" n="getIndex" sc="rw" p="src/mcpindex.h" cx="23" ccx="40" in="36" churn="59" amp="180" r="10">inline const McpIndex& getIndex( const std::string& root )</d> +<!-- demote: a <t> in sigs is a lower same-file sibling past answer row 10, a pointer (p= file, sym= name, r= rank), not the answer --> +<t p="src/ingest_cache.h" sym="contentHash64" r="11"/> +<t p="src/ingest_cache.h" sym="CacheEntry" r="12"/> +<t p="src/ingest_cache.h" sym="blobChecksum" r="13"/> +<t p="src/ingest_cache.h" sym="buildCachePathKeys" r="14"/> +<t p="src/quality.h" sym="contentIdsBySym" r="15"/> +<t p="src/ingest_cache.h" sym="buildCacheWritePlan" r="16"/> +<t p="src/mcpindex.h" sym="makeHandle" r="17"/> +<d l="464" e="484" n="indexContentHash" sc="mcpdetail" p="src/mcpindex.h" cx="5" ccx="7" in="1" churn="59" amp="145" r="18">inline std::uint64_t indexContentHash( const std::vector<std::string>& files, const std::vector<long long>& fileMtime, const std::vector<std::uint64_t> … [line truncated: 25 more bytes on this line] +<t p="src/ingest_prewarm.h" sym="PrewarmMissPass" r="19"/> +<d l="28" e="54" n="IngestFileScan" sc="IngestFileScan" p="src/ingest_prewarm.h" churn="25" amp="81" r="20" mem="markExtractPartial">struct IngestFileScan</d> +<t p="src/ingest_prewarm.h" sym="forgetNestRefusalsForCache" r="21"/> +<d l="357" e="360" n="byteHash" sc="mcpdetail" p="src/mcpindex.h" cx="1" in="7" churn="59" amp="151" r="22">inline std::uint64_t byteHash( const char* data, std::size_t n ) noexcept</d> +… [217 more display lines; full output is 24477 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: 2.06s** + +````` +<ctx task="rankGraphTeleport" route="name-exact(rankGraphTeleport); anchors: rankGraphTeleport(src/graph.h)" root="." confidence="high" margin_pct="45" at="914c4045d" doc_mentions="2" schema="ripwire.for/v1" bundle="auto" bodies="1" doc_mentions_capped="1" doc_mentions_total="14" est_tokens="2165"> +<!-- ripwire for schema=ripwire.for/v1: bundle=/bodies=/reason= the body posture; d: cx= ccx= complexity, in= callers (absent cx/ccx/in = 0), churn= amp= change, clone= tested= 1, sc= scope, id=p::sc::n; total= shown= capped=1 if cut; task= the query; d pure=1 const/constexpr sig, next= the follow-up to paste; route= name-exact(X)|subtoken+body[:broad|:declined]; confidence=/margin_pct= head score drop (low=flat); b t= n= p= l= full bodies, c n= l= p= callee signatures (p= if not b's); callers of=: the one function's 1-hop callers, s t= n= sc= p=file:line (n=Owner.name folds sc= on a member; sites_at= its calls as [file:]line, sites_total= if cut; via=name by name only), shown= of total=; d=2 rows: their callers (via=name if every path has a by-name hop), shown_d2= of d2= (d2_capped=1 if cut, else 0); capped=1 if cut; floors; next= the radius; windows=1: the radius call lists only a first page of next_total= rows (the impact verb's own count, a floor), so no page is pointed at: next= lists them all, columnar; t p= file outside sigs (weaker), t sym= its top symbols not in sigs/syms (a pointer, not the answer), r= rank (gap = trimmed); t order: code files first, then doc files (a code question); d e= its last line (absent=unknown, never 0; l= the name's line); c prov=split: a resolver split arm; may be another arm's (NOT a claim the edge is false) [doc mentions: 2 docs, 1 symbol; doc_mentions=] [floor: kept 3 of 40] --> +<!-- root= is the crawl root; p= below is RELATIVE to it (single-root only; absent => p= is ingest's own path, unchanged); at=this commit(+dirty). [cut: doc_mentions_capped="1" doc_mentions_total="14" — an indexing cap dropped content not shown here] est_tokens= prices this bundle in tokens --> +<sigs> +<d l="14921" e="14949" n="rankGraphTeleport" sc="rw" p="src/graph.h" cx="5" ccx="8" in="7" churn="732" amp="990" r="1" next="--expand=src/graph.h:rankGraphTeleport"> +<doc>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 (edges</doc>inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>&am … [line truncated: 31 more bytes on this line] +<d l="501" n="The convergence disclosure contract" sc="rank — Personalized PageRank" p="docs/ARCHITECTURE.md" churn="79" amp="202" r="2">#### The convergence disclosure contract</d> +<d l="6401" n="Wave-2 adversarial verification (2026-08-19) — six probes against `aa97c9e`" sc="6. Correctness and quality instruments" p="docs/EVALS.md" churn="1179" amp="1396" r="3">### Wave-2 adversarial verification (2026-08-19) — six probes against `aa97c9e`</d> +</sigs> +<tail total="3" shown="3" capped="0"> +<t p="src/graph.h"/> +<t p="docs/ARCHITECTURE.md"/> +<t p="docs/EVALS.md"/> +</tail> +<callers of="rw::rankGraphTeleport" shown="7" total="7" capped="1" d2="52" shown_d2="4" d2_capped="1" windows="1" next_total="80" next="--impact=rw::rankGraphTeleport --format=columnar --limit=80"> +<s t="fn" n="getIndex" sc="rw" p="src/mcpindex.h:1224" sites_at="1340"/> +<s t="fn" n="rankGraph" sc="rw" p="src/graph.h:14964" sites_at="14968"/> +<s t="fn" n="anchoredLexicalRank" sc="rw" p="src/graph.h:15633" sites_at="15684"/> +<s t="fn" n="runEval" sc="rw" p="src/eval.h:171" sites_at="328"/> +<s t="fn" n="churnDecayRanking" p="src/main.cpp:1433" sites_at="1447"/> +<s t="fn" n="churnRankedGraph" p="src/main.cpp:1472" sites_at="1486 1487 1501"/> +<s t="fn" n="runDefaultMap" p="src/main.cpp:1759" sites_at="1879"/> +<s t="fn" n="symbolQueryJson" sc="rw" p="src/mcpverbs.h:792" d="2"/> +<s t="fn" n="pathText" sc="rw" p="src/mcpverbs.h:4040" d="2"/> +<s t="fn" n="fetchBody" sc="rw" p="src/mcpverbs.h:5902" d="2"/> +<s t="fn" n="computeLensRanking" p="src/verbs_for.h:115" d="2"/> +</callers> +<bodies shown="1" total="1" capped="0"> +<b t="fn" l="14921" p="src/graph.h" n="rankGraphTeleport"> +<![CDATA[inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>& p, float alpha = 0.85f ) +… [28 more display lines; full output is 6611 bytes on 29 raw line(s)] +````` + +## `./build/ripwire . --for="rankGraphTeleport" --no-route` + +*Same query with routing forced OFF (plain subtoken+body BM25) — contrast with the routed run.* + +````` +<ctx task="rankGraphTeleport" root="." confidence="low" margin_pct="0" at="914c4045d" doc_mentions="6" schema="ripwire.for/v1" bundle="auto" bodies="4" budget_bytes="7500" doc_mentions_capped="1" doc_mentions_total="22" est_tokens="10974"> +<!-- ripwire for schema=ripwire.for/v1: bundle=/bodies=/reason= the body posture; d: cx= ccx= complexity, in= callers (absent cx/ccx/in = 0), churn= amp= change, clone= tested= 1, sc= scope, id=p::sc::n; total= shown= capped=1 if cut; task= the query; d pure=1 const/constexpr sig, next= the follow-up to paste; confidence=/margin_pct= head score drop (low=flat); b t= n= p= l= full bodies, c n= l= p= callee signatures (p= if not b's); t p= file outside sigs (weaker), t sym= its top symbols not in sigs/syms (a pointer, not the answer), r= rank (gap = trimmed); t order: code files first, then doc files (a code question); t page rows go on to file-page row 160 (code question: 160 code rows, docs within row 160); past page 0 (code question: past 40 code rows, a doc past row 40) listed last, head files skipped; past 120 of those p= only, p_only= counts them; t folded=class=N: N p= only rows of that class (doc|config|script|testdata|other) not listed, next= pages to them; field name= type= owner= rel=: a member of owner=, rel=creates held by value, uses by reference/pointer; d e= its last line (absent=unknown, never 0; l= the name's line); c prov=split: a resolver split arm; may be another arm's (NOT a claim the edge is false) [doc mentions: 6 docs, 3 symbols; doc_mentions=] --> +<!-- root= is the crawl root; p= below is RELATIVE to it (single-root only; absent => p= is ingest's own path, unchanged); at=this commit(+dirty). [budget_bytes= is the default BYTE target this ranked payload was shaped toward: row text shortens toward it, no row of the ranked head is removed for it (sigs past_target=)] [sigs capped=1 with shown=total: rows shrunk, none dropped] [sigs past_target=K: the last K rows are past the budget_bytes target, served because they are rows of the ranked head; none is cut] [sigs next=: one call serving all total= rows uncut] [docs_dropped=N: N shown rows have a doc comment not printed (r>24 always, r5..24 if capped)] [cut: doc_mentions_capped="1" doc_mentions_total="22" — an indexing cap dropped content not shown here] est_tokens= prices this bundle in tokens --> +<sigs shown="40" total="40" capped="1" past_target="14" docs_dropped="25" next="--for=rankGraphTeleport --signatures-only --no-route --token-budget=6700"> +<d l="14921" e="14949" n="rankGraphTeleport" sc="rw" p="src/graph.h" cx="5" ccx="8" in="7" churn="732" amp="990" r="1" next="--expand=src/graph.h:rankGraphTeleport"> +<doc>PageRank with an explicit teleport / personalization vector p (Σp = 1). The prior is name-quali…</doc>inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>& p, float alpha = 0.85f )</d> +<d l="14964" e="14969" n="rankGraph" sc="rw" p="src/graph.h" cx="2" ccx="1" in="13" churn="732" amp="996" r="2"> +<doc>uniform-teleport PageRank (the default). A kRankFlagNotNamed unit (model.h) has no edge and a 0 …</doc>inline RankedGraph rankGraph( const Graph& g, float alpha = 0.85f )</d> +<d l="105" e="109" n="storedDefaultRank" sc="rw::warmsnap" p="src/warmsnap_graph.h" cx="1" in="3" churn="2" amp="33" r="3"> +<doc>The default map's PageRank — uniform teleport, the one rank that is a function of the Graph al…</doc>inline std::optional<RankedGraph>& storedDefaultRank() noexcept</d> +<d l="1472" e="1511" n="churnRankedGraph" p="src/main.cpp" cx="10" ccx="12" in="1" churn="514" amp="669" r="4">inline ChurnRanking churnRankedGraph( const MainDispatch& d )</d> +<d l="2578" e="2582" n="kChurnRankLegend" sc="rw" p="src/serialize.h" churn="521" amp="626" pure="1" r="5">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…</d> +<d l="14912" e="14917" n="RankedGraph" sc="RankedGraph" p="src/graph.h" churn="732" amp="983" r="6">struct RankedGraph</d> +<d l="14955" e="14959" n="takeRank" sc="rw" p="src/graph.h" cx="1" in="2" churn="732" amp="985" r="7">inline std::vector<float> takeRank( RankedGraph ranked, RankDisclosure& disclosureOut )</d> +<d l="14880" e="14904" n="biasPrior" sc="rw" p="src/graph.h" cx="5" ccx="4" in="1" churn="732" amp="984" r="8">inline std::vector<float> biasPrior( const Graph& g, const std::vector<float>& p )</d> +<d l="2469" e="2495" n="churnTeleportWorkspace" sc="rw" p="src/gitmine.h" cx="6" ccx="9" in="1" churn="106" amp="153" r="9">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] +<d l="1433" e="1470" n="churnDecayRanking" p="src/main.cpp" cx="7" ccx="7" in="1" churn="514" amp="669" r="10">inline ChurnRanking churnDecayRanking( const MainDispatch& d, const rw::SinceScope& sinceScope, bool isScoped, const char* verbLabel )</d> +<d l="48" e="49" n="pageRankDouble" sc="rw" p="src/pagerank.h" cx="1" churn="8" amp="37" r="11">PageRankRun pageRankDouble( const sparseCsr<float>& inEdges, std::span<const double> weightedOutDegree, std::span<const double> teleport, std::span<double> rank…</d> +<d l="503" e="549" n="rankByText" sc="rw" p="src/mcpverbs.h" cx="11" ccx="19" in="1" churn="676" amp="692" r="12">inline std::string rankByText( const std::string& root, std::string_view mode, int topK, bool stable = false )</d> +<!-- demote: a <t> in sigs is a lower same-file sibling past answer row 10, a pointer (p= file, sym= name, r= rank), not the answer --> +<t p="src/gitmine.h" sym="churnDecayTeleport" r="13"/> +<d l="99" e="206" n="pageRankDouble" sc="rw" p="src/pagerank.cpp" cx="19" ccx="34" in="2" churn="14" amp="44" tested="1" r="14">PageRankRun pageRankDouble( const sparseCsr<float>& inEdges, std::span<const double> weightedOutDegree, std::span<const double> teleport, std::span< … [line truncated: 45 more bytes on this line] +<d l="240" e="244" n="didYouMean" sc="rw" p="src/didyoumean.h" cx="2" ccx="1" in="7" churn="10" amp="59" r="15">inline std::string didYouMean( const IngestResult& ing, std::string_view name )</d> +<t p="src/gitmine.h" sym="churnDecayTeleportWorkspace" r="16"/> +<d l="1224" e="1399" n="getIndex" sc="rw" p="src/mcpindex.h" cx="23" ccx="40" in="36" churn="59" amp="180" r="17">inline const McpIndex& getIndex( const std::string& root )</d> +<t p="src/serialize.h" sym="DataSectionsCut" r="18"/> +<d l="110" e="120" n="defaultRank" sc="rw::warmsnap" p="src/warmsnap_graph.h" cx="3" ccx="2" in="1" churn="2" amp="31" r="19">inline RankedGraph defaultRank( const Graph& g )</d> +<d l="501" n="The convergence disclosure contract" sc="rank — Personalized PageRank" p="docs/ARCHITECTURE.md" churn="79" amp="202" r="20">#### The convergence disclosure contract</d> +<d l="6401" n="Wave-2 adversarial verification (2026-08-19) — six probes against `aa97c9e`" sc="6. Correctness and quality instruments" p="docs/EVALS.md" churn="1179" amp="1396" r="21">### Wave-2 adversarial verification (2026-08-19) — six probes against `aa97c9e`</d> +<t p="src/gitmine.h" sym="kChurnMergeBombMaxFiles" r="22"/> +… [276 more display lines; full output is 30304 bytes on 77 raw line(s)] +````` + +## `./build/ripwire . --for="rankGraphTeleport" --signatures-only` + +*T3 opt-out: the signatures-only lens (no auto bodies, no bundle="auto" attribute) — contrast with the terminal default above.* + +````` +<ctx task="rankGraphTeleport" route="name-exact(rankGraphTeleport); anchors: rankGraphTeleport(src/graph.h)" root="." confidence="high" margin_pct="45" at="914c4045d" doc_mentions="2" schema="ripwire.for/v1" doc_mentions_capped="1" doc_mentions_total="14" est_tokens="959"> +<!-- ripwire for schema=ripwire.for/v1: bundle=/bodies=/reason= the body posture; d: cx= ccx= complexity, in= callers (absent cx/ccx/in = 0), churn= amp= change, clone= tested= 1, sc= scope, id=p::sc::n; total= shown= capped=1 if cut; task= the query; d pure=1 const/constexpr sig, next= the follow-up to paste; route= name-exact(X)|subtoken+body[:broad|:declined]; confidence=/margin_pct= head score drop (low=flat); t p= file outside sigs (weaker), t sym= its top symbols not in sigs/syms (a pointer, not the answer), r= rank (gap = trimmed); t order: code files first, then doc files (a code question); d e= its last line (absent=unknown, never 0; l= the name's line) [doc mentions: 2 docs, 1 symbol; doc_mentions=] [floor: kept 3 of 40] --> +<!-- root= is the crawl root; p= below is RELATIVE to it (single-root only; absent => p= is ingest's own path, unchanged); at=this commit(+dirty). [cut: doc_mentions_capped="1" doc_mentions_total="14" — an indexing cap dropped content not shown here] est_tokens= prices this bundle in tokens --> +<sigs> +<d l="14921" e="14949" n="rankGraphTeleport" sc="rw" p="src/graph.h" cx="5" ccx="8" in="7" churn="732" amp="990" r="1" next="--expand=src/graph.h:rankGraphTeleport"> +<doc>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 (edges</doc>inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>&am … [line truncated: 31 more bytes on this line] +<d l="501" n="The convergence disclosure contract" sc="rank — Personalized PageRank" p="docs/ARCHITECTURE.md" churn="79" amp="202" r="2">#### The convergence disclosure contract</d> +<d l="6401" n="Wave-2 adversarial verification (2026-08-19) — six probes against `aa97c9e`" sc="6. Correctness and quality instruments" p="docs/EVALS.md" churn="1179" amp="1396" r="3">### Wave-2 adversarial verification (2026-08-19) — six probes against `aa97c9e`</d> +</sigs> +<tail total="3" shown="3" capped="0"> +<t p="src/graph.h"/> +<t p="docs/ARCHITECTURE.md"/> +<t p="docs/EVALS.md"/> +</tail> +<!-- syms: leads, not the answer: first 6 shown files' symbols it lacks, p=file:line n=Owner.name; by=name task word, by=callee a head <d> row calls it (via=name name-only, prov=split one arm); name_total= callee_total= files_total= cut by the 3-row, 6-file cap; files= head= if under 6, 8 --> +<syms files="3" head="3" name_total="17"> +<y p="src/graph.h:14964" n="rankGraph" by="name"/> +<y p="src/graph.h:21100" n="graphCountFloorAttrXml" by="name"/> +<y p="src/graph.h:21109" n="graphGaugeClauses" by="name"/> +</syms> +</ctx> +````` + +## `./build/ripwire . --for="tree-sitter parse of a source file" --adaptive` + +*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]).* + +````` +<ctx task="tree-sitter parse of a source file" route="subtoken+body" root="." confidence="low" margin_pct="0" at="914c4045d" doc_mentions="1" schema="ripwire.for/v1" bundle="compact" bodies="0" reason="compact-route" budget_bytes="7500" est_tokens="10088"> +<!-- ripwire for schema=ripwire.for/v1: bundle=/bodies=/reason= the body posture; d: cx= ccx= complexity, in= callers (absent cx/ccx/in = 0), churn= amp= change, clone= tested= 1, sc= scope, id=p::sc::n; total= shown= capped=1 if cut; task= the query; d pure=1 const/constexpr sig, next= the follow-up to paste; d same_as=N: doc+sig text as row n=N (not repeated); route= name-exact(X)|subtoken+body[:broad|:declined]; confidence=/margin_pct= head score drop (low=flat); h l= p= n=, c n= l= p= (p= if not h's; same-named joined, shown= counts them), noedge= no callee resolved; fold kind=bodies: b t= n= p= l= top ranked rows' whole bodies, not the answer; served= of total= in budget_bytes=; slice/skip p= n= l=; skip bytes= next=; a skip makes sigs next= it, sigs_next= the signatures-only re-call; d mem= an owner's direct member names only, by the index (question words first, then owner's file, path, line, name), mem_more= names cut; t p= file outside sigs (weaker), t sym= its top symbols not in sigs/syms (a pointer, not the answer), r= rank (gap = trimmed); t order: code files first, then doc files (a code question); t page rows go on to file-page row 160 (code question: 160 code rows, docs within row 160); past page 0 (code question: past 40 code rows, a doc past row 40) listed last, head files skipped; past 120 of those p= only, p_only= counts them; t folded=class=N: N p= only rows of that class (doc|config|script|testdata|other) not listed, next= pages to them; d e= its last line (absent=unknown, never 0; l= the name's line) [adaptive: kept 40 of 40 - no relevance cliff (broad query saturates the score); capped at the ceiling] [doc mentions: 1 doc, 1 symbol; doc_mentions=] --> +<!-- root= is the crawl root; p= below is RELATIVE to it (single-root only; absent => p= is ingest's own path, unchanged); at=this commit(+dirty). [budget_bytes= is the default BYTE target this ranked payload was shaped toward: row text shortens toward it, no row of the ranked head is removed for it (sigs past_target=)] [sigs capped=1 with shown=total: rows shrunk, none dropped] [sigs past_target=K: the last K rows are past the budget_bytes target, served because they are rows of the ranked head; none is cut] [sigs next=: one call serving all total= rows uncut] [docs_dropped=N: N shown rows have a doc comment not printed (r>24 always, r5..24 if capped)] [files_first=N: N rows moved so r=1..8 are distinct files' best rows, score order, a repeated name once; same rows; fold, hops keep score order]; lego/compose collapse to a counted stub by default (a disclosed cut): total= that section's own pre-cap row count, shown="0" capped="1" (nothing rendered here), next= names the sections=lego,compose flag that restores both sections byte-identically in one call est_tokens= prices this bundle in tokens --> +<sigs shown="40" total="40" capped="1" past_target="7" docs_dropped="24" files_first="7" next="--for='tree-sitter parse of a source file' --signatures-only --adaptive --token-budget=5400"> +<d l="28" e="63" n="topLevelEvidence" sc="rw::pythonrunner" p="src/pythonrunner.h" cx="4" ccx="3" in="2" churn="5" amp="15" r="1" next="--expand=src/pythonrunner.h:topLevelEvidence">inline bool topLevelEvidence( std::string_view source, const TSLanguage* language, const Predicate& predicate )</d … [line truncated: 1 more bytes on this line] +<d l="45" e="45" n="kDefaultMaxFileBytes" sc="rw" p="src/ingest.h" churn="72" amp="185" pure="1" r="2"> +<doc>The crawl's per-file byte ceiling. A text file larger than this is skipped: at this size it is o…</doc>constexpr std::size_t kDefaultMaxFileBytes = 4u * 1024u * 1024u</d> +<d l="1247" e="1255" n="parseTree" p="src/ingest_sidecap.h" cx="1" in="4" churn="188" amp="364" tested="1" r="3">TSTree* parseTree( TSParser* parser, std::string_view src )</d> +<d l="594" e="669" n="doctorProbeGrammars" p="src/verbs_doctor.h" cx="7" ccx="17" in="1" churn="51" amp="150" r="4"> +<doc>Exercise every registered grammar and its embedded query, reporting loaded and expected totals</doc>inline DoctorGrammarProbe doctorProbeGrammars()</d> +<d l="527" e="565" n="SourceReader" sc="SourceReader" p="src/forselfhook.h" churn="11" amp="10" r="5" mem="parsed">class SourceReader</d> +<d l="104" e="238" n="kLangTable" p="src/ingest_crawl.h" churn="90" amp="225" pure="1" r="6">constexpr std::array<LangEntry, 58> kLangTable =</d> +<d l="2495" e="2510" n="FileHealth" sc="FileHealth" p="src/model.h" churn="338" amp="570" r="7" mem="operator==">struct FileHealth</d> +<d l="308" e="343" n="SliceScan" sc="SliceScan" p="src/slice.h" churn="54" amp="102" r="8" mem="disclose">struct SliceScan</d> +<d l="138" e="152" n="ParsedFile::ParsedFile" p="src/forselfhook.h" cx="2" ccx="1" churn="11" amp="10" r="9">explicit ParsedFile( std::string bytes ) : m_bytes( std::move( bytes ) )</d> +<d l="135" e="177" n="ParsedFile" sc="ParsedFile" p="src/forselfhook.h" churn="11" amp="10" r="10" mem="operator=,usable,root,text">class ParsedFile</d> +<!-- demote: a <t> in sigs is a lower same-file sibling past answer row 10, a pointer (p= file, sym= name, r= rank), not the answer --> +<t p="src/ingest.h" sym="AstWalk" r="11"/> +<t p="src/ingest_sidecap.h" sym="astroFenceTailIsBlank" r="12"/> +<d l="386" e="459" n="sliceAtRev" sc="slicediff" p="src/slicediff.h" cx="14" ccx="15" in="1" churn="14" amp="76" r="13">inline RevSide sliceAtRev( const std::string& root, const std::string& sha, const std::string& rel, const Symbol& sym, SliceFam fam, const ::TSLanguage* grammar, st … [line truncated: 77 more bytes on this line] +<d l="2075" e="2104" n="collectGatedLocalNames" sc="rw" p="src/ingest_astquery.h" cx="6" ccx="5" in="1" churn="61" amp="178" r="14">std::vector<LocalNameFact> collectGatedLocalNames( std::string_view defBytes, std::uint32_t defStartLine, Lang lang )</d> +<d l="927" e="978" n="scanModule" sc="detail" p="src/jsrunner.h" cx="16" ccx="15" in="3" churn="22" amp="109" r="15">inline ModuleScan scanModule( std::string_view source, std::string_view path )</d> +<t p="src/ingest.h" sym="kMaxKotlinStringNestDepth" r="16"/> +<d l="87" e="97" n="hasMainGuard" sc="rw::pythonrunner" p="src/pythonrunner.h" cx="2" ccx="2" in="1" churn="5" amp="14" r="17">inline bool hasMainGuard( std::string_view source )</d> +<d l="223" e="227" n="hasPhantomScopeSeparator" p="src/ingest_names.h" cx="2" ccx="1" in="2" churn="87" amp="249" tested="1" r="18">inline bool hasPhantomScopeSeparator( TSNode qualified ) noexcept</d> +<t p="src/slice.h" sym="DisclosureWhy" r="19"/> +<t p="src/ingest_crawl.h" sym="jsonNestsTooDeep" r="20"/> +<t p="src/ingest.h" sym="kMaxYamlNestDepth" r="21"/> +<t p="src/ingest_astquery.h" sym="spanTiersOfFiles" r="22"/> +<t p="src/slice.h" sym="sliceScanDefinition" r="23"/> +… [243 more display lines; full output is 26577 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.01s** + +````` +<ctx task="why does src/lexical.h chooseForRanker pick name-exact BM25" route="subtoken+body" root="." confidence="low" margin_pct="0" at="914c4045d" mention_anchored="3" doc_mentions="4" schema="ripwire.for/v1" bundle="compact" bodies="0" reason="compact-route" budget_bytes="7500" doc_mentions_capp … [line truncated: 49 more bytes on this line] +<!-- ripwire for schema=ripwire.for/v1: bundle=/bodies=/reason= the body posture; d: cx= ccx= complexity, in= callers (absent cx/ccx/in = 0), churn= amp= change, clone= tested= 1, sc= scope, id=p::sc::n; total= shown= capped=1 if cut; task= the query; d pure=1 const/constexpr sig, next= the follow-up to paste; route= name-exact(X)|subtoken+body[:broad|:declined]; confidence=/margin_pct= head score drop (low=flat); h l= p= n=, c n= l= p= (p= if not h's; same-named joined, shown= counts them), noedge= no callee resolved; h qword= its name (case-folded, leading _#$@ dropped) equals that question word (by name, not resolved, not the only one), first, calls to 100 (capped=1 next= all); qword_cut= owners not so served, next= the first; fold kind=bodies: b t= n= p= l= top ranked rows' whole bodies, not the answer; served= of total= in budget_bytes=; slice/skip p= n= l=; skip bytes= next=; a skip makes sigs next= it, sigs_next= the signatures-only re-call; t p= file outside sigs (weaker), t sym= its top symbols not in sigs/syms (a pointer, not the answer), r= rank (gap = trimmed); t tsym= up to 2 more file symbols named by a task word (a name match); t order: code files first, then doc files (a code question); t page rows go on to file-page row 160 (code question: 160 code rows, docs within row 160); past page 0 (code question: past 40 code rows, a doc past row 40) listed last, head files skipped; past 120 of those p= only, p_only= counts them; t folded=class=N: N p= only rows of that class (doc|config|script|testdata|other) not listed, next= pages to them; d layer=: built-in arch layer (game|infra|render|math|audio|ai|test) from a dir name in p=; d e= its last line (absent=unknown, never 0; l= the name's line); c prov=split: a resolver split arm; may be another arm's (NOT a claim the edge is false) [mention anchor: 1 file + 2 symbols; mention_anchored=] [doc mentions: 4 docs, 2 symbols; doc_mentions=] --> +<!-- root= is the crawl root; p= below is RELATIVE to it (single-root only; absent => p= is ingest's own path, unchanged); at=this commit(+dirty). [budget_bytes= is the default BYTE target this ranked payload was shaped toward: row text shortens toward it, no row of the ranked head is removed for it (sigs past_target=)] [sigs capped=1 with shown=total: rows shrunk, none dropped] [sigs past_target=K: the last K rows are past the budget_bytes target, served because they are rows of the ranked head; none is cut] [sigs next=: one call serving all total= rows uncut] [docs_dropped=N: N shown rows have a doc comment not printed (r>24 always, r5..24 if capped)] [docs_after_code=N: N doc rows of the shown set moved below its code rows; same rows, reordered, none added or removed; a question naming docs keeps score order] [cut: doc_mentions_capped="1" doc_mentions_total="7" — an indexing cap dropped content not shown here]; lego/compose collapse to a counted stub by default (a disclosed cut): total= that section's own pre-cap row count, shown="0" capped="1" (nothing rendered here), next= names the sections=lego,compose flag that restores both sections byte-identically in one call est_tokens= prices this bundle in tokens --> +<sigs shown="40" total="40" capped="1" past_target="16" docs_dropped="28" docs_after_code="2" next="--for='why does src/lexical.h chooseForRanker pick name-exact BM25' --signatures-only --token-budget=6500"> +<d l="2015" e="2021" n="lexicalScoresNameExactRanked" sc="rw" p="src/lexical.h" cx="1" in="4" churn="95" amp="153" r="1" next="--expand=src/lexical.h:lexicalScoresNameExactRanked"> +<doc>The name-exact ranker AS THE RETRIEVAL LENS SERVES IT: whole-name BM25 plus the definition-over-…</doc>inline std::vector<float> lexicalScoresNameExactRanked( const IngestResult& ing, std::string_view query, const std::vector<float>* symbolScoreMul )</d> +<d l="158" e="169" n="printEvalRankerNote" sc="rw" p="src/eval.h" cx="1" in="1" churn="18" amp="52" r="2"> +<doc>P11.12: the interpretive footer for --eval's ranker table, pulled into its own function so the 9…</doc>inline void printEvalRankerNote()</d> +<d l="194" e="194" n="kWeakLexicalScoreThreshold" sc="rw" p="src/lexical.h" churn="95" amp="149" pure="1" r="3"> +<doc>calling agent knows to reformulate rather than trust the ranking. Calibrated empirically (2026-0…</doc>inline constexpr float kWeakLexicalScoreThreshold = 1.0f</d> +<d l="2845" e="2954" n="chooseForRanker" sc="rw" p="src/lexical.h" cx="18" ccx="23" in="6" churn="95" amp="155" r="4">inline RouteChoice chooseForRanker( const IngestResult& ing, std::string_view query )</d> +<d l="716" e="795" n="runEvalRetrieval" sc="rw" p="src/eval.h" cx="7" ccx="10" in="1" churn="18" amp="52" r="5">inline int runEvalRetrieval( const IngestResult& ing, const Graph& g )</d> +<d l="1108" e="1145" n="chooseSubjectRouteUnchecked" sc="rw" p="src/subjectanchor.h" cx="14" ccx="11" in="1" churn="51" amp="48" r="6">inline SubjectRoute chooseSubjectRouteUnchecked( const IngestResult& ing, const Graph& g, std::string_view task, bool servesBodiesAndCallers )</d> +<d l="7282" e="7295" n="candidatesRootTag" sc="rw" p="src/serialize.h" cx="5" ccx="4" in="1" churn="521" amp="627" r="7">inline std::string candidatesRootTag( std::size_t keep, std::size_t corpusCount, const CandidateProvenance& prov )</d> +<d l="1712" e="1872" n="lexicalScoresNameExactTiered" sc="rw" p="src/lexical.h" cx="40" ccx="68" in="2" churn="95" amp="151" r="8">inline std::vector<float> lexicalScoresNameExactTiered( const IngestResult& ing, std::string_view query, const std::vector<float>* symbolScoreMul )</d> +<d l="1468" e="1485" n="chooseSubjectRoute" sc="rw" p="src/subjectanchor.h" cx="6" ccx="5" in="3" churn="51" amp="50" r="9">inline SubjectRoute chooseSubjectRoute( const IngestResult& ing, const Graph& g, std::string_view task, bool servesBodiesAndCallers )</d> +<d l="808" e="812" n="NameCorpusStats" sc="NameCorpusStats" p="src/naminglens.h" churn="23" amp="62" r="10">struct NameCorpusStats</d> +<!-- demote: a <t> in sigs is a lower same-file sibling past answer row 10, a pointer (p= file, sym= name, r= rank), not the answer --> +<t p="src/subjectanchor.h" sym="routeAnchorFallThrough" r="11"/> +<d l="1089" e="1190" n="runEvalMined" sc="rw" p="src/eval.h" cx="25" ccx="38" in="1" churn="18" amp="52" r="12">inline int runEvalMined( const std::string& root, const IngestResult& ing, const Graph& g, const std::string& path )</d> +<d l="48" e="99" n="LensRanking" sc="LensRanking" p="src/packtask.h" churn="93" amp="211" r="13">struct LensRanking</d> +<d l="48" e="63" n="hasIdentifierShape" sc="namesplit" p="src/infra/namesplit.h" layer="infra" cx="8" ccx="7" in="5" churn="14" amp="54" r="14">inline bool hasIdentifierShape( std::string_view w ) noexcept</d> +<d l="687" e="972" n="runEvalSkills" sc="rw" p="src/skilleval.h" cx="56" ccx="97" in="1" churn="20" amp="75" r="15">inline int runEvalSkills( const std::string& root, const IngestResult& ing, const Graph& g, const std::string& labelsPath )</d> +<d l="1412" e="1464" n="applyAnchorHonesty" sc="rw" p="src/subjectanchor.h" cx="13" ccx="19" in="1" churn="51" amp="48" r="16">inline std::vector<SourceSyntaxAnchor> applyAnchorHonesty( const IngestResult& ing, std::string_view task, SubjectRoute& out )</d> +<t p="src/lexical.h" sym="Bm25Params" r="17"/> +<d l="171" e="380" n="runEval" sc="rw" p="src/eval.h" cx="46" ccx="69" in="1" churn="18" amp="52" r="18">inline int runEval( const std::string& root, const IngestResult& ing, const Graph& g, const std::vector<char>& currentDiff )</d> +<d l="31" e="31" n="kLexWeightDoc" sc="rw" p="src/lexindex.h" churn="10" amp="27" pure="1" r="19">inline constexpr int kLexWeightDoc = 2</d> +<d l="1875" e="1878" n="lexicalScoresNameExact" sc="rw" p="src/lexical.h" cx="1" in="3" churn="95" amp="152" r="20">inline std::vector<float> lexicalScoresNameExact( const IngestResult& ing, std::string_view query )</d> +<d l="351" e="365" n="hedgeOffTaskPick" sc="rw" p="src/exemplar.h" cx="5" ccx="3" in="1" churn="9" amp="20" r="21">inline void hedgeOffTaskPick( const IngestResult& ing, ExemplarPick& pick )</d> +<t p="src/lexical.h" sym="lexicalScoresTiered" r="22"/> +… [275 more display lines; full output is 31831 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: 1.26s** + +````` +<ctx task="why does src/lexical.h chooseForRanker pick name-exact BM25" route="subtoken+body" root="." confidence="low" margin_pct="0" at="914c4045d" doc_mentions="2" schema="ripwire.for/v1" bundle="compact" bodies="0" reason="compact-route" budget_bytes="7500" doc_mentions_capped="1" doc_mentions_t … [line truncated: 28 more bytes on this line] +<!-- ripwire for schema=ripwire.for/v1: bundle=/bodies=/reason= the body posture; d: cx= ccx= complexity, in= callers (absent cx/ccx/in = 0), churn= amp= change, clone= tested= 1, sc= scope, id=p::sc::n; total= shown= capped=1 if cut; task= the query; d pure=1 const/constexpr sig, next= the follow-up to paste; route= name-exact(X)|subtoken+body[:broad|:declined]; confidence=/margin_pct= head score drop (low=flat); h l= p= n=, c n= l= p= (p= if not h's; same-named joined, shown= counts them), noedge= no callee resolved; h qword= its name (case-folded, leading _#$@ dropped) equals that question word (by name, not resolved, not the only one), first, calls to 100 (capped=1 next= all); qword_cut= owners not so served, next= the first; fold kind=bodies: b t= n= p= l= top ranked rows' whole bodies, not the answer; served= of total= in budget_bytes=; slice/skip p= n= l=; skip bytes= next=; a skip makes sigs next= it, sigs_next= the signatures-only re-call; t p= file outside sigs (weaker), t sym= its top symbols not in sigs/syms (a pointer, not the answer), r= rank (gap = trimmed); t tsym= up to 2 more file symbols named by a task word (a name match); t order: code files first, then doc files (a code question); t page rows go on to file-page row 160 (code question: 160 code rows, docs within row 160); past page 0 (code question: past 40 code rows, a doc past row 40) listed last, head files skipped; past 120 of those p= only, p_only= counts them; t folded=class=N: N p= only rows of that class (doc|config|script|testdata|other) not listed, next= pages to them; d layer=: built-in arch layer (game|infra|render|math|audio|ai|test) from a dir name in p=; d e= its last line (absent=unknown, never 0; l= the name's line); c prov=split: a resolver split arm; may be another arm's (NOT a claim the edge is false) [doc mentions: 2 docs, 1 symbol; doc_mentions=] --> +<!-- root= is the crawl root; p= below is RELATIVE to it (single-root only; absent => p= is ingest's own path, unchanged); at=this commit(+dirty). [budget_bytes= is the default BYTE target this ranked payload was shaped toward: row text shortens toward it, no row of the ranked head is removed for it (sigs past_target=)] [sigs capped=1 with shown=total: rows shrunk, none dropped] [sigs past_target=K: the last K rows are past the budget_bytes target, served because they are rows of the ranked head; none is cut] [sigs sigs_next=: one call serving all total= rows uncut] [docs_dropped=N: N shown rows have a doc comment not printed (r>24 always, r5..24 if capped)] [cut: doc_mentions_capped="1" doc_mentions_total="3" — an indexing cap dropped content not shown here]; lego/compose collapse to a counted stub by default (a disclosed cut): total= that section's own pre-cap row count, shown="0" capped="1" (nothing rendered here), next= names the sections=lego,compose flag that restores both sections byte-identically in one call est_tokens= prices this bundle in tokens --> +<sigs shown="40" total="40" capped="1" past_target="14" docs_dropped="30" sigs_next="--for='why does src/lexical.h chooseForRanker pick name-exact BM25' --signatures-only --no-mention-boost --token-budget=6400" next="--expand=src/eval.h:716:runEvalRetrieval"> +<d l="2015" e="2021" n="lexicalScoresNameExactRanked" sc="rw" p="src/lexical.h" cx="1" in="4" churn="95" amp="153" r="1" next="--expand=src/lexical.h:lexicalScoresNameExactRanked"> +<doc>The name-exact ranker AS THE RETRIEVAL LENS SERVES IT: whole-name BM25 plus the definition-over-…</doc>inline std::vector<float> lexicalScoresNameExactRanked( const IngestResult& ing, std::string_view query, const std::vector<float>* symbolScoreMul )</d> +<d l="158" e="169" n="printEvalRankerNote" sc="rw" p="src/eval.h" cx="1" in="1" churn="18" amp="52" r="2"> +<doc>P11.12: the interpretive footer for --eval's ranker table, pulled into its own function so the 9…</doc>inline void printEvalRankerNote()</d> +<d l="716" e="795" n="runEvalRetrieval" sc="rw" p="src/eval.h" cx="7" ccx="10" in="1" churn="18" amp="52" r="3">inline int runEvalRetrieval( const IngestResult& ing, const Graph& g )</d> +<d l="1108" e="1145" n="chooseSubjectRouteUnchecked" sc="rw" p="src/subjectanchor.h" cx="14" ccx="11" in="1" churn="51" amp="48" r="4"> +<doc>The route the subject reading picks, before the CONFIDENCE-ANCHOR check. `servesBodiesAndCallers…</doc>inline SubjectRoute chooseSubjectRouteUnchecked( const IngestResult& ing, const Graph& g, std::string_view task, bool servesBodiesAndCallers )</d> +<d l="194" e="194" n="kWeakLexicalScoreThreshold" sc="rw" p="src/lexical.h" churn="95" amp="149" pure="1" r="5">inline constexpr float kWeakLexicalScoreThreshold = 1.0f</d> +<d l="7282" e="7295" n="candidatesRootTag" sc="rw" p="src/serialize.h" cx="5" ccx="4" in="1" churn="521" amp="627" r="6">inline std::string candidatesRootTag( std::size_t keep, std::size_t corpusCount, const CandidateProvenance& prov )</d> +<d l="1712" e="1872" n="lexicalScoresNameExactTiered" sc="rw" p="src/lexical.h" cx="40" ccx="68" in="2" churn="95" amp="151" r="7">inline std::vector<float> lexicalScoresNameExactTiered( const IngestResult& ing, std::string_view query, const std::vector<float>* symbolScoreMul )</d> +<d l="1468" e="1485" n="chooseSubjectRoute" sc="rw" p="src/subjectanchor.h" cx="6" ccx="5" in="3" churn="51" amp="50" r="8">inline SubjectRoute chooseSubjectRoute( const IngestResult& ing, const Graph& g, std::string_view task, bool servesBodiesAndCallers )</d> +<d l="808" e="812" n="NameCorpusStats" sc="NameCorpusStats" p="src/naminglens.h" churn="23" amp="62" r="9">struct NameCorpusStats</d> +<d l="1238" e="1257" n="routeAnchorFallThrough" sc="rw" p="src/subjectanchor.h" cx="5" ccx="5" in="1" churn="51" amp="48" r="10">inline RouteChoice routeAnchorFallThrough( std::string_view query, const RouteChoice& anchored )</d> +<d l="1089" e="1190" n="runEvalMined" sc="rw" p="src/eval.h" cx="25" ccx="38" in="1" churn="18" amp="52" r="11">inline int runEvalMined( const std::string& root, const IngestResult& ing, const Graph& g, const std::string& path )</d> +<d l="48" e="99" n="LensRanking" sc="LensRanking" p="src/packtask.h" churn="93" amp="211" r="12">struct LensRanking</d> +<d l="48" e="63" n="hasIdentifierShape" sc="namesplit" p="src/infra/namesplit.h" layer="infra" cx="8" ccx="7" in="5" churn="14" amp="54" r="13">inline bool hasIdentifierShape( std::string_view w ) noexcept</d> +<d l="687" e="972" n="runEvalSkills" sc="rw" p="src/skilleval.h" cx="56" ccx="97" in="1" churn="20" amp="75" r="14">inline int runEvalSkills( const std::string& root, const IngestResult& ing, const Graph& g, const std::string& labelsPath )</d> +<d l="1412" e="1464" n="applyAnchorHonesty" sc="rw" p="src/subjectanchor.h" cx="13" ccx="19" in="1" churn="51" amp="48" r="15">inline std::vector<SourceSyntaxAnchor> applyAnchorHonesty( const IngestResult& ing, std::string_view task, SubjectRoute& out )</d> +<!-- demote: a <t> in sigs is a lower same-file sibling past answer row 10, a pointer (p= file, sym= name, r= rank), not the answer --> +<t p="src/lexical.h" sym="Bm25Params" r="16"/> +<d l="2845" e="2954" n="chooseForRanker" sc="rw" p="src/lexical.h" cx="18" ccx="23" in="6" churn="95" amp="155" r="17">inline RouteChoice chooseForRanker( const IngestResult& ing, std::string_view query )</d> +<d l="171" e="380" n="runEval" sc="rw" p="src/eval.h" cx="46" ccx="69" in="1" churn="18" amp="52" r="18">inline int runEval( const std::string& root, const IngestResult& ing, const Graph& g, const std::vector<char>& currentDiff )</d> +<d l="31" e="31" n="kLexWeightDoc" sc="rw" p="src/lexindex.h" churn="10" amp="27" pure="1" r="19">inline constexpr int kLexWeightDoc = 2</d> +<d l="1875" e="1878" n="lexicalScoresNameExact" sc="rw" p="src/lexical.h" cx="1" in="3" churn="95" amp="152" r="20">inline std::vector<float> lexicalScoresNameExact( const IngestResult& ing, std::string_view query )</d> +<d l="351" e="365" n="hedgeOffTaskPick" sc="rw" p="src/exemplar.h" cx="5" ccx="3" in="1" churn="9" amp="20" r="21">inline void hedgeOffTaskPick( const IngestResult& ing, ExemplarPick& pick )</d> +<d l="1625" e="1681" n="lexicalScoresTiered" sc="rw" p="src/lexical.h" cx="4" ccx="4" in="5" churn="95" amp="154" r="22">inline std::vector<float> lexicalScoresTiered( const IngestResult& ing, const std::vector<std::uint32_t>& outOff, const std::vector<NodeId>& outTarge … [line truncated: 104 more bytes on this line] +… [275 more display lines; full output is 31784 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.* + +````` +<ctx schema="ripwire.lego/v1" root="."> +<!-- ripwire lego schema=ripwire.lego/v1: ONE interface/base type: <iface n= p= defs= implementors=>, its <m> method contract, every implementor. counts_floor=1: every count is a FLOOR, never a total. graph_ambiguous=/graph_unresolved=: resolver gauge. graph_unindexed=N: N files no grammar could read (the map header's unindexed=); their calls raise neither gauge. root=: p= relative to it. methods=0 caveat=not-extracted-for-lang: no <m> contract read for this language. --> +<lego graph_ambiguous="3984" graph_unresolved="20100" graph_unindexed="313" counts_floor="1"> +<iface n="Vehicle" p="test/legofix/vehicle.rs" methods="0" caveat="not-extracted-for-lang" defs="1" implementors="2"> +<impl n="Car" p="test/legofix/vehicle.rs:12"/> +<impl n="Bike" p="test/legofix/vehicle.rs:13"/> +</iface> +</lego> +</ctx> +````` + +## `./build/ripwire . --exemplar="format byte sizes for humans"` + +*The repo's best-in-class instance to imitate before writing new code (picked by ROLE).* + +````` +<!-- ripwire exemplar schema=ripwire.exemplar/v1: the best-in-class instance of kind= for the task, chosen by role: n= p= in= ccx= tested=, <bodies> +<b> to imitate. window: shown= total= capped= (capped=1 cut). root=: p= relative to it. candidates=N: instances of kind= under the ccx ceiling the pick was ranked from. low_confidence=1: weak task-to-kind match, fell back to fn unless off_task=1; pass a kind (fn|method|class...). b t= l=: the body's … [line truncated: 25 more bytes on this line] +<exemplar schema="ripwire.exemplar/v1" kind="fn" candidates="21230" n="kindIs" p="src/infra/nodekind.h:46" in="445" ccx="3" root="." tested="1" low_confidence="1"> +<bodies shown="1" total="1" capped="0"> +<b t="fn" l="46" p="src/infra/nodekind.h" n="kindIs"> +<![CDATA[inline bool kindIs( const char* t, const char ( &lit )[N] ) noexcept +{ + for( std::size_t i = 0; i < N; ++i ) // N includes lit's NUL — comparing it is what makes this equality, not a prefix test + { + if( t[i] != lit[i] ) + { + return false; + } + } + return true; +}]]></b></bodies></exemplar> +````` + +## `./build/ripwire . --help-task="calls(runDefaultMap, rankGraphTeleport)"` + +*Deterministic enhanced help: a closed claim in the task is a structured shape, so the router recommends the ONE command that answers it (--verify) with the evidence behind the pick. Advice only — nothing executes.* + +````` +<!-- ripwire help-task schema=ripwire.help-task/v1: which verb answers this task: status=recommend|abstain confidence= score= margin=, <facts> the evidence. choice intent= skill= reason=: the route matched, the skill owning it, the evidence in words. git=/dirty=: the root is a git repo / its tree differs from HEAD (the stamp's +dirty). trace=1: the task text has a stack/sanitizer trace shape; it routes to from-trace. resolved_symbols=N: indexed names the task NAMES; a bare short/common word needs backticks or F(). --> +<task-route schema="ripwire.help-task/v1" status="recommend" confidence="high" score="100" margin="100"> +<facts git="1" dirty="0" trace="0" resolved_symbols="2"/> +<choice intent="verify-claim" skill="ripwire-navigate" reason="closed claim grammar" score="100"> +<run>ripwire '.' --verify='calls(runDefaultMap, rankGraphTeleport)'</run> +</choice> +</task-route> +````` + +## `./build/ripwire . --help-task="write a cheerful release announcement"` + +*The honest half of the contract: a task with no ripwire-shaped evidence ABSTAINS with zero commands rather than guessing.* + +````` +<!-- ripwire help-task schema=ripwire.help-task/v1: which verb answers this task: status=recommend|abstain confidence= score= margin=, <facts> the evidence. next=: the one pasteable follow-up. git=/dirty=: the root is a git repo / its tree differs from HEAD (the stamp's +dirty). trace=1: the task text has a stack/sanitizer trace shape; it routes to from-trace. resolved_symbols=N: indexed names the task NAMES; a bare short/common word needs backticks or F(). --> +<task-route schema="ripwire.help-task/v1" status="abstain" confidence="none" score="0" margin="0" next="--for='write a cheerful release announcement'"> +<facts git="1" dirty="0" trace="0" resolved_symbols="0"/> +</task-route> +````` + +## `./build/ripwire . --recall="quality delta gating exit codes"` + +*Most relevant DOCS' full bodies (markdown only) — recall what is already written down.* + +````` +ripwire recall — "quality delta gating exit codes" — 146 relevant of 359 document files, best-first — total=146 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 21.925) ━━ [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. + +| Code | Meaning | +| --- | --- | +| 0 | The command completed. | +| 1 | The command refused the request. A refusal names the reason on stderr. When `--callers`, `--callees`, `--uses`, `--impact` or `--path` refuse a selector that matches no indexed definition, they also print an answer on stdout: the verb's element with `found="0"` and the name to retry with. | +| 2 | A policy gate fired: `--arch` found a layering violation, `--scan-skill` found a CRITICAL, `--quality-delta` found new debt. | +| 3 | The output exceeded the token budget that you set. | +| 4 | `--test-gate` found an open obligation. | +| 5 | The memory guard stopped the run: over `--max-memory` (default 65% of the machine's memory) with no partial answer possible, or a verb other than the default map facing a partial index. One stderr line names the limit and the override. | + +#### 6.3 JSON output + +`--json` emits JSON instead of XML, with keys mirroring the XML attribute names one to one. It is an +allow-list: the default map, `--for`, `--pack-task`, `--callers`, `--callees`, `--impact`, +`--quality-delta`, `--test-gate`, `--metrics`, `--flags`, and `--plan-lanes`, which is JSON-native. Every other +verb refuses on stderr with exit 1 rather than silently falling back to XML, so a verb added tomorrow +refuses by default. + + + +━━ CHANGELOG.md (relevance 20.987) ━━ [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 +… [141 more lines, 13749 bytes total] +````` + +stderr: + +````` +ripwire: redacted 1 secret from emitted context (keyword-gated-secret=1) — pass --no-redact to disable +````` + +## `./build/ripwire <scratch>/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 1503096-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=957 + +━━ commands.md (relevance 33.748) ━━ [sections: 1 of 166 selected (196 in doc), section-granular; whole doc 639182 B; lines="3910-3914"; dropped_by_budget=165] [truncated: 1865 of 7797 bytes] +### `--field-affinity[=STRUCT]` + +**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. + +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)) +````` + +stderr: + +````` +ripwire: redacted 1 secret from emitted context (keyword-gated-secret=1) — pass --no-redact to disable +````` + +## `./build/ripwire . --tree` + +*File-by-file orientation map (top symbols per file).* + +````` +<!-- ripwire tree schema=ripwire.tree/v1: each file with its top 3 symbols by rank, files by best symbol: <file p= symbols=> of <s t= n=>; of files= indexed, files_unlisted= have none. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). symbols_capped=: 1 = cut. root=: p= relative to it. pr_iters=N: PageRank iterations. shown_symbols=: <s> rows printed. next=: the one pasteable follow-up. --> +<tree schema="ripwire.tree/v1" files="4852" files_unlisted="108" shown="80" capped="1" total="4744" has_more="1" next_offset="80" offset="0" limit="0" pr_iters="37" root="." shown_symbols="232" symbols_capped="1" next="--tree --offset=80"> +<file p="src/infra/nodekind.h" symbols="1"> +<s t="fn" n="kindIs"/> +</file> +<file p="src/ingest_metrics.h" symbols="91"> +<s t="fn" n="nodeTextOf"/> +<s t="fn" n="nodeFieldText"/> +<s t="struct" n="CtrlKind"/> +</file> +<file p="src/infra/namesplit.h" symbols="12"> +<s t="fn" n="isIdentChar"/> +<s t="fn" n="afterLast"/> +<s t="fn" n="isIdentStart"/> +</file> +<file p="src/model.h" symbols="257"> +<s t="fn" n="relForHash"/> +<s t="fn" n="rootRelPath"/> +<s t="fn" n="isStructOrNamedType"/> +</file> +<file p="src/infra/Diagnostics.h" symbols="102"> +<s t="macro" n="RW_ASSUME_"/> +<s t="macro" n="RW_ASSUME_"/> +<s t="macro" n="ASSUME"/> +</file> +<file p="src/infra/enumcount.h" symbols="7"> +<s t="fn" n="enumTableAt"/> +<s t="fn" n="spellsEnumerator"/> +<s t="fn" n="namesEnumerator"/> +</file> +… [365 more display lines; full output is 11021 bytes on 1 raw line(s)] +````` + +## `./build/ripwire . --html=<scratch>/aux/map2.html` + +*Self-contained HTML force-directed call graph.* + +**wall time: 1.86s** + +````` +(empty) +````` + +Artifact written: + +````` + 155977 <scratch>/aux/map2.html +````` + +## `./build/ripwire . --order=stable --top-k=5` + +*Stable (path/id) emit order — provider KV-cache hits across re-runs.* + +````` +<!-- ripwire map schema=ripwire.map/v1: ranked symbol map: <f p= layer=> groups <s t= n= sc= k= amb=> rows (k= rank), <c n=> resolved callees; the header comment is data. est_tokens=: price as emitted (an upper bound under compact). root=: p= relative to it. pr_iters=N: PageRank iterations. <inv listed= unlisted=>: files the ranked rows show / do not (sum = files=), each named or counted below. <entry p= n=>: 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. <ls p= n= f=>: 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 <c> 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. lens=: attributes another form of this answer serves, withheld here. sc=: enclosing scope; the full id is p::sc::n (p= of the row or its <f>) and selectors take it. --> +<!-- t=modscope=a-file's-MODULE-SCOPE(n=<file-scope>):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 --> +<!-- t=type|alias|functype=a-Go-named-type-by-its-written-form:type=a-defined-type-whose-WRITTEN-form-is-not-a-struct/iface/func-literal(type-N-string;type-W-Pair-too,whatever-Pair-is-underneath),alias=type-A=B,functype=type-F-func(...) --> +<!-- t=alias|functype-in-C++-and-.h:alias=using-X=Y(also-templated-or-class-scope)or-namespace-L=lib(defs=X-prints-its-written-target-as-to=),functype=a-typedef-of-a-function-or-function-pointer-type(typedef-void(*F)(int));other-typedefs-read-t=struct --> +<r schema="ripwire.map/v1" root="." pr_iters="37" lens="k,est_tokens"> +<f p="src/infra/Diagnostics.h" layer="infra"> +<s t="macro" n="RW_ASSUME_"> +<c n="RW_CHECK_"/> +</s> +</f> +<f p="src/infra/namesplit.h" layer="infra"> +<s t="fn" n="isIdentChar" sc="namesplit"> +</s> +</f> +<f p="src/infra/nodekind.h" layer="infra"> +<s t="fn" n="kindIs" sc="rw"> +</s> +</f> +<f p="src/ingest_metrics.h"> +<s t="fn" n="nodeTextOf"> +</s> +</f> +<f p="src/model.h"> +<s t="fn" n="relForHash" sc="rw"> +</s> +</f> +<inv listed="5" unlisted="4847"> +<entry p="scripts/changelog_assemble.py" n="main"> +<c n="repoRoot"/> +<c n="fragmentNames"/> +… [91 more display lines; full output is 10376 bytes on 1 raw line(s)] +````` + + +--- + +# navigate / answer a question + +## `./build/ripwire . --around=rankGraphTeleport` + +*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.* + +````` +<!-- ripwire around schema=ripwire.around/v1: call neighbourhood of of=: depth= hops, fanout= kept per hop; absent rows lie outside that boundary. est_tokens=: price as emitted (an upper bound under compact). root=: p= relative to it. 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. overloads=N: N same-name defs merged in this row; shown= counts each. prov=scip|binding|import|split|final-segment: how that <c> 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. <c via="name">: that callee matched by name alone (receiver unproven); it does NOT mean the edge is false. <c x=N>: N same-named via=name rows merged; callees=FILE:SYM lists all. sc=: enclosing scope; the full id is p::sc::n (p= of the row or its <f>) and selectors take it. amb=K: K calls split over several defs. 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. --> +<!-- t=modscope=a-file's-MODULE-SCOPE(n=<file-scope>):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 --> +<!-- t=type|alias|functype=a-Go-named-type-by-its-written-form:type=a-defined-type-whose-WRITTEN-form-is-not-a-struct/iface/func-literal(type-N-string;type-W-Pair-too,whatever-Pair-is-underneath),alias=type-A=B,functype=type-F-func(...) --> +<!-- t=alias|functype-in-C++-and-.h:alias=using-X=Y(also-templated-or-class-scope)or-namespace-L=lib(defs=X-prints-its-written-target-as-to=),functype=a-typedef-of-a-function-or-function-pointer-type(typedef-void(*F)(int));other-typedefs-read-t=struct --> +<!-- a bound BIT this walk, so raising it would return more: depth_truncated=1 means at least one symbol one hop past depth= is absent; fanout_cut=N means N distinct symbols were dropped by the fanout= cap and appear NOWHERE here (exact, not a floor: a neighbour another hub re-admitted is not counted). Neither attribute is emitted when its bound cut nothing, so absent means that bound did not bind and raising it returns nothing new. The knobs are around-depth=N and around-fanout=K. --> +<!-- files=4852 symbols=45031 edges=45381 shown=12 est_tokens=3402 ambiguous=3984 unresolved=20100 locality_pinned=14 external=12460 declined=45307 extent_suspect_syms=12 macro_blanked_files=7 skipped_oversize=15 unindexed="txt:85,tsv:54,mod:33,xml:33,jsonl:26,scm:25" unindexed_exts=23 order=important-first --> +<r schema="ripwire.around/v1" root="." of="rankGraphTeleport" depth="1" fanout="32" depth_truncated="1" est_tokens="3402"> +<f p="src/graph.h"> +<s t="fn" n="rankGraphTeleport" sc="rw" amb="1" k="1.0000"> +<c n="biasPrior"/> +<c n="PROFILE_SCOPE_DESCRIBE" prov="split"/> +<c n="PROFILE_SCOPE_DESCRIBE" prov="split"/> +<c n="pageRankDouble"/> +</s> +<s t="fn" n="biasPrior" sc="rw" k="0.5000"> +<c n="ASSUME_NO_ALIAS_BUF"/> +</s> +<s t="fn" n="rankGraph" sc="rw" k="0.5000"> +<c n="rankGraphTeleport"/> +</s> +<s t="fn" n="anchoredLexicalRank" sc="rw" k="0.5000"> +<c n="localityKeyAt"/> +<c n="rankGraphTeleport"/> +<c n="blendMaxNorm"/> +<c n="ASSUME"/> +<c n="NodeId"/> +</s> +</f> +<f p="src/eval.h"> +<s t="fn" n="runEval" sc="rw" amb="4" k="0.5000"> +… [169 more display lines; full output is 8418 bytes on 1 raw line(s)] +````` + +## `./build/ripwire . --around=rankGraphTeleport --around-depth=2` + +*The restoring knob: --around-depth=2 brings back the whole 2-hop neighbourhood (depth="2" on the root) — pay for it only when the 1-hop view was not enough.* + +````` +<ctx schema="ripwire.pack-signatures/v1"> +<!-- ripwire pack-signatures schema=ripwire.pack-signatures/v1: the ranked map plus <sigs> +<d l= n= sc= pure=> signature rows. est_tokens=: price as emitted (an upper bound under compact). root=: p= relative to it. 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. locali … [line truncated: 1576 more bytes on this line] +<!-- t=modscope=a-file's-MODULE-SCOPE(n=<file-scope>):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 --> +<!-- t=type|alias|functype=a-Go-named-type-by-its-written-form:type=a-defined-type-whose-WRITTEN-form-is-not-a-struct/iface/func-literal(type-N-string;type-W-Pair-too,whatever-Pair-is-underneath),alias=type-A=B,functype=type-F-func(...) --> +<!-- t=alias|functype-in-C++-and-.h:alias=using-X=Y(also-templated-or-class-scope)or-namespace-L=lib(defs=X-prints-its-written-target-as-to=),functype=a-typedef-of-a-function-or-function-pointer-type(typedef-void(*F)(int));other-typedefs-read-t=struct --> +<!-- a bound BIT this walk, so raising it would return more: depth_truncated=1 means at least one symbol one hop past depth= is absent; fanout_cut=N means N distinct symbols were dropped by the fanout= cap and appear NOWHERE here (exact, not a floor: a neighbour another hub re-admitted is not counted). Neither attribute is emitted when its bound cut nothing, so absent means that bound did not bind and raising it returns nothing new. The knobs are around-depth=N and around-fanout=K. --> +<!-- files=4852 symbols=45031 edges=45381 shown=159 est_tokens=29856 ambiguous=3984 unresolved=20100 locality_pinned=14 external=12460 declined=45307 extent_suspect_syms=12 macro_blanked_files=7 skipped_oversize=15 unindexed="txt:85,tsv:54,mod:33,xml:33,jsonl:26,scm:25" unindexed_exts=23 order=important-first --> +<r root="." of="rankGraphTeleport" depth="2" fanout="32" depth_truncated="1" fanout_cut="116" est_tokens="30458"> +<f p="src/graph.h"> +<s t="fn" n="rankGraphTeleport" sc="rw" amb="1" k="1.0000"> +<c n="biasPrior"/> +<c n="PROFILE_SCOPE_DESCRIBE" prov="split"/> +<c n="PROFILE_SCOPE_DESCRIBE" prov="split"/> +<c n="pageRankDouble"/> +</s> +<s t="fn" n="biasPrior" sc="rw" k="0.5000"> +<c n="ASSUME_NO_ALIAS_BUF"/> +</s> +<s t="fn" n="rankGraph" sc="rw" k="0.5000"> +<c n="rankGraphTeleport"/> +</s> +<s t="fn" n="anchoredLexicalRank" sc="rw" k="0.5000"> +<c n="localityKeyAt"/> +<c n="rankGraphTeleport"/> +<c n="blendMaxNorm"/> +<c n="ASSUME"/> +<c n="NodeId"/> +</s> +<s t="method" n="localityKeyAt" sc="Graph" k="0.3333"> +… [2411 more display lines; full output is 74072 bytes on 1 raw line(s)] +````` + +## `./build/ripwire . --around=rankGraphTeleport --around-fanout=4` + +*The other knob: --around-fanout=4 keeps only the 4 strongest edges per node (default 32) — the same 1-hop depth, a quarter of the rows.* + +````` +<!-- ripwire around schema=ripwire.around/v1: call neighbourhood of of=: depth= hops, fanout= kept per hop; absent rows lie outside that boundary. est_tokens=: price as emitted (an upper bound under compact). root=: p= relative to it. 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 <c> 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. sc=: enclosing scope; the full id is p::sc::n (p= of the row or its <f>) and selectors take it. amb=K: K calls split over several defs. f p=: a file; s t= n=: kind, name; c n=: a resolved callee. s k=: rank. --> +<!-- t=modscope=a-file's-MODULE-SCOPE(n=<file-scope>):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 --> +<!-- t=type|alias|functype=a-Go-named-type-by-its-written-form:type=a-defined-type-whose-WRITTEN-form-is-not-a-struct/iface/func-literal(type-N-string;type-W-Pair-too,whatever-Pair-is-underneath),alias=type-A=B,functype=type-F-func(...) --> +<!-- t=alias|functype-in-C++-and-.h:alias=using-X=Y(also-templated-or-class-scope)or-namespace-L=lib(defs=X-prints-its-written-target-as-to=),functype=a-typedef-of-a-function-or-function-pointer-type(typedef-void(*F)(int));other-typedefs-read-t=struct --> +<!-- a bound BIT this walk, so raising it would return more: depth_truncated=1 means at least one symbol one hop past depth= is absent; fanout_cut=N means N distinct symbols were dropped by the fanout= cap and appear NOWHERE here (exact, not a floor: a neighbour another hub re-admitted is not counted). Neither attribute is emitted when its bound cut nothing, so absent means that bound did not bind and raising it returns nothing new. The knobs are around-depth=N and around-fanout=K. --> +<!-- files=4852 symbols=45031 edges=45381 shown=5 est_tokens=1719 ambiguous=3984 unresolved=20100 locality_pinned=14 external=12460 declined=45307 extent_suspect_syms=12 macro_blanked_files=7 skipped_oversize=15 unindexed="txt:85,tsv:54,mod:33,xml:33,jsonl:26,scm:25" unindexed_exts=23 order=important-first --> +<r schema="ripwire.around/v1" root="." of="rankGraphTeleport" depth="1" fanout="4" depth_truncated="1" fanout_cut="7" est_tokens="1719"> +<f p="src/graph.h"> +<s t="fn" n="rankGraphTeleport" sc="rw" amb="1" k="1.0000"> +<c n="biasPrior"/> +<c n="PROFILE_SCOPE_DESCRIBE" prov="split"/> +<c n="PROFILE_SCOPE_DESCRIBE" prov="split"/> +<c n="pageRankDouble"/> +</s> +<s t="fn" n="biasPrior" sc="rw" k="0.5000"> +<c n="ASSUME_NO_ALIAS_BUF"/> +</s> +<s t="fn" n="rankGraph" sc="rw" k="0.5000"> +<c n="rankGraphTeleport"/> +</s> +<s t="fn" n="anchoredLexicalRank" sc="rw" k="0.5000"> +<c n="localityKeyAt"/> +<c n="rankGraphTeleport"/> +<c n="blendMaxNorm"/> +<c n="ASSUME"/> +<c n="NodeId"/> +</s> +</f> +<f p="src/main.cpp"> +<s t="fn" n="churnRankedGraph" k="0.5000"> +… [14 more display lines; full output is 4254 bytes on 1 raw line(s)] +````` + +## `./build/ripwire . --callers=rankGraphTeleport` + +*Who calls SYM (1-hop in-edges).* + +````` +<!-- ripwire callers schema=ripwire.callers/v1: 1-hop CALLERS of of= (defs= matched, count= distinct symbols): <s t= n= p=>; hop_tested=/hop_untested=. counts_floor=1: every count is a FLOOR, never a total. graph_ambiguous=/graph_unresolved=: resolver gauge. graph_unindexed=N: N files no grammar could read (the map header's unindexed=); their calls raise neither gauge. root=: p= relative to it. <s sites_at=>: its leaf-name calls not proven elsewhere, as [file:]line (p=: def line, default file); not proof each binds. next=: the one pasteable follow-up. --> +<callers schema="ripwire.callers/v1" of="rankGraphTeleport" defs="1" count="7" root="." hop_tested="0" hop_untested="7" graph_ambiguous="3984" graph_unresolved="20100" graph_unindexed="313" counts_floor="1" next="--uses=rankGraphTeleport"> +<s t="fn" n="getIndex" p="src/mcpindex.h:1224" sites_at="1340"/> +<s t="fn" n="rankGraph" p="src/graph.h:14964" sites_at="14968"/> +<s t="fn" n="anchoredLexicalRank" p="src/graph.h:15633" sites_at="15684"/> +<s t="fn" n="runEval" p="src/eval.h:171" sites_at="328"/> +<s t="fn" n="churnDecayRanking" p="src/main.cpp:1433" sites_at="1447"/> +<s t="fn" n="churnRankedGraph" p="src/main.cpp:1472" sites_at="1486 1487 1501"/> +<s t="fn" n="runDefaultMap" p="src/main.cpp:1759" sites_at="1879"/> +</callers> +````` + +## `./build/ripwire . --callers=rankGraphTeleport --legend=full` + +*The same rows under --legend=full: the default is the compact dialect (one compact comment plus schema="ripwire.callers/v1" on the root), and --legend=full restores the prose legend — every row byte and every completeness attribute (counts_floor=, graph_ambiguous=, next=) identical, ~3 KB more legend. Works on EVERY XML verb.* + +````` +<!-- ripwire callers/callees: the 1-hop call hierarchy read off the call graph — the callers form lists symbols that CALL of=; the callees form lists symbols of= itself calls. of= is the selector you passed, defs= how many DEFINITIONS it resolved to (rows UNION every def's neighbours), count= the DISTINCT neighbour symbols (a floor, per counts_floor=), windowed by limit= and offset=. A neighbour that is an indexed function-like #define is a macro row (t="macro", role="macro" on the XML row): the edge crosses a macro expansion, not a plain call — rows carry no role= otherwise. Rows are ordered SOURCE first, then test/bench, then docs; within a tier callers rank by each row's own caller count (most-called first); callees keep path order. hop_tested=/hop_untested= partition count= by the tested= lens below (1-hop, never transitive). tested="1" on a row means an indexed test transitively reaches it (never 0, omitted when it does not). BLIND SPOT the test-gate legend also names: only a CALL EDGE from an INDEXED test symbol counts here, so a shell or CLI-level test running a built binary as a SUBPROCESS is invisible to it and a repo tested that way reads all-untested. Read untested= as no in-process test reaches it, not as no test covers it. next= is the one pasteable follow-up (the uses verb on this selector: the call sites). sites_at= on a caller row: its calls of the called LEAF name, bar ones proven elsewhere, as [file:]line (space-separated, ascending; two calls on a line are one site; no file: p='s); p= stays where the caller is DEFINED. Matched by name like the uses verb's call rows, so not proof each binds here; absent when no call there is spelled like it (an aliased import). counts_floor="1" means every count here is a FLOOR, never a total: edges are extracted from source TEXT by NAME. Missing: dynamic dispatch (virtual/interface/duck-typed), a most-vexing-parse declaration with no call expression, a function-pointer/callback bound to more than one function in scope (reassigned, table-indexed, lambda-bound, or address-taken/reference-bound), and a plain-name binding (fp=handler) whose variable type is not PROVABLY a function pointer (a same-file typedef/declarator; a HEADER typedef is missed; auto/template types are read as unpinned, so KEPT). A macro-generated call site is role="macro" only when its name uniquely names an indexed function-like #define (C-family, t="macro"); a shared name stays a plain call, an unindexed macro is no edge. Read a zero as "none found", never as "none exists". graph_ambiguous=/graph_unresolved= are the whole graph's resolver gauge (calls split over several defs / calls whose in-repo defs were all language-filtered), the map header's ambiguous=/unresolved=. graph_unindexed=N is a third gauge: files no grammar could read (the map header's unindexed=), whose calls raise neither gauge above; absent when zero, and so is this sentence. COUNTING UNIT differs by verb: callers, callees, edit-check, graph-query and pr-context counts are DISTINCT SYMBOLS (repeated calls from one caller, and calls to two overloads, collapse into ONE row; multiplicity survives only in the call graph's edge weight). The reach counts (impact's reaches=, pr-context's dependents=) are the size of a transitive reach SET, each symbol counted once. The uses verb counts call SITES, one row per occurrence — a larger count there for the same symbol is these units agreeing, not disagreeing. The map header's edges= is a unit again different — distinct (caller,callee) PAIRS — and that document carries neither this marker nor this clause. --> +<!-- root= on this element is the crawl root every p= below is RELATIVE to (single-root runs only; absent => p= is the path ingest itself used, unchanged). --> +<callers of="rankGraphTeleport" defs="1" count="7" root="." hop_tested="0" hop_untested="7" graph_ambiguous="3984" graph_unresolved="20100" graph_unindexed="313" counts_floor="1" next="--uses=rankGraphTeleport"> +<s t="fn" n="getIndex" p="src/mcpindex.h:1224" sites_at="1340"/> +<s t="fn" n="rankGraph" p="src/graph.h:14964" sites_at="14968"/> +<s t="fn" n="anchoredLexicalRank" p="src/graph.h:15633" sites_at="15684"/> +<s t="fn" n="runEval" p="src/eval.h:171" sites_at="328"/> +<s t="fn" n="churnDecayRanking" p="src/main.cpp:1433" sites_at="1447"/> +<s t="fn" n="churnRankedGraph" p="src/main.cpp:1472" sites_at="1486 1487 1501"/> +<s t="fn" n="runDefaultMap" p="src/main.cpp:1759" sites_at="1879"/> +</callers> +````` + +## `./build/ripwire . --callers=DoesNotExist` + +*Unknown-symbol REFUSAL shape (exit 1) with a did-you-mean from real edit distance.* + +**exit code: 1** — **wall time: 1.01s** + +````` +<!-- ripwire callers schema=ripwire.callers/v1: 1-hop CALLERS of of= (defs= matched, count= distinct symbols): <s t= n= p=>; hop_tested=/hop_untested=. found=0: no indexed definition matched the selector, nothing listed or counted (zero = none found, not none exists); exit stays 1. --> +<callers schema="ripwire.callers/v1" of="DoesNotExist" found="0"/> +````` + +stderr: + +````` +ripwire: --callers symbol not found: DoesNotExist (note: the lexical definition scan stopped at its budget, 4096 files or 16 MiB, before reading every file, so this miss is not proof the bytes define nothing; --grep=DoesNotExist lists its text uses) +````` + +## `./build/ripwire . --callees=rankGraphTeleport` + +*What SYM calls (1-hop out-edges).* + +````` +<!-- ripwire callees schema=ripwire.callees/v1: 1-hop CALLEES of of= (defs= matched, count= distinct symbols): <s t= n= p= role= tested=>. counts_floor=1: every count is a FLOOR, never a total. graph_ambiguous=/graph_unresolved=: resolver gauge. graph_unindexed=N: N files no grammar could read (the map header's unindexed=); their calls raise neither gauge. stdm n= calls=: of declined_calls=, calls named like a standard-type member of their language (C++ container/string/optional/smart pointer, Rust collection/string/Option/Result; n=) on a receiver no rule tied to an in-tree class (Rust: one of an in-tree type no rule typed too: a generic bound, dyn or impl Trait, a type alias, a glob of a glob, a tuple-struct field, a non-plain pattern, behind Option / Result / Rc / Arc / RefCell / Cell / Mutex / RwLock); no edge or row (may be the std member). root=: p= relative to it. prov=scip|binding|import|split|final-segment: how that <c> edge bound (absent: one unique name); split = one arm of an amb= pick; final-segment = a qualified type matched by last name only. <s tested=1>: a non-test row an indexed test transitively reaches (absent otherwise, never 0). declined_calls=K: K call sites left unbound, in no count; <dc n= l=|in= p= cands=K via=declined>: one such call SITE (callees: called name, line; callers: calling def, file:line); NOT an edge or a caller/callee claim; cands=K: K in-tree defs it could have meant (K may be 1), the resolver proved none; not a claim this call reaches any of them. dc gate=: builtin or std, a name gate declined it; side, a Ruby call whose in-reach defs answer on the other side of self. next=: the one pasteable follow-up. hop_tested=/hop_untested=: count= split by whether an indexed test reaches the row (in-process calls only). --> +<callees schema="ripwire.callees/v1" of="rankGraphTeleport" defs="1" count="4" root="." hop_tested="3" hop_untested="1" declined_calls="6" graph_ambiguous="3984" graph_unresolved="20100" graph_unindexed="313" counts_floor="1" next="--expand=rankGraphTeleport"> +<s t="fn" n="biasPrior" p="src/graph.h:14880"/> +<s t="macro" n="PROFILE_SCOPE_DESCRIBE" p="src/infra/profileScope.h:1282" role="macro" tested="1" prov="split"/> +<s t="macro" n="PROFILE_SCOPE_DESCRIBE" p="src/infra/profileScope.h:1296" role="macro" tested="1" prov="split"/> +<s t="fn" n="pageRankDouble" p="src/pagerank.cpp:99" tested="1"/> +<stdm n="begin,end,size" calls="6"/> +<dc n="size" l="14925" cands="2" via="declined" gate="std"/> +<dc n="begin" l="14926" cands="7" via="declined"/> +<dc n="end" l="14926" cands="7" via="declined"/> +<dc n="begin" l="14947" cands="7" via="declined"/> +<dc n="end" l="14947" cands="7" via="declined"/> +<dc n="begin" l="14947" cands="7" via="declined"/> +</callees> +````` + +## `./build/ripwire . --uses=rankGraphTeleport` + +*The resolvable use-sites (call/read/write/import/extends) with file:line; count= is a floor.* + +````` +<!-- ripwire uses schema=ripwire.uses/v1: resolvable use-sites of of=: <u role=call|macro|read|write|import|extends|type p=file:line in_id=>. counts_floor=1: every count is a FLOOR, never a total. graph_ambiguous=/graph_unresolved=: resolver gauge. graph_unindexed=N: N files no grammar could read (the map header's unindexed=); their calls raise neither gauge. root=: p= relative to it. defs=N: definitions the selector matched; qualify file:name to narrow the call sites. external=1: of= has no definition in the indexed tree under any spelling (stdlib/third-party). count=N: unhedged use-site rows (a floor). --> +<uses schema="ripwire.uses/v1" of="rankGraphTeleport" defs="1" external="0" count="9" root="." graph_ambiguous="3984" graph_unresolved="20100" graph_unindexed="313" counts_floor="1"> +<u role="call" p="src/mcpindex.h:1340" in_id="src/mcpindex.h::rw::getIndex"/> +<u role="call" p="src/graph.h:14968" in_id="src/graph.h::rw::rankGraph"/> +<u role="call" p="src/graph.h:15684" in_id="src/graph.h::rw::anchoredLexicalRank"/> +<u role="call" p="src/eval.h:328" in_id="src/eval.h::rw::runEval"/> +<u role="call" p="src/main.cpp:1447" in_id="churnDecayRanking"/> +<u role="call" p="src/main.cpp:1486" in_id="churnRankedGraph"/> +<u role="call" p="src/main.cpp:1487" in_id="churnRankedGraph"/> +<u role="call" p="src/main.cpp:1501" in_id="churnRankedGraph"/> +<u role="call" p="src/main.cpp:1879" in_id="runDefaultMap"/> +</uses> +````` + +## `./build/ripwire . --graph-query='and(callers(name("rankGraphTeleport"),2),kind(all,fn))'` + +*Composable node-set query: functions within 2 caller-hops of rankGraphTeleport.* + +````` +<!-- ripwire graph-query schema=ripwire.graph-query/v1: graph-query expression over the symbol graph: <s t= n= p=> matching rows. window: shown= capped= (capped=1 cut). counts_floor=1: every count is a FLOOR, never a total. graph_ambiguous=/graph_unresolved=: resolver gauge. graph_unindexed=N: N files no grammar could read (the map header's unindexed=); their calls raise neither gauge. root=: p= relative to it. pr_iters=N: PageRank iterations. expr=: the expression as given; count=: symbols it matched (rows page by shown=/total=). --> +<query schema="ripwire.graph-query/v1" expr="and(callers(name("rankGraphTeleport"),2),kind(all,fn))" count="59" shown="59" capped="0" graph_ambiguous="3984" graph_unresolved="20100" graph_unindexed="313" counts_floor="1" root="." pr_iters="37"> +<s t="fn" n="getIndex" p="src/mcpindex.h:1224"/> +<s t="fn" n="rankGraph" p="src/graph.h:14964"/> +<s t="fn" n="anchoredLexicalRank" p="src/graph.h:15633"/> +<s t="fn" n="emitCommunitiesReport" p="src/verbs_report.h:2732"/> +<s t="fn" n="emitCommunityDrill" p="src/verbs_report.h:2893"/> +<s t="fn" n="computeLensRanking" p="src/verbs_for.h:115"/> +<s t="fn" n="dispatchMainBody" p="src/main.cpp:4711"/> +<s t="fn" n="buildGraphRecorded" p="src/warmsnap_graph.h:448"/> +<s t="fn" n="postCheckJsonBuilt" p="src/mcpedit.h:1120"/> +<s t="fn" n="fetchBody" p="src/mcpverbs.h:5902"/> +<s t="fn" n="runEvalRetrieval" p="src/eval.h:716"/> +<s t="fn" n="runEvalMined" p="src/eval.h:1089"/> +<s t="fn" n="dispatchMcpLine" p="src/mcp.h:1151"/> +<s t="fn" n="runEditVerb" p="src/mcpedit.h:1261"/> +<s t="fn" n="churnDecayRanking" p="src/main.cpp:1433"/> +<s t="fn" n="fetchBodyByName" p="src/mcpverbs.h:5825"/> +<s t="fn" n="symbolQueryJson" p="src/mcpverbs.h:792"/> +<s t="fn" n="anchoredFileScore" p="src/eval.h:111"/> +<s t="fn" n="pathText" p="src/mcpverbs.h:4040"/> +<s t="fn" n="analyzeToString" p="src/mcpverbs.h:456"/> +<s t="fn" n="grepHitsJson" p="src/mcpverbs.h:1350"/> +<s t="fn" n="cochangePartnersJson" p="src/mcpverbs.h:1530"/> +<s t="fn" n="mentionsJson" p="src/mcpverbs.h:1942"/> +<s t="fn" n="forTaskText" p="src/mcpverbs.h:2649"/> +<s t="fn" n="legoText" p="src/mcpverbs.h:3230"/> +<s t="fn" n="ownersText" p="src/mcpverbs.h:3271"/> +<s t="fn" n="exemplarText" p="src/mcpverbs.h:3412"/> +<s t="fn" n="impactText" p="src/mcpverbs.h:3492"/> +… [32 more display lines; full output is 3884 bytes on 1 raw line(s)] +````` + +## `./build/ripwire . --external-surface` + +*Names referenced but never defined in-corpus (stdlib/third-party surface). The root carries names/shown/capped; the default is a 100-row window now, so total= and a pasteable next= join them when it bites (the explicit --limit form carries the same quintet). The sh BUILTINS (cd/echo/set…) are dropped and COUNTED as builtins_excluded= — grep/sed/git stay, they ARE the surface.* + +````` +<!-- ripwire external-surface schema=ripwire.external-surface/v1: names used but never defined in the index: <x n= lang= refs= calls=>. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). next=: the one pasteable follow-up. names=N: distinct external names (the x rows' total). builtins_excluded=N: sh BUILTIN rows (echo printf cd exit test ...) dropped from names=; the include-builtins flag keeps them. --> +<external-surface schema="ripwire.external-surface/v1" names="3750" builtins_excluded="21" shown="100" capped="1" total="3750" has_more="1" next_offset="100" offset="0" limit="0" next="--external-surface --offset=100"> +<x n="grep" lang="sh" refs="18055" calls="18055"/> +<x n="cat" lang="sh" refs="3645" calls="3645"/> +<x n="tr" lang="sh" refs="2782" calls="2782"/> +<x n="python3" lang="sh" refs="2440" calls="2440"/> +<x n="sed" lang="sh" refs="2257" calls="2257"/> +<x n="string_view" lang="cpp" refs="1545" calls="1545"/> +<x n="to_string" lang="cpp" refs="1391" calls="1391"/> +<x n="wc" lang="sh" refs="1212" calls="1212"/> +<x n="ts_node_is_null" lang="cpp" refs="1182" calls="1182"/> +<x n="print" lang="py" refs="1091" calls="1091"/> +<x n="mktemp" lang="sh" refs="1038" calls="1038"/> +<x n="dirname" lang="sh" refs="1016" calls="1016"/> +<x n="uint32_t" lang="cpp" refs="923" calls="923"/> +<x n="ts_node_type" lang="cpp" refs="921" calls="921"/> +<x n="cmp" lang="sh" refs="883" calls="883"/> +<x n="size_t" lang="cpp" refs="870" calls="870"/> +<x n="xmllint" lang="sh" refs="720" calls="720"/> +<x n="stdout" lang="cpp" refs="705" calls="0"/> +<x n="starts_with" lang="cpp" refs="704" calls="704"/> +<x n="stderr" lang="cpp" refs="645" calls="0"/> +<x n="awk" lang="sh" refs="618" calls="618"/> +<x n="diff" lang="sh" refs="595" calls="595"/> +<x n="rm" lang="sh" refs="482" calls="482"/> +<x n="rfind" lang="cpp" refs="458" calls="458"/> +<x n="any_of" lang="cpp" refs="430" calls="430"/> +<x n="add_argument" lang="py" refs="332" calls="332"/> +<x n="ends_with" lang="cpp" refs="300" calls="300"/> +<x n="ts_node_start_byte" lang="cpp" refs="299" calls="299"/> +… [73 more display lines; full output is 5633 bytes on 1 raw line(s)] +````` + +## `./build/ripwire . --external-surface --include-builtins` + +*The restoring knob: --include-builtins keeps the shell builtins in the same 100-row window (they now compete for rows, so the window's tail differs).* + +````` +<!-- ripwire external-surface schema=ripwire.external-surface/v1: names used but never defined in the index: <x n= lang= refs= calls=>. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). next=: the one pasteable follow-up. names=N: distinct external names (the x rows' total). --> +<external-surface schema="ripwire.external-surface/v1" names="3771" shown="100" capped="1" total="3771" has_more="1" next_offset="100" offset="0" limit="0" next="--external-surface --include-builtins --offset=100"> +<x n="grep" lang="sh" refs="18055" calls="18055"/> +<x n="printf" lang="sh" refs="17149" calls="17149"/> +<x n="echo" lang="sh" refs="9884" calls="9884"/> +<x n="cat" lang="sh" refs="3645" calls="3645"/> +<x n="exit" lang="sh" refs="3638" calls="3638"/> +<x n="cd" lang="sh" refs="2913" calls="2913"/> +<x n="tr" lang="sh" refs="2782" calls="2782"/> +<x n="python3" lang="sh" refs="2440" calls="2440"/> +<x n="sed" lang="sh" refs="2257" calls="2257"/> +<x n="return" lang="sh" refs="1842" calls="1842"/> +<x n="string_view" lang="cpp" refs="1545" calls="1545"/> +<x n="to_string" lang="cpp" refs="1391" calls="1391"/> +<x n="wc" lang="sh" refs="1212" calls="1212"/> +<x n="ts_node_is_null" lang="cpp" refs="1182" calls="1182"/> +<x n="command" lang="sh" refs="1170" calls="1170"/> +<x n="print" lang="py" refs="1091" calls="1091"/> +<x n="mktemp" lang="sh" refs="1038" calls="1038"/> +<x n="dirname" lang="sh" refs="1016" calls="1016"/> +<x n="pwd" lang="sh" refs="943" calls="943"/> +<x n="uint32_t" lang="cpp" refs="923" calls="923"/> +<x n="ts_node_type" lang="cpp" refs="921" calls="921"/> +<x n="trap" lang="sh" refs="900" calls="900"/> +<x n="cmp" lang="sh" refs="883" calls="883"/> +<x n="size_t" lang="cpp" refs="870" calls="870"/> +<x n="xmllint" lang="sh" refs="720" calls="720"/> +<x n="stdout" lang="cpp" refs="705" calls="0"/> +<x n="starts_with" lang="cpp" refs="704" calls="704"/> +<x n="stderr" lang="cpp" refs="645" calls="0"/> +… [73 more display lines; full output is 5508 bytes on 1 raw line(s)] +````` + +## `./build/ripwire . --path=main,rankGraphTeleport` + +*Shortest directed call-path SRC -> DST. CHANGED: now reports from_p/to_p/from_defs and resolves the right `main` (was reachable="0").* + +````` +<!-- ripwire path schema=ripwire.path/v1: one DIRECTED call path from= to to=, each <s t= n= p=> a hop; reachable=0 hops=0 when none shown. alts_capped=: 1 = cut. counts_floor=1: every count is a FLOOR, never a total. graph_ambiguous=/graph_unresolved=: resolver gauge. graph_unindexed=N: N files no grammar could read (the map header's unindexed=); their calls raise neither gauge. root=: p= relative to it. next=: the one pasteable follow-up. s site=: a call of this row's name in the row above (arity fit, then owner, first); by name, not proof. s sites=N: N such lines. s call=: its text, <=3 lines/120 B, U+2026=cut; pair 1 only. s sig=: this row's signature, <=160 B; pair 1 only. alts side=from|to of=: further definitions that endpoint's name binds, not printed above (the pick is not provably unique): <d p= sel= class=>, sel= pastes as that endpoint. alts shown_alts=K defs=N: K of the other rows shown; alts_capped=1 they are cut; next= pages the rest. from_p=/to_p=: the definitions from= and to= were bound to. from_defs=/to_defs=: definitions of each name, all searched; above 1, qualify file:name. --> +<path schema="ripwire.path/v1" from="main" to="rankGraphTeleport" from_p="src/main.cpp:4563" to_p="src/graph.h:14921" from_defs="189" to_defs="1" reachable="1" hops="6" next="--expand=src/main.cpp:4622:finishMainRun" root="." graph_ambiguous="3984" graph_unresolved="20100" graph_unindexed="313" coun … [line truncated: 13 more bytes on this line] +<s t="fn" n="main" p="src/main.cpp:4563"/> +<s t="fn" n="finishMainRun" p="src/main.cpp:4622" site="src/main.cpp:4616" call="const int rc = finishMainRun( cfg, argv );" sig="static int finishMainRun( const rw::Config& cfg, char** argv )"/> +<s t="fn" n="runWithCompactLegend" p="src/main.cpp:4384" site="src/main.cpp:4625" call="const int rc = runWithCompactLegend( cfg, argv );" sig="static int runWithCompactLegend( const rw::Config& cfg, char** argv )"/> +<s t="fn" n="dispatchMain" p="src/main.cpp:6325" site="src/main.cpp:4395" sites="4" call="return dispatchMain( cfg, argv );" sig="static int dispatchMain( const rw::Config& cfg, char** argv )"/> +<s t="fn" n="dispatchMainBody" p="src/main.cpp:4711" site="src/main.cpp:6329" call="return dispatchMainBody( cfg, argv );" sig="static int dispatchMainBody( const rw::Config& cfg, char** argv )"/> +<s t="fn" n="runDefaultMap" p="src/main.cpp:1759" site="src/main.cpp:6086" sites="2" call="return runDefaultMap( dsp );" sig="int runDefaultMap( const MainDispatch& d )"/> +<s t="fn" n="rankGraphTeleport" p="src/graph.h:14921" site="src/main.cpp:1879" call="rank = rw::takeRank( rankGraphTeleport( g, diffTeleport( ing, changed ) ), rankDisclosure );" sig="inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>& p, float alpha = 0.85f … [line truncated: 5 more bytes on this line] +<alts side="from" of="main" shown_alts="16" alts_capped="1" defs="183" next="--defs=main --offset=17"> +<d p="docs/counts_snapshot.py:230" sel="docs/counts_snapshot.py:main" class="source"/> +<d p="docs/docs_commands_build.py:900" sel="docs/docs_commands_build.py:main" class="source"/> +<d p="scripts/changelog_assemble.py:170" sel="scripts/changelog_assemble.py:main" class="source"/> +<d p="scripts/merge_resolve.py:208" sel="scripts/merge_resolve.py:main" class="source"/> +<d p="scripts/optremarks.py:289" sel="scripts/optremarks.py:main" class="source"/> +<d p="scripts/tidyadvisory_diff.py:313" sel="scripts/tidyadvisory_diff.py:main" class="source"/> +<d p="src/tsprobe.cpp:70" sel="src/tsprobe.cpp:main" class="source"/> +<d p="bench/agentloop/analyze.py:345" sel="bench/agentloop/analyze.py:main" class="test"/> +<d p="bench/agentloop/backfill_claude_transcripts.py:104" sel="bench/agentloop/backfill_claude_transcripts.py:main" class="test"/> +<d p="bench/agentloop/editsuite/gen_expected.py:47" sel="bench/agentloop/editsuite/gen_expected.py:main" class="test"/> +<d p="bench/agentloop/followup_calls.py:160" sel="bench/agentloop/followup_calls.py:main" class="test"/> +<d p="bench/agentloop/grade_answers.py:609" sel="bench/agentloop/grade_answers.py:main" class="test"/> +<d p="bench/agentloop/power_sim.py:209" sel="bench/agentloop/power_sim.py:main" class="test"/> +<d p="bench/agentloop/run_agentloop.py:1237" sel="bench/agentloop/run_agentloop.py:main" class="test"/> +<d p="bench/agentloop/run_editsuite.py:530" sel="bench/agentloop/run_editsuite.py:main" class="test"/> +<d p="bench/agentloop/select_tasks.py:144" sel="bench/agentloop/select_tasks.py:main" class="test"/> +</alts> +</path> +````` + +## `./build/ripwire . --defs=main,rankGraphTeleport` + +*Which definitions each name binds, one row per definition group with sel= (the spelling that picks it alone in any verb), class=source|test and in= callers; source first.* + +````` +<!-- ripwire defs schema=ripwire.defs/v1: per <name q= defs=> the parsed definitions the name binds (defs= groups; a prototype with its definition is one): <d n= t= p= sel= lang= class=source|test in=>, sel= binds that one alone in any SYM verb, in= distinct callers (a floor); source first, then in=, then path. window: shown= offset= (capped=1 cut). root=: p= relative to it. <d in=N>: N callers in the index (absent: not measured). next=: the one pasteable follow-up. name data_defs=K: data keys or doc headings of that name (JSON/YAML key, markdown heading), not code, not in defs=. name shown=K offset=M: rows M..M+K of defs=; next= pages the rest. name next=: the next page, or (defs=0) the single-name call whose refusal names near names. --> +<defs schema="ripwire.defs/v1" root="."> +<name q="main" defs="183" data_defs="6" shown="16" offset="0" next="--defs=main --offset=16"> +<d n="main" t="fn" p="docs/counts_snapshot.py:230" sel="docs/counts_snapshot.py:main" lang="py" class="source" in="1"/> +<d n="main" t="fn" p="docs/docs_commands_build.py:900" sel="docs/docs_commands_build.py:main" lang="py" class="source" in="1"/> +<d n="main" t="fn" p="scripts/changelog_assemble.py:170" sel="scripts/changelog_assemble.py:main" lang="py" class="source" in="1"/> +<d n="main" t="fn" p="scripts/merge_resolve.py:208" sel="scripts/merge_resolve.py:main" lang="py" class="source" in="1"/> +<d n="main" t="fn" p="scripts/optremarks.py:289" sel="scripts/optremarks.py:main" lang="py" class="source" in="1"/> +<d n="main" t="fn" p="scripts/tidyadvisory_diff.py:313" sel="scripts/tidyadvisory_diff.py:main" lang="py" class="source" in="1"/> +<d n="main" t="fn" p="src/main.cpp:4563" sel="src/main.cpp:main" lang="cpp" class="source" in="0"/> +<d n="main" t="fn" p="src/tsprobe.cpp:70" sel="src/tsprobe.cpp:main" lang="cpp" class="source" in="0"/> +<d n="main" t="fn" p="bench/agentloop/analyze.py:345" sel="bench/agentloop/analyze.py:main" lang="py" class="test" in="1"/> +<d n="main" t="fn" p="bench/agentloop/backfill_claude_transcripts.py:104" sel="bench/agentloop/backfill_claude_transcripts.py:main" lang="py" class="test" in="1"/> +<d n="main" t="fn" p="bench/agentloop/editsuite/gen_expected.py:47" sel="bench/agentloop/editsuite/gen_expected.py:main" lang="py" class="test" in="1"/> +<d n="main" t="fn" p="bench/agentloop/followup_calls.py:160" sel="bench/agentloop/followup_calls.py:main" lang="py" class="test" in="1"/> +<d n="main" t="fn" p="bench/agentloop/grade_answers.py:609" sel="bench/agentloop/grade_answers.py:main" lang="py" class="test" in="1"/> +<d n="main" t="fn" p="bench/agentloop/power_sim.py:209" sel="bench/agentloop/power_sim.py:main" lang="py" class="test" in="1"/> +<d n="main" t="fn" p="bench/agentloop/run_agentloop.py:1237" sel="bench/agentloop/run_agentloop.py:main" lang="py" class="test" in="1"/> +<d n="main" t="fn" p="bench/agentloop/run_editsuite.py:530" sel="bench/agentloop/run_editsuite.py:main" lang="py" class="test" in="1"/> +</name> +<name q="rankGraphTeleport" defs="1"> +<d n="rankGraphTeleport" t="fn" p="src/graph.h:14921" sel="rankGraphTeleport" lang="cpp" class="source" in="7"/> +</name> +</defs> +````` + +## `./build/ripwire . --connect=rankGraphTeleport,runEval,getIndex` + +*Minimal connecting subgraph over 3 symbols (finds shared-caller joins).* + +````` +<!-- ripwire connect schema=ripwire.connect/v1: minimal joining subgraph: <g> groups, <t> terminals, <s connects=> joins, <e f= t=> edges, <unconnected>. counts_floor=1: every count is a FLOOR, never a total. graph_ambiguous=/graph_unresolved=: resolver gauge. graph_unindexed=N: N files no grammar could read (the map header's unindexed=); their calls raise neither gauge. est_tokens=: price as emitted (an upper bound under compact). root=: p= relative to it. hub_floor=D: connects= >= D is hub=1, vacuous. nodes=N: symbols printed, terminals plus joins (a floor). radius=N: undirected hop bound searched (default 6, max 12); raise it with connect-radius=N. e site=: a call of t= in f= (arity fit, then owner, first); by name, not proof. e call=: its text, <=3 lines/120 B, U+2026=cut. e sig=: t='s signature, <=160 B, once per callee. terminals=/groups=/edges=: task symbols resolved, connected groups (g), e edges printed. t n= / s n=: a terminal's / a join's symbol name. --> +<connect schema="ripwire.connect/v1" terminals="3" nodes="3" edges="2" radius="6" groups="1" est_tokens="754" hub_floor="302" root="." graph_ambiguous="3984" graph_unresolved="20100" graph_unindexed="313" counts_floor="1"> +<g terminals="3"> +<t n="runEval" t="fn" p="src/eval.h:171"/> +<t n="rankGraphTeleport" t="fn" p="src/graph.h:14921"/> +<t n="getIndex" t="fn" p="src/mcpindex.h:1224"/> +<e f="runEval" t="rankGraphTeleport" site="src/eval.h:328" call="const std::vector<float> r = rankGraphTeleport( g, diffTeleport( ing, seedMask ) ).rank;" sig="inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>& p, float alpha = 0.85f )"/> +<e f="getIndex" t="rankGraphTeleport" site="src/mcpindex.h:1340" call="const auto [ wsRank, wsIters, wsConverged ] = rankGraphTeleport( ix.g, diffTeleport( ix.ing, changed ) );"/> +</g> +</connect> +````` + +## `./build/ripwire . --impact=rankGraphTeleport` + +*Transitive blast radius — everything that reaches SYM. NOW carries shown/capped.* + +````` +<!-- ripwire impact schema=ripwire.impact/v1: transitive blast radius of of=: <s t= n= p=> reach set, <f via= p=> importers; defs= matched, reaches= their transitive callers, radius_tested= non-tests an indexed test reaches, radius_untested= the rest; importers= files that #include/import a def's file. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). importers_capped=/files_capped=: 1 = cut. counts_floor=1: every count is a FLOOR, never a total. graph_ambiguous=/graph_unresolved=: resolver gauge. graph_unindexed=N: N files no grammar could read (the map header's unindexed=); their calls raise neither gauge. root=: p= relative to it. pr_iters=N: PageRank iterations. shown_importers=: <f> rows (limit= sizes them). importers_next=: the call listing every importer. importers_tests=/importers_dirs=: over EVERY importer of a cut tier: test/bench/fixture files / the 3 dirs (2 path segments) holding most, dir:count. files files=/shown_files=: files the WHOLE reach set touches (rides beside a cut symbol window) / listed; rf syms= reached symbols there, d= fewest hops; files_capped=1 + files_next= when cut. <f lazy=1>: every edge from that importer into a def file is deferred (in a function/block body, or an autoload), firing only if reached; lazy=0: at least one is load-time. declined_calls=K: K call sites left unbound, in no count; <dc n= l=|in= p= cands=K via=declined>: one such call SITE (callees: called name, line; callers: calling def, file:line); NOT an edge or a caller/callee claim; cands=K: K in-tree defs it could have meant (K may be 1), the resolver proved none; not a claim this call reaches any of them. all_next=: the ONE call listing every row of total= (same rows, columnar); next_offset= pages. <s d=N>: hops to of= (1 = direct caller), set where it changes. by_depth=k:n: n of reaches= at depth k, shallowest rows first. next=: the one pasteable follow-up. --> +<impact schema="ripwire.impact/v1" of="rankGraphTeleport" defs="1" reaches="80" by_depth="1:7,2:52,3:13,4:6,5:1,6:1" importers="73" shown_importers="40" importers_capped="1" importers_next="--impact=rankGraphTeleport --limit=73" importers_tests="2" importers_dirs="src:71,test:2" radius_tested="0" ra … [line truncated: 338 more bytes on this line] +<files files="16" shown_files="16" files_capped="0"> +<rf p="src/main.cpp" syms="12" d="1"/> +<rf p="src/eval.h" syms="4" d="1"/> +<rf p="src/graph.h" syms="2" d="1"/> +<rf p="src/mcpindex.h" syms="1" d="1"/> +<rf p="src/mcpverbs.h" syms="29" d="2"/> +<rf p="src/verbs_for.h" syms="7" d="2"/> +<rf p="src/verbs_report.h" syms="6" d="2"/> +<rf p="src/editplan.h" syms="4" d="2"/> +<rf p="src/mcpedit.h" syms="3" d="2"/> +<rf p="src/lsp.h" syms="2" d="2"/> +<rf p="src/mcp.h" syms="2" d="2"/> +<rf p="src/verbs_change.h" syms="2" d="2"/> +<rf p="src/verbs_navigate.h" syms="2" d="2"/> +<rf p="src/warmsnap_graph.h" syms="2" d="2"/> +<rf p="src/forpage.h" syms="1" d="2"/> +<rf p="src/mcpserver.h" syms="1" d="2"/> +</files> +<s t="fn" n="getIndex" p="src/mcpindex.h:1224" d="1"/> +<s t="fn" n="rankGraph" p="src/graph.h:14964"/> +<s t="fn" n="anchoredLexicalRank" p="src/graph.h:15633"/> +<s t="fn" n="churnDecayRanking" p="src/main.cpp:1433"/> +<s t="fn" n="runDefaultMap" p="src/main.cpp:1759"/> +<s t="fn" n="churnRankedGraph" p="src/main.cpp:1472"/> +<s t="fn" n="runEval" p="src/eval.h:171"/> +<s t="fn" n="emitCommunitiesReport" p="src/verbs_report.h:2732" d="2"/> +<s t="fn" n="emitCommunityDrill" p="src/verbs_report.h:2893"/> +<s t="fn" n="computeLensRanking" p="src/verbs_for.h:115"/> +… [73 more display lines; full output is 7439 bytes on 1 raw line(s)] +````` + +## `./build/ripwire . --mentions=rankGraphTeleport` + +*Markdown docs that name SYM in a backtick (doc<->code edges).* + +````` +<!-- ripwire mentions schema=ripwire.mentions/v1: markdown FILES naming of= in backticks (docs=, sections=): <doc p= mentions=>; not a call edge. root=: p= relative to it. defs=N: definitions of= resolved to; rows union their doc mentions. --> +<!-- unbackticked_docs=N: N more markdown files, over readable indexed markdown, name of= as a whole word but not as a clean one-line backtick span (prose, a code block, a span broken across lines) - not in docs=; a text match, so a ceiling --> +<mentions schema="ripwire.mentions/v1" of="rankGraphTeleport" defs="1" docs="6" sections="14" unbackticked_docs="5" root="."> +<doc p="docs/ARCHITECTURE.md" mentions="1"/> +<doc p="docs/EVALS.md" mentions="4"/> +<doc p="prompts/help-wanted/certified-ranking-order.md" mentions="2"/> +<doc p="prompts/help-wanted/correctness-fuzzers.md" mentions="1"/> +<doc p="prompts/help-wanted/graph-unit-tests.md" mentions="5"/> +<doc p="prompts/help-wanted/next-uses-bare-name.md" mentions="1"/> +</mentions> +````` + +## `./build/ripwire . --affected=src/graph.h` + +*Test files that transitively reach the changed file.* + +````` +<!-- ripwire affected schema=ripwire.affected/v1: test files that transitively reach the changed files/symbols: <test p= partner= hops= run=> in evidence order (order= partners=); seeded_by= the reading taken. counts_floor=1: every count is a FLOOR, never a total. graph_ambiguous=/graph_unresolved=: resolver gauge. graph_unindexed=N: N files no grammar could read (the map header's unindexed=); their calls raise neither gauge. run_unknown=1: no runner derivable (a guess would be worse). root=: p= relative to it. seeds=N: symbols the argument matched; only those outside test files seed the caller walk. seed_test_files=N: matched files that are TESTS; listed to run (seed_kind=test), never walk seeds. tests=N: test files listed to run (the rows). reached=N: symbols the transitive caller walk reached from the seeds (seeds excluded). script_gates_unmodelled=N: test/*.sh runners; their subprocess reach is unmodelled, never in tests=/reached=. run_first=N: the first N test files have the most direct evidence (changed/partner/hops=1, else nearest hops=); not a skip list. changed=: the files/symbols argument as given. --> +<affected schema="ripwire.affected/v1" changed="src/graph.h" seeded_by="file" seeds="849" seed_test_files="0" tests="11" reached="1036" script_gates_unmodelled="952" run_first="3" order="evidence" partners="0" root="." graph_ambiguous="3984" graph_unresolved="20100" graph_unindexed="313" counts_floo … [line truncated: 6 more bytes on this line] +<test p="test/connectcore_harness.cpp" hops="1" run="bash test/connectcorecheck.sh"/> +<test p="test/cppqualtmplfix/member.cpp" hops="1" run="bash test/cppqualcheck.sh"/> +<test p="test/verify_csr.cpp" hops="1" run="bash test/a9disclosurecheck.sh"/> +<test p="test/fuzz/readers/readers_ingest.cpp" hops="2" run_unknown="1"/> +<test p="test/includeprecise_unit.cpp" hops="3" run="bash test/includeprecisecheck.sh"/> +<test p="test/rustimport_unit.cpp" hops="3" run="bash test/rustimportprecisecheck.sh"/> +<test p="test/columnarcommafix/columnar_comma_test.cpp" hops="4" run="bash test/columnarcommacheck.sh"/> +<test p="test/cloneband_harness.cpp" hops="5" run="bash test/clonebandcheck.sh"/> +<test p="test/type3clone_harness.cpp" hops="5" run="bash test/type3clonecheck.sh"/> +<test p="test/fuzz/readers/readers_light.cpp" hops="6" run_unknown="1"/> +<test p="test/shstatus_harness.cpp" hops="7" run="bash test/gateexitcheck.sh"/> +</affected> +````` + +## `./build/ripwire . --situ` + +*Mid-task situational report for the current git diff — recorded against a CLEAN tree (contrast with the sandbox run below).* + +````` +ripwire situational-awareness — 0 changed file(s), 0 symbols in them +root: . +at: 914c4045d + (0 changed files — working tree is clean, nothing to analyze) +````` + +## `./build/ripwire . --test-gate` + +*Pre-PR gate on a CLEAN tree: no obligations, exit 0.* + +**wall time: 6.64s** + +````` +<!-- ripwire test-gate schema=ripwire.test-gate/v1: tests <t p= changed= partner= hops= run=> + untested blast radius <u sym= p= l= ccx=>; exit 4 while either exists. tests_capped=/untested_capped=: 1 = cut. counts_floor=1: every count is a FLOOR, never a total. graph_ambiguous=/graph_unresolved=: resolver gauge. graph_unindexed=N: N files no grammar could read (the map header's unindexed=); their calls raise neither gauge. at=: commit+dirty+shallow. next=: the one pasteable follow-up. impacted=N: symbols that transitively call the change (changed symbols excluded). shown_tests=/shown_untested=: t rows and u rows printed, two independent counts. script_gates_unmodelled=N: test/*.sh runners in the corpus, a path count; not call-graph modelled. script_gates_registered=N: shell gates test/regression.sh registers as suite members. script_gates_mapped=N: registered gates with exact dependency evidence (literal paths or RIPWIRE_TEST_DEPS). script_gates_unresolved_dynamic=N: registered gates with no mappable deps; they may cover the change unlisted. ccx_bar=N: the cognitive-complexity bar a u row's ccx= is read against. untested_modscope=N: <file-scope> owners excluded from untested= (#324, uncallable); still in impacted=. tests=/untested=: tests to run (t total) / impacted symbols no test reaches (u total). --> +<test-gate schema="ripwire.test-gate/v1" changed="0" impacted="0" tests="0" untested="0" untested_modscope="0" shown_tests="0" tests_capped="0" shown_untested="0" untested_capped="0" script_gates_unmodelled="952" script_gates_registered="886" script_gates_mapped="292" script_gates_unresolved_dynamic … [line truncated: 136 more bytes on this line] +</test-gate> +````` + +## `./build/ripwire . --grep=DISCLOSE` + +*Literal trigram-indexed search. Each hit carries its MATCHED line as the <hit> element's own CDATA (the <m> wrapper is gone), plus shown/capped/hits_capped and a pasteable next= on the root.* + +````` +<!-- ripwire grep schema=ripwire.grep/v1: literal/regex scan grouped by file: <f p=> +<hit l= in=>CDATA text</hit> (<b>/<a> context around it); complete=1 only for an exhaustive literal scan (beside pattern_meta=, of the literal reading only); <unindexed> = off-index. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). c … [line truncated: 2304 more bytes on this line] +<grep pattern="DISCLOSE" schema="ripwire.grep/v1" root="." files="292" hits="993" shown="100" capped="1" total="993" has_more="1" next_offset="100" offset="0" limit="0" hits_capped="0" suppressed_comment="159" suppressed_string="4" tier_parsed="77" tier_unclassified="771" tier_budget="bytes" tier_fi … [line truncated: 202 more bytes on this line] +<f p=".coderabbit.yaml"> +<hit l="33" in="path_instructions" occ="2"> +<![CDATA[ A degrade path uses DISCLOSE( sink, why ), never ASSUME(false): a one-argument DISCLOSE( msg ) is a debug trace]]> +</hit> +</f> +<f p="src/abicheck.h" parse_degraded="1"> +<hit l="517" in="abicheck::collectAuthoredSites"> +<![CDATA[ DISCLOSE( result, AbiResult::DisclosureWhy::NoMergeBase, "abi: no merge-base for a ref (unrelated history?) — that ref is counted, not compared" );]]> +</hit> +</f> +<f p="src/arch.h"> +<hit l="512" in="rw::parseArchRules"> +<![CDATA[ DISCLOSE( Diagnostics::answerRefused, "--arch exits 1 with path:line and the reason on stderr; no report is printed",]]> +</hit> +<hit l="846" in="rw::readArchBaselineSidecar"> +<![CDATA[ if( sidecar.refused ) { DISCLOSE( baseline, ArchBaselineRead::DisclosureWhy::SymlinkRefused, "arch: refusing to read the arch baseline sidecar through a symlink" ); }]]> +</hit> +<hit l="897" in="rw::openArchBaselineSidecar"> +<![CDATA[ DISCLOSE( Diagnostics::answerRefused, "--baseline exits 1: pathguard names the refused link on stderr and the verb says it cannot write the sidecar",]]> +</hit> +</f> +<f p="src/atoms.h"> +<hit l="372" in="atomdetail::collectExclusions"> +<![CDATA[ DISCLOSE( ex, Exclusions::DisclosureWhy::ForHeaderSaturated, "atoms: the for-header exclusion stream spent its whole budget; the rules reading it are suppressed this run" );]]> +</hit> +<hit l="376" in="atomdetail::collectExclusions"> +<![CDATA[ DISCLOSE( ex, Exclusions::DisclosureWhy::StmtCrementSaturated, "atoms: the statement-crement exclusion stream spent its whole budget; the rules reading it are suppressed this run" );]]> +… [463 more display lines; full output is 30177 bytes on 1 raw line(s)] +````` + +## `./build/ripwire . --grep=DISCLOSE --grep-context=1` + +*Same search with one line of source context either side.* + +````` +<!-- ripwire grep schema=ripwire.grep/v1: literal/regex scan grouped by file: <f p=> +<hit l= in=>CDATA text</hit> (<b>/<a> context around it); complete=1 only for an exhaustive literal scan (beside pattern_meta=, of the literal reading only); <unindexed> = off-index. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). c … [line truncated: 2197 more bytes on this line] +<grep pattern="DISCLOSE" schema="ripwire.grep/v1" root="." files="292" hits="993" shown="100" capped="1" total="993" has_more="1" next_offset="100" offset="0" limit="0" hits_capped="0" suppressed_comment="159" suppressed_string="4" tier_parsed="77" tier_unclassified="771" tier_budget="bytes" tier_fi … [line truncated: 202 more bytes on this line] +<f p=".coderabbit.yaml"> +<hit l="33" in="path_instructions" occ="2"> +<b> +<![CDATA[ External input (files, git, env, argv, MCP/JSON, data read back from a cache) is checked with VALIDATE.]]> +</b> +<![CDATA[ A degrade path uses DISCLOSE( sink, why ), never ASSUME(false): a one-argument DISCLOSE( msg ) is a debug trace]]> +<a> +<![CDATA[ that ships nothing, and a Diagnostics::answerUnchanged reason must be true. A count that cannot be a total must be]]> +</a> +</hit> +</f> +<f p="src/abicheck.h" parse_degraded="1"> +<hit l="517" in="abicheck::collectAuthoredSites"> +<b> +<![CDATA[ {]]> +</b> +<![CDATA[ DISCLOSE( result, AbiResult::DisclosureWhy::NoMergeBase, "abi: no merge-base for a ref (unrelated history?) — that ref is counted, not compared" );]]> +<a> +<![CDATA[ continue;]]> +</a> +</hit> +</f> +<f p="src/arch.h"> +<hit l="512" in="rw::parseArchRules"> +<b> +<![CDATA[ rw::emitTo( stderr, "ripwire: --arch: {}:{}: {} — rules file rejected\n", path.c_str(), lineNo, why );]]> +</b> +… [1061 more display lines; full output is 42138 bytes on 1 raw line(s)] +````` + +## `./build/ripwire . --grep=DISCLOSE --grep-before=1 --grep-after=2 --limit=3` + +*The asymmetric spelling of the same context: one line before and two after each hit (ripgrep's -B/-A), on a three-hit window.* + +````` +<!-- ripwire grep schema=ripwire.grep/v1: literal/regex scan grouped by file: <f p=> +<hit l= in=>CDATA text</hit> (<b>/<a> context around it); complete=1 only for an exhaustive literal scan (beside pattern_meta=, of the literal reading only); <unindexed> = off-index. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). c … [line truncated: 1779 more bytes on this line] +<grep pattern="DISCLOSE" schema="ripwire.grep/v1" root="." files="292" hits="993" shown="3" capped="1" total="993" has_more="1" next_offset="3" offset="0" limit="3" hits_capped="0" suppressed_comment="159" suppressed_string="4" tier_parsed="77" tier_unclassified="771" tier_budget="bytes" tier_files= … [line truncated: 196 more bytes on this line] +<f p=".coderabbit.yaml"> +<hit l="33" in="path_instructions" occ="2"> +<b> +<![CDATA[ External input (files, git, env, argv, MCP/JSON, data read back from a cache) is checked with VALIDATE.]]> +</b> +<![CDATA[ A degrade path uses DISCLOSE( sink, why ), never ASSUME(false): a one-argument DISCLOSE( msg ) is a debug trace]]> +<a> +<![CDATA[ that ships nothing, and a Diagnostics::answerUnchanged reason must be true. A count that cannot be a total must be + labelled a floor; a zero means none found. Flag silent zeros, undisclosed truncation, and gate arms]]></a></hit></f><f p="src/abicheck.h" parse_degraded="1"><hit l="517" in="abicheck::collectAuthoredSites"><b><![CDATA[ {]]></b><![CDATA[ DISCLOSE( result, AbiResult::Disclosu … [line truncated: 148 more bytes on this line] + }]]></a></hit></f><f p="src/arch.h"><hit l="512" in="rw::parseArchRules"><b><![CDATA[ rw::emitTo( stderr, "ripwire: --arch: {}:{}: {} — rules file rejected\n", path.c_str(), lineNo, why );]]></b><![CDATA[ DISCLOSE( Diagnostics::answerRefused, "--arch exits 1 with path:line an … [line truncated: 134 more bytes on this line] + return false;]]></a></hit></f><unindexed count="15" shown="3" capped="1"><f p="CMakeLists.txt"><hit l="122"><![CDATA[# ASSUME and the DISCLOSE( msg ) trace live, which is the only configuration that can catch an]]></hit><hit l="347"><![CDATA[# -DCMAKE_BUILD_TYPE=Release" locally — Release … [line truncated: 382 more bytes on this line] +````` + +## `./build/ripwire . --regex='fnv1a\w+'` + +*Regex search + enclosing symbol.* + +````` +<!-- ripwire grep schema=ripwire.grep/v1: literal/regex scan grouped by file: <f p=> +<hit l= in=>CDATA text</hit> (<b>/<a> context around it); complete=1 only for an exhaustive literal scan (beside pattern_meta=, of the literal reading only); <unindexed> = off-index. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). c … [line truncated: 2221 more bytes on this line] +<grep pattern="fnv1a\w+" schema="ripwire.grep/v1" root="." files="30" hits="118" shown="100" capped="1" total="118" has_more="1" next_offset="100" offset="0" limit="0" hits_capped="0" suppressed_comment="97" suppressed_string="51" tier_parsed="48" tier_unclassified="4" tier_budget="bytes" tier_files … [line truncated: 225 more bytes on this line] +<f p="src/arch.h"> +<hit l="683" in="rw::fnv1a64"> +<![CDATA[inline std::uint64_t fnv1a64( std::string_view s ) noexcept]]> +</hit> +<hit l="685" in="rw::fnv1a64"> +<![CDATA[ return hashutil::fnv1a64( s );]]> +</hit> +<hit l="788" in="rw::archViolHash"> +<![CDATA[ h = hashutil::fnv1aAbsorb( h, c );]]> +</hit> +<hit l="791" in="rw::archViolHash"> +<![CDATA[ h = hashutil::fnv1aMultiply( h ); // NUL separator byte]]> +</hit> +</f> +<f p="src/cloneidiom.h"> +<hit l="919" in="rw::idiomParamTypeKey"> +<![CDATA[ return spelled.empty() ? 0 : fnv1a64( spelled );]]> +</hit> +<hit l="1109" in="rw::oneStatementFacts"> +<![CDATA[ f.ids.push_back( fnv1a64( w ) );]]> +</hit> +<hit l="1112" in="rw::oneStatementFacts"> +<![CDATA[ f.alpha = fnv1a64( renamed );]]> +</hit> +<hit l="1182" in="rw::idiomTokenHashSet"> +<![CDATA[ out.push_back( fnv1a64( t.text ) );]]> +</hit> +… [468 more display lines; full output is 22744 bytes on 1 raw line(s)] +````` + +## `./build/ripwire . --match='(if_statement)'` + +*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: 1.07s** + +````` +<!-- ripwire match schema=ripwire.match/v1: tree-sitter structural query: <m p= in=> captured nodes with their enclosing symbol; grammars=/eligible_files= the scope. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). counts_floor=1: every count is a FLOOR, never a total. hits_capped=1: hits= is a floor. root=: p= relative to it. auto_captured=1: the query bound no @capture, so @m was appended to its single top-level pattern. of_files=: indexed files in all (eligible_files= of them are in the query's languages). --> +<match schema="ripwire.match/v1" hits="5000" shown="100" capped="1" total="5000" has_more="1" next_offset="100" offset="0" limit="0" counts_floor="1" hits_capped="1" auto_captured="1" grammars="cpp,c,python,go,typescript,tsx,swift,objc,javascript,bash,java,csharp,php,dart,lua,gdscript" eligible_file … [line truncated: 34 more bytes on this line] +<m p="bench/agentloop/analyze.py:37" in="load_results">if data.get( "schema" ) != SCHEMA: raise SystemExit( f"{path}: unexpected schema {data.get('schema')!r} (expecte</m> +<m p="bench/agentloop/analyze.py:48" in="load_results">if not str( data.get( "tasks_lock_content_sha256", "" ) ).startswith( "questions:" ): train_repos = select_tasks</m> +<m p="bench/agentloop/analyze.py:50" in="load_results">if train_repos: raise SystemExit( f"{path}: records from repo(s) that re-derive to LocBench </m> +<m p="bench/agentloop/analyze.py:72" in="pair_by_task_seed">if base and ctx and base["status"] == "ok" and ctx["status"] == "ok": paired.append( ( instance_id, base["re</m> +<m p="bench/agentloop/analyze.py:101" in="clustered_bootstrap_lower">if not repos: return 0.0, []</m> +<m p="bench/agentloop/analyze.py:117" in="loc_hit_delta">if base["localization_hit"] is None or ctx["localization_hit"] is None: return 0.0</m> +<m p="bench/agentloop/analyze.py:126" in="paired_ratio">if bv: ratios.append( cv / bv - 1 )</m> +<m p="bench/agentloop/analyze.py:127" in="paired_ratio">if not ratios: return None, None</m> +<m p="bench/agentloop/analyze.py:146" in="substitution_rate">if rw is None or native is None: return None</m> +<m p="bench/agentloop/analyze.py:169" in="analyze">if not paired: out["note"] = "zero complete paired (baseline,ripwire_cli) runs — nothing to analyze yet" </m> +<m p="bench/agentloop/analyze.py:206" in="print_report">if contaminated: print( f" ** {contaminated} baseline run(s) invoked ripwire despite the no-ripwire contract " </m> +<m p="bench/agentloop/analyze.py:210" in="print_report">if "note" in out: print( f" {out['note']}" ); return</m> +<m p="bench/agentloop/analyze.py:295" in="self_test">if out["n_pairs"] != 27: failures.append( f"expected 27 paired runs, got {out['n_pairs']}" )</m> +<m p="bench/agentloop/analyze.py:296" in="self_test">if out["n_incomplete"] != 2: failures.append( f"expected 2 incomplete pairs (the orphan + the contaminated-basel</m> +<m p="bench/agentloop/analyze.py:299" in="self_test">if out["n_repos"] != 3: failures.append( f"expected 3 repos, got {out['n_repos']}" )</m> +<m p="bench/agentloop/analyze.py:300" in="self_test">if out.get( "n_contaminated_baseline" ) != 1: failures.append( f"expected exactly 1 contaminated baseline run co</m> +<m p="bench/agentloop/analyze.py:303" in="self_test">if not ( out["resolved_delta_mean"] > 0 ): failures.append( "expected a positive resolved-rate delta" )</m> +<m p="bench/agentloop/analyze.py:304" in="self_test">if not ( out["resolved_delta_bootstrap_95_lower"] > 0 ): failures.append( "expected a POSITIVE bootstrap 95% low</m> +<m p="bench/agentloop/analyze.py:306" in="self_test">if out["tokens_out_ratio_p50"] is None or abs( out["tokens_out_ratio_p50"] - 0.08 ) > 1e-6: failures.append( f"e</m> +<m p="bench/agentloop/analyze.py:309" in="self_test">if out.get( "n_resolved_pairs" ) != 27: failures.append( f"expected all 27 pairs resolution-scored, got {out.get</m> +<m p="bench/agentloop/analyze.py:312" in="self_test">if out.get( "substitution_rate_baseline" ) != 0.0: failures.append( f"expected baseline substitution rate 0.0 (n</m> +<m p="bench/agentloop/analyze.py:315" in="self_test">if out.get( "substitution_rate_ripwire" ) is None or abs( out["substitution_rate_ripwire"] - 0.75 ) > 1e-9: fail</m> +<m p="bench/agentloop/analyze.py:318" in="self_test">if out.get( "n_substitution_ripwire" ) != 27: failures.append( f"expected 27 substitution-scored ripwire runs, g</m> +<m p="bench/agentloop/analyze.py:324" in="self_test">if out3.get( "substitution_rate_ripwire" ) is not None or out3.get( "n_substitution_ripwire" ) != 0: failures.ap</m> +<m p="bench/agentloop/analyze.py:330" in="self_test">if out2["n_pairs"] != 27: failures.append( f"evaluator-none: expected 27 pairs, got {out2['n_pairs']}" )</m> +<m p="bench/agentloop/analyze.py:332" in="self_test">if out2["n_resolved_pairs"] != 0: failures.append( f"evaluator-none: expected 0 resolution-scored pairs, got {ou</m> +<m p="bench/agentloop/analyze.py:334" in="self_test">if out2["resolved_delta_mean"] is not None or out2["resolved_delta_bootstrap_95_lower"] is not None: failures.ap</m> +<m p="bench/agentloop/analyze.py:336" in="self_test">if out2["tokens_out_ratio_p50"] is None or abs( out2["tokens_out_ratio_p50"] - 0.08 ) > 1e-6: failures.append( "</m> +… [73 more display lines; full output is 17045 bytes on 1 raw line(s)] +````` + +## `./build/ripwire . --match='(if_statement) @i'` + +*The same shape query WITH an explicit capture — identical hits, no auto_captured= attribute.* + +**wall time: 1.03s** + +````` +<!-- ripwire match schema=ripwire.match/v1: tree-sitter structural query: <m p= in=> captured nodes with their enclosing symbol; grammars=/eligible_files= the scope. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). counts_floor=1: every count is a FLOOR, never a total. hits_capped=1: hits= is a floor. root=: p= relative to it. of_files=: indexed files in all (eligible_files= of them are in the query's languages). --> +<match schema="ripwire.match/v1" hits="5000" shown="100" capped="1" total="5000" has_more="1" next_offset="100" offset="0" limit="0" counts_floor="1" hits_capped="1" grammars="cpp,c,python,go,typescript,tsx,swift,objc,javascript,bash,java,csharp,php,dart,lua,gdscript" eligible_files="3634" of_files= … [line truncated: 16 more bytes on this line] +<m p="bench/agentloop/analyze.py:37" in="load_results">if data.get( "schema" ) != SCHEMA: raise SystemExit( f"{path}: unexpected schema {data.get('schema')!r} (expecte</m> +<m p="bench/agentloop/analyze.py:48" in="load_results">if not str( data.get( "tasks_lock_content_sha256", "" ) ).startswith( "questions:" ): train_repos = select_tasks</m> +<m p="bench/agentloop/analyze.py:50" in="load_results">if train_repos: raise SystemExit( f"{path}: records from repo(s) that re-derive to LocBench </m> +<m p="bench/agentloop/analyze.py:72" in="pair_by_task_seed">if base and ctx and base["status"] == "ok" and ctx["status"] == "ok": paired.append( ( instance_id, base["re</m> +<m p="bench/agentloop/analyze.py:101" in="clustered_bootstrap_lower">if not repos: return 0.0, []</m> +<m p="bench/agentloop/analyze.py:117" in="loc_hit_delta">if base["localization_hit"] is None or ctx["localization_hit"] is None: return 0.0</m> +<m p="bench/agentloop/analyze.py:126" in="paired_ratio">if bv: ratios.append( cv / bv - 1 )</m> +<m p="bench/agentloop/analyze.py:127" in="paired_ratio">if not ratios: return None, None</m> +<m p="bench/agentloop/analyze.py:146" in="substitution_rate">if rw is None or native is None: return None</m> +<m p="bench/agentloop/analyze.py:169" in="analyze">if not paired: out["note"] = "zero complete paired (baseline,ripwire_cli) runs — nothing to analyze yet" </m> +<m p="bench/agentloop/analyze.py:206" in="print_report">if contaminated: print( f" ** {contaminated} baseline run(s) invoked ripwire despite the no-ripwire contract " </m> +<m p="bench/agentloop/analyze.py:210" in="print_report">if "note" in out: print( f" {out['note']}" ); return</m> +<m p="bench/agentloop/analyze.py:295" in="self_test">if out["n_pairs"] != 27: failures.append( f"expected 27 paired runs, got {out['n_pairs']}" )</m> +<m p="bench/agentloop/analyze.py:296" in="self_test">if out["n_incomplete"] != 2: failures.append( f"expected 2 incomplete pairs (the orphan + the contaminated-basel</m> +<m p="bench/agentloop/analyze.py:299" in="self_test">if out["n_repos"] != 3: failures.append( f"expected 3 repos, got {out['n_repos']}" )</m> +<m p="bench/agentloop/analyze.py:300" in="self_test">if out.get( "n_contaminated_baseline" ) != 1: failures.append( f"expected exactly 1 contaminated baseline run co</m> +<m p="bench/agentloop/analyze.py:303" in="self_test">if not ( out["resolved_delta_mean"] > 0 ): failures.append( "expected a positive resolved-rate delta" )</m> +<m p="bench/agentloop/analyze.py:304" in="self_test">if not ( out["resolved_delta_bootstrap_95_lower"] > 0 ): failures.append( "expected a POSITIVE bootstrap 95% low</m> +<m p="bench/agentloop/analyze.py:306" in="self_test">if out["tokens_out_ratio_p50"] is None or abs( out["tokens_out_ratio_p50"] - 0.08 ) > 1e-6: failures.append( f"e</m> +<m p="bench/agentloop/analyze.py:309" in="self_test">if out.get( "n_resolved_pairs" ) != 27: failures.append( f"expected all 27 pairs resolution-scored, got {out.get</m> +<m p="bench/agentloop/analyze.py:312" in="self_test">if out.get( "substitution_rate_baseline" ) != 0.0: failures.append( f"expected baseline substitution rate 0.0 (n</m> +<m p="bench/agentloop/analyze.py:315" in="self_test">if out.get( "substitution_rate_ripwire" ) is None or abs( out["substitution_rate_ripwire"] - 0.75 ) > 1e-9: fail</m> +<m p="bench/agentloop/analyze.py:318" in="self_test">if out.get( "n_substitution_ripwire" ) != 27: failures.append( f"expected 27 substitution-scored ripwire runs, g</m> +<m p="bench/agentloop/analyze.py:324" in="self_test">if out3.get( "substitution_rate_ripwire" ) is not None or out3.get( "n_substitution_ripwire" ) != 0: failures.ap</m> +<m p="bench/agentloop/analyze.py:330" in="self_test">if out2["n_pairs"] != 27: failures.append( f"evaluator-none: expected 27 pairs, got {out2['n_pairs']}" )</m> +<m p="bench/agentloop/analyze.py:332" in="self_test">if out2["n_resolved_pairs"] != 0: failures.append( f"evaluator-none: expected 0 resolution-scored pairs, got {ou</m> +<m p="bench/agentloop/analyze.py:334" in="self_test">if out2["resolved_delta_mean"] is not None or out2["resolved_delta_bootstrap_95_lower"] is not None: failures.ap</m> +<m p="bench/agentloop/analyze.py:336" in="self_test">if out2["tokens_out_ratio_p50"] is None or abs( out2["tokens_out_ratio_p50"] - 0.08 ) > 1e-6: failures.append( "</m> +… [73 more display lines; full output is 16929 bytes on 1 raw line(s)] +````` + +## `./build/ripwire . --query="teleport pagerank" --top-k=5` + +*Raw BM25 ranking (debug lens; --for is the real verb).* + +````` +<!-- routed: subtoken+body:broad --> +<!-- ripwire query schema=ripwire.query/v1: lexical-rank map for the query term, the map's row vocabulary. est_tokens=: price as emitted (an upper bound under compact). root=: p= relative to it. 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 <c> 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. sc=: enclosing scope; the full id is p::sc::n (p= of the row or its <f>) and selectors take it. amb=K: K calls split over several defs. f p=: a file; s t= n=: kind, name; c n=: a resolved callee. s k=: rank. --> +<!-- t=modscope=a-file's-MODULE-SCOPE(n=<file-scope>):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 --> +<!-- t=type|alias|functype=a-Go-named-type-by-its-written-form:type=a-defined-type-whose-WRITTEN-form-is-not-a-struct/iface/func-literal(type-N-string;type-W-Pair-too,whatever-Pair-is-underneath),alias=type-A=B,functype=type-F-func(...) --> +<!-- t=alias|functype-in-C++-and-.h:alias=using-X=Y(also-templated-or-class-scope)or-namespace-L=lib(defs=X-prints-its-written-target-as-to=),functype=a-typedef-of-a-function-or-function-pointer-type(typedef-void(*F)(int));other-typedefs-read-t=struct --> +<!-- files=4852 symbols=45031 edges=45381 shown=5 est_tokens=1513 ambiguous=3984 unresolved=20100 locality_pinned=14 external=12460 declined=45307 extent_suspect_syms=12 macro_blanked_files=7 skipped_oversize=15 unindexed="txt:85,tsv:54,mod:33,xml:33,jsonl:26,scm:25" unindexed_exts=23 order=important-first --> +<r schema="ripwire.query/v1" root="." est_tokens="1513"> +<f p="src/serialize.h"> +<s t="var" n="kChurnRankLegend" sc="rw" k="19.7955"> +</s> +</f> +<f p="src/mcpverbs.h"> +<s t="fn" n="rankByText" sc="rw" k="15.5254"> +<c n="takeRank"/> +<c n="rankGraph"/> +<c n="hits"/> +<c n="rrfFuse"/> +<c n="getIndex"/> +<c n="captureXml"/> +<c n="serialize"/> +</s> +</f> +<f p="src/gitmine.h"> +<s t="fn" n="churnPriorFromFreq" sc="rw" k="13.5824"> +<c n="DISCLOSE"/> +</s> +</f> +<f p="src/pagerank.cpp"> +<s t="fn" n="pageRankDouble" sc="rw" amb="3" k="13.4173"> +<c n="ASSUME"/> +… [23 more display lines; full output is 3783 bytes on 1 raw line(s)] +````` + + +--- + +# zoom the detail ladder + +## `./build/ripwire . --for="pagerank power iteration" --detail=2` + +*Importance-weighted detail: FULL bodies for top-2, signatures for the rest.* + +**wall time: 1.06s** + +````` +<ctx task="pagerank power iteration" route="subtoken+body" root="." confidence="high" margin_pct="22" at="914c4045d" doc_mentions="4" schema="ripwire.for/v1" budget_bytes="7500" doc_mentions_capped="1" doc_mentions_total="14" est_tokens="7389"> +<!-- ripwire for schema=ripwire.for/v1: bundle=/bodies=/reason= the body posture; d: cx= ccx= complexity, in= callers (absent cx/ccx/in = 0), churn= amp= change, clone= tested= 1, sc= scope, id=p::sc::n; total= shown= capped=1 if cut; task= the query; d pure=1 const/constexpr sig, next= the follow-up to paste; d same_as=N: doc+sig text as row n=N (not repeated); route= name-exact(X)|subtoken+body[:broad|:declined]; confidence=/margin_pct= head score drop (low=flat); t p= file outside sigs (weaker), t sym= its top symbols not in sigs/syms (a pointer, not the answer), r= rank (gap = trimmed); t tsym= up to 2 more file symbols named by a task word (a name match); t order: code files first, then doc files (a code question); t page rows go on to file-page row 160 (code question: 160 code rows, docs within row 160); past page 0 (code question: past 40 code rows, a doc past row 40) listed last, head files skipped; past 120 of those p= only, p_only= counts them; t folded=class=N: N p= only rows of that class (doc|config|script|testdata|other) not listed, next= pages to them; d layer=: built-in arch layer (game|infra|render|math|audio|ai|test) from a dir name in p=; d e= its last line (absent=unknown, never 0; l= the name's line) [doc mentions: 4 docs, 2 symbols; doc_mentions=] --> +<!-- root= is the crawl root; p= below is RELATIVE to it (single-root only; absent => p= is ingest's own path, unchanged); at=this commit(+dirty). [budget_bytes= is the default BYTE target this ranked payload was shaped toward: row text shortens toward it, no row of the ranked head is removed for it (sigs past_target=)] [sigs capped=1 with shown=total: rows shrunk, none dropped] [sigs past_target=K: the last K rows are past the budget_bytes target, served because they are rows of the ranked head; none is cut] [sigs next=: one call serving all total= rows uncut] [docs_dropped=N: N shown rows have a doc comment not printed (r>24 always, r5..24 if capped)] [docs_after_code=N: N doc rows of the shown set moved below its code rows; same rows, reordered, none added or removed; a question naming docs keeps score order] [files_first=N: N rows moved so r=1..8 are distinct files' best rows, score order, a repeated name once; same rows; fold, hops keep score order] [cut: doc_mentions_capped="1" doc_mentions_total="14" — an indexing cap dropped content not shown here]; lego/compose collapse to a counted stub by default (a disclosed cut): total= that section's own pre-cap row count, shown="0" capped="1" (nothing rendered here), next= names the sections=lego,compose flag that restores both sections byte-identically in one call est_tokens= prices this bundle in tokens --> +<sigs shown="40" total="40" capped="1" past_target="14" docs_dropped="25" docs_after_code="5" files_first="7" next="--for='pagerank power iteration' --signatures-only --token-budget=6200"> +<d l="422" e="422" n="kScoreTieAbsEps" sc="rw" p="src/eval.h" churn="18" amp="51" pure="1" r="1" next="--expand=src/eval.h:kScoreTieAbsEps"> +<doc>NodeId order. Renumbering an otherwise-identical graph (the exact "same probe file, different so…</doc>inline constexpr float kScoreTieAbsEps = 1e-6f</d> +<d l="51" e="56" n="RankDisclosure" sc="RankDisclosure" p="src/prconverge.h" churn="3" amp="27" r="2"> +<doc>What a ranked document discloses about the power iteration that ordered it. `isPageRank == false…</doc>struct RankDisclosure</d> +<d l="99" e="206" n="pageRankDouble" sc="rw" p="src/pagerank.cpp" cx="19" ccx="34" in="2" churn="14" amp="44" tested="1" r="3"> +<doc>The PageRank power iteration itself — the numeric kernel every ranked document's order comes f…</doc>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] +<d l="503" e="549" n="rankByText" sc="rw" p="src/mcpverbs.h" cx="11" ccx="19" in="1" churn="676" amp="692" r="4">inline std::string rankByText( const std::string& root, std::string_view mode, int topK, bool stable = false )</d> +<d l="14912" e="14917" n="RankedGraph" sc="RankedGraph" p="src/graph.h" churn="732" amp="983" r="5">struct RankedGraph</d> +<d l="2578" e="2582" n="kChurnRankLegend" sc="rw" p="src/serialize.h" churn="521" amp="626" pure="1" r="6">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…</d> +<d l="1372" e="1393" n="sliceRdIterationCeiling" sc="slicev" p="src/slice.h" cx="9" ccx="12" in="1" churn="54" amp="103" r="7">inline std::uint32_t sliceRdIterationCeiling() noexcept</d> +<d l="31" e="44" n="PageRankRun" sc="PageRankRun" p="src/pagerank.h" churn="8" amp="37" r="8">struct PageRankRun</d> +<d l="73" e="144" n="renderDisclosure" sc="rw" p="src/prconverge.h" cx="12" ccx="15" in="15" churn="3" amp="42" r="9"> +<doc>Render one form of the disclosure. Empty string whenever there is nothing to say — no power it…</doc>inline std::string renderDisclosure( const RankDisclosure& d, DiscloseAs as )</d> +<d l="18200" e="18209" n="navRelevanceWeight" sc="rw" p="src/graph.h" cx="2" ccx="1" in="2" churn="732" amp="985" r="10">inline std::uint32_t navRelevanceWeight( const Graph& g, NodeId n ) noexcept</d> +<d l="1247" e="1247" n="kPowerShellPathPrependScope" sc="rw::oswin" p="src/infra/os_win32_logic.h" layer="infra" churn="20" amp="50" pure="1" r="11">inline constexpr std::string_view kPowerShellPathPrependScope = "in PowerShell, for this window</d> +<d l="14921" e="14949" n="rankGraphTeleport" sc="rw" p="src/graph.h" cx="5" ccx="8" in="7" churn="732" amp="990" r="12">inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>& p, float alpha = 0.85f )</d> +<!-- demote: a <t> in sigs is a lower same-file sibling past answer row 10, a pointer (p= file, sym= name, r= rank), not the answer --> +<t p="src/infra/os_win32_logic.h" sym="powerShellPathPrependHint" r="13"/> +<d l="1255" e="1255" n="path_prepend_hint" sc="rw::os" p="src/infra/os.h" layer="infra" cx="1" in="1" churn="43" amp="94" r="14">inline std::string path_prepend_hint( std::string_view dir )</d> +<t p="src/infra/os_win32_logic.h" sym="powerShellSingleQuote" r="15"/> +<d l="2198" e="2206" n="dynamic_map::leftmost_leaf" p="src/infra/dynamic_map.hpp" layer="infra" cx="2" ccx="1" in="7" churn="7" amp="38" pure="1" r="16">handle_t leftmost_leaf() const</d> +<d l="58" e="91" n="HOT_FILES" p="scripts/optremarks.py" churn="22" amp="86" r="17">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] +<d l="294" e="299" n="doctorPathPrependLine" p="src/verbs_doctor.h" cx="2" ccx="1" in="2" churn="51" amp="151" r="18">inline std::string doctorPathPrependLine( const std::string& selfPath )</d> +<t p="src/infra/dynamic_map.hpp" sym="reverse_iterator" r="19"/> +<t p="src/verbs_doctor.h" sym="doctorWhichRipwire" r="20"/> +<t p="src/serialize.h" sym="rankByLegendFor" r="21"/> +… [130 more display lines; full output is 19074 bytes on 6 raw line(s)] +````` + +## `./build/ripwire . --pack-signatures --top-k=10` + +*Body-elided decl skeletons — recounted on this corpus. Measured as element bytes: the <d> signature+doc elements --pack-signatures emits, against the SAME symbols' full <b> 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: 88.3% fewer bytes at top-10, 87.4% at top-50, 88.6% at top-100 (re-derived 2026-11-21 when train 1118a's qualified C++ calls began binding the namespace their qualifier names (qual-ns-call-bind; with the train's other lanes this repo's graph went from 44,435 to 44,883 edges on main 5df5a26be): the ranked top-10 lost the RW_CHECK_ macro and gained enumcount.h's enumTableAt, whose signature is most of its short body, from 89.7/88.0/87.8 (main 5df5a26be recounts 90.0/88.5/88.8); before that, 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 <d> 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 <b> 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.* + +````` +<ctx schema="ripwire.pack-signatures/v1"> +<!-- ripwire pack-signatures schema=ripwire.pack-signatures/v1: the ranked map plus <sigs> +<d l= n= sc= pure=> signature rows. est_tokens=: price as emitted (an upper bound under compact). root=: p= relative to it. pr_iters=N: PageRank iterations. declined=K: K call sites without edges, including inert Elixir quote sites after unquote/unquote_splicing re-entry. external=K: K calls proven … [line truncated: 1430 more bytes on this line] +<!-- t=modscope=a-file's-MODULE-SCOPE(n=<file-scope>):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 --> +<!-- t=type|alias|functype=a-Go-named-type-by-its-written-form:type=a-defined-type-whose-WRITTEN-form-is-not-a-struct/iface/func-literal(type-N-string;type-W-Pair-too,whatever-Pair-is-underneath),alias=type-A=B,functype=type-F-func(...) --> +<!-- t=alias|functype-in-C++-and-.h:alias=using-X=Y(also-templated-or-class-scope)or-namespace-L=lib(defs=X-prints-its-written-target-as-to=),functype=a-typedef-of-a-function-or-function-pointer-type(typedef-void(*F)(int));other-typedefs-read-t=struct --> +<!-- files=4852 symbols=45031 edges=45381 shown=10 est_tokens=6092 ambiguous=3984 unresolved=20100 locality_pinned=14 external=12460 declined=45307 extent_suspect_syms=12 macro_blanked_files=7 skipped_oversize=15 unindexed="txt:85,tsv:54,mod:33,xml:33,jsonl:26,scm:25" unindexed_exts=23 order=important-first --> +<r root="." est_tokens="6930" pr_iters="37"> +<f p="src/infra/nodekind.h" layer="infra"> +<s t="fn" n="kindIs" sc="rw" k="0.0032"> +</s> +</f> +<f p="src/ingest_metrics.h"> +<s t="fn" n="nodeTextOf" k="0.0021"> +</s> +</f> +<f p="src/infra/namesplit.h" layer="infra"> +<s t="fn" n="isIdentChar" sc="namesplit" k="0.0020"> +</s> +</f> +<f p="src/model.h"> +<s t="fn" n="relForHash" sc="rw" k="0.0019"> +</s> +<s t="fn" n="rootRelPath" sc="rw" k="0.0017"> +<c n="relForHash"/> +</s> +</f> +<f p="src/infra/Diagnostics.h" layer="infra"> +<s t="macro" n="RW_ASSUME_" overloads="2" k="0.0018"> +<c n="RW_CHECK_"/> +… [145 more display lines; full output is 15210 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.* + +````` +<!-- ripwire pack-signatures schema=ripwire.pack-signatures/v1: the ranked map plus <sigs> +<d l= n= sc= pure=> signature rows. est_tokens=: price as emitted (an upper bound under compact). root=: p= relative to it. --> +<ctx schema="ripwire.pack-signatures/v1" root="." est_tokens="327"> +<outline> +<o t="fn" l="14921" p="src/graph.h" n="rankGraphTeleport"> +<![CDATA[inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>& p, float alpha = 0.85f ) +{ + PROFILE_SCOPE_DESCRIBE( "rankGraph: PageRank (power iteration)" ); + const std::vector<float> pw = biasPrior( g, p ); + const std::size_t N = pw.size(); + std::vector<double> teleport( pw.begin(), pw.end() ); + std::vector<double> rankDouble( N, 0.0 ); + PageRankRun run{}; // an N == 0 graph never enters the kernel: { 0, converged } — see PageRankRun + if( N ) + { + ... + } + std::vector<float> 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 }; +} +]]></o></outline></ctx> +````` + +## `./build/ripwire . --outline=rankGraphTeleport:1-10 --top-k=0` + +*CHANGED: a line range on --outline is now STRIPPED with a stderr note (it used to refuse).* + +````` +<!-- ripwire pack-signatures schema=ripwire.pack-signatures/v1: the ranked map plus <sigs> +<d l= n= sc= pure=> signature rows. est_tokens=: price as emitted (an upper bound under compact). root=: p= relative to it. --> +<ctx schema="ripwire.pack-signatures/v1" root="." est_tokens="327"> +<outline> +<o t="fn" l="14921" p="src/graph.h" n="rankGraphTeleport"> +<![CDATA[inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>& p, float alpha = 0.85f ) +{ + PROFILE_SCOPE_DESCRIBE( "rankGraph: PageRank (power iteration)" ); + const std::vector<float> pw = biasPrior( g, p ); + const std::size_t N = pw.size(); + std::vector<double> teleport( pw.begin(), pw.end() ); + std::vector<double> rankDouble( N, 0.0 ); + PageRankRun run{}; // an N == 0 graph never enters the kernel: { 0, converged } — see PageRankRun + if( N ) + { + ... + } + std::vector<float> 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 }; +} +]]></o></outline></ctx> +````` + +stderr: + +````` +ripwire: --outline=rankGraphTeleport:1-10: --outline has no line-range form — outlining the whole symbol (use --expand=rankGraphTeleport:1-10 for a body slice) +````` + +## `./build/ripwire . --expand=rankGraphTeleport --top-k=0` + +*Full body + inline callee signatures.* + +````` +<ctx schema="ripwire.expand/v1" root="." est_tokens="1227"> +<!-- ripwire expand schema=ripwire.expand/v1: full bodies: <bodies shown= total= capped=> of <b t= l= p= n= sibs= sibs_total= sibs_capped= inc=>; <calls> +<c n= l= p=> 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. inc_total=N: the file's true include/import count; inc= lists the first 2 … [line truncated: 303 more bytes on this line] +<bodies shown="1" total="1" capped="0"> +<b t="fn" l="14921" p="src/graph.h" n="rankGraphTeleport" sibs="<file-scope>,DeclinedSiteKind,kNoDeclinedList,ProvenSite,operator<=>,provenSiteCountsFor,Graph,localityKeyAt,ImplementorRow,implementorClosure,LegoClosure,LegoClosureWalk,LegoClosureWalk,take,boundOf,add,expand,legoImplement … [line truncated: 1657 more bytes on this line] +<![CDATA[inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>& p, float alpha = 0.85f ) +{ + PROFILE_SCOPE_DESCRIBE( "rankGraph: PageRank (power iteration)" ); + const std::vector<float> pw = biasPrior( g, p ); + const std::size_t N = pw.size(); + std::vector<double> teleport( pw.begin(), pw.end() ); + std::vector<double> rankDouble( N, 0.0 ); + PageRankRun run{}; // an N == 0 graph never enters the kernel: { 0, converged } — see PageRankRun + if( N ) + { + double teleportMass = 0.0; + for( const double value : teleport ) + { + teleportMass += value; + } + if( teleportMass > 0.0 ) + { + const double inverseMass = 1.0 / teleportMass; + for( double& value : teleport ) + { + value *= inverseMass; + } + } + run = pageRankDouble( g.inEdges, g.wOutDeg, teleport, rankDouble, PageRankConfig{ .alpha = double( alpha ) } ); + } + std::vector<float> 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 }; +}]]><calls total="4"><c n="biasPrior" l="14880">inline std::vector<float> biasPrior( const Graph& g, const std::vector<float>& p )</c><c n="PROFILE_SCOPE_DESCRIBE" l="1282" p="src/infra/profileScope.h">#define PROFILE_SCOPE_DESCRIBE( desc )</c><c n="PROFILE_SCOPE_DESCRIBE" l="129 … [line truncated: 368 more bytes on this line] +````` + +## `./build/ripwire . --expand=rankGraphTeleport:1-12 --top-k=0` + +*Body SLICE: lines 1..12 of the symbol's own body, with lines="lo-hi/total" marking it partial.* + +````` +<ctx schema="ripwire.expand/v1" root="." est_tokens="1066"> +<!-- ripwire expand schema=ripwire.expand/v1: full bodies: <bodies shown= total= capped=> of <b t= l= p= n= sibs= sibs_total= sibs_capped= inc=>; <calls> +<c n= l= p=> 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. inc_total=N: the file's true include/import count; inc= lists the first 2 … [line truncated: 303 more bytes on this line] +<bodies shown="1" total="1" capped="0"> +<b t="fn" l="14921" p="src/graph.h" n="rankGraphTeleport" lines="1-12/29" sibs="<file-scope>,DeclinedSiteKind,kNoDeclinedList,ProvenSite,operator<=>,provenSiteCountsFor,Graph,localityKeyAt,ImplementorRow,implementorClosure,LegoClosure,LegoClosureWalk,LegoClosureWalk,take,boundOf,add,expa … [line truncated: 1673 more bytes on this line] +<![CDATA[inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>& p, float alpha = 0.85f ) +{ + PROFILE_SCOPE_DESCRIBE( "rankGraph: PageRank (power iteration)" ); + const std::vector<float> pw = biasPrior( g, p ); + const std::size_t N = pw.size(); + std::vector<double> teleport( pw.begin(), pw.end() ); + std::vector<double> rankDouble( N, 0.0 ); + PageRankRun run{}; // an N == 0 graph never enters the kernel: { 0, converged } — see PageRankRun + if( N ) + { + double teleportMass = 0.0; + for( const double value : teleport )]]><calls total="4"><c n="biasPrior" l="14880">inline std::vector<float> biasPrior( const Graph& g, const std::vector<float>& p )</c><c n="PROFILE_SCOPE_DESCRIBE" l="1282" p="src/infra/profileScope.h">#define PROFILE_SCOPE_DESCRIBE( des … [line truncated: 411 more bytes on this line] +````` + +## `./build/ripwire . --expand=compressBody --top-k=0 --compress` + +*Comments stripped + blank runs collapsed — compressBody is the function that implements --compress itself, chosen because it is comment-heavy enough to show a real reduction (the previously captioned symbol had no comments or blank runs, so before/after were byte-identical under a caption promising a difference).* + +````` +<ctx schema="ripwire.expand/v1" root="." est_tokens="906"> +<!-- ripwire expand schema=ripwire.expand/v1: full bodies: <bodies shown= total= capped=> of <b t= l= p= n= sibs= sibs_total= sibs_capped= inc=>; <calls> +<c n= l= p=> 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. inc_total=N: the file's true include/import count; inc= lists the first 2 … [line truncated: 200 more bytes on this line] +<bodies shown="1" total="1" capped="0" compress="1"> +<b t="fn" l="5212" p="src/serialize.h" n="compressBody" sibs="<file-scope>,xmlSafeByte,xmlScrubIsLossy,xmlControlCharRef,eraseAbsentClause,spliceClauseAfter,kXmlEscapeByteset,escapeXml,kMultiRootTableLegend,multiRootTableLegend,xmlCommentText,ctxRootOpen,ctxRootOpenParts,ctxRootJsonScrubKeys,c … [line truncated: 2003 more bytes on this line] +<![CDATA[inline std::string compressBody( std::string_view src ) +{ + return collapseBlankLineRuns( stripCommentsKeepLiterals( src ) ); +}]]><calls total="2"><c n="stripCommentsKeepLiterals" l="5140">inline std::string stripCommentsKeepLiterals( std::string_view src )</c><c n="collapseBlankLineRuns" l="5179">inline std::string collapseBlankLineRuns( std::string_view text )</c></calls></b></bodies></ctx> +````` + +## `./build/ripwire . --expand=readAckRecords --top-k=0 --no-redact` + +*--no-redact: emit bodies verbatim (credential redaction is on by default).* + +````` +<ctx schema="ripwire.expand/v1" root="." est_tokens="3086"> +<!-- ripwire expand schema=ripwire.expand/v1: full bodies: <bodies shown= total= capped=> of <b t= l= p= n= sibs= sibs_total= sibs_capped= inc=>; <calls> +<c n= l= p=> 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. <c via="name">: that callee matched by name alone (receiver unproven); it … [line truncated: 410 more bytes on this line] +<bodies shown="3" total="3" capped="0"> +<b t="fn" l="9289" p="src/quality.h" n="readAckRecords" sibs="<file-scope>,kBaselineFile,kMinCloneTokens,kCcxBar,kLocBar,kNestBar,kParamBar,kShortHorizonDays,kShortHorizonMinCommits,kReusedHelperMinFanin,kMinorCcxDelta,kMinorLocDelta,kMinorParamDelta,kMaterialGrowthPct,kSubBarGrowthPct,subBarG … [line truncated: 1751 more bytes on this line] +<![CDATA[inline gtl::btree_map<std::string, AckRecord> readAckRecords( const std::string& path, std::size_t& badLines );]]> +</b> +<b t="fn" l="9291" p="src/quality.h" n="readAckRecords" sibs="<file-scope>,kBaselineFile,kMinCloneTokens,kCcxBar,kLocBar,kNestBar,kParamBar,kShortHorizonDays,kShortHorizonMinCommits,kReusedHelperMinFanin,kMinorCcxDelta,kMinorLocDelta,kMinorParamDelta,kMaterialGrowthPct,kSubBarGrowthPct,subBarG … [line truncated: 1751 more bytes on this line] +<![CDATA[inline gtl::btree_map<std::string, AckRecord> readAckRecords( const std::string& path ) +{ + std::size_t ignored = 0; + return readAckRecords( path, ignored ); +}]]><calls total="1"><c n="readAckRecords" l="9297">inline gtl::btree_map<std::string, AckRecord> readAckRecords( const std::string& path, std::size_t& badLines )</c></calls></b><b t="fn" l="9297" p="src/quality.h" n="readAckRecords" sibs="<file-scope>,kBaselineFile,kMinCloneToke … [line truncated: 2062 more bytes on this line] +{ + badLines = 0; + gtl::btree_map<std::string, AckRecord> out; + // openRegularFileStream, not a stream opened on the name: a FIFO planted at the ledger's name blocked that open until + // a writer appeared, so --quality-delta hung before any output, and a link to /dev/zero never reached end of file. + // Anything that is not a regular file now reads as no ledger, and stderr says so (docparse.h). Still one line at a + // time, as the std::ifstream it replaces read it: a large ledger is never held whole. + rw::pathguard::NoFollowRead ledger = docparse::detail::openRegularFileStream( "the quality-acks ledger", path ); + std::string line; + while( ledger.readLine( line ) ) + { + while( !line.empty() && ( line.back() == '\r' || line.back() == '\n' ) ) + { + line.pop_back(); // CRLF tolerance (merged-in Windows checkout) + } + if( line.empty() || line[0] == '#' ) + { +… [46 more display lines; full output is 11763 bytes on 68 raw line(s)] +````` + +## `./build/ripwire . --pack-top-n=3 --top-k=0` + +*Pack the top-3 ranked symbols' full bodies (deprecated verb; see stderr).* + +````` +<ctx schema="ripwire.pack-top-n/v1" root="." est_tokens="17442"> +<!-- ripwire pack-top-n schema=ripwire.pack-top-n/v1: the ranked map plus <src p=> bodies of the top-N symbols. window: shown= total= capped= (capped=1 cut). est_tokens=: price as emitted (an upper bound under compact). root=: p= relative to it. <src truncated=1 lines=1-K/T>: cut at a line end at the byte budget; K of its T lines. <src_cut shown= total= capped=1 budget_bytes=>: files served of the top-N asked, the rest over the byte ceiling; unreadable=N not readable. --> +<src_cut shown="1" total="3" capped="1" budget_bytes="65536"/> +<src p="./src/graph.h" truncated="1" lines="1-1007/21347"> +<![CDATA[#pragma once + +// graph.h — resolve references → graph, build the in-edge CSR for PageRank, and the +// resolved out-edges for serialization. Ranking lives in pagerank.cpp. + +#include "model.h" +#include "elixir_resolve.h" // lexical module/name/arity resolution; reuses cached Binding records +#include "filter.h" // isTestPath — for the Q2 tested= post-pass +#include "pageview.h" // LB-H: kImportReachRowCap — the import tier's display cap lives with the rest of the truncation vocabulary +#include "nextverb.h" // cut-fix E: nextFlag / nextAttrXml — the import tier's importers_next= +#include "graphlegend.h" // M15: graphGaugeAttrXml/Json + kGraphCountFloorAttrXml/Json — graphCountFloorAttrXml( g ) below +#include "lintrules.h" // langOfPath / dependencyCapable — the file-language classification + // restrictDependencyHealth() needs (owns the extension table, kept in sync + // by hand with ingest.cpp's kLangTable per its own header comment) +#include "infra/sparseCsr.h" // first-party infra math (src/infra/) +#include "infra/csrverify.h" // structural gate, ASSUME'd after every production CSR build +#include "infra/hashutil.h" // packPair — composite integer keys +#include "pagerank.h" // double-precision PageRank kernel over float CSR storage +#include "prconverge.h" // RankDisclosure — the power iteration's own account, carried with its result +#include "smallvec.h" // rw::SmallVec — THE ONE ALIAS (src/smallvec.h picks the implementation) +#include "resolve.h" // P2-D one-hop type narrowing (Rule 1: class membership) — applied before the name-based fallback +#include "receiverevidence.h" // FE-B: typed receivers RESOLVE; a call nothing proves keeps its rows marked via="name" +#include "ifacedispatch.h" // lane L6: a call on an interface-typed receiver names its implementors' methods (BaseBound) +#include "langfacts.h" // langFacts(l): the per-language facts the resolver reads instead of a Lang:: compare +#include "scipoverlay.h" // SCIP precision overlay (data struct only; parser lives in scip.h) +#include "pincensus.h" // eval-only per-call-site decision census (--pin-census); inert unless armed +… [981 more display lines; full output is 66176 bytes on 1007 raw line(s)] +````` + +stderr: + +````` +ripwire: --pack-top-n is deprecated — use --pack-task/--detail instead (unchanged behavior for now) +````` + + +--- + +# assess quality / structure + +## `./build/ripwire . --metrics --top-k=10` + +*Fan-in/out + complexity annotations on the map.* + +````` +<!-- ripwire metrics schema=ripwire.metrics/v1: the ranked map with per-symbol metrics. est_tokens=: price as emitted (an upper bound under compact). root=: p= relative to it. pr_iters=N: PageRank iterations. <inv listed= unlisted=>: files the ranked rows show / do not (sum = files=), each named or counted below. <entry p= n=>: 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. <ls p= n= f=>: 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 <c> 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. <s tested=1>: a non-test row an indexed test transitively reaches (absent otherwise, never 0). sc=: enclosing scope; the full id is p::sc::n (p= of the row or its <f>) 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. --> +<!-- t=modscope=a-file's-MODULE-SCOPE(n=<file-scope>):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 --> +<!-- t=type|alias|functype=a-Go-named-type-by-its-written-form:type=a-defined-type-whose-WRITTEN-form-is-not-a-struct/iface/func-literal(type-N-string;type-W-Pair-too,whatever-Pair-is-underneath),alias=type-A=B,functype=type-F-func(...) --> +<!-- t=alias|functype-in-C++-and-.h:alias=using-X=Y(also-templated-or-class-scope)or-namespace-L=lib(defs=X-prints-its-written-target-as-to=),functype=a-typedef-of-a-function-or-function-pointer-type(typedef-void(*F)(int));other-typedefs-read-t=struct --> +<!-- files=4852 symbols=45031 edges=45381 shown=10 est_tokens=5198 ambiguous=3984 unresolved=20100 locality_pinned=14 external=12460 declined=45307 extent_suspect_syms=12 macro_blanked_files=7 skipped_oversize=15 unindexed="txt:85,tsv:54,mod:33,xml:33,jsonl:26,scm:25" unindexed_exts=23 order=important-first --> +<r schema="ripwire.metrics/v1" root="." est_tokens="5198" pr_iters="37"> +<f p="src/infra/nodekind.h" layer="infra"> +<s t="fn" n="kindIs" sc="rw" in="445" out="0" cx="3" ccx="3" role="hub" loc="11" params="2" nest="2" locals="0" locals_floor="1" cbo="0" amp="458" tested="1" k="0.0032" ev="3" ev_floor="1" ev_why="guard-return:1"> +</s> +</f> +<f p="src/ingest_metrics.h"> +<s t="fn" n="nodeTextOf" in="210" out="0" cx="4" ccx="3" role="hub" loc="9" params="2" nest="1" locals="2" locals_floor="1" cbo="0" amp="354" tested="1" k="0.0021" ev="2" ev_floor="1" ev_why="guard-return:1"> +</s> +</f> +<f p="src/infra/namesplit.h" layer="infra"> +<s t="fn" n="isIdentChar" sc="namesplit" in="113" out="0" cx="7" ccx="4" role="hub" loc="4" params="1" nest="0" locals="0" locals_floor="1" cbo="0" amp="162" tested="1" k="0.0020"> +</s> +</f> +<f p="src/model.h"> +<s t="fn" n="relForHash" sc="rw" in="55" out="0" cx="17" ccx="13" role="hub" loc="35" params="2" nest="2" locals="2" locals_floor="1" cbo="0" amp="625" tested="1" k="0.0019"> +</s> +<s t="fn" n="rootRelPath" sc="rw" in="247" out="1" cx="2" ccx="1" role="hub" loc="5" params="2" nest="1" locals="1" locals_floor="1" cbo="1" amp="817" tested="1" k="0.0017"> +<c n="relForHash"/> +</s> +</f> +<f p="src/infra/Diagnostics.h" layer="infra"> +<s t="macro" n="RW_ASSUME_" l="328" in="3" out="1" cx="0" ccx="0" loc="2" cbo="1" amp="74" tested="1" k="0.0018"> +<c n="RW_CHECK_"/> +</s> +<s t="macro" n="RW_ASSUME_" l="370" in="3" out="3" cx="0" ccx="0" loc="7" cbo="3" amp="74" tested="1" amb="1" k="0.0018"> +… [111 more display lines; full output is 12897 bytes on 1 raw line(s)] +````` + +## `./build/ripwire . --deps` + +*File->file dependency graph (god-files, cycles).* + +````` +<!-- ripwire deps schema=ripwire.deps/v1: file-to-file include/import view, heaviest cone first: <f p= afferent= includes= instab= transitive=>, <health>, <godfiles>, <cycles>. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). graph_partial=1: measured over resolved edges; unresolved imports could add, merge or remove cycles and change ratios. no_file_edges=LANGS: this build resolves almost none of these languages' imports to files (Go only across go.mod replace); counts over them (ca/ce and violations= of the arch verb) are floors over the resolved edges only, and a coupling number absent beside it is unknown, not zero. unmeasured_files=N: files in the no_file_edges= languages; an edge to or from them is in a count only where this build resolved it. masked_files=N: no_file_edges= files, left out of dep_files=/ccd/nccd/shape and propagation_cost (an edgeless one would count as a cone of one; one with an edge has only a floor). health cyclic_files=N: dep_files= files inside an include cycle (all cycles, not only the listed ones); absent at 0. health containment_edges=N: Rust mod x; pairs whose only directive is the declaration, out of transitive=/cycles/ccd/shape, in Ca/Ce. root=: p= relative to it. files=N: files with at least one include/import directive; this listing's denominator (health files= = corpus). violations=N: edges into a file more unstable by over 0.05 (Martin I); only the worst 12 are listed. from=: the including file of a stable-deps violation; it depends on the more unstable to=. gap=: instab of to= minus instab of from=, project includes only; worst first. godfiles f layer=: built-in arch layer (game|infra|render|math|audio|ai|test) from a dir name in p=; absent if none. layer=test only for a file under a test directory whose dependents are all test paths, by path. health dep_files=N: dependency-capable files (dep_langs=), the ccd/acd/nccd denominator. health dep_langs=: the languages dep_files= counts; compare its numbers across builds only when equal. ccd=/acd=/nccd=: Lakos: sum of per-file transitive cones (self incl) / per file / over a balanced tree's. health shape=: tangled when cyclic_files= is 1 in 20 of dep_files= or more, else nccd= below 1 horizontal, from 1 vertical (a heuristic). health lazy_edges=N: in-closure (lazy) include pairs kept OUT of cones, cycles and ccd; absent at 0. cycle size=/cost=: files in that include cycle / size squared, the cycle's share of ccd=. cycle cut=/cutrefs=: SUGGESTED edge to break it (fewest directives) / that edge's directive count; nothing cut. inc t=: one include/import target as written; one with no edge did not resolve to an indexed file. --> +<deps schema="ripwire.deps/v1" files="1871" shown="40" capped="1" total="1871" has_more="1" next_offset="40" offset="0" limit="0" root="." no_file_edges="go,swift,java,cs,php,dart,kt,gd,clj" unmeasured_files="407" graph_partial="1"> +<health files="4852" dep_files="3804" ccd="23035" acd="6.1" nccd="0.56" shape="horizontal" cyclic_files="15" masked_files="393" lazy_edges="82" containment_edges="147" dep_langs="cpp,py,ts,go,rs,swift,objc,js,sh,java,rb,cs,c,php,lua,ex,kt"/> +<godfiles total="954" shown="12" capped="1"> +<f p="test/lib/clean-env.sh" afferent="288" layer="test"/> +<f p="src/model.h" afferent="144"/> +<f p="src/infra/emit.h" afferent="101" layer="infra"/> +<f p="src/infra/sortutil.h" afferent="89" layer="infra"/> +<f p="src/infra/Diagnostics.h" afferent="78" layer="infra"/> +<f p="src/serialize.h" afferent="75"/> +<f p="src/graph.h" afferent="74"/> +<f p="src/nextverb.h" afferent="43"/> +<f p="src/infra/os.h" afferent="42" layer="infra"/> +<f p="src/filter.h" afferent="40"/> +<f p="src/infra/namesplit.h" afferent="36" layer="infra"/> +<f p="scripts/cxxstd.sh" afferent="34"/> +</godfiles> +<stabledeps violations="85"> +<v from="src/graph.h" to="src/ifacedispatch.h" gap="0.56"/> +<v from="src/graph.h" to="src/argtypepick.h" gap="0.54"/> +<v from="src/graph.h" to="src/pincensus.h" gap="0.54"/> +<v from="src/graph.h" to="src/restlinks.h" gap="0.54"/> +<v from="src/graph.h" to="src/pyscopepin.h" gap="0.50"/> +<v from="test/declinedsitefix/rb/lib/rake/task.rb" to="test/legotransitivefix/rb/task.rb" gap="0.50"/> +<v from="src/gitstamp.h" to="src/quality.h" gap="0.48"/> +<v from="test/ifacedispatchfix/rs/src/render/mod.rs" to="test/ifacedispatchfix/rs/src/render/impls.rs" gap="0.47"/> +<v from="src/docparse.h" to="src/htmldoc.h" gap="0.46"/> +<v from="src/serialize.h" to="src/countfloor.h" gap="0.37"/> +<v from="src/serialize.h" to="src/mapinventory.h" gap="0.36"/> +<v from="src/model.h" to="src/refnames.h" gap="0.28"/> +… [915 more display lines; full output is 26230 bytes on 1 raw line(s)] +````` + +## `./build/ripwire . --hotspots` + +*Complexity x recent git churn (maintenance pain).* + +**wall time: 2.08s** + +````` +<!-- ripwire hotspots schema=ripwire.hotspots/v1: maintenance pain = churn x ccx over window=: <f p= churn= ccx= score= top= top_ccx= top_l=>; unranked_*= no churn/complexity. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). at=: commit+dirty+shallow. root=: p= relative to it. files=/ranked=: files in the window / those with both churn and complexity; ranked + unranked_no_churn + unranked_no_complexity = files. unranked_no_churn=/unranked_no_complexity=: files left out for no commit in window= / no measured complexity. --> +<!-- extent_suspect_syms=K on a row = K of the file's functions failed an extent/scope containment check (the map, the bundles and the skipped verb mark each one, reasons and all) and are LEFT OUT of that row's ccx=, score= and top=, so its ccx= is a FLOOR of the file's true sum rather than a total. unranked_extent_suspect= counts files with commits whose every scorable function was left out that way (or whose trusted remainder scores 0), so ranked= + unranked_no_churn= + unranked_no_complexity= + unranked_extent_suspect= = files= exactly. Absent = nothing excluded. --> +<hotspots schema="ripwire.hotspots/v1" window="12mo@HEAD" files="4852" ranked="1122" unranked_no_churn="0" unranked_no_complexity="3728" unranked_extent_suspect="2" shown="40" capped="1" total="1122" has_more="1" next_offset="40" offset="0" limit="0" root="." at="914c4045d"> +<f p="src/graph.h" churn="732" ccx="6723" score="4921236" top="buildGraph" top_ccx="1979" top_l="10846"/> +<f p="src/quality.h" churn="693" ccx="2657" score="1841301" top="computeDelta" top_ccx="318" top_l="12009"/> +<f p="src/serialize.h" churn="521" ccx="2407" score="1254047" top="packSignatures" top_ccx="235" top_l="6525"/> +<f p="src/mcpverbs.h" churn="676" ccx="1369" score="925444" top="runBatchSub" top_ccx="142" top_l="6335"/> +<f p="src/main.cpp" churn="514" ccx="1372" score="705208" top="dispatchMainBody" top_ccx="513" top_l="4711"/> +<f p="src/verbs_for.h" churn="422" ccx="1358" score="573076" top="runForLensPass" top_ccx="706" top_l="3606"/> +<f p="src/resolve.h" churn="222" ccx="2566" score="569652" top="buildPreciseIncludeAdjWithContext" top_ccx="103" top_l="5588"/> +<f p="src/cli.h" churn="651" ccx="682" score="443982" top="parseArgs" top_ccx="214" top_l="5740"/> +<f p="src/ingest_binds.h" churn="152" ccx="2607" score="396264" top="bindsVisitNode" top_ccx="103" top_l="7848"/> +<f p="src/verbs_navigate.h" churn="340" ccx="1038" score="352920" top="runVerify" top_ccx="144" top_l="2297"/> +<f p="src/receiverevidence.h" churn="119" ccx="1613" score="191947" top="bareClassAt" top_ccx="77" top_l="784"/> +<f p="src/mcp.h" churn="191" ccx="991" score="189281" top="dispatchMcpLine" top_ccx="794" top_l="1151"/> +<f p="src/compactlegend.h" churn="545" ccx="328" score="178760" top="applyCompactDialectOnce" top_ccx="49" top_l="2664"/> +<f p="src/verbs_quality.h" churn="209" ccx="761" score="159049" top="runQualityViews" top_ccx="122" top_l="4027"/> +<f p="src/ingest_cache.h" churn="392" ccx="398" score="156016" top="saveCache" top_ccx="113" top_l="3688"/> +<f p="src/verbs_report.h" churn="117" ccx="1199" score="140283" top="runStructureText" top_ccx="270" top_l="3358"/> +<f p="src/ingest_sidecap.h" churn="188" ccx="717" score="134796" top="routesVisitNode" top_ccx="89" top_l="532"/> +<f p="src/crossref.h" churn="111" ccx="1147" score="127317" top="mergeBasesByOneWalk" top_ccx="45" top_l="1626"/> +<f p="src/ingest_valuerefs.h" churn="83" ccx="1502" score="124666" top="classify" top_ccx="119" top_l="2479"/> +<f p="src/forliteral.h" churn="65" ccx="1795" score="116675" top="renderForLiteral" top_ccx="277" top_l="4210"/> +<f p="src/ingest_names.h" churn="87" ccx="958" score="83346" top="braceBlockHoldsStatement" top_ccx="33" top_l="2747"/> +<f p="src/gitmine.h" churn="106" ccx="747" score="79182" top="applyCoChangeBoost" top_ccx="95" top_l="3620"/> +<f p="src/ingest_relations.h" churn="95" ccx="733" score="69635" top="captureFields" top_ccx="99" top_l="1409"/> +<f p="src/lexical.h" churn="95" ccx="691" score="65645" top="lexicalScoresNameExactTiered" top_ccx="68" top_l="1712"/> +<f p="src/model.h" churn="338" ccx="186" score="62868" top="shadowSuppressedSite" top_ccx="14" top_l="3046"/> +<f p="src/valuerefindex.h" churn="70" ccx="897" score="62790" top="resolveName" top_ccx="47" top_l="1944"/> +<f p="src/defectshape.h" churn="25" ccx="2487" score="62175" top="lexCpp" top_ccx="107" top_l="300"/> +… [14 more display lines; full output is 5835 bytes on 1 raw line(s)] +````` + +## `./build/ripwire . --clones` + +*Token-normalized duplicate bodies.* + +**wall time: 2.01s** + +````` +<!-- ripwire clones schema=ripwire.clones/v1: similar normalized-token bodies: <group type=2|3 gid= tokens= n= similarity=> of <f n= p=>; 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, call-sequence. --> +<clones schema="ripwire.clones/v1" groups="176" type3="942" exempt_groups="759" idiom_groups="61" demoted_groups="30" clone_groups="468" dup_loc="8996" total_loc="333518" dup_pct="2.7" shown="80" capped="1" total="1118" has_more="1" next_offset="80" offset="0" limit="0" root="."> +<group type="2" gid="50" tokens="338" n="3"> +<f n="rw_is_ripwire_call" p="hooks/ripwire-claude-route.sh:187"/> +<f n="rw_is_ripwire_call" p="hooks/ripwire-codex-route.sh:104"/> +<f n="rw_is_ripwire_call" p="hooks/ripwire-nudge.sh:623"/> +</group> +<group type="2" gid="289" tokens="213" n="2" exempt="shell-runner"> +<f n="call_sites" p="test/declinecheck.sh:116"/> +<f n="call_sites" p="test/usesselectorcheck.sh:55"/> +</group> +<group type="2" gid="390" tokens="211" n="4" exempt="shell-runner"> +<f n="batch_sub" p="test/mcpclidiffcheck.sh:64"/> +<f n="batch_sub" p="test/mcptranchecheck.sh:55"/> +<f n="batch_sub" p="test/mcpw2fixcheck.sh:52"/> +<f n="batch_sub" p="test/mcpw3fixcheck.sh:51"/> +</group> +<group type="2" gid="242" tokens="210" n="2" exempt="shell-runner"> +<f n="mcpfor" p="test/anchorhonestycheck.sh:37"/> +<f n="mcpfor" p="test/foranchornscheck.sh:29"/> +</group> +<group type="2" gid="414" tokens="198" n="2" exempt="shell-runner"> +<f n="classify" p="test/preludevetocheck.sh:41"/> +<f n="classify" p="test/rustmacropathcheck.sh:53"/> +</group> +<group type="2" gid="284" tokens="175" n="2" exempt="shell-runner"> +<f n="mcp" p="test/pathfewestcheck.sh:320"/> +<f n="mcp" p="test/pathroutecheck.sh:468"/> +</group> +<group type="2" gid="49" tokens="163" n="3"> +… [309 more display lines; full output is 16374 bytes on 1 raw line(s)] +````` + +## `./build/ripwire . --cochange` + +*Files that change together in git (hidden coupling).* + +**wall time: 2.24s** + +````` +<!-- ripwire cochange schema=ripwire.cochange/v1: files that change together in git: <pair a= b= together= deg= conf_ab= conf_ba= surprising=>, or for of= <f p= together= conf_rev=>. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). at=: commit+dirty+shallow. root=: p= relative to it. pairs=N: file pairs with 3+ shared commits in window= (after min_recur), surprising or not. sub_windows=N: equal-commit-count slices of window=; the denominator of recur=. driver=a|b: the side whose changes best imply the other's, look there first; absent on a tie. recur=K: slices of sub_windows= the pair co-changed in; 1 = one burst, not a standing coupling. --> +<cochange schema="ripwire.cochange/v1" pairs="5714" window="18mo@HEAD" sub_windows="3" shown="30" capped="1" total="5714" has_more="1" next_offset="30" offset="0" limit="0" root="." at="914c4045d"> +<pair a="src/aliasdef.h" b="src/ingest_sidecap.h" together="5" deg="1.00" conf_ab="1.00" conf_ba="0.03" driver="a" recur="1" surprising="1"/> +<pair a="test/headsnapcachecheck.sh" b="test/qsnapcachecheck.sh" together="5" deg="1.00" conf_ab="1.00" conf_ba="0.83" driver="a" recur="3" surprising="1"/> +<pair a="src/cli.h" b="src/handoffwindow.h" together="4" deg="1.00" conf_ab="0.01" conf_ba="1.00" driver="b" recur="1" surprising="1"/> +<pair a="src/main.cpp" b="src/warmsnap_model.h" together="4" deg="1.00" conf_ab="0.01" conf_ba="1.00" driver="b" recur="1" surprising="1"/> +<pair a="src/foraliashop.h" b="src/verbs_navigate.h" together="4" deg="1.00" conf_ab="1.00" conf_ba="0.01" driver="a" recur="1" surprising="1"/> +<pair a="src/layout.h" b="test/layoutfix/attrfields.h" together="4" deg="1.00" conf_ab="0.11" conf_ba="1.00" driver="b" recur="1" surprising="1"/> +<pair a="src/ingest_valuerefs.h" b="src/pydottedpath.h" together="3" deg="1.00" conf_ab="0.04" conf_ba="1.00" driver="b" recur="1" surprising="1"/> +<pair a="test/pincensuscheck.sh" b="test/scipjoincheck.sh" together="3" deg="1.00" conf_ab="0.38" conf_ba="1.00" driver="b" recur="2" surprising="1"/> +<pair a="test/grepcheck.sh" b="test/grepcontextcheck.sh" together="3" deg="1.00" conf_ab="0.50" conf_ba="1.00" driver="b" recur="1" surprising="1"/> +<pair a="test/arityfix/argtype/buf.cc" b="test/arityfix/argtype/watermark.cc" together="3" deg="1.00" conf_ab="1.00" conf_ba="1.00" recur="1" surprising="1"/> +<pair a="test/luacheck.sh" b="test/phpcheck.sh" together="3" deg="1.00" conf_ab="0.75" conf_ba="1.00" driver="b" recur="2" surprising="1"/> +<pair a="src/ingest_cache.h" b="src/refnames.h" together="3" deg="1.00" conf_ab="0.01" conf_ba="1.00" driver="b" recur="1" surprising="1"/> +<pair a="test/fnslotcpp2/dep.cc" b="test/fnslotcpp2/use_bnd.cc" together="3" deg="1.00" conf_ab="1.00" conf_ba="0.75" driver="a" recur="1" surprising="1"/> +<pair a="src/argtypepick.h" b="test/arityfix/argtype/watermark.cc" together="3" deg="1.00" conf_ab="0.50" conf_ba="1.00" driver="b" recur="1" surprising="1"/> +<pair a="src/argtypepick.h" b="test/arityfix/argtype/buf.h" together="3" deg="1.00" conf_ab="0.50" conf_ba="1.00" driver="b" recur="1" surprising="1"/> +<pair a="test/gatecountcheck.sh" b="test/manifestcheck.sh" together="3" deg="1.00" conf_ab="1.00" conf_ba="0.23" driver="a" recur="2" surprising="1"/> +<pair a="src/argtypepick.h" b="test/arityfix/argtype/buf.cc" together="3" deg="1.00" conf_ab="0.50" conf_ba="1.00" driver="b" recur="1" surprising="1"/> +<pair a="test/mcpslicecheck.sh" b="test/mcpverbscheck.sh" together="3" deg="1.00" conf_ab="1.00" conf_ba="0.16" driver="a" recur="2" surprising="1"/> +<pair a="src/arch.h" b="test/fileset_unit.cpp" together="3" deg="1.00" conf_ab="0.07" conf_ba="1.00" driver="b" recur="1" surprising="1"/> +<pair a="src/graph.h" b="test/fileset_unit.cpp" together="3" deg="1.00" conf_ab="0.00" conf_ba="1.00" driver="b" recur="1" surprising="1"/> +<pair a="bench/scip_match_diag.py" b="bench/scip_pin_precision.py" together="3" deg="1.00" conf_ab="1.00" conf_ba="0.60" driver="a" recur="2" surprising="1"/> +<pair a="test/gatecountcheck.sh" b="test/regression.sh" together="3" deg="1.00" conf_ab="1.00" conf_ba="0.00" driver="a" recur="2" surprising="1"/> +<pair a="test/lib/sweeproot.sh" b="test/substrfiltercheck.sh" together="3" deg="1.00" conf_ab="1.00" conf_ba="0.27" driver="a" recur="1" surprising="1"/> +<pair a="test/grepcheck.sh" b="test/grepscancheck.sh" together="3" deg="1.00" conf_ab="0.50" conf_ba="1.00" driver="b" recur="1" surprising="1"/> +<pair a="test/rubyrecvcheck.sh" b="test/rubyrequirecheck.sh" together="3" deg="1.00" conf_ab="0.50" conf_ba="1.00" driver="b" recur="1" surprising="1"/> +<pair a="src/verbs_report.h" b="test/fileset_unit.cpp" together="3" deg="1.00" conf_ab="0.03" conf_ba="1.00" driver="b" recur="1" surprising="1"/> +<pair a="test/cachesplitcheck.sh" b="test/portablecachecheck.sh" together="3" deg="1.00" conf_ab="0.75" conf_ba="1.00" driver="b" recur="3" surprising="1"/> +<pair a="test/grepcontextcheck.sh" b="test/grepscancheck.sh" together="3" deg="1.00" conf_ab="1.00" conf_ba="1.00" recur="1" surprising="1"/> +<pair a="src/fieldaffinity.h" b="test/accessshapefix/walks.cpp" together="3" deg="1.00" conf_ab="0.33" conf_ba="1.00" driver="b" recur="1" surprising="1"/> +<pair a="src/binstale.h" b="src/crossref.h" together="3" deg="1.00" conf_ab="1.00" conf_ba="0.03" driver="a" recur="2" surprising="1"/> +</cochange> +````` + +## `./build/ripwire . --hotspots --since="2 weeks ago"` + +*Hotspots scoped to RECENT churn (the regression lens).* + +**wall time: 2.21s** + +````` +<!-- ripwire hotspots schema=ripwire.hotspots/v1: maintenance pain = churn x ccx over window=: <f p= churn= ccx= score= top= top_ccx= top_l=>; unranked_*= no churn/complexity. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). at=: commit+dirty+shallow. root=: p= relative to it. files=/ranked=: files in the window / those with both churn and complexity; ranked + unranked_no_churn + unranked_no_complexity = files. unranked_no_churn=/unranked_no_complexity=: files left out for no commit in window= / no measured complexity. --> +<hotspots schema="ripwire.hotspots/v1" window="2 weeks ago" files="4852" ranked="440" unranked_no_churn="3966" unranked_no_complexity="446" shown="40" capped="1" total="440" has_more="1" next_offset="40" offset="0" limit="0" root="." at="914c4045d"> +<f p="src/graph.h" churn="123" ccx="6723" score="826929" top="buildGraph" top_ccx="1979" top_l="10846"/> +<f p="src/quality.h" churn="106" ccx="2657" score="281642" top="computeDelta" top_ccx="318" top_l="12009"/> +<f p="src/mcpverbs.h" churn="98" ccx="1369" score="134162" top="runBatchSub" top_ccx="142" top_l="6335"/> +<f p="src/serialize.h" churn="54" ccx="2407" score="129978" top="packSignatures" top_ccx="235" top_l="6525"/> +<f p="src/verbs_for.h" churn="76" ccx="1358" score="103208" top="runForLensPass" top_ccx="706" top_l="3606"/> +<f p="src/resolve.h" churn="29" ccx="2566" score="74414" top="buildPreciseIncludeAdjWithContext" top_ccx="103" top_l="5588"/> +<f p="src/main.cpp" churn="45" ccx="1372" score="61740" top="dispatchMainBody" top_ccx="513" top_l="4711"/> +<f p="src/cli.h" churn="81" ccx="682" score="55242" top="parseArgs" top_ccx="214" top_l="5740"/> +<f p="src/verbs_quality.h" churn="72" ccx="761" score="54792" top="runQualityViews" top_ccx="122" top_l="4027"/> +<f p="src/receiverevidence.h" churn="33" ccx="1613" score="53229" top="bareClassAt" top_ccx="77" top_l="784"/> +<f p="src/ingest_binds.h" churn="19" ccx="2607" score="49533" top="bindsVisitNode" top_ccx="103" top_l="7848"/> +<f p="src/verbs_navigate.h" churn="45" ccx="1038" score="46710" top="runVerify" top_ccx="144" top_l="2297"/> +<f p="src/defectshape.h" churn="16" ccx="2487" score="39792" top="lexCpp" top_ccx="107" top_l="300"/> +<f p="src/compactlegend.h" churn="107" ccx="328" score="35096" top="applyCompactDialectOnce" top_ccx="49" top_l="2664"/> +<f p="src/ingest_names.h" churn="21" ccx="958" score="20118" top="braceBlockHoldsStatement" top_ccx="33" top_l="2747"/> +<f p="src/ingest_cache.h" churn="49" ccx="398" score="19502" top="saveCache" top_ccx="113" top_l="3688"/> +<f p="src/ingest_sidecap.h" churn="26" ccx="717" score="18642" top="routesVisitNode" top_ccx="89" top_l="532"/> +<f p="src/forliteral.h" churn="10" ccx="1795" score="17950" top="renderForLiteral" top_ccx="277" top_l="4210"/> +<f p="src/ingest_valuerefs.h" churn="11" ccx="1502" score="16522" top="classify" top_ccx="119" top_l="2479"/> +<f p="src/crossref.h" churn="14" ccx="1147" score="16058" top="mergeBasesByOneWalk" top_ccx="45" top_l="1626"/> +<f p="src/darkflags.h" churn="16" ccx="959" score="15344" top="shellExpansionAt" top_ccx="61" top_l="1138"/> +<f p="src/layout.h" churn="14" ccx="1051" score="14714" top="resolveStdType" top_ccx="47" top_l="2063"/> +<f p="src/exemplarfamily.h" churn="18" ccx="735" score="13230" top="openSpanAfter" top_ccx="37" top_l="1294"/> +<f p="src/forfilesyms.h" churn="26" ccx="478" score="12428" top="shownRows" top_ccx="34" top_l="368"/> +<f p="src/mcp.h" churn="12" ccx="991" score="11892" top="dispatchMcpLine" top_ccx="794" top_l="1151"/> +<f p="src/ingest_astquery.h" churn="15" ccx="751" score="11265" top="astQueryGrouped" top_ccx="214" top_l="842"/> +<f p="src/shstatus.h" churn="9" ccx="1211" score="10899" top="isBareRedirect" top_ccx="58" top_l="1648"/> +<f p="src/verbs_report.h" churn="9" ccx="1199" score="10791" top="runStructureText" top_ccx="270" top_l="3358"/> +… [13 more display lines; full output is 5213 bytes on 1 raw line(s)] +````` + +## `./build/ripwire . --arch=test/archfix/rules.txt` + +*Enforce layering rules (exit 2 on violation) — run against the repo's own test fixture rules.* + +````` +<!-- ripwire arch schema=ripwire.arch/v1: layering rules fit: v from= fromLayer= to= toLayer=: a file-to-file include/import a rule denies, with each end's layer (fromLayer=path: a regex path-rule, toLayer= that rule); layers= rules= pathRules= declared; violations= the v rows; baselined= those the baseline sidecar accepts, baselined=1 on the row (under baseline-update: every hash it now holds); a row without it is NEW, exit 2 if any; rules match root-relative paths. graph_partial=1: measured over resolved edges; unresolved imports could add, merge or remove cycles and change ratios. no_file_edges=LANGS: this build resolves almost none of these languages' imports to files (Go only across go.mod replace); counts over them (ca/ce and violations= of the arch verb) are floors over the resolved edges only, and a coupling number absent beside it is unknown, not zero. unmeasured_files=N: files in the no_file_edges= languages; an edge to or from them is in a count only where this build resolved it. masked_files=N: no_file_edges= files, left out of dep_files=/ccd/nccd/shape and propagation_cost (an edgeless one would count as a cone of one; one with an edge has only a floor). root=: from=/to=/path= relative to it. metrics: Martin metrics per directory, estimated from name-based deps; descriptive, never a gate. modules= the m rows, typed_modules= those with types>0; zone_pain= zone_useless= zone_ok= zone_na= partition modules=: the two main-sequence corners (a heuristic with no outcome-based validation: folklore, not proof), typed modules in neither, types=0 modules (no abstractness score). zone_unknown=: modules holding a file in a no_file_edges= language: zone and coupling unknown, not zero; a fifth part of the partition. propagation_cost=: density of the file-dep transitive closure (MacCormack): the fraction of files reachable from an average file. m path= ca= ce= types= abstract= I= A= D= zone= reachable=: a directory module: ca= modules depending on it, ce= modules it depends on, types= declared, abstract= abstract ones, I=ce/(ca+ce), A=abstract/types, D=|A+I-1| (distance from the main sequence), zone=pain|useless: D past 0.5 with A+I below|not below 1, else ok; n/a at types=0; reachable=0: no main and no module nothing depends on reaches it; isolated=1: ca=ce=0; leaf=1: ce=0 under ca>0. --> +<arch schema="ripwire.arch/v1" layers="2" rules="1" pathRules="0" violations="0" baselined="0" no_file_edges="go,swift,java,cs,php,dart,kt,gd,clj" unmeasured_files="407" graph_partial="1" root="."> +<metrics modules="1417" typed_modules="704" zone_pain="385" zone_useless="3" zone_ok="145" zone_na="639" zone_unknown="245" propagation_cost="0.002" masked_files="393"> +<m path="." ca="0" ce="0" types="0" abstract="0" I="0.00" A="0.00" D="1.00" zone="n/a" reachable="1" isolated="1"/> +<m path=".codex-plugin" ca="0" ce="0" types="0" abstract="0" I="0.00" A="0.00" D="1.00" zone="n/a" reachable="1" isolated="1"/> +<m path=".github" ca="0" ce="0" types="0" abstract="0" I="0.00" A="0.00" D="1.00" zone="n/a" reachable="1" isolated="1"/> +<m path=".github/workflows" ca="0" ce="0" types="0" abstract="0" I="0.00" A="0.00" D="1.00" zone="n/a" reachable="1" isolated="1"/> +<m path="bench" ca="0" ce="1" types="25" abstract="2" I="1.00" A="0.08" D="0.08" zone="ok" reachable="1"/> +<m path="bench/agentloop" ca="0" ce="0" types="0" abstract="0" I="0.00" A="0.00" D="1.00" zone="n/a" reachable="1" isolated="1"/> +<m path="bench/agentloop/editsuite" ca="0" ce="0" types="0" abstract="0" I="0.00" A="0.00" D="1.00" zone="n/a" reachable="1" isolated="1"/> +<m path="bench/agentloop/editsuite/fixture" ca="0" ce="0" types="2" abstract="0" I="0.00" A="0.00" D="1.00" zone="pain" reachable="1" isolated="1"/> +<m path="bench/agentloop/editsuite/fixture/test" ca="0" ce="0" types="0" abstract="0" I="0.00" A="0.00" D="1.00" zone="n/a" reachable="1" isolated="1"/> +<m path="bench/agentloop/fixtures/grader" ca="0" ce="0" types="0" abstract="0" I="0.00" A="0.00" D="1.00" zone="n/a" reachable="1" isolated="1"/> +<m path="bench/agentloop/results" ca="0" ce="0" types="0" abstract="0" I="0.00" A="0.00" D="1.00" zone="n/a" reachable="1" isolated="1"/> +<m path="bench/arb" ca="0" ce="0" types="0" abstract="0" I="0.00" A="0.00" D="1.00" zone="n/a" reachable="1" isolated="1"/> +<m path="bench/arise-h2h" ca="0" ce="0" types="0" abstract="0" I="0.00" A="0.00" D="1.00" zone="n/a" reachable="1" isolated="1"/> +<m path="bench/arise-h2h/swe_agent_bundle_ripwire" ca="0" ce="0" types="0" abstract="0" I="0.00" A="0.00" D="1.00" zone="n/a" reachable="1" isolated="1"/> +<m path="bench/capsweep" ca="0" ce="0" types="0" abstract="0" I="0.00" A="0.00" D="1.00" zone="n/a" reachable="1" isolated="1"/> +<m path="bench/cppbench" ca="0" ce="0" types="1" abstract="0" I="0.00" A="0.00" D="1.00" zone="pain" reachable="1" isolated="1"/> +<m path="bench/cppbench/results" ca="0" ce="0" types="0" abstract="0" I="0.00" A="0.00" D="1.00" zone="n/a" reachable="1" isolated="1"/> +<m path="bench/ensemblecal" ca="0" ce="0" types="0" abstract="0" I="0.00" A="0.00" D="1.00" zone="n/a" reachable="1" isolated="1"/> +<m path="bench/fixround" ca="0" ce="0" types="0" abstract="0" I="0.00" A="0.00" D="1.00" zone="n/a" reachable="1" isolated="1"/> +<m path="bench/graft-h2h" ca="0" ce="0" types="0" abstract="0" I="0.00" A="0.00" D="1.00" zone="n/a" reachable="1" isolated="1"/> +<m path="bench/h4fixtures/bash" ca="0" ce="0" types="0" abstract="0" I="0.00" A="0.00" D="1.00" zone="n/a" reachable="1" isolated="1"/> +<m path="bench/h4fixtures/c" ca="0" ce="0" types="1" abstract="0" I="0.00" A="0.00" D="1.00" zone="pain" reachable="1" isolated="1"/> +<m path="bench/h4fixtures/cpp" ca="0" ce="0" types="2" abstract="1" I="0.00" A="0.50" D="0.50" zone="ok" reachable="1" isolated="1"/> +<m path="bench/h4fixtures/cppvex" ca="0" ce="0" types="0" abstract="0" I="0.00" A="0.00" D="1.00" zone="n/a" reachable="1" isolated="1"/> +<m path="bench/h4fixtures/csharp" types="3" abstract="0" A="0.00" zone="unknown" no_file_edges="cs"/> +<m path="bench/h4fixtures/go" types="1" abstract="0" A="0.00" zone="unknown" no_file_edges="go"/> +<m path="bench/h4fixtures/go2" types="1" abstract="0" A="0.00" zone="unknown" no_file_edges="go"/> +… [1392 more display lines; full output is 194260 bytes on 1 raw line(s)] +````` + +stderr: + +````` +ripwire arch: 407 file(s) in go,swift,java,cs,php,dart,kt,gd,clj: this build resolves almost none of their imports to files, so an edge through one was mostly never judged: violations= is a floor +````` + +## `./build/ripwire . --lint` + +*Built-in AST checks (c-cast, goto, unsafe-c-fn, ...).* + +**wall time: 1.97s** + +````` +<!-- ripwire lint schema=ripwire.lint/v1: AST-only checks, facts not gates: <rule name= count= shown_rows= rows_capped= count_capped=> of <f rule= p= in=>. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). findings_capped=/rows_capped=/count_capped=: 1 = cut. counts_floor=1: every count is a FLOOR, never a total. root=: p= relative to it. findings=N: findings over the printed rules; a floor when findings_capped=1. findings_next=: the call counting the floored rules' rest (count_capped=1 rules only, 10x per-rule budget). --> +<lint schema="ripwire.lint/v1" findings="8638" shown="667" capped="1" total="8638" has_more="1" next_offset="667" offset="0" limit="0" counts_floor="1" findings_capped="1" findings_next="--lint --lint-select=magic-number --lint-max-per-rule=50000" root="."> +<rule name="c-style-cast" count="761" shown_rows="79" rows_capped="1"/> +<rule name="goto" count="17" shown_rows="0" rows_capped="1"/> +<rule name="do-while" count="20" shown_rows="0" rows_capped="1"/> +<rule name="unsafe-c-fn" count="0" shown_rows="0" rows_capped="0"/> +<rule name="weak-crypto" count="0" shown_rows="0" rows_capped="0"/> +<rule name="redundant-parens" count="0" shown_rows="0" rows_capped="0"/> +<rule name="suspicious-semicolon" count="0" shown_rows="0" rows_capped="0"/> +<rule name="typedef-over-using" count="50" shown_rows="0" rows_capped="1"/> +<rule name="magic-number" count="372" shown_rows="235" rows_capped="1" count_capped="1"/> +<rule name="empty-catch" count="1" shown_rows="0" rows_capped="1"/> +<rule name="self-assign" count="3" shown_rows="0" rows_capped="1"/> +<rule name="large-function" count="378" shown_rows="34" rows_capped="1"/> +<rule name="deep-nesting" count="551" shown_rows="42" rows_capped="1"/> +<rule name="inconsistent-return" count="2" shown_rows="0" rows_capped="1"/> +<rule name="unreachable-code" count="5" shown_rows="0" rows_capped="1"/> +<rule name="naming-short" count="2279" shown_rows="81" rows_capped="1"/> +<rule name="naming-wordy" count="198" shown_rows="7" rows_capped="1"/> +<rule name="naming-series" count="985" shown_rows="0" rows_capped="1"/> +<rule name="naming-underscore" count="2" shown_rows="0" rows_capped="1"/> +<rule name="naming-case" count="102" shown_rows="0" rows_capped="1"/> +<rule name="naming-predicate" count="1" shown_rows="0" rows_capped="1"/> +<rule name="naming-setter" count="4" shown_rows="0" rows_capped="1"/> +<rule name="naming-confusable" count="1142" shown_rows="33" rows_capped="1"/> +<rule name="naming-uninformative" count="0" shown_rows="0" rows_capped="0"/> +<rule name="atom-comma-operator" count="5" shown_rows="0" rows_capped="1"/> +<rule name="atom-embedded-crement" count="253" shown_rows="17" rows_capped="1"/> +<rule name="atom-assign-as-value" count="108" shown_rows="11" rows_capped="1"/> +<rule name="atom-nested-ternary" count="379" shown_rows="27" rows_capped="1"/> +… [679 more display lines; full output is 70993 bytes on 1 raw line(s)] +````` + +## `./build/ripwire . --lint-rules=test/lintrulesfix/rules` + +*User lint rules (YAML, ast-grep style) from a directory.* + +````` +<!-- ripwire lint schema=ripwire.lint/v1: AST-only checks, facts not gates: <rule name= count= shown_rows= rows_capped= count_capped=> of <f rule= p= in=>. window: shown= capped= (capped=1 cut). rows_capped=: 1 = cut. root=: p= relative to it. findings=N: findings over the printed rules; a floor when findings_capped=1. --> +<lint schema="ripwire.lint/v1" findings="5" shown="5" capped="0" root="."> +<rule name="broken-query" sev="error" count="0" shown_rows="0" rows_capped="0" compiled="0"/> +<rule name="no-printf" sev="warn" count="5" shown_rows="5" rows_capped="0"/> +<f rule="no-printf" sev="warn" p="test/coplintfix/position.cpp:41" in="demo">use LOG() instead of printf</f> +<f rule="no-printf" sev="warn" p="test/coplintfix/safe.cpp:15" in="safe_demo">use LOG() instead of printf</f> +<f rule="no-printf" sev="warn" p="test/coplintfix/safe.cpp:27" in="safe_demo">use LOG() instead of printf</f> +<f rule="no-printf" sev="warn" p="test/lintrulesfix/sample.cpp:8" in="greet">use LOG() instead of printf</f> +<f rule="no-printf" sev="warn" p="test/usesfix/store.cpp:24" in="run">use LOG() instead of printf</f> +</lint> +````` + +stderr: + +````` +ripwire: lint-rules: test/lintrulesfix/rules/malformed.yaml:5: expected 'key: value' — file skipped +[math degraded] lint-rules: malformed rule file skipped (lintrules.h:494, auto rw::parseLintRuleFile(const std::string &, std::string_view, std::vector<LintRule> &)::(anonymous class)::operator()(std::size_t, const char *) const — logged once per site) +ripwire: AST query did not compile for any grammar: (this_is_not_a_real_node @x @@@ ((( ) +````` + +## `./build/ripwire . --lint --with-profile=report.txt` + +*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.* + +Input file: + +````` +#PROF_TSV_BEGIN one row per scope, aggregated across threads; counters are RAW integers +scope file line calls total_ms l1d_mpki +walk: chase pass x.cpp 9 12 48.500 7.250 +#PROF_TSV_END +````` + +````` +<!-- ripwire lint schema=ripwire.lint/v1: AST-only checks, facts not gates: <rule name= count= shown_rows= rows_capped= count_capped=> of <f rule= p= in=>. window: shown= capped= (capped=1 cut). rows_capped=: 1 = cut. root=: p= relative to it. findings=N: findings over the printed rules; a floor when findings_capped=1. --> +<lint schema="ripwire.lint/v1" findings="1" shown="1" capped="0" heat_joined="1" root="."> +<rule name="c-style-cast" count="0" shown_rows="0" rows_capped="0"/> +<rule name="goto" count="0" shown_rows="0" rows_capped="0"/> +<rule name="do-while" count="0" shown_rows="0" rows_capped="0"/> +<rule name="unsafe-c-fn" count="0" shown_rows="0" rows_capped="0"/> +<rule name="weak-crypto" count="0" shown_rows="0" rows_capped="0"/> +<rule name="redundant-parens" count="0" shown_rows="0" rows_capped="0"/> +<rule name="suspicious-semicolon" count="0" shown_rows="0" rows_capped="0"/> +<rule name="typedef-over-using" count="0" shown_rows="0" rows_capped="0"/> +<rule name="magic-number" count="0" shown_rows="0" rows_capped="0"/> +<rule name="empty-catch" count="0" shown_rows="0" rows_capped="0"/> +<rule name="self-assign" count="0" shown_rows="0" rows_capped="0"/> +<rule name="large-function" count="0" shown_rows="0" rows_capped="0"/> +<rule name="deep-nesting" count="0" shown_rows="0" rows_capped="0"/> +<rule name="inconsistent-return" count="0" shown_rows="0" rows_capped="0"/> +<rule name="unreachable-code" count="0" shown_rows="0" rows_capped="0"/> +<rule name="naming-short" count="0" shown_rows="0" rows_capped="0"/> +<rule name="naming-wordy" count="0" shown_rows="0" rows_capped="0"/> +<rule name="naming-series" count="0" shown_rows="0" rows_capped="0"/> +<rule name="naming-underscore" count="0" shown_rows="0" rows_capped="0"/> +<rule name="naming-case" count="0" shown_rows="0" rows_capped="0"/> +<rule name="naming-predicate" count="0" shown_rows="0" rows_capped="0"/> +<rule name="naming-setter" count="0" shown_rows="0" rows_capped="0"/> +<rule name="naming-confusable" count="0" shown_rows="0" rows_capped="0"/> +<rule name="naming-uninformative" count="0" shown_rows="0" rows_capped="0"/> +<rule name="atom-comma-operator" count="0" shown_rows="0" rows_capped="0"/> +<rule name="atom-embedded-crement" count="0" shown_rows="0" rows_capped="0"/> +<rule name="atom-assign-as-value" count="0" shown_rows="0" rows_capped="0"/> +<rule name="atom-nested-ternary" count="0" shown_rows="0" rows_capped="0"/> +… [13 more display lines; full output is 3428 bytes on 1 raw line(s)] +````` + +The joined finding — past the display cut above, extracted so the join is visible: + +````` +<f rule="cache-pointer-chase-loop" p="src/x.cpp:11" in="walk" heat_scope="walk: chase pass" heat_calls="12" heat_total_ms="48.500" heat_l1d_mpki="7.250">p = p->next</f> +````` + +## `./build/ripwire . --communities` + +*Cluster the call graph into cohesive modules.* + +````` +<!-- ripwire communities schema=ripwire.communities/v1: call-graph modules (Louvain): <community id= size= dir= label=> of <member t= n= p=>; drill= the verb taking a row's id=; shown_modules=/shown_bridges= <community>/<bridge> rows listed; bridges= community pairs joined by a call edge; isolated= symbols with no call edge: isolated_doc= doc sections, isolated_decl= other bodyless, isolated_header= other header defs, isolated_source= the rest; modules= modules of 2+ symbols; connected_singletons= 1-symbol modules with a call edge; symbols= indexed symbols. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). modules_capped=/bridges_capped=: 1 = cut. counts_floor=1: every count is a FLOOR, never a total. graph_ambiguous=/graph_unresolved=: resolver gauge. graph_unindexed=N: N files no grammar could read (the map header's unindexed=); their calls raise neither gauge. root=: p= relative to it. pr_iters=N: PageRank iterations. <bridge a= b=>: two module ids joined by call edges. from_label=/to_label=: the label= of a=/b=. <bridge edges=>: call edges between the two, either direction. --> +<communities schema="ripwire.communities/v1" drill="--community=ID" modules="5247" shown_modules="30" modules_capped="1" bridges="8832" shown_bridges="12" bridges_capped="1" isolated="21074" isolated_decl="5832" isolated_header="3601" isolated_source="4566" isolated_doc="7075" connected_singletons=" … [line truncated: 193 more bytes on this line] +<community id="6925" size="1652" dir="src" label="src::emitTo@infra/emit.h:53:2760 [write,run,emit]" shown="5" capped="1"> +<member t="macro" n="EXPECTS" p="src/infra/Diagnostics.h:393"/> +<member t="fn" n="escapeXml" p="src/serialize.h:185"/> +<member t="fn" n="formatTo" p="src/infra/emit.h:141"/> +<member t="fn" n="emitTo" p="src/infra/emit.h:53"/> +<member t="fn" n="emitTo" p="src/infra/emit.h:78"/> +</community> +<community id="6970" size="733" dir="src" label="src::kindIs@infra/nodekind.h:46:3271 [push,emit,read]" shown="5" capped="1"> +<member t="fn" n="kindIs" p="src/infra/nodekind.h:46"/> +<member t="fn" n="nodeTextOf" p="src/ingest_metrics.h:161"/> +<member t="fn" n="enumTableAt" p="src/infra/enumcount.h:106"/> +<member t="fn" n="fieldChild" p="src/infra/fieldid.h:223"/> +<member t="fn" n="langFacts" p="src/langfacts.h:568"/> +</community> +<community id="6984" size="375" dir="src" label="src::DISCLOSE@infra/Diagnostics.h:622:43913 [read,scan,run]" shown="5" capped="1"> +<member t="macro" n="DISCLOSE" p="src/infra/Diagnostics.h:622"/> +<member t="fn" n="isStructOrNamedType" p="src/model.h:147"/> +<member t="fn" n="tokText" p="src/defectshape.h:161"/> +<member t="macro" n="VALIDATE" p="src/infra/Diagnostics.h:423"/> +<member t="fn" n="tokIs" p="src/defectshape.h:171"/> +</community> +<community id="7026" size="70" dir="src" label="src::isIdentChar@infra/namesplit.h:35:1884 [call,split,parse]" shown="5" capped="1"> +<member t="fn" n="isIdentChar" p="src/infra/namesplit.h:35"/> +<member t="fn" n="trimWs" p="src/resolve.h:2004"/> +<member t="fn" n="trimWs" p="src/verify.h:77"/> +<member t="fn" n="identifierRunOf" p="src/taskroute.h:822"/> +<member t="fn" n="indentOf" p="src/lintrules.h:444"/> +</community> +… [188 more display lines; full output is 16453 bytes on 1 raw line(s)] +````` + +## `./build/ripwire . --zoom` + +*Nested module hierarchy (multi-level Louvain) + cross-module bridges — shown_levels="2" of levels= BY DEFAULT over the 40 largest top modules (~8 KB, where the whole tree is ~220 KB); a module AT the cut carries children=.* + +````` +<!-- ripwire zoom schema=ripwire.zoom/v1: nested module hierarchy: <module level= id= size= dir= shown= capped=> of <member t= n= p=>; symbols= = isolated= + size= of all top_modules=. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). levels_capped=: 1 = cut. counts_floor=1: every count is a FLOOR, never a total. graph_ambiguous=/graph_unresolved=: resolver gauge. graph_unindexed=N: N files no grammar could read (the map header's unindexed=); their calls raise neither gauge. pr_iters=N: PageRank iterations. shown_levels=N: of levels= printed; levels_capped=1 deeper ones unprinted. children=K: K child modules below the shown_levels= cut, unprinted. next=: the one pasteable follow-up. --> +<zoom schema="ripwire.zoom/v1" levels="5" shown_levels="2" levels_capped="1" top_modules="1689" symbols="45032" isolated="21074" shown="40" capped="1" total="1689" has_more="1" next_offset="40" offset="0" limit="0" pr_iters="37" graph_ambiguous="3984" graph_unresolved="20100" graph_unindexed="313" c … [line truncated: 42 more bytes on this line] +<module level="4" id="1818" size="11567" dir="./src"> +<module level="3" id="1819" size="11038" dir="./src" children="23"> +</module> +<module level="3" id="1831" size="469" dir="./src/infra" children="6"> +</module> +<module level="3" id="6790" size="60" dir="./src" children="2"> +</module> +</module> +<module level="4" id="6327" size="2959" dir="./test"> +<module level="3" id="6329" size="2959" dir="./test" children="12"> +</module> +</module> +<module level="4" id="1572" size="570" dir="./bench/agentloop"> +<module level="3" id="1635" size="422" dir="./test" children="7"> +</module> +<module level="3" id="1572" size="148" dir="./bench/agentloop" children="3"> +</module> +</module> +<module level="4" id="740" size="321" dir="./docs"> +<module level="3" id="740" size="321" dir="./docs" children="1"> +</module> +</module> +<module level="4" id="19670" size="106" dir="./test/ownerhopfix/py/pkg"> +<module level="3" id="19673" size="106" dir="./test/ownerhopfix/py/pkg" children="1"> +</module> +</module> +<module level="4" id="5765" size="76" dir="./docs"> +<module level="3" id="5767" size="76" dir="./docs" children="2"> +… [139 more display lines; full output is 7639 bytes on 1 raw line(s)] +````` + +## `./build/ripwire . --zoom --zoom-levels=3` + +*The restoring knob: --zoom-levels=N prints N levels (0 = the whole tree); here three, ~11 KB.* + +````` +<!-- ripwire zoom schema=ripwire.zoom/v1: nested module hierarchy: <module level= id= size= dir= shown= capped=> of <member t= n= p=>; symbols= = isolated= + size= of all top_modules=. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). levels_capped=: 1 = cut. counts_floor=1: every count is a FLOOR, never a total. graph_ambiguous=/graph_unresolved=: resolver gauge. graph_unindexed=N: N files no grammar could read (the map header's unindexed=); their calls raise neither gauge. pr_iters=N: PageRank iterations. shown_levels=N: of levels= printed; levels_capped=1 deeper ones unprinted. children=K: K child modules below the shown_levels= cut, unprinted. next=: the one pasteable follow-up. --> +<zoom schema="ripwire.zoom/v1" levels="5" shown_levels="3" levels_capped="1" top_modules="1689" symbols="45032" isolated="21074" shown="40" capped="1" total="1689" has_more="1" next_offset="40" offset="0" limit="0" pr_iters="37" graph_ambiguous="3984" graph_unresolved="20100" graph_unindexed="313" c … [line truncated: 58 more bytes on this line] +<module level="4" id="1818" size="11567" dir="./src"> +<module level="3" id="1819" size="11038" dir="./src"> +<module level="2" id="1825" size="7552" dir="./src" children="93"> +</module> +<module level="2" id="1833" size="1456" dir="./src" children="21"> +</module> +<module level="2" id="6626" size="772" dir="./src" children="30"> +</module> +<module level="2" id="6571" size="254" dir="./src" children="13"> +</module> +<module level="2" id="8206" size="90" dir="./src" children="3"> +</module> +<module level="2" id="6619" size="111" dir="./src" children="6"> +</module> +<module level="2" id="7222" size="95" dir="./src" children="9"> +</module> +<module level="2" id="6753" size="84" dir="./src" children="8"> +</module> +<module level="2" id="8847" size="105" dir="./src/infra" children="3"> +</module> +<module level="2" id="1821" size="112" dir="./src/infra" children="3"> +</module> +<module level="2" id="7311" size="54" dir="./src" children="6"> +</module> +<module level="2" id="6997" size="54" dir="./src" children="5"> +</module> +<module level="2" id="10095" size="53" dir="./src" children="2"> +</module> +… [325 more display lines; full output is 14516 bytes on 1 raw line(s)] +````` + +## `./build/ripwire . --report` + +*Architecture summary (modules, god-files, cycles) as markdown.* + +````` +<!-- ripwire markdown: no run of 4-or-more backticks in this output — safe to embed inside a wider fence --> + +# ripwire architecture report + +4852 files · 45032 symbols · 45381 edges · 5247 modules (21074 call-graph isolated) + +Root: `.` + +Call-graph isolate provenance: 5832 declaration, 3601 header, 4566 source, 7075 document; 0 connected Louvain singletons + +## Modules (call-graph clusters; showing 12 of 5247) +- **src::emitTo@infra/emit.h:53:2760 [write,run,emit]** — 1652 symbols +- **src::kindIs@infra/nodekind.h:46:3271 [push,emit,read]** — 733 symbols +- **src::DISCLOSE@infra/Diagnostics.h:622:43913 [read,scan,run]** — 375 symbols +- **docs::`--top-k=N`@COMMANDS.md:59:9303 [pack,allow,insert]** — 185 symbols +- **src::close@infra/os.h:181:9420 [open,write,read]** — 121 symbols +- **src::str@infra/internedtext.h:323:16987 [resolve,find,add]** — 118 symbols +- **src/infra::fail@os_win32.cpp:63:2553 [get,open,release]** — 111 symbols +- **src::shSingleQuote@infra/shquote.h:19:960 [read,resolve,compute]** — 109 symbols +- **test/ownerhopfix/py/pkg::big_handler_001@broadcast.py:3:72** — 106 symbols +- **src::sortUnique@infra/sortutil.h:55:2725 [connect,collect,compute]** — 84 symbols +- **src::text@ingest_valuerefs.h:804:41690 [emit,open,mark]** — 80 symbols +- **src::unq@shstatus.h:194:7733 [visit,call,bind]** — 77 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. + +## God files (most depended-on; showing 10 of 316) +- `src/model.h` — 144 dependents +- `src/infra/emit.h` — 101 dependents +- `src/infra/sortutil.h` — 89 dependents +… [38 more lines, 4349 bytes total] +````` + +## `./build/ripwire . --seams` + +*Cross-module call seams no test reaches. NOW carries seam_pairs/shown/capped.* + +````` +<!-- ripwire seams schema=ripwire.seams/v1: cross-directory call edges NO test reaches: <seam from= to= untested= shown= capped=> of <edge caller= p= callee= cp=>. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). counts_floor=1: every count is a FLOOR, never a total. graph_ambiguous=/graph_unresolved=: resolver gauge. graph_unindexed=N: N files no grammar could read (the map header's unindexed=); their calls raise neither gauge. root=: p= relative to it. pr_iters=N: PageRank iterations. modules=N: directories holding indexed symbols (a module = parent dir). bridges=N: cross-directory call edges, tested or not; untested= is those no test reaches. test_files=N: test files whose calls seed the reach; 0 means every seam reads untested. seam_pairs=N: directed dir pairs with an untested edge (the seam rows' total). doc_links=N: cross-directory links between two document sections, not in bridges= or untested= (no test exercises a document link); absent at 0. <file-scope> (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. --> +<seams schema="ripwire.seams/v1" modules="1411" bridges="6264" untested="3248" doc_links="90" test_files="3938" seam_pairs="47" shown="20" capped="1" total="47" has_more="1" next_offset="20" offset="0" limit="0" pr_iters="37" root="." graph_ambiguous="3984" graph_unresolved="20100" graph_unindexed=" … [line truncated: 22 more bytes on this line] +<seam from="src" to="src/infra" untested="3057" shown="5" capped="1"> +<edge caller="jsonStr" p="src/serialize.h:11341" callee="escapeMcp" cp="src/infra/jsonesc.h:247"/> +<edge caller="baseNameOf" p="src/mention.h:338" callee="afterLast" cp="src/infra/namesplit.h:193"/> +<edge caller="appendNextValueXml" p="src/nextverb.h:50" callee="utf8SeqLen" cp="src/infra/jsonesc.h:59"/> +<edge caller="tokensForEmittedBytes" p="src/serialize.h:1325" callee="ASSUME" cp="src/infra/Diagnostics.h:392"/> +<edge caller="jsonEscape" p="src/mcpjson.h:865" callee="escapeMcp" cp="src/infra/jsonesc.h:247"/> +</seam> +<seam from="bench" to="src/infra" untested="78" shown="5" capped="1"> +<edge caller="infraSortSmall" p="bench/bench_radix_ab.cpp:73" callee="sortKeySmall" cp="src/infra/radixSort.h:91"/> +<edge caller="isSorted" p="bench/bench_sort_large.cpp:42" callee="lessByFromTo" cp="src/infra/sortutil.h:180"/> +<edge caller="benchScores" p="bench/bench_radix_ab.cpp:133" callee="nonNegativeFloatDescKey" cp="src/infra/sortutil.h:83"/> +<edge caller="benchScores" p="bench/bench_radix_ab.cpp:133" callee="lessByScoreDescId" cp="src/infra/sortutil.h:62"/> +<edge caller="benchAdaptive" p="bench/bench_radix_ab.cpp:157" callee="nonNegativeFloatDescKey" cp="src/infra/sortutil.h:83"/> +</seam> +<seam from="src/infra" to="src" untested="9" shown="5" capped="1"> +<edge caller="RW_SAME_THREAD_" p="src/infra/Diagnostics.h:448" callee="load" cp="src/clones.h:986"/> +<edge caller="claimOrCheck" p="src/infra/Diagnostics.h:250" callee="load" cp="src/clones.h:986"/> +<edge caller="stopping" p="src/infra/pipefields.h:59" callee="load" cp="src/clones.h:986"/> +<edge caller="addEvents" p="src/infra/profileScope.h:323" callee="load" cp="src/clones.h:986"/> +<edge caller="liveThreadCount" p="src/infra/os.h:606" callee="increment" cp="src/ingest_crawl.h:1817"/> +</seam> +<seam from="bench/multiswe" to="bench/locbench" untested="8" shown="5" capped="1"> +<edge caller="main" p="bench/multiswe/run_multiswe.py:301" callee="run_ctx" cp="bench/locbench/run_locbench.py:166"/> +<edge caller="main" p="bench/multiswe/run_multiswe.py:301" callee="parse_candidates" cp="bench/locbench/run_locbench.py:223"/> +<edge caller="main" p="bench/multiswe/run_multiswe.py:301" callee="norm_path" cp="bench/locbench/run_locbench.py:241"/> +<edge caller="main" p="bench/multiswe/run_multiswe.py:301" callee="ranked_files_from_candidates" cp="bench/locbench/run_locbench.py:245"/> +<edge caller="main" p="bench/multiswe/run_multiswe.py:301" callee="file_ranks" cp="bench/locbench/run_locbench.py:251"/> +</seam> +… [90 more display lines; full output is 12768 bytes on 1 raw line(s)] +````` + +## `./build/ripwire . --mermaid` + +*Module (directory) dependency graph as a Mermaid diagram.* + +````` +%% 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<br/>15178"] + n106["src/infra<br/>1687"] + end + subgraph sg1 ["test"] + n107["test<br/>7030"] + n750["test/legochargefix<br/>546"] + n472["test/fixtures/recallpassage<br/>314"] + n491["test/fnslotcpp2<br/>285"] + n913["test/lib<br/>262"] + n712["test/ifacepeelfix/cpp<br/>206"] + n1260["test/slotjoinfix<br/>182"] + n1017["test/ownerhopfix/py/pkg<br/>158"] + n408["test/expandmodefix<br/>151"] + n410["test/expandsibsfix<br/>149"] + n1223["test/rubyschemafix<br/>99"] + n527["test/forbodyfoldfix/py<br/>98"] + end + n77["docs<br/>1266"] + subgraph sg3 ["bench"] + n63["bench/sectionfront<br/>1033"] + n4["bench<br/>569"] + n5["bench/agentloop<br/>331"] + n50["bench/locbench/results/r5_pooling<br/>237"] + n51["bench/locbench/results/r6_expansion<br/>187"] + n60["bench/recalleval<br/>113"] + n44["bench/locbench<br/>107"] + n38["bench/headtohead/r3-headroom-2026-08-03<br/>104"] +… [23 more lines, 1626 bytes total] +````` + +## `./build/ripwire . --owners` + +*Bus-factor: recency-weighted author ownership per file.* + +**wall time: 1.46s** + +````` +<!-- ripwire owners schema=ripwire.owners/v1: recency-weighted author ownership (half-life 6mo): <f p= authors= bf= top= share=>; bf=1 = one person holds it. at=: commit+dirty+shallow. root=: p= relative to it. files=N: files analysed. files=N: single-author files folded into this one row; detail=1 lists each. --> +<owners schema="ripwire.owners/v1" files="4852" root="." at="914c4045d"> +<uniform authors="1" bf="1" share="1.00" files="3755"/> +<f p=".coderabbit.yaml" authors="2" bf="0" top="<author>" share="0.59"/> +<f p=".github/pargates-shard-weights.json" authors="3" bf="0" top="<author>" share="0.49"/> +<f p=".github/workflows/ci.yml" authors="6" bf="0" top="<author>" share="0.41"/> +<f p=".github/workflows/nightly.yml" authors="3" bf="0" top="<author>" share="0.73"/> +<f p=".github/workflows/release.yml" authors="3" bf="0" top="<author>" share="0.59"/> +<f p=".github/workflows/windows-package.yml" authors="2" bf="1" top="<author>" share="0.89"/> +<f p="AGENTS.md" authors="2" bf="0" top="<author>" share="0.71"/> +<f p="CHANGELOG.md" authors="18" bf="0" top="<author>" share="0.51"/> +<f p="CLAUDE.md" authors="5" bf="0" top="<author>" share="0.41"/> +<f p="CONTRIBUTING.md" authors="8" bf="0" top="<author>" share="0.36"/> +<f p="INSTALL.md" authors="3" bf="0" top="<author>" share="0.77"/> +<f p="README.md" authors="23" bf="0" top="<author>" share="0.50"/> +<f p="SECURITY.md" authors="3" bf="0" top="<author>" share="0.46"/> +<f p="THIRD_PARTY.md" authors="8" bf="0" top="<author>" share="0.41"/> +<f p="bench/ANSWERQUALITY.md" authors="2" bf="0" top="<author>" share="0.72"/> +<f p="bench/PROFILE.md" authors="5" bf="0" top="<author>" share="0.78"/> +<f p="bench/agentloop/README.md" authors="2" bf="1" top="<author>" share="0.89"/> +<f p="bench/agentloop/grade_answers.py" authors="4" bf="0" top="<author>" share="0.39"/> +<f p="bench/agentloop/run_agentloop.py" authors="3" bf="1" top="<author>" share="0.90"/> +<f p="bench/agentloop/run_editsuite.py" authors="2" bf="0" top="<author>" share="0.80"/> +<f p="bench/arb/run_arb.py" authors="2" bf="0" top="<author>" share="0.65"/> +<f p="bench/bench_proof.py" authors="2" bf="0" top="<author>" share="0.60"/> +<f p="bench/capsweep/capsweep.py" authors="3" bf="0" top="<author>" share="0.78"/> +<f p="bench/headtohead/r3-headroom-2026-08-03/timing_determinism.py" authors="2" bf="0" top="<author>" share="0.60"/> +<f p="bench/mcp_session_timing.py" authors="2" bf="0" top="<author>" share="0.60"/> +<f p="bench/mine_traces.py" authors="2" bf="0" top="<author>" share="0.72"/> +<f p="bench/nestcal/measure.py" authors="2" bf="0" top="<author>" share="0.60"/> +… [1071 more display lines; full output is 119783 bytes on 1 raw line(s)] +````` + +## `./build/ripwire . --dead-code=src` + +*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.89s** + +````` +<!-- ripwire dead-code schema=ripwire.dead-code/v1: internal-linkage functions with no caller found in the index (not a confidence score): <d n= t= p= l=>; filter= path component. window: shown= total= (capped=1 cut). counts_floor=1: every count is a FLOOR, never a total. graph_ambiguous=/graph_unresolved=: resolver gauge. graph_unindexed=N: N files no grammar could read (the map header's unindexed=); their calls raise neither gauge. value-ref-excluded=N: internal functions kept off because a table, field or argument in another function or at file scope holds them (matched by name, not a proven call); a floor. root=: p= relative to it. evidence=: the rule every row met, internal linkage and no caller in the index; verify before deleting. register-macro-excluded=N: symbols skipped as self-registering test/bench macros (TEST, BENCHMARK...) or Rust #[test]; a floor. exported linkage=exported evidence=no-non-test-caller: PUBLIC free functions of the filtered files with no non-test caller in the graph, <e> rows after d/to; not dead, not in count=, code outside the tree may call them (zero means none found here); total= found, shown= printed (capped=1 rows cut), files= read of files_total= filtered files holding a non-internal free function with no non-test caller (first by path; total=0 can follow), unseen=N a floor on text files unread, unseen_by= the cap or failure behind each, extra=skipped verdicts fixed by indexed files so unindexed ones unread (counts, at= are floors). e n= t= p= l= v=unused no mention in any text file under the root outside its def (prose docs not read)|test-only only tests|file-only same-file words only|unknown why= names what may reach it: string (__all__, getattr, a registry key)|value|framework (decorator, hook)|import (re-export)|barrel|api|name|by-name|declined|built-name|dispatch|members|manifest|in-file|unimported|unseen; tests= text= str= imp= same= word counts, defs= overloads, at= sites to read. count=N: candidates meeting evidence= (a floor). --> +<dead-code schema="ripwire.dead-code/v1" count="1" evidence="internal-linkage+zero-callers" register-macro-excluded="0" value-ref-excluded="10" filter="src" root="." graph_ambiguous="3984" graph_unresolved="20100" graph_unindexed="313" counts_floor="1"> +<d n="unused_helper" t="fn" p="test/archmetricsfix/src/orphan/util.cpp" l="1"/> +<exported linkage="exported" evidence="no-non-test-caller" total="9" shown="9" files="1" files_total="1" unseen="1" unseen_by="size=1,total=0,files=0,read=0,walk=0"> +<e n="Unique" t="cls" p="src/infra/os_win32.cpp" l="85" v="unknown" defs="3" why="name,members,unseen" text="7" same="13" at="src/pincensus.h:57,src/pincensus.h:83"/> +<e n="StreamLock" t="cls" p="src/infra/os_win32.cpp" l="205" v="unknown" defs="2" why="unseen" same="6"/> +<e n="NativePath" t="cls" p="src/infra/os_win32.cpp" l="370" v="unknown" defs="2" why="members,unseen" tests="1" same="14"/> +<e n="SocketTable" t="cls" p="src/infra/os_win32.cpp" l="425" v="unknown" defs="2" why="unseen" same="5"/> +<e n="WinsockSession" t="cls" p="src/infra/os_win32.cpp" l="439" v="unknown" defs="2" why="members,unseen" same="6"/> +<e n="memoryStreamMutex" t="fn" p="src/infra/os_win32.cpp" l="1330" v="unknown" why="unseen" same="3"/> +<e n="ProcThreadAttributes" t="cls" p="src/infra/os_win32.cpp" l="2084" v="unknown" defs="2" why="members,unseen" same="6"/> +<e n="childMutex" t="fn" p="src/infra/os_win32.cpp" l="2230" v="unknown" why="unseen" same="5"/> +<e n="threadTrampoline" t="fn" p="src/infra/os_win32.cpp" l="2575" v="unknown" why="value,unseen" same="1"/> +</exported> +</dead-code> +````` + +## `./build/ripwire . --exercises=test/regression.sh` + +*Which symbols a TEST FILE exercises — the reverse direction of --affected.* + +````` +<!-- ripwire exercises schema=ripwire.exercises/v1: NON-TEST symbols this test transitively calls (what it covers): <t p= run=>; the inverse of affected. window: shown= capped= (capped=1 cut). seed_files_capped=: 1 = cut. counts_floor=1: every count is a FLOOR, never a total. graph_ambiguous=/graph_unresolved=: resolver gauge. graph_unindexed=N: N files no grammar could read (the map header's unindexed=); their calls raise neither gauge. root=: p= relative to it. pr_iters=N: PageRank iterations. seed_files=N: test files the pattern matched. shown_seed_files=N: of those, printed as t rows (at most 20). test_symbols=N: symbols in those test files, the walk's seeds. reaches=N: non-test symbols the tests transitively call (the s rows' total). harness=script|mixed: seeds include shell gates, whose subprocess coverage is unseen; note= says so. of=: the test file pattern given. --> +<exercises schema="ripwire.exercises/v1" of="test/regression.sh" seed_files="1" shown_seed_files="1" seed_files_capped="0" test_symbols="4" reaches="0" harness="script" note="a shell gate invokes the compiled binary as a subprocess; script-to-binary edges are not modelled, so reaches= counts call-gr … [line truncated: 189 more bytes on this line] +<t p="test/regression.sh" run="bash test/regression.sh"/> +</exercises> +````` + +## `./build/ripwire . --community=0` + +*Drill into ONE call-graph community by id — the drill= the --communities output itself advertises.* + +````` +<!-- ripwire community schema=ripwire.community/v1: ONE module id=: <member t= n= p=> ranked members, its <bridge> edges; size= the TRUE count; dir= its members' most common directory (a top-level file's own path); label= dir::name@file:line:byte of its top fan-in member (non-accessors first) [up to 3 top name verbs]; bridges= modules a call edge joins to it; partition= module count incl. singletons (ids 0..partition-1); modules= those of 2+ symbols; shown_bridges= <bridge> rows listed. window: shown= capped= (capped=1 cut). bridges_capped=: 1 = cut. counts_floor=1: every count is a FLOOR, never a total. graph_ambiguous=/graph_unresolved=: resolver gauge. graph_unindexed=N: N files no grammar could read (the map header's unindexed=); their calls raise neither gauge. root=: p= relative to it. pr_iters=N: PageRank iterations. --> +<community schema="ripwire.community/v1" id="0" size="1" dir=".coderabbit.yaml" label=".coderabbit.yaml::reviews@.coderabbit.yaml:12:928" bridges="0" shown_bridges="0" bridges_capped="0" partition="26321" modules="5247" shown="1" capped="0" pr_iters="37" root="." graph_ambiguous="3984" graph_unresol … [line truncated: 51 more bytes on this line] +<member t="sec" n="reviews" p=".coderabbit.yaml:12"/> +</community> +````` + +## `./build/ripwire . --quality-delta` + +*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: 33.96s** + +````` +<!-- ripwire quality-delta schema=ripwire.quality-delta/v1: only what the change made WORSE vs baseline=: regressions= minor= gating=; <r kind= sym= p= was= now= gating= bar=>, <sa> acked. value-ref-excluded=N: internal functions kept off because a table, field or argument in another function or at file scope holds them (matched by name, not a proven call); a floor. at=: commit+dirty+shallow. stale=N: ack ledger rows whose target no longer applies (sa rows); never gating. stale_by_kind=: stale= split by ack kind (kind:N,...); the sa rows are collapsed. stale_next=: the call printing the sa rows and the full header. preexisting-worse=N: regressions on symbols that existed at baseline; they gate when major. new-symbol=N: NEW code; new-symbol rows never gate, except defect-shape format-arity, ceiling=, tangle. register-macro-excluded=N: symbols skipped: self-registering test/bench macros or Rust #[test]; a floor. declined-call-excluded=N: symbols kept out of dead-code only because a declined call may mean them; a floor. api-new-surface=N: new PUBLIC symbols; a count, never gates, not in regressions=. renames=/rename_window_commits=: git rename pairs read over that many commits, to re-file baseline and acks. acked_by_rename=/acked_by_content=: acked= suppressions matched via git renames / an equal body hash. renames_window_truncated=1: history is deeper than the rename window, older renames unread. acked=N: findings suppressed by the ack ledger, listed as sa rows; never gating. --> +<quality-delta schema="ripwire.quality-delta/v1" baseline="git-HEAD" regressions="0" minor="0" acked="0" stale="203" preexisting-worse="0" new-symbol="0" gating="0" register-macro-excluded="63" api-new-surface="0" at="914c4045d+dirty" renames="68" rename_window_commits="400" acked_by_rename="0" acke … [line truncated: 298 more bytes on this line] +</quality-delta> +````` + +stderr: + +````` +ripwire: no ./.ripwire_quality_baseline — auto-comparing the working tree vs git HEAD (commit the baseline with --quality-baseline to pin it) +````` + +## `./build/ripwire . --quality-delta --show-stale` + +*The same run, the same clone, the folded rows printed back: each stale acknowledgement as an <sa kind= key= why=> row under the full header — the demo row included, and no quarter of the bytes saved by silence. Refused without --quality-delta.* + +**wall time: 15.46s** + +````` +<!-- ripwire quality-delta schema=ripwire.quality-delta/v1: only what the change made WORSE vs baseline=: regressions= minor= gating=; <r kind= sym= p= was= now= gating= bar=>, <sa> acked. value-ref-excluded=N: internal functions kept off because a table, field or argument in another function or at file scope holds them (matched by name, not a proven call); a floor. at=: commit+dirty+shallow. stale=N: ack ledger rows whose target no longer applies (sa rows); never gating. preexisting-worse=N: regressions on symbols that existed at baseline; they gate when major. new-symbol=N: NEW code; new-symbol rows never gate, except defect-shape format-arity, ceiling=, tangle. register-macro-excluded=N: symbols skipped: self-registering test/bench macros or Rust #[test]; a floor. declined-call-excluded=N: symbols kept out of dead-code only because a declined call may mean them; a floor. api-new-surface=N: new PUBLIC symbols; a count, never gates, not in regressions=. renames=/rename_window_commits=: git rename pairs read over that many commits, to re-file baseline and acks. acked_by_rename=/acked_by_content=: acked= suppressions matched via git renames / an equal body hash. renames_window_truncated=1: history is deeper than the rename window, older renames unread. acked=N: findings suppressed by the ack ledger, listed as sa rows; never gating. sa key=/why=: the stale ack's ledger hash / target-gone (names nothing now) or finding-gone (no longer fires). --> +<quality-delta schema="ripwire.quality-delta/v1" baseline="git-HEAD" regressions="0" minor="0" acked="0" stale="203" preexisting-worse="0" new-symbol="0" gating="0" register-macro-excluded="63" api-new-surface="0" at="914c4045d+dirty" renames="68" rename_window_commits="400" acked_by_rename="0" acke … [line truncated: 99 more bytes on this line] +<sa kind="api-surface" key="0123456789abcdef" why="target-gone"/> +<sa kind="api-surface" key="085e3d408c2c4a35" why="target-gone"/> +<sa kind="api-surface" key="155d74d341a49f3c" why="target-gone"/> +<sa kind="api-surface" key="1a15386c2d1e47af" why="target-gone"/> +<sa kind="api-surface" key="298e798c7f075715" why="target-gone"/> +<sa kind="api-surface" key="56acdf9b5c314a14" why="target-gone"/> +<sa kind="api-surface" key="5a07390012b46e06" why="target-gone"/> +<sa kind="api-surface" key="6eef859578c8c376" why="target-gone"/> +<sa kind="api-surface" key="6f2394762f82a855" why="target-gone"/> +<sa kind="api-surface" key="7f2c3eefdf6e512e" why="target-gone"/> +<sa kind="api-surface" key="802e513731103806" why="target-gone"/> +<sa kind="api-surface" key="b6a24afef32a68a8" why="target-gone"/> +<sa kind="api-surface" key="c923e661c197b265" why="target-gone"/> +<sa kind="api-surface:new-symbol" key="1926b0d9e94541a0" why="target-gone"/> +<sa kind="api-surface:new-symbol" key="1d3814ba687a4aef" why="target-gone"/> +<sa kind="api-surface:new-symbol" key="1db76028879244ef" why="target-gone"/> +<sa kind="api-surface:new-symbol" key="25c9f0504fd376a4" why="target-gone"/> +<sa kind="api-surface:new-symbol" key="26aa7c55d54c4341" why="target-gone"/> +<sa kind="api-surface:new-symbol" key="26e3f9a6bff9ea57" why="target-gone"/> +<sa kind="api-surface:new-symbol" key="36e39c7ab0fc1686" why="target-gone"/> +<sa kind="api-surface:new-symbol" key="4bce64bd920de0c3" why="target-gone"/> +<sa kind="api-surface:new-symbol" key="61f0e361ef7dee27" why="target-gone"/> +<sa kind="api-surface:new-symbol" key="79625906f9f71ad0" why="target-gone"/> +<sa kind="api-surface:new-symbol" key="8ecb190954dce18a" why="target-gone"/> +<sa kind="api-surface:new-symbol" key="995375dfa4e63104" why="target-gone"/> +<sa kind="api-surface:new-symbol" key="ee71e4fffa361902" why="target-gone"/> +<sa kind="complexity" key="0001f7edbff929e5" why="finding-gone" sym="src/cli.h::rw::validateLegendModifier" p="src/cli.h:4828"/> +<sa kind="complexity" key="05b5f1acf3a7e880" why="finding-gone" sym="runQualityDelta" p="src/verbs_quality.h:3449"/> +… [176 more display lines; full output is 19650 bytes on 1 raw line(s)] +````` + +stderr: + +````` +ripwire: no ./.ripwire_quality_baseline — auto-comparing the working tree vs git HEAD (commit the baseline with --quality-baseline to pin it) +````` + +## `./build/ripwire . --edit-check=rankGraphTeleport` + +*Fast per-symbol post-edit contract check vs git HEAD (unchanged on a clean tree).* + +**wall time: 14.00s** + +````` +<!-- ripwire edit-check schema=ripwire.edit-check/v1: sym='s contract NOW vs HEAD: status=unchanged|new-symbol|contract-change; <c n= p= incompatible=1 sites_l=> callers. counts_floor=1: every count is a FLOOR, never a total. graph_ambiguous=/graph_unresolved=: resolver gauge. graph_unindexed=N: N files no grammar could read (the map header's unindexed=); their calls raise neither gauge. est_tokens=: price as emitted (an upper bound under compact). at=: commit+dirty+shallow. root=: p= relative to it. next=: the one pasteable follow-up. defs=N: overloads at this site (same file, scope, name) folded into one contract; params compared by MAX. callers=N: callers of sym= (the c rows' total; a floor). t=: sym='s kind (fn|cls|...). --> +<edit-check schema="ripwire.edit-check/v1" sym="rankGraphTeleport" t="fn" p="src/graph.h:14921" status="unchanged" defs="1" callers="7" incompatible="0" at="914c4045d" graph_ambiguous="3984" graph_unresolved="20100" graph_unindexed="313" counts_floor="1" root="." next="--test-gate=src/graph.h" est_t … [line truncated: 12 more bytes on this line] +<c n="runEval" p="src/eval.h:171"/> +<c n="rankGraph" p="src/graph.h:14964"/> +<c n="anchoredLexicalRank" p="src/graph.h:15633"/> +<c n="churnDecayRanking" p="src/main.cpp:1433"/> +<c n="churnRankedGraph" p="src/main.cpp:1472"/> +<c n="runDefaultMap" p="src/main.cpp:1759"/> +<c n="getIndex" p="src/mcpindex.h:1224"/> +</edit-check> +````` + +stderr: + +````` +ripwire: cache <tmp>: over its 2048 MiB budget — evicted 92 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).* + +````` +<!-- ripwire pr-context schema=ripwire.pr-context/v1: review bundle per changed file vs base=: symbols, callers, blast radius, tests, owners. counts_floor=1: every count is a FLOOR, never a total. graph_ambiguous=/graph_unresolved=: resolver gauge. graph_unindexed=N: N files no grammar could read (the map header's unindexed=); their calls raise neither gauge. 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). 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). files=N: changed files in the diff (shown= of them listed). --> +<pr-context schema="ripwire.pr-context/v1" base="working-tree" root="." direction="worktree-since-head" files="0" skipped_mode_only="0" budget_tokens="8000" est_tokens="584" trim_level="0" truncated="none" budget_default="1" at="914c4045d" graph_ambiguous="3984" graph_unresolved="20100" graph_uninde … [line truncated: 27 more bytes on this line] +<!-- no changed files in the index (clean tree, or the diff touched only non-indexed files) --> +</pr-context> +````` + +## `./build/ripwire . --pr-context=HEAD~1` + +*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: 1.17s** + +````` +<!-- ripwire pr-context schema=ripwire.pr-context/v1: review bundle per changed file vs base=: symbols, callers, blast radius, tests, owners. counts_floor=1: every count is a FLOOR, never a total. graph_ambiguous=/graph_unresolved=: resolver gauge. graph_unindexed=N: N files no grammar could read (the map header's unindexed=); their calls raise neither gauge. 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). 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). --> +<pr-context schema="ripwire.pr-context/v1" base="HEAD~1" root="." anchor="merge-base" base_sha="b6ae53e9f" base_moved="0" direction="head-since-fork" files="0" skipped_mode_only="0" budget_tokens="8000" est_tokens="825" trim_level="0" truncated="none" budget_default="1" at="914c4045d" graph_ambiguou … [line truncated: 73 more bytes on this line] +<no-ref-work note="HEAD~1 tip == merge-base, so that ref has no divergent work of its own; this bundle is HEAD's work since the fork. For the ref's OWN diff see merge-scout or stray-content"/> +<!-- no changed files in the index (clean tree, or the diff touched only non-indexed files) --> +</pr-context> +````` + +## `./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: 19.88s** + +````` +<!-- ripwire merge-scout schema=ripwire.merge-scout/v1: cross-branch overlap of arms= refs: <arm ref= base= changed= head_conflicts=>, <pair a= b= conflicts= risks=>, <landing order=>. at=: commit+dirty+shallow. head=: the HEAD commit, bare 9-hex sha (at= adds +dirty). ok=1 on an arm row means the comparison RAN, so changed=/head_conflicts= are real and may legitimately be 0 (an empty but materialized tree is a real index); ok=0 means it did not run at all. no-work note=: arm compared and has no divergent work vs its merge base, so no landing slot. --> +<merge-scout schema="ripwire.merge-scout/v1" arms="2" head="914c4045d" at="914c4045d"> +<arm ref="HEAD~2" base="739151ce9" ok="1" changed="0" head_conflicts="0"> +<no-work note="no divergent work vs merge-base — see --stray-content"/> +</arm> +<arm ref="HEAD~1" base="b6ae53e9f" ok="1" changed="0" head_conflicts="0"> +<no-work note="no divergent work vs merge-base — see --stray-content"/> +</arm> +<pair a="HEAD~2" b="HEAD~1" conflicts="0" risks="0"/> +<landing order=""/> +</merge-scout> +````` + +## `./build/ripwire . --stray-content=lane/` + +*Which refs of the `lane/` ref family still hold divergent authored work vs HEAD, with verdicts.* + +**wall time: 5.86s** + +````` +<!-- ripwire stray-content schema=ripwire.stray-content/v1: per local ref, lines/symbols NOT in HEAD: <ref ok= v= base= stray=>; 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. authored=N: lines this ref authored in the file vs its merge base. del=N: base lines this ref removed (0 = pure addition). redone=N: of del=, the base lines HEAD removed too (the supersession evidence). sim=: minhash containment, 0 to 1, of the ref's blob in HEAD's (pure-addition evidence). head-touched=1: the live line changed this path since the merge base. more files=N: N more file rows of this ref withheld; shown + N = the ref's files=; detail=1 lists all. unknown=N: refs that could not be analysed (v=unknown, e.g. no merge base); never counted merged. file p=: the stray file, repo-relative. --> +<stray-content schema="ripwire.stray-content/v1" head="914c4045d" head_ref="integration/train-ge3" refs="499" blobs="2194" unmerged="61" superseded="29" merged="409" unknown="0" filter="lane/" at="914c4045d"> +<ref name="lane/arise-result" tip="13292db7a" date="2026-09-23" base="60b65f026" ok="1" v="unmerged" stray="16331" files="18" superseded="55"> +<file p="bench/slice/results/arise_line_rank_prereg/narrowpool-results.json" v="unmerged" stray="8629" authored="8629" del="0" redone="0" sim="0.00" head-touched="0"/> +<file p="bench/slice/results/arise_line_rank_prereg/results.json" v="unmerged" stray="3810" authored="3810" del="0" redone="0" sim="0.00" head-touched="0"/> +<file p="bench/slice/results/arise_line_rank_prereg/scorer-results.json" v="unmerged" stray="1213" authored="1213" del="0" redone="0" sim="0.00" head-touched="0"/> +<file p="docs/research/arise-line-ranking-prereg.md" v="unmerged" stray="625" authored="625" del="0" redone="0" sim="0.00" head-touched="0"/> +<file p="bench/slice/score_arise_linerank.py" v="unmerged" stray="537" authored="537" del="0" redone="0" sim="0.00" head-touched="0"/> +<file p="bench/slice/run_slice_linerecall_r3.py" v="unmerged" stray="326" authored="326" del="0" redone="0" sim="0.00" head-touched="0"/> +<file p="test/slicerank_unit.cpp" v="unmerged" stray="258" authored="258" del="0" redone="0" sim="0.00" head-touched="0"/> +<file p="bench/slice/score_arise_narrowpool.py" v="unmerged" stray="199" authored="199" del="0" redone="0" sim="0.00" head-touched="0"/> +<file p="bench/slice/results/arise_line_rank_prereg/instance_ids.txt" v="unmerged" stray="182" authored="182" del="0" redone="0" sim="0.00" head-touched="0"/> +<file p="src/slice.h" v="unmerged" stray="132" authored="172" del="6" redone="0" sim="0.96" head-touched="1"/> +<file p="bench/slice/results/arise_line_rank_prereg/RESULTS.md" v="unmerged" stray="126" authored="126" del="0" redone="0" sim="0.00" head-touched="0"/> +<file p="bench/slice/results/arise_line_rank_prereg/scorer-summary.json" v="unmerged" stray="82" authored="82" del="0" redone="0" sim="0.00" head-touched="0"/> +<more files="6"/> +</ref> +<ref name="lane/margin-rescore" tip="9ffd3628c" date="2026-09-23" base="755f9026f" ok="1" v="unmerged" stray="13921" files="13" superseded="1"> +<file p="bench/locbench/results/margin_rescore/calib.json" v="unmerged" stray="6592" authored="6592" del="0" redone="0" sim="0.00" head-touched="0"/> +<file p="bench/locbench/results/served_syms_prereg/calib.json" v="unmerged" stray="3862" authored="3862" del="0" redone="0" sim="0.00" head-touched="0"/> +<file p="docs/research/confidence-and-abstention.md" v="unmerged" stray="828" authored="828" del="0" redone="0" sim="0.00" head-touched="0"/> +<file p="bench/locbench/calibrate_confidence.py" v="unmerged" stray="745" authored="745" del="0" redone="0" sim="0.00" head-touched="0"/> +<file p="bench/locbench/served_syms_signal.py" v="unmerged" stray="671" authored="671" del="0" redone="0" sim="0.00" head-touched="0"/> +<file p="bench/locbench/test_served_syms_signal.py" v="unmerged" stray="588" authored="588" del="0" redone="0" sim="0.00" head-touched="0"/> +<file p="bench/locbench/results/margin_rescore/calib.md" v="unmerged" stray="214" authored="214" del="0" redone="0" sim="0.00" head-touched="0"/> +<file p="bench/locbench/results/served_syms_prereg/calib.md" v="unmerged" stray="111" authored="111" del="0" redone="0" sim="0.00" head-touched="0"/> +<file p="bench/locbench/results/margin_rescore/instance_ids.txt" v="unmerged" stray="92" authored="92" del="0" redone="0" sim="0.00" head-touched="0"/> +<file p="bench/locbench/results/served_syms_prereg/instance_ids.txt" v="unmerged" stray="92" authored="92" del="0" redone="0" sim="0.00" head-touched="0"/> +<file p="bench/locbench/results/margin_rescore/POPULATION.md" v="unmerged" stray="63" authored="63" del="0" redone="0" sim="0.00" head-touched="0"/> +<file p="bench/locbench/results/served_syms_prereg/POPULATION.md" v="unmerged" stray="62" authored="62" del="0" redone="0" sim="0.00" head-touched="0"/> +… [822 more display lines; full output is 92874 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: 1.42s** + +````` +<!-- ripwire stray-content schema=ripwire.stray-content/v1: per local ref, lines/symbols NOT in HEAD: <ref ok= v= base= stray=>; 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. unknown=N: refs that could not be analysed (v=unknown, e.g. no merge base); never counted merged. --> +<stray-content schema="ripwire.stray-content/v1" head="914c4045d" head_ref="integration/train-ge3" refs="1" blobs="0" unmerged="0" superseded="0" merged="1" unknown="0" filter="fix/" at="914c4045d"> +</stray-content> +````` + +## `./build/ripwire . --stray-content=lane/ --plan` + +*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: 18.19s** + +````` +<!-- ripwire landing-plan schema=ripwire.landing-plan/v1: stranded-work landing order across refs, fewest conflicts first. at=: commit+dirty+shallow. --> +<landing-plan schema="ripwire.landing-plan/v1" head="914c4045d" refs="499" unmerged="61" superseded="29" merged="409" undetermined="0" scouted="1" bounded="60" scout-ok="1" at="914c4045d"> +<ref name="lane/arise-result" v="unmerged" stray="16331" files="18" scouted="1"/> +<ref name="lane/margin-rescore" v="unmerged" stray="13921" files="13" scouted="0"/> +<ref name="lane/recv-xfile" v="unmerged" stray="9251" files="34" scouted="0"/> +<ref name="lane/py-local-bind" v="unmerged" stray="7081" files="8" scouted="0"/> +<ref name="lane/served-syms-result" v="unmerged" stray="6346" files="9" scouted="0"/> +<ref name="lane/orient-narrow-v3" v="unmerged" stray="3273" files="46" scouted="0"/> +<ref name="lane/for-howitworks-067" v="unmerged" stray="3247" files="39" scouted="0"/> +<ref name="lane/m1-lookback-harness" v="unmerged" stray="3164" files="14" scouted="0"/> +<ref name="lane/orient-map-067" v="unmerged" stray="2475" files="40" scouted="0"/> +<ref name="lane/parse-budget-det" v="unmerged" stray="2396" files="64" scouted="0"/> +<ref name="lane/xs-1119-d2-pin" v="unmerged" stray="2298" files="31" scouted="0"/> +<ref name="lane/qual-ns-call-bind" v="unmerged" stray="2288" files="30" scouted="0"/> +<ref name="lane/import-proved-splits" v="unmerged" stray="2280" files="30" scouted="0"/> +<ref name="lane/small-edges-1118" v="unmerged" stray="2168" files="6" scouted="0"/> +<ref name="lane/go-cpp-edges" v="unmerged" stray="2146" files="7" scouted="0"/> +<ref name="lane/served-syms-prereg" v="unmerged" stray="2135" files="5" scouted="0"/> +<ref name="lane/edge-strays-1118" v="unmerged" stray="2090" files="17" scouted="0"/> +<ref name="lane/crossctx-external-prereg" v="unmerged" stray="2055" files="7" scouted="0"/> +<ref name="lane/no-skip-ingest" v="unmerged" stray="1860" files="52" scouted="0"/> +<ref name="lane/for-noise" v="unmerged" stray="1821" files="47" scouted="0"/> +<ref name="lane/std-namesake" v="unmerged" stray="1753" files="9" scouted="0"/> +<ref name="lane/for-tonly" v="unmerged" stray="1728" files="11" scouted="0"/> +<ref name="lane/arise-line-ranking" v="unmerged" stray="1538" files="7" scouted="0"/> +<ref name="lane/for-noise-body-slot" v="unmerged" stray="1524" files="39" scouted="0"/> +<ref name="lane/row-features-2" v="unmerged" stray="1218" files="11" scouted="0"/> +<ref name="lane/research-abstention" v="unmerged" stray="899" files="3" scouted="0"/> +<ref name="lane/agent-trap" v="unmerged" stray="857" files="13" scouted="0"/> +<ref name="lane/row-features" v="unmerged" stray="840" files="10" scouted="0"/> +… [286 more display lines; full output is 31579 bytes on 1 raw line(s)] +````` + +stderr: + +````` +ripwire: warning: --plan scouted 1 of 61 unmerged branches for conflicts and landing order (limit: 12 arms, and 8192 indexed files across the arms); pass --detail=1 to scout every unmerged branch +````` + +## `./build/ripwire . --stray-content=zzzz-no-such-ref --plan` + +*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.77s** + +````` +(empty) +````` + +stderr: + +````` +ripwire: --plan: --stray-content=zzzz-no-such-ref matches no local ref — a zero here would be a failure, not a measurement + (the filter is a substring match against refs/heads names; run bare --stray-content to list them, e.g. --stray-content=feat/) +````` + +## `./build/ripwire . --stray-content=lane/ --abi` + +*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: 40.36s** + +````` +<!-- ripwire abi schema=ripwire.abi/v1: cross-branch ABI-break gate: each local branch's structs on paths it authored (its diff from its merge base with HEAD), laid out lexically, compared with HEAD's; a match is omitted; exit 2 on a drift. head_ref= HEAD's branch, refs= branches read, candidates= structs HEAD declares and locates, compared= sites modelled on both sides, blobs= git blobs read; dropped= listed rows past the 12-per-ref cap; head_only= sites on paths only HEAD changed (out of scope); unmodelable= sites skipped: HEAD's copy has no model; unrelated= refs with no merge base, never compared, also in quiet=; broken_refs= refs with a drift; quiet= refs with no row (none differed or none compared); excluded_refs= refs with unlisted kinds only. window: shown= capped= (capped=1 cut). at=: commit+dirty+shallow. root=: p= relative to it. ref name= tip= date=: a branch with rows, its tip commit and date; shown=/capped=/head_only= and kind counts are its own. struct n= p= l= kind= head_size=: a struct, its file and line at HEAD, sizeof there. kind=drift: the byte contract differs (the kind that exits 2); unknown: the ref's copy could not be modelled, never read as same; absent: the ref does not define it at that path. drift= unknown= absent= count them on abi and ref; each row is on one kind count (absent at 0): their sum is the row total. ref_size= size_delta=: sizeof on the ref and its distance from head_size=, only where the ref's copy was sized; size_delta=0 is the same size, not the same layout. d n= a= b=: a differing field as type@offset at HEAD (a=) and on the ref (b=), or absent. ref_caveat k= d=: why the ref's copy is unmodelled: kind, detail. head_caveat k= d=: a limit of HEAD's own model of the struct: kind, detail. head-moved=N: the ref's copy equals its merge base's, so HEAD changed; counted, listed under detail=1. --> +<abi schema="ripwire.abi/v1" head_ref="integration/train-ge3" refs="499" candidates="3078" compared="12715" blobs="896" shown="68" capped="0" dropped="0" head_only="1113101" unmodelable="4371" unrelated="0" broken_refs="26" quiet="415" excluded_refs="49" at="914c4045d" drift="52" unknown="13" absent … [line truncated: 32 more bytes on this line] +<ref name="lane/for-tonly" tip="07f6c870d" date="2026-10-29" shown="4" capped="0" head_only="2275" drift="4" head-moved="60"> +<struct n="ForLensJsonInputs" p="src/verbs_for.h" l="464" kind="drift" head_size="232" ref_size="216" size_delta="16"> +<d n="graph" a="const rw::Graph*@208" b="absent"/> +<d n="signaturesOnly" a="bool@216" b="absent"/> +<d n="tailTermTieRank" a="const std::vector<float>*@224" b="absent"/> +<d n="testOnlyCallers" a="absent" b="const std::vector<std::uint8_t>*@208"/> +<head_caveat k="reference-member" d="ing: a reference member's storage is unspecified"/> +<ref_caveat k="reference-member" d="ing: a reference member's storage is unspecified"/> +</struct> +<struct n="SigRowSpelling" p="src/serialize.h" l="6489" kind="drift" head_size="2" ref_size="16" size_delta="14"> +<d n="foldRepeatedText" a="bool@1" b="absent"/> +<d n="testOnlyCallers" a="absent" b="const std::vector<std::uint8_t>*@8"/> +</struct> +<struct n="ForLensHeaderParts" p="src/verbs_for.h" l="573" kind="drift" head_size="280" ref_size="272" size_delta="8"> +<d n="tailCodeFirst" a="bool@260" b="absent"/> +<d n="tailWide" a="bool@261" b="absent"/> +<d n="hopsCallsNextPresent" a="bool@262" b="bool@260"/> +<d n="bodyFoldPresent" a="bool@263" b="bool@261"/> +<d n="foldFollowPresent" a="bool@264" b="bool@262"/> +<d n="memberNamesPresent" a="bool@265" b="bool@263"/> +<d n="initSlotsPresent" a="bool@266" b="bool@264"/> +<d n="regPresent" a="bool@267" b="absent"/> +<d n="slotJoinPresent" a="bool@268" b="bool@265"/> +<d n="slotNamePresent" a="bool@269" b="bool@266"/> +<d n="ctorHopPresent" a="bool@270" b="bool@267"/> +<d n="callerHopPresent" a="bool@271" b="bool@268"/> +<d n="callerHopRanked" a="bool@272" b="bool@269"/> +<d n="callerHopSubject" a="bool@273" b="absent"/> +… [734 more display lines; full output is 54263 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 renders two pages under the same 60-row cap, the definitions page (kind="def" rows and the kind="text" lines no parse read, the references counted in <refs count= next=>) and the whole list, and serves the definitions page when it shows more definitions, whatever its bytes, else only when it is strictly shorter. Here the branches' copies sit in blobs past the parse guard (<unparsed>, kind="text", never counted as definitions), so both pages show HEAD's one definition and the default serves the shorter whole list: that definition, then HEAD's references.* + +**wall time: 18.15s** + +````` +<!-- ripwire whereis schema=ripwire.whereis/v1: every LOCAL ref whose tree holds sym= (refs_scanned=, blobs=), HEAD first: <hit ref= tip= date= p= l= kind= t=>. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). at=: commit+dirty+shallow. next=: the one pasteable follow-up. refs_omitted=K: past the ref window (512 refs; whereis: 2097152 tree entries) the newest refs by committer date were read; K older local branches were not, in no count or row (a ref-name SUBSTR filter picks which; detail=1 reads all). hits=N: occurrences in HEAD plus every scanned local ref's full tree (the total rows). on-head=1|0: whether HEAD's tree holds it; 0 beside hits = it lives only on a branch. head_labels=index: HEAD kind= from the parsed index; lexical: text heuristic. ref_labels=parsed: another ref's kind= from the index's own tags parse of its blob (one per blob and path; HEAD's own blob takes HEAD's labels); a blob with no line a loose lexical test calls worth parsing is not parsed and its rows read ref; kind=text: such a line no parse read, never a def. unparsed blobs=N: other refs' blobs holding a line worth parsing that no parse read (past the runaway guard, or the parser could not finish); those lines read kind=text; next= lifts the guard. unparsed rows=N: the kind=text rows those blobs gave. hit refs=N: N scanned refs hold this same definition (or kind=text) line (path + text); printed once for the first by name, whose ref= tip= date= l= it carries; defs page only, absent = one ref; hits= counts every copy, listing=all prints each. folded=N: def (or text) rows of other refs a listed row's refs= stands for; shown + more + folded + refs count = hits on the first page. more hits=N: rows after this page; page on with offset=next_offset. listing=defs|refs: only those kind= rows listed (defs: def and text); under defs <refs count=N next=> counts the kind=ref rows and next= lists them; the window counts listed rows; default: defs if it lists more defs than all, else if shorter; a def the parser does not model (define_method, setattr, assignment) is a counted ref. head_date=: a hit without tip= date= has tip= at=, date= this. --> +<whereis schema="ripwire.whereis/v1" sym="rankGraphTeleport" on-head="1" refs_scanned="373" blobs="10151" hits="2701870" head_labels="index" refs_omitted="282" shown="60" capped="1" total="146" has_more="1" next_offset="60" offset="0" limit="0" listing="defs" folded="1786" ref_labels="parsed" head_d … [line truncated: 32 more bytes on this line] +<unparsed blobs="404" rows="1923" next="--whereis=rankGraphTeleport --detail=1"/> +<hit ref="HEAD" p="src/graph.h" l="14921" kind="def" t="inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>& p, float alpha = 0.85f )"/> +<hit ref="community/pr433" tip="fafb3f267" date="2026-10-29" p="src/graph.h" l="11991" kind="text" refs="365" t="inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>& p, float alpha = 0.85f )"/> +<hit ref="community/pr433" tip="fafb3f267" date="2026-10-29" p="docs/EVALS.md" l="14331" kind="text" refs="315" t="- **(i) Static.** A's diff leaves `priorwt::weight`, graph.h:4378, `biasPrior`, `rankGraphTeleport`, `rankGraph` and `diffTeleport` byte-unchanged. `rankDefaultMap`'s call sit … [line truncated: 26 more bytes on this line] +<hit ref="community/pr433" tip="fafb3f267" date="2026-10-29" p="docs/EVALS.md" l="14449" kind="text" refs="315" t="- Gate S (i): `priorwt::weight`, the `priorWeight` assignment, `biasPrior`, `rankGraphTeleport`, `rankGraph`, `diffTeleport`"/> +<hit ref="fix/hub-fold-fix1" tip="347613a6e" date="2026-10-26" p="src/main.cpp" l="1478" kind="text" refs="181" t="rw::RankedGraph ranked = isDecay ? rankGraphTeleport( d.g, churnDecayTeleportWorkspace( rootDirs, d.ing, &hasChurnEvidence ) )"/> +<hit ref="fix/hub-fold-fix1" tip="347613a6e" date="2026-10-26" p="test/showcase_capture.py" l="174" kind="text" refs="22" t="#0 0x102f4a1c8 in rw::rankGraphTeleport(Graph const&, std::vector<float> const&, float) src/graph.h:{TELEPORT_LN}"/> +<hit ref="integration/train-1106a" tip="0e7be4adc" date="2026-11-06" p="test/grepbytescheck.sh" l="129" kind="text" refs="5" t="# rankGraphTeleport (24 hits: one function and its doc mentions)."/> +<hit ref="integration/train-1106a" tip="0e7be4adc" date="2026-11-06" p="docs/COMMANDS.md" l="1626" kind="text" refs="149" t="<![CDATA[inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>& p, float alpha = 0.85f )"/> +<hit ref="integration/train-1106a" tip="0e7be4adc" date="2026-11-06" p="docs/COMMANDS.md" l="1657" kind="text" refs="149" t="<![CDATA[inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>& p, float alpha = 0.85f )"/> +<hit ref="integration/train-1111i" tip="dbb6e80a8" date="2026-11-15" p="docs/captures/COMMANDS_showcase_2026-11-13.md" l="151" kind="text" refs="13" t="<![CDATA[inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>& p, float alpha = 0.85f )"/> +<hit ref="integration/train-1111i" tip="dbb6e80a8" date="2026-11-15" p="docs/captures/COMMANDS_showcase_2026-11-13.md" l="311" kind="text" refs="13" t="<![CDATA[inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>& p, float alpha = 0.85f )"/> +<hit ref="integration/train-1111i" tip="dbb6e80a8" date="2026-11-15" p="docs/captures/COMMANDS_showcase_2026-11-13.md" l="1663" kind="text" refs="13" t="<![CDATA[inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>& p, float alpha = 0.85f )"/> +<hit ref="integration/train-1111i" tip="dbb6e80a8" date="2026-11-15" p="docs/captures/COMMANDS_showcase_2026-11-13.md" l="1694" kind="text" refs="13" t="<![CDATA[inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>& p, float alpha = 0.85f )"/> +<hit ref="integration/train-1111i" tip="dbb6e80a8" date="2026-11-15" p="docs/captures/COMMANDS_showcase_2026-11-13.md" l="1731" kind="text" refs="13" t="<![CDATA[inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>& p, float alpha = 0.85f )"/> +<hit ref="integration/train-1111i" tip="dbb6e80a8" date="2026-11-15" p="docs/captures/COMMANDS_showcase_2026-11-13.md" l="1774" kind="text" refs="13" t="<![CDATA[inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>& p, float alpha = 0.85f )"/> +<hit ref="integration/train-1111i" tip="dbb6e80a8" date="2026-11-15" p="docs/captures/COMMANDS_showcase_2026-11-13.md" l="3571" kind="text" refs="13" t="<![CDATA[inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>& p, float alpha = 0.85f )"/> +<hit ref="integration/train-1117d1-r" tip="56e055752" date="2026-11-19" p="docs/captures/COMMANDS_showcase_2026-11-18.md" l="146" kind="text" refs="9" t="<![CDATA[inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>& p, float alpha = 0.85f )"/> +<hit ref="integration/train-1117d1-r" tip="56e055752" date="2026-11-19" p="docs/captures/COMMANDS_showcase_2026-11-18.md" l="306" kind="text" refs="9" t="<![CDATA[inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>& p, float alpha = 0.85f )"/> +<hit ref="integration/train-1117d1-r" tip="56e055752" date="2026-11-19" p="docs/captures/COMMANDS_showcase_2026-11-18.md" l="1599" kind="text" refs="9" t="<![CDATA[inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>& p, float alpha = 0.85f )"/> +<hit ref="integration/train-1117d1-r" tip="56e055752" date="2026-11-19" p="docs/captures/COMMANDS_showcase_2026-11-18.md" l="1628" kind="text" refs="9" t="<![CDATA[inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>& p, float alpha = 0.85f )"/> +<hit ref="integration/train-1117d1-r" tip="56e055752" date="2026-11-19" p="docs/captures/COMMANDS_showcase_2026-11-18.md" l="1665" kind="text" refs="9" t="<![CDATA[inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>& p, float alpha = 0.85f )"/> +<hit ref="integration/train-1117d1-r" tip="56e055752" date="2026-11-19" p="docs/captures/COMMANDS_showcase_2026-11-18.md" l="1708" kind="text" refs="9" t="<![CDATA[inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>& p, float alpha = 0.85f )"/> +<hit ref="integration/train-1117d1-r" tip="56e055752" date="2026-11-19" p="docs/captures/COMMANDS_showcase_2026-11-18.md" l="3527" kind="text" refs="9" t="<![CDATA[inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>& p, float alpha = 0.85f )"/> +<hit ref="integration/train-1118a" tip="77ce05d87" date="2026-11-21" p="docs/captures/COMMANDS_showcase_2026-11-20.md" l="149" kind="text" t="<![CDATA[inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>& p, float alpha = 0.85f )"/> +<hit ref="integration/train-1118a" tip="77ce05d87" date="2026-11-21" p="docs/captures/COMMANDS_showcase_2026-11-20.md" l="307" kind="text" t="<![CDATA[inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>& p, float alpha = 0.85f )"/> +<hit ref="integration/train-1118a" tip="77ce05d87" date="2026-11-21" p="docs/captures/COMMANDS_showcase_2026-11-20.md" l="1599" kind="text" t="<![CDATA[inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>& p, float alpha = 0.85f )"/> +<hit ref="integration/train-1118a" tip="77ce05d87" date="2026-11-21" p="docs/captures/COMMANDS_showcase_2026-11-20.md" l="1628" kind="text" t="<![CDATA[inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>& p, float alpha = 0.85f )"/> +… [36 more display lines; full output is 19963 bytes on 1 raw line(s)] +````` + +stderr: + +````` +ripwire: warning: --whereis read the newest 373 of 655 local branches; 282 older were not read (limit: 2097152 tree entries across all refs, 374 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 404 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 before any branch row arrives, so it can show fewer definitions than the definitions page. The default serves this page only when both show the same definitions and the definitions page is not strictly shorter (a tie serves this page), as above: here it is the default's own page, HEAD's one definition and then its references.* + +**wall time: 18.17s** + +````` +<!-- ripwire whereis schema=ripwire.whereis/v1: every LOCAL ref whose tree holds sym= (refs_scanned=, blobs=), HEAD first: <hit ref= tip= date= p= l= kind= t=>. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). at=: commit+dirty+shallow. next=: the one pasteable follow-up. refs_omitted=K: past the ref window (512 refs; whereis: 2097152 tree entries) the newest refs by committer date were read; K older local branches were not, in no count or row (a ref-name SUBSTR filter picks which; detail=1 reads all). hits=N: occurrences in HEAD plus every scanned local ref's full tree (the total rows). on-head=1|0: whether HEAD's tree holds it; 0 beside hits = it lives only on a branch. head_labels=index: HEAD kind= from the parsed index; lexical: text heuristic. ref_labels=parsed: another ref's kind= from the index's own tags parse of its blob (one per blob and path; HEAD's own blob takes HEAD's labels); a blob with no line a loose lexical test calls worth parsing is not parsed and its rows read ref; kind=text: such a line no parse read, never a def. unparsed blobs=N: other refs' blobs holding a line worth parsing that no parse read (past the runaway guard, or the parser could not finish); those lines read kind=text; next= lifts the guard. unparsed rows=N: the kind=text rows those blobs gave. hit t_bytes=N: t= previews an N-byte line (over 300 B): 200 B at most, its first bytes cut on a UTF-8 boundary plus an ellipsis. t_cut rows=N: rows of this page whose t= is a preview (each carries t_bytes=); next= replays this page (same listing, window, rows) with every line whole. more hits=N: rows after this page; page on with offset=next_offset. head_date=: a hit without tip= date= has tip= at=, date= this. --> +<whereis schema="ripwire.whereis/v1" sym="rankGraphTeleport" on-head="1" refs_scanned="373" blobs="10151" hits="2701870" head_labels="index" refs_omitted="282" shown="60" capped="1" total="2701870" has_more="1" next_offset="60" offset="0" limit="0" ref_labels="parsed" head_date="2026-11-22" at="914c … [line truncated: 7 more bytes on this line] +<unparsed blobs="404" rows="1923" next="--whereis=rankGraphTeleport --whereis-listing=all --detail=1"/> +<t_cut rows="4" next="--whereis=rankGraphTeleport --whereis-listing=all --whereis-full-text"/> +<hit ref="HEAD" p="src/graph.h" l="14921" kind="def" t="inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>& p, float alpha = 0.85f )"/> +<hit ref="HEAD" p="present/deck5_ripwire_build.js" l="1269" kind="ref" t="s.addText("$ ripwire . --callers=rankGraphTeleport", { x: 8.68, y: 2.1, w: 3.8, h: 0.3, fontFace: MONO, fontSize: 10, color: MUTED, margin: 0 });"/> +<hit ref="HEAD" p="present/deck5_ripwire_build.js" l="1271" kind="ref" t="{ text: "<callers of=\"rankGraphTeleport\"\n defs=\"1\" count=\"7\" ", options: { color: TEXT } },"/> +<hit ref="HEAD" p="present/deck5_ripwire_build.js" l="1285" kind="ref" t_bytes="478" t=""- The --callers example: `ripwire . --callers=rankGraphTeleport` answered defs=\"1\" count=\"6\" counts_floor=\"1\", with runEval and rankGraph as its first two rows, on main 4 … [line truncated: 26 more bytes on this line] +<hit ref="HEAD" p="src/cli.h" l="121" kind="ref" t="// tokens on --around=rankGraphTeleport vs 5,860 B at depth 1; the root's"/> +<hit ref="HEAD" p="src/crossref.h" l="4240" kind="ref" t="// code above the real definition: `--whereis=rankGraphTeleport` opened with three kind="def" rows into"/> +<hit ref="HEAD" p="src/didyoumean.h" l="238" kind="ref" t="// `--path=rankGraphTeleport,` printed "endpoint not found: (did you mean 'A'?)". Guarded at the shared walk"/> +<hit ref="HEAD" p="src/eval.h" l="328" kind="ref" t="const std::vector<float> r = rankGraphTeleport( g, diffTeleport( ing, seedMask ) ).rank;"/> +<hit ref="HEAD" p="src/graph.h" l="285" kind="ref" t="// renormalized to Σ=1 in rankGraphTeleport — so every teleport-based"/> +<hit ref="HEAD" p="src/graph.h" l="14852" kind="ref" t="// prior (never the edges) and renormalized in rankGraphTeleport. Every symbol whose name is missing from"/> +<hit ref="HEAD" p="src/graph.h" l="14909" kind="ref" t="// discard out. That is what this used to be: rankGraphTeleport called pageRankDouble, threw away its return,"/> +<hit ref="HEAD" p="src/graph.h" l="14954" kind="ref" t="// `rank = takeRank( rankGraphTeleport( … ), d )` is the only spelling, and it fills both or neither."/> +<hit ref="HEAD" p="src/graph.h" l="14968" kind="ref" t="return rankGraphTeleport( g, std::vector<float>( N, ranked ? 1.0f / float( ranked ) : 0.f ), alpha );"/> +<hit ref="HEAD" p="src/graph.h" l="15614" kind="ref" t="// the anchor-count is not a cliff), run the EXISTING PPR machinery (rankGraphTeleport — the same"/> +<hit ref="HEAD" p="src/graph.h" l="15684" kind="ref" t="const std::vector<float> ppr = rankGraphTeleport( g, p ).rank;"/> +<hit ref="HEAD" p="src/main.cpp" l="1447" kind="ref" t="rw::RankedGraph ranked = stubbed ? rw::RankedGraph{} : rankGraphTeleport( d.g, churnPriorFromDecayed( d.ing, mined.weights, mined.anyHistory ) );"/> +<hit ref="HEAD" p="src/main.cpp" l="1486" kind="ref" t="rw::RankedGraph ranked = isDecay ? rankGraphTeleport( d.g, churnDecayTeleportWorkspace( rootDirs, d.ing, &hasChurnEvidence ) )"/> +<hit ref="HEAD" p="src/main.cpp" l="1487" kind="ref" t=": rankGraphTeleport( d.g, churnTeleportWorkspace( rootDirs, d.ing, "18 months ago", &hasChurnEvidence ) );"/> +<hit ref="HEAD" p="src/main.cpp" l="1501" kind="ref" t="rw::RankedGraph ranked = rankGraphTeleport( d.g, churnTeleport( d.root, d.ing, "18 months ago", d.cfg.since.empty() ? nullptr : &sinceScope, &hasChurnEvidence ) );"/> +<hit ref="HEAD" p="src/main.cpp" l="1879" kind="ref" t="rank = rw::takeRank( rankGraphTeleport( g, diffTeleport( ing, changed ) ), rankDisclosure );"/> +<hit ref="HEAD" p="src/mcp.h" l="2837" kind="ref" t="// queries:["callers:rankGraphTeleport", {"verb":"slice","symbol":"…"}]"/> +<hit ref="HEAD" p="src/mcpindex.h" l="1304" kind="ref" t="// symbols, the rest uniform, then rankGraphTeleport (which also applies the name-quality biasPrior"/> +<hit ref="HEAD" p="src/mcpindex.h" l="1340" kind="ref" t="const auto [ wsRank, wsIters, wsConverged ] = rankGraphTeleport( ix.g, diffTeleport( ix.ing, changed ) );"/> +<hit ref="HEAD" p="src/mcpverbs.h" l="6238" kind="ref" t="// the colon is a SEPARATOR, and `callers: rankGraphTeleport` is how a human writes one. Untrimmed, the"/> +<hit ref="HEAD" p="src/mcpverbs.h" l="6240" kind="ref" t="// symbol not found: ' rankGraphTeleport' (did you mean 'rankGraphTeleport'?)"/> +<hit ref="HEAD" p="src/selectorrefuse.h" l="7" kind="ref" t="// ("that file defines no 'rankGraphTeleport'"), names the files that DO define the name, and hands back a"/> +… [36 more display lines; full output is 13481 bytes on 1 raw line(s)] +````` + +stderr: + +````` +ripwire: warning: --whereis read the newest 373 of 655 local branches; 282 older were not read (limit: 2097152 tree entries across all refs, 374 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 404 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 thirteen 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: 16.21s** + +````` +<!-- ripwire quality-delta schema=ripwire.quality-delta/v1: only what the change made WORSE vs baseline=: regressions= minor= gating=; <r kind= sym= p= was= now= gating= bar=>, <sa> acked. value-ref-excluded=N: internal functions kept off because a table, field or argument in another function or at file scope holds them (matched by name, not a proven call); a floor. stale=N: ack ledger rows whose target no longer applies (sa rows); never gating. stale_by_kind=: stale= split by ack kind (kind:N,...); the sa rows are collapsed. stale_next=: the call printing the sa rows and the full header. preexisting-worse=N: regressions on symbols that existed at baseline; they gate when major. new-symbol=N: NEW code; new-symbol rows never gate, except defect-shape format-arity, ceiling=, tangle. register-macro-excluded=N: symbols skipped: self-registering test/bench macros or Rust #[test]; a floor. declined-call-excluded=N: symbols kept out of dead-code only because a declined call may mean them; a floor. api-new-surface=N: new PUBLIC symbols; a count, never gates, not in regressions=. renames=/rename_window_commits=: git rename pairs read over that many commits, to re-file baseline and acks. acked_by_rename=/acked_by_content=: acked= suppressions matched via git renames / an equal body hash. kinds_skipped=: kinds NOT run, so none of their rows is here and every count covers the rest; a count only they feed is absent. skipped_why=selector (the caller chose; stale acks judged for those kinds only) | memory (see ingest_scope=) | selector,memory (both). acked=N: findings suppressed by the ack ledger, listed as sa rows; never gating. base_ref=/target_ref=: the two resolved full shas a range compared (committed trees; at= omitted). churn=unavailable: range form; short-horizon-churn cannot be measured, so its silence is not no churn. --> +<quality-delta schema="ripwire.quality-delta/v1" baseline="ref-pair" regressions="0" minor="0" acked="0" stale="26" preexisting-worse="0" new-symbol="0" gating="0" register-macro-excluded="63" api-new-surface="0" base_ref="b6ae53e9f828e641b9be583700a1a6501e18ca4f" target_ref="914c4045d08e71e6e6ad23e … [line truncated: 449 more bytes on this line] +</quality-delta> +````` + +## `./build/ripwire . --whereis=rankGraphTeleport --whereis-listing=all --whereis-full-text` + +*The same page with every t= line whole: the page above previews each line over 300 B (200 B and t_bytes=, the <t_cut rows= next=> naming this call), and --whereis-full-text replays it with the same listing, window, rows and labels. MCP: full_text=true.* + +**wall time: 16.58s** + +````` +<!-- ripwire whereis schema=ripwire.whereis/v1: every LOCAL ref whose tree holds sym= (refs_scanned=, blobs=), HEAD first: <hit ref= tip= date= p= l= kind= t=>. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). at=: commit+dirty+shallow. next=: the one pasteable follow-up. refs_omitted=K: past the ref window (512 refs; whereis: 2097152 tree entries) the newest refs by committer date were read; K older local branches were not, in no count or row (a ref-name SUBSTR filter picks which; detail=1 reads all). hits=N: occurrences in HEAD plus every scanned local ref's full tree (the total rows). on-head=1|0: whether HEAD's tree holds it; 0 beside hits = it lives only on a branch. head_labels=index: HEAD kind= from the parsed index; lexical: text heuristic. ref_labels=parsed: another ref's kind= from the index's own tags parse of its blob (one per blob and path; HEAD's own blob takes HEAD's labels); a blob with no line a loose lexical test calls worth parsing is not parsed and its rows read ref; kind=text: such a line no parse read, never a def. unparsed blobs=N: other refs' blobs holding a line worth parsing that no parse read (past the runaway guard, or the parser could not finish); those lines read kind=text; next= lifts the guard. unparsed rows=N: the kind=text rows those blobs gave. more hits=N: rows after this page; page on with offset=next_offset. head_date=: a hit without tip= date= has tip= at=, date= this. --> +<whereis schema="ripwire.whereis/v1" sym="rankGraphTeleport" on-head="1" refs_scanned="373" blobs="10151" hits="2701870" head_labels="index" refs_omitted="282" shown="60" capped="1" total="2701870" has_more="1" next_offset="60" offset="0" limit="0" ref_labels="parsed" head_date="2026-11-22" at="914c … [line truncated: 7 more bytes on this line] +<unparsed blobs="404" rows="1923" next="--whereis=rankGraphTeleport --whereis-listing=all --detail=1"/> +<hit ref="HEAD" p="src/graph.h" l="14921" kind="def" t="inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>& p, float alpha = 0.85f )"/> +<hit ref="HEAD" p="present/deck5_ripwire_build.js" l="1269" kind="ref" t="s.addText("$ ripwire . --callers=rankGraphTeleport", { x: 8.68, y: 2.1, w: 3.8, h: 0.3, fontFace: MONO, fontSize: 10, color: MUTED, margin: 0 });"/> +<hit ref="HEAD" p="present/deck5_ripwire_build.js" l="1271" kind="ref" t="{ text: "<callers of=\"rankGraphTeleport\"\n defs=\"1\" count=\"7\" ", options: { color: TEXT } },"/> +<hit ref="HEAD" p="present/deck5_ripwire_build.js" l="1285" kind="ref" t=""- The --callers example: `ripwire . --callers=rankGraphTeleport` answered defs=\"1\" count=\"6\" counts_floor=\"1\", with runEval and rankGraph as its first two rows, on main 40a1895b. On ma … [line truncated: 355 more bytes on this line] +<hit ref="HEAD" p="src/cli.h" l="121" kind="ref" t="// tokens on --around=rankGraphTeleport vs 5,860 B at depth 1; the root's"/> +<hit ref="HEAD" p="src/crossref.h" l="4240" kind="ref" t="// code above the real definition: `--whereis=rankGraphTeleport` opened with three kind="def" rows into"/> +<hit ref="HEAD" p="src/didyoumean.h" l="238" kind="ref" t="// `--path=rankGraphTeleport,` printed "endpoint not found: (did you mean 'A'?)". Guarded at the shared walk"/> +<hit ref="HEAD" p="src/eval.h" l="328" kind="ref" t="const std::vector<float> r = rankGraphTeleport( g, diffTeleport( ing, seedMask ) ).rank;"/> +<hit ref="HEAD" p="src/graph.h" l="285" kind="ref" t="// renormalized to Σ=1 in rankGraphTeleport — so every teleport-based"/> +<hit ref="HEAD" p="src/graph.h" l="14852" kind="ref" t="// prior (never the edges) and renormalized in rankGraphTeleport. Every symbol whose name is missing from"/> +<hit ref="HEAD" p="src/graph.h" l="14909" kind="ref" t="// discard out. That is what this used to be: rankGraphTeleport called pageRankDouble, threw away its return,"/> +<hit ref="HEAD" p="src/graph.h" l="14954" kind="ref" t="// `rank = takeRank( rankGraphTeleport( … ), d )` is the only spelling, and it fills both or neither."/> +<hit ref="HEAD" p="src/graph.h" l="14968" kind="ref" t="return rankGraphTeleport( g, std::vector<float>( N, ranked ? 1.0f / float( ranked ) : 0.f ), alpha );"/> +<hit ref="HEAD" p="src/graph.h" l="15614" kind="ref" t="// the anchor-count is not a cliff), run the EXISTING PPR machinery (rankGraphTeleport — the same"/> +<hit ref="HEAD" p="src/graph.h" l="15684" kind="ref" t="const std::vector<float> ppr = rankGraphTeleport( g, p ).rank;"/> +<hit ref="HEAD" p="src/main.cpp" l="1447" kind="ref" t="rw::RankedGraph ranked = stubbed ? rw::RankedGraph{} : rankGraphTeleport( d.g, churnPriorFromDecayed( d.ing, mined.weights, mined.anyHistory ) );"/> +<hit ref="HEAD" p="src/main.cpp" l="1486" kind="ref" t="rw::RankedGraph ranked = isDecay ? rankGraphTeleport( d.g, churnDecayTeleportWorkspace( rootDirs, d.ing, &hasChurnEvidence ) )"/> +<hit ref="HEAD" p="src/main.cpp" l="1487" kind="ref" t=": rankGraphTeleport( d.g, churnTeleportWorkspace( rootDirs, d.ing, "18 months ago", &hasChurnEvidence ) );"/> +<hit ref="HEAD" p="src/main.cpp" l="1501" kind="ref" t="rw::RankedGraph ranked = rankGraphTeleport( d.g, churnTeleport( d.root, d.ing, "18 months ago", d.cfg.since.empty() ? nullptr : &sinceScope, &hasChurnEvidence ) );"/> +<hit ref="HEAD" p="src/main.cpp" l="1879" kind="ref" t="rank = rw::takeRank( rankGraphTeleport( g, diffTeleport( ing, changed ) ), rankDisclosure );"/> +<hit ref="HEAD" p="src/mcp.h" l="2837" kind="ref" t="// queries:["callers:rankGraphTeleport", {"verb":"slice","symbol":"…"}]"/> +<hit ref="HEAD" p="src/mcpindex.h" l="1304" kind="ref" t="// symbols, the rest uniform, then rankGraphTeleport (which also applies the name-quality biasPrior"/> +<hit ref="HEAD" p="src/mcpindex.h" l="1340" kind="ref" t="const auto [ wsRank, wsIters, wsConverged ] = rankGraphTeleport( ix.g, diffTeleport( ix.ing, changed ) );"/> +<hit ref="HEAD" p="src/mcpverbs.h" l="6238" kind="ref" t="// the colon is a SEPARATOR, and `callers: rankGraphTeleport` is how a human writes one. Untrimmed, the"/> +<hit ref="HEAD" p="src/mcpverbs.h" l="6240" kind="ref" t="// symbol not found: ' rankGraphTeleport' (did you mean 'rankGraphTeleport'?)"/> +<hit ref="HEAD" p="src/selectorrefuse.h" l="7" kind="ref" t="// ("that file defines no 'rankGraphTeleport'"), names the files that DO define the name, and hands back a"/> +<hit ref="HEAD" p="bench/capsweep/capsweep.py" l="173" kind="ref" t="# all and passes through untouched — `. --pattern=\'rankGraphTeleport($A, $B, $C)\'` is a tree-sitter pattern"/> +… [35 more display lines; full output is 13988 bytes on 1 raw line(s)] +````` + +stderr: + +````` +ripwire: warning: --whereis read the newest 373 of 655 local branches; 282 older were not read (limit: 2097152 tree entries across all refs, 374 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 404 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 <fate> row (never / removed-by-commit) for names no tree carries.* + +**wall time: 18.14s** + +````` +<!-- ripwire whereis schema=ripwire.whereis/v1: every LOCAL ref whose tree holds sym= (refs_scanned=, blobs=), HEAD first: <hit ref= tip= date= p= l= kind= t=>. window: shown= capped= (capped=1 cut). at=: commit+dirty+shallow. next=: the one pasteable follow-up. refs_omitted=K: past the ref window (512 refs; whereis: 2097152 tree entries) the newest refs by committer date were read; K older local branches were not, in no count or row (a ref-name SUBSTR filter picks which; detail=1 reads all). hits=N: occurrences in HEAD plus every scanned local ref's full tree (the total rows). on-head=1|0: whether HEAD's tree holds it; 0 beside hits = it lives only on a branch. head_labels=index: HEAD kind= from the parsed index; lexical: text heuristic. ref_labels=parsed: another ref's kind= from the index's own tags parse of its blob (one per blob and path; HEAD's own blob takes HEAD's labels); a blob with no line a loose lexical test calls worth parsing is not parsed and its rows read ref; kind=text: such a line no parse read, never a def. hit refs=N: N scanned refs hold this same definition (or kind=text) line (path + text); printed once for the first by name, whose ref= tip= date= l= it carries; defs page only, absent = one ref; hits= counts every copy, listing=all prints each. folded=N: def (or text) rows of other refs a listed row's refs= stands for; shown + more + folded + refs count = hits on the first page. listing=defs|refs: only those kind= rows listed (defs: def and text); under defs <refs count=N next=> counts the kind=ref rows and next= lists them; the window counts listed rows; default: defs if it lists more defs than all, else if shorter; a def the parser does not model (define_method, setattr, assignment) is a counted ref. head_date=: a hit without tip= date= has tip= at=, date= this. --> +<whereis schema="ripwire.whereis/v1" sym="computeOnePairOverlap" on-head="1" refs_scanned="373" blobs="10151" hits="163932" head_labels="index" refs_omitted="282" shown="2" capped="0" listing="defs" folded="372" ref_labels="parsed" head_date="2026-11-22" at="914c4045d"> +<history probed="1" head="914c4045d" commits="7404" removed-names="59523"/> +<hit ref="HEAD" p="src/mergescout.h" l="696" kind="def" t="inline PairOverlap computeOnePairOverlap( std::size_t a, std::size_t b, const Arm& armA, const Arm& armB )"/> +<hit ref="community/pr433" tip="fafb3f267" date="2026-10-29" p="src/mergescout.h" l="696" kind="def" refs="373" t="inline PairOverlap computeOnePairOverlap( std::size_t a, std::size_t b, const Arm& armA, const Arm& armB )"/> +<refs count="163558" next="--whereis=computeOnePairOverlap --whereis-listing=refs"/> +</whereis> +````` + +stderr: + +````` +ripwire: warning: --whereis read the newest 373 of 655 local branches; 282 older were not read (limit: 2097152 tree entries across all refs, 374 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: 1.05s** + +````` +<!-- ripwire flags schema=ripwire.flags/v1: BUILT but DARK: <gate name= kind=compile|cmake|env default= dark= regions=/loc=(#if only) reads= p= l=> with <read p= l=> sites. writes_capped=/reads_capped=: 1 = cut. next=: the one pasteable follow-up. gates=/dark_gates=: gate rows (never cut) / those whose default keeps the guarded code out of the build. compile=/cmake=/env=: gates by kind: ifndef/define header gate, CMake option(), getenv read. files=N: files this verb scanned for gates (source + CMakeLists), wider than the map's corpus. --> +<!-- BASH: a parameter expansion in a .sh/.bash/.zsh file is an env read (kind="env") unless the same file assigned that name before it (lexical order in one file: no flow, no source following). An assignment takes effect where its command ends, so X="${X:-d}" or a quoted value spanning lines still reads the caller's X. Each Bash read row carries form= (required for :? and ?, default for :-, unset-default for -, settest for + and :+ and a -n/-z operand of [, [[ or test, assign for := and =, plain for $X and ${X}); colon="1" when the colon spelling makes an EMPTY value count as unset (colon="0" when not, absent when the expansion has no operator); default= the literal default word, possibly empty; test="n" or "z" when the read is the operand of that test. writes= on a gate counts, and write rows list, every Bash assignment of the name anywhere in the repo (X=, export X=, local, declare, readonly, read, for, mapfile, getopts, printf -v, := expansions, and the REPLY, OPTARG or MAPFILE that read, select, getopts and mapfile set themselves; not a prefix X=v cmd, which reaches only that command). A local, or a declare inside a function, hides reads only to the end of that function; a write inside $( ) or ( ) only to that subshell's end; an element write X[i]= hides only subscripted ${X[i]} reads, never the scalar $X. Write rows are paged like the reads (shown_writes= writes_capped= and more writes= as for reads). ambient="1": a name Bash or the login always sets (BASH_*, PWD, HOME, PATH, RANDOM and the like), never unsupplied. generated_skipped=N on the root: shell files this verb read but did not harvest because a GENERATED and DO NOT EDIT banner opens them. nesting_cut=N on the root: shell files where an expansion nested more than 32 deep inside another's word (${A:-${B:-…}}) was not read past that depth, so a read there may be missing. --> +<!-- ROWS AND WHAT IS NEVER CUT: the gate rows ARE the answer this verb was asked for and are never windowed, capped or paged, and gates/dark_gates/compile/cmake/env/files on the root plus regions/loc/reads/dark on every gate are counted over the FULL set before any cap exists. What pages is the read SITES under one gate, at 8 a gate by default: a gate whose sites were cut says shown_reads= (the rows this run printed) with reads_capped="1", against the reads= total already on the same element, and the more reads= child keeps naming the remainder. The pair is emitted ONLY on a gate that was cut, never as a capped="0" on the gates that fit. limit=N raises the per gate cap (offset=M skips that many sites in every gate), detail lifts it entirely, and next= on the root is the exact pasteable invocation that shows every site this run dropped. --> +<flags schema="ripwire.flags/v1" gates="494" dark_gates="485" compile="13" cmake="13" env="468" files="4861" generated_skipped="1" next="--flags --limit=882"> +<gate name="FIXTURE_DARK_FEATURE" kind="compile" default="0" dark="1" regions="2" loc="13" reads="2" p="test/flagsfix/wiringFlags.h" l="10"> +<read p="test/flagsfix/feature.cpp" l="10"/> +<read p="test/flagsfix/sub/nested.cpp" l="5"/> +</gate> +<gate name="PROFILE_PMC_VERBOSE" kind="compile" default="0" dark="1" regions="2" loc="11" reads="2" p="src/infra/profilePmc.h" l="78"> +<read p="src/infra/profilePmc.h" l="81"/> +<read p="src/infra/profilePmc.h" l="480"/> +</gate> +<gate name="ALIASFIX_ALL" kind="compile" default="0" dark="1" regions="0" loc="0" reads="2" p="test/flagsaliasfix/aliases.h" l="7"> +<aliases n="2" regions="2" loc="8"/> +<read p="test/flagsaliasfix/aliases.h" l="11"/> +<read p="test/flagsaliasfix/aliases.h" l="15"/> +</gate> +<gate name="ALIASFIX_TURNS" kind="compile" default="0" dark="1" regions="1" loc="4" reads="1" p="test/flagsaliasfix/aliases.h" l="15"> +<alias-of name="ALIASFIX_ALL"/> +<read p="test/flagsaliasfix/use.cpp" l="10"/> +</gate> +<gate name="ALIASFIX_WALLS" kind="compile" default="0" dark="1" regions="1" loc="4" reads="1" p="test/flagsaliasfix/aliases.h" l="11"> +<alias-of name="ALIASFIX_ALL"/> +<read p="test/flagsaliasfix/use.cpp" l="3"/> +</gate> +<gate name="PROFILE_BARRIER" kind="compile" default="0" dark="1" regions="1" loc="3" reads="1" p="src/infra/profileScope.h" l="60"> +<read p="src/infra/profileScope.h" l="122"/> +</gate> +<gate name="FIXTURE_CMAKE_DARK" kind="cmake" default="unset" dark="1" regions="1" loc="1" reads="3" p="test/flagsfix/CMakeLists.txt" l="4"> +<alias-of name="OFF"/> +… [2404 more display lines; full output is 151283 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.* + +````` +<!-- ripwire flip schema=ripwire.flip/v1: the blast radius of flipping one build gate: the regions and symbols it toggles. root=: p= relative to it. --> +<flip schema="ripwire.flip/v1" gate="RIPWIRE_ASAN" kind="cmake" default="unset" dark="1" runtime="0" p="CMakeLists.txt" l="14" family="1" regions="0" loc="0" branches="0" bindings="0" hosts="0" filescope="0" downstream="0" dependents="0" tests="0" untested="0" files="4861" root="."> +<parent name="OFF" siblings="9"/> +<member name="RIPWIRE_ASAN" via="self" regions="0" loc="0" branches="0"/> +<lights r="0" b="0"> +</lights> +<hosts n="0"> +</hosts> +<downstream n="0"> +</downstream> +<tests n="0"> +</tests> +<untested n="0"> +</untested> +<build n="14" note="CMake read sites: a switch here can add whole translation units or link targets, which this verb does NOT follow"> +<c p="CMakeLists.txt" l="14"/> +<c p="CMakeLists.txt" l="18"/> +<c p="CMakeLists.txt" l="24"/> +<c p="CMakeLists.txt" l="36"/> +<c p="CMakeLists.txt" l="38"/> +<c p="CMakeLists.txt" l="788"/> +<c p="CMakeLists.txt" l="1082"/> +<c p="CMakeLists.txt" l="1087"/> +<c p="CMakeLists.txt" l="1123"/> +<c p="CMakeLists.txt" l="1136"/> +<c p="CMakeLists.txt" l="1141"/> +<c p="CMakeLists.txt" l="1180"/> +<c p="CMakeLists.txt" l="1233"/> +<c p="CMakeLists.txt" l="1235"/> +</build> +</flip> +````` + +## `./build/ripwire . --flags --flip=RIPWIRE_ASA` + +*Unknown-gate refusal (exit 1) with a did-you-mean from a real edit distance (one character off RIPWIRE_ASAN).* + +**exit code: 1** + +````` +(empty) +````` + +stderr: + +````` +ripwire: --flip: no gate named 'RIPWIRE_ASA' in . (did you mean 'RIPWIRE_ASAN', 'RIPWIRE_ASAN_BIN', 'RIPWIRE_ASAN_PROBE_SEC', 'RIPWIRE_ASAN_PROBE_WHY'?) +ripwire: run `ripwire . --flags` for the gate table +````` + +## `./build/ripwire . --plan-lanes=3 --task="add a --since filter to the doc-drift verb and cover it with tests"` + +*NEW VERB: pre-hoc lane plan — which of 3 parallel worktrees would COLLIDE, before a line is written. JSON on stdout.* + +**wall time: 1.56s** + +````` +{"v":1,"verb":"plan-lanes","at":"914c4045d","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":4852,"symbols":45032,"edges":453 … [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"}, +{"p":"./src/docdrift.h","n":"writeDocDriftPage","scope":"docdrift","l":2909,"id":"./src/docdrift.h::docdrift::writeDocDriftPage"}, +{"p":"./src/mcpverbs.h","n":"docDriftText","scope":"rw","l":689,"id":"./src/mcpverbs.h::rw::docDriftText"}, +{"p":"./src/verbs_change.h","n":"runDocDrift","scope":"","l":1688,"id":null}]},"lanes":[{"id":"lane-0","task":"add a --since filter to the doc-drift verb and cover it with tests","claims":{"symbols":[{"p":"./src/editcheck.h","n":"editCheckPriceRoot","scope":"rw","key":"33219bb04158a6a8","id":"./src/ … [line truncated: 158 more bytes on this line] +{"p":"./src/docdrift.h","n":"writeGateability","scope":"docdrift","key":"42c456dfb55faee4","id":"./src/docdrift.h::docdrift::writeGateability","id_addressable":true,"id_collides_with":0,"l":2685,"ord":0,"overloads":1,"amb":2,"cx":6,"ccx":6,"churn":37,"tested":0}, +{"p":"./src/docdrift.h","n":"docDriftNextAttr","scope":"docdrift","key":"7723ed789a1c9c09","id":"./src/docdrift.h::docdrift::docDriftNextAttr","id_addressable":true,"id_collides_with":0,"l":2864,"ord":0,"overloads":1,"amb":0,"cx":6,"ccx":5,"churn":37,"tested":0}, +{"p":"./src/docdrift.h","n":"writeWeakDisclosures","scope":"docdrift","key":"7d760d428aab46d1","id":"./src/docdrift.h::docdrift::writeWeakDisclosures","id_addressable":true,"id_collides_with":0,"l":2839,"ord":0,"overloads":1,"amb":2,"cx":4,"ccx":5,"churn":37,"tested":0}, +{"p":"./src/docdrift.h","n":"recordWeakDisclosures","scope":"docdrift","key":"972779210e49c0cf","id":"./src/docdrift.h::docdrift::recordWeakDisclosures","id_addressable":true,"id_collides_with":0,"l":2430,"ord":0,"overloads":1,"amb":0,"cx":2,"ccx":1,"churn":37,"tested":0}, +{"p":"./src/testmap.h","n":"scriptGatesUnmodelledCount","scope":"rw","key":"98c4487e2e9e08bc","id":"./src/testmap.h::rw::scriptGatesUnmodelledCount","id_addressable":true,"id_collides_with":0,"l":2016,"ord":0,"overloads":1,"amb":0,"cx":4,"ccx":4,"churn":77,"tested":0}, +{"p":"./src/graphlegend.h","n":"kRadiusTestTierLegend","scope":"rw","key":"98c48ee73bccc1a2","id":"./src/graphlegend.h::rw::kRadiusTestTierLegend","id_addressable":true,"id_collides_with":0,"l":538,"ord":0,"overloads":1,"amb":0,"cx":0,"ccx":0,"churn":242,"tested":0}, +{"p":"./src/graphlegend.h","n":"impactTestedPartitionLegend","scope":"rw","key":"9ca0ff23a3b8620e","id":"./src/graphlegend.h::rw::impactTestedPartitionLegend","id_addressable":true,"id_collides_with":0,"l":567,"ord":0,"overloads":1,"amb":0,"cx":4,"ccx":4,"churn":242,"tested":0}, +{"p":"./src/pageview.h","n":"secondaryCutAttrs","scope":"rw","key":"a10ea8d3bdca1dfb","id":"./src/pageview.h::rw::secondaryCutAttrs","id_addressable":true,"id_collides_with":0,"l":404,"ord":0,"overloads":1,"amb":0,"cx":3,"ccx":2,"churn":29,"tested":0}, +{"p":"./src/main.cpp","n":"emitNoteAddUnprovenDefs","scope":"","key":"a950332ccfce6b8d","id":null,"id_addressable":false,"id_collides_with":0,"l":696,"ord":0,"overloads":1,"amb":1,"cx":2,"ccx":1,"churn":514,"tested":0}, +{"p":"./src/docdrift.h","n":"sortDocsByLiveDrift","scope":"docdrift","key":"d5de682411b9a9a9","id":"./src/docdrift.h::docdrift::sortDocsByLiveDrift","id_addressable":true,"id_collides_with":0,"l":2390,"ord":0,"overloads":1,"amb":0,"cx":2,"ccx":2,"churn":37,"tested":0}, +{"p":"./src/mcpverbs.h","n":"unknownSubVerbRefusal","scope":"rw","key":"e336d39b0a6addea","id":"./src/mcpverbs.h::rw::unknownSubVerbRefusal","id_addressable":true,"id_collides_with":0,"l":6306,"ord":0,"overloads":1,"amb":0,"cx":3,"ccx":2,"churn":676,"tested":0}], +"files":[{"p":"./src/docdrift.h","symbols":5,"churn":37,"ccx":19,"hotspot_rank":51}, +{"p":"./src/editcheck.h","symbols":1,"churn":70,"ccx":10,"hotspot_rank":54}, +{"p":"./src/graphlegend.h","symbols":2,"churn":242,"ccx":4,"hotspot_rank":34}, +{"p":"./src/main.cpp","symbols":1,"churn":514,"ccx":1,"hotspot_rank":5}, +{"p":"./src/mcpverbs.h","symbols":1,"churn":676,"ccx":2,"hotspot_rank":4}, +{"p":"./src/pageview.h","symbols":1,"churn":29,"ccx":2,"hotspot_rank":173}, +{"p":"./src/testmap.h","symbols":1,"churn":77,"ccx":4,"hotspot_rank":37}]},"blast_radius":{"reaches":53,"files_total":17,"capped":false,"files":["./src/darkflags.h","./src/docdrift.h","./src/editcheck.h","./src/editplan.h","./src/editpreview.h","./src/flipimpact.h","./src/main.cpp","./src/mcp.h","./ … [line truncated: 202 more bytes on this line] +"tests_total":0,"tests_capped":false,"tests_granularity":"claimed-symbols","untested":53,"module_span":2,"notes":[], +"execution":{"policy":"codex-lane/v1","model":"gpt-5.6-sol","reasoning":"high","rule":"complex-or-wide","basis":"structural-only","signals":{"claims":12,"files":7,"module_span":2,"max_ccx":10,"sum_ccx":42,"ambiguous_calls":5,"blast_reaches":53,"contract_touches":0,"conflicts":0,"untested":53,"tests_ … [line truncated: 134 more bytes on this line] +{"id":"lane-1","task":"add a --since filter to the doc-drift verb and cover it with tests","claims":{"symbols":[{"p":"./src/taskroute.h","n":"classifyRoutesUncapped","scope":"rw::taskroute","key":"0c5e6053e914484d","id":"./src/taskroute.h::rw::taskroute::classifyRoutesUncapped","id_addressable":true … [line truncated: 101 more bytes on this line] +{"p":"./src/gitmine.h","n":"gitWindowBoundarySha","scope":"rw","key":"18627516699d7062","id":"./src/gitmine.h::rw::gitWindowBoundarySha","id_addressable":true,"id_collides_with":0,"l":2179,"ord":0,"overloads":1,"amb":1,"cx":4,"ccx":3,"churn":106,"tested":0}, +{"p":"./src/jsrunner.h","n":"matchesDefaultInclude","scope":"rw::jsrunner","key":"1e885c432f6da6bb","id":"./src/jsrunner.h::rw::jsrunner::matchesDefaultInclude","id_addressable":true,"id_collides_with":0,"l":549,"ord":0,"overloads":1,"amb":0,"cx":11,"ccx":11,"churn":22,"tested":0}, +… [68 more display lines; full output is 20421 bytes on 1 raw line(s)] +````` + +## `./build/ripwire . --plan-lanes --brief=<scratch>/aux/lanes_brief.txt` + +*NEW VERB, explicit form: one line per lane, lane boundaries are the ones you wrote (the defensible mode).* + +**wall time: 1.67s** + +Input file: + +````` +add a --since filter to the doc-drift verb +add the CLI parse arm and help text for the new filter +write regression tests for the new filter +````` + +````` +{"v":1,"verb":"plan-lanes","at":"914c4045d","root":".","task":null,"source":"brief","requested":3,"lane_count":3,"claim_key":"path+scope+name","on_conflict":"producing-lane-rebases","corpus":{"files":4852,"symbols":45032,"edges":45381,"ambiguous":3984,"unresolved":20100},"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":689,"ord":0,"overloads":1,"amb":0,"cx":1,"ccx":0,"churn":676,"tested":0}, +{"p":"./src/recall.h","n":"docFileMask","scope":"rw","key":"3149a219f599664c","id":"./src/recall.h::rw::docFileMask","id_addressable":true,"id_collides_with":0,"l":113,"ord":0,"overloads":1,"amb":0,"cx":4,"ccx":4,"churn":49,"tested":0}, +{"p":"./src/docdrift.h","n":"writeDocDriftPage","scope":"docdrift","key":"380b7de5df1cfd73","id":"./src/docdrift.h::docdrift::writeDocDriftPage","id_addressable":true,"id_collides_with":0,"l":2909,"ord":0,"overloads":1,"amb":10,"cx":14,"ccx":15,"churn":37,"tested":0}, +{"p":"./src/docdrift.h","n":"computeDocDrift","scope":"docdrift","key":"3b19cc3d8996c3b2","id":"./src/docdrift.h::docdrift::computeDocDrift","id_addressable":true,"id_collides_with":0,"l":2441,"ord":0,"overloads":1,"amb":1,"cx":26,"ccx":38,"churn":37,"tested":0}, +{"p":"./src/docdrift.h","n":"DriftResult","scope":"DriftResult","key":"422ab39546b6e0bd","id":"./src/docdrift.h::DriftResult::DriftResult","id_addressable":true,"id_collides_with":0,"l":286,"ord":0,"overloads":1,"amb":0,"cx":0,"ccx":0,"churn":37,"tested":0}, +{"p":"./src/docdrift.h","n":"writeGateability","scope":"docdrift","key":"42c456dfb55faee4","id":"./src/docdrift.h::docdrift::writeGateability","id_addressable":true,"id_collides_with":0,"l":2685,"ord":0,"overloads":1,"amb":2,"cx":6,"ccx":6,"churn":37,"tested":0}, +{"p":"./src/verbs_change.h","n":"runDocDrift","scope":"","key":"904831e5c0f66b39","id":null,"id_addressable":false,"id_collides_with":0,"l":1688,"ord":0,"overloads":1,"amb":1,"cx":5,"ccx":4,"churn":92,"tested":0}, +{"p":"./src/ensemble.h","n":"kEnsembleChurnSince","scope":"ensemble","key":"a34fc78c05bf56a8","id":"./src/ensemble.h::ensemble::kEnsembleChurnSince","id_addressable":true,"id_collides_with":0,"l":121,"ord":0,"overloads":1,"amb":0,"cx":0,"ccx":0,"churn":24,"tested":0}, +{"p":"./src/mcpverbs.h","n":"unknownSubVerbRefusal","scope":"rw","key":"e336d39b0a6addea","id":"./src/mcpverbs.h::rw::unknownSubVerbRefusal","id_addressable":true,"id_collides_with":0,"l":6306,"ord":0,"overloads":1,"amb":0,"cx":3,"ccx":2,"churn":676,"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":51}, +{"p":"./src/ensemble.h","symbols":1,"churn":24,"ccx":0,"hotspot_rank":131}, +{"p":"./src/mcpverbs.h","symbols":2,"churn":676,"ccx":2,"hotspot_rank":4}, +{"p":"./src/recall.h","symbols":1,"churn":49,"ccx":4,"hotspot_rank":49}, +{"p":"./src/verbs_change.h","symbols":1,"churn":92,"ccx":4,"hotspot_rank":35}], +"symbols_total":4300,"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":188,"l":289,"ord":0,"overloads":1,"amb":0,"cx":23,"ccx":31,"churn":22, … [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":188,"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":3148,"ord":0,"overloads":1,"amb":0,"cx":0,"ccx":0,"churn":651,"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":3227,"ord":0,"overloads":1,"amb":0,"cx":0,"ccx":0,"churn":651,"tested":0}, +{"p":"./docs/docs_commands_build.py","n":"main","scope":"","key":"4015853681ded3bc","id":null,"id_addressable":false,"id_collides_with":188,"l":900,"ord":0,"overloads":1,"amb":0,"cx":19,"ccx":28,"churn":19,"tested":0}, +{"p":"./src/mcprefusal.h","n":"kMcpValueFields","scope":"rw::mcprefuse","key":"4a7106e488a2aa80","id":"./src/mcprefusal.h::rw::mcprefuse::kMcpValueFields","id_addressable":true,"id_collides_with":0,"l":304,"ord":0,"overloads":1,"amb":0,"cx":0,"ccx":0,"churn":51,"tested":0}, +{"p":"./src/query.h","n":"tryParsePredicateOnAll","scope":"query","key":"786acc4dbfec612b","id":"./src/query.h::query::tryParsePredicateOnAll","id_addressable":false,"id_collides_with":1,"l":114,"ord":0,"overloads":2,"amb":0,"cx":1,"ccx":0,"churn":22,"tested":0}, +{"p":"./src/cli.h","n":"printUsageTier","scope":"rw","key":"82b7af67acdca479","id":"./src/cli.h::rw::printUsageTier","id_addressable":true,"id_collides_with":0,"l":3278,"ord":0,"overloads":1,"amb":0,"cx":2,"ccx":1,"churn":651,"tested":0}, +{"p":"./src/crossref.h","n":"writeWhereisTextCut","scope":"crossref","key":"9a3ef6403f53ce21","id":"./src/crossref.h::crossref::writeWhereisTextCut","id_addressable":true,"id_collides_with":0,"l":5163,"ord":0,"overloads":1,"amb":1,"cx":3,"ccx":3,"churn":111,"tested":0}, +… [59 more display lines; full output is 18361 bytes on 1 raw line(s)] +````` + +## `./build/ripwire . --plan-lanes=99 --task=x` + +*Out-of-range refusal shape for the lane count.* + +**exit code: 1** + +````` +(empty) +````` + +stderr: + +````` +ripwire: --plan-lanes=99 is out of range — N must be 2..16 (1 is not a fan-out) +````` + +## `./build/ripwire . --layout=Symbol` + +*CPU/GPU contract view of one struct: computed offsets/sizes/padding + mirror check.* + +````` +<!-- ripwire layout schema=ripwire.layout/v1: struct field layout vs cache lines: offsets, padding, hot/cold split candidates. root=: p= relative to it. sym=: the aggregate name asked for. found=1: a C-family struct/class/union body was located for sym=. defs=N: same-name aggregate defs found; a more element counts any not shown. mirror=: single|match|mismatch (byte drift, exits nonzero)|stub|spelling, over same-name defs. asserts=N: static_assert tripwires in indexed files that mention sym=. conflicts=N: asserts contradicting the computed size (agree=0 rows); nonzero exits nonzero. scanned=N: indexed C-family files read for asserts. agg=: struct, class or union. fields=N: member rows listed. modeled=0: size/align/tail pad not computed; off= only up to the first unknown. ty=: the field type as written, before macro expansion (as= gives the expansion). sz=N: field bytes incl. array extent (LP64 model); sized=0 instead when unknown. al=N: field alignment in bytes (LP64 model). off=N: computed byte offset; absent after an earlier field of unknown size. bits=N bit=B: a bitfield N bits wide from bit B of its 1-byte unit at off=. std_abi=: the C++ standard library (libc++|libstdc++) whose std:: member sizes were used: the one this binary was built against. def size=/align=/tail_pad=: computed bytes, alignment, trailing padding (modeled=1 only). --> +<layout schema="ripwire.layout/v1" sym="Symbol" found="1" defs="1" mirror="single" asserts="3" conflicts="0" scanned="1130" std_abi="libc++" root="."> +<def p="src/model.h" l="912" agg="struct" modeled="1" fields="31" size="112" align="8" tail_pad="0"> +<f n="id" ty="NodeId" as="std::uint32_t" sz="4" al="4" off="0"/> +<f n="kind" ty="SymKind" as="std::uint8_t" sz="1" al="1" off="4"/> +<f n="lang" ty="Lang" as="std::uint8_t" sz="1" al="1" off="5"/> +<f n="ppAlt" ty="std::uint16_t" sz="2" al="2" off="6"/> +<f n="fileId" ty="std::uint32_t" sz="4" al="4" off="8"/> +<f n="line" ty="std::uint32_t" sz="4" al="4" off="12"/> +<f n="sigStartByte" ty="std::uint32_t" sz="4" al="4" off="16"/> +<f n="sigEndByte" ty="std::uint32_t" sz="4" al="4" off="20"/> +<f n="endByte" ty="std::uint32_t" sz="4" al="4" off="24"/> +<f n="cx" ty="std::uint32_t" sz="4" al="4" off="28"/> +<f n="ccx" ty="std::uint32_t" sz="4" al="4" off="32"/> +<f n="loc" ty="std::uint32_t" sz="4" al="4" off="36"/> +<f n="locals" ty="std::uint16_t" sz="2" al="2" off="40"/> +<f n="steer" ty="std::uint8_t" sz="1" al="1" off="42"/> +<f n="dispatchShare" ty="std::uint8_t" sz="1" al="1" off="43"/> +<f n="humps" ty="std::uint16_t" sz="2" al="2" off="44"/> +<f n="deepLoc" ty="std::uint16_t" sz="2" al="2" off="46"/> +<f n="ev" ty="std::uint16_t" sz="2" al="2" off="48"/> +<f n="evWhy" ty="std::array<std::uint8_t, kEvWhyTagCount>" sz="8" al="1" off="50"/> +<f n="params" ty="std::uint16_t" sz="2" al="2" off="58"/> +<f n="maxNest" ty="std::uint8_t" sz="1" al="1" off="60"/> +<f n="arityExact" ty="std::uint8_t" sz="1" al="1" off="61"/> +<f n="testScope" ty="std::uint8_t" bits="1" bit="0" sz="1" al="1" off="62"/> +<f n="internalLinkage" ty="std::uint8_t" bits="1" bit="1" sz="1" al="1" off="62"/> +<f n="scopeRootsStd" ty="std::uint8_t" bits="1" bit="2" sz="1" al="1" off="62"/> +<f n="fnLocal" ty="std::uint8_t" bits="1" bit="3" sz="1" al="1" off="62"/> +<f n="paramsMin" ty="std::uint8_t" bits="4" bit="4" sz="1" al="1" off="62"/> +<f n="extentSuspect" ty="std::uint8_t" bits="4" bit="0" sz="1" al="1" off="63"/> +<f n="rankFlags" ty="std::uint8_t" bits="4" bit="4" sz="1" al="1" off="63"/> +<f n="name" ty="std::string" sz="24" al="8" off="64"/> +<f n="scope" ty="std::string" sz="24" al="8" off="88"/> +</def> +<assert p="src/model.h" l="1136" kind="mention" t="static_assert( sizeof( Symbol ) == 64 + 2 * sizeof( std::string ), "Symbol size changed — verify the new field uses the smallest type + is grouped (SoA); see model.h" )"/> +<assert p="src/renamemine.h" l="617" kind="mention" t="static_assert( kRuleCount <= std::numeric_limits<decltype( firedRuleMask( std::declval<const Symbol&>(), std::string_view() ) )>::digits, "firedRuleMask holds one bit per naming rule — widen it before kRuleCount outgro" … [line truncated: 2 more bytes on this line] +<assert p="src/warmsnap_model.h" l="35" kind="mention" t="static_assert( sizeof( IngestResult ) == 1144 && sizeof( Symbol ) == 112 && sizeof( Reference ) == 64 && sizeof( Binding ) == 36 && sizeof( RefColdText ) == 20, "the model changed shape: store and load the … [line truncated: 18 more bytes on this line] +</layout> +````` + +## `./build/ripwire . --layout=Lang` + +*The honest refusal (exit 1): Lang is an `enum class`, not a struct — no offsets are fabricated.* + +**exit code: 1** + +````` +(empty) +````` + +stderr: + +````` +ripwire: --layout: 'Lang' is an enum, --layout models structs (a scoped/unscoped enum's underlying type is not a byte layout) +````` + +## `./build/ripwire . --doc-drift` + +*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).* + +````` +<!-- ripwire doc-drift schema=ripwire.doc-drift/v1: markdown anchors that no longer hold: <doc p=> of <a k= l= c= why= ref= want= got= tgt=>; unchecked/dated rows disclose the rest. failed_capped=/weak_capped=: 1 = cut. at=: commit+dirty+shallow. next=: the one pasteable follow-up. docs=N: markdown docs scanned for anchors; docs minus clean = the doc rows. clean=N: docs with no failed anchor (drift and dated 0); not proof every anchor was checked. checked=N: anchors verified against the index; checked + unchecked = anchors. prose=N: value anchors dropped as prose (name not in code); subtracted from anchors=, never checked. corpus=N: files the anchors were checked against (index + config/build exts); 0 = no anchor shape, no scan. drift=/dated=: anchors that no longer hold / anchors skipped as dated (unverifiable by date). unchecked=N: anchors not proved (the unchecked rows give each reason); checked + unchecked = anchors. doc shown_failed=/failed_total=: a rows printed / all failed anchors (drift+dated); cut at 12, detail=1 lifts. a kind=/rec=: dated-record, an author-dated failed anchor in dated= / its evidence: line|block|title|stamp. a sym=: the symbol the doc names on that file:line; line-moved = that symbol no longer spans the line. more weak=N: w rows of this group withheld; shown_weak + N = its n=; detail=1 lists all. shown_weak=N: w rows printed of n= (cut at 12 a doc, weak_capped=1); detail=1 lists all. w resolves-to=: the indexed symbol spanning that line; not proof it is the one the doc meant. unchecked r=/note=: why n= anchors were not proved, and what was still checked for them. dated r=/note=: the dating mark that moved n= failed anchors into dated= instead of drift=. --> +<doc-drift schema="ripwire.doc-drift/v1" docs="356" clean="321" anchors="8252" checked="3910" unchecked="4342" drift="91" dated="136" prose="26" corpus="5018" at="914c4045d" next="--doc-drift --detail=1"> +<doc p="docs/research/answer-completeness.md" anchors="187" checked="84" drift="16" dated="0" shown_failed="12" failed_capped="1" failed_total="16"> +<a k="file-line" l="341" c="25" why="line-moved" ref="src/pageview.h:292" sym="pageDisclosure" got="(file scope)" tgt="src/pageview.h:351"/> +<a k="file-line" l="349" c="99" why="line-moved" ref="src/serialize.h:4169" sym="kForLensDefaultTopN" got="append" tgt="src/serialize.h:1111"/> +<a k="file-line" l="353" c="89" why="line-moved" ref="src/serialize.h:4435" sym="kForPayloadBudgetBytes" got="settleEstTokens" tgt="src/serialize.h:1000"/> +<a k="file-line" l="356" c="42" why="line-moved" ref="src/serialize.h:1010" sym="kForFileTailShownCap" got="(file scope)" tgt="src/serialize.h:1188"/> +<a k="file-line" l="358" c="89" why="line-moved" ref="src/serialize.h:5481" sym="kForAnchorBodyBudgetBytes" got="(file scope)" tgt="src/serialize.h:1164"/> +<a k="file-line" l="360" c="88" why="line-moved" ref="src/serialize.h:5800" sym="kForCompactSurfaceBudgetBytes" got="(file scope)" tgt="src/serialize.h:1283"/> +<a k="file-line" l="366" c="43" why="line-moved" ref="src/serialize.h:6534" sym="kWithGraphNodeCap" got="packSignatures" tgt="src/serialize.h:10073"/> +<a k="file-line" l="367" c="51" why="line-moved" ref="src/forpage.h:287" sym="kForPageRowsDefault" got="forCandidatePageDoc" tgt="src/forpage.h:76"/> +<a k="file-line" l="380" c="44" why="line-moved" ref="src/serialize.h:2460" sym="kFillOrderThreshold" got="writeRecentRows" tgt="src/serialize.h:1655"/> +<a k="file-line" l="382" c="62" why="line-moved" ref="src/main.cpp:1283" sym="kRecentRows" got="(file scope)" tgt="src/main.cpp:1230"/> +<a k="file-line" l="399" c="48" why="line-moved" ref="src/serialize.h:5317" sym="kMaxExpandSibs" got="sigRowTail" tgt="src/serialize.h:8172"/> +<a k="file-line" l="400" c="50" why="line-moved" ref="src/serialize.h:5342" sym="kMaxExpandIncludes" got="(file scope)" tgt="src/serialize.h:8181"/> +<more drift="4"/> +</doc> +<doc p="prompts/help-wanted/graph-unit-tests.md" anchors="164" checked="95" drift="8" dated="0"> +<a k="file-line" l="96" c="6" why="range-straddles" ref="src/infra/Diagnostics.h:265-321" got="RW_CHECK_" tgt="src/infra/Diagnostics.h:321"/> +<a k="file-line" l="99" c="57" why="line-moved" ref="Diagnostics.h:543-550" sym="DISCLOSE" got="(file scope)" tgt="src/infra/Diagnostics.h:622"/> +<a k="file-line" l="132" c="18" why="range-straddles" ref="src/graph.h:2742-2755" sym="buildGraph" got="(file scope)" tgt="src/graph.h:2755"/> +<a k="file-line" l="155" c="17" why="line-moved" ref="src/graph.h:3228" sym="biasPrior" got="recordSubmoduleBind" tgt="src/graph.h:14880"/> +<a k="file-line" l="170" c="3" why="line-moved" ref="src/graph.h:3915" sym="computeImpure" got="JsImportTarget" tgt="src/graph.h:18067"/> +<a k="const" l="301" c="421" why="const-value" ref="maxIterationCount = 90" want="90" got="400" tgt="test/verify_pagerank.cpp:59"/> +<a k="const" l="301" c="510" why="const-value" ref="maxIterationCount = 89" want="89" got="400" tgt="test/verify_pagerank.cpp:59"/> +<a k="const" l="303" c="18" why="const-value" ref="maxIterationCount = 1" want="1" got="400" tgt="test/verify_pagerank.cpp:59"/> +</doc> +<doc p="CHANGELOG.md" anchors="1948" checked="805" drift="7" dated="15" shown_failed="12" failed_capped="1" failed_total="22"> +<a k="file-line" l="1300" c="5" why="missing-file" kind="dated-record" rec="block" ref="cmd-split-window.c:58"/> +<a k="file-line" l="1432" c="43" why="missing-file" kind="dated-record" rec="block" ref="cmd-queue.c:625"/> +… [260 more display lines; full output is 25804 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.* + +````` +<!-- ripwire doc-drift schema=ripwire.doc-drift/v1: markdown anchors that no longer hold: <doc p=> of <a k= l= c= why= ref= want= got= tgt=>; unchecked/dated rows disclose the rest. failed_capped=/weak_capped=: 1 = cut. at=: commit+dirty+shallow. next=: the one pasteable follow-up. docs=N: markdown docs scanned for anchors; docs minus clean = the doc rows. clean=N: docs with no failed anchor (drift and dated 0); not proof every anchor was checked. checked=N: anchors verified against the index; checked + unchecked = anchors. prose=N: value anchors dropped as prose (name not in code); subtracted from anchors=, never checked. corpus=N: files the anchors were checked against (index + config/build exts); 0 = no anchor shape, no scan. drift=/dated=: anchors that no longer hold / anchors skipped as dated (unverifiable by date). unchecked=N: anchors not proved (the unchecked rows give each reason); checked + unchecked = anchors. doc shown_failed=/failed_total=: a rows printed / all failed anchors (drift+dated); cut at 12, detail=1 lifts. a kind=/rec=: dated-record, an author-dated failed anchor in dated= / its evidence: line|block|title|stamp. a sym=: the symbol the doc names on that file:line; line-moved = that symbol no longer spans the line. more weak=N: w rows of this group withheld; shown_weak + N = its n=; detail=1 lists all. shown_weak=N: w rows printed of n= (cut at 12 a doc, weak_capped=1); detail=1 lists all. w resolves-to=: the indexed symbol spanning that line; not proof it is the one the doc meant. unchecked r=/note=: why n= anchors were not proved, and what was still checked for them. dated r=/note=: the dating mark that moved n= failed anchors into dated= instead of drift=. --> +<doc-drift schema="ripwire.doc-drift/v1" docs="356" clean="321" anchors="8252" checked="3910" unchecked="4342" drift="91" dated="136" prose="26" corpus="5018" at="914c4045d" next="--doc-drift --detail=1"> +<doc p="docs/research/answer-completeness.md" anchors="187" checked="84" drift="16" dated="0" shown_failed="12" failed_capped="1" failed_total="16"> +<a k="file-line" l="341" c="25" why="line-moved" ref="src/pageview.h:292" sym="pageDisclosure" got="(file scope)" tgt="src/pageview.h:351"/> +<a k="file-line" l="349" c="99" why="line-moved" ref="src/serialize.h:4169" sym="kForLensDefaultTopN" got="append" tgt="src/serialize.h:1111"/> +<a k="file-line" l="353" c="89" why="line-moved" ref="src/serialize.h:4435" sym="kForPayloadBudgetBytes" got="settleEstTokens" tgt="src/serialize.h:1000"/> +<a k="file-line" l="356" c="42" why="line-moved" ref="src/serialize.h:1010" sym="kForFileTailShownCap" got="(file scope)" tgt="src/serialize.h:1188"/> +<a k="file-line" l="358" c="89" why="line-moved" ref="src/serialize.h:5481" sym="kForAnchorBodyBudgetBytes" got="(file scope)" tgt="src/serialize.h:1164"/> +<a k="file-line" l="360" c="88" why="line-moved" ref="src/serialize.h:5800" sym="kForCompactSurfaceBudgetBytes" got="(file scope)" tgt="src/serialize.h:1283"/> +<a k="file-line" l="366" c="43" why="line-moved" ref="src/serialize.h:6534" sym="kWithGraphNodeCap" got="packSignatures" tgt="src/serialize.h:10073"/> +<a k="file-line" l="367" c="51" why="line-moved" ref="src/forpage.h:287" sym="kForPageRowsDefault" got="forCandidatePageDoc" tgt="src/forpage.h:76"/> +<a k="file-line" l="380" c="44" why="line-moved" ref="src/serialize.h:2460" sym="kFillOrderThreshold" got="writeRecentRows" tgt="src/serialize.h:1655"/> +<a k="file-line" l="382" c="62" why="line-moved" ref="src/main.cpp:1283" sym="kRecentRows" got="(file scope)" tgt="src/main.cpp:1230"/> +<a k="file-line" l="399" c="48" why="line-moved" ref="src/serialize.h:5317" sym="kMaxExpandSibs" got="sigRowTail" tgt="src/serialize.h:8172"/> +<a k="file-line" l="400" c="50" why="line-moved" ref="src/serialize.h:5342" sym="kMaxExpandIncludes" got="(file scope)" tgt="src/serialize.h:8181"/> +<more drift="4"/> +</doc> +<doc p="prompts/help-wanted/graph-unit-tests.md" anchors="164" checked="95" drift="8" dated="0"> +<a k="file-line" l="96" c="6" why="range-straddles" ref="src/infra/Diagnostics.h:265-321" got="RW_CHECK_" tgt="src/infra/Diagnostics.h:321"/> +<a k="file-line" l="99" c="57" why="line-moved" ref="Diagnostics.h:543-550" sym="DISCLOSE" got="(file scope)" tgt="src/infra/Diagnostics.h:622"/> +<a k="file-line" l="132" c="18" why="range-straddles" ref="src/graph.h:2742-2755" sym="buildGraph" got="(file scope)" tgt="src/graph.h:2755"/> +<a k="file-line" l="155" c="17" why="line-moved" ref="src/graph.h:3228" sym="biasPrior" got="recordSubmoduleBind" tgt="src/graph.h:14880"/> +<a k="file-line" l="170" c="3" why="line-moved" ref="src/graph.h:3915" sym="computeImpure" got="JsImportTarget" tgt="src/graph.h:18067"/> +<a k="const" l="301" c="421" why="const-value" ref="maxIterationCount = 90" want="90" got="400" tgt="test/verify_pagerank.cpp:59"/> +<a k="const" l="301" c="510" why="const-value" ref="maxIterationCount = 89" want="89" got="400" tgt="test/verify_pagerank.cpp:59"/> +<a k="const" l="303" c="18" why="const-value" ref="maxIterationCount = 1" want="1" got="400" tgt="test/verify_pagerank.cpp:59"/> +</doc> +<doc p="CHANGELOG.md" anchors="1948" checked="805" drift="7" dated="15" shown_failed="12" failed_capped="1" failed_total="22"> +<a k="file-line" l="1300" c="5" why="missing-file" kind="dated-record" rec="block" ref="cmd-split-window.c:58"/> +<a k="file-line" l="1432" c="43" why="missing-file" kind="dated-record" rec="block" ref="cmd-queue.c:625"/> +… [292 more display lines; full output is 27293 bytes on 1 raw line(s)] +````` + +Tail of the same output — the `<gateability>` section: + +````` +<gateability docs="30" projected_drift="0"> +<fix p="docs/research/answer-completeness.md" live="16"/> +<fix p="prompts/help-wanted/graph-unit-tests.md" live="8"/> +<fix p="CHANGELOG.md" live="7"/> +<fix p="test/docdriftfix/NOTES.md" live="7"/> +<fix p="THIRD_PARTY.md" live="6"/> +<fix p="changelog.d/uses-unarmed.md" live="4"/> +<fix p="docs/LSP.md" live="4"/> +<fix p="docs/QUALITY_PANEL.md" live="4"/> +<fix p="prompts/help-wanted/kotlin-scope-functions.md" live="4"/> +<fix p="changelog.d/proven-site-keeps-namesakes.md" live="3"/> +<fix p="changelog.d/touch-sym.md" live="3"/> +<fix p="CONTRIBUTING.md" live="2"/> +<fix p="changelog.d/callee-row-file.md" live="2"/> +<fix p="docs/COMMANDS.md" live="2"/> +<fix p="prompts/help-wanted/uses-qualified-selector.md" live="2"/> +<fix p="test/docdriftfix/live_notes.md" live="2"/> +<fix p="test/gateabilityfix/UNDATED.md" live="2"/> +<fix p="README.md" live="1"/> +<fix p="bench/nestcal/r1-2026-08-07/REPORT.md" live="1"/> +<fix p="changelog.d/qd-lessons-1.md" live="1"/> +<fix p="docs/EVALS.md" live="1"/> +<fix p="docs/LINEAGE.md" live="1"/> +<fix p="docs/OPTREMARKS.md" live="1"/> +<fix p="prompts/help-wanted/nesting-refusals-visible.md" live="1"/> +````` + +## `./build/ripwire . --doc-drift --with-history` + +*Same report, with git history splitting stale mentions into deleted-by-commit vs never-existed.* + +````` +<!-- ripwire doc-drift schema=ripwire.doc-drift/v1: markdown anchors that no longer hold: <doc p=> of <a k= l= c= why= ref= want= got= tgt=>; unchecked/dated rows disclose the rest. failed_capped=/weak_capped=: 1 = cut. at=: commit+dirty+shallow. next=: the one pasteable follow-up. docs=N: markdown docs scanned for anchors; docs minus clean = the doc rows. clean=N: docs with no failed anchor (drift and dated 0); not proof every anchor was checked. checked=N: anchors verified against the index; checked + unchecked = anchors. prose=N: value anchors dropped as prose (name not in code); subtracted from anchors=, never checked. corpus=N: files the anchors were checked against (index + config/build exts); 0 = no anchor shape, no scan. drift=/dated=: anchors that no longer hold / anchors skipped as dated (unverifiable by date). unchecked=N: anchors not proved (the unchecked rows give each reason); checked + unchecked = anchors. doc shown_failed=/failed_total=: a rows printed / all failed anchors (drift+dated); cut at 12, detail=1 lifts. a kind=/rec=: dated-record, an author-dated failed anchor in dated= / its evidence: line|block|title|stamp. a sym=: the symbol the doc names on that file:line; line-moved = that symbol no longer spans the line. more weak=N: w rows of this group withheld; shown_weak + N = its n=; detail=1 lists all. shown_weak=N: w rows printed of n= (cut at 12 a doc, weak_capped=1); detail=1 lists all. w resolves-to=: the indexed symbol spanning that line; not proof it is the one the doc meant. unchecked r=/note=: why n= anchors were not proved, and what was still checked for them. dated r=/note=: the dating mark that moved n= failed anchors into dated= instead of drift=. --> +<doc-drift schema="ripwire.doc-drift/v1" docs="356" clean="327" anchors="8252" checked="3888" unchecked="4364" drift="78" dated="127" prose="26" corpus="5018" at="914c4045d" next="--doc-drift --detail=1"> +<history probed="1" head="914c4045d" commits="7404" removed-names="59523"/> +<doc p="docs/research/answer-completeness.md" anchors="187" checked="84" drift="16" dated="0" shown_failed="12" failed_capped="1" failed_total="16"> +<a k="file-line" l="341" c="25" why="line-moved" ref="src/pageview.h:292" sym="pageDisclosure" got="(file scope)" tgt="src/pageview.h:351"/> +<a k="file-line" l="349" c="99" why="line-moved" ref="src/serialize.h:4169" sym="kForLensDefaultTopN" got="append" tgt="src/serialize.h:1111"/> +<a k="file-line" l="353" c="89" why="line-moved" ref="src/serialize.h:4435" sym="kForPayloadBudgetBytes" got="settleEstTokens" tgt="src/serialize.h:1000"/> +<a k="file-line" l="356" c="42" why="line-moved" ref="src/serialize.h:1010" sym="kForFileTailShownCap" got="(file scope)" tgt="src/serialize.h:1188"/> +<a k="file-line" l="358" c="89" why="line-moved" ref="src/serialize.h:5481" sym="kForAnchorBodyBudgetBytes" got="(file scope)" tgt="src/serialize.h:1164"/> +<a k="file-line" l="360" c="88" why="line-moved" ref="src/serialize.h:5800" sym="kForCompactSurfaceBudgetBytes" got="(file scope)" tgt="src/serialize.h:1283"/> +<a k="file-line" l="366" c="43" why="line-moved" ref="src/serialize.h:6534" sym="kWithGraphNodeCap" got="packSignatures" tgt="src/serialize.h:10073"/> +<a k="file-line" l="367" c="51" why="line-moved" ref="src/forpage.h:287" sym="kForPageRowsDefault" got="forCandidatePageDoc" tgt="src/forpage.h:76"/> +<a k="file-line" l="380" c="44" why="line-moved" ref="src/serialize.h:2460" sym="kFillOrderThreshold" got="writeRecentRows" tgt="src/serialize.h:1655"/> +<a k="file-line" l="382" c="62" why="line-moved" ref="src/main.cpp:1283" sym="kRecentRows" got="(file scope)" tgt="src/main.cpp:1230"/> +<a k="file-line" l="399" c="48" why="line-moved" ref="src/serialize.h:5317" sym="kMaxExpandSibs" got="sigRowTail" tgt="src/serialize.h:8172"/> +<a k="file-line" l="400" c="50" why="line-moved" ref="src/serialize.h:5342" sym="kMaxExpandIncludes" got="(file scope)" tgt="src/serialize.h:8181"/> +<more drift="4"/> +</doc> +<doc p="prompts/help-wanted/graph-unit-tests.md" anchors="164" checked="95" drift="8" dated="0"> +<a k="file-line" l="96" c="6" why="range-straddles" ref="src/infra/Diagnostics.h:265-321" got="RW_CHECK_" tgt="src/infra/Diagnostics.h:321"/> +<a k="file-line" l="99" c="57" why="line-moved" ref="Diagnostics.h:543-550" sym="DISCLOSE" got="(file scope)" tgt="src/infra/Diagnostics.h:622"/> +<a k="file-line" l="132" c="18" why="range-straddles" ref="src/graph.h:2742-2755" sym="buildGraph" got="(file scope)" tgt="src/graph.h:2755"/> +<a k="file-line" l="155" c="17" why="line-moved" ref="src/graph.h:3228" sym="biasPrior" got="recordSubmoduleBind" tgt="src/graph.h:14880"/> +<a k="file-line" l="170" c="3" why="line-moved" ref="src/graph.h:3915" sym="computeImpure" got="JsImportTarget" tgt="src/graph.h:18067"/> +<a k="const" l="301" c="421" why="const-value" ref="maxIterationCount = 90" want="90" got="400" tgt="test/verify_pagerank.cpp:59"/> +<a k="const" l="301" c="510" why="const-value" ref="maxIterationCount = 89" want="89" got="400" tgt="test/verify_pagerank.cpp:59"/> +<a k="const" l="303" c="18" why="const-value" ref="maxIterationCount = 1" want="1" got="400" tgt="test/verify_pagerank.cpp:59"/> +</doc> +<doc p="test/docdriftfix/NOTES.md" anchors="30" checked="21" drift="7" dated="0"> +<a k="file-line" l="9" c="64" why="line-moved" ref="code.h:23" sym="stableHelper" got="movedHelper" tgt="test/docdriftfix/code.h:17"/> +… [234 more display lines; full output is 25789 bytes on 1 raw line(s)] +````` + +## `./build/ripwire . --from-trace=-` + +*Map a pasted stack trace onto indexed symbols. CHANGED: in_corpus= now reports the real count (was 0).* + +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<float> 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:1761 + #3 0x102e01a44 in main src/main.cpp:4565 + #4 0x1a2b3c0dc in start+0x9dc (dyld:arm64e+0x60dc) +==41337==ABORTING +````` + +````` +<ctx schema="ripwire.from-trace/v1" task="<stdin>" next="--slice=@src/graph.h:14923" est_tokens="2112"> +<!-- ripwire from-trace schema=ripwire.from-trace/v1: trace frames mapped to indexed symbols, innermost first; the innermost in-corpus body included. window: shown= total= capped= (capped=1 cut). est_tokens=: price as emitted (an upper bound under compact). <d r=N>: rank N in this ranking, rows in r= order. <d cx= ccx=>: cyclomatic/cognitive complexity. <d in=N>: N callers in the index (absent: not measured). sc=: enclosing scope; the full id is p::sc::n (p= of the row or its <f>) and selectors take it. next=: the one pasteable follow-up. task=: the trace source this bundle maps, verbatim (a file path, stdin, or an MCP label). src=/format=: the trace read and its dominant frame format, python|asan|node|compiler|generic. frame_lines=/parsed=: frame-shaped input lines / those yielding a path:line; the rest matched no format. in_corpus=: parsed frames in indexed files; always suspects= + merged= + unresolved=. suspects=/merged=/unresolved=: frame rows / folded into a claimed symbol / unresolved rows (indexed file, no def). skipped=N: frames outside every root, listed as skipped rows, never ranked. rank=N: frame order, innermost in-corpus first; p= is the trace's own path:line, defs are sigs l=. resolved_by=name|line: bound by the frame's own name, else by the def enclosing its line. innermost=1: the innermost in-corpus frame (rank 1); its full body is served. frame n= t=: the bound symbol's name and kind (fn|cls|...); d, b and c n=: a ranked row's, a body's, a callee's name. --> +<!-- ledger: budget=7500 bytes (allowance 9583 bytes = ceiling + the single-entry overshoot a whole first signature costs) --> +<trace src="<stdin>" format="asan" frame_lines="5" parsed="4" in_corpus="4" skipped="0" merged="0" unresolved="0" suspects="4"> +<frame rank="1" n="rankGraphTeleport" t="fn" p="src/graph.h:14923" resolved_by="name" innermost="1"/> +<frame rank="2" n="rankGraph" t="fn" p="src/graph.h:14966" resolved_by="name"/> +<frame rank="3" n="runDefaultMap" t="fn" p="src/main.cpp:1761" resolved_by="name"/> +<frame rank="4" n="main" t="fn" p="src/main.cpp:4565" resolved_by="name"/> +</trace> +<sigs> +<d l="14921" n="rankGraphTeleport" sc="rw" p="src/graph.h" cx="5" ccx="8" in="7" r="1" next="--expand=src/graph.h:rankGraphTeleport"> +<doc>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 (edges</doc>inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>&am … [line truncated: 31 more bytes on this line] +<d l="14964" n="rankGraph" sc="rw" p="src/graph.h" cx="2" ccx="1" in="13" r="2"> +<doc>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 it</doc>inline RankedGraph rankGraph( const Graph& g, float alpha = 0.85f )</d> +<d l="1759" n="runDefaultMap" p="src/main.cpp" cx="224" ccx="313" in="1" r="3">int runDefaultMap( const MainDispatch& d )</d> +<d l="4563" n="main" p="src/main.cpp" cx="14" ccx="11" in="0" r="4">int main( int argc, char** argv )</d> +</sigs> +<bodies shown="1" total="1" capped="0"> +<b t="fn" l="14921" p="src/graph.h" n="rankGraphTeleport"> +<![CDATA[inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>& p, float alpha = 0.85f ) +{ + PROFILE_SCOPE_DESCRIBE( "rankGraph: PageRank (power iteration)" ); + const std::vector<float> pw = biasPrior( g, p ); + const std::size_t N = pw.size(); + std::vector<double> teleport( pw.begin(), pw.end() ); + std::vector<double> rankDouble( N, 0.0 ); + PageRankRun run{}; // an N == 0 graph never enters the kernel: { 0, converged } — see PageRankRun + if( N ) + { + double teleportMass = 0.0; +… [18 more display lines; full output is 5279 bytes on 29 raw line(s)] +````` + +## `./build/ripwire . --notes` + +*List all field notes (write-side memory) — the committed .ripwire_notes at the repo root, each with the sha/branch it was recorded at.* + +````` +<ctx schema="ripwire.notes/v1"> +<!-- ripwire notes schema=ripwire.notes/v1: field notes by target: <target id= dangling=> holds <note d= sha= branch=>; the kept count comment: notes= rows, targets= <target> rows, dangling= targets matching nothing indexed (listed, surfaced nowhere). dangling=1: matches nothing indexed. --> +<!-- notes=2 targets=2 dangling=0 --> +<notes> +<target id="src/infra/Diagnostics.h" dangling="0"> +<note d="2026-09-12" sha="42b7c8d" branch="lane/noalias-docs"> +<![CDATA[ASSUME_NO_ALIAS is an optimizer fact in release (separate_storage) only where the compiler consumes it: clang 18+ by default, LLVM 17/AppleClang 16 via the CMake -mllvm flag (scalars only), GCC never (debug check only); never on two members of one object; ASSUME_NO_ALIAS_BUF for OWNING cont … [line truncated: 22 more bytes on this line] +</note> +</target> +<target id="test/manifestcheck.sh" dangling="0"> +<note d="2026-08-23" sha="42634f5" branch="claude/fervent-volhard-ddfd9f"> +<![CDATA[README.md's single '<N> gate scripts' claim (~line 1305) is NOT enforced — the derived-vs-stated sibling loop here covers docs/EVALS.md only. It drifted 407→451 unnoticed (fixed 2026-08-23). To close: grep both files ('file:line:' parsing) in the gateCountClaims arm.]]> +</note> +</target> +</notes> +</ctx> +````` + +## `./build/ripwire . --pack-task="add a new output format flag to the CLI"` + +*ONE budget-shared bundle: ranking + top bodies + caller sigs + notes + tests_to_run. CHANGED: <d> rows now carry n=/id=.* + +````` +<ctx schema="ripwire.pack-task/v1" task="add a new output format flag to the CLI" route="subtoken+body:declined(add;218-carriers,70-defs)" root="." est_tokens="3150" budget_tokens="6000"> +<!-- ripwire pack-task schema=ripwire.pack-task/v1: one-call task bundle for task= under budget_tokens=: <sigs> +<d n= sc= l= p=> ranking, <far> +<s t= n= p=> ranked but over 1 hop out (of_top= ranked rows) > <bodies> +<b t= n= p= l=> with <calls> +<c n= l= p=> callees > <callers> +<s rel=caller|callee shared=> 1-hop from the bodies (of_top= bodies; shared= bodies reached, absent at 1) > notes > <tests> +<test p= run=> (run= when derivable). window: shown= total= capped= (capped=1 cut). est_tokens=: price as emitted (an upper bound under compact). root=: p= relative to it. <d r=N>: rank N in this ranking, rows in r= order. <d cx= ccx=>: cyclomatic/cognitive complexity. <d in=N>: N callers in the ind … [line truncated: 485 more bytes on this line] +<!-- ledger: budget=12744 bytes (6000-token target, ceiling 14160) | ranking: full | bodies: kept 5 of 6 (capped) | callers: 11 of 11 | notes: none | tests: none | far: 6 of 6 --> +<sigs> +<d l="3288" n="printUsage" sc="rw" p="src/cli.h" cx="1" ccx="0" in="1" r="1" next="--expand=src/cli.h:printUsage"> +<doc>Print the authoritative CLI usage and flag catalog to the caller-provided output stream</doc>inline void printUsage( std::FILE* out ) noexcept</d> +<d l="490" n="wrapCliAddPost" sc="rw" p="src/wrap.h" cx="4" ccx="2" in="1" r="2"> +<doc>claude's `mcp add … -- ripwire --mcp`: the flag goes on the end of that command line, ahead of its newline</doc>inline std::string wrapCliAddPost( const AgentTarget& row, std::string_view toolsArg )</d> +<d l="111" n="AgentTarget" sc="AgentTarget" p="src/wrap.h" cx="0" ccx="0" in="0" r="3">struct AgentTarget</d> +<d l="746" n="wrapEmitCliFirst" sc="rw" p="src/wrap.h" cx="10" ccx="5" in="1" r="4"> +<doc>ONE recipe path for every agent that can shell out, and the point is that the RECOMMENDATION does not vary by agent — only the MCP alternative does. Before this there were four near-identical CLI-fi</doc>inline void wrapEmitCliFirst( const AgentTarget& row, const std::string& token, c … [line truncated: 83 more bytes on this line] +<d l="473" n="wrapWritesToolsArg" sc="rw" p="src/wrap.h" cx="6" ccx="1" in="3" r="5"> +<doc>mcp-tools pass-through. Written into the server command only where its argument shape is known to be one more plain argument: the JSON args arrays (cursor/windsurf/gemini), opencode's command array</doc>inline bool wrapWritesToolsArg( const AgentTarget& row ) noexcept</d> +<d l="3593" n="kJsonShapeModifiers" p="src/main.cpp" cx="0" ccx="0" in="0" pure="1" r="6"> +<doc>B1.4: the output-SHAPE members of the list above, as a table rather than a second if-chain. A flag in here selects an ENCODING for rows some verb already produced, so "--json is not supported for X</doc>inline constexpr std::string_view kJsonShapeModifiers[] =</d> +<far of_top="12" shown="6" total="6" capped="0"> +<s t="fn" n="cliRefusesFileList" p="src/situ.h:213"/> +<s t="fn" n="classNewGroupXml" p="src/testmap.h:2051"/> +<s t="fn" n="fileSubjectNote" p="src/forfilepage.h:711"/> +<s t="fn" n="callHierarchyPageNext" p="src/nextverb.h:216"/> +<s t="fn" n="toUint" p="src/tracein.h:103"/> +<s t="cls" n="McpValueSpec" p="src/mcprefusal.h:268"/> +</far> +</sigs> +… [54 more display lines; full output is 9043 bytes on 46 raw line(s)] +````` + +## `./build/ripwire . --pack-task="add a new output format flag to the CLI" --partition=3` + +*Fan-out form: one shared core + 3 per-agent slices carved along call-graph communities.* + +````` +<ctx-partitions schema="ripwire.pack-task/v1" partitions="3" requested="3" core_symbols="6" surface="42" modules="23" split="0" budget_per_agent_tokens="6000" core_budget_tokens="2040" partition_budget_tokens="3960" total_bytes="20871" overlap_mean="0.010" overlap_max="0.031" shared_symbols="2" unio … [line truncated: 36 more bytes on this line] +<!-- ripwire pack-task schema=ripwire.pack-task/v1: N minimally overlapping agent bundles carved along call-graph communities plus one shared core; each <bundle> wraps a <ctx>; bundle role=core|partition i= symbols= modules= bytes= tokens=: one agent's ctx, symbols= ids assigned, bytes= its size; tokens= = est_tokens= = bytes/2.36 (flat, the densest rate; the inner ctx est_tokens= is language-weighted). Inner ctx task= root= budget_tokens= dropped_positive=: the task, p= base, the slice's token target, ranked candidates its budget cut. of_top=: rows ranked (far) / bodies (callers); s rel=caller|callee shared=: 1-hop edge, bodies reached (absent at 1). window: shown= total= capped= (capped=1 cut). run_unknown=1: no runner derivable (a guess would be worse). est_tokens=: price as emitted (an upper bound under compact). <d r=N>: rank N in this ranking, rows in r= order. <d cx= ccx=>: cyclomatic/cognitive complexity. <d in=N>: N callers in the index (absent: not measured). route=: the ranker: name-exact(X) = the task names symbol X (anchors: its evidence), subtoken+body = conceptual BM25 (:broad = 1-2 plain words, plain rg may also win; :declined(...) = a name hit refused as a common name). sc=: enclosing scope; the full id is p::sc::n (p= of the row or its <f>) and selectors take it. next=: the one pasteable follow-up. pure=1: const/constexpr signature (Swift: non-mutating) and no transitive side effect found; a hint. partitions=/requested=: partitions carved / asked for. modules=/split=: call-graph groups found / cuts forced to split one. core_symbols=/surface=: ids in the shared core / core plus the assignable remainder. budget_per_agent_tokens=: one agent's budget, core_budget_tokens= plus partition_budget_tokens=. total_bytes=N: bytes of all bundles together. overlap_mean=/overlap_max=: pairwise Jaccard over the ids partitions name, before trimming. shared_symbols=/union_symbols=: ids two or more partitions name / ids any partition names. core_overlap=: share of the core surface a partition reaches anyway. c p=: the file a body callee's l= is in, printed when it is not the b row's own (no p=: the b's file). --> +<bundle role="core" symbols="6" bytes="2738" tokens="1160" est_tokens="1160"> +<ctx task="add a new output format flag to the CLI" route="subtoken+body:declined(add;218-carriers,70-defs)" root="." dropped_positive="2" est_tokens="938" budget_tokens="2040"> +<!-- slice budget=4332 bytes (2040-token target, ceiling 4814) | ranking: capped | bodies: kept 2 of 6 (capped) | callers: kept 1 of 11 | notes: none | tests: none | far: none --> +<sigs shown="4" total="6" capped="1"> +<d l="3288" n="printUsage" sc="rw" p="src/cli.h" cx="1" ccx="0" in="1" r="1" next="--expand=src/cli.h:printUsage"> +<doc>Print the authoritative CLI usage and flag catalog to the caller-provided output stream</doc>inline void printUsage( std::FILE* out ) noexcept</d> +<d l="490" n="wrapCliAddPost" sc="rw" p="src/wrap.h" cx="4" ccx="2" in="1" r="2"> +<doc>claude's `mcp add … -- ripwire --mcp`: the flag goes on the end of that command line, ahead of…</doc>inline std::string wrapCliAddPost( const AgentTarget& row, std::string_view toolsArg )</d> +<d l="111" n="AgentTarget" sc="AgentTarget" p="src/wrap.h" cx="0" ccx="0" in="0" r="3">struct AgentTarget</d> +<d l="746" n="wrapEmitCliFirst" sc="rw" p="src/wrap.h" cx="10" ccx="5" in="1" r="4"> +<doc>ONE recipe path for every agent that can shell out, and the point is that the RECOMMENDATION doe…</doc>inline void wrapEmitCliFirst( const AgentTarget& row, const std::string& token, const std::string_view executablePath, const WrapListing& listing ) noexcept</d> +</sigs> +<bodies shown="2" total="6" capped="1"> +<b t="fn" l="3288" p="src/cli.h" n="printUsage"> +<![CDATA[inline void printUsage( std::FILE* out ) noexcept { printUsageTier( out, HelpTier::Full, {} ); }]]> +<calls total="1"> +<c n="printUsageTier" l="3278">inline bool printUsageTier( std::FILE* out, HelpTier tier, std::string_view want ) noexcept</c> +</calls> +</b> +<b t="fn" l="490" p="src/wrap.h" n="wrapCliAddPost"> +<![CDATA[inline std::string wrapCliAddPost( const AgentTarget& row, std::string_view toolsArg ) +{ + std::string post( row.mcpAddPost ); + if( !toolsArg.empty() && wrapWritesToolsArg( row ) && post.ends_with( '\n' ) ) + { + post.insert( post.size() - 1, " " + std::string( toolsArg ) ); + } + return post; +… [89 more display lines; full output is 23791 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.* + +````` +<ctx task="pagerank power iteration" route="subtoken+body" root="." confidence="high" margin_pct="22" at="914c4045d" doc_mentions="4" schema="ripwire.for/v1" bundle="compact" bodies="0" reason="compact-route" budget_bytes="7500" doc_mentions_capped="1" doc_mentions_total="14" est_tokens="8311"> +<!-- ripwire for schema=ripwire.for/v1: bundle=/bodies=/reason= the body posture; d: cx= ccx= complexity, in= callers (absent cx/ccx/in = 0), churn= amp= change, clone= tested= 1, sc= scope, id=p::sc::n; total= shown= capped=1 if cut; task= the query; d pure=1 const/constexpr sig, next= the follow-up to paste; d same_as=N: doc+sig text as row n=N (not repeated); route= name-exact(X)|subtoken+body[:broad|:declined]; confidence=/margin_pct= head score drop (low=flat); h l= p= n=, c n= l= p= (p= if not h's; same-named joined, shown= counts them), noedge= no callee resolved; fold kind=bodies: b t= n= p= l= top ranked rows' whole bodies, not the answer; served= of total= in budget_bytes=; slice/skip p= n= l=; skip bytes= next=; a skip makes sigs next= it, sigs_next= the signatures-only re-call; d mem= an owner's direct member names only, by the index (question words first, then owner's file, path, line, name), mem_more= names cut; t p= file outside sigs (weaker), t sym= its top symbols not in sigs/syms (a pointer, not the answer), r= rank (gap = trimmed); t tsym= up to 2 more file symbols named by a task word (a name match); t order: code files first, then doc files (a code question); t page rows go on to file-page row 160 (code question: 160 code rows, docs within row 160); past page 0 (code question: past 40 code rows, a doc past row 40) listed last, head files skipped; past 120 of those p= only, p_only= counts them; t folded=class=N: N p= only rows of that class (doc|config|script|testdata|other) not listed, next= pages to them; d layer=: built-in arch layer (game|infra|render|math|audio|ai|test) from a dir name in p=; d e= its last line (absent=unknown, never 0; l= the name's line); c prov=split: a resolver split arm; may be another arm's (NOT a claim the edge is false) [doc mentions: 4 docs, 2 symbols; doc_mentions=] --> +<!-- root= is the crawl root; p= below is RELATIVE to it (single-root only; absent => p= is ingest's own path, unchanged); at=this commit(+dirty). [budget_bytes= is the default BYTE target this ranked payload was shaped toward: row text shortens toward it, no row of the ranked head is removed for it (sigs past_target=)] [sigs capped=1 with shown=total: rows shrunk, none dropped] [sigs past_target=K: the last K rows are past the budget_bytes target, served because they are rows of the ranked head; none is cut] [sigs sigs_next=: one call serving all total= rows uncut] [docs_dropped=N: N shown rows have a doc comment not printed (r>24 always, r5..24 if capped)] [docs_after_code=N: N doc rows of the shown set moved below its code rows; same rows, reordered, none added or removed; a question naming docs keeps score order] [files_first=N: N rows moved so r=1..8 are distinct files' best rows, score order, a repeated name once; same rows; fold, hops keep score order] [cut: doc_mentions_capped="1" doc_mentions_total="14" — an indexing cap dropped content not shown here]; lego/compose collapse to a counted stub by default (a disclosed cut): total= that section's own pre-cap row count, shown="0" capped="1" (nothing rendered here), next= names the sections=lego,compose flag that restores both sections byte-identically in one call est_tokens= prices this bundle in tokens --> +<sigs shown="40" total="40" capped="1" past_target="14" docs_dropped="25" docs_after_code="5" files_first="7" sigs_next="--for='pagerank power iteration' --signatures-only --token-budget=6200" next="--expand=src/prconverge.h:73:renderDisclosure"> +<d l="422" e="422" n="kScoreTieAbsEps" sc="rw" p="src/eval.h" churn="18" amp="51" pure="1" r="1" next="--expand=src/eval.h:kScoreTieAbsEps"> +<doc>NodeId order. Renumbering an otherwise-identical graph (the exact "same probe file, different so…</doc>inline constexpr float kScoreTieAbsEps = 1e-6f</d> +<d l="51" e="56" n="RankDisclosure" sc="RankDisclosure" p="src/prconverge.h" churn="3" amp="27" r="2"> +<doc>What a ranked document discloses about the power iteration that ordered it. `isPageRank == false…</doc>struct RankDisclosure</d> +<d l="99" e="206" n="pageRankDouble" sc="rw" p="src/pagerank.cpp" cx="19" ccx="34" in="2" churn="14" amp="44" tested="1" r="3"> +<doc>The PageRank power iteration itself — the numeric kernel every ranked document's order comes f…</doc>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] +<d l="503" e="549" n="rankByText" sc="rw" p="src/mcpverbs.h" cx="11" ccx="19" in="1" churn="676" amp="692" r="4">inline std::string rankByText( const std::string& root, std::string_view mode, int topK, bool stable = false )</d> +<d l="14912" e="14917" n="RankedGraph" sc="RankedGraph" p="src/graph.h" churn="732" amp="983" r="5">struct RankedGraph</d> +<d l="2578" e="2582" n="kChurnRankLegend" sc="rw" p="src/serialize.h" churn="521" amp="626" pure="1" r="6">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…</d> +<d l="1372" e="1393" n="sliceRdIterationCeiling" sc="slicev" p="src/slice.h" cx="9" ccx="12" in="1" churn="54" amp="103" r="7">inline std::uint32_t sliceRdIterationCeiling() noexcept</d> +<d l="31" e="44" n="PageRankRun" sc="PageRankRun" p="src/pagerank.h" churn="8" amp="37" r="8" mem="disclose">struct PageRankRun</d> +<d l="73" e="144" n="renderDisclosure" sc="rw" p="src/prconverge.h" cx="12" ccx="15" in="15" churn="3" amp="42" r="9"> +<doc>Render one form of the disclosure. Empty string whenever there is nothing to say — no power it…</doc>inline std::string renderDisclosure( const RankDisclosure& d, DiscloseAs as )</d> +<d l="18200" e="18209" n="navRelevanceWeight" sc="rw" p="src/graph.h" cx="2" ccx="1" in="2" churn="732" amp="985" r="10">inline std::uint32_t navRelevanceWeight( const Graph& g, NodeId n ) noexcept</d> +<d l="1247" e="1247" n="kPowerShellPathPrependScope" sc="rw::oswin" p="src/infra/os_win32_logic.h" layer="infra" churn="20" amp="50" pure="1" r="11">inline constexpr std::string_view kPowerShellPathPrependScope = "in PowerShell, for this window</d> +<d l="14921" e="14949" n="rankGraphTeleport" sc="rw" p="src/graph.h" cx="5" ccx="8" in="7" churn="732" amp="990" r="12">inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>& p, float alpha = 0.85f )</d> +<!-- demote: a <t> in sigs is a lower same-file sibling past answer row 10, a pointer (p= file, sym= name, r= rank), not the answer --> +<t p="src/infra/os_win32_logic.h" sym="powerShellPathPrependHint" r="13"/> +<d l="1255" e="1255" n="path_prepend_hint" sc="rw::os" p="src/infra/os.h" layer="infra" cx="1" in="1" churn="43" amp="94" r="14">inline std::string path_prepend_hint( std::string_view dir )</d> +<t p="src/infra/os_win32_logic.h" sym="powerShellSingleQuote" r="15"/> +<d l="2198" e="2206" n="dynamic_map::leftmost_leaf" p="src/infra/dynamic_map.hpp" layer="infra" cx="2" ccx="1" in="7" churn="7" amp="38" pure="1" r="16">handle_t leftmost_leaf() const</d> +<d l="58" e="91" n="HOT_FILES" p="scripts/optremarks.py" churn="22" amp="86" r="17">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] +<d l="294" e="299" n="doctorPathPrependLine" p="src/verbs_doctor.h" cx="2" ccx="1" in="2" churn="51" amp="151" r="18">inline std::string doctorPathPrependLine( const std::string& selfPath )</d> +<t p="src/infra/dynamic_map.hpp" sym="reverse_iterator" r="19"/> +<t p="src/verbs_doctor.h" sym="doctorWhichRipwire" r="20"/> +<t p="src/serialize.h" sym="rankByLegendFor" r="21"/> +… [166 more display lines; full output is 20893 bytes on 15 raw line(s)] +````` + +## `./build/ripwire . --export=cc.json:<scratch>/aux/ripwire2.cc.json` + +*Per-file metrics as CodeCharta cc.json.* + +**wall time: 1.12s** + +````` +(empty) +````` + +Artifact written: + +````` + 741947 <scratch>/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 +````` + +## `./build/ripwire . --batch=<scratch>/aux/batch2.txt` + +*One-turn sweep: 4 newline-delimited verb:arg sub-queries answered in ONE deduped <batch>.* + +**wall time: 1.82s** + +Input file: + +````` +for:incremental cache invalidation +callers:rankGraphTeleport +grep:DISCLOSE +lego:Vehicle +````` + +````` +<batch schema="ripwire.batch/v1" n="4" requested="4" cap="16"> +<!-- ripwire batch schema=ripwire.batch/v1: n= read sub-queries in one sweep (requested=, cap=): each <q> wraps one sub-answer verbatim in CDATA. i=/verb=/ok=: sub-query index, its verb text, 1 answered (payload in CDATA) or 0 failed. <file-scope> (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. --> +<q i="0" verb="for" ok="1"> +<![CDATA[<ctx task="incremental cache invalidation" route="subtoken+body" root="." confidence="low" margin_pct="0" at="914c4045d" doc_mentions="3" bundle="sigs" lens="churn,amp,tested" budget_bytes="7500" est_tokens="9860"> +<!-- ripwire lens for "incremental cache invalidation" [doc mentions: 3 docs discussing 2 top-ranked symbols surfaced; doc_mentions= on the root repeats the doc count]: reusable building blocks (cx=complexity, in=reuse-count; an absent cx/ccx/in is 0) — prefer composing/reusing these over reimplementing; sc=scope (full id p::sc::n); route= name-exact(X)|subtoken+body[:broad|:declined]; bundle=sigs: signatures only in this bundle, no inline bodies — fetch a symbol's full body with the fetch_body verb [confidence= derives from the ranked head's largest relative score drop (margin_pct=, whole percent, 0 = none; the same gap the adaptive flag cuts at). low = flat ranking: treat the set as a starting point, not an answer]; lens="churn,amp,tested": the three per-row quality columns the CLI for lens carries and this dialect does NOT (they need a git and a quality pass this server does not run per request); an absent column here means NOT MEASURED, never measured-and-zero; est_tokens= prices this bundle in tokens; tail: file-grain rows, WEAKER evidence than the ranked rows: first the positive-score files NOT among the shown sigs rows, the files of trimmed rows first, best-symbol rank order; then the file page's first 40 rows not listed above, file-first (the IDF share of the query's subtokens its top 8 symbols cover); sym= its top symbols by lens rank, minus names a sigs row or the syms block shows (a pointer, not the answer); total=every positive-score file, shown=printed, capped=1 when they differ, next= the page from its first unprinted row. r= on a ranked row is its 1-based rank in this lens ranking, rows in r= order, p= the file (a gap = a budget-trimmed row); tail order on this code question: every code file of both parts first, each part in the order above, then the doc files (.md, .rst, a Sphinx .txt page) in that order; tail walk: the page rows go on to the file page's first 160 rows (a code question: its first 160 code rows, plus the doc rows within its first 160 rows); a row past page 0 (a code question: past its first 40 code rows, a doc past row 40) comes after every page 0 row, skips files the head shows and carries sym= too; past 120 such rows p= only, p_only= counts them; tail folded=class=N: on a code question, N rows past page 0 of that file class (doc, config, script, testdata, other) are not listed, unless the task names the class (adding a new X, or a quoted message, keeps doc and config); next= pages from the first one; e= on a d row: the 1-based line where that definition ends, body-inclusive; absent when the extent is not known (extent_suspect, docs, config), never 0; l= is the line of the definition's name, so a definition can start above l=; lego/compose collapse to a counted stub by default (a disclosed cut): total= that section's own pre-cap row count, shown="0" capped="1" (nothing rendered here), next= names the sections=lego,compose flag that restores both sections byte-identically in one call --> +<!-- root= is the crawl root; p= below is RELATIVE to it (single-root only; absent => p= is ingest's own path, unchanged); at=this commit(+dirty). [budget_bytes= is the default BYTE target this ranked payload was shaped toward: row text shortens toward it, no row of the ranked head is removed for it (sigs past_target=)] [sigs capped=1 with shown=total: rows shrunk, none dropped] [sigs past_target=K: the last K rows are past the budget_bytes target, served because they are rows of the ranked head; none is cut] [sigs next_budget_tokens=: call this tool again with that budget_tokens to get all total= rows uncut] [docs_dropped=N: N shown rows have a doc comment not printed (r>24 always, r5..24 if capped)] [docs_after_code=N: N doc rows of the shown set moved below its code rows; same rows, reordered, none added or removed; a question naming docs keeps score order] [files_first=N: N rows moved so r=1..8 are distinct files' best rows, score order, a repeated name once; same rows; fold, hops keep score order] --> +<!-- <d cx= ccx=>: cyclomatic/cognitive complexity. layer=: built-in arch layer (game|infra|render|math|audio|ai|test) from a dir name in p=; absent if none. task=: the query. d n= l=: the symbol's name and def line. d pure=1: const/constexpr signature (Swift: non-mutating) and no transitive side effect found; a hint. --> +<sigs shown="40" total="40" capped="1" past_target="10" docs_dropped="14" docs_after_code="1" files_first="9" next_budget_tokens="5700"> +<d l="153" e="153" n="kCacheMagic" p="src/ingest_cache.h" pure="1" r="1" next="--expand=src/ingest_cache.h:kCacheMagic"> +<doc>incremental cache (--cache): per-file content hash + raw facts so a re-run re-parses ONLY c…</doc>constexpr std::uint32_t kCacheMagic = 0x4b505443</d> +<d l="1588" e="1593" n="spanTierMemoPath" sc="rw" p="src/ingest_astquery.h" cx="1" in="3" r="2"> +<doc>Composed exactly the way every OTHER blob family is (quality.h): one fixed-width identity hex pe…</doc>inline std::string spanTierMemoPath( const std::string& diskPath )</d> +<d l="906" e="909" n="mcpRefreshedThisRequest" sc="rw" p="src/mcpindex.h" cx="1" in="2" r="3"> +<doc>P1-15 — the `_reingest` envelope field for a response whose handling ran an INCREMENTAL pass, …</doc>inline bool mcpRefreshedThisRequest( std::uint64_t passesAtEntry )</d> +<d l="277" e="306" n="ingestCommitTree" sc="rw::dmm" p="src/dmm.h" cx="6" ccx="5" in="1" r="4"> +<doc>Ingest the tree at `sha`, materialized out of `root`'s object store. The HEAD side reuses the SA…</doc>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] +<d l="2495" e="2510" n="FileHealth" sc="FileHealth" p="src/model.h" r="5">struct FileHealth</d> +<d l="10321" e="10352" n="legoImplementorsOnSurface" sc="rw" p="src/serialize.h" cx="10" ccx="13" in="2" r="6">inline std::vector<std::vector<NodeId>> legoImplementorsOnSurface( const IngestResult& ing, const std::vector<std::vector<NodeId>>& implementors, const std:: … [line truncated: 10 more bytes on this line] +<d l="5409" e="5519" n="computeHeadSnapshot" sc="quality" p="src/quality.h" cx="19" ccx="21" in="3" r="7">inline std::pair<Snapshot, bool> computeHeadSnapshot( const std::string& root, const std::string_view* cacheNever = nullptr, std::size_t maxFileBytes = kDefault…</d> +<d l="1006" e="1212" n="runParsePool" p="src/ingest_parsepool.h" cx="25" ccx="54" in="1" r="8">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] +<d l="779" e="786" n="mcpRebuildBaseline" sc="rw" p="src/mcpindex.h" cx="2" ccx="1" in="1" r="9">inline McpRebuildBaseline mcpRebuildBaseline( const McpIndex& ix, bool isIncrementalPass )</d> +<d l="938" e="945" n="mcpFreshFields" sc="rw" p="src/mcpindex.h" cx="2" ccx="1" in="1" r="10">inline std::string mcpFreshFields( std::uint64_t passesAtEntry )</d> +<!-- demote: a <t> in sigs is a lower same-file sibling past answer row 10, a pointer (p= file, sym= name, r= rank), not the answer --> +<t p="src/mcpindex.h" sym="getIndex" r="11"/> +<t p="src/mcpindex.h" sym="McpIndex" r="12"/> +<d l="1103" e="1116" n="receiptNextFor" sc="mcpedit" p="src/mcpedit.h" cx="4" ccx="3" in="1" r="13">inline std::string receiptNextFor( const std::string& fileIdentity, const std::string& symbolName, const std::string& foldJson, const std::string& firstTestRun )</d> +<d l="177" e="186" n="AncestorCacheScope::AncestorCacheScope" p="src/infra/tsparent.h" layer="infra" cx="2" ccx="1" r="14">AncestorCacheScope( TSNode root, bool enabled ) : previous( tAncestorCache )</d> +<t p="src/infra/tsparent.h" sym="AncestorCacheScope" r="15"/> +<d l="240" e="243" n="cacheArtifactVerdict" sc="rw" p="src/ingest.cpp" cx="1" in="1" r="16">const char* cacheArtifactVerdict( const std::string& path, bool captureValueUses )</d> +<d l="27" e="31" n="parentCacheOn" p="src/ingest_sidecap.h" cx="1" r="17">inline bool parentCacheOn()</d> +… [236 more display lines; full output is 60641 bytes on 1 raw line(s)] +````` + + +--- + +# self-diagnosis + +## `./build/ripwire . --doctor` + +*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: 5.94s** + +````` +<!-- ripwire doctor schema=ripwire.doctor/v1: setup health: <c n= ok=> checks; exit 1 when one fails. at=: commit+dirty+shallow. n=: the check's name (binary-path, grammars, cache-dir, git, tree-sitter, index-cache, layout ...). loaded=/expected=: grammars whose tags query compiled / grammars compiled in; a shortfall fails the row. dir=: the per-user cache directory scanned (TMPDIR/XDG_CACHE_HOME ladder); unwritable fails the row. blobs=N: ripwire cache blobs in dir=; the scan stops at 4096 (blobs_floor=1 then). bytes=N: total size in bytes of the blobs counted (short when truncated=1). many=1: more than 50 blobs; an eviction-sanity flag, informational, never fails the row. truncated=1: cache-dir, blob scan cut (cap or I/O error); tracked-binaries, scan SKIPPED, stale=0 unmeasured. locks=N: advisory edit-lock files under locks/; unheld ones over a day old are swept on a cache write. volatile=: this row's attributes that read LIVE machine state; a determinism diff strips them, never the row. git=0|1: git runs from PATH; 0 fails the row (churn verbs need it). repo=0|1: the root is inside a git work tree; 0 is a diagnosis, not a failure. history=0|1: the repo has at least one commit; head= prints only when it does. head=: HEAD's short sha (9 hex, the at= width). core_abi=/cpp_grammar_abi=: tree-sitter core language ABI / the C++ grammar's ABI; informational. languages=N: distinct compiled-in grammars (the grammars row's expected=). tracked=N: git ls-files count, printed even when truncated=1 (over 20000 files skips the scan). binaries=N: tracked paths that sniff as binary content. non_git=1: no git history to compare; the row passes unscanned. stale=N: tracked binaries committed before a same-dir same-stem source changed; any fails the row. cache_version=/parser_ver_lean=/parser_ver_rich=/artifact_arch=: index identity; reuse needs all four. rich_verbs=: the verbs that consume the rich artifact (rich=); every other verb reads the lean one. source=: auto (per-root blob), cache-flag (named by the cache flag) or disabled (no-cache: nothing read). lean_path=/rich_path=: the artifact files checked; one path when the cache flag named it. lean=/rich=: can THIS binary open that artifact (ok, absent, parser-version ...); format, never freshness. fsmonitor=: the checkout's core.fsmonitor at startup: unset, builtin, off, or hook (a command git runs). neutralised=1: a hook fsmonitor was overridden to false for this run; 0 when none was needed. filter_drivers=N: filter drivers the repository's own config defines; filter_scope= local|all, filter_pinned= 1 (run with an empty command) or refused. state=: layout records agree, disagree (mixed binary: rebuild clean-first), not-checked or no-records. checked=1: the cross-unit layout comparison ran; 0 = under two comparable records. units=N: translation units that registered a layout record. types=N: layout types recorded (only those registered in src/model.h); omitted on state=disagree. checks=/passed=: checks run / how many passed; exit 1 when passed= is below checks=. built_from=: the commit this binary was built from; at= is the tree HEAD now, a mismatch is normal. self=/which=: this binary's path and the one which ripwire finds on PATH; which_version= is the version line that one prints when they differ. on_path=0|1: whether a ripwire is on PATH; 0 fails the row and hint= carries the export line. same_file=1: the PATH copy is this very file (same device and inode). same_bytes=1: a different file with identical content, a copied install (ok); 0 fails the row; unknown: a file was unreadable; the row fails unverified (hint= names it). self_mtime=/self_size=/which_mtime=/which_size=: epoch mtime and byte size of each binary. hint=: the row's verdict and fix in plain text (which binary is stale, what to run). --> +<doctor schema="ripwire.doctor/v1" checks="9" passed="8" at="914c4045d" built_from="914c4045d"> +<c n="binary-path" ok="0" self="./build/ripwire" which="<path>" on_path="1" same_file="0" same_bytes="0" self_mtime="1795336538" self_size="65732168" which_mtime="1793517843" which_size="58197960" which_version="ripw … [line truncated: 525 more bytes on this line] +<c n="grammars" ok="1" loaded="27" expected="27"/> +<c n="cache-dir" ok="1" dir="<tmp>" blobs="213" bytes="2000864999" many="1" truncated="0" locks="225" volatile="blobs,blobs_floor,bytes,many,truncated,locks"/> +<c n="git" ok="1" git="1" repo="1" history="1" head="914c4045d"/> +<c n="tree-sitter" ok="1" core_abi="15" cpp_grammar_abi="14" languages="27"/> +<c n="tracked-binaries" ok="1" tracked="5597" binaries="33" non_git="0" truncated="0" stale="0"/> +<c n="index-cache" ok="1" cache_version="54" parser_ver_lean="337" parser_ver_rich="338" artifact_arch="16" rich_verbs="for,uses,metrics,exemplar,context-ratio,nonlocal-state,quality-panel,verify,eval-retrieval,eval-mined,eval-skills" source="auto" lean_path="<tmp> … [line truncated: 219 more bytes on this line] +<c n="git-config-trust" ok="1" fsmonitor="unset" neutralised="0" filter_drivers="0"/> +<c n="layout" ok="1" state="agree" checked="1" units="2" types="12"/> +</doctor> +````` + + +--- + +# security + +## `./build/ripwire --scan-skill=skills/ripwire-orient/SKILL.md` + +*Scan a single skill file for injection/exfiltration patterns before installing.* + +````` +<!-- ripwire scan-skills schema=ripwire.scan-skills/v1: injection/exfiltration/path-traversal scan of skill files: files= findings= skipped= verdict=. files=N: files scanned (unscannable ones are skipped=). findings=N: pattern hits; rows print up to 200 (shown= capped=1 past that). verdict=clean|warn|critical: the worst finding's severity, the same as exit 0/1/2. --> +<skillscan schema="ripwire.scan-skills/v1" files="1" findings="0" verdict="clean"> +</skillscan> +````` + +stderr: + +````` +ripwire scan: 0 finding(s) in skills/ripwire-orient/SKILL.md +````` + +## `./build/ripwire --scan-skills=skills` + +*Scan a whole skills directory (exit 2 = CRITICAL, 1 = WARN). Explicit-DIR form only.* + +````` +<!-- ripwire scan-skills schema=ripwire.scan-skills/v1: injection/exfiltration/path-traversal scan of skill files: files= findings= skipped= verdict=. files=N: files scanned (unscannable ones are skipped=). findings=N: pattern hits; rows print up to 200 (shown= capped=1 past that). verdict=clean|warn|critical: the worst finding's severity, the same as exit 0/1/2. --> +<skillscan schema="ripwire.scan-skills/v1" files="26" findings="0" verdict="clean"> +</skillscan> +````` + +stderr: + +````` +ripwire scan: 0 finding(s) total (26 skill file(s) scanned, 0 unscannable file(s) skipped, 0 denylisted subtree(s) not descended) +````` + + +--- + +# knobs / modes + +## `./build/ripwire . --rank-by=churn --top-k=5` + +*Rank by git change-frequency prior instead of PageRank.* + +**wall time: 1.39s** + +````` +<!-- ripwire map schema=ripwire.map/v1: ranked symbol map: <f p= layer=> groups <s t= n= sc= k= amb=> rows (k= rank), <c n=> resolved callees; the header comment is data. est_tokens=: price as emitted (an upper bound under compact). at=: commit+dirty+shallow. root=: p= relative to it. pr_iters=N: PageRank iterations. rank_by=: the ranker behind k=. window=: the git span mined. 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. overloads=N: N same-name defs merged in this row; shown= counts each. 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. sc=: enclosing scope; the full id is p::sc::n (p= of the row or its <f>) and selectors take it. --> +<!-- t=modscope=a-file's-MODULE-SCOPE(n=<file-scope>):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 --> +<!-- t=type|alias|functype=a-Go-named-type-by-its-written-form:type=a-defined-type-whose-WRITTEN-form-is-not-a-struct/iface/func-literal(type-N-string;type-W-Pair-too,whatever-Pair-is-underneath),alias=type-A=B,functype=type-F-func(...) --> +<!-- t=alias|functype-in-C++-and-.h:alias=using-X=Y(also-templated-or-class-scope)or-namespace-L=lib(defs=X-prints-its-written-target-as-to=),functype=a-typedef-of-a-function-or-function-pointer-type(typedef-void(*F)(int));other-typedefs-read-t=struct --> +<!-- files=4852 symbols=45031 edges=45381 shown=5 est_tokens=1268 ambiguous=3984 unresolved=20100 locality_pinned=14 external=12460 declined=45307 extent_suspect_syms=12 macro_blanked_files=7 skipped_oversize=15 unindexed="txt:85,tsv:54,mod:33,xml:33,jsonl:26,scm:25" unindexed_exts=23 order=important-first --> +<r schema="ripwire.map/v1" at="914c4045d" root="." rank_by="churn" window="18mo@HEAD" est_tokens="1268" pr_iters="22"> +<f p="src/resolve.h"> +<s t="method" n="appendUint" sc="Narrower" k="0.0038"> +</s> +</f> +<f p="src/infra/enumcount.h" layer="infra"> +<s t="fn" n="enumTableAt" sc="rw" k="0.0034"> +</s> +</f> +<f p="src/infra/Diagnostics.h" layer="infra"> +<s t="macro" n="RW_ASSUME_" overloads="2" k="0.0032"> +<c n="RW_CHECK_"/> +</s> +</f> +<f p="src/model.h"> +<s t="fn" n="relForHash" sc="rw" k="0.0032"> +</s> +</f> +</r> +````` + +## `./build/ripwire . --rank-by=churn-decay --since=HEAD~12 --exclude=test --exclude=docs --exclude=skills --exclude=changelog.d --in=src --limit=2` + +*Scope the recent-changes answer to ONE directory. The global <recent> block stays byte-identical, a second <recent scope="src"> 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 <symbols stubbed="1" would_show= next=/> 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. This page holds 2 row(s), not the usual 3: no change window on this branch held enough src/ files for a larger page to cut, so the generator fell back to a smaller one (see chooseInWindow).* + +**wall time: 1.68s** + +````` +<!-- ripwire map schema=ripwire.map/v1: ranked symbol map: <f p= layer=> groups <s t= n= sc= k= amb=> rows (k= rank), <c n=> resolved callees; the header comment is data. window: capped= has_more= next_offset= (capped=1 cut; next_offset= pastes as offset=). est_tokens=: price as emitted (an upper bound under compact). at=: commit+dirty+shallow. root=: p= relative to it. rank_by=: the ranker behind k=. window=: the git span mined. declined=K: K calls left unbound (no evidence chose one def). external=K: K calls proven outside the tree, no edge. locality_pinned=K: K calls pinned by locality alone (a guess). <recent n= of=>: the n= newest-touched of of= touched files; <rc age_d=> days since its last commit, w= decayed weight. merge_bombs_skipped=N: N commits touching more than 100 INDEXED files skipped, uncounted; a file only they touched is absent; the window's count, so the global block only. <recent scope=DIR>: a second block riding when the global one does, DIR's files only (p= root-relative); of= is its total; capped=/has_more=/next_offset=/offset=/limit= page it, next= is that page. <symbols stubbed=1 would_show=N next=>: the symbol map in= did not ask for was not rendered; N is that run's own shown= — definitions counted individually as shown= counts them, so its rows follow from rows+sum(overloads-1)=shown (not the header's symbols= corpus count); next= fetches it. 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. next=: the one pasteable follow-up. --> +<!-- t=modscope=a-file's-MODULE-SCOPE(n=<file-scope>):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 --> +<!-- t=alias|functype-in-C++-and-.h:alias=using-X=Y(also-templated-or-class-scope)or-namespace-L=lib(defs=X-prints-its-written-target-as-to=),functype=a-typedef-of-a-function-or-function-pointer-type(typedef-void(*F)(int));other-typedefs-read-t=struct --> +<!-- files=648 symbols=23039 edges=31083 shown=0 est_tokens=1467 ambiguous=2764 unresolved=5488 locality_pinned=9 external=8312 declined=40001 skipped_oversize=15 unindexed="tsv:43,txt:26,scm:25,jsonl:23,expected:15,lock:7" unindexed_exts=12 order=important-first --> +<r schema="ripwire.map/v1" at="914c4045d" root="." rank_by="churn-decay" window="HEAD~12 half-life=90d" est_tokens="1467"> +<recent n="3" of="3" merge_bombs_skipped="0"> +<rc p="src/serialize.h" age_d="0" w="6"/> +<rc p="src/lexical.h" age_d="0" w="3"/> +<rc p="src/ingest_sidecap.h" age_d="0" w="2"/> +</recent> +<recent scope="src" n="2" of="3" capped="1" has_more="1" next_offset="2" offset="0" limit="2" next="--rank-by=churn-decay --since=HEAD~12 --exclude=test --exclude=docs --exclude=skills --exclude=changelog.d --in=src --offset=2 --limit=2"> +<rc p="src/serialize.h" age_d="0" w="6"/> +<rc p="src/lexical.h" age_d="0" w="3"/> +</recent> +<symbols stubbed="1" would_show="200" next="--rank-by=churn-decay --since=HEAD~12 --exclude=test --exclude=docs --exclude=skills --exclude=changelog.d"/> +</r> +````` + +## `./build/ripwire . --rank-by=bogus --top-k=5` + +*An unknown value REFUSES (exit 1), NAMED, with the supported set listed.* + +**exit code: 1** + +````` +(empty) +````` + +stderr: + +````` +ripwire: --rank-by: unknown value 'bogus' (supported: pagerank|authority|hub|rrf|churn|churn-decay) +````` + +## `./build/ripwire . --callers=rankGraphTeleport --format=columnar` + +*Columnar output: paths table + parallel arrays, ~15-60% fewer tokens on MANY-row lists — small results can be LARGER (the columnar legend is a fixed cost).* + +````` +<!-- ripwire callers schema=ripwire.callers/v1: 1-hop CALLERS of of= (defs= matched, count= distinct symbols): <s t= n= p=>; hop_tested=/hop_untested=. counts_floor=1: every count is a FLOOR, never a total. graph_ambiguous=/graph_unresolved=: resolver gauge. graph_unindexed=N: N files no grammar could read (the map header's unindexed=); their calls raise neither gauge. root=: p= relative to it. format=columnar: parallel arrays, not row attributes: <paths> maps I=path, each <cols> array holds n= comma-separated values in one row order, fields= naming them (the path column indexes <paths>; , is a comma). <tested> column: 1 = a non-test row an indexed test transitively reaches; 0 = none found, or a test row. <sites_at> column: each row's leaf-name calls not proven elsewhere, as [file:]line (default: its path), space-separated; not proof each binds. next=: the one pasteable follow-up. --> +<callers schema="ripwire.callers/v1" of="rankGraphTeleport" defs="1" count="7" hop_tested="0" hop_untested="7" root="." graph_ambiguous="3984" graph_unresolved="20100" graph_unindexed="313" counts_floor="1" next="--uses=rankGraphTeleport" format="columnar"> +<paths>0=src/mcpindex.h 1=src/graph.h 2=src/eval.h 3=src/main.cpp</paths> +<cols n="7" fields="path,name,line,kind,tested,sites_at"> +<path>0,1,1,2,3,3,3</path> +<name>getIndex,rankGraph,anchoredLexicalRank,runEval,churnDecayRanking,churnRankedGraph,runDefaultMap</name> +<line>1224,14964,15633,171,1433,1472,1759</line> +<kind>fn,fn,fn,fn,fn,fn,fn</kind> +<tested>0,0,0,0,0,0,0</tested> +<sites_at>1340,14968,15684,328,1447,1486 1487 1501,1879</sites_at> +</cols> +</callers> +````` + +## `./build/ripwire . --for="cache invalidation" --format=candidates --top-k=5` + +*Flat top-K export for an external reranker.* + +````` +<!-- ripwire candidates: flat top K export for an external reranker. r=rank(1 based) s=SCORE n=name id=canonical k=KIND-tag p=path l=line. Note k= is the kind here and the PageRank score in the ranked map; on this row the score is s=. Root: count= rows exported of total= RANKED CORPUS symbols (total is the corpus size, never a match count), capped="1" means the top-k cut dropped some; route= names the ranker (s= is comparable only within one route); anchored= counts query-mention lifts (0 = the anchor ran and moved nothing); weak="1" means the top raw lexical score is below the confidence bar, so these rows rest on thin textual evidence; doc_tier= names the query SHAPE (a pasted trace, a pasted bug-report form) that scored documents down for this run, absent when none did. --> +<candidates count="5" total="45032" capped="1" route="subtoken+body" anchored="0"> +<cand r="1" s="14.7662" n="spanTierMemoPath" id="src/ingest_astquery.h::rw::spanTierMemoPath" k="fn" p="src/ingest_astquery.h" l="1588"> +<sig>inline std::string spanTierMemoPath( const std::string& diskPath )</sig> +</cand> +<cand r="2" s="9.38714" n="legoImplementorsOnSurface" id="src/serialize.h::rw::legoImplementorsOnSurface" k="fn" p="src/serialize.h" l="10321"> +<sig>inline std::vector<std::vector<NodeId>> legoImplementorsOnSurface( const IngestResult& ing, const std::vector<std::vector<NodeId>>& implementors, const std::vector<NodeId>& surfaceIds )</sig> +</cand> +<cand r="3" s="8.12141" n="See the map — not just the numbers" id="README.md::Rip'n Fast. Fewer Tokens. Better Code.::See the map — not just the numbers" k="sec" p="README.md" l="426"> +<sig>### See the map — not just the numbers</sig> +</cand> +<cand r="4" s="7.13298" n="receiptNextFor" id="src/mcpedit.h::mcpedit::receiptNextFor" k="fn" p="src/mcpedit.h" l="1103"> +<sig>inline std::string receiptNextFor( const std::string& fileIdentity, const std::string& symbolName, const std::string& foldJson, const std::string& firstTestRun )</sig> +</cand> +<cand r="5" s="6.95707" n="AncestorCacheScope" id="src/infra/tsparent.h::AncestorCacheScope::AncestorCacheScope" k="fn" p="src/infra/tsparent.h" l="177"> +<sig>AncestorCacheScope( TSNode root, bool enabled ) : previous( tAncestorCache )</sig> +</cand> +</candidates> +````` + +## `./build/ripwire . --callers=rankGraphTeleport --format=bogus` + +*An unknown --format value REFUSES (exit 1), named, with the supported set listed.* + +**exit code: 1** + +````` +(empty) +````` + +stderr: + +````` +ripwire: --format: unknown value 'bogus' (supported: xml|columnar|rows|candidates) +````` + +## `./build/ripwire . --callers=rankGraphTeleport --json` + +*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":3984,"graph_unresolved":20100,"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:15633","sites_at":["15684"]}, +{"t":"fn","n":"runEval","p":"src/eval.h:171","sites_at":["328"]}, +{"t":"fn","n":"churnDecayRanking","p":"src/main.cpp:1433","sites_at":["1447"]}, +{"t":"fn","n":"churnRankedGraph","p":"src/main.cpp:1472","sites_at":["1486","1487","1501"]}, +{"t":"fn","n":"runDefaultMap","p":"src/main.cpp:1759","sites_at":["1879"]}]} +````` + +## `./build/ripwire . --hotspots --json` + +*JSON refusal shape: an unsupported verb refuses loudly instead of silently falling back to XML.* + +**exit code: 1** + +````` +(empty) +````` + +stderr: + +````` +ripwire: --json is not yet supported for --hotspots — supported: the default map, --for, --pack-task, --callers/--callees, --impact, --quality-delta, --test-gate, --metrics, --defs, --flags, and --plan-lanes which is JSON-native (e.g. ripwire <dir> --callers=SYM --json) +````` + +## `./build/ripwire . --hotspots --limit=3 --offset=3` + +*Pagination: 3 items, skipping the first 3 (deterministic seams).* + +**wall time: 1.39s** + +````` +<!-- ripwire hotspots schema=ripwire.hotspots/v1: maintenance pain = churn x ccx over window=: <f p= churn= ccx= score= top= top_ccx= top_l=>; unranked_*= no churn/complexity. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). at=: commit+dirty+shallow. root=: p= relative to it. files=/ranked=: files in the window / those with both churn and complexity; ranked + unranked_no_churn + unranked_no_complexity = files. unranked_no_churn=/unranked_no_complexity=: files left out for no commit in window= / no measured complexity. --> +<!-- extent_suspect_syms=K on a row = K of the file's functions failed an extent/scope containment check (the map, the bundles and the skipped verb mark each one, reasons and all) and are LEFT OUT of that row's ccx=, score= and top=, so its ccx= is a FLOOR of the file's true sum rather than a total. unranked_extent_suspect= counts files with commits whose every scorable function was left out that way (or whose trusted remainder scores 0), so ranked= + unranked_no_churn= + unranked_no_complexity= + unranked_extent_suspect= = files= exactly. Absent = nothing excluded. --> +<hotspots schema="ripwire.hotspots/v1" window="12mo@HEAD" files="4852" ranked="1122" unranked_no_churn="0" unranked_no_complexity="3728" unranked_extent_suspect="2" shown="3" capped="1" total="1122" has_more="1" next_offset="6" offset="3" limit="3" root="." at="914c4045d"> +<f p="src/mcpverbs.h" churn="676" ccx="1369" score="925444" top="runBatchSub" top_ccx="142" top_l="6335"/> +<f p="src/main.cpp" churn="514" ccx="1372" score="705208" top="dispatchMainBody" top_ccx="513" top_l="4711"/> +<f p="src/verbs_for.h" churn="422" ccx="1358" score="573076" top="runForLensPass" top_ccx="706" top_l="3606"/> +</hotspots> +````` + +## `./build/ripwire . --ignore-tests --top-k=5` + +*Drop test paths from the corpus before ranking.* + +````` +<!-- ripwire map schema=ripwire.map/v1: ranked symbol map: <f p= layer=> groups <s t= n= sc= k= amb=> rows (k= rank), <c n=> resolved callees; the header comment is data. est_tokens=: price as emitted (an upper bound under compact). root=: p= relative to it. pr_iters=N: PageRank iterations. <inv listed= unlisted=>: files the ranked rows show / do not (sum = files=), each named or counted below. <entry p= n=>: 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. <ls p= n= f=>: n= unshown files under dir p=; f= names its code files, the rest (tests, docs, config, test/doc/example dirs) counted. declined=K: K calls left unbound (no evidence chose one def). external=K: K calls proven outside the tree, no edge. locality_pinned=K: K calls pinned by locality alone (a guess). macro_blanked_files=K: K files indexed from a macro-blanked re-parse. prov=scip|binding|import|split|final-segment: how that <c> 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. sc=: enclosing scope; the full id is p::sc::n (p= of the row or its <f>) and selectors take it. --> +<!-- t=modscope=a-file's-MODULE-SCOPE(n=<file-scope>):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 --> +<!-- t=alias|functype-in-C++-and-.h:alias=using-X=Y(also-templated-or-class-scope)or-namespace-L=lib(defs=X-prints-its-written-target-as-to=),functype=a-typedef-of-a-function-or-function-pointer-type(typedef-void(*F)(int));other-typedefs-read-t=struct --> +<!-- files=4852 symbols=25025 edges=31933 shown=5 est_tokens=4005 ambiguous=2782 unresolved=5645 locality_pinned=9 external=8610 declined=40564 macro_blanked_files=7 skipped_oversize=15 unindexed="txt:85,tsv:54,mod:33,xml:33,jsonl:26,scm:25" unindexed_exts=23 order=important-first --> +<r schema="ripwire.map/v1" root="." est_tokens="4005" pr_iters="35"> +<f p="src/infra/nodekind.h" layer="infra"> +<s t="fn" n="kindIs" sc="rw" k="0.0046"> +</s> +</f> +<f p="src/ingest_metrics.h"> +<s t="fn" n="nodeTextOf" k="0.0030"> +</s> +</f> +<f p="src/infra/namesplit.h" layer="infra"> +<s t="fn" n="isIdentChar" sc="namesplit" k="0.0029"> +</s> +</f> +<f p="src/model.h"> +<s t="fn" n="relForHash" sc="rw" k="0.0027"> +</s> +</f> +<f p="src/infra/Diagnostics.h" layer="infra"> +<s t="macro" n="RW_ASSUME_" k="0.0025"> +<c n="RW_CHECK_"/> +</s> +</f> +<inv listed="5" unlisted="4847"> +<entry p="scripts/changelog_assemble.py" n="main"> +<c n="repoRoot"/> +<c n="fragmentNames"/> +… [90 more display lines; full output is 9986 bytes on 1 raw line(s)] +````` + +stderr: + +````` +[validate] symbolCount == N && fileCount == ing.files.size() && referenceCount == ing.references.size() is false — warmsnap: the graph section describes another model (warmsnap_graph.h:274, std::optional<Graph> rw::warmsnap::readGraph(Session &, const IngestResult &) — logged once per site) +````` + +## `./build/ripwire . --exclude=present --exclude=bench --top-k=5` + +*Drop matching paths (repeatable) before ranking.* + +````` +<!-- ripwire map schema=ripwire.map/v1: ranked symbol map: <f p= layer=> groups <s t= n= sc= k= amb=> rows (k= rank), <c n=> resolved callees; the header comment is data. est_tokens=: price as emitted (an upper bound under compact). root=: p= relative to it. pr_iters=N: PageRank iterations. <inv listed= unlisted=>: files the ranked rows show / do not (sum = files=), each named or counted below. <entry p= n=>: 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. <ls p= n= f=>: 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 <c> 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). 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. sc=: enclosing scope; the full id is p::sc::n (p= of the row or its <f>) and selectors take it. --> +<!-- t=modscope=a-file's-MODULE-SCOPE(n=<file-scope>):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 --> +<!-- t=type|alias|functype=a-Go-named-type-by-its-written-form:type=a-defined-type-whose-WRITTEN-form-is-not-a-struct/iface/func-literal(type-N-string;type-W-Pair-too,whatever-Pair-is-underneath),alias=type-A=B,functype=type-F-func(...) --> +<!-- t=alias|functype-in-C++-and-.h:alias=using-X=Y(also-templated-or-class-scope)or-namespace-L=lib(defs=X-prints-its-written-target-as-to=),functype=a-typedef-of-a-function-or-function-pointer-type(typedef-void(*F)(int));other-typedefs-read-t=struct --> +<!-- files=4581 symbols=40657 edges=43844 shown=5 est_tokens=4096 ambiguous=3931 unresolved=19137 locality_pinned=14 external=9813 declined=42896 extent_suspect_syms=12 macro_blanked_files=7 unindexed="txt:64,mod:33,xml:33,scm:25,tsv:11,cmake:5" unindexed_exts=18 order=important-first --> +<r schema="ripwire.map/v1" root="." est_tokens="4096" pr_iters="38"> +<f p="src/infra/nodekind.h" layer="infra"> +<s t="fn" n="kindIs" sc="rw" k="0.0034"> +</s> +</f> +<f p="src/ingest_metrics.h"> +<s t="fn" n="nodeTextOf" k="0.0022"> +</s> +</f> +<f p="src/infra/namesplit.h" layer="infra"> +<s t="fn" n="isIdentChar" sc="namesplit" k="0.0021"> +</s> +</f> +<f p="src/model.h"> +<s t="fn" n="relForHash" sc="rw" k="0.0020"> +</s> +</f> +<f p="src/infra/Diagnostics.h" layer="infra"> +<s t="macro" n="RW_ASSUME_" k="0.0019"> +<c n="RW_CHECK_"/> +</s> +</f> +<inv listed="5" unlisted="4576"> +<entry p="scripts/changelog_assemble.py" n="main"> +<c n="repoRoot"/> +… [89 more display lines; full output is 10212 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: 1.15s** + +````` +<!-- ripwire map-diff schema=ripwire.map-diff/v1: the ranked map anchored at at=: what the diff touched, the map's row vocabulary. est_tokens=: price as emitted (an upper bound under compact). at=: commit+dirty+shallow. root=: p= relative to it. pr_iters=N: PageRank iterations. 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. 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). changed=K: K indexed git-changed files seed the PageRank teleport (0: uniform, incl. no git). 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. sc=: enclosing scope; the full id is p::sc::n (p= of the row or its <f>) 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. --> +<!-- t=modscope=a-file's-MODULE-SCOPE(n=<file-scope>):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 --> +<!-- t=type|alias|functype=a-Go-named-type-by-its-written-form:type=a-defined-type-whose-WRITTEN-form-is-not-a-struct/iface/func-literal(type-N-string;type-W-Pair-too,whatever-Pair-is-underneath),alias=type-A=B,functype=type-F-func(...) --> +<!-- t=alias|functype-in-C++-and-.h:alias=using-X=Y(also-templated-or-class-scope)or-namespace-L=lib(defs=X-prints-its-written-target-as-to=),functype=a-typedef-of-a-function-or-function-pointer-type(typedef-void(*F)(int));other-typedefs-read-t=struct --> +<!-- files=4852 symbols=45031 edges=45381 shown=5 est_tokens=1322 ambiguous=3984 unresolved=20100 locality_pinned=14 external=12460 declined=45307 extent_suspect_syms=12 macro_blanked_files=7 changed=0 skipped_oversize=15 unindexed="txt:85,tsv:54,mod:33,xml:33,jsonl:26,scm:25" unindexed_exts=23 order=important-first --> +<r schema="ripwire.map-diff/v1" at="914c4045d" root="." est_tokens="1322" pr_iters="37"> +<f p="src/infra/nodekind.h" layer="infra"> +<s t="fn" n="kindIs" sc="rw" k="0.0032"> +</s> +</f> +<f p="src/ingest_metrics.h"> +<s t="fn" n="nodeTextOf" k="0.0021"> +</s> +</f> +<f p="src/infra/namesplit.h" layer="infra"> +<s t="fn" n="isIdentChar" sc="namesplit" k="0.0020"> +</s> +</f> +<f p="src/model.h"> +<s t="fn" n="relForHash" sc="rw" k="0.0019"> +</s> +</f> +<f p="src/infra/Diagnostics.h" layer="infra"> +<s t="macro" n="RW_ASSUME_" k="0.0018"> +<c n="RW_CHECK_"/> +</s> +</f> +</r> +````` + +stderr: + +````` +[validate] symbolCount == N && fileCount == ing.files.size() && referenceCount == ing.references.size() is false — warmsnap: the graph section describes another model (warmsnap_graph.h:274, std::optional<Graph> rw::warmsnap::readGraph(Session &, const IngestResult &) — logged once per site) +````` + +## `./build/ripwire . --no-cache --top-k=3` + +*Force a cold parse (bypass the warm TMPDIR cache) — shows the cold-vs-warm cost.* + +**wall time: 2.41s** + +````` +<!-- ripwire map schema=ripwire.map/v1: ranked symbol map: <f p= layer=> groups <s t= n= sc= k= amb=> rows (k= rank), <c n=> resolved callees; the header comment is data. est_tokens=: price as emitted (an upper bound under compact). root=: p= relative to it. pr_iters=N: PageRank iterations. <inv listed= unlisted=>: files the ranked rows show / do not (sum = files=), each named or counted below. <entry p= n=>: 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. <ls p= n= f=>: 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 <c> 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. sc=: enclosing scope; the full id is p::sc::n (p= of the row or its <f>) and selectors take it. --> +<!-- t=modscope=a-file's-MODULE-SCOPE(n=<file-scope>):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 --> +<!-- t=type|alias|functype=a-Go-named-type-by-its-written-form:type=a-defined-type-whose-WRITTEN-form-is-not-a-struct/iface/func-literal(type-N-string;type-W-Pair-too,whatever-Pair-is-underneath),alias=type-A=B,functype=type-F-func(...) --> +<!-- t=alias|functype-in-C++-and-.h:alias=using-X=Y(also-templated-or-class-scope)or-namespace-L=lib(defs=X-prints-its-written-target-as-to=),functype=a-typedef-of-a-function-or-function-pointer-type(typedef-void(*F)(int));other-typedefs-read-t=struct --> +<!-- files=4852 symbols=45031 edges=45381 shown=3 est_tokens=4089 ambiguous=3984 unresolved=20100 locality_pinned=14 external=12460 declined=45307 extent_suspect_syms=12 macro_blanked_files=7 skipped_oversize=15 unindexed="txt:85,tsv:54,mod:33,xml:33,jsonl:26,scm:25" unindexed_exts=23 order=important-first --> +<r schema="ripwire.map/v1" root="." est_tokens="4089" pr_iters="37"> +<f p="src/infra/nodekind.h" layer="infra"> +<s t="fn" n="kindIs" sc="rw" k="0.0032"> +</s> +</f> +<f p="src/ingest_metrics.h"> +<s t="fn" n="nodeTextOf" k="0.0021"> +</s> +</f> +<f p="src/infra/namesplit.h" layer="infra"> +<s t="fn" n="isIdentChar" sc="namesplit" k="0.0020"> +</s> +</f> +<inv listed="3" unlisted="4849"> +<entry p="scripts/changelog_assemble.py" n="main"> +<c n="repoRoot"/> +<c n="fragmentNames"/> +<c n="check"/> +<c n="assembledEntries"/> +<c n="release"/> +</entry> +<entry p="scripts/merge_resolve.py" n="main"> +<c n="generator_constants"/> +<c n="git"/> +<c n="parse"/> +… [82 more display lines; full output is 10210 bytes on 1 raw line(s)] +````` + +## `./build/ripwire . --cache=<scratch>/aux/warm2.ripwirecache --top-k=3` + +*Explicit incremental cache at a path OUTSIDE the repo (first call writes it).* + +**wall time: 2.61s** + +````` +<!-- ripwire map schema=ripwire.map/v1: ranked symbol map: <f p= layer=> groups <s t= n= sc= k= amb=> rows (k= rank), <c n=> resolved callees; the header comment is data. est_tokens=: price as emitted (an upper bound under compact). root=: p= relative to it. pr_iters=N: PageRank iterations. <inv listed= unlisted=>: files the ranked rows show / do not (sum = files=), each named or counted below. <entry p= n=>: 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. <ls p= n= f=>: 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 <c> 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. sc=: enclosing scope; the full id is p::sc::n (p= of the row or its <f>) and selectors take it. --> +<!-- t=modscope=a-file's-MODULE-SCOPE(n=<file-scope>):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 --> +<!-- t=type|alias|functype=a-Go-named-type-by-its-written-form:type=a-defined-type-whose-WRITTEN-form-is-not-a-struct/iface/func-literal(type-N-string;type-W-Pair-too,whatever-Pair-is-underneath),alias=type-A=B,functype=type-F-func(...) --> +<!-- t=alias|functype-in-C++-and-.h:alias=using-X=Y(also-templated-or-class-scope)or-namespace-L=lib(defs=X-prints-its-written-target-as-to=),functype=a-typedef-of-a-function-or-function-pointer-type(typedef-void(*F)(int));other-typedefs-read-t=struct --> +<!-- files=4852 symbols=45031 edges=45381 shown=3 est_tokens=4089 ambiguous=3984 unresolved=20100 locality_pinned=14 external=12460 declined=45307 extent_suspect_syms=12 macro_blanked_files=7 skipped_oversize=15 unindexed="txt:85,tsv:54,mod:33,xml:33,jsonl:26,scm:25" unindexed_exts=23 order=important-first --> +<r schema="ripwire.map/v1" root="." est_tokens="4089" pr_iters="37"> +<f p="src/infra/nodekind.h" layer="infra"> +<s t="fn" n="kindIs" sc="rw" k="0.0032"> +</s> +</f> +<f p="src/ingest_metrics.h"> +<s t="fn" n="nodeTextOf" k="0.0021"> +</s> +</f> +<f p="src/infra/namesplit.h" layer="infra"> +<s t="fn" n="isIdentChar" sc="namesplit" k="0.0020"> +</s> +</f> +<inv listed="3" unlisted="4849"> +<entry p="scripts/changelog_assemble.py" n="main"> +<c n="repoRoot"/> +<c n="fragmentNames"/> +<c n="check"/> +<c n="assembledEntries"/> +<c n="release"/> +</entry> +<entry p="scripts/merge_resolve.py" n="main"> +<c n="generator_constants"/> +<c n="git"/> +<c n="parse"/> +… [82 more display lines; full output is 10210 bytes on 1 raw line(s)] +````` + +Artifact written: + +````` + 40894532 <scratch>/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).* + +````` +<!-- ripwire map schema=ripwire.map/v1: ranked symbol map: <f p= layer=> groups <s t= n= sc= k= amb=> rows (k= rank), <c n=> resolved callees; the header comment is data. est_tokens=: price as emitted (an upper bound under compact). root=: p= relative to it. pr_iters=N: PageRank iterations. <inv listed= unlisted=>: files the ranked rows show / do not (sum = files=), each named or counted below. <entry p= n=>: 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. <ls p= n= f=>: 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. 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. sc=: enclosing scope; the full id is p::sc::n (p= of the row or its <f>) and selectors take it. --> +<!-- t=modscope=a-file's-MODULE-SCOPE(n=<file-scope>):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 --> +<!-- t=type|alias|functype=a-Go-named-type-by-its-written-form:type=a-defined-type-whose-WRITTEN-form-is-not-a-struct/iface/func-literal(type-N-string;type-W-Pair-too,whatever-Pair-is-underneath),alias=type-A=B,functype=type-F-func(...) --> +<!-- t=alias|functype-in-C++-and-.h:alias=using-X=Y(also-templated-or-class-scope)or-namespace-L=lib(defs=X-prints-its-written-target-as-to=),functype=a-typedef-of-a-function-or-function-pointer-type(typedef-void(*F)(int));other-typedefs-read-t=struct --> +<!-- files=3587 symbols=14120 edges=4669 shown=3 est_tokens=2016 ambiguous=387 unresolved=1221 locality_pinned=5 external=1256 declined=1485 extent_suspect_syms=12 macro_blanked_files=7 skipped_oversize=1280 unindexed="txt:85,tsv:54,mod:33,xml:33,jsonl:26,scm:25" unindexed_exts=23 order=important-first --> +<r schema="ripwire.map/v1" root="." est_tokens="2016" pr_iters="38"> +<f p="test/forcallerhopfix/d2inherit/pycap/m.py" layer="test"> +<s t="fn" n="post_entry" sc="Ledger" k="0.0017"> +</s> +</f> +<f p="test/forcallerhopfix/c/fan.c" layer="test"> +<s t="fn" n="fan_target" k="0.0016"> +</s> +</f> +<f p="test/stdnamesakefix/tree/rs/lib.rs" layer="test"> +<s t="method" n="map" sc="Shelf" k="0.0013"> +</s> +</f> +<inv listed="3" unlisted="3584"> +<entry p="src/tsprobe.cpp" n="main"> +<c n="langIndex"/> +<c n="kindIndex"/> +<c n="langName"/> +</entry> +<ls p="." n="6"/> +<ls p=".codex-plugin" n="1"/> +<ls p="bench" n="140"/> +<ls p="changelog.d" n="114"/> +<ls p="docs" n="4"/> +<ls p="hooks" n="1"/> +… [20 more display lines; full output is 5003 bytes on 1 raw line(s)] +````` + +## `./build/ripwire . --scip=does_not_exist.scip --callers=rankGraphTeleport` + +*SCIP overlay with a missing index REFUSES (exit 1) naming the file — never silently serves the name-based map you named a precision index to improve on (it used to degrade in silence).* + +**exit code: 1** + +````` +(empty) +````` + +stderr: + +````` +ripwire: --scip=does_not_exist.scip: cannot open the index — refusing rather than serving the name-based map you named a precision index to improve on (generate one with scip-clang/scip-python, or drop --scip) +````` + +## `./build/ripwire src test --top-k=5` + +*Multi-root workspace: ONE merged graph over two roots, paths labeled <root>/<rel>.* + +**wall time: 2.44s** + +````` +<!-- ripwire map schema=ripwire.map/v1: ranked symbol map: <f p= layer=> groups <s t= n= sc= k= amb=> rows (k= rank), <c n=> resolved callees; the header comment is data. est_tokens=: price as emitted (an upper bound under compact). <root label= p=>: a workspace root; label= prefixes every p=/id=. pr_iters=N: PageRank iterations. 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. 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). roots=N: N workspace roots. 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. sc=: enclosing scope; the full id is p::sc::n (p= of the row or its <f>) and selectors take it. --> +<!-- t=modscope=a-file's-MODULE-SCOPE(n=<file-scope>):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 --> +<!-- t=type|alias|functype=a-Go-named-type-by-its-written-form:type=a-defined-type-whose-WRITTEN-form-is-not-a-struct/iface/func-literal(type-N-string;type-W-Pair-too,whatever-Pair-is-underneath),alias=type-A=B,functype=type-F-func(...) --> +<!-- t=alias|functype-in-C++-and-.h:alias=using-X=Y(also-templated-or-class-scope)or-namespace-L=lib(defs=X-prints-its-written-target-as-to=),functype=a-typedef-of-a-function-or-function-pointer-type(typedef-void(*F)(int));other-typedefs-read-t=struct --> +<!-- files=4333 symbols=36823 edges=42714 shown=5 est_tokens=1220 ambiguous=3818 unresolved=13724 locality_pinned=14 external=7856 declined=42419 extent_suspect_syms=12 macro_blanked_files=7 roots=2 unindexed="txt:59,mod:33,xml:33,tsv:8,am:4,cfg:4" unindexed_exts=16 order=important-first --> +<r schema="ripwire.map/v1" est_tokens="1220" pr_iters="39"> +<root label="src" p="src"/> +<root label="test" p="test"/> +<f p="src/infra/nodekind.h" layer="infra"> +<s t="fn" n="kindIs" sc="rw" k="0.0037"> +</s> +</f> +<f p="src/ingest_metrics.h"> +<s t="fn" n="nodeTextOf" k="0.0024"> +</s> +</f> +<f p="src/infra/namesplit.h" layer="infra"> +<s t="fn" n="isIdentChar" sc="namesplit" k="0.0023"> +</s> +</f> +<f p="src/model.h"> +<s t="fn" n="relForHash" sc="rw" k="0.0022"> +</s> +</f> +<f p="src/infra/Diagnostics.h" layer="infra"> +<s t="macro" n="RW_ASSUME_" k="0.0021"> +<c n="RW_CHECK_"/> +</s> +</f> +</r> +````` + +## `./build/ripwire . --eval` + +*Self-eval: co-change recall vs BM25.* + +**wall time: 23.05s** + +````` +ripwire --eval (co-change recovery, averaged over 80 historical commits) + ranker recall@5 recall@10 recall@20 + ripwire 5.8% 6.0% 12.0% + BM25 9.0% 9.8% 11.6% + BM25sub 10.1% 11.3% 12.8% + BM25body 10.1% 14.5% 27.4% + fused 3.8% 9.2% 16.9% + anchored 9.9% 14.5% 25.3% + same-dir 0.8% 0.8% 2.1% + random 0.1% 0.2% 0.4% <- floor (random ranking over F=4852 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 / + subtoken+body); fused = RRF(ripwire, BM25sub); anchored = BM25body + anchored PPR + expansion (--for --anchor, EXPERIMENTAL). The SHIPPED default for --for/--query is + the subtoken+body lexical family (routed to name-exact only for an identifier-shaped + query — lexical.h chooseForRanker), so a gap between the ripwire and BM25* rows here + is structural-importance-vs-lexical-relatedness on a co-change task, not the shipped + retrieval path losing to an alternative it was never running. +````` + +## `./build/ripwire . --eval-retrieval` + +*Known-item retrieval eval: MRR + recall@k per ranker per query mode.* + +**wall time: 246.88s** + +````` +ripwire --eval-retrieval (known-item, 4000 doc-commented symbols; gold is in-corpus by construction) + sample: population=12348 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.3% 82.2% 87.4% + subtoken doc-phrase 0.883 86.0% 90.4% 91.5% + name-exact name 0.877 79.7% 93.9% 96.1% + name-exact doc-phrase 0.008 0.3% 1.1% 1.6% + anchored name 0.663 53.7% 81.0% 86.0% + anchored doc-phrase 0.876 85.1% 90.0% 90.8% + routed name 0.879 79.9% 94.0% 96.3% + routed doc-phrase 0.881 86.0% 90.2% 91.2% + 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 + (or an explicit camel/snake token appears) AND every matched name is specific enough to anchor on — + a common name (many definitions, or a subtoken carried by many symbol names) declines the route — so + conceptual prose falls back to subtoken+body; routed tracks the better ranker on BOTH modes + (routed==name-exact on name, ~=subtoken+body on doc-phrase). +````` + +## `./build/ripwire . --eval-stray=<scratch>/aux/stray_labels2.tsv` + +*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: 12.84s** + +Input file: + +````` +# ref<TAB>verdict labels for --eval-stray (the first three local branches, resolved at capture time; a missing branch is padded with a nonexistent name on purpose) +arm/for-howitworks-067-f2add merged +arm/for-howitworks-067-placebo unmerged +arm/orient-map-067-narrow merged +````` + +````` +<!-- ripwire stray-content eval: labelled verdict accuracy. Each row is one branch whose true state was established by hand; want= is the label, got= is what the classifier said. A branch absent from the report scores as merged ONLY when it is a real ref this repo has (merged refs are omitted by design); a label naming a ref that does not exist is refused, not scored (see badRefs on refusal). unknown= on the root counts cases whose verdict is unknown (no merge-base / unrelated history); its own bucket, never folded into merged. labels_omitted= (present only when non-zero) counts labelled refs past the sweep's 512-ref window (it keeps every labelled ref first, so only more than 512 labels leave any out): never scored. Use this to MEASURE a threshold change instead of eyeballing it. --> +<stray-eval cases="3" correct="1" unknown="0" accuracy="33.3"> +<case ref="arm/for-howitworks-067-f2add" want="merged" got="unmerged" hit="0" reported="1"/> +<case ref="arm/for-howitworks-067-placebo" want="unmerged" got="unmerged" hit="1" reported="1"/> +<case ref="arm/orient-map-067-narrow" want="merged" got="unmerged" hit="0" reported="1"/> +</stray-eval> +````` + +stderr: + +````` +ripwire: warning: --stray-content read the newest 512 of 655 local branches; 143 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=<scratch>/aux/skills_labels2.tsv` + +*Labelled skill-ROUTING eval over the repo's own skills/ directory (4 hand-labelled prompts).* + +Input file: + +````` +orient in an unfamiliar codebase fast ripwire-orient judged +who calls this function and what is the blast radius ripwire-navigate judged +plan parallel worktrees so the lanes do not collide ripwire-change-check judged +what is the weather in Paris none neg +````` + +````` +ripwire --eval-skills (skill routing over K=16 candidate skills [ripwire-router excluded]; 3 positive + 1 negative prompts; corpus '<scratch>/aux/skills_labels2.tsv'; split test= … [line truncated: 8 more bytes on this line] + arm hit@1 hit@2 mrr sep-auc fire/abstain@ORACLE-th (upper bound) + overlap 66.7% 66.7% 0.689 0.000 50.0% (th=-1.000) + name 33.3% 66.7% 0.537 0.667 50.0% (th=0.000) + bm25-desc 66.7% 66.7% 0.689 0.667 75.0% (th=2.872) + bm25-full 33.3% 66.7% 0.611 1.000 50.0% (th=0.427) + for-routed 33.3% 33.3% 0.556 1.000 50.0% (th=0.703) + random 6.2% 12.5% 0.211 0.500 <- floor (uniform-random ranking; auc 0.5 by definition) + provenance hit@1 (bm25-desc): router 0/0, desc 0/0, judged 2/3 (desc rows quote the descriptions - expect them easiest; judged is the honest number) + judged-only hit@1 per arm: overlap 2/3, name 1/3, bm25-desc 2/3, bm25-full 1/3, for-routed 1/3 + router-magnet: with ripwire-router ADMITTED as a candidate it takes top-1 on 1/3 positive prompts (bm25-desc arm) - why it is excluded above + per-skill (bm25-desc): name / permitted-rows / won / pos-fires / false-fires / neg-fires + ripwire-before-you-build 0 0 1 1 0 + ripwire-change-check 1 0 0 0 0 + ripwire-find-bug 0 0 0 0 0 + ripwire-fresh-eyes 0 0 0 0 1 + ripwire-graph-query 0 0 0 0 0 + ripwire-handoff 0 0 0 0 0 + ripwire-layers 0 0 0 0 0 + ripwire-mcp 0 0 0 0 0 + ripwire-navigate 1 1 1 0 0 + ripwire-opt-remarks 0 0 0 0 0 + ripwire-orient 1 1 1 0 0 + ripwire-perf-target 0 0 0 0 0 + ripwire-quality-bar 0 0 0 0 0 + ripwire-reuse-first 0 0 0 0 0 + ripwire-security-scan 0 0 0 0 0 + ripwire-write-tests 0 0 0 0 0 + misses (overlap): + line 3 want=ripwire-change-check got=ripwire-before-you-build "plan parallel worktrees so the lanes do not collide" +… [19 more lines, 3721 bytes total] +````` + +## `./build/ripwire wrap claude` + +*Print the recipe to wire ripwire into Claude Code as an MCP server.* + +````` +# ripwire -> Claude Code (CLI-first) +# RECOMMENDED — this agent can run shell commands, so call the CLI directly. It costs +# nothing until you invoke it, and it reads CLAUDE.md, so the paste block below IS the wiring: +ripwire . --for="<your task>" +# +# ...every follow-up call answers with the compact legend by default (terse definitions of only the +# attributes the answer carries; the payload is byte-identical either way). Add --legend=full when a +# definition's reasoning is needed -- `ripwire --help` carries the measured saving (one place, +# gate-held) -- this line does not repeat it, because two copies of a number is one that goes stale: +# ripwire . --callers=SYM --legend=full +# +# ALTERNATIVE — register the MCP server instead, for a warm index across calls: +claude mcp add ripwire -- ripwire --mcp --mcp-tools=no-edit +# verbs the agent can then call mid-task (30 total): +# read: analyze, rank_by, find_symbol, find_referencing_symbols, grep, cochange, memory_recall, situational_awareness, mentions, for, lego, owners, fetch_body, batch, flags, doc_drift, slice +# flagship reflex: exemplar, quality_delta, quality_baseline, impact, uses, affected, path_between, connect, explore, from_trace, edit_check, whereis, stray_content +bash skills/install.sh # deploy to ${CLAUDE_CONFIG_DIR:-~/.claude}/skills (drift-gated) +bash skills/install.sh --hook # RECOMMENDED: advisory Read/Grep -> ripwire CLI nudge + session primer (opt-in, never blocks) +# +# context wiring — a binary on PATH is invisible to an agent until its rules file says when +# to reach for it. Paste the block below into CLAUDE.md: +# --- paste into CLAUDE.md --- +## ripwire — deterministic codebase maps (on PATH as `ripwire`) +Reach for it BEFORE blind grep + whole-file reads. First call ~1s cold; after that warm, ~0.1s. +- Orient on a task: `ripwire <dir> --for="<task in words>"` — ranked, quality-annotated + signatures. Paste symbol/file names from the issue verbatim; named mentions get anchored. +- One task: `--pack-task="<task>" --legend=compact`; before parallel agents: `--plan-lanes=N --task="<goal>"`, then read `lanes[].execution`. +- Have a stack trace / build error: `ripwire <dir> --from-trace=FILE --legend=compact` (`-` = stdin) — + paste the error, don't paraphrase it into a query. +- Who calls X: `--callers=SYM --legend=compact`. "Is it safe to change X?" needs the full blast radius: +… [13 more lines, 4536 bytes total] +````` + +## `./build/ripwire --version` + +*Version + short build info.* + +````` +ripwire 0.6.10-dev.110+g914c4045d (dev, AppleClang 21.0.0.21000101, emit=std::print, built_from=914c4045d) +````` + + +--- + +# navigate — seeds, claims, slices, shapes + +## `./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.* + +````` +<!-- ripwire at schema=ripwire.at/v1: enclosing-definition chain at p=:l=: sym= innermost, chain= outermost-first, <s n= t= l= el=> spans. root=: p= relative to it. --> +<at schema="ripwire.at/v1" p="src/graph.h" l="14923" sym="rankGraphTeleport" chain="1" root="."> +<s n="rankGraphTeleport" t="fn" l="14921" el="14949"/> +</at> +````` + +## `./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.* + +````` +<!-- ripwire callers schema=ripwire.callers/v1: 1-hop CALLERS of of= (defs= matched, count= distinct symbols): <s t= n= p=>; hop_tested=/hop_untested=. counts_floor=1: every count is a FLOOR, never a total. graph_ambiguous=/graph_unresolved=: resolver gauge. graph_unindexed=N: N files no grammar could read (the map header's unindexed=); their calls raise neither gauge. root=: p= relative to it. <s sites_at=>: its leaf-name calls not proven elsewhere, as [file:]line (p=: def line, default file); not proof each binds. next=: the one pasteable follow-up. --> +<callers schema="ripwire.callers/v1" of="@src/graph.h:14923" defs="1" count="7" root="." hop_tested="0" hop_untested="7" graph_ambiguous="3984" graph_unresolved="20100" graph_unindexed="313" counts_floor="1" next="--uses=@src/graph.h:14923"> +<s t="fn" n="getIndex" p="src/mcpindex.h:1224" sites_at="1340"/> +<s t="fn" n="rankGraph" p="src/graph.h:14964" sites_at="14968"/> +<s t="fn" n="anchoredLexicalRank" p="src/graph.h:15633" sites_at="15684"/> +<s t="fn" n="runEval" p="src/eval.h:171" sites_at="328"/> +<s t="fn" n="churnDecayRanking" p="src/main.cpp:1433" sites_at="1447"/> +<s t="fn" n="churnRankedGraph" p="src/main.cpp:1472" sites_at="1486 1487 1501"/> +<s t="fn" n="runDefaultMap" p="src/main.cpp:1759" sites_at="1879"/> +</callers> +````` + +## `./build/ripwire . --at=src/graph.h:999999` + +*A seed past the end of the file — the refusal shape for a faulted location.* + +**exit code: 1** + +````` +(empty) +````` + +stderr: + +````` +ripwire: the at flag's seed 'src/graph.h:999999' named no location (./src/graph.h has only 21347 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.* + +````` +<!-- ripwire verify schema=ripwire.verify/v1: ONE structured claim, verdict=confirmed|refuted|unknown, its witness rows <s t= n= p=> inline. window: shown= capped= (capped=1 cut). counts_floor=1: every count is a FLOOR, never a total. graph_ambiguous=/graph_unresolved=: resolver gauge. graph_unindexed=N: N files no grammar could read (the map header's unindexed=); their calls raise neither gauge. root=: p= relative to it. claim=/shape=: the claim as given and its shape; from_defs=/to_defs=: defs each name resolved to. hops=N: call edges on the witness path (a confirmed reach claim only). --> +<verify schema="ripwire.verify/v1" claim="calls(runDefaultMap, rankGraphTeleport)" shape="calls" verdict="confirmed" from_defs="1" to_defs="1" hops="1" root="." graph_ambiguous="3984" graph_unresolved="20100" graph_unindexed="313" counts_floor="1" shown="2" capped="0"> +<s t="fn" n="runDefaultMap" p="src/main.cpp:1759"/> +<s t="fn" n="rankGraphTeleport" p="src/graph.h:14921"/> +</verify> +````` + +## `./build/ripwire . --verify="unused(rankGraphTeleport)"` + +*A claim that is FALSE — the refuted shape, with the references that refute it.* + +````` +<!-- ripwire verify schema=ripwire.verify/v1: ONE structured claim, verdict=confirmed|refuted|unknown, its witness rows <s t= n= p=> inline. window: shown= capped= (capped=1 cut). counts_floor=1: every count is a FLOOR, never a total. graph_ambiguous=/graph_unresolved=: resolver gauge. graph_unindexed=N: N files no grammar could read (the map header's unindexed=); their calls raise neither gauge. root=: p= relative to it. claim=/shape=: the claim as given and its shape; from_defs=/to_defs=: defs each name resolved to. --> +<verify schema="ripwire.verify/v1" claim="unused(rankGraphTeleport)" shape="unused" verdict="refuted" defs="1" external="0" count="9" root="." graph_ambiguous="3984" graph_unresolved="20100" graph_unindexed="313" counts_floor="1" shown="9" capped="0"> +<u role="call" p="src/eval.h:328" in_id="src/eval.h::rw::runEval"/> +<u role="call" p="src/graph.h:14968" in_id="src/graph.h::rw::rankGraph"/> +<u role="call" p="src/graph.h:15684" in_id="src/graph.h::rw::anchoredLexicalRank"/> +<u role="call" p="src/main.cpp:1447" in_id="churnDecayRanking"/> +<u role="call" p="src/main.cpp:1486" in_id="churnRankedGraph"/> +<u role="call" p="src/main.cpp:1487" in_id="churnRankedGraph"/> +<u role="call" p="src/main.cpp:1501" in_id="churnRankedGraph"/> +<u role="call" p="src/main.cpp:1879" in_id="runDefaultMap"/> +<u role="call" p="src/mcpindex.h:1340" in_id="src/mcpindex.h::rw::getIndex"/> +</verify> +````` + +## `./build/ripwire . --verify="contains(src/graph.h, \"no such literal anywhere\")"` + +*A literal-scan absence: refuted only with complete= evidence, never on a partial scan.* + +````` +<!-- ripwire verify schema=ripwire.verify/v1: ONE structured claim, verdict=confirmed|refuted|unknown, its witness rows <s t= n= p=> inline. window: shown= capped= (capped=1 cut). root=: p= relative to it. claim=/shape=: the claim as given and its shape; from_defs=/to_defs=: defs each name resolved to. --> +<verify schema="ripwire.verify/v1" claim="contains(src/graph.h, "no such literal anywhere")" shape="contains" verdict="refuted" hits="0" root="." complete="1" shown="0" capped="0"> +</verify> +````` + +## `./build/ripwire . --verify="frobnicate(x)"` + +*An unparseable claim — the refusal names the accepted shapes.* + +**exit code: 1** + +````` +(empty) +````` + +stderr: + +````` +ripwire: --verify claim not recognized: 'frobnicate(x)' — unknown shape word. The claim language is CLOSED; the shapes are: calls(A, B) does A transitively call B · uses(SYM) is SYM referenced anywhere · unused(SYM) is SYM referenced nowhere · contains(FILE, "LITERAL") do FILE's bytes contain t … [line truncated: 218 more bytes on this line] +````` + +## `./build/ripwire . --slice=rankGraphTeleport` + +*Bare --slice=SYM: the INVENTORY of sliceable locals (<v n= l= t=/>), so a caller can pick VAR.* + +**wall time: 1.08s** + +````` +<!-- ripwire slice schema=ripwire.slice/v1: name-based def-use rows of one variable in one definition: <s l= k=def|use|both|scope t= [b= pp= rd=]> (rd= reaching-def lines per reach=cfg|linear), <v n= l= t=> inventory; steps=/depth= flow. at=: commit+dirty+shallow. root=: p= relative to it. sym=/lang=: the sliced definition's name and language; p= is its file:line. vars=N: sliceable local bindings in the definition, one v row each; name one to slice it. counts=as-classified: defs=/uses=/vars=/steps= count what the name classifier rowed; neither floors nor totals. --> +<slice sym="rankGraphTeleport" p="src/graph.h:14921" t="fn" lang="cpp" schema="ripwire.slice/v1" vars="14" at="914c4045d" root="." counts="as-classified"> +<v n="alpha" l="14921" t="param"/> +<v n="g" l="14921" t="param"/> +<v n="p" l="14921" t="param"/> +<v n="pw" l="14924" t="decl"/> +<v n="N" l="14925" t="decl"/> +<v n="teleport" l="14926" t="decl"/> +<v n="rankDouble" l="14927" t="decl"/> +<v n="run" l="14928" t="decl"/> +<v n="teleportMass" l="14931" t="decl"/> +<v n="value" l="14932" t="decl"/> +<v n="inverseMass" l="14938" t="decl"/> +<v n="value" l="14939" t="decl"/> +<v n="r" l="14946" t="decl"/> +<v n="value" l="14947" t="param"/> +</slice> +````` + +## `./build/ripwire . --slice=rankGraphTeleport:teleport` + +*Intra-procedural def-use slice of ONE variable: one <s> row per line touching it, k=def|use|both, reaching definitions flow-sensitive (reach=cfg).* + +**wall time: 1.24s** + +````` +<!-- ripwire slice schema=ripwire.slice/v1: name-based def-use rows of one variable in one definition: <s l= k=def|use|both|scope t= [b= pp= rd=]> (rd= reaching-def lines per reach=cfg|linear), <v n= l= t=> inventory; steps=/depth= flow. at=: commit+dirty+shallow. root=: p= relative to it. sym=/lang=: the sliced definition's name and language; p= is its file:line. order=defuse: seed s rows (no v=) ranked among these rows by def-use coverage (distinct local names on the line) desc, then line; not source order, not a whole-function ranking (measured at chance — docs/EVALS.md) — flow s rows (v=) keep their (d=,l=,v=) order. counts=as-classified: defs=/uses=/vars=/steps= count what the name classifier rowed; neither floors nor totals. --> +<slice sym="rankGraphTeleport" p="src/graph.h:14921" t="fn" lang="cpp" schema="ripwire.slice/v1" var="teleport" defs="1" uses="3" reach="cfg" order="defuse" at="914c4045d" root="." counts="as-classified"> +<s l="14944" k="use" t="call-arg" rd="14926"> +<![CDATA[run = pageRankDouble( g.inEdges, g.wOutDeg, teleport, rankDouble, PageRankConfig{ .alpha = double( alpha ) } );]]> +</s> +<s l="14926" k="def" t="decl"> +<![CDATA[std::vector<double> teleport( pw.begin(), pw.end() );]]> +</s> +<s l="14932" k="use" t="read" rd="14926"> +<![CDATA[for( const double value : teleport )]]> +</s> +<s l="14939" k="use" t="read" rd="14926"> +<![CDATA[for( double& value : teleport )]]> +</s> +</slice> +````` + +## `./build/ripwire . --slice=rankGraphTeleport:teleport --slice-flow=back --slice-depth=3` + +*TRANSITIVE backward value-flow from the seed variable, bounded BFS (depth= disclosed; a cut frontier says flow_truncated=1).* + +**wall time: 2.48s** + +````` +<!-- ripwire slice schema=ripwire.slice/v1: name-based def-use rows of one variable in one definition: <s l= k=def|use|both|scope t= [b= pp= rd=]> (rd= reaching-def lines per reach=cfg|linear), <v n= l= t=> inventory; steps=/depth= flow. at=: commit+dirty+shallow. root=: p= relative to it. sym=/lang=: the sliced definition's name and language; p= is its file:line. order=defuse: seed s rows (no v=) ranked among these rows by def-use coverage (distinct local names on the line) desc, then line; not source order, not a whole-function ranking (measured at chance — docs/EVALS.md) — flow s rows (v=) keep their (d=,l=,v=) order. counts=as-classified: defs=/uses=/vars=/steps= count what the name classifier rowed; neither floors nor totals. --> +<slice sym="rankGraphTeleport" p="src/graph.h:14921" t="fn" lang="cpp" schema="ripwire.slice/v1" var="teleport" defs="1" uses="3" reach="cfg" flow="back" depth="3" steps="3" order="defuse" at="914c4045d" root="." counts="as-classified"> +<s l="14944" k="use" t="call-arg" rd="14926"> +<![CDATA[run = pageRankDouble( g.inEdges, g.wOutDeg, teleport, rankDouble, PageRankConfig{ .alpha = double( alpha ) } );]]> +</s> +<s l="14926" k="def" t="decl"> +<![CDATA[std::vector<double> teleport( pw.begin(), pw.end() );]]> +</s> +<s l="14932" k="use" t="read" rd="14926"> +<![CDATA[for( const double value : teleport )]]> +</s> +<s l="14939" k="use" t="read" rd="14926"> +<![CDATA[for( double& value : teleport )]]> +</s> +<s l="14924" k="def" t="decl" v="pw" d="1" f="14926"> +<![CDATA[const std::vector<float> pw = biasPrior( g, p );]]> +</s> +<s l="14921" k="def" t="param" v="g" d="2" f="14924"> +<![CDATA[inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>& p, float alpha = 0.85f )]]> +</s> +<s l="14921" k="def" t="param" v="p" d="2" f="14924"> +<![CDATA[inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>& p, float alpha = 0.85f )]]> +</s> +</slice> +````` + +## `./build/ripwire . --slice=rankGraphTeleport:teleport --slice-flow=fwd` + +*Forward flow: which statements the seed's value reaches, at the default depth bound.* + +**wall time: 1.23s** + +````` +<!-- ripwire slice schema=ripwire.slice/v1: name-based def-use rows of one variable in one definition: <s l= k=def|use|both|scope t= [b= pp= rd=]> (rd= reaching-def lines per reach=cfg|linear), <v n= l= t=> inventory; steps=/depth= flow. at=: commit+dirty+shallow. root=: p= relative to it. sym=/lang=: the sliced definition's name and language; p= is its file:line. order=defuse: seed s rows (no v=) ranked among these rows by def-use coverage (distinct local names on the line) desc, then line; not source order, not a whole-function ranking (measured at chance — docs/EVALS.md) — flow s rows (v=) keep their (d=,l=,v=) order. counts=as-classified: defs=/uses=/vars=/steps= count what the name classifier rowed; neither floors nor totals. --> +<slice sym="rankGraphTeleport" p="src/graph.h:14921" t="fn" lang="cpp" schema="ripwire.slice/v1" var="teleport" defs="1" uses="3" reach="cfg" flow="fwd" depth="8" steps="7" order="defuse" at="914c4045d" root="." counts="as-classified"> +<s l="14944" k="use" t="call-arg" rd="14926"> +<![CDATA[run = pageRankDouble( g.inEdges, g.wOutDeg, teleport, rankDouble, PageRankConfig{ .alpha = double( alpha ) } );]]> +</s> +<s l="14926" k="def" t="decl"> +<![CDATA[std::vector<double> teleport( pw.begin(), pw.end() );]]> +</s> +<s l="14932" k="use" t="read" rd="14926"> +<![CDATA[for( const double value : teleport )]]> +</s> +<s l="14939" k="use" t="read" rd="14926"> +<![CDATA[for( double& value : teleport )]]> +</s> +<s l="14934" k="use" t="read" v="value" d="2" f="14932" b="14932"> +<![CDATA[teleportMass += value;]]> +</s> +<s l="14941" k="both" t="assign" v="value" d="2" f="14939" b="14939"> +<![CDATA[value *= inverseMass;]]> +</s> +<s l="14948" k="use" t="read" v="run" d="2" f="14944"> +<![CDATA[return { std::move( r ), run.iterationCount, run.hasConverged };]]> +</s> +<s l="14934" k="both" t="assign" v="teleportMass" d="3" f="14934"> +<![CDATA[teleportMass += value;]]> +</s> +<s l="14936" k="use" t="read" v="teleportMass" d="3" f="14934"> +<![CDATA[if( teleportMass > 0.0 )]]> +</s> +<s l="14938" k="use" t="read" v="teleportMass" d="3" f="14934"> +<![CDATA[const double inverseMass = 1.0 / teleportMass;]]> +</s> +<s l="14941" k="use" t="read" v="inverseMass" d="4" f="14938"> +<![CDATA[value *= inverseMass;]]> +</s> +</slice> +````` + +## `./build/ripwire . --slice=rankGraphTeleport:nosuchvar` + +*A variable the definition does not bind — the refusal shape, naming the inventory.* + +**exit code: 1** + +````` +(empty) +````` + +stderr: + +````` +ripwire: --slice: no occurrence of 'nosuchvar' in rankGraphTeleport — sliceable locals: alpha, g, p, pw, N, teleport, rankDouble, run, teleportMass, value, inverseMass, r (bare --slice=rankGraphTeleport lists them with first-def lines) +````` + +## `./build/ripwire . --slice-depth=3` + +*--slice-depth without --slice-flow is refused loudly rather than silently ignored.* + +**exit code: 1** + +````` +(empty) +````` + +stderr: + +````` +ripwire: --slice-depth bounds the --slice-flow BFS — pass both (e.g. ripwire <dir> --slice=parseArgs:argIndex --slice-flow=fwd --slice-depth=4) +````` + +## `./build/ripwire . --slice=rankGraphTeleport:teleport --legend=compact` + +*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.11s** + +````` +<!-- ripwire slice schema=ripwire.slice/v1: name-based def-use rows of one variable in one definition: <s l= k=def|use|both|scope t= [b= pp= rd=]> (rd= reaching-def lines per reach=cfg|linear), <v n= l= t=> inventory; steps=/depth= flow. at=: commit+dirty+shallow. root=: p= relative to it. sym=/lang=: the sliced definition's name and language; p= is its file:line. order=defuse: seed s rows (no v=) ranked among these rows by def-use coverage (distinct local names on the line) desc, then line; not source order, not a whole-function ranking (measured at chance — docs/EVALS.md) — flow s rows (v=) keep their (d=,l=,v=) order. counts=as-classified: defs=/uses=/vars=/steps= count what the name classifier rowed; neither floors nor totals. --> +<slice sym="rankGraphTeleport" p="src/graph.h:14921" t="fn" lang="cpp" schema="ripwire.slice/v1" var="teleport" defs="1" uses="3" reach="cfg" order="defuse" at="914c4045d" root="." counts="as-classified"> +<s l="14944" k="use" t="call-arg" rd="14926"> +<![CDATA[run = pageRankDouble( g.inEdges, g.wOutDeg, teleport, rankDouble, PageRankConfig{ .alpha = double( alpha ) } );]]> +</s> +<s l="14926" k="def" t="decl"> +<![CDATA[std::vector<double> teleport( pw.begin(), pw.end() );]]> +</s> +<s l="14932" k="use" t="read" rd="14926"> +<![CDATA[for( const double value : teleport )]]> +</s> +<s l="14939" k="use" t="read" rd="14926"> +<![CDATA[for( double& value : teleport )]]> +</s> +</slice> +````` + +## `./build/ripwire . --pattern='rankGraphTeleport($A, $B, $C)'` + +*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: 2.26s** + +````` +<!-- ripwire pattern schema=ripwire.pattern/v1: structural pattern hits with their enclosing symbol. window: shown= capped= (capped=1 cut). hits_capped=1: hits= is a floor. root=: p= relative to it. q=: the pattern as given; grammars=/shapes=: grammars it resolved for and the node kind it became in each; unsupported=: families this verb never serves. eligible_files=/skipped_files=/of_files=: files scanned / served-language files it did not resolve for, never read / all indexed. m p= in=: the hit's file:line and its enclosing symbol; the text is the matched node. --> +<pattern schema="ripwire.pattern/v1" hits="1" shown="1" capped="0" hits_capped="0" q="rankGraphTeleport($A, $B, $C)" grammars="cpp,cpp/cu,c,python,go,rust,typescript,tsx,swift,objc,javascript,java,csharp" shapes="cpp:call_expression,cpp/cu:call_expression,c:call_expression,python:call,go:call_expres … [line truncated: 309 more bytes on this line] +<m p="src/graph.h:14968" in="rankGraph">rankGraphTeleport( g, std::vector<float>( N, ranked ? 1.0f / float( ranked ) : 0.f ), alpha )</m> +</pattern> +````` + +## `./build/ripwire . --pattern='DISCLOSE(...)'` + +*The ellipsis form over a macro-shaped call site; unsupported= names the families this verb does not serve.* + +**wall time: 1.96s** + +````` +<!-- ripwire pattern schema=ripwire.pattern/v1: structural pattern hits with their enclosing symbol. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). ellipsis_capped=: 1 = cut. hits_capped=1: hits= is a floor. root=: p= relative to it. q=: the pattern as given; grammars=/shapes=: grammars it resolved for and the node kind it became in each; unsupported=: families this verb never serves. eligible_files=/skipped_files=/of_files=: files scanned / served-language files it did not resolve for, never read / all indexed. ellipsis=first-match: one first-match-wins probe, not exhaustive; ellipsis_bound= its sibling cap; ellipsis_skipped= nodes abandoned over it (a floor). m p= in=: the hit's file:line and its enclosing symbol; the text is the matched node. --> +<pattern schema="ripwire.pattern/v1" hits="370" shown="100" capped="1" total="370" has_more="1" next_offset="100" offset="0" limit="0" hits_capped="0" q="DISCLOSE(...)" grammars="cpp,cpp/cu,c,python,go,rust,typescript,tsx,swift,objc,javascript,java,csharp" shapes="cpp:call_expression,cpp/cu:call_exp … [line truncated: 446 more bytes on this line] +<m p="src/abicheck.h:517" in="collectAuthoredSites">DISCLOSE( result, AbiResult::DisclosureWhy::NoMergeBase, "abi: no merge-base for a ref (unrelated history?) — that ref</m> +<m p="src/arch.h:512" in="parseArchRules">DISCLOSE( Diagnostics::answerRefused, "--arch exits 1 with path:line and the reason on stderr; no report is printed", </m> +<m p="src/arch.h:846" in="readArchBaselineSidecar">DISCLOSE( baseline, ArchBaselineRead::DisclosureWhy::SymlinkRefused, "arch: refusing to read the arch baseline sidecar t</m> +<m p="src/arch.h:897" in="openArchBaselineSidecar">DISCLOSE( Diagnostics::answerRefused, "--baseline exits 1: pathguard names the refused link on stderr and the verb says </m> +<m p="src/atoms.h:372" in="collectExclusions">DISCLOSE( ex, Exclusions::DisclosureWhy::ForHeaderSaturated, "atoms: the for-header exclusion stream spent its whole bud</m> +<m p="src/atoms.h:376" in="collectExclusions">DISCLOSE( ex, Exclusions::DisclosureWhy::StmtCrementSaturated, "atoms: the statement-crement exclusion stream spent its </m> +<m p="src/atoms.h:380" in="collectExclusions">DISCLOSE( ex, Exclusions::DisclosureWhy::StmtAssignSaturated, "atoms: the statement-assign exclusion stream spent its wh</m> +<m p="src/atoms.h:384" in="collectExclusions">DISCLOSE( ex, Exclusions::DisclosureWhy::InnerCommaSaturated, "atoms: the inner-comma exclusion stream spent its whole b</m> +<m p="src/clones.h:1321" in="walkByBucket">DISCLOSE( st_, Type3Stats::DisclosureWhy::PairCapHit, "clones: Type-3 pair cap hit — first N compared (both-gate-survi</m> +<m p="src/commentcoherence.h:216" in="computeCommentCoherence">DISCLOSE( scan, CommentCoherenceScan::DisclosureWhy::UnreadableFile, "comment-coherence: an indexed file could not be re</m> +<m p="src/crossref.h:603" in="streamOversizeInPieces">DISCLOSE( st, StreamBlobStats::DisclosureWhy::StreamEndedMidBlob, "crossref: git cat-file stream ended</m> +<m p="src/crossref.h:640" in="streamBlobs">DISCLOSE( st, StreamBlobStats::DisclosureWhy::ListUnwritable, "crossref: cannot write the blob-batch list — cross-bran</m> +<m p="src/crossref.h:656" in="streamBlobs">DISCLOSE( st, StreamBlobStats::DisclosureWhy::BatchNotStarted, "crossref: git cat-file --batch failed to start — cross</m> +<m p="src/crossref.h:710" in="streamBlobs">DISCLOSE( st, StreamBlobStats::DisclosureWhy::StreamEndedMidBlob, "crossref: git cat-file stream e</m> +<m p="src/crossref.h:977" in="refCommitTime">DISCLOSE( sink, RefEnumeration::DisclosureWhy::DateUnreadable, "crossref: for-each-ref yielded a ref with no readable co</m> +<m p="src/crossref.h:1013" in="enumerateRefs">DISCLOSE( dropSink, RefEnumeration::DisclosureWhy::TipNotObjectName, "crossref: for-each-ref yielded a ref whose tip is </m> +<m p="src/crossref.h:1111" in="diffRaw">DISCLOSE( "crossref: refusing a diff whose revision arguments are not resolved object names" )</m> +<m p="src/crossref.h:1197" in="parallelIndexed">DISCLOSE( sweep, ParallelSweep::DisclosureWhy::WorkerThrew, "crossref: a git worker threw — this shard of the sweep is</m> +<m p="src/crossref.h:1265" in="streamBlobsInSlices">DISCLOSE( stats, StreamBlobStats::DisclosureWhy::BatchNotStarted, "crossref: a blob-stream slice was never read — comp</m> +<m p="src/crossref.h:1581" in="probeRefBase">DISCLOSE( plumb, RefPlumbing::DisclosureWhy::RevisionNotObjectName, "crossref: ref tip or HEAD is not a resolved object </m> +<m p="src/crossref.h:1592" in="probeRefBase">DISCLOSE( plumb, RefPlumbing::DisclosureWhy::MergeBaseNotObjectName, "crossref: merge-base returned something that is no</m> +<m p="src/crossref.h:1599" in="probeRefBase">DISCLOSE( plumb, RefPlumbing::DisclosureWhy::NoMergeBase, "crossref: no merge-base for ref (shallow clone or unrelated h</m> +<m p="src/crossref.h:1751" in="probeRefBases">DISCLOSE( plumbing[ i ], RefPlumbing::DisclosureWhy::NoMergeBase, "crossref: no merge-base for ref (shallow clone or unr</m> +<m p="src/crossref.h:2772" in="lsTree">DISCLOSE( "crossref: refusing to list a tree whose revision argument is not a resolved object name" )</m> +<m p="src/crossref.h:3166" in="relabelHeadHitsFromIndex">DISCLOSE( "whereis: the index's def sites match no HEAD row (working tree drifted from HEAD?) — keeping the lexical la</m> +<m p="src/crossref.h:3439" in="readBranchParseBatch">DISCLOSE( reads[ k ], BranchBlobReadBack::DisclosureWhy::NotReadBackWhole, "whereis: a blob the pa</m> +<m p="src/crossref.h:3688" in="scanWorktree">DISCLOSE( scan, WorktreeScan::DisclosureWhy::ListingFailed, "whereis: git could not list the working tree's changes — </m> +<m p="src/crossref.h:3698" in="scanWorktree">DISCLOSE( scan, WorktreeScan::DisclosureWhy::OverPathCap, "whereis: more changed paths than the overlay reads — the re</m> +… [73 more display lines; full output is 18272 bytes on 1 raw line(s)] +````` + +## `./build/ripwire . --pattern='x'` + +*A pattern that collapses to a bare token is REFUSED — never reported as hits=0.* + +**exit code: 1** + +````` +(empty) +````` + +stderr: + +````` +ripwire: --pattern: this pattern collapses to a single bare token, which is a TEXT search, not a structural one — a clean parse is not enough (a bare word parses fine in most grammars and means nothing structural). Give it a shape (foo($X), $A + $B, if ($C) { ... }) or use the grep flag for litera … [line truncated: 176 more bytes on this line] +````` + +## `./build/ripwire . --grep=DISCLOSE --and=cache` + +*Boolean grep: hits where BOTH literals share the matched line (--grep-scope=line is the default).* + +````` +<!-- ripwire grep schema=ripwire.grep/v1: literal/regex scan grouped by file: <f p=> +<hit l= in=>CDATA text</hit> (<b>/<a> context around it); complete=1 only for an exhaustive literal scan (beside pattern_meta=, of the literal reading only); <unindexed> = 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] +<grep pattern="DISCLOSE" schema="ripwire.grep/v1" root="." terms="DISCLOSE +cache" scope="line" terms_suppressed="1141" files="10" hits="31" shown="31" capped="0" hits_capped="0" suppressed_comment="2" suppressed_string="8" tier_parsed="14" tier_unclassified="0" corpus_oversize="15" corpus_pruned_di … [line truncated: 121 more bytes on this line] +<f p="src/ingest_cache.h"> +<hit l="2321" in="openCacheFrame" n="6"> +<![CDATA[ DISCLOSE( Diagnostics::answerUnchanged, "a rejected cache is rebuilt from source: this run parses and answers byte-identically",]]> +<at l="2329" in="openCacheFrame"/> +<at l="2337" in="openCacheFrame"/> +<at l="2409" in="openCacheFrame"/> +<at l="2575" in="ByteR::fitsBelow"/> +<at l="3008" in="readFileRecord"/> +</hit> +<hit l="2369" in="openCacheFrame" n="6"> +<![CDATA[ DISCLOSE( Diagnostics::answerUnchanged, "a rejected cache is rebuilt from source: this run parses and answers byte-identically",]]> +<at l="2387" in="openCacheFrame"/> +<at l="2751" in="readRefQualifier"/> +<at l="2820" in="readDef"/> +<at l="2830" in="readDef"/> +<at l="3017" in="readFileRecord"/> +</hit> +<hit l="3054" in="readFileRecord" n="2"> +<![CDATA[ DISCLOSE( Diagnostics::answerUnchanged, "a rejected cache is rebuilt from source: this run parses and answers byte-identically",]]> +<at l="3450" in="loadCache"/> +</hit> +<hit l="4030" in="saveCache"> +<![CDATA[ DISCLOSE( Diagnostics::answerUnchanged, "this answer is already computed in memory: only the next run starts cold", "ingest: saveCache rename(tmp -> cache) failed — old cache preserved" );]]> +</hit> +</f> +<f p="src/ingest_crawl.h" parse_degraded="1"> +<hit l="2349" in="isReadableCacheBlob"> +… [139 more display lines; full output is 11580 bytes on 1 raw line(s)] +````` + +## `./build/ripwire . --grep=DISCLOSE --not=test --grep-scope=file` + +*Drop every hit in a file that ALSO contains the --not literal anywhere (file scope).* + +````` +<!-- ripwire grep schema=ripwire.grep/v1: literal/regex scan grouped by file: <f p=> +<hit l= in=>CDATA text</hit> (<b>/<a> context around it); complete=1 only for an exhaustive literal scan (beside pattern_meta=, of the literal reading only); <unindexed> = 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: 1589 more bytes on this line] +<grep pattern="DISCLOSE" schema="ripwire.grep/v1" root="." terms="DISCLOSE -test" scope="file" terms_suppressed="1131" files="6" hits="18" shown="18" capped="0" hits_capped="0" suppressed_comment="31" suppressed_string="3" tier_parsed="25" tier_unclassified="0" corpus_oversize="15" corpus_pruned_dir … [line truncated: 123 more bytes on this line] +<f p="src/commentcoherence.h" parse_degraded="1"> +<hit l="216" in="rw::computeCommentCoherence"> +<![CDATA[ DISCLOSE( scan, CommentCoherenceScan::DisclosureWhy::UnreadableFile, "comment-coherence: an indexed file could not be read — its functions are absent from the report" );]]> +</hit> +</f> +<f p="src/forctorhop.h"> +<hit l="167" in="rw::spliceCtorHop"> +<![CDATA[ DISCLOSE( Diagnostics::answerUnchanged, "no row carries ctor_l=: the answer is the one without the constructor hop",]]> +</hit> +</f> +<f p="src/forrowfeatures.h"> +<hit l="127" in="rw::armRowFeatures"> +<![CDATA[ DISCLOSE( Diagnostics::answerUnchanged, "the dump is a side file; the answer never reads it", "RIPWIRE_ROW_FEATURES: not a path" );]]> +</hit> +<hit l="134" in="rw::armRowFeatures"> +<![CDATA[ DISCLOSE( Diagnostics::answerUnchanged, "the dump is a side file; the answer never reads it", "RIPWIRE_ROW_FEATURES: a directory" );]]> +</hit> +<hit l="140" in="rw::armRowFeatures"> +<![CDATA[ DISCLOSE( Diagnostics::answerUnchanged, "the dump is a side file; the answer never reads it", "RIPWIRE_ROW_FEATURES: posture not captured" );]]> +</hit> +<hit l="758" in="rw::rowFeaturesNoteCapture"> +<![CDATA[ DISCLOSE( Diagnostics::answerUnchanged, "the dump is a side file; the answer never reads it", "RIPWIRE_ROW_FEATURES: answer not captured whole" );]]> +</hit> +<hit l="799" in="rw::rowFeaturesFinish"> +<![CDATA[ DISCLOSE( Diagnostics::answerUnchanged, "the dump is a side file written after the answer; the answer never reads it", "RIPWIRE_ROW_FEATURES: write failed" );]]> +</hit> +</f> +… [106 more display lines; full output is 8783 bytes on 1 raw line(s)] +````` + +## `./build/ripwire . --grep=DISCLOSE --grep=cache` + +*A second --grep= REFUSES and names --and= as the AND spelling — no silent overwrite.* + +**exit code: 1** + +````` +(empty) +````` + +stderr: + +````` +ripwire: --grep given twice; did you mean --grep='A' --and='B'? +````` + +## `./build/ripwire . --grep=DISCLOSE --grep-in=any` + +*Span tiers off: the exhaustive view — the comment and string hits the default tier held back (suppressed_comment=96 / suppressed_string=29 in the plain --grep block above) now print alongside the code hits; hits= grows accordingly.* + +````` +<!-- ripwire grep schema=ripwire.grep/v1: literal/regex scan grouped by file: <f p=> +<hit l= in=>CDATA text</hit> (<b>/<a> context around it); complete=1 only for an exhaustive literal scan (beside pattern_meta=, of the literal reading only); <unindexed> = off-index. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). h … [line truncated: 1741 more bytes on this line] +<grep pattern="DISCLOSE" schema="ripwire.grep/v1" root="." files="315" hits="1153" shown="100" capped="1" total="1153" has_more="1" next_offset="100" offset="0" limit="0" hits_capped="0" corpus_oversize="15" corpus_pruned_dirs="6" unindexed_hits="15" unindexed_files_scanned="327" unindexed_files_ski … [line truncated: 62 more bytes on this line] +<f p=".coderabbit.yaml"> +<hit l="33" in="path_instructions" occ="2"> +<![CDATA[ A degrade path uses DISCLOSE( sink, why ), never ASSUME(false): a one-argument DISCLOSE( msg ) is a debug trace]]> +</hit> +</f> +<f p=".github/workflows/ci.yml"> +<hit l="389" in="release"> +<![CDATA[ # Release — defines NDEBUG, which compiles the DISCLOSE( msg ) trace out; the optimizer-visible build.]]> +</hit> +<hit l="390" in="release"> +<![CDATA[ # plain — NDEBUG off, so the DISCLOSE( msg ) trace compiles in and the degrade-path gates can observe]]> +</hit> +</f> +<f p="docs/limits_build.py"> +<hit l="3"> +<![CDATA[# whether the file it lives in DISCLOSES a truncation when it fires.]]> +</hit> +</f> +<f p="scripts/optremarks.py"> +<hit l="156" in="COLD_FILES"> +<![CDATA[ "the ASSUME / DISCLOSE handlers. They run on a degrade path: once, after something has already gone wrong." ),]]> +</hit> +</f> +<f p="src/abicheck.h" parse_degraded="1"> +<hit l="111"> +<![CDATA[#include "infra/Diagnostics.h" // ASSUME / DISCLOSE]]> +</hit> +… [437 more display lines; full output is 27699 bytes on 1 raw line(s)] +````` + +## `./build/ripwire . --grep=deterministic` + +*A literal whose classified hits are all prose: the answer serves tier="comment+string" rather than an empty code tier, and tier_unclassified= says how many hits the fixed parse budget never classified.* + +````` +<!-- ripwire grep schema=ripwire.grep/v1: literal/regex scan grouped by file: <f p=> +<hit l= in=>CDATA text</hit> (<b>/<a> context around it); complete=1 only for an exhaustive literal scan (beside pattern_meta=, of the literal reading only); <unindexed> = off-index. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). c … [line truncated: 2311 more bytes on this line] +<grep pattern="deterministic" schema="ripwire.grep/v1" root="." files="591" hits="1396" shown="100" capped="1" total="1396" has_more="1" next_offset="100" offset="0" limit="0" hits_capped="0" suppressed_comment="218" tier="code+string" tier_partial="1" tier_parsed="67" tier_unclassified="1511" tier_ … [line truncated: 230 more bytes on this line] +<f p=".github/workflows/ci.yml"> +<hit l="1007" in="windows"> +<![CDATA[ # on the machine is not one deterministic build step (G3). Read it back rather than assume it took.]]> +</hit> +<hit l="1044" in="windows"> +<![CDATA[ # 951-byte legend plus one bare <r>, is deterministic across two runs, and parses as well-formed]]> +</hit> +</f> +<f p="present/deck5_ripwire_build.js"> +<hit l="127"> +<![CDATA[ s.addText("A zero-runtime-dependency C++23 CLI that maps any codebase into a ranked, deterministic call graph for coding agents — and puts a tripwire on every claim it emits.",]]> +</hit> +<hit l="505"> +<![CDATA[ ["Kotlin", "by @xCatG: calls resolve between Kotlin and Java, both ways; no sanitizer finding across 501 real .kt files, deterministic on ~9,500 more (#126)", CYAN],]]> +</hit> +<hit l="531" line_bytes="574"> +<![CDATA[ "- Kotlin — merged: #126, merge commit 1ad9184a (2026-09-11); PR body, PR author xCatG: “vendored fwcd/tree-sitter-kotlin grammar … a JVM interop bridge that resolves Kotlin↔Java calls bidirectionally”; “Zero ASan/UBSan/LSan findings across 501 real .kt files (8 local Androi … [line truncated: 224 more bytes on this line] +</hit> +<hit l="601" line_bytes="532"> +<![CDATA[ "FOOTER (the instruments). From the release notes' Highlights: 'Three readouts, all registered before the work began, and none of them a model's opinion. A frozen bank of 30 retrieval questions, each answered in ONE call on a 2,066-file C++ corpus pinned at one commit, scored on the gol … [line truncated: 224 more bytes on this line] +</hit> +<hit l="1467"> +<![CDATA[ foot(s, "the MCP server exposes the same deterministic engine — one index, shared with the CLI, staleness-checked");]]> +</hit> +<hit l="1664"> +<![CDATA[ ["2009", "Reciprocal Rank Fusion — Cormack et al.", "deterministic signal fusion (--rank-by=rrf)"],]]> +</hit> +… [672 more display lines; full output is 40302 bytes on 1 raw line(s)] +````` + +## `./build/ripwire . --grep=DISCLOSE --handles` + +*h= on each editable enclosing-symbol row: a freshness-pinned identity an edit verb can target and must refuse on after any file change.* + +````` +<!-- ripwire grep schema=ripwire.grep/v1: literal/regex scan grouped by file: <f p=> +<hit l= in=>CDATA text</hit> (<b>/<a> context around it); complete=1 only for an exhaustive literal scan (beside pattern_meta=, of the literal reading only); <unindexed> = off-index. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). c … [line truncated: 2417 more bytes on this line] +<grep pattern="DISCLOSE" schema="ripwire.grep/v1" root="." files="292" hits="993" shown="100" capped="1" total="993" has_more="1" next_offset="100" offset="0" limit="0" hits_capped="0" suppressed_comment="159" suppressed_string="4" tier_parsed="77" tier_unclassified="771" tier_budget="bytes" tier_fi … [line truncated: 202 more bytes on this line] +<f p=".coderabbit.yaml"> +<hit l="33" in="path_instructions" occ="2"> +<![CDATA[ A degrade path uses DISCLOSE( sink, why ), never ASSUME(false): a one-argument DISCLOSE( msg ) is a debug trace]]> +</hit> +</f> +<f p="src/abicheck.h" parse_degraded="1"> +<hit l="517" in="abicheck::collectAuthoredSites"> +<![CDATA[ DISCLOSE( result, AbiResult::DisclosureWhy::NoMergeBase, "abi: no merge-base for a ref (unrelated history?) — that ref is counted, not compared" );]]> +</hit> +</f> +<f p="src/arch.h"> +<hit l="512" in="rw::parseArchRules"> +<![CDATA[ DISCLOSE( Diagnostics::answerRefused, "--arch exits 1 with path:line and the reason on stderr; no report is printed",]]> +</hit> +<hit l="846" in="rw::readArchBaselineSidecar"> +<![CDATA[ if( sidecar.refused ) { DISCLOSE( baseline, ArchBaselineRead::DisclosureWhy::SymlinkRefused, "arch: refusing to read the arch baseline sidecar through a symlink" ); }]]> +</hit> +<hit l="897" in="rw::openArchBaselineSidecar"> +<![CDATA[ DISCLOSE( Diagnostics::answerRefused, "--baseline exits 1: pathguard names the refused link on stderr and the verb says it cannot write the sidecar",]]> +</hit> +</f> +<f p="src/atoms.h"> +<hit l="372" in="atomdetail::collectExclusions"> +<![CDATA[ DISCLOSE( ex, Exclusions::DisclosureWhy::ForHeaderSaturated, "atoms: the for-header exclusion stream spent its whole budget; the rules reading it are suppressed this run" );]]> +</hit> +<hit l="376" in="atomdetail::collectExclusions"> +<![CDATA[ DISCLOSE( ex, Exclusions::DisclosureWhy::StmtCrementSaturated, "atoms: the statement-crement exclusion stream spent its whole budget; the rules reading it are suppressed this run" );]]> +… [463 more display lines; full output is 33298 bytes on 1 raw line(s)] +````` + +## `./build/ripwire . --grep=DISCLOSE --legend=compact` + +*The grep compact legend (ripwire.grep/v1).* + +````` +<!-- ripwire grep schema=ripwire.grep/v1: literal/regex scan grouped by file: <f p=> +<hit l= in=>CDATA text</hit> (<b>/<a> context around it); complete=1 only for an exhaustive literal scan (beside pattern_meta=, of the literal reading only); <unindexed> = off-index. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). c … [line truncated: 2304 more bytes on this line] +<grep pattern="DISCLOSE" schema="ripwire.grep/v1" root="." files="292" hits="993" shown="100" capped="1" total="993" has_more="1" next_offset="100" offset="0" limit="0" hits_capped="0" suppressed_comment="159" suppressed_string="4" tier_parsed="77" tier_unclassified="771" tier_budget="bytes" tier_fi … [line truncated: 202 more bytes on this line] +<f p=".coderabbit.yaml"> +<hit l="33" in="path_instructions" occ="2"> +<![CDATA[ A degrade path uses DISCLOSE( sink, why ), never ASSUME(false): a one-argument DISCLOSE( msg ) is a debug trace]]> +</hit> +</f> +<f p="src/abicheck.h" parse_degraded="1"> +<hit l="517" in="abicheck::collectAuthoredSites"> +<![CDATA[ DISCLOSE( result, AbiResult::DisclosureWhy::NoMergeBase, "abi: no merge-base for a ref (unrelated history?) — that ref is counted, not compared" );]]> +</hit> +</f> +<f p="src/arch.h"> +<hit l="512" in="rw::parseArchRules"> +<![CDATA[ DISCLOSE( Diagnostics::answerRefused, "--arch exits 1 with path:line and the reason on stderr; no report is printed",]]> +</hit> +<hit l="846" in="rw::readArchBaselineSidecar"> +<![CDATA[ if( sidecar.refused ) { DISCLOSE( baseline, ArchBaselineRead::DisclosureWhy::SymlinkRefused, "arch: refusing to read the arch baseline sidecar through a symlink" ); }]]> +</hit> +<hit l="897" in="rw::openArchBaselineSidecar"> +<![CDATA[ DISCLOSE( Diagnostics::answerRefused, "--baseline exits 1: pathguard names the refused link on stderr and the verb says it cannot write the sidecar",]]> +</hit> +</f> +<f p="src/atoms.h"> +<hit l="372" in="atomdetail::collectExclusions"> +<![CDATA[ DISCLOSE( ex, Exclusions::DisclosureWhy::ForHeaderSaturated, "atoms: the for-header exclusion stream spent its whole budget; the rules reading it are suppressed this run" );]]> +</hit> +<hit l="376" in="atomdetail::collectExclusions"> +<![CDATA[ DISCLOSE( ex, Exclusions::DisclosureWhy::StmtCrementSaturated, "atoms: the statement-crement exclusion stream spent its whole budget; the rules reading it are suppressed this run" );]]> +… [463 more display lines; full output is 30177 bytes on 1 raw line(s)] +````` + +## `./build/ripwire . --for="tree-sitter parse of a source file" --legend=compact` + +*The --for compact legend (ripwire.for/v1) — every data/completeness attribute kept.* + +**wall time: 1.89s** + +````` +<ctx task="tree-sitter parse of a source file" route="subtoken+body" root="." confidence="low" margin_pct="0" at="914c4045d" doc_mentions="1" schema="ripwire.for/v1" bundle="compact" bodies="0" reason="compact-route" budget_bytes="7500" est_tokens="10042"> +<!-- ripwire for schema=ripwire.for/v1: bundle=/bodies=/reason= the body posture; d: cx= ccx= complexity, in= callers (absent cx/ccx/in = 0), churn= amp= change, clone= tested= 1, sc= scope, id=p::sc::n; total= shown= capped=1 if cut; task= the query; d pure=1 const/constexpr sig, next= the follow-up to paste; d same_as=N: doc+sig text as row n=N (not repeated); route= name-exact(X)|subtoken+body[:broad|:declined]; confidence=/margin_pct= head score drop (low=flat); h l= p= n=, c n= l= p= (p= if not h's; same-named joined, shown= counts them), noedge= no callee resolved; fold kind=bodies: b t= n= p= l= top ranked rows' whole bodies, not the answer; served= of total= in budget_bytes=; slice/skip p= n= l=; skip bytes= next=; a skip makes sigs next= it, sigs_next= the signatures-only re-call; d mem= an owner's direct member names only, by the index (question words first, then owner's file, path, line, name), mem_more= names cut; t p= file outside sigs (weaker), t sym= its top symbols not in sigs/syms (a pointer, not the answer), r= rank (gap = trimmed); t order: code files first, then doc files (a code question); t page rows go on to file-page row 160 (code question: 160 code rows, docs within row 160); past page 0 (code question: past 40 code rows, a doc past row 40) listed last, head files skipped; past 120 of those p= only, p_only= counts them; t folded=class=N: N p= only rows of that class (doc|config|script|testdata|other) not listed, next= pages to them; d e= its last line (absent=unknown, never 0; l= the name's line) [doc mentions: 1 doc, 1 symbol; doc_mentions=] --> +<!-- root= is the crawl root; p= below is RELATIVE to it (single-root only; absent => p= is ingest's own path, unchanged); at=this commit(+dirty). [budget_bytes= is the default BYTE target this ranked payload was shaped toward: row text shortens toward it, no row of the ranked head is removed for it (sigs past_target=)] [sigs capped=1 with shown=total: rows shrunk, none dropped] [sigs past_target=K: the last K rows are past the budget_bytes target, served because they are rows of the ranked head; none is cut] [sigs next=: one call serving all total= rows uncut] [docs_dropped=N: N shown rows have a doc comment not printed (r>24 always, r5..24 if capped)] [files_first=N: N rows moved so r=1..8 are distinct files' best rows, score order, a repeated name once; same rows; fold, hops keep score order]; lego/compose collapse to a counted stub by default (a disclosed cut): total= that section's own pre-cap row count, shown="0" capped="1" (nothing rendered here), next= names the sections=lego,compose flag that restores both sections byte-identically in one call est_tokens= prices this bundle in tokens --> +<sigs shown="40" total="40" capped="1" past_target="7" docs_dropped="24" files_first="7" next="--for='tree-sitter parse of a source file' --signatures-only --token-budget=5400"> +<d l="28" e="63" n="topLevelEvidence" sc="rw::pythonrunner" p="src/pythonrunner.h" cx="4" ccx="3" in="2" churn="5" amp="15" r="1" next="--expand=src/pythonrunner.h:topLevelEvidence">inline bool topLevelEvidence( std::string_view source, const TSLanguage* language, const Predicate& predicate )</d … [line truncated: 1 more bytes on this line] +<d l="45" e="45" n="kDefaultMaxFileBytes" sc="rw" p="src/ingest.h" churn="72" amp="185" pure="1" r="2"> +<doc>The crawl's per-file byte ceiling. A text file larger than this is skipped: at this size it is o…</doc>constexpr std::size_t kDefaultMaxFileBytes = 4u * 1024u * 1024u</d> +<d l="1247" e="1255" n="parseTree" p="src/ingest_sidecap.h" cx="1" in="4" churn="188" amp="364" tested="1" r="3">TSTree* parseTree( TSParser* parser, std::string_view src )</d> +<d l="594" e="669" n="doctorProbeGrammars" p="src/verbs_doctor.h" cx="7" ccx="17" in="1" churn="51" amp="150" r="4"> +<doc>Exercise every registered grammar and its embedded query, reporting loaded and expected totals</doc>inline DoctorGrammarProbe doctorProbeGrammars()</d> +<d l="527" e="565" n="SourceReader" sc="SourceReader" p="src/forselfhook.h" churn="11" amp="10" r="5" mem="parsed">class SourceReader</d> +<d l="104" e="238" n="kLangTable" p="src/ingest_crawl.h" churn="90" amp="225" pure="1" r="6">constexpr std::array<LangEntry, 58> kLangTable =</d> +<d l="2495" e="2510" n="FileHealth" sc="FileHealth" p="src/model.h" churn="338" amp="570" r="7" mem="operator==">struct FileHealth</d> +<d l="308" e="343" n="SliceScan" sc="SliceScan" p="src/slice.h" churn="54" amp="102" r="8" mem="disclose">struct SliceScan</d> +<d l="138" e="152" n="ParsedFile::ParsedFile" p="src/forselfhook.h" cx="2" ccx="1" churn="11" amp="10" r="9">explicit ParsedFile( std::string bytes ) : m_bytes( std::move( bytes ) )</d> +<d l="135" e="177" n="ParsedFile" sc="ParsedFile" p="src/forselfhook.h" churn="11" amp="10" r="10" mem="operator=,usable,root,text">class ParsedFile</d> +<!-- demote: a <t> in sigs is a lower same-file sibling past answer row 10, a pointer (p= file, sym= name, r= rank), not the answer --> +<t p="src/ingest.h" sym="AstWalk" r="11"/> +<t p="src/ingest_sidecap.h" sym="astroFenceTailIsBlank" r="12"/> +<d l="386" e="459" n="sliceAtRev" sc="slicediff" p="src/slicediff.h" cx="14" ccx="15" in="1" churn="14" amp="76" r="13">inline RevSide sliceAtRev( const std::string& root, const std::string& sha, const std::string& rel, const Symbol& sym, SliceFam fam, const ::TSLanguage* grammar, st … [line truncated: 77 more bytes on this line] +<d l="2075" e="2104" n="collectGatedLocalNames" sc="rw" p="src/ingest_astquery.h" cx="6" ccx="5" in="1" churn="61" amp="178" r="14">std::vector<LocalNameFact> collectGatedLocalNames( std::string_view defBytes, std::uint32_t defStartLine, Lang lang )</d> +<d l="927" e="978" n="scanModule" sc="detail" p="src/jsrunner.h" cx="16" ccx="15" in="3" churn="22" amp="109" r="15">inline ModuleScan scanModule( std::string_view source, std::string_view path )</d> +<t p="src/ingest.h" sym="kMaxKotlinStringNestDepth" r="16"/> +<d l="87" e="97" n="hasMainGuard" sc="rw::pythonrunner" p="src/pythonrunner.h" cx="2" ccx="2" in="1" churn="5" amp="14" r="17">inline bool hasMainGuard( std::string_view source )</d> +<d l="223" e="227" n="hasPhantomScopeSeparator" p="src/ingest_names.h" cx="2" ccx="1" in="2" churn="87" amp="249" tested="1" r="18">inline bool hasPhantomScopeSeparator( TSNode qualified ) noexcept</d> +<t p="src/slice.h" sym="DisclosureWhy" r="19"/> +<t p="src/ingest_crawl.h" sym="jsonNestsTooDeep" r="20"/> +<t p="src/ingest.h" sym="kMaxYamlNestDepth" r="21"/> +<t p="src/ingest_astquery.h" sym="spanTiersOfFiles" r="22"/> +<t p="src/slice.h" sym="sliceScanDefinition" r="23"/> +… [243 more display lines; full output is 26462 bytes on 44 raw line(s)] +````` + +## `./build/ripwire . --for="tree-sitter parse of a source file" --sections=lego,compose` + +*Restore the <lego>/<compose> sections the --for bundle collapses to a counted stub by default (this is the stub's own next= spelling).* + +**wall time: 3.42s** + +````` +<ctx task="tree-sitter parse of a source file" route="subtoken+body" root="." confidence="low" margin_pct="0" at="914c4045d" doc_mentions="1" schema="ripwire.for/v1" bundle="compact" bodies="0" reason="compact-route" budget_bytes="7500" est_tokens="10590"> +<!-- ripwire for schema=ripwire.for/v1: bundle=/bodies=/reason= the body posture; d: cx= ccx= complexity, in= callers (absent cx/ccx/in = 0), churn= amp= change, clone= tested= 1, sc= scope, id=p::sc::n; total= shown= capped=1 if cut; task= the query; d pure=1 const/constexpr sig, next= the follow-up to paste; d same_as=N: doc+sig text as row n=N (not repeated); route= name-exact(X)|subtoken+body[:broad|:declined]; confidence=/margin_pct= head score drop (low=flat); h l= p= n=, c n= l= p= (p= if not h's; same-named joined, shown= counts them), noedge= no callee resolved; fold kind=bodies: b t= n= p= l= top ranked rows' whole bodies, not the answer; served= of total= in budget_bytes=; slice/skip p= n= l=; skip bytes= next=; a skip makes sigs next= it, sigs_next= the signatures-only re-call; d mem= an owner's direct member names only, by the index (question words first, then owner's file, path, line, name), mem_more= names cut; t p= file outside sigs (weaker), t sym= its top symbols not in sigs/syms (a pointer, not the answer), r= rank (gap = trimmed); t order: code files first, then doc files (a code question); t page rows go on to file-page row 160 (code question: 160 code rows, docs within row 160); past page 0 (code question: past 40 code rows, a doc past row 40) listed last, head files skipped; past 120 of those p= only, p_only= counts them; t folded=class=N: N p= only rows of that class (doc|config|script|testdata|other) not listed, next= pages to them; field name= type= owner= rel=: a member of owner=, rel=creates held by value, uses by reference/pointer; iface implementors=N: types implementing it, m= its method contract; d e= its last line (absent=unknown, never 0; l= the name's line) [doc mentions: 1 doc, 1 symbol; doc_mentions=] --> +<!-- root= is the crawl root; p= below is RELATIVE to it (single-root only; absent => p= is ingest's own path, unchanged); at=this commit(+dirty). [budget_bytes= is the default BYTE target this ranked payload was shaped toward: row text shortens toward it, no row of the ranked head is removed for it (sigs past_target=)] [sigs capped=1 with shown=total: rows shrunk, none dropped] [sigs past_target=K: the last K rows are past the budget_bytes target, served because they are rows of the ranked head; none is cut] [sigs next=: one call serving all total= rows uncut] [docs_dropped=N: N shown rows have a doc comment not printed (r>24 always, r5..24 if capped)] [files_first=N: N rows moved so r=1..8 are distinct files' best rows, score order, a repeated name once; same rows; fold, hops keep score order]; iface implementors=N counts every type an extends/implements clause binds to it (the lego verb's count), never the rows listed: shown_implementors=K only K impl rows here (implementors_capped=1), implementors_next= lists all; implementors_floor=1 an extends clause spelled like it bound nowhere, so N may be short (not proof of another), floor_next= lists every extends site est_tokens= prices this bundle in tokens --> +<sigs shown="40" total="40" capped="1" past_target="7" docs_dropped="24" files_first="7" next="--for='tree-sitter parse of a source file' --signatures-only --token-budget=5400"> +<d l="28" e="63" n="topLevelEvidence" sc="rw::pythonrunner" p="src/pythonrunner.h" cx="4" ccx="3" in="2" churn="5" amp="15" r="1" next="--expand=src/pythonrunner.h:topLevelEvidence">inline bool topLevelEvidence( std::string_view source, const TSLanguage* language, const Predicate& predicate )</d … [line truncated: 1 more bytes on this line] +<d l="45" e="45" n="kDefaultMaxFileBytes" sc="rw" p="src/ingest.h" churn="72" amp="185" pure="1" r="2"> +<doc>The crawl's per-file byte ceiling. A text file larger than this is skipped: at this size it is o…</doc>constexpr std::size_t kDefaultMaxFileBytes = 4u * 1024u * 1024u</d> +<d l="1247" e="1255" n="parseTree" p="src/ingest_sidecap.h" cx="1" in="4" churn="188" amp="364" tested="1" r="3">TSTree* parseTree( TSParser* parser, std::string_view src )</d> +<d l="594" e="669" n="doctorProbeGrammars" p="src/verbs_doctor.h" cx="7" ccx="17" in="1" churn="51" amp="150" r="4"> +<doc>Exercise every registered grammar and its embedded query, reporting loaded and expected totals</doc>inline DoctorGrammarProbe doctorProbeGrammars()</d> +<d l="527" e="565" n="SourceReader" sc="SourceReader" p="src/forselfhook.h" churn="11" amp="10" r="5" mem="parsed">class SourceReader</d> +<d l="104" e="238" n="kLangTable" p="src/ingest_crawl.h" churn="90" amp="225" pure="1" r="6">constexpr std::array<LangEntry, 58> kLangTable =</d> +<d l="2495" e="2510" n="FileHealth" sc="FileHealth" p="src/model.h" churn="338" amp="570" r="7" mem="operator==">struct FileHealth</d> +<d l="308" e="343" n="SliceScan" sc="SliceScan" p="src/slice.h" churn="54" amp="102" r="8" mem="disclose">struct SliceScan</d> +<d l="138" e="152" n="ParsedFile::ParsedFile" p="src/forselfhook.h" cx="2" ccx="1" churn="11" amp="10" r="9">explicit ParsedFile( std::string bytes ) : m_bytes( std::move( bytes ) )</d> +<d l="135" e="177" n="ParsedFile" sc="ParsedFile" p="src/forselfhook.h" churn="11" amp="10" r="10" mem="operator=,usable,root,text">class ParsedFile</d> +<!-- demote: a <t> in sigs is a lower same-file sibling past answer row 10, a pointer (p= file, sym= name, r= rank), not the answer --> +<t p="src/ingest.h" sym="AstWalk" r="11"/> +<t p="src/ingest_sidecap.h" sym="astroFenceTailIsBlank" r="12"/> +<d l="386" e="459" n="sliceAtRev" sc="slicediff" p="src/slicediff.h" cx="14" ccx="15" in="1" churn="14" amp="76" r="13">inline RevSide sliceAtRev( const std::string& root, const std::string& sha, const std::string& rel, const Symbol& sym, SliceFam fam, const ::TSLanguage* grammar, st … [line truncated: 77 more bytes on this line] +<d l="2075" e="2104" n="collectGatedLocalNames" sc="rw" p="src/ingest_astquery.h" cx="6" ccx="5" in="1" churn="61" amp="178" r="14">std::vector<LocalNameFact> collectGatedLocalNames( std::string_view defBytes, std::uint32_t defStartLine, Lang lang )</d> +<d l="927" e="978" n="scanModule" sc="detail" p="src/jsrunner.h" cx="16" ccx="15" in="3" churn="22" amp="109" r="15">inline ModuleScan scanModule( std::string_view source, std::string_view path )</d> +<t p="src/ingest.h" sym="kMaxKotlinStringNestDepth" r="16"/> +<d l="87" e="97" n="hasMainGuard" sc="rw::pythonrunner" p="src/pythonrunner.h" cx="2" ccx="2" in="1" churn="5" amp="14" r="17">inline bool hasMainGuard( std::string_view source )</d> +<d l="223" e="227" n="hasPhantomScopeSeparator" p="src/ingest_names.h" cx="2" ccx="1" in="2" churn="87" amp="249" tested="1" r="18">inline bool hasPhantomScopeSeparator( TSNode qualified ) noexcept</d> +<t p="src/slice.h" sym="DisclosureWhy" r="19"/> +<t p="src/ingest_crawl.h" sym="jsonNestsTooDeep" r="20"/> +<t p="src/ingest.h" sym="kMaxYamlNestDepth" r="21"/> +<t p="src/ingest_astquery.h" sym="spanTiersOfFiles" r="22"/> +<t p="src/slice.h" sym="sliceScanDefinition" r="23"/> +… [265 more display lines; full output is 27832 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 <bodies> walk (bundle="auto").* + +**wall time: 3.52s** + +````` +<ctx task="tree-sitter parse of a source file" route="subtoken+body" root="." confidence="low" margin_pct="0" at="914c4045d" doc_mentions="1" schema="ripwire.for/v1" bundle="auto" bodies="5" budget_bytes="7500" est_tokens="10293"> +<!-- ripwire for schema=ripwire.for/v1: bundle=/bodies=/reason= the body posture; d: cx= ccx= complexity, in= callers (absent cx/ccx/in = 0), churn= amp= change, clone= tested= 1, sc= scope, id=p::sc::n; total= shown= capped=1 if cut; task= the query; d pure=1 const/constexpr sig, next= the follow-up to paste; d same_as=N: doc+sig text as row n=N (not repeated); route= name-exact(X)|subtoken+body[:broad|:declined]; confidence=/margin_pct= head score drop (low=flat); b t= n= p= l= full bodies, c n= l= p= callee signatures (p= if not b's); t p= file outside sigs (weaker), t sym= its top symbols not in sigs/syms (a pointer, not the answer), r= rank (gap = trimmed); t order: code files first, then doc files (a code question); t page rows go on to file-page row 160 (code question: 160 code rows, docs within row 160); past page 0 (code question: past 40 code rows, a doc past row 40) listed last, head files skipped; past 120 of those p= only, p_only= counts them; t folded=class=N: N p= only rows of that class (doc|config|script|testdata|other) not listed, next= pages to them; d e= its last line (absent=unknown, never 0; l= the name's line) [doc mentions: 1 doc, 1 symbol; doc_mentions=] --> +<!-- root= is the crawl root; p= below is RELATIVE to it (single-root only; absent => p= is ingest's own path, unchanged); at=this commit(+dirty). [budget_bytes= is the default BYTE target this ranked payload was shaped toward: row text shortens toward it, no row of the ranked head is removed for it (sigs past_target=)] [sigs capped=1 with shown=total: rows shrunk, none dropped] [sigs past_target=K: the last K rows are past the budget_bytes target, served because they are rows of the ranked head; none is cut] [sigs next=: one call serving all total= rows uncut] [docs_dropped=N: N shown rows have a doc comment not printed (r>24 always, r5..24 if capped)] [files_first=N: N rows moved so r=1..8 are distinct files' best rows, score order, a repeated name once; same rows; fold, hops keep score order]; lego/compose collapse to a counted stub by default (a disclosed cut): total= that section's own pre-cap row count, shown="0" capped="1" (nothing rendered here), next= names the sections=lego,compose flag that restores both sections byte-identically in one call est_tokens= prices this bundle in tokens --> +<sigs shown="40" total="40" capped="1" past_target="7" docs_dropped="24" files_first="7" next="--for='tree-sitter parse of a source file' --signatures-only --token-budget=5400"> +<d l="28" e="63" n="topLevelEvidence" sc="rw::pythonrunner" p="src/pythonrunner.h" cx="4" ccx="3" in="2" churn="5" amp="15" r="1" next="--expand=src/pythonrunner.h:topLevelEvidence">inline bool topLevelEvidence( std::string_view source, const TSLanguage* language, const Predicate& predicate )</d … [line truncated: 1 more bytes on this line] +<d l="45" e="45" n="kDefaultMaxFileBytes" sc="rw" p="src/ingest.h" churn="72" amp="185" pure="1" r="2"> +<doc>The crawl's per-file byte ceiling. A text file larger than this is skipped: at this size it is o…</doc>constexpr std::size_t kDefaultMaxFileBytes = 4u * 1024u * 1024u</d> +<d l="1247" e="1255" n="parseTree" p="src/ingest_sidecap.h" cx="1" in="4" churn="188" amp="364" tested="1" r="3">TSTree* parseTree( TSParser* parser, std::string_view src )</d> +<d l="594" e="669" n="doctorProbeGrammars" p="src/verbs_doctor.h" cx="7" ccx="17" in="1" churn="51" amp="150" r="4"> +<doc>Exercise every registered grammar and its embedded query, reporting loaded and expected totals</doc>inline DoctorGrammarProbe doctorProbeGrammars()</d> +<d l="527" e="565" n="SourceReader" sc="SourceReader" p="src/forselfhook.h" churn="11" amp="10" r="5">class SourceReader</d> +<d l="104" e="238" n="kLangTable" p="src/ingest_crawl.h" churn="90" amp="225" pure="1" r="6">constexpr std::array<LangEntry, 58> kLangTable =</d> +<d l="2495" e="2510" n="FileHealth" sc="FileHealth" p="src/model.h" churn="338" amp="570" r="7">struct FileHealth</d> +<d l="308" e="343" n="SliceScan" sc="SliceScan" p="src/slice.h" churn="54" amp="102" r="8">struct SliceScan</d> +<d l="138" e="152" n="ParsedFile::ParsedFile" p="src/forselfhook.h" cx="2" ccx="1" churn="11" amp="10" r="9">explicit ParsedFile( std::string bytes ) : m_bytes( std::move( bytes ) )</d> +<d l="135" e="177" n="ParsedFile" sc="ParsedFile" p="src/forselfhook.h" churn="11" amp="10" r="10">class ParsedFile</d> +<!-- demote: a <t> in sigs is a lower same-file sibling past answer row 10, a pointer (p= file, sym= name, r= rank), not the answer --> +<t p="src/ingest.h" sym="AstWalk" r="11"/> +<t p="src/ingest_sidecap.h" sym="astroFenceTailIsBlank" r="12"/> +<d l="386" e="459" n="sliceAtRev" sc="slicediff" p="src/slicediff.h" cx="14" ccx="15" in="1" churn="14" amp="76" r="13">inline RevSide sliceAtRev( const std::string& root, const std::string& sha, const std::string& rel, const Symbol& sym, SliceFam fam, const ::TSLanguage* grammar, st … [line truncated: 77 more bytes on this line] +<d l="2075" e="2104" n="collectGatedLocalNames" sc="rw" p="src/ingest_astquery.h" cx="6" ccx="5" in="1" churn="61" amp="178" r="14">std::vector<LocalNameFact> collectGatedLocalNames( std::string_view defBytes, std::uint32_t defStartLine, Lang lang )</d> +<d l="927" e="978" n="scanModule" sc="detail" p="src/jsrunner.h" cx="16" ccx="15" in="3" churn="22" amp="109" r="15">inline ModuleScan scanModule( std::string_view source, std::string_view path )</d> +<t p="src/ingest.h" sym="kMaxKotlinStringNestDepth" r="16"/> +<d l="87" e="97" n="hasMainGuard" sc="rw::pythonrunner" p="src/pythonrunner.h" cx="2" ccx="2" in="1" churn="5" amp="14" r="17">inline bool hasMainGuard( std::string_view source )</d> +<d l="223" e="227" n="hasPhantomScopeSeparator" p="src/ingest_names.h" cx="2" ccx="1" in="2" churn="87" amp="249" tested="1" r="18">inline bool hasPhantomScopeSeparator( TSNode qualified ) noexcept</d> +<t p="src/slice.h" sym="DisclosureWhy" r="19"/> +<t p="src/ingest_crawl.h" sym="jsonNestsTooDeep" r="20"/> +<t p="src/ingest.h" sym="kMaxYamlNestDepth" r="21"/> +<t p="src/ingest_astquery.h" sym="spanTiersOfFiles" r="22"/> +<t p="src/slice.h" sym="sliceScanDefinition" r="23"/> +… [273 more display lines; full output is 28246 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: 2.57s** + +````` +<ctx task="quality delta acks ledger rubber stamp" route="subtoken+body" root="." confidence="low" margin_pct="0" at="914c4045d" doc_mentions="1" schema="ripwire.for/v1" bundle="compact" bodies="0" reason="compact-route" budget_bytes="7500" est_tokens="11969"> +<!-- ripwire for schema=ripwire.for/v1: bundle=/bodies=/reason= the body posture; d: cx= ccx= complexity, in= callers (absent cx/ccx/in = 0), churn= amp= change, clone= tested= 1, sc= scope, id=p::sc::n; total= shown= capped=1 if cut; task= the query; d pure=1 const/constexpr sig, next= the follow-up to paste; route= name-exact(X)|subtoken+body[:broad|:declined]; confidence=/margin_pct= head score drop (low=flat); h l= p= n=, c n= l= p= (p= if not h's; same-named joined, shown= counts them), noedge= no callee resolved; h calls capped=1 next= the call listing every callee; fold kind=bodies: b t= n= p= l= top ranked rows' whole bodies, not the answer; served= of total= in budget_bytes=; slice/skip p= n= l=; skip bytes= next=; a skip makes sigs next= it, sigs_next= the signatures-only re-call; d mem= an owner's direct member names only, by the index (question words first, then owner's file, path, line, name), mem_more= names cut; t p= file outside sigs (weaker), t sym= its top symbols not in sigs/syms (a pointer, not the answer), r= rank (gap = trimmed); t order: code files first, then doc files (a code question); t page rows go on to file-page row 160 (code question: 160 code rows, docs within row 160); past page 0 (code question: past 40 code rows, a doc past row 40) listed last, head files skipped; past 120 of those p= only, p_only= counts them; t folded=class=N: N p= only rows of that class (doc|config|script|testdata|other) not listed, next= pages to them; d e= its last line (absent=unknown, never 0; l= the name's line); c prov=split: a resolver split arm; may be another arm's (NOT a claim the edge is false) [doc mentions: 1 doc, 1 symbol; doc_mentions=] --> +<!-- root= is the crawl root; p= below is RELATIVE to it (single-root only; absent => p= is ingest's own path, unchanged); at=this commit(+dirty). [budget_bytes= is the default BYTE target this ranked payload was shaped toward: row text shortens toward it, no row of the ranked head is removed for it (sigs past_target=)] [sigs capped=1 with shown=total: rows shrunk, none dropped] [sigs past_target=K: the last K rows are past the budget_bytes target, served because they are rows of the ranked head; none is cut] [sigs sigs_next=: one call serving all total= rows uncut] [docs_dropped=N: N shown rows have a doc comment not printed (r>24 always, r5..24 if capped)] [files_first=N: N rows moved so r=1..8 are distinct files' best rows, score order, a repeated name once; same rows; fold, hops keep score order]; lego/compose collapse to a counted stub by default (a disclosed cut): total= that section's own pre-cap row count, shown="0" capped="1" (nothing rendered here), next= names the sections=lego,compose flag that restores both sections byte-identically in one call est_tokens= prices this bundle in tokens --> +<sigs shown="40" total="40" capped="1" past_target="13" docs_dropped="27" files_first="38" sigs_next="--for='quality delta acks ledger rubber stamp' --signatures-only --token-budget=6400" next="--expand=src/verbs_quality.h:2776:refuseUnmatchedAckOnly"> +<d l="2846" e="2890" n="runQualityAckWrite" p="src/verbs_quality.h" cx="8" ccx="8" in="1" churn="209" amp="312" r="1" next="--expand=src/verbs_quality.h:runQualityAckWrite"> +<doc>WRITE ACKS — the --quality-ack arm: fold the VISIBLE findings --ack-only selects into the ledg…</doc>int runQualityAckWrite( const rw::Config& cfg, const rw::quality::Scope& scope, const QdPartition& part, DeltaBasis& basis, const std::string& acksFile )</d> +<d l="4905" e="4984" n="computeQualityDelta" sc="rw" p="src/mcpverbs.h" cx="5" ccx="5" in="1" churn="676" amp="692" r="2">inline QualityDeltaOutcome computeQualityDelta( const std::string& root )</d> +<d l="10866" e="10881" n="staleByKindValue" sc="quality" p="src/quality.h" cx="5" ccx="7" in="2" churn="693" amp="874" r="3">inline std::string staleByKindValue( const std::vector<StaleAck>& staleAcks )</d> +<d l="2539" e="2541" n="kAtStampLegend" sc="rw" p="src/serialize.h" churn="521" amp="626" pure="1" r="4">inline constexpr const char* kAtStampLegend = "<!-- at= is the git commit these numbers were com…</d> +<d l="5801" e="5811" n="runForLensPosture" p="src/verbs_for.h" cx="5" ccx="3" in="3" churn="422" amp="505" r="5">std::optional<int> runForLensPosture( const MainDispatch& d, rw::ForAnswerLedger* ledger )</d> +<d l="314" e="371" n="computeDmm" sc="rw::dmm" p="src/dmm.h" cx="9" ccx="6" in="1" churn="16" amp="77" r="6">inline Result computeDmm( const std::string& root, std::string_view spec, const IngestResult& wo…</d> +<d l="2776" e="2801" n="refuseUnmatchedAckOnly" p="src/verbs_quality.h" cx="4" ccx="3" in="1" churn="209" amp="312" r="7"> +<doc>An --ack-only that matched NO finding: refused with exit 1, and nothing accepted. M1 FOLLOW-UP (…</doc>int refuseUnmatchedAckOnly( std::string_view ackOnly, const std::string& acksFile, const gtl::btree_map<std::string, rw::quality::AckRecord>& acks, std::size_t …</d> +<d l="2645" e="2660" n="applyScopeAndAcks" p="src/verbs_quality.h" cx="1" in="1" churn="209" amp="312" r="8"> +<doc>SCOPE + RATCHET — split basis.regs by --scope, then suppress what the ack ledger already accep…</doc>QdPartition applyScopeAndAcks( const rw::quality::Scope& scope, DeltaBasis& basis )</d> +<d l="2405" e="2426" n="refPairStaleAcks" p="src/verbs_quality.h" cx="6" ccx="6" in="1" churn="209" amp="312" r="9"> +<doc>L2 stale acks in the range form. A changed-files answer holds no whole target tree to check the …</doc>std::vector<rw::quality::StaleAck> refPairStaleAcks( const gtl::btree_map<std::string, rw::quality::AckRecord>& acks, const RefPairDelta& refs )</d> +<d l="3449" e="3568" n="runQualityDelta" p="src/verbs_quality.h" cx="14" ccx="15" in="2" churn="209" amp="313" r="10">std::optional<int> runQualityDelta( const MainDispatch& d )</d> +<!-- demote: a <t> in sigs is a lower same-file sibling past answer row 10, a pointer (p= file, sym= name, r= rank), not the answer --> +<t p="src/verbs_quality.h" sym="refPairBasis" r="11"/> +<d l="1401" e="1436" n="refuseForeignAckSelection" p="src/verbs_quality.h" cx="9" ccx="12" in="1" churn="209" amp="312" r="12">std::optional<int> refuseForeignAckSelection( const rw::Config& cfg, const rw::quality::Scope& scope, const std::vector<rw::quality::Regression>& out … [line truncated: 18 more bytes on this line] +<d l="3054" e="3083" n="computeQdReport" p="src/verbs_quality.h" cx="4" ccx="3" in="1" churn="209" amp="312" r="13">QdReport computeQdReport( const QdComparison& c, std::vector<rw::quality::StaleAck> staleAcks, const std::string& baselineFile )</d> +<d l="2227" e="2252" n="ackNothingToAccept" p="src/verbs_quality.h" cx="6" ccx="7" in="1" churn="209" amp="312" r="14">int ackNothingToAccept( const std::string& acksFile, const gtl::btree_map<std::string, rw::quality::AckRecord>& acks, const rw::quality::Scope& scope, std::size… … [line truncated: 4 more bytes on this line] +<t p="src/verbs_quality.h" sym="DeltaBasis" r="15"/> +<t p="src/quality.h" sym="kAcksFile" r="16"/> +<d l="2814" e="2842" n="writeAcceptedAcks" p="src/verbs_quality.h" cx="5" ccx="5" in="1" churn="209" amp="312" r="17">int writeAcceptedAcks( const std::string& acksFile, const gtl::btree_map<std::string, rw::quality::AckRecord>& acks, const QdAckTally& tally, const rw::quality::Sco … [line truncated: 48 more bytes on this line] +<t p="src/verbs_quality.h" sym="inspectDirtyBaselinePin" r="18"/> +<d l="3320" e="3336" n="qdStaleFold" p="src/verbs_quality.h" cx="7" ccx="4" in="1" churn="209" amp="312" r="19">std::optional<QdStaleFold> qdStaleFold( const QdReport& rep, const Escape& ex )</d> +<t p="src/quality.h" sym="IdentityHealing" r="20"/> +<t p="src/verbs_quality.h" sym="emitQdVerdict" r="21"/> +… [410 more display lines; full output is 41503 bytes on 132 raw line(s)] +````` + +stderr: + +````` +ripwire: redacted 1 secret from emitted context (keyword-gated-secret=1) — pass --no-redact to disable +````` + +## `./build/ripwire . --for="quality delta acks ledger rubber stamp" --no-doc-mention` + +*The same task with doc-mention surfacing OFF — the contrast the flag exists for (no [doc mentions] clause, one fewer row).* + +**wall time: 2.18s** + +````` +<ctx task="quality delta acks ledger rubber stamp" route="subtoken+body" root="." confidence="low" margin_pct="0" at="914c4045d" schema="ripwire.for/v1" bundle="compact" bodies="0" reason="compact-route" budget_bytes="7500" est_tokens="11923"> +<!-- ripwire for schema=ripwire.for/v1: bundle=/bodies=/reason= the body posture; d: cx= ccx= complexity, in= callers (absent cx/ccx/in = 0), churn= amp= change, clone= tested= 1, sc= scope, id=p::sc::n; total= shown= capped=1 if cut; task= the query; d pure=1 const/constexpr sig, next= the follow-up to paste; route= name-exact(X)|subtoken+body[:broad|:declined]; confidence=/margin_pct= head score drop (low=flat); h l= p= n=, c n= l= p= (p= if not h's; same-named joined, shown= counts them), noedge= no callee resolved; h calls capped=1 next= the call listing every callee; fold kind=bodies: b t= n= p= l= top ranked rows' whole bodies, not the answer; served= of total= in budget_bytes=; slice/skip p= n= l=; skip bytes= next=; a skip makes sigs next= it, sigs_next= the signatures-only re-call; d mem= an owner's direct member names only, by the index (question words first, then owner's file, path, line, name), mem_more= names cut; t p= file outside sigs (weaker), t sym= its top symbols not in sigs/syms (a pointer, not the answer), r= rank (gap = trimmed); t order: code files first, then doc files (a code question); t page rows go on to file-page row 160 (code question: 160 code rows, docs within row 160); past page 0 (code question: past 40 code rows, a doc past row 40) listed last, head files skipped; past 120 of those p= only, p_only= counts them; t folded=class=N: N p= only rows of that class (doc|config|script|testdata|other) not listed, next= pages to them; d e= its last line (absent=unknown, never 0; l= the name's line); c prov=split: a resolver split arm; may be another arm's (NOT a claim the edge is false) --> +<!-- root= is the crawl root; p= below is RELATIVE to it (single-root only; absent => p= is ingest's own path, unchanged); at=this commit(+dirty). [budget_bytes= is the default BYTE target this ranked payload was shaped toward: row text shortens toward it, no row of the ranked head is removed for it (sigs past_target=)] [sigs capped=1 with shown=total: rows shrunk, none dropped] [sigs past_target=K: the last K rows are past the budget_bytes target, served because they are rows of the ranked head; none is cut] [sigs sigs_next=: one call serving all total= rows uncut] [docs_dropped=N: N shown rows have a doc comment not printed (r>24 always, r5..24 if capped)] [files_first=N: N rows moved so r=1..8 are distinct files' best rows, score order, a repeated name once; same rows; fold, hops keep score order]; lego/compose collapse to a counted stub by default (a disclosed cut): total= that section's own pre-cap row count, shown="0" capped="1" (nothing rendered here), next= names the sections=lego,compose flag that restores both sections byte-identically in one call est_tokens= prices this bundle in tokens --> +<sigs shown="40" total="40" capped="1" past_target="12" docs_dropped="27" files_first="38" sigs_next="--for='quality delta acks ledger rubber stamp' --signatures-only --no-doc-mention --token-budget=6300" next="--expand=src/verbs_quality.h:2776:refuseUnmatchedAckOnly"> +<d l="2846" e="2890" n="runQualityAckWrite" p="src/verbs_quality.h" cx="8" ccx="8" in="1" churn="209" amp="312" r="1" next="--expand=src/verbs_quality.h:runQualityAckWrite"> +<doc>WRITE ACKS — the --quality-ack arm: fold the VISIBLE findings --ack-only selects into the ledg…</doc>int runQualityAckWrite( const rw::Config& cfg, const rw::quality::Scope& scope, const QdPartition& part, DeltaBasis& basis, const std::string& acksFile )</d> +<d l="4905" e="4984" n="computeQualityDelta" sc="rw" p="src/mcpverbs.h" cx="5" ccx="5" in="1" churn="676" amp="692" r="2">inline QualityDeltaOutcome computeQualityDelta( const std::string& root )</d> +<d l="10866" e="10881" n="staleByKindValue" sc="quality" p="src/quality.h" cx="5" ccx="7" in="2" churn="693" amp="874" r="3">inline std::string staleByKindValue( const std::vector<StaleAck>& staleAcks )</d> +<d l="2539" e="2541" n="kAtStampLegend" sc="rw" p="src/serialize.h" churn="521" amp="626" pure="1" r="4">inline constexpr const char* kAtStampLegend = "<!-- at= is the git commit these numbers were com…</d> +<d l="5801" e="5811" n="runForLensPosture" p="src/verbs_for.h" cx="5" ccx="3" in="3" churn="422" amp="505" r="5">std::optional<int> runForLensPosture( const MainDispatch& d, rw::ForAnswerLedger* ledger )</d> +<d l="314" e="371" n="computeDmm" sc="rw::dmm" p="src/dmm.h" cx="9" ccx="6" in="1" churn="16" amp="77" r="6">inline Result computeDmm( const std::string& root, std::string_view spec, const IngestResult& wo…</d> +<d l="2776" e="2801" n="refuseUnmatchedAckOnly" p="src/verbs_quality.h" cx="4" ccx="3" in="1" churn="209" amp="312" r="7"> +<doc>An --ack-only that matched NO finding: refused with exit 1, and nothing accepted. M1 FOLLOW-UP (…</doc>int refuseUnmatchedAckOnly( std::string_view ackOnly, const std::string& acksFile, const gtl::btree_map<std::string, rw::quality::AckRecord>& acks, std::size_t …</d> +<d l="2645" e="2660" n="applyScopeAndAcks" p="src/verbs_quality.h" cx="1" in="1" churn="209" amp="312" r="8"> +<doc>SCOPE + RATCHET — split basis.regs by --scope, then suppress what the ack ledger already accep…</doc>QdPartition applyScopeAndAcks( const rw::quality::Scope& scope, DeltaBasis& basis )</d> +<d l="2405" e="2426" n="refPairStaleAcks" p="src/verbs_quality.h" cx="6" ccx="6" in="1" churn="209" amp="312" r="9"> +<doc>L2 stale acks in the range form. A changed-files answer holds no whole target tree to check the …</doc>std::vector<rw::quality::StaleAck> refPairStaleAcks( const gtl::btree_map<std::string, rw::quality::AckRecord>& acks, const RefPairDelta& refs )</d> +<d l="3449" e="3568" n="runQualityDelta" p="src/verbs_quality.h" cx="14" ccx="15" in="2" churn="209" amp="313" r="10">std::optional<int> runQualityDelta( const MainDispatch& d )</d> +<!-- demote: a <t> in sigs is a lower same-file sibling past answer row 10, a pointer (p= file, sym= name, r= rank), not the answer --> +<t p="src/verbs_quality.h" sym="refPairBasis" r="11"/> +<d l="1401" e="1436" n="refuseForeignAckSelection" p="src/verbs_quality.h" cx="9" ccx="12" in="1" churn="209" amp="312" r="12">std::optional<int> refuseForeignAckSelection( const rw::Config& cfg, const rw::quality::Scope& scope, const std::vector<rw::quality::Regression>& out … [line truncated: 18 more bytes on this line] +<d l="3054" e="3083" n="computeQdReport" p="src/verbs_quality.h" cx="4" ccx="3" in="1" churn="209" amp="312" r="13">QdReport computeQdReport( const QdComparison& c, std::vector<rw::quality::StaleAck> staleAcks, const std::string& baselineFile )</d> +<d l="2227" e="2252" n="ackNothingToAccept" p="src/verbs_quality.h" cx="6" ccx="7" in="1" churn="209" amp="312" r="14">int ackNothingToAccept( const std::string& acksFile, const gtl::btree_map<std::string, rw::quality::AckRecord>& acks, const rw::quality::Scope& scope, std::size… … [line truncated: 4 more bytes on this line] +<t p="src/verbs_quality.h" sym="DeltaBasis" r="15"/> +<t p="src/quality.h" sym="kAcksFile" r="16"/> +<d l="2814" e="2842" n="writeAcceptedAcks" p="src/verbs_quality.h" cx="5" ccx="5" in="1" churn="209" amp="312" r="17">int writeAcceptedAcks( const std::string& acksFile, const gtl::btree_map<std::string, rw::quality::AckRecord>& acks, const QdAckTally& tally, const rw::quality::Sco … [line truncated: 48 more bytes on this line] +<t p="src/verbs_quality.h" sym="inspectDirtyBaselinePin" r="18"/> +<d l="3320" e="3336" n="qdStaleFold" p="src/verbs_quality.h" cx="7" ccx="4" in="1" churn="209" amp="312" r="19">std::optional<QdStaleFold> qdStaleFold( const QdReport& rep, const Escape& ex )</d> +<t p="src/quality.h" sym="IdentityHealing" r="20"/> +<t p="src/verbs_quality.h" sym="emitQdVerdict" r="21"/> +… [337 more display lines; full output is 31814 bytes on 60 raw line(s)] +````` + +## `./build/ripwire . --safe-delete=rankGraphTeleport` + +*"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.* + +````` +<!-- ripwire safe-delete schema=ripwire.safe-delete/v1: can sym= go, a READ never a verdict: callers= impact_reaches= uses= tested_self= risk=; <c n= p= amb=>; radius_tested= non-tests of impact_reaches= an indexed test reaches, radius_untested= the rest; t= p= its tower-front match's kind and file:line; defs= matched; ambiguous_callers= callers with a call split over several defs; dead_code_candidate=1 only at defs=1 with no caller, for a t=fn with a body, outside .h/.hpp/.hh/.hxx, whose signature spells static (0 never means in use). window: shown= capped= (capped=1 cut). counts_floor=1: every count is a FLOOR, never a total. graph_ambiguous=/graph_unresolved=: resolver gauge. graph_unindexed=N: N files no grammar could read (the map header's unindexed=); their calls raise neither gauge. root=: p= relative to it. amb=K: K calls split over several defs. c sites_at=: its leaf-name calls not proven elsewhere, as [file:]line (p=: def line, default file); not proof each binds. --> +<safe-delete schema="ripwire.safe-delete/v1" sym="rankGraphTeleport" t="fn" p="src/graph.h:14921" defs="1" callers="7" ambiguous_callers="2" impact_reaches="80" uses="9" tested_self="0" radius_tested="0" radius_untested="80" dead_code_candidate="0" risk="untested-radius" shown="7" capped="0" graph_a … [line truncated: 89 more bytes on this line] +<c n="runEval" p="src/eval.h:171" sites_at="328" amb="4"/> +<c n="rankGraph" p="src/graph.h:14964" sites_at="14968"/> +<c n="anchoredLexicalRank" p="src/graph.h:15633" sites_at="15684"/> +<c n="churnDecayRanking" p="src/main.cpp:1433" sites_at="1447"/> +<c n="churnRankedGraph" p="src/main.cpp:1472" sites_at="1486 1487 1501"/> +<c n="runDefaultMap" p="src/main.cpp:1759" sites_at="1879" amb="15"/> +<c n="getIndex" p="src/mcpindex.h:1224" sites_at="1340"/> +</safe-delete> +````` + +## `./build/ripwire . --safe-delete=DoesNotExist` + +*Unknown-symbol refusal shape for --safe-delete.* + +**exit code: 1** + +````` +(empty) +````` + +stderr: + +````` +ripwire: --safe-delete symbol not found: DoesNotExist (note: the lexical definition scan stopped at its budget, 4096 files or 16 MiB, before reading every file, so this miss is not proof the bytes define nothing; --grep=DoesNotExist lists its text uses) +````` + +## `./build/ripwire . --handoff` + +*The continuation packet for the NEXT session: <verified> disk truth (branch/sha, changed symbols, blast radius, tests) + <heuristic> labeled suggestions. Recorded against a CLEAN tree.* + +**wall time: 5.64s** + +````` +<!-- ripwire handoff schema=ripwire.handoff/v1: continuation packet for the NEXT session: <verified changed= blast_files=>, <tests n=>, <heuristic n= candidates=>, <note>, <doc p=>. window: capped= (capped=1 cut). est_tokens=: price as emitted (an upper bound under compact). at=: commit+dirty+shallow. root=: p= relative to it. branch=/subject=: the checked out branch and HEAD commit subject; gitok=0: the git diff probe failed, changed counts are floors. cochange_window=/cochange_commits=: the git window the cochange rows were mined in and the commits it held (0: could not look). doc s=: lexical score of that plan/design doc for the branch+subject query. note target=/txt=: a committed notes row on this work (symbol id or path) and its text; a suggestion. --> +<handoff schema="ripwire.handoff/v1" at="914c4045d" root="." branch="integration/train-ge3" subject="showcase: the 11-20 capture stays main's; the train re-records once at its tip" gitok="1" est_tokens="889"> +<verified changed="0" blast_files="0"> +<tests n="0"> +</tests> +</verified> +<heuristic n="6" candidates="345" capped="1" cochange_window="18mo@HEAD" cochange_commits="8003"> +<note target="src/infra/Diagnostics.h" txt="ASSUME_NO_ALIAS is an optimizer fact in release (separate_storage) only where the compiler consumes it: clang 18+ by default, LLVM 17/AppleClang 16 via the CMake -mllvm flag (scalars only), GCC never (debug check only); never on two members of one object; … [line truncated: 57 more bytes on this line] +<note target="test/manifestcheck.sh" txt="README.md's single '<N> gate scripts' claim (~line 1305) is NOT enforced — the derived-vs-stated sibling loop here covers docs/EVALS.md only. It drifted 407→451 unnoticed (fixed 2026-08-23). To close: grep both files ('file:line … [line truncated: 47 more bytes on this line] +<doc p="CHANGELOG.md" s="13.474"/> +<doc p="docs/EVALS.md" s="10.567"/> +<doc p="bench/locbench/results/r1cpp_anchorhop/GATE_DECISION_r1cpp.md" s="9.495"/> +<doc p="bench/locbench/results/vt2_pooling_freestat/FREESTAT.md" s="9.337"/> +</heuristic> +</handoff> +````` + +## `./build/ripwire . --handoff --token-budget=1200` + +*The same packet under a hard ceiling: heuristic rows drop tail-first (withheld= disclosed), verified rows never drop.* + +**wall time: 5.03s** + +````` +<!-- ripwire handoff schema=ripwire.handoff/v1: continuation packet for the NEXT session: <verified changed= blast_files=>, <tests n=>, <heuristic n= candidates=>, <note>, <doc p=>. window: capped= (capped=1 cut). est_tokens=: price as emitted (an upper bound under compact). over_ceiling=1: budget not met. withheld=: rows the budget cut. at=: commit+dirty+shallow. root=: p= relative to it. branch=/subject=: the checked out branch and HEAD commit subject; gitok=0: the git diff probe failed, changed counts are floors. cochange_window=/cochange_commits=: the git window the cochange rows were mined in and the commits it held (0: could not look). doc s=: lexical score of that plan/design doc for the branch+subject query. note target=/txt=: a committed notes row on this work (symbol id or path) and its text; a suggestion. budget=: the token-budget cap this packet was fitted to; est_tokens= prices what it delivers. withheld_rows=N: heuristic rows the budget dropped (withheld=1 says so); verified rows are never dropped. --> +<handoff schema="ripwire.handoff/v1" at="914c4045d" root="." branch="integration/train-ge3" subject="showcase: the 11-20 capture stays main's; the train re-records once at its tip" gitok="1" budget="1200" withheld="1" withheld_rows="3" est_tokens="944" over_ceiling="1"> +<verified changed="0" blast_files="0"> +<tests n="0"> +</tests> +</verified> +<heuristic n="3" candidates="345" capped="1" cochange_window="18mo@HEAD" cochange_commits="8003"> +<note target="src/infra/Diagnostics.h" txt="ASSUME_NO_ALIAS is an optimizer fact in release (separate_storage) only where the compiler consumes it: clang 18+ by default, LLVM 17/AppleClang 16 via the CMake -mllvm flag (scalars only), GCC never (debug check only); never on two members of one object; … [line truncated: 57 more bytes on this line] +<note target="test/manifestcheck.sh" txt="README.md's single '<N> gate scripts' claim (~line 1305) is NOT enforced — the derived-vs-stated sibling loop here covers docs/EVALS.md only. It drifted 407→451 unnoticed (fixed 2026-08-23). To close: grep both files ('file:line … [line truncated: 47 more bytes on this line] +<doc p="CHANGELOG.md" s="13.474"/> +</heuristic> +</handoff> +````` + +## `./build/ripwire . --skipped` + +*WHY a file is not in the index (oversize / excluded / unsupported-ext / gitignored) and which indexed files it cannot vouch for (degraded-parse, minified-suspect), plus the per-language census.* + +````` +<ctx schema="ripwire.skipped/v1"> +<!-- ripwire skipped schema=ripwire.skipped/v1: why the index lacks a file <f p= why= bytes= limit= ext=>; indexed but unvouched <h p= why= err= err_ratio=>; <lang> census. root=: p= relative to it. indexed=N: the map's files=; indexed= + oversize= + excluded= + ignored= = every file the crawl enumerated. oversize=N: files dropped for exceeding a size ceiling (row limit= names which). excluded=N: files dropped by an exclude substring you passed. unsupported_ext=N: source/text files no grammar reads; binary assets and excluded/ignored files not counted. excluded_dirs=N: subtrees an exclude pruned; their files are UNKNOWN, not zero, and in no count here. pruned_dirs=N: subtrees pruned by built-in policy (vendor/build, CMakeCache.txt dirs); contents UNKNOWN. ignored=/ignored_dirs=: files / subtrees git ignore rules hid (else indexed); subtree contents UNKNOWN. ignore_mode=: git (rules applied), off (no-ignore flag), unavailable/root-ignored (not consulted, full walk). degraded_parse=/minified_suspect=: counts of the h rows of each why=; those files stay indexed. unmeasured=N: indexed files never parsed (doc pass, binary sniff, nest guard, read error); not health-counted. max_file_size=B: the effective per-file size ceiling in bytes (the max-file-size flag raises it). json_ceiling=/yaml_ceiling=: fixed .json/.yaml byte ceilings the max-file-size flag does NOT raise. ws_freq=R: whitespace share of the leading 4096 bytes; under 0.070 = minified-suspect (never under 256 B). x=/files=: an unindexed extension and its file count (full list; the map's unindexed= is the top 6). files=/symbols=: per language, files with its symbols (FLOOR: symbol-less files uncounted) / symbols (exact). lang n=: a language this build extracted symbols from; files=/symbols= its counts. --> +<!-- why=extent-suspect on an <h> row = the file holds extent_suspect_syms= definitions whose extent, scope or kind FAILED a containment check (the map and bundle rows carry the reasons as extent_suspect=: name, head, scope, error); joined to the parse-health reasons comma-separated, and rowed even when the parse itself is clean. extent_suspect_files= on the root counts such rows. Nothing is dropped. --> +<!-- why=macro-blanked on an <h> row = this file's symbols come from a SECOND parse. Its first parse held error bytes, so macro_blanked= semicolon-less ALL-CAPS function-like macro invocations, each alone on its line directly inside a class/struct/union body (a shape the C-family grammars misread as a field missing its semicolon, letting one body swallow what follows it), were replaced by spaces with every offset and line unchanged, and that re-parse was adopted because it held STRICTLY FEWER error bytes; names, spans and bodies still read the original bytes. err=, err_ratio= and degraded-parse on such a row describe the ADOPTED parse: a row without degraded-parse parsed clean once blanked. A blanked invocation stays a use of the macro name for the uses verb (role=type, as the unrepaired parse recorded it) but is no call edge, and identifiers inside its parentheses are not recorded. macro_blanked_files= on the root counts such rows. Nothing is dropped. --> +<!-- why=use-bounds-blanked on an <h> row = this Rust file's symbols come from a SECOND parse. Its first parse held error bytes, so use_bounds_blanked= precise-capturing bounds (a use<..> list on an impl Trait, which this build's Rust grammar predates) were replaced by spaces with every offset and line unchanged, and that re-parse was adopted because it held STRICTLY FEWER error bytes; names, spans and bodies still read the original bytes. A use<..> list names only generic parameters and lifetimes already in scope, so no definition, call or type use is lost. err=, err_ratio= and degraded-parse on such a row describe the ADOPTED parse. use_bounds_blanked_files= on the root counts such rows. Nothing is dropped. --> +<skipped indexed="4852" oversize="15" excluded="0" unsupported_ext="313" excluded_dirs="0" pruned_dirs="6" ignored="0" ignored_dirs="0" ignore_mode="git" degraded_parse="192" minified_suspect="4" extent_suspect_files="4" macro_blanked_files="7" use_bounds_blanked_files="2" unmeasured="41" max_file_s … [line truncated: 67 more bytes on this line] +<f p="bench/locbench/full560.json" why="oversize" bytes="679702" limit="262144"/> +<f p="bench/locbench/results/r1_anchorhop/heldout_baseline_release.json" why="oversize" bytes="365776" limit="262144"/> +<f p="bench/locbench/results/r1_anchorhop/heldout_candidate_release.json" why="oversize" bytes="365761" limit="262144"/> +<f p="bench/locbench/results/r3_pathtok/heldout_baseline.json" why="oversize" bytes="440937" limit="262144"/> +<f p="bench/locbench/results/r3_pathtok/heldout_candidate_w3.json" why="oversize" bytes="440925" limit="262144"/> +<f p="bench/locbench/results/r3_pathtok/train_w0.json" why="oversize" bytes="342194" limit="262144"/> +<f p="bench/locbench/results/r3_pathtok/train_w1.json" why="oversize" bytes="342123" limit="262144"/> +<f p="bench/locbench/results/r3_pathtok/train_w2.json" why="oversize" bytes="342117" limit="262144"/> +<f p="bench/locbench/results/r3_pathtok/train_w3.json" why="oversize" bytes="342138" limit="262144"/> +<f p="bench/locbench/results/r4_siblift/train_1x1.json" why="oversize" bytes="342197" limit="262144"/> +<f p="bench/locbench/results/r4_siblift/train_1x2.json" why="oversize" bytes="342194" limit="262144"/> +<f p="bench/locbench/results/r4_siblift/train_2x1.json" why="oversize" bytes="342187" limit="262144"/> +<f p="bench/locbench/results/r4_siblift/train_2x2.json" why="oversize" bytes="342210" limit="262144"/> +<f p="bench/locbench/results/r4_siblift/train_base.json" why="oversize" bytes="342194" limit="262144"/> +<f p="bench/locbench/results/vt2_pooling_freestat/vt2_train_base.json" why="oversize" bytes="342396" limit="262144"/> +<f p=".clang-tidy-baseline.txt" why="unsupported-ext" bytes="143081" ext=".txt"/> +<f p=".github/pargates-load-timing.txt" why="unsupported-ext" bytes="1614" ext=".txt"/> +<f p=".github/pargates-macos-plain-skip.txt" why="unsupported-ext" bytes="986" ext=".txt"/> +<f p="CMakeLists.txt" why="unsupported-ext" bytes="112962" ext=".txt"/> +<f p="bench/agentloop/editsuite/expected/i1/stats.py.expected" why="unsupported-ext" bytes="603" ext=".expected"/> +<f p="bench/agentloop/editsuite/expected/i2/matrix.cpp.expected" why="unsupported-ext" bytes="973" ext=".expected"/> +<f p="bench/agentloop/editsuite/expected/i3/text.py.expected" why="unsupported-ext" bytes="338" ext=".expected"/> +<f p="bench/agentloop/editsuite/expected/p1/geometry.cpp.expected" why="unsupported-ext" bytes="723" ext=".expected"/> +<f p="bench/agentloop/editsuite/expected/p2/stats.py.expected" why="unsupported-ext" bytes="575" ext=".expected"/> +… [565 more display lines; full output is 59879 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.97s** + +````` +<!-- ripwire map schema=ripwire.map/v1: ranked symbol map: <f p= layer=> groups <s t= n= sc= k= amb=> rows (k= rank), <c n=> resolved callees; the header comment is data. est_tokens=: price as emitted (an upper bound under compact). root=: p= relative to it. pr_iters=N: PageRank iterations. <inv listed= unlisted=>: files the ranked rows show / do not (sum = files=), each named or counted below. <entry p= n=>: 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. <ls p= n= f=>: 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 <c> 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. sc=: enclosing scope; the full id is p::sc::n (p= of the row or its <f>) and selectors take it. --> +<!-- t=modscope=a-file's-MODULE-SCOPE(n=<file-scope>):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 --> +<!-- t=type|alias|functype=a-Go-named-type-by-its-written-form:type=a-defined-type-whose-WRITTEN-form-is-not-a-struct/iface/func-literal(type-N-string;type-W-Pair-too,whatever-Pair-is-underneath),alias=type-A=B,functype=type-F-func(...) --> +<!-- t=alias|functype-in-C++-and-.h:alias=using-X=Y(also-templated-or-class-scope)or-namespace-L=lib(defs=X-prints-its-written-target-as-to=),functype=a-typedef-of-a-function-or-function-pointer-type(typedef-void(*F)(int));other-typedefs-read-t=struct --> +<!-- files=4852 symbols=45031 edges=45381 shown=3 est_tokens=4089 ambiguous=3984 unresolved=20100 locality_pinned=14 external=12460 declined=45307 extent_suspect_syms=12 macro_blanked_files=7 skipped_oversize=15 unindexed="txt:85,tsv:54,mod:33,xml:33,jsonl:26,scm:25" unindexed_exts=23 order=important-first --> +<r schema="ripwire.map/v1" root="." est_tokens="4089" pr_iters="37"> +<f p="src/infra/nodekind.h" layer="infra"> +<s t="fn" n="kindIs" sc="rw" k="0.0032"> +</s> +</f> +<f p="src/ingest_metrics.h"> +<s t="fn" n="nodeTextOf" k="0.0021"> +</s> +</f> +<f p="src/infra/namesplit.h" layer="infra"> +<s t="fn" n="isIdentChar" sc="namesplit" k="0.0020"> +</s> +</f> +<inv listed="3" unlisted="4849"> +<entry p="scripts/changelog_assemble.py" n="main"> +<c n="repoRoot"/> +<c n="fragmentNames"/> +<c n="check"/> +<c n="assembledEntries"/> +<c n="release"/> +</entry> +<entry p="scripts/merge_resolve.py" n="main"> +<c n="generator_constants"/> +<c n="git"/> +<c n="parse"/> +… [82 more display lines; full output is 10210 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.* + +````` +<!-- ripwire map schema=ripwire.map/v1: ranked symbol map: <f p= layer=> groups <s t= n= sc= k= amb=> rows (k= rank), <c n=> resolved callees; the header comment is data. est_tokens=: price as emitted (an upper bound under compact). root=: p= relative to it. pr_iters=N: PageRank iterations. <inv listed= unlisted=>: files the ranked rows show / do not (sum = files=), each named or counted below. <entry p= n=>: 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. <ls p= n= f=>: 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 <c> 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. sc=: enclosing scope; the full id is p::sc::n (p= of the row or its <f>) and selectors take it. --> +<!-- t=modscope=a-file's-MODULE-SCOPE(n=<file-scope>):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 --> +<!-- t=type|alias|functype=a-Go-named-type-by-its-written-form:type=a-defined-type-whose-WRITTEN-form-is-not-a-struct/iface/func-literal(type-N-string;type-W-Pair-too,whatever-Pair-is-underneath),alias=type-A=B,functype=type-F-func(...) --> +<!-- t=alias|functype-in-C++-and-.h:alias=using-X=Y(also-templated-or-class-scope)or-namespace-L=lib(defs=X-prints-its-written-target-as-to=),functype=a-typedef-of-a-function-or-function-pointer-type(typedef-void(*F)(int));other-typedefs-read-t=struct --> +<!-- files=4852 symbols=45031 edges=45381 shown=3 est_tokens=4089 ambiguous=3984 unresolved=20100 locality_pinned=14 external=12460 declined=45307 extent_suspect_syms=12 macro_blanked_files=7 skipped_oversize=15 unindexed="txt:85,tsv:54,mod:33,xml:33,jsonl:26,scm:25" unindexed_exts=23 order=important-first --> +<r schema="ripwire.map/v1" root="." est_tokens="4089" pr_iters="37"> +<f p="src/infra/nodekind.h" layer="infra"> +<s t="fn" n="kindIs" sc="rw" k="0.0032"> +</s> +</f> +<f p="src/ingest_metrics.h"> +<s t="fn" n="nodeTextOf" k="0.0021"> +</s> +</f> +<f p="src/infra/namesplit.h" layer="infra"> +<s t="fn" n="isIdentChar" sc="namesplit" k="0.0020"> +</s> +</f> +<inv listed="3" unlisted="4849"> +<entry p="scripts/changelog_assemble.py" n="main"> +<c n="repoRoot"/> +<c n="fragmentNames"/> +<c n="check"/> +<c n="assembledEntries"/> +<c n="release"/> +</entry> +<entry p="scripts/merge_resolve.py" n="main"> +<c n="generator_constants"/> +<c n="git"/> +<c n="parse"/> +… [82 more display lines; full output is 10210 bytes on 1 raw line(s)] +````` + +stderr: + +````` +ripwire: --no-stable is read only by --mcp/--listen (it opts out of the stable ordering the server turns on) — it changed nothing here; the CLI map orders important-first unless you pass --order=stable +````` + +## `./build/ripwire . --run-trace="cat <scratch>/aux/asan_trace_now.txt; exit 1"` + +*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** + +````` +<ctx schema="ripwire.from-trace/v1" task="run-trace: cat <scratch>/aux/asan_trace_now.txt; exit 1" next="--slice=@src/graph.h:14923" est_tokens="2727"> +<!-- ripwire from-trace schema=ripwire.from-trace/v1: trace frames mapped to indexed symbols, innermost first; the innermost in-corpus body included. window: shown= total= capped= (capped=1 cut). est_tokens=: price as emitted (an upper bound under compact). <d r=N>: rank N in this ranking, rows in r= order. <d cx= ccx=>: cyclomatic/cognitive complexity. <d in=N>: N callers in the index (absent: not measured). sc=: enclosing scope; the full id is p::sc::n (p= of the row or its <f>) and selectors take it. next=: the one pasteable follow-up. task=: the trace source this bundle maps, verbatim (a file path, stdin, or an MCP label). src=/format=: the trace read and its dominant frame format, python|asan|node|compiler|generic. frame_lines=/parsed=: frame-shaped input lines / those yielding a path:line; the rest matched no format. in_corpus=: parsed frames in indexed files; always suspects= + merged= + unresolved=. suspects=/merged=/unresolved=: frame rows / folded into a claimed symbol / unresolved rows (indexed file, no def). skipped=N: frames outside every root, listed as skipped rows, never ranked. rank=N: frame order, innermost in-corpus first; p= is the trace's own path:line, defs are sigs l=. resolved_by=name|line: bound by the frame's own name, else by the def enclosing its line. innermost=1: the innermost in-corpus frame (rank 1); its full body is served. run exit=: the command's OWN exit code; signal=: the signal that killed it; timed_out=1: the timeout_s= cap did. run duration_ms=: wall clock, MEASURED, not deterministic; timeout_s=: the cap it ran under. run lines=: non-empty captured lines; bytes=: the whole capture; dropped_bytes=: middle bytes the cap dropped. lines view=tail: the last shown= of total= output lines; view=relevant: shown= of relevant= error/frame-shaped ones. lines relevant=N: captured lines that are error-marked or frame-shaped; the relevant view picks from these. frame n= t=: the bound symbol's name and kind (fn|cls|...); d, b and c n=: a ranked row's, a body's, a callee's name. --> +<!-- ledger: budget=7500 bytes (allowance 9583 bytes = ceiling + the single-entry overshoot a whole first signature costs) --> +<run exit="1" duration_ms="294" timeout_s="600" lines="9" bytes="606"/> +<lines view="relevant" shown="7" relevant="7" total="9"> +<![CDATA[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<float> 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:1761 + #3 0x102e01a44 in main src/main.cpp:4565 + #4 0x1a2b3c0dc in start+0x9dc (dyld:arm64e+0x60dc)]]></lines><trace src="run-trace: cat <scratch>/aux/asan_trace_now.txt; exit 1" format="asan" frame_lines="5" parsed="4" in_c … [line truncated: 1698 more bytes on this line] +{ + PROFILE_SCOPE_DESCRIBE( "rankGraph: PageRank (power iteration)" ); + const std::vector<float> pw = biasPrior( g, p ); + const std::size_t N = pw.size(); + std::vector<double> teleport( pw.begin(), pw.end() ); + std::vector<double> rankDouble( N, 0.0 ); + PageRankRun run{}; // an N == 0 graph never enters the kernel: { 0, converged } — see PageRankRun + if( N ) + { + double teleportMass = 0.0; + for( const double value : teleport ) + { + teleportMass += value; + } + if( teleportMass > 0.0 ) + { + const double inverseMass = 1.0 / teleportMass; + for( double& value : teleport ) + { + value *= inverseMass; + } + } + run = pageRankDouble( g.inEdges, g.wOutDeg, teleport, rankDouble, PageRankConfig{ .alpha = double( alpha ) } ); + } + std::vector<float> 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 }; +}]]><calls total="4"><c n="biasPrior" l="14880">inline std::vector<float> biasPrior( const Graph& g, const std::vector<float>& p )</c><c n="PROFILE_SCOPE_DESCRIBE" l="1282" p="src/infra/profileScope.h">#define PROFILE_SCOPE_DESCRIBE( desc )</c><c n="PROFILE_SCOPE_DESCRIBE" l="129 … [line truncated: 368 more bytes on this line] +````` + +## `./build/ripwire . --run-trace="true"` + +*A command that exits 0: a minimal success record (exit, measured duration, disclosed output tail) and NO bundle — nothing failed, nothing to map.* + +````` +<ctx schema="ripwire.from-trace/v1" task="run-trace: true"> +<!-- ripwire from-trace schema=ripwire.from-trace/v1: trace frames mapped to indexed symbols, innermost first; the innermost in-corpus body included. task=: the trace source this bundle maps, verbatim (a file path, stdin, or an MCP label). run exit=: the command's OWN exit code; signal=: the signal that killed it; timed_out=1: the timeout_s= cap did. run duration_ms=: wall clock, MEASURED, not deterministic; timeout_s=: the cap it ran under. run lines=: non-empty captured lines; bytes=: the whole capture; dropped_bytes=: middle bytes the cap dropped. --> +<run exit="0" duration_ms="137" timeout_s="600" lines="0" bytes="0"/> +</ctx> +````` + +## `./build/ripwire . --run-trace="sleep 30" --run-timeout=2` + +*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.62s** + +````` +<ctx schema="ripwire.from-trace/v1" task="run-trace: sleep 30"> +<!-- ripwire from-trace schema=ripwire.from-trace/v1: trace frames mapped to indexed symbols, innermost first; the innermost in-corpus body included. task=: the trace source this bundle maps, verbatim (a file path, stdin, or an MCP label). run duration_ms=: wall clock, MEASURED, not deterministic; timeout_s=: the cap it ran under. run lines=: non-empty captured lines; bytes=: the whole capture; dropped_bytes=: middle bytes the cap dropped. run frames=0: the command FAILED but its output carried no mappable frame, so no bundle follows. --> +<run timed_out="1" signal="9" duration_ms="2003" timeout_s="2" lines="0" bytes="0" frames="0"/> +</ctx> +````` + +stderr: + +````` +ripwire: --run-trace: TIMEOUT — the command exceeded the 2 s cap; its process group was killed +````` + +## `./build/ripwire . --run-timeout=5` + +*--run-timeout alone is refused loudly (it only modifies --run-trace).* + +**exit code: 1** + +````` +(empty) +````` + +stderr: + +````` +ripwire: --run-timeout=SECONDS modifies --run-trace — pass it too (e.g. ripwire <dir> --run-trace="make -j" --run-timeout=60) +````` + + +--- + +# assess quality — the wider lens family + +## `./build/ripwire . --quality-panel` + +*THE single wide-angle quality read: six families in one pass, an eligible/ranked shortlist rather than a firehose.* + +**wall time: 9.50s** + +````` +<!-- ripwire quality-panel schema=ripwire.quality-panel/v1: every quality family in ONE report, ranked by distinct families fired: <s p= n= fam= of= fired= join=>; bar_*= thresholds. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). at=: commit+dirty+shallow. root=: p= relative to it. preset=: strict (5 stable families, cut 2), default (6, cut 2), lenient (6, cut 1); selects, never weights. families=6: evidence families: structural lexical confusion historical colocation state. enabled=/enabled_n=: the families this preset COUNTS, and how many. cut=N: distinct enabled families that must fire for a row to rank. cut_reachable=0: cut= exceeds the evaluable families (of=); a corpus fact, never a clean bill of health. eligible=N: functions/methods with a body; ranked= + below_cut= + no_family= = eligible=, always. ranked=N: rows that met the cut (total=); only shown= print, page with offset=. below_cut=N: fired at least one enabled family, but fewer than cut=. no_family=N: no enabled family fired; unavailable= families were never measured. bar_ccx=/bar_loc=/bar_nest=/bar_params=: absolute bars: cognitive complexity, lines, nesting, params. rcut=/rmeasured=: readability decile width (rrank= under it fires) / functions measured. hcut=/hranked=: file churn decile width / files with an in-window commit (hranked=0 voids historical). window=: the git churn window hrank= and churn= are counted over (RELATIVE to this corpus). ccut=/cranked=: colocation decile width / functions reading any outside definition (0 voids it). cfiles=/cscope=: files the confusion atom rules read / eligible symbols in them. lscope=N: symbols the lexical naming rules read. sfiles=/sscope=: files the state lens reads / symbols in them. cells=N: non-local mutable cells the state lens found. tested_scope=N: symbols an indexed test reaches; at 0 no row can carry join=deep+untested. deep_untested=N: rows carrying join=deep+untested across the WHOLE set, not just this page. e f=: the fired family this evidence row belongs to. counted=1: this preset counts the family toward fam=; 0 = fired, not counted. why=: the measurements that crossed (rule*N fired N times; hrank=/churn= are the file's, inherited). --> +<quality_panel schema="ripwire.quality-panel/v1" preset="default" families="6" enabled="structural,lexical,confusion,historical,colocation,state" enabled_n="6" cut="2" cut_reachable="1" eligible="25297" ranked="1458" below_cut="8442" no_family="15397" bar_ccx="15" bar_loc="60" bar_nest="4" bar_param … [line truncated: 335 more bytes on this line] +<s p="src/gitmine.h:1797" n="addRootFilesToGitPathIndex" fam="4" of="6" fired="structural,lexical,confusion,historical"> +<e f="structural" counted="1" why="ccx=25 ev=6"/> +<e f="lexical" counted="1" why="naming-wordy"/> +<e f="confusion" counted="1" why="atom-embedded-crement*2"/> +<e f="historical" counted="1" why="hrank=35 churn=106"/> +</s> +<s p="src/graph.h:10846" n="buildGraph" fam="4" of="6" fired="structural,confusion,historical,colocation"> +<e f="structural" counted="1" why="ccx=1979 loc=4026 nest=8 humps=99 deep=667 ev=252 rrank=0"/> +<e f="confusion" counted="1" why="atom-embedded-crement*6 atom-nested-ternary*2"/> +<e f="historical" counted="1" why="hrank=5 churn=732"/> +<e f="colocation" counted="1" why="crank=18"/> +</s> +<s p="src/graphlegend.h:837" n="declinedSitesLegend" fam="4" of="6" fired="structural,lexical,confusion,historical"> +<e f="structural" counted="1" why="ccx=24 ev=2"/> +<e f="lexical" counted="1" why="naming-confusable"/> +<e f="confusion" counted="1" why="atom-nested-ternary*4"/> +<e f="historical" counted="1" why="hrank=19 churn=242"/> +</s> +<s p="src/ingest.cpp:415" n="ingest" fam="4" of="6" fired="structural,historical,colocation,state"> +<e f="structural" counted="1" why="ccx=41 loc=298 params=8 ev=3"/> +<e f="historical" counted="1" why="hrank=20 churn=229"/> +<e f="colocation" counted="1" why="crank=20"/> +<e f="state" counted="1" why="reads=1"/> +</s> +<s p="src/ingest_relations.h:320" n="lookupInScope" fam="4" of="6" fired="structural,confusion,historical,state"> +<e f="structural" counted="1" why="params=5 ev=6"/> +<e f="confusion" counted="1" why="atom-embedded-crement"/> +<e f="historical" counted="1" why="hrank=37 churn=95"/> +… [188 more display lines; full output is 15456 bytes on 1 raw line(s)] +````` + +## `./build/ripwire . --biggest-first --limit=8` + +*Per-function size ranking, largest Halstead volume/token entropy/lines first — a size proxy, not a readability order (withdrawn, docs/EVALS.md §8) — a RANKING lens, not a grade.* + +````` +<!-- ripwire readability schema=ripwire.readability/v1: Posnett/Hindle/Devanbu lens, largest Halstead volume first (a size proxy): <fn p= n= lines= toks= ops= vocab= vol= ent= posnett=>. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). root=: p= relative to it. functions=N: functions and methods measured (bodyless declarations are not). --> +<readability schema="ripwire.readability/v1" functions="25297" shown="8" capped="1" total="25297" has_more="1" next_offset="8" offset="0" limit="8" root="."> +<fn p="src/graph.h:10846" n="buildGraph" lines="4026" toks="25074" ops="16029" vocab="1325" vol="260061.9" ent="6.83" posnett="0.000"/> +<fn p="src/verbs_for.h:3606" n="runForLensPass" lines="1984" toks="12389" ops="7572" vocab="925" vol="122072.7" ent="6.60" posnett="0.000"/> +<fn p="src/mcp.h:1151" n="dispatchMcpLine" lines="1852" toks="9460" ops="6010" vocab="832" vol="91766.2" ent="6.57" posnett="0.000"/> +<fn p="src/main.cpp:4711" n="dispatchMainBody" lines="1610" toks="8076" ops="5175" vocab="751" vol="77147.4" ent="6.43" posnett="0.000"/> +<fn p="test/forbodyslotfix/src/c/render.c:7" n="render_screen" lines="176" toks="9485" ops="6322" vocab="181" vol="71136.0" ent="4.54" posnett="0.000"/> +<fn p="src/main.cpp:1759" n="runDefaultMap" lines="1187" toks="6552" ops="4029" vocab="528" vol="59258.9" ent="6.46" posnett="0.000"/> +<fn p="src/packtask.h:1448" n="packTaskBundleText" lines="841" toks="5926" ops="3619" vocab="534" vol="53693.7" ent="6.57" posnett="0.000"/> +<fn p="src/quality.h:12009" n="computeDelta" lines="941" toks="5288" ops="3370" vocab="381" vol="45337.4" ent="6.33" posnett="0.000"/> +</readability> +````` + +## `./build/ripwire . --comment-coherence --limit=8` + +*Functions WITH a doc comment, most name-restating first: c_coeff (high = the comment repeats the name) and cic (Jaccard of comment vs identifier vocabulary), both reported, never collapsed.* + +````` +<!-- ripwire comment-coherence schema=ripwire.comment-coherence/v1: two comment/name content measures per documented function, most name-restating first: <fn p= n= c_coeff= cic=>. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). root=: p= relative to it. documented=N: functions with a doc comment, measured (the rows); a FLOOR when unreadable_files= shows. no_comment=N: eligible symbols with no measurable comment; UNAVAILABLE, never scored as zero. words=/restate=: comment word count (c_coeff= denominator, stopwords kept) / words matching a name word. c_terms=/i_terms=/shared=: comment term set / identifiers the body uses / overlap; cic= shared over union. --> +<comment_coherence schema="ripwire.comment-coherence/v1" documented="7779" no_comment="17518" shown="8" capped="1" total="7779" has_more="1" next_offset="8" offset="0" limit="8" root="."> +<fn p="src/infra/os.h:637" n="socket" c_coeff="1.000" words="1" restate="1" cic="0.000" c_terms="1" i_terms="5" shared="0"/> +<fn p="src/lsp.h:540" n="lspLocationJson" c_coeff="1.000" words="1" restate="1" cic="0.000" c_terms="1" i_terms="26" shared="0"/> +<fn p="src/query.h:262" n="sourceAll" c_coeff="1.000" words="1" restate="1" cic="0.000" c_terms="1" i_terms="12" shared="0"/> +<fn p="src/warmsnap.h:791" n="recordTree" c_coeff="1.000" words="2" restate="2" cic="0.023" c_terms="2" i_terms="88" shared="2"/> +<fn p="src/warmsnap.h:847" n="replayTree" c_coeff="1.000" words="2" restate="2" cic="0.028" c_terms="2" i_terms="71" shared="2"/> +<fn p="src/verbs_quality.h:3605" n="runDmm" c_coeff="1.000" words="1" restate="1" cic="0.029" c_terms="1" i_terms="35" shared="1"/> +<fn p="src/infra/dynamic_map.hpp:1955" n="erase_rec" c_coeff="1.000" words="1" restate="1" cic="0.048" c_terms="1" i_terms="21" shared="1"/> +<fn p="test/verify_os_win32_logic.cpp:249" n="WidePath: separators, the Git Bash drive spelling, and nothing else rewritten" c_coeff="1.000" words="2" restate="2" cic="0.133" c_terms="2" i_terms="15" shared="2"/> +</comment_coherence> +````` + +## `./build/ripwire . --context-ratio --limit=8` + +*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).* + +````` +<!-- ripwire context-ratio schema=ripwire.context-ratio/v1: LOCAL-REASONING lens: the share of a unit's context outside its file: <s p= n= sites= ents_out= ent_ratio= read_ratio=>. window: total= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). syms_capped=/files_capped=/defs_capped=: 1 = cut. counts_floor=1: every count is a FLOOR, never a total. root=: p= relative to it. units=N: symbols measured (the s row population). file_units=N: files measured (the f row population). defs_per_name_cap=N: most defs one name adds (lowest ids); defs_capped=1 = cut, ents=/rtok= floors. body_bytes_per_token=: the bytes-per-token rate rtok= is estimated at. shown_syms=N: symbol rows printed; the rest page with offset=next_offset. shown_files=N: file rows printed (fixed cap 40, not paged); files_capped=1 = rows dropped. ents=N: distinct in-corpus defs its reference sites resolve to, by name (a FLOOR). files=N: distinct files holding those defs (a FLOOR). files_out=N: of files=, those other than the unit's own file. rtok=N: est. tokens of every resolved def, what a reader must read. rtok_out=N: the part of rtok= defined outside the unit's own file. ext=N: referenced names with no in-corpus def; mostly locals/params, NOT external deps; in neither ratio. amb_names=N: referenced names with 2+ defs, each counted (per name; not the map's per-call amb=). ents=N: distinct in-corpus defs the file's sites resolve to (a FLOOR; a union, not the sum of s rows). files=N: distinct files holding those defs (a FLOOR). files_out=N: of files=, those other than this file. rtok=N: est. tokens of every resolved def, what a reader must read. rtok_out=N: the part of rtok= defined outside this file. ext=N: referenced names with no in-corpus def; mostly locals/params, NOT external deps; in neither ratio. amb_names=N: referenced names with 2+ defs, each counted (per name; not the map's per-call amb=). s t=: the unit's kind (fn|cls|...). --> +<contextratio schema="ripwire.context-ratio/v1" units="37573" file_units="4114" defs_per_name_cap="8" body_bytes_per_token="3.80" shown_syms="8" syms_capped="1" shown_files="40" files_capped="1" total="37573" has_more="1" next_offset="8" offset="0" limit="8" defs_capped="1" counts_floor="1" root="." … [line truncated: 1 more bytes on this line] +<s p="src/main.cpp:4711" n="dispatchMainBody" t="fn" sites="1195" ents="275" ents_out="249" ent_ratio="0.905" files="84" files_out="83" rtok="259872" rtok_out="223425" read_ratio="0.860" ext="133" amb_names="33"/> +<s p="src/mcpverbs.h:4905" n="computeQualityDelta" t="fn" sites="78" ents="48" ents_out="44" ent_ratio="0.917" files="21" files_out="20" rtok="98317" rtok_out="97446" read_ratio="0.991" ext="10" amb_names="8"/> +<s p="src/mcp.h:1151" n="dispatchMcpLine" t="fn" sites="1368" ents="248" ents_out="222" ent_ratio="0.895" files="52" files_out="51" rtok="93914" rtok_out="88808" read_ratio="0.946" ext="167" amb_names="22"/> +<s p="src/mcpverbs.h:5433" n="editCheckText" t="fn" sites="37" ents="45" ents_out="45" ent_ratio="1.000" files="29" files_out="29" rtok="86588" rtok_out="86588" read_ratio="1.000" ext="4" amb_names="8"/> +<s p="src/editpreview.h:342" n="run" t="fn" sites="127" ents="68" ents_out="64" ent_ratio="0.941" files="32" files_out="31" rtok="83028" rtok_out="80705" read_ratio="0.972" ext="31" amb_names="9"/> +<s p="src/mcpindex.h:1224" n="getIndex" t="fn" sites="174" ents="91" ents_out="72" ent_ratio="0.791" files="26" files_out="25" rtok="82532" rtok_out="78774" read_ratio="0.954" ext="20" amb_names="13"/> +<s p="src/mcpverbs.h:5143" n="qualityBaselineJson" t="fn" sites="32" ents="47" ents_out="46" ent_ratio="0.979" files="29" files_out="28" rtok="76984" rtok_out="76955" read_ratio="1.000" ext="4" amb_names="10"/> +<s p="test/verify_csr.cpp:147" n="production buildGraph stores caller to callee as target-row source-column" t="fn" sites="24" ents="35" ents_out="35" ent_ratio="1.000" files="17" files_out="17" rtok="73786" rtok_out="73786" read_ratio="1.000" ext="2" amb_names="10"/> +<f p="src/main.cpp" sites="4321" ents="639" ents_out="542" ent_ratio="0.848" files="136" files_out="135" rtok="441131" rtok_out="361743" read_ratio="0.820" ext="586" amb_names="67"/> +<f p="src/mcpverbs.h" sites="5744" ents="832" ents_out="744" ent_ratio="0.894" files="149" files_out="148" rtok="402101" rtok_out="329784" read_ratio="0.820" ext="714" amb_names="60"/> +<f p="src/graph.h" sites="15293" ents="1399" ents_out="760" ent_ratio="0.543" files="174" files_out="173" rtok="335463" rtok_out="199446" read_ratio="0.595" ext="1332" amb_names="155"/> +<f p="src/verbs_for.h" sites="5273" ents="677" ents_out="531" ent_ratio="0.784" files="156" files_out="155" rtok="257668" rtok_out="170563" read_ratio="0.662" ext="578" amb_names="58"/> +<f p="src/quality.h" sites="7163" ents="882" ents_out="497" ent_ratio="0.563" files="146" files_out="145" rtok="213690" rtok_out="136970" read_ratio="0.641" ext="792" amb_names="98"/> +<f p="src/verbs_navigate.h" sites="4391" ents="576" ents_out="522" ent_ratio="0.906" files="108" files_out="107" rtok="143913" rtok_out="119786" read_ratio="0.832" ext="428" amb_names="45"/> +<f p="src/verbs_quality.h" sites="3205" ents="603" ents_out="433" ent_ratio="0.718" files="117" files_out="116" rtok="162338" rtok_out="110617" read_ratio="0.681" ext="277" amb_names="57"/> +<f p="src/mcpindex.h" sites="747" ents="262" ents_out="222" ent_ratio="0.847" files="70" files_out="69" rtok="117487" rtok_out="110181" read_ratio="0.938" ext="125" amb_names="42"/> +<f p="src/mcp.h" sites="1930" ents="327" ents_out="270" ent_ratio="0.826" files="66" files_out="65" rtok="145445" rtok_out="94263" read_ratio="0.648" ext="240" amb_names="29"/> +<f p="src/legenddict.h" sites="1026" ents="252" ents_out="191" ent_ratio="0.758" files="60" files_out="59" rtok="98801" rtok_out="90398" read_ratio="0.915" ext="88" amb_names="29"/> +<f p="src/editpreview.h" sites="446" ents="139" ents_out="133" ent_ratio="0.957" files="46" files_out="45" rtok="91570" rtok_out="89119" read_ratio="0.973" ext="71" amb_names="21"/> +<f p="src/verbs_change.h" sites="1317" ents="276" ents_out="249" ent_ratio="0.902" files="77" files_out="76" rtok="90082" rtok_out="84499" read_ratio="0.938" ext="130" amb_names="32"/> +<f p="src/warmsnap_graph.h" sites="451" ents="194" ents_out="187" ent_ratio="0.964" files="55" files_out="54" rtok="84732" rtok_out="82740" read_ratio="0.976" ext="32" amb_names="34"/> +<f p="test/verify_csr.cpp" sites="184" ents="63" ents_out="60" ent_ratio="0.952" files="30" files_out="29" rtok="75456" rtok_out="74711" read_ratio="0.990" ext="30" amb_names="16"/> +<f p="src/forpage.h" sites="1232" ents="266" ents_out="211" ent_ratio="0.793" files="83" files_out="82" rtok="76604" rtok_out="68552" read_ratio="0.895" ext="182" amb_names="30"/> +<f p="src/ingest_sidecap.h" sites="1954" ents="442" ents_out="331" ent_ratio="0.749" files="92" files_out="91" rtok="93243" rtok_out="68102" read_ratio="0.730" ext="238" amb_names="45"/> +<f p="src/verbs_report.h" sites="3992" ents="342" ents_out="291" ent_ratio="0.851" files="80" files_out="79" rtok="80818" rtok_out="56731" read_ratio="0.702" ext="431" amb_names="31"/> +<f p="src/mcpserver.h" sites="459" ents="132" ents_out="116" ent_ratio="0.879" files="41" files_out="40" rtok="54782" rtok_out="52057" read_ratio="0.950" ext="64" amb_names="22"/> +<f p="src/backhops.h" sites="1291" ents="370" ents_out="276" ent_ratio="0.746" files="88" files_out="87" rtok="67891" rtok_out="50299" read_ratio="0.741" ext="151" amb_names="63"/> +<f p="src/packtask.h" sites="1524" ents="245" ents_out="193" ent_ratio="0.788" files="56" files_out="55" rtok="62515" rtok_out="49947" read_ratio="0.799" ext="218" amb_names="28"/> +… [21 more display lines; full output is 11281 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: 4.20s** + +````` +<!-- ripwire nonlocal-state schema=ripwire.nonlocal-state/v1: per function, the non-local MUTABLE state it reaches: <fn p= n= writes= reads=> over <cell n= p= dir= via=> rows. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). cells_capped=: 1 = cut. counts_floor=1: every count is a FLOOR, never a total. graph_ambiguous=/graph_unresolved=: resolver gauge. graph_unindexed=N: N files no grammar could read (the map header's unindexed=); their calls raise neither gauge. root=: p= relative to it. cells=N: mutable non-local cells found in the corpus (globals, statics, Python module globals; FLOOR). functions=N: functions reaching at least one cell, directly or via callees (all rows, before paging). direct_writes=/direct_reads=: the writes=/reads= cells this function's OWN body writes/reads. cells_total=N: distinct cells reached (read and written counts once); at most 12 cell rows print. at=/at_dir=: one own-body use site (may be more) and what own-body sites do (can be narrower than dir=). shown_cells=N: cell rows printed of cells_total= (cap 12); cells_capped=1 on the row is the cut. unanalyzed_langs=/unanalyzed_files=: indexed languages (and their files) this lens skips; NOT zero cells. --> +<nonlocal_state schema="ripwire.nonlocal-state/v1" cells="1175" functions="1521" shown="8" capped="1" total="1521" has_more="1" next_offset="8" offset="0" limit="8" graph_ambiguous="3984" graph_unresolved="20100" graph_unindexed="313" counts_floor="1" unanalyzed_langs="c,go,rust,javascript,typescrip … [line truncated: 108 more bytes on this line] +<fn p="bench/bench_svector_wave.cpp:346" n="main" writes="8" reads="14" direct_writes="0" direct_reads="4" cells_total="14" shown_cells="12" cells_capped="1"> +<cell n="kNames" p="bench/bench_svector_wave.cpp:98" dir="rw" at="bench/bench_svector_wave.cpp:358" at_dir="r"/> +<cell n="kPush" p="bench/bench_svector_wave.cpp:99" dir="rw" at="bench/bench_svector_wave.cpp:358" at_dir="r"/> +<cell n="kReads" p="bench/bench_svector_wave.cpp:100" dir="rw" at="bench/bench_svector_wave.cpp:358" at_dir="r"/> +<cell n="kSamples" p="bench/bench_svector_wave.cpp:101" dir="rw" at="bench/bench_svector_wave.cpp:358" at_dir="r"/> +<cell n="g_api" p="src/infra/profilePmc.h:140" dir="rw" via="ensure_thread_counting"/> +<cell n="g_keyOf" p="bench/bench_svector_wave.cpp:145" dir="rw" via="regenerate"/> +<cell n="g_perf" p="src/infra/profilePmc.h:289" dir="rw" via="ensure_thread_counting"/> +<cell n="g_readOf" p="bench/bench_svector_wave.cpp:146" dir="rw" via="regenerate"/> +<cell n="g_arm" p="bench/bench_svector_wave.cpp:65" dir="r" via="runArm"/> +<cell n="g_bytes" p="bench/bench_svector_wave.cpp:67" dir="r" via="runArm"/> +<cell n="g_count" p="bench/bench_svector_wave.cpp:66" dir="r" via="runArm"/> +<cell n="g_once" p="src/infra/profilePmc.h:290" dir="r" via="ensure_thread_counting"/> +</fn> +<fn p="bench/bench_svector_wave.cpp:295" n="sweep" writes="6" reads="13" direct_writes="4" direct_reads="1" cells_total="13" shown_cells="12" cells_capped="1"> +<cell n="kNames" p="bench/bench_svector_wave.cpp:98" dir="rw" at="bench/bench_svector_wave.cpp:317" at_dir="w"/> +<cell n="kPush" p="bench/bench_svector_wave.cpp:99" dir="rw" at="bench/bench_svector_wave.cpp:318" at_dir="w"/> +<cell n="kReads" p="bench/bench_svector_wave.cpp:100" dir="rw" at="bench/bench_svector_wave.cpp:319" at_dir="rw"/> +<cell n="kSamples" p="bench/bench_svector_wave.cpp:101" dir="rw" at="bench/bench_svector_wave.cpp:313" at_dir="w"/> +<cell n="g_keyOf" p="bench/bench_svector_wave.cpp:145" dir="rw" via="regenerate"/> +<cell n="g_readOf" p="bench/bench_svector_wave.cpp:146" dir="rw" via="regenerate"/> +<cell n="g_api" p="src/infra/profilePmc.h:140" dir="r" via="read"/> +<cell n="g_arm" p="bench/bench_svector_wave.cpp:65" dir="r" via="runArm"/> +<cell n="g_bytes" p="bench/bench_svector_wave.cpp:67" dir="r" via="runArm"/> +<cell n="g_count" p="bench/bench_svector_wave.cpp:66" dir="r" via="runArm"/> +<cell n="g_perf" p="src/infra/profilePmc.h:289" dir="r" via="read"/> +<cell n="g_pool" p="bench/bench_svector_wave.cpp:144" dir="r" via="regenerate"/> +</fn> +… [58 more display lines; full output is 8686 bytes on 1 raw line(s)] +````` + +## `./build/ripwire . --ensemble --limit=8` + +*The family join: per function, which of four orthogonal evidence families fire, ranked by how many agree.* + +**wall time: 5.46s** + +````` +<!-- ripwire ensemble schema=ripwire.ensemble/v1: four orthogonal evidence families joined, ranked by DISTINCT families fired (no composite score): <s p= n= fam= of= fired=>. window: total= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). syms_capped=/files_capped=: 1 = cut. at=: commit+dirty+shallow. root=: p= relative to it. eligible=N: functions and methods with a body, the denominator; ranked + no_family = eligible. no_family=N: eligible symbols where no family fired. bar_ccx=/bar_loc=/bar_nest=/bar_params=: absolute structural bars: cognitive cx, lines, nesting, params. rcut=N: ranks the worst readability decile covers (1 to 40); rrank= inside it fires structural. rmeasured=N: functions the readability lens measured. hcut=N: file ranks the worst churn decile covers (1 to 40); hrank= inside it fires historical. hranked=N: files with any in-window commit; 0 = historical family unavailable. cfiles=N: indexed files the confusion (atom) pack can read: C/C++/ObjC/CUDA. cscope=N: eligible symbols in those files; 0 = confusion family unavailable. lscope=N: eligible symbols in a language the naming pack reads; 0 = lexical family unavailable. shown_syms=N: symbol rows printed; the rest page with offset=next_offset. shown_files=N: file rows printed (fixed cap 20, not paged); files_capped=1 = rows dropped. e f=: the fired family: structural, lexical, confusion or historical. why=: the measurements that crossed, space separated; rule*N = that rule fired N times. top=: the file's most corroborated symbol (most families on one symbol). top_l=: that symbol's line. top_fam=N: families fired on top=, the stronger claim; file rows rank by it. union_fam=N: distinct families firing anywhere in the file (weaker: may be different symbols). union=: the names of those families. syms=N: symbols in the file where at least one family fired. families=N: evidence families joined; ranked=N: symbols at least one fired on; window=: the git span the historical family read. --> +<ensemble schema="ripwire.ensemble/v1" families="4" eligible="25297" ranked="9452" no_family="15845" bar_ccx="15" bar_loc="60" bar_nest="4" bar_params="5" rcut="40" rmeasured="25297" hcut="40" hranked="4852" window="12mo" cfiles="1130" cscope="14092" lscope="25297" shown_syms="8" syms_capped="1" sho … [line truncated: 118 more bytes on this line] +<s p="src/gitmine.h:1797" n="addRootFilesToGitPathIndex" fam="4" of="4" fired="structural,lexical,confusion,historical"> +<e f="structural" why="ccx=25 ev=6"/> +<e f="lexical" why="naming-wordy"/> +<e f="confusion" why="atom-embedded-crement*2"/> +<e f="historical" why="hrank=35 churn=106"/> +</s> +<s p="src/graphlegend.h:837" n="declinedSitesLegend" fam="4" of="4" fired="structural,lexical,confusion,historical"> +<e f="structural" why="ccx=24 ev=2"/> +<e f="lexical" why="naming-confusable"/> +<e f="confusion" why="atom-nested-ternary*4"/> +<e f="historical" why="hrank=19 churn=242"/> +</s> +<s p="src/serialize.h:10938" n="packDeps" fam="4" of="4" fired="structural,lexical,confusion,historical"> +<e f="structural" why="ccx=125 loc=360 nest=5 params=16 humps=4 deep=14 ev=5 rrank=17"/> +<e f="lexical" why="naming-confusable"/> +<e f="confusion" why="atom-nested-ternary"/> +<e f="historical" why="hrank=11 churn=521"/> +</s> +<s p="src/compactlegend.h:2065" n="payloadSubCapAttrs" fam="3" of="4" fired="structural,confusion,historical"> +<e f="structural" why="ccx=45 nest=6 humps=2 deep=11"/> +<e f="confusion" why="atom-assign-as-value"/> +<e f="historical" why="hrank=10 churn=545"/> +</s> +<s p="src/compactlegend.h:2664" n="applyCompactDialectOnce" fam="3" of="4" fired="structural,confusion,historical"> +<e f="structural" why="ccx=49 loc=120 nest=4 humps=1 deep=1 ev=3"/> +<e f="confusion" why="atom-nested-ternary"/> +<e f="historical" why="hrank=10 churn=545"/> +</s> +… [36 more display lines; full output is 7531 bytes on 1 raw line(s)] +````` + +## `./build/ripwire . --field-affinity` + +*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.62s** + +````` +<!-- ripwire field-affinity schema=ripwire.field-affinity/v1: fields read together but declared far apart vs 64-byte lines: <s n= p=> structs, <pair a= b= fns= dist=>, <finding k= f= g=>. window: shown= capped= (capped=1 cut). counts_floor=1: every count is a FLOOR, never a total. root=: p= relative to it. block=64: ASSUMED cache-line bytes; all geometry (dist= wt= ln= lines= findings) is against it. model=lp64-approx: sizes/offsets are the layout verb's LP64 standard-layout MODEL, not the real ABI. weighting=fanin-floor: w= sums 1 + fan-in per co-accessing fn; a reachability proxy, not a frequency. aggregates=N: C-family structs/classes the layout model located a body for (the scanned universe). files=N: C-family files declaring at least one struct/class the modelling pass visited. fns_scanned=N: C-family functions/methods with a readable body scanned for dot/arrow member accesses. accesses=N: member-access sites tied to one aggregate field (FLOOR: bare in-method names uncounted). amb_skipped=N: access sites REFUSED, not guessed: 2+ aggregates declare that field name; in no count here. structs=N: aggregates with 1+ attributed access; the top 20 by sepcost= print (shown=/capped=). findings=N: split-line + straddle findings over ALL structs=, not just the printed rows. min_fns=2: a pair fires split-line only when co-accessed by this many distinct functions. as_loops=N: for-loops the static advance-shape pass classified corpus-wide; report-only, never ranks. as_index=/as_chase=/as_mixed=/as_unknown=: as_loops= by advance shape (chase = pointer chase). agg=: the aggregate keyword (struct, class ...). modeled=1: layout model placed the fields; 0 = affinity only, no geometry, no finding (why= says why). fields=N: fields declared (before the touched-only filter). touched=N: fields with 1+ attributed access; at most 32 f rows print. pairs=N: co-accessed field pairs in all; at most 12 pair rows print (most fns= first). sepcost=: sum over measured pairs of fns x (1 - wt); the struct ranking key. findings=N: this struct's findings, every one printed. size=/align=/lines=: modeled sizeof, alignment, cache lines spanned (modeled=1 only). acc=N: member-access sites attributed to this field (FLOOR). sz=B: the field's modeled size in bytes (absent when the model could not size it). off=/ln=: modeled byte offset and its cache line (off/64); placed=0 instead when the model refused. w=: sum of 1 + fan-in over the co-accessing functions; a static reachability proxy, never a frequency. wt=: separation weight (64 - dist)/64, 0.00 = the two can never share a line; measured=0 instead when unplaced. wt=0.00: split-line fires only when the pair can never share a 64-byte line. w=: the split-line pair's 1 + fan-in weight sum (proxy); straddle rows carry none. off=/sz=/crosses=: straddle field offset, size, and the line its last byte lands on (lines start at off/64). fanin=N: this function's caller count (the w= proxy input). touched=N: distinct fields of this struct the function touches (named in f=); at most 8 fn rows of fns= print. scope=: the function's PROFILE_SCOPE description (first 120 chars), a counter to confirm with. scopes=N: distinct PROFILE_SCOPEs among the co-accessing functions (the scope children). status=: instrumented (a scope exists to measure) or uninstrumented (no witness yet). counter=: the hardware counter to compare across the two layouts. hint=: how to add the missing instrumentation (uninstrumented only). as_stem_ambiguous=/as_stem_unowned=/as_stem_nonptr=: chase names REFUSED - 2+ owners / no owner / owner type has no pointer marker. --> +<fieldaffinity schema="ripwire.field-affinity/v1" block="64" model="lp64-approx" counts_floor="1" weighting="fanin-floor" aggregates="3078" files="611" fns_scanned="15130" accesses="15723" amb_skipped="52588" structs="1159" shown="20" capped="1" findings="934" min_fns="2" as_loops="4574" as_index="9 … [line truncated: 77 more bytes on this line] +<s n="Graph" p="src/graph.h" l="100" agg="struct" modeled="1" fields="48" touched="33" fns="161" pairs="528" sepcost="1458.50" findings="427" size="1536" align="8" lines="24"> +<f n="inEdges" acc="136" fns="61" sz="48" off="0" ln="0"/> +<f n="wOutDeg" acc="36" fns="31" sz="24" off="48" ln="0"/> +<f n="outVals" acc="9" fns="6" sz="24" off="120" ln="1"/> +<f n="outAnchorMiss" acc="30" fns="19" sz="24" off="192" ln="3"/> +<f n="scipDocsSeen" acc="1" fns="1" sz="8" off="216" ln="3"/> +<f n="scipEdgesPinned" acc="1" fns="1" sz="8" off="224" ln="3"/> +<f n="baseOutsideClauses" acc="13" fns="8" sz="24" off="280" ln="4"/> +<f n="rubyMainMixins" acc="5" fns="5" sz="24" off="304" ln="4"/> +<f n="unindexedFiles" acc="8" fns="8" sz="8" off="424" ln="6"/> +<f n="rubyBasesUnscoped" acc="7" fns="7" sz="8" off="432" ln="6"/> +<f n="importAdj" acc="7" fns="5" sz="48" off="440" ln="6"/> +<f n="inertDeclinedCaller" acc="6" fns="4" sz="24" off="528" ln="8"/> +<f n="declinedListOff" acc="43" fns="15" sz="24" off="552" ln="8"/> +<f n="declinedListCand" acc="21" fns="13" sz="24" off="576" ln="9"/> +<f n="declinedListCallCount" acc="18" fns="8" sz="24" off="600" ln="9"/> +<f n="declinedSiteCaller" acc="29" fns="16" sz="24" off="624" ln="9"/> +<f n="declinedSiteList" acc="21" fns="15" sz="24" off="648" ln="10"/> +<f n="declinedSiteRef" acc="25" fns="13" sz="24" off="672" ln="10"/> +<f n="declinedSiteKind" acc="9" fns="6" sz="24" off="696" ln="10"/> +<f n="declinedSiteBound" acc="5" fns="4" sz="24" off="720" ln="11"/> +<f n="gateDeclinedTarget" acc="10" fns="4" sz="24" off="744" ln="11"/> +<f n="stdMemberDeclinedCalls" acc="16" fns="12" sz="8" off="776" ln="12"/> +<f n="stdMemberDeclines" acc="13" fns="4" sz="24" off="784" ln="12"/> +<f n="keptForwards" acc="17" fns="16" sz="24" off="808" ln="12"/> +<f n="provenSites" acc="14" fns="11" sz="24" off="832" ln="13"/> +<f n="callDispositions" acc="5" fns="3" sz="80" off="856" ln="13"/> +<f n="localityKey" acc="5" fns="3" sz="24" off="936" ln="14"/> +… [1425 more display lines; full output is 134138 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: 1.72s** + +````` +<!-- ripwire field-affinity schema=ripwire.field-affinity/v1: fields read together but declared far apart vs 64-byte lines: <s n= p=> structs, <pair a= b= fns= dist=>, <finding k= f= g=>. window: shown= capped= (capped=1 cut). counts_floor=1: every count is a FLOOR, never a total. root=: p= relative to it. sym=: the struct asked for; only its own fields and pairs are reported. block=64: ASSUMED cache-line bytes; all geometry (dist= wt= ln= lines= findings) is against it. model=lp64-approx: sizes/offsets are the layout verb's LP64 standard-layout MODEL, not the real ABI. weighting=fanin-floor: w= sums 1 + fan-in per co-accessing fn; a reachability proxy, not a frequency. aggregates=N: C-family structs/classes the layout model located a body for (the scanned universe). files=N: C-family files declaring at least one struct/class the modelling pass visited. fns_scanned=N: C-family functions/methods with a readable body scanned for dot/arrow member accesses. accesses=N: member-access sites tied to one aggregate field (FLOOR: bare in-method names uncounted). amb_skipped=N: access sites REFUSED, not guessed: 2+ aggregates declare that field name; in no count here. structs=N: aggregates with 1+ attributed access; the top 20 by sepcost= print (shown=/capped=). findings=N: split-line + straddle findings over ALL structs=, not just the printed rows. min_fns=2: a pair fires split-line only when co-accessed by this many distinct functions. as_loops=N: for-loops the static advance-shape pass classified corpus-wide; report-only, never ranks. as_index=/as_chase=/as_mixed=/as_unknown=: as_loops= by advance shape (chase = pointer chase). agg=: the aggregate keyword (struct, class ...). modeled=1: layout model placed the fields; 0 = affinity only, no geometry, no finding (why= says why). fields=N: fields declared (before the touched-only filter). touched=N: fields with 1+ attributed access; at most 32 f rows print. pairs=N: co-accessed field pairs in all; at most 12 pair rows print (most fns= first). sepcost=: sum over measured pairs of fns x (1 - wt); the struct ranking key. findings=N: this struct's findings, every one printed. size=/align=/lines=: modeled sizeof, alignment, cache lines spanned (modeled=1 only). acc=N: member-access sites attributed to this field (FLOOR). sz=B: the field's modeled size in bytes (absent when the model could not size it). off=/ln=: modeled byte offset and its cache line (off/64); placed=0 instead when the model refused. fanin=N: this function's caller count (the w= proxy input). touched=N: distinct fields of this struct the function touches (named in f=); at most 8 fn rows of fns= print. scopes=N: distinct PROFILE_SCOPEs among the co-accessing functions (the scope children). status=: instrumented (a scope exists to measure) or uninstrumented (no witness yet). counter=: the hardware counter to compare across the two layouts. as_stem_ambiguous=/as_stem_unowned=/as_stem_nonptr=: chase names REFUSED - 2+ owners / no owner / owner type has no pointer marker. --> +<fieldaffinity schema="ripwire.field-affinity/v1" block="64" model="lp64-approx" counts_floor="1" weighting="fanin-floor" aggregates="3078" files="611" fns_scanned="15130" accesses="15723" amb_skipped="52588" structs="1" shown="1" capped="0" findings="0" min_fns="2" as_loops="4574" as_index="9" as_c … [line truncated: 84 more bytes on this line] +<s n="Symbol" p="src/model.h" l="912" agg="struct" modeled="1" fields="31" touched="1" fns="15" pairs="0" sepcost="0.00" findings="0" size="112" align="8" lines="2"> +<f n="fnLocal" acc="15" fns="15" sz="1" off="62" ln="0"/> +<fn n="fileDefsInLineOrder" p="src/forfilepage.h" l="418" fanin="0" touched="1" f="fnLocal"/> +<fn n="renderForFilePage" p="src/forfilepage.h" l="616" fanin="0" touched="1" f="fnLocal"/> +<fn n="applyFileSubjectLift" p="src/forfilepage.h" l="722" fanin="0" touched="1" f="fnLocal"/> +<fn n="receiverOf" p="src/forselfhook.h" l="927" fanin="0" touched="1" f="fnLocal"/> +<fn n="withTaskNamedMembers" p="src/forselfhook.h" l="1043" fanin="0" touched="1" f="fnLocal"/> +<fn n="coneDefsOf" p="src/forselfhook.h" l="1100" fanin="0" touched="1" f="fnLocal"/> +<fn n="renderForSelfHooks" p="src/forselfhook.h" l="1291" fanin="0" touched="1" f="fnLocal"/> +<fn n="localDefOutOfReach" p="src/graph.h" l="2047" fanin="0" touched="1" f="fnLocal"/> +<validate scopes="2" status="instrumented" counter="l1d-cache-misses"> +<scope n="buildGraph/8: HTTP-route edges"/> +<scope n="ingest/build-model: lex stats CSR + file signatures (B0)"/> +</validate> +</s> +</fieldaffinity> +````` + +## `./build/ripwire . --naming-consistency --limit=8` + +*The corpus's OWN case-convention vote per (language, kind) group; off-convention names get a mechanical propose= (a suggestion, never a blind rename).* + +````` +<!-- ripwire naming-consistency schema=ripwire.naming-consistency/v1: the corpus's case-convention vote per (language, kind): <g lang= kind= style= agree= total=>, <f p= n= propose=> outliers. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). root=: p= relative to it. component_exempt=N: PascalCase .tsx/.jsx functions (read as JSX components by extension alone), kept out of voting and flagging. groups=N: (language, kind) groups with at least one styled name. candidates=N: multi-token styled names scanned. decided=N: groups whose leading style cleared both the sample and agreement floors. flagged=N: off-convention names in decided groups (the f rows). g why=insufficient-sample|no-clear-convention: which bar a style=UNAVAILABLE group missed. --> +<naming-consistency schema="ripwire.naming-consistency/v1" groups="32" candidates="19493" decided="11" flagged="799" component_exempt="8" shown="8" capped="1" total="799" has_more="1" next_offset="8" offset="0" limit="8" root="."> +<g lang="cpp" kind="fn" style="camel" agree="10732" total="11358"/> +<g lang="cpp" kind="var" style="camel" agree="2403" total="2424"/> +<g lang="py" kind="fn" style="snake" agree="1439" total="1489"/> +<g lang="py" kind="var" style="UNAVAILABLE" why="no-clear-convention" total="562"/> +<g lang="ts" kind="fn" style="camel" agree="302" total="313"/> +<g lang="ts" kind="var" style="UNAVAILABLE" why="insufficient-sample" total="5"/> +<g lang="go" kind="fn" style="UNAVAILABLE" why="no-clear-convention" total="113"/> +<g lang="go" kind="var" style="UNAVAILABLE" why="insufficient-sample" total="13"/> +<g lang="rs" kind="fn" style="snake" agree="311" total="322"/> +<g lang="rs" kind="var" style="UNAVAILABLE" why="insufficient-sample" total="13"/> +<g lang="swift" kind="fn" style="UNAVAILABLE" why="no-clear-convention" total="50"/> +<g lang="swift" kind="var" style="UNAVAILABLE" why="insufficient-sample" total="17"/> +<g lang="objc" kind="fn" style="UNAVAILABLE" why="insufficient-sample" total="18"/> +<g lang="js" kind="fn" style="camel" agree="167" total="169"/> +<g lang="js" kind="var" style="UNAVAILABLE" why="insufficient-sample" total="3"/> +<g lang="sh" kind="fn" style="UNAVAILABLE" why="no-clear-convention" total="1619"/> +<g lang="java" kind="fn" style="camel" agree="112" total="112"/> +<g lang="java" kind="var" style="UNAVAILABLE" why="insufficient-sample" total="1"/> +<g lang="rb" kind="fn" style="snake" agree="55" total="55"/> +<g lang="rb" kind="var" style="UNAVAILABLE" why="insufficient-sample" total="17"/> +<g lang="cs" kind="fn" style="pascal" agree="39" total="39"/> +<g lang="cs" kind="var" style="UNAVAILABLE" why="insufficient-sample" total="3"/> +<g lang="c" kind="fn" style="UNAVAILABLE" why="no-clear-convention" total="506"/> +<g lang="c" kind="var" style="UNAVAILABLE" why="no-clear-convention" total="20"/> +<g lang="php" kind="fn" style="UNAVAILABLE" why="insufficient-sample" total="9"/> +<g lang="php" kind="var" style="UNAVAILABLE" why="insufficient-sample" total="1"/> +<g lang="lua" kind="fn" style="UNAVAILABLE" why="insufficient-sample" total="15"/> +<g lang="ex" kind="fn" style="snake" agree="23" total="23"/> +… [13 more display lines; full output is 4390 bytes on 1 raw line(s)] +````` + +## `./build/ripwire . --naming-calibration` + +*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: 19.33s** + +````` +<!-- ripwire naming-calibration schema=ripwire.naming-calibration/v1: naming lint rules scored against this repo's OWN rename history (a noisy proxy): <r n= old= new= fired= proxy=>. at=: commit+dirty+shallow. probed=0: no history to mine, nothing scored (r= says why); 1 = the git walk ran. pairs=N: labelled rename pairs that survived the join, the SAMPLE SIZE; a small one means nothing. candidates=N: raw substitutions mined from the patch stream before the join; FLOOR when truncated=1. commits=N: non-merge commits walked (the walk stops at 40000). hunks=N: diff hunks with content on both sides. wide_hunks=N: hunks DROPPED for exceeding the 24-line per-side pairing cap; never mined. drop_old_alive=N: candidates dropped: the old spelling is still an indexed name. drop_new_absent=N: candidates dropped: the new spelling is no eligible indexed symbol at HEAD. drop_ambiguous=N: candidates dropped: a name on both sides of several (split, rework, revert). drop_old_skipped=N: candidates dropped: the lens skips the old spelling, no rule could fire. scope=group-rule: the rule judges co-visible names, which one pair cannot evidence; unscored, not 0/0. o=/n=: one labelled pair's old (abandoned) and new (chosen) spelling. sup=N: distinct hunks that showed this substitution. p at=: path:line of the symbol the pair joined to, not a commit (the root at= is). old_fires=: rules that fired on the old spelling; absent when none. new_fires=: rules that fired on the new spelling; absent when none. --> +<naming-calibration schema="ripwire.naming-calibration/v1" probed="1" pairs="218" candidates="3155" commits="7404" hunks="147753" wide_hunks="1597" drop_old_alive="905" drop_new_absent="1837" drop_ambiguous="195" drop_old_skipped="0" at="914c4045d"> +<r n="naming-short" old="2" new="4" fired="6" proxy="0.333"/> +<r n="naming-wordy" old="1" new="1" fired="2" proxy="0.500"/> +<r n="naming-series" scope="group-rule"/> +<r n="naming-underscore" old="0" new="0" fired="0"/> +<r n="naming-case" old="0" new="1" fired="1" proxy="0.000"/> +<r n="naming-predicate" old="0" new="0" fired="0"/> +<r n="naming-setter" old="0" new="0" fired="0"/> +<r n="naming-confusable" scope="group-rule"/> +<!-- 4 rename rows withheld: the project's own rebrand, which names a private pre-release identifier --> +<p o="ATTR" n="ATTR_RE" sup="1" at="./bench/recalleval/run_recalleval.py:84"/> +<p o="DEGRADED_PATH_ALERT" n="DISCLOSE" sup="329" at="./test/showcase_coverage_check.py:154"/> +<p o="InRepoImportCounter" n="ImportResolver" sup="1" at="./src/resolve.h:4810"/> +<p o="LexTfTable" n="LexMatchTfTable" sup="3" at="./src/lexical.h:763"/> +<p o="RunEval" n="DriveEval" sup="2" at="./test/attribmultideffix/cpp/eval_user.cc:4"/> +<p o="RunPiece" n="DrivePiece" sup="3" at="./test/attribmultideffix/cpp/piece_user.cc:4"/> +<p o="Rust" n="Go" sup="1" at="./test/fnslotcpp/src/twin_a.cc:1" new_fires="naming-short"/> +<p o="Subtoken" n="Member" sup="1" at="./test/callformfix/csharp/Main.cs:9"/> +<p o="TTCA" n="answer" sup="1" at="./src/ifacedispatch.h:309"/> +<p o="_famBIsFamily" n="_famBKind" sup="1" at="./test/showcase_capture.py:493"/> +<p o="above" n="below" sup="1" at="./src/pathgaps.h:645"/> +<p o="answerWords" n="answerTokens" sup="1" at="./src/forfilesyms.h:248"/> +<p o="appendSubjectGraphVerb" n="appendSubjectGraphVerbBlock" sup="4" at="./src/verbs_for.h:3461"/> +<p o="atomicWriteQSnap" n="atomicWriteFile" sup="4" at="./src/quality.h:5065"/> +<p o="bodyOwnerClimb" n="adoptBodyOwnerOrTypeUse" sup="2" at="./src/ingest_sidecap.h:2314" new_fires="naming-wordy"/> +<p o="bodyXml" n="xml" sup="2" at="./src/fordocbody.h:964"/> +… [199 more display lines; full output is 19232 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: 4.17s** + +````` +<!-- ripwire lint schema=ripwire.lint/v1: AST-only checks, facts not gates: <rule name= count= shown_rows= rows_capped= count_capped=> of <f rule= p= in=>. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). findings_capped=/rows_capped=/count_capped=: 1 = cut. counts_floor=1: every count is a FLOOR, never a total. root=: p= relative to it. findings=N: findings over the printed rules; a floor when findings_capped=1. findings_next=: the call counting the floored rules' rest (count_capped=1 rules only, 10x per-rule budget). --> +<lint schema="ripwire.lint/v1" findings="10481" shown="628" capped="1" total="10481" has_more="1" next_offset="628" offset="0" limit="0" counts_floor="1" findings_capped="1" findings_next="--lint --naming-locals --lint-select=magic-number --lint-max-per-rule=50000" naming_locals="1" root="."> +<rule name="c-style-cast" count="761" shown_rows="28" rows_capped="1"/> +<rule name="goto" count="17" shown_rows="0" rows_capped="1"/> +<rule name="do-while" count="20" shown_rows="0" rows_capped="1"/> +<rule name="unsafe-c-fn" count="0" shown_rows="0" rows_capped="0"/> +<rule name="weak-crypto" count="0" shown_rows="0" rows_capped="0"/> +<rule name="redundant-parens" count="0" shown_rows="0" rows_capped="0"/> +<rule name="suspicious-semicolon" count="0" shown_rows="0" rows_capped="0"/> +<rule name="typedef-over-using" count="50" shown_rows="0" rows_capped="1"/> +<rule name="magic-number" count="372" shown_rows="201" rows_capped="1" count_capped="1"/> +<rule name="empty-catch" count="1" shown_rows="0" rows_capped="1"/> +<rule name="self-assign" count="3" shown_rows="0" rows_capped="1"/> +<rule name="large-function" count="378" shown_rows="25" rows_capped="1"/> +<rule name="deep-nesting" count="551" shown_rows="35" rows_capped="1"/> +<rule name="inconsistent-return" count="2" shown_rows="0" rows_capped="1"/> +<rule name="unreachable-code" count="5" shown_rows="0" rows_capped="1"/> +<rule name="naming-short" count="4117" shown_rows="204" rows_capped="1"/> +<rule name="naming-wordy" count="203" shown_rows="7" rows_capped="1"/> +<rule name="naming-series" count="985" shown_rows="0" rows_capped="1"/> +<rule name="naming-underscore" count="2" shown_rows="0" rows_capped="1"/> +<rule name="naming-case" count="102" shown_rows="0" rows_capped="1"/> +<rule name="naming-predicate" count="1" shown_rows="0" rows_capped="1"/> +<rule name="naming-setter" count="4" shown_rows="0" rows_capped="1"/> +<rule name="naming-confusable" count="1142" shown_rows="28" rows_capped="1"/> +<rule name="naming-uninformative" count="0" shown_rows="0" rows_capped="0"/> +<rule name="atom-comma-operator" count="5" shown_rows="0" rows_capped="1"/> +<rule name="atom-embedded-crement" count="253" shown_rows="7" rows_capped="1"/> +<rule name="atom-assign-as-value" count="108" shown_rows="8" rows_capped="1"/> +<rule name="atom-nested-ternary" count="379" shown_rows="16" rows_capped="1"/> +… [640 more display lines; full output is 72804 bytes on 1 raw line(s)] +````` + +## `./build/ripwire . --lint-catalog` + +*The built-in rule registry — one row per rule with sev=/category=/rationale/lang=/since=; no corpus needed.* + +````` +<!-- ripwire lint-catalog schema=ripwire.lint-catalog/v1: the built-in lint rule registry: <rule name= sev= cat= lang= since=>. rules=N: rules in the built-in registry, one rule row each, never cut. --> +<lintcatalog schema="ripwire.lint-catalog/v1" rules="39"> +<rule name="c-style-cast" sev="warn" cat="style" lang="cpp,c,objc,java,cs" since="v0.1.0">a C-style cast — cppcoreguidelines-pro-type-cstyle-cast prefers the explicit static_cast/const_cast/reinterpret_cast</rule> +<rule name="goto" sev="warn" cat="control-flow" lang="cpp,c,objc,go,cs" since="v0.1.0">a goto statement — cppcoreguidelines-avoid-goto</rule> +<rule name="do-while" sev="info" cat="style" lang="cpp,c,objc,ts,js,swift,java,cs" since="v0.1.0">a do/while loop shape (on Swift, its do/catch block shares the same grammar node and also matches)</rule> +<rule name="unsafe-c-fn" sev="error" cat="security" lang="cpp,c,objc,ts,js,go,rs" since="v0.1.0">a call to an unbounded C string function (strcpy/strcat/sprintf/gets)</rule> +<rule name="weak-crypto" sev="error" cat="security" lang="cpp,c,objc,ts,js,go,rs" since="v0.1.0">a call to a broken hash or cipher (MD5/SHA1/MD4/RC4)</rule> +<rule name="redundant-parens" sev="info" cat="style" lang="cpp,c,objc,py,ts,js,go,rs,java,cs" since="v0.1.0">a doubly-parenthesized expression — readability-redundant-parentheses</rule> +<rule name="suspicious-semicolon" sev="warn" cat="correctness" lang="cpp,c,objc" since="v0.1.0">an if-body that is just `;` — bugprone-suspicious-semicolon</rule> +<rule name="typedef-over-using" sev="info" cat="style" lang="cpp,c,objc" since="v0.1.0">a C-style typedef struct/union where `using` is preferred</rule> +<rule name="magic-number" sev="info" cat="maintainability" lang="cpp,c,objc" since="v0.1.0">a non-trivial numeric literal inside a function body, outside a const/constexpr init</rule> +<rule name="empty-catch" sev="warn" cat="error-masking" lang="cpp,c,objc" since="v0.1.0">a catch block with an empty body</rule> +<rule name="self-assign" sev="warn" cat="correctness" lang="cpp,c,objc,ts,js,rs,java,cs" since="v0.1.0">x = x — almost always a copy-paste bug</rule> +<rule name="large-function" sev="info" cat="maintainability" lang="cpp,c" since="v0.1.0">a function body over 80 lines</rule> +<rule name="deep-nesting" sev="info" cat="maintainability" lang="cpp,c" since="v0.1.0">brace nesting depth over 4 inside a function body</rule> +<rule name="inconsistent-return" sev="info" cat="maintainability" lang="cpp,c" since="v0.1.0">a bare `return;` mixed with a value-returning return in the same function</rule> +<rule name="unreachable-code" sev="warn" cat="correctness" lang="cpp,c,objc,py,ts,js,go,java,cs" since="v0.1.0">a statement after an unconditional return/break/continue/throw/raise in the same block</rule> +<rule name="naming-short" sev="info" cat="naming" lang="cpp,c,objc,py,ts,js,go,rs,swift,java,cs,rb,sh,php,lua,ex,dart,kt,gd,clj" since="v0.2.2">a 1-2 letter Function/Method/Var name — visible far beyond any tiny scope [Beniamini/Hofmeister]</rule> +<rule name="naming-wordy" sev="info" cat="naming" lang="cpp,c,objc,py,ts,js,go,rs,swift,java,cs,rb,sh,php,lua,ex,dart,kt,gd,clj" since="v0.2.2">more than 5 words in one name; a k or C-family g_/m_/s_ marker prefix is not a word [Butler; AlSuhaibani]</rule> +<rule name="naming-series" sev="info" cat="naming" lang="cpp,c,objc,py,ts,js,go,rs,swift,java,cs,rb,sh,php,lua,ex,dart,kt,gd,clj" since="v0.2.2">foo1/foo2/... digit-suffix siblings sharing a base name in one scope [Butler]</rule> +<rule name="naming-underscore" sev="info" cat="naming" lang="cpp,c,objc,py,ts,js,go,rs,swift,java,cs,rb,sh,php,lua,ex,dart,kt,gd,clj" since="v0.2.2">internal consecutive underscores, or a C-family reserved __x/_X form [Butler]</rule> +<rule name="naming-case" sev="info" cat="naming" lang="cpp,c,objc,py,ts,js,go,rs,swift,java,cs,rb,sh,php,lua,ex,dart,kt,gd,clj" since="v0.2.2">snake_case and camelCase mixed inside one name [Butler]</rule> +<rule name="naming-predicate" sev="info" cat="naming" lang="cpp,c,objc,py,ts,js,go,rs,swift,java,cs,rb,sh,php,lua,ex,dart,kt,gd,clj" since="v0.2.2">an is/has/can/should/was-prefixed name whose KNOWN return type is not bool-like [LAPD A2]</rule> +<rule name="naming-setter" sev="info" cat="naming" lang="cpp,c,objc,py,ts,js,go,rs,swift,java,cs,rb,sh,php,lua,ex,dart,kt,gd,clj" since="v0.2.2">a set-prefixed name whose KNOWN return type is not void-like [LAPD A3]</rule> +<rule name="naming-confusable" sev="info" cat="naming" lang="cpp,c,objc,py,ts,js,go,rs,swift,java,cs,rb,sh,php,lua,ex,dart,kt,gd,clj" since="v0.2.2">a co-visible pair within edit distance <=2, reordered tokens, or a bare/digit-suffixed twin [Namesake]</rule> +<rule name="naming-uninformative" sev="info" cat="naming" lang="cpp,c,objc,py,ts,js,go,rs,swift,java,cs,rb,sh,php,lua,ex,dart,kt,gd,clj" since="v0.2.2">every split subtoken is corpus-ubiquitous (BM25 idf) on a body past the size floor — fires only at the low end [Sparck Jones 1972]</rule> +<rule name="atom-comma-operator" sev="info" cat="readability" lang="cpp,c,objc" since="v0.2.2">the comma operator inside an expression (never a for-header comma) [Gopstein FSE 2017]</rule> +<rule name="atom-embedded-crement" sev="info" cat="readability" lang="cpp,c,objc" since="v0.2.2">++/-- evaluated inside a larger expression (never a whole statement) [Gopstein FSE 2017]</rule> +<rule name="atom-assign-as-value" sev="info" cat="readability" lang="cpp,c,objc" since="v0.2.2">an assignment whose VALUE is consumed (a condition, an argument, ...) [Gopstein FSE 2017]</rule> +<rule name="atom-nested-ternary" sev="info" cat="readability" lang="cpp,c,objc" since="v0.2.2">a conditional expression inside a conditional expression [Gopstein FSE 2017]</rule> +… [12 more display lines; full output is 7847 bytes on 1 raw line(s)] +````` + +## `./build/ripwire . --legend-dict` + +*The session legend dictionary the MCP server serves as ripwire://legend-dict/full — one definition per line, headed by its dictv= version; no corpus needed. =roster lists the completeness attributes it defines.* + +````` +ripwire legend dictionary ripwire.dict/v1 dictv=6ad237691d743450 entries=1178 +<about legend="ref" dict= dictv=>: this LAST child is only the legend pointer; the root keeps every attribute it carries inline, unchanged (schema=, each count, cut and floor); rows follow it; legend="ref": a definition is sent once per session (this dictionary's core, or the first answer that needs … [line truncated: 80 more bytes on this line] +schema=ripwire.KEY/v1: the line ripwire.KEY/v1 below reads the answer's rows +window: shown= total= capped= has_more= next_offset= offset= limit= page a list (capped=1 cut; next_offset= pastes as offset=) +X_capped= (any attribute ending _capped): 1 = cut +under ref, est_tokens= and over_ceiling= price the answer with its inline legend: an upper bound +under ref, a <g n= p=> group of n <= 8 runner-less rows prints as its n single rows, each run_unknown=1 +ripwire.map/v1 <r>: ranked symbol map: <f p= layer=> groups <s t= n= sc= k= amb=> rows (k= rank), <c n=> resolved callees; the header comment is data +ripwire.map-diff/v1 <r>: the ranked map anchored at at=: what the diff touched, the map's row vocabulary +ripwire.metrics/v1 <r>: the ranked map with per-symbol metrics +ripwire.around/v1 <r>: call neighbourhood of of=: depth= hops, fanout= kept per hop; absent rows lie outside that boundary +ripwire.query/v1 <r>: lexical-rank map for the query term, the map's row vocabulary +ripwire.pack-signatures/v1 <ctx>: the ranked map plus <sigs><d l= n= sc= pure=> signature rows +ripwire.pack-top-n/v1 <ctx>: the ranked map plus <src p=> bodies of the top-N symbols +ripwire.skipped/v1 <ctx>: why the index lacks a file <f p= why= bytes= limit= ext=>; indexed but unvouched <h p= why= err= err_ratio=>; <lang> census +ripwire.notes/v1 <ctx>: field notes by target: <target id= dangling=> holds <note d= sha= branch=>; the kept count comment: notes= rows, targets= <target> rows, dangling= targets matching nothing indexed (listed, surfaced nowhere) +ripwire.lego/v1 <ctx>: ONE interface/base type: <iface n= p= defs= implementors=>, its <m> method contract, every implementor +ripwire.expand/v1 <ctx>: full bodies: <bodies shown= total= capped=> of <b t= l= p= n= sibs= sibs_total= sibs_capped= inc=>; <calls><c n= l= p=> resolved callees (p= when not the b's file) +ripwire.expand-file/v1 <ctx>: the file's own text: <src p= sym=>; <s n= sc= l=/> per scoped symbol; full id = p::sc::n +ripwire.candidate-page/v1 <sigs>: budgeted-bundle candidate page: a resumable window over the ranked candidate set the bundle cuts, for task= under budget_tokens=, one tier per page, ranks global across pages +ripwire.pack-task/v1 <ctx>: one-call task bundle for task= under budget_tokens=: <sigs><d n= sc= l= p=> ranking, <far><s t= n= p=> ranked but over 1 hop out (of_top= ranked rows) > <bodies><b t= n= p= l=> with <calls><c n= l= p=> callees > <callers><s rel=caller|callee shared=> 1-hop from the bodies … [line truncated: 108 more bytes on this line] +ripwire.from-trace/v1 <ctx>: trace frames mapped to indexed symbols, innermost first; the innermost in-corpus body included +ripwire.exemplar/v1 <ctx>: the best-in-class instance of kind= for the task, chosen by role: <exemplar n= p= in= ccx= tested=>, <bodies><b> to imitate +ripwire.pack-task/v1 <ctx-partitions>: N minimally overlapping agent bundles carved along call-graph communities plus one shared core; each <bundle> wraps a <ctx>; bundle role=core|partition i= symbols= modules= bytes= tokens=: one agent's ctx, symbols= ids assigned, bytes= its size; tokens= = est_t … [line truncated: 345 more bytes on this line] +ripwire.callers/v1 <callers>: 1-hop CALLERS of of= (defs= matched, count= distinct symbols): <s t= n= p=>; hop_tested=/hop_untested= +ripwire.callees/v1 <callees>: 1-hop CALLEES of of= (defs= matched, count= distinct symbols): <s t= n= p= role= tested=> +ripwire.uses/v1 <uses>: resolvable use-sites of of=: <u role=call|macro|read|write|import|extends|type p=file:line in_id=> +ripwire.impact/v1 <impact>: transitive blast radius of of=: <s t= n= p=> reach set, <f via= p=> importers; defs= matched, reaches= their transitive callers, radius_tested= non-tests an indexed test reaches, radius_untested= the rest; importers= files that #include/import a def's file +ripwire.defs/v1 <defs>: per <name q= defs=> the parsed definitions the name binds (defs= groups; a prototype with its definition is one): <d n= t= p= sel= lang= class=source|test in=>, sel= binds that one alone in any SYM verb, in= distinct callers (a floor); source first, then in=, then path +ripwire.path/v1 <path>: one DIRECTED call path from= to to=, each <s t= n= p=> a hop; reachable=0 hops=0 when none shown +… [1149 more display lines; full output is 135171 bytes on 1179 raw line(s)] +````` + +## `./build/ripwire . --lint --lint-select=cache-` + +*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.31s** + +````` +<!-- ripwire lint schema=ripwire.lint/v1: AST-only checks, facts not gates: <rule name= count= shown_rows= rows_capped= count_capped=> of <f rule= p= in=>. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). rows_capped=: 1 = cut. root=: p= relative to it. findings=N: findings over the printed rules; a floor when findings_capped=1. --> +<lint schema="ripwire.lint/v1" findings="972" shown="631" capped="1" total="972" has_more="1" next_offset="631" offset="0" limit="0" selected="8 of 39" select="cache-" root="."> +<rule name="cache-node-container" count="54" shown_rows="31" rows_capped="1"/> +<rule name="cache-vector-of-raw-ptr" count="169" shown_rows="112" rows_capped="1"/> +<rule name="cache-vector-of-indirect" count="296" shown_rows="188" rows_capped="1"/> +<rule name="cache-heap-alloc-in-loop" count="7" shown_rows="3" rows_capped="1"/> +<rule name="cache-pointer-chase-loop" count="8" shown_rows="1" rows_capped="1"/> +<rule name="cache-gather-subscript" count="416" shown_rows="296" rows_capped="1"/> +<rule name="cache-shared-ptr-by-value" count="21" shown_rows="0" rows_capped="1"/> +<rule name="cache-manual-prefetch" count="1" shown_rows="0" rows_capped="1"/> +<f rule="cache-vector-of-indirect" p="bench/agentloop/editsuite/fixture/matrix.cpp:3" in="Matrix">vector<std::vector<double>></f> +<f rule="cache-gather-subscript" p="bench/bench_chase_ab.cpp:106" in="linkChain">nodes[ perm[i] ]</f> +<f rule="cache-gather-subscript" p="bench/bench_chase_ab.cpp:106" in="linkChain">nodes[ perm[ i + 1 ] ]</f> +<f rule="cache-pointer-chase-loop" p="bench/bench_chase_ab.cpp:118" in="chase">p = p->next</f> +<f rule="cache-node-container" p="bench/bench_convergence.cpp:40" in="Map">map</f> +<f rule="cache-gather-subscript" p="bench/bench_convergence.cpp:77" in="main">byName[ symN[i] ]</f> +<f rule="cache-vector-of-indirect" p="bench/bench_convergence.cpp:82" in="main">vector<std::vector<std::vector<std::uint32_t>>></f> +<f rule="cache-vector-of-indirect" p="bench/bench_convergence.cpp:82" in="main">vector<std::vector<std::uint32_t>></f> +<f rule="cache-gather-subscript" p="bench/bench_convergence.cpp:97" in="main">m[ symN[id] ]</f> +<f rule="cache-vector-of-indirect" p="bench/bench_newline_ab.cpp:279" in="main">vector<std::vector<double>></f> +<f rule="cache-gather-subscript" p="bench/bench_ordered_map.cpp:89" in="aggregateMax">m[ in.keys[ i ] ]</f> +<f rule="cache-node-container" p="bench/bench_svector3.cpp:62" in="Map">map</f> +<f rule="cache-vector-of-indirect" p="bench/bench_svector3.cpp:85" in="main">vector<std::vector<std::vector<std::uint32_t>>></f> +<f rule="cache-vector-of-indirect" p="bench/bench_svector3.cpp:85" in="main">vector<std::vector<std::uint32_t>></f> +<f rule="cache-gather-subscript" p="bench/bench_svector3.cpp:95" in="main">m[ symN[id] ]</f> +<f rule="cache-node-container" p="bench/bench_svector_wave.cpp:94" in="Map">map</f> +<f rule="cache-gather-subscript" p="bench/bench_svector_wave.cpp:155" in="build">m[ g_pool[ g_keyOf[i] ] ]</f> +<f rule="cache-gather-subscript" p="bench/bench_svector_wave.cpp:162" in="readSize">g_pool[ g_readOf[i] ]</f> +<f rule="cache-gather-subscript" p="bench/bench_svector_wave.cpp:172" in="readIterate">g_pool[ g_readOf[i] ]</f> +<f rule="cache-gather-subscript" p="bench/bench_svector_wave.cpp:184" in="rehash">m[ g_pool[i] ]</f> +… [612 more display lines; full output is 72930 bytes on 1 raw line(s)] +````` + +## `./build/ripwire . --lint --lint-ignore=naming-,cache-` + +*DROP two families, applied after selection; the raw select=/ignore= you passed rides on the root.* + +**wall time: 2.90s** + +````` +<!-- ripwire lint schema=ripwire.lint/v1: AST-only checks, facts not gates: <rule name= count= shown_rows= rows_capped= count_capped=> of <f rule= p= in=>. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). findings_capped=/rows_capped=/count_capped=: 1 = cut. counts_floor=1: every count is a FLOOR, never a total. root=: p= relative to it. findings=N: findings over the printed rules; a floor when findings_capped=1. findings_next=: the call counting the floored rules' rest (count_capped=1 rules only, 10x per-rule budget). --> +<lint schema="ripwire.lint/v1" findings="2953" shown="713" capped="1" total="2953" has_more="1" next_offset="713" offset="0" limit="0" counts_floor="1" findings_capped="1" findings_next="--lint --lint-select=magic-number --lint-max-per-rule=50000" selected="22 of 39" ignore="naming-,cache-" root="." … [line truncated: 1 more bytes on this line] +<rule name="c-style-cast" count="761" shown_rows="127" rows_capped="1"/> +<rule name="goto" count="17" shown_rows="0" rows_capped="1"/> +<rule name="do-while" count="20" shown_rows="0" rows_capped="1"/> +<rule name="unsafe-c-fn" count="0" shown_rows="0" rows_capped="0"/> +<rule name="weak-crypto" count="0" shown_rows="0" rows_capped="0"/> +<rule name="redundant-parens" count="0" shown_rows="0" rows_capped="0"/> +<rule name="suspicious-semicolon" count="0" shown_rows="0" rows_capped="0"/> +<rule name="typedef-over-using" count="50" shown_rows="0" rows_capped="1"/> +<rule name="magic-number" count="372" shown_rows="368" rows_capped="1" count_capped="1"/> +<rule name="empty-catch" count="1" shown_rows="0" rows_capped="1"/> +<rule name="self-assign" count="3" shown_rows="0" rows_capped="1"/> +<rule name="large-function" count="378" shown_rows="47" rows_capped="1"/> +<rule name="deep-nesting" count="551" shown_rows="78" rows_capped="1"/> +<rule name="inconsistent-return" count="2" shown_rows="0" rows_capped="1"/> +<rule name="unreachable-code" count="5" shown_rows="0" rows_capped="1"/> +<rule name="atom-comma-operator" count="5" shown_rows="1" rows_capped="1"/> +<rule name="atom-embedded-crement" count="253" shown_rows="25" rows_capped="1"/> +<rule name="atom-assign-as-value" count="108" shown_rows="16" rows_capped="1"/> +<rule name="atom-nested-ternary" count="379" shown_rows="49" rows_capped="1"/> +<rule name="atom-implicit-predicate" count="3" shown_rows="2" rows_capped="1"/> +<rule name="atom-octal-literal" count="45" shown_rows="0" rows_capped="1"/> +<rule name="atom-reversed-subscript" count="0" shown_rows="0" rows_capped="0"/> +<f rule="magic-number" p="bench/agentloop/editsuite/fixture/geometry.cpp:7" in="area_of_triangle">0.5</f> +<f rule="magic-number" p="bench/bench_chase_ab.cpp:100" in="linkChain">1023u</f> +<f rule="large-function" p="bench/bench_chase_ab.cpp:161" in="main">main (90 lines)</f> +<f rule="magic-number" p="bench/bench_chase_ab.cpp:167" in="main">20</f> +<f rule="atom-implicit-predicate" p="bench/bench_chase_ab.cpp:234" in="main">delta < 0.02 && delta > -0.02</f> +<f rule="magic-number" p="bench/bench_chase_ab.cpp:234" in="main">0.02</f> +… [708 more display lines; full output is 67292 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.70s** + +````` +<!-- ripwire lint schema=ripwire.lint/v1: AST-only checks, facts not gates: <rule name= count= shown_rows= rows_capped= count_capped=> of <f rule= p= in=>. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). findings_capped=/rows_capped=/count_capped=: 1 = cut. counts_floor=1: every count is a FLOOR, never a total. root=: p= relative to it. findings=N: findings over the printed rules; a floor when findings_capped=1. findings_next=: the call counting the floored rules' rest (count_capped=1 rules only, 10x per-rule budget). --> +<lint schema="ripwire.lint/v1" findings="4" shown="4" capped="1" total="4" has_more="0" next_offset="4" offset="0" limit="0" counts_floor="1" findings_capped="1" findings_next="--lint --lint-select=goto --lint-max-per-rule=40" selected="1 of 39" select="goto" root="."> +<rule name="goto" count="4" shown_rows="4" rows_capped="0" count_capped="1"/> +<f rule="goto" p="src/infra/timsort.hpp:508" in="mergeLo">goto epilogue;</f> +<f rule="goto" p="src/infra/timsort.hpp:517" in="mergeLo">goto epilogue;</f> +<f rule="goto" p="src/infra/timsort.hpp:534" in="mergeLo">goto epilogue;</f> +<f rule="goto" p="src/infra/timsort.hpp:541" in="mergeLo">goto epilogue;</f> +</lint> +````` + +## `./build/ripwire . --lint --lint-select=goto --lint-max-per-rule=40` + +*Pasting that findings_next=: the same rule under a 10x budget counts its true total — no count_capped=, no findings_next=.* + +**wall time: 2.59s** + +````` +<!-- ripwire lint schema=ripwire.lint/v1: AST-only checks, facts not gates: <rule name= count= shown_rows= rows_capped= count_capped=> of <f rule= p= in=>. window: shown= capped= (capped=1 cut). rows_capped=: 1 = cut. root=: p= relative to it. findings=N: findings over the printed rules; a floor when findings_capped=1. --> +<lint schema="ripwire.lint/v1" findings="17" shown="17" capped="0" selected="1 of 39" select="goto" root="."> +<rule name="goto" count="17" shown_rows="17" rows_capped="0"/> +<f rule="goto" p="src/infra/timsort.hpp:508" in="mergeLo">goto epilogue;</f> +<f rule="goto" p="src/infra/timsort.hpp:517" in="mergeLo">goto epilogue;</f> +<f rule="goto" p="src/infra/timsort.hpp:534" in="mergeLo">goto epilogue;</f> +<f rule="goto" p="src/infra/timsort.hpp:541" in="mergeLo">goto epilogue;</f> +<f rule="goto" p="src/infra/timsort.hpp:551" in="mergeLo">goto epilogue;</f> +<f rule="goto" p="src/infra/timsort.hpp:558" in="mergeLo">goto epilogue;</f> +<f rule="goto" p="src/infra/timsort.hpp:633" in="mergeHi">goto epilogue;</f> +<f rule="goto" p="src/infra/timsort.hpp:644" in="mergeHi">goto epilogue;</f> +<f rule="goto" p="src/infra/timsort.hpp:663" in="mergeHi">goto epilogue;</f> +<f rule="goto" p="src/infra/timsort.hpp:670" in="mergeHi">goto epilogue;</f> +<f rule="goto" p="src/infra/timsort.hpp:683" in="mergeHi">goto epilogue;</f> +<f rule="goto" p="src/infra/timsort.hpp:689" in="mergeHi">goto epilogue;</f> +<f rule="goto" p="test/forbodyslotfix/src/c/cmd-find.c:101" in="cmd_find_target">goto error;</f> +<f rule="goto" p="test/forbodyslotfix/src/c/cmd-find.c:103" in="cmd_find_target">goto error;</f> +<f rule="goto" p="test/forbodyslotfix/src/c/cmd-find.c:105" in="cmd_find_target">goto error;</f> +<f rule="goto" p="test/sliceflowsensfix/disclosed.cpp:22" in="cd03">goto done;</f> +<f rule="goto" p="test/unreachablefix/dead.cpp:48" in="withGoto">goto done;</f> +</lint> +````` + +## `./build/ripwire . --lint --lint-select=cach-` + +*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.99s** + +````` +(empty) +````` + +stderr: + +````` +ripwire: --lint-select: 'cach-' matches no rule or family (did you mean 'cache-'?) — see --lint-catalog for the full registry +````` + +## `./build/ripwire . --lint --lint-select=nosuchfamily` + +*A PREFIX with no near miss at all: the refusal points at --lint-catalog instead of guessing.* + +**exit code: 1** — **wall time: 2.23s** + +````` +(empty) +````` + +stderr: + +````` +ripwire: --lint-select: 'nosuchfamily' matches no rule or family — see --lint-catalog for the full registry +````` + +## `./build/ripwire . --lint --sarif` + +*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.40s** + +````` +{"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] +{"id":"goto","shortDescription":{"text":"goto"},"properties":{"builtin":true,"capped":false,"applicable":true}}, +{"id":"do-while","shortDescription":{"text":"do-while"},"properties":{"builtin":true,"capped":false,"applicable":true}}, +{"id":"unsafe-c-fn","shortDescription":{"text":"unsafe-c-fn"},"properties":{"builtin":true,"capped":false,"applicable":true}}, +{"id":"weak-crypto","shortDescription":{"text":"weak-crypto"},"properties":{"builtin":true,"capped":false,"applicable":true}}, +{"id":"redundant-parens","shortDescription":{"text":"redundant-parens"},"properties":{"builtin":true,"capped":false,"applicable":true}}, +{"id":"suspicious-semicolon","shortDescription":{"text":"suspicious-semicolon"},"properties":{"builtin":true,"capped":false,"applicable":true}}, +{"id":"typedef-over-using","shortDescription":{"text":"typedef-over-using"},"properties":{"builtin":true,"capped":false,"applicable":true}}, +{"id":"magic-number","shortDescription":{"text":"magic-number"},"properties":{"builtin":true,"capped":true,"applicable":true}}, +{"id":"empty-catch","shortDescription":{"text":"empty-catch"},"properties":{"builtin":true,"capped":false,"applicable":true}}, +{"id":"self-assign","shortDescription":{"text":"self-assign"},"properties":{"builtin":true,"capped":false,"applicable":true}}, +{"id":"large-function","shortDescription":{"text":"large-function"},"properties":{"builtin":true,"capped":false,"applicable":true}}, +{"id":"deep-nesting","shortDescription":{"text":"deep-nesting"},"properties":{"builtin":true,"capped":false,"applicable":true}}, +{"id":"inconsistent-return","shortDescription":{"text":"inconsistent-return"},"properties":{"builtin":true,"capped":false,"applicable":true}}, +{"id":"unreachable-code","shortDescription":{"text":"unreachable-code"},"properties":{"builtin":true,"capped":false,"applicable":true}}, +{"id":"naming-short","shortDescription":{"text":"naming-short"},"properties":{"builtin":true,"capped":false,"applicable":true}}, +{"id":"naming-wordy","shortDescription":{"text":"naming-wordy"},"properties":{"builtin":true,"capped":false,"applicable":true}}, +{"id":"naming-series","shortDescription":{"text":"naming-series"},"properties":{"builtin":true,"capped":false,"applicable":true}}, +{"id":"naming-underscore","shortDescription":{"text":"naming-underscore"},"properties":{"builtin":true,"capped":false,"applicable":true}}, +{"id":"naming-case","shortDescription":{"text":"naming-case"},"properties":{"builtin":true,"capped":false,"applicable":true}}, +{"id":"naming-predicate","shortDescription":{"text":"naming-predicate"},"properties":{"builtin":true,"capped":false,"applicable":true}}, +{"id":"naming-setter","shortDescription":{"text":"naming-setter"},"properties":{"builtin":true,"capped":false,"applicable":true}}, +{"id":"naming-confusable","shortDescription":{"text":"naming-confusable"},"properties":{"builtin":true,"capped":false,"applicable":true}}, +{"id":"naming-uninformative","shortDescription":{"text":"naming-uninformative"},"properties":{"builtin":true,"capped":false,"applicable":true}}, +{"id":"atom-comma-operator","shortDescription":{"text":"atom-comma-operator"},"properties":{"builtin":true,"capped":false,"applicable":true}}, +{"id":"atom-embedded-crement","shortDescription":{"text":"atom-embedded-crement"},"properties":{"builtin":true,"capped":false,"applicable":true}}, +{"id":"atom-assign-as-value","shortDescription":{"text":"atom-assign-as-value"},"properties":{"builtin":true,"capped":false,"applicable":true}}, +{"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}}, +… [17285 more display lines; full output is 2454955 bytes on 1 raw line(s)] +````` + +Parsed summary of the same SARIF (past the display cut): + +````` +sarif 2.1.0 rules= 39 results= 8638 +````` + +## `./build/ripwire . --lint --sarif --limit=5` + +*SARIF is always the FULL result set: paging alongside it refuses loudly.* + +**exit code: 1** + +````` +(empty) +````` + +stderr: + +````` +ripwire: --sarif always emits the full result set — drop --limit=N/--offset=M +````` + +## `./build/ripwire . --dmm` + +*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: 4.86s** + +````` +<!-- ripwire dmm schema=ripwire.dmm/v1: Delta Maintainability Model base=→target=: dmm= good/(good+bad) units by size_metric=; <p k= dmm= good= bad= d_low= d_high=>. at=: commit+dirty+shallow. available=0: no score at all (dmm=UNAVAILABLE, reason= says why); never read as 1.000 or 0.000. combine=pooled: root dmm= is summed good over summed good+bad of the 3 properties (ripwire's own). low_loc=/low_cx=/low_params=: a unit is LOW risk at or under these lines / cyclomatic / params. base_units=/base_volume=/target_units=/target_volume=: units with a body and their line span per side. reason=: why no score (no unit's size, complexity or params moved; a tree failed to parse ...). --> +<dmm schema="ripwire.dmm/v1" base="914c4045d08e71e6e6ad23e8a9a1a6b490679aee" target="working-tree" at="914c4045d" available="0" combine="pooled" size_metric="physical-loc" low_loc="15" low_cx="5" low_params="2" dmm="UNAVAILABLE" good="0" bad="0" base_units="25297" base_volume="333518" target_units=" … [line truncated: 147 more bytes on this line] +<p k="size" dmm="UNAVAILABLE" good="0" bad="0" d_low="0" d_high="0"/> +<p k="complexity" dmm="UNAVAILABLE" good="0" bad="0" d_low="0" d_high="0"/> +<p k="interfacing" dmm="UNAVAILABLE" good="0" bad="0" d_low="0" d_high="0"/> +</dmm> +````` + +## `./build/ripwire . --dmm=HEAD` + +*The per-commit scalar: HEAD vs its first parent, with the three separately actionable sub-scores.* + +**wall time: 15.17s** + +````` +<!-- ripwire dmm schema=ripwire.dmm/v1: Delta Maintainability Model base=→target=: dmm= good/(good+bad) units by size_metric=; <p k= dmm= good= bad= d_low= d_high=>. at=: commit+dirty+shallow. available=0: no score at all (dmm=UNAVAILABLE, reason= says why); never read as 1.000 or 0.000. combine=pooled: root dmm= is summed good over summed good+bad of the 3 properties (ripwire's own). low_loc=/low_cx=/low_params=: a unit is LOW risk at or under these lines / cyclomatic / params. base_units=/base_volume=/target_units=/target_volume=: units with a body and their line span per side. reason=: why no score (no unit's size, complexity or params moved; a tree failed to parse ...). --> +<dmm schema="ripwire.dmm/v1" base="b6ae53e9f828e641b9be583700a1a6501e18ca4f" target="914c4045d08e71e6e6ad23e8a9a1a6b490679aee" at="914c4045d" available="0" combine="pooled" size_metric="physical-loc" low_loc="15" low_cx="5" low_params="2" dmm="UNAVAILABLE" good="0" bad="0" base_units="25297" base_vo … [line truncated: 175 more bytes on this line] +<p k="size" dmm="UNAVAILABLE" good="0" bad="0" d_low="0" d_high="0"/> +<p k="complexity" dmm="UNAVAILABLE" good="0" bad="0" d_low="0" d_high="0"/> +<p k="interfacing" dmm="UNAVAILABLE" good="0" bad="0" d_low="0" d_high="0"/> +</dmm> +````` + +## `./build/ripwire . --dmm=HEAD~3..HEAD` + +*The range form: tree HEAD vs tree HEAD~3.* + +**wall time: 12.63s** + +````` +<!-- ripwire dmm schema=ripwire.dmm/v1: Delta Maintainability Model base=→target=: dmm= good/(good+bad) units by size_metric=; <p k= dmm= good= bad= d_low= d_high=>. at=: commit+dirty+shallow. available=0: no score at all (dmm=UNAVAILABLE, reason= says why); never read as 1.000 or 0.000. combine=pooled: root dmm= is summed good over summed good+bad of the 3 properties (ripwire's own). low_loc=/low_cx=/low_params=: a unit is LOW risk at or under these lines / cyclomatic / params. base_units=/base_volume=/target_units=/target_volume=: units with a body and their line span per side. --> +<dmm schema="ripwire.dmm/v1" base="8e1c5d3957f5dc6beb9169df28789aaf8d962670" target="914c4045d08e71e6e6ad23e8a9a1a6b490679aee" at="914c4045d" available="1" combine="pooled" size_metric="physical-loc" low_loc="15" low_cx="5" low_params="2" dmm="0.979" good="141" bad="3" base_units="25287" base_volume … [line truncated: 54 more bytes on this line] +<p k="size" dmm="0.912" good="31" bad="3" d_low="31" d_high="3"/> +<p k="complexity" dmm="1.000" good="34" bad="0" d_low="34" d_high="0"/> +<p k="interfacing" dmm="1.000" good="76" bad="0" d_low="55" d_high="-21"/> +</dmm> +````` + +## `./build/ripwire . --cochange --cochange-groups` + +*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: 2.35s** + +````` +<!-- ripwire cochange schema=ripwire.cochange/v1: files that change together in git: <pair a= b= together= deg= conf_ab= conf_ba= surprising=>, or for of= <f p= together= conf_rev=>. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). no_file_edges=LANGS: this build resolves almost none of these languages' imports to files (Go only across go.mod replace); counts over them (ca/ce and violations= of the arch verb) are floors over the resolved edges only, and a coupling number absent beside it is unknown, not zero. unknown_pairs=N: pairs left out of groups= because surprising= is unknown for them, not 0; drop the cochange-groups flag to list them. at=: commit+dirty+shallow. root=: p= relative to it. sub_windows=N: equal-commit-count slices of window=; the denominator of recur=. recur=K: slices of sub_windows= the pair co-changed in; 1 = one burst, not a standing coupling. no_file_edges=LANGS: with unknown_pairs=N, pairs whose side imports are almost never resolved to files and none links them are in no group; groups= may be low. --> +<cochange schema="ripwire.cochange/v1" groups="159" pairs_covered="1313" cover="greedy" window="18mo@HEAD" sub_windows="3" no_file_edges="java" unknown_pairs="1" shown="30" capped="1" total="159" has_more="1" next_offset="30" offset="0" limit="0" root="." at="914c4045d"> +<group core="src/cli.h" partners="84"> +<f p="src/abicheck.h" together="5" recur="3" conf_core="0.01"/> +<f p="src/arch.h" together="7" recur="3" conf_core="0.01"/> +<f p="src/clones.h" together="7" recur="3" conf_core="0.01"/> +<f p="src/codexdoctor.h" together="3" recur="2" conf_core="0.00"/> +<f p="src/columnar.h" together="5" recur="3" conf_core="0.01"/> +<f p="src/commentcoherence.h" together="3" recur="1" conf_core="0.00"/> +<f p="src/compactlegend.h" together="152" recur="3" conf_core="0.24"/> +<f p="src/contextratio.h" together="4" recur="1" conf_core="0.01"/> +<f p="src/countfloor.h" together="4" recur="2" conf_core="0.01"/> +<f p="src/crossref.h" together="25" recur="3" conf_core="0.04"/> +<f p="src/darkflags.h" together="9" recur="3" conf_core="0.01"/> +<f p="src/defectshape.h" together="4" recur="2" conf_core="0.01"/> +<f p="src/didyoumean.h" together="3" recur="1" conf_core="0.00"/> +<f p="src/dmm.h" together="4" recur="1" conf_core="0.01"/> +<f p="src/docparse.h" together="4" recur="1" conf_core="0.01"/> +<f p="src/editcheck.h" together="12" recur="3" conf_core="0.02"/> +<f p="src/editplan.h" together="9" recur="1" conf_core="0.01"/> +<f p="src/editpreview.h" together="6" recur="2" conf_core="0.01"/> +<f p="src/ensemble.h" together="7" recur="2" conf_core="0.01"/> +<f p="src/eval.h" together="3" recur="1" conf_core="0.00"/> +<f p="src/filter.h" together="4" recur="1" conf_core="0.01"/> +<f p="src/flipimpact.h" together="5" recur="3" conf_core="0.01"/> +<f p="src/gitcmd.h" together="3" recur="3" conf_core="0.00"/> +<f p="src/githarden.h" together="5" recur="2" conf_core="0.01"/> +<f p="src/gitmine.h" together="13" recur="3" conf_core="0.02"/> +<f p="src/graph.h" together="62" recur="3" conf_core="0.10"/> +<f p="src/graphlegend.h" together="63" recur="3" conf_core="0.10"/> +… [1005 more display lines; full output is 67750 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: 2.18s** + +````` +<!-- ripwire cochange schema=ripwire.cochange/v1: files that change together in git: <pair a= b= together= deg= conf_ab= conf_ba= surprising=>, or for of= <f p= together= conf_rev=>. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). at=: commit+dirty+shallow. root=: p= relative to it. pairs=N: file pairs with 3+ shared commits in window= (after min_recur), surprising or not. sub_windows=N: equal-commit-count slices of window=; the denominator of recur=. driver=a|b: the side whose changes best imply the other's, look there first; absent on a tie. recur=K: slices of sub_windows= the pair co-changed in; 1 = one burst, not a standing coupling. --> +<cochange schema="ripwire.cochange/v1" pairs="3652" window="18mo@HEAD" sub_windows="3" min_recur="2" shown="30" capped="1" total="3652" has_more="1" next_offset="30" offset="0" limit="0" root="." at="914c4045d"> +<pair a="test/headsnapcachecheck.sh" b="test/qsnapcachecheck.sh" together="5" deg="1.00" conf_ab="1.00" conf_ba="0.83" driver="a" recur="3" surprising="1"/> +<pair a="src/binstale.h" b="src/crossref.h" together="3" deg="1.00" conf_ab="1.00" conf_ba="0.03" driver="a" recur="2" surprising="1"/> +<pair a="bench/scip_match_diag.py" b="bench/scip_pin_precision.py" together="3" deg="1.00" conf_ab="1.00" conf_ba="0.60" driver="a" recur="2" surprising="1"/> +<pair a="test/cachesplitcheck.sh" b="test/portablecachecheck.sh" together="3" deg="1.00" conf_ab="0.75" conf_ba="1.00" driver="b" recur="3" surprising="1"/> +<pair a="test/mcpslicecheck.sh" b="test/mcpverbscheck.sh" together="3" deg="1.00" conf_ab="1.00" conf_ba="0.16" driver="a" recur="2" surprising="1"/> +<pair a="test/elixircheck.sh" b="test/elixirsemanticcheck.sh" together="3" deg="1.00" conf_ab="0.13" conf_ba="1.00" driver="b" recur="2" surprising="1"/> +<pair a="test/gatecountcheck.sh" b="test/manifestcheck.sh" together="3" deg="1.00" conf_ab="1.00" conf_ba="0.23" driver="a" recur="2" surprising="1"/> +<pair a="test/pincensuscheck.sh" b="test/scipjoincheck.sh" together="3" deg="1.00" conf_ab="0.38" conf_ba="1.00" driver="b" recur="2" surprising="1"/> +<pair a="test/luacheck.sh" b="test/phpcheck.sh" together="3" deg="1.00" conf_ab="0.75" conf_ba="1.00" driver="b" recur="2" surprising="1"/> +<pair a="test/gatecountcheck.sh" b="test/regression.sh" together="3" deg="1.00" conf_ab="1.00" conf_ba="0.00" driver="a" recur="2" surprising="1"/> +<pair a="src/cli.h" b="src/sarif.h" together="6" deg="0.86" conf_ab="0.01" conf_ba="0.86" driver="b" recur="2" surprising="1"/> +<pair a="src/abicheck.h" b="src/landingplan.h" together="6" deg="0.86" conf_ab="0.40" conf_ba="0.86" driver="b" recur="3" surprising="1"/> +<pair a="hooks/ripwire-claude-route.sh" b="hooks/ripwire-codex-route.sh" together="20" deg="0.83" conf_ab="0.83" conf_ba="0.83" recur="3" surprising="1"/> +<pair a="test/headsnapcachecheck.sh" b="test/qsnapprefetchcheck.sh" together="4" deg="0.80" conf_ab="0.80" conf_ba="0.67" driver="a" recur="2" surprising="1"/> +<pair a="test/anchorcheck.sh" b="test/routecheck.sh" together="15" deg="0.79" conf_ab="0.79" conf_ba="0.71" driver="a" recur="3" surprising="1"/> +<pair a="src/ingest_cache.h" b="src/quality.h" together="291" deg="0.78" conf_ab="0.78" conf_ba="0.44" driver="a" recur="3" surprising="1"/> +<pair a="hooks/ripwire-claude-route.sh" b="hooks/ripwire-claude-toolroute.sh" together="6" deg="0.75" conf_ab="0.25" conf_ba="0.75" driver="b" recur="2" surprising="1"/> +<pair a="test/tracecheck.sh" b="test/w3fixbudgetcheck.sh" together="3" deg="0.75" conf_ab="0.75" conf_ba="0.75" recur="2" surprising="1"/> +<pair a="test/estchargecheck.sh" b="test/tracecheck.sh" together="3" deg="0.75" conf_ab="0.04" conf_ba="0.75" driver="b" recur="2" surprising="1"/> +<pair a="test/dartcheck.sh" b="test/elixircheck.sh" together="3" deg="0.75" conf_ab="0.75" conf_ba="0.13" driver="a" recur="2" surprising="1"/> +<pair a="test/estchargecheck.sh" b="test/w3fixbudgetcheck.sh" together="3" deg="0.75" conf_ab="0.04" conf_ba="0.75" driver="b" recur="2" surprising="1"/> +<pair a="src/infra/diagnostics.cpp" b="test/diagnotice_harness.cpp" together="3" deg="0.75" conf_ab="0.30" conf_ba="0.75" driver="b" recur="2" surprising="1"/> +<pair a="test/cachesplitcheck.sh" b="test/evictioncheck.sh" together="3" deg="0.75" conf_ab="0.75" conf_ba="0.23" driver="a" recur="2" surprising="1"/> +<pair a="hooks/ripwire-claude-route.sh" b="test/routehookcheck.sh" together="14" deg="0.74" conf_ab="0.58" conf_ba="0.74" driver="b" recur="2" surprising="1"/> +<pair a="src/ingest_model.h" b="src/model.h" together="53" deg="0.74" conf_ab="0.74" conf_ba="0.16" driver="a" recur="3" surprising="1"/> +<pair a="src/quality.h" b="src/tsprobe.cpp" together="8" deg="0.73" conf_ab="0.01" conf_ba="0.73" driver="b" recur="3" surprising="1"/> +<pair a="src/commentcoherence.h" b="src/readability.h" together="5" deg="0.71" conf_ab="0.71" conf_ba="0.42" driver="a" recur="2" surprising="1"/> +<pair a="hooks/ripwire-codex-route.sh" b="test/codexpromptroutecheck.sh" together="7" deg="0.70" conf_ab="0.29" conf_ba="0.70" driver="b" recur="2" surprising="1"/> +<pair a="src/graph.h" b="src/ingest_ruby.h" together="7" deg="0.70" conf_ab="0.01" conf_ba="0.70" driver="b" recur="2" surprising="1"/> +<pair a="src/ingest_cache.h" b="src/ingest_ruby.h" together="7" deg="0.70" conf_ab="0.02" conf_ba="0.70" driver="b" recur="2" surprising="1"/> +</cochange> +````` + +## `./build/ripwire . --html=<scratch>/aux/map2.html --color-by=community` + +*The HTML graph with the initial colour mode set to community (the page embeds all five modes and keeps a live selector).* + +**wall time: 2.14s** + +````` +(empty) +````` + +Artifact written: + +````` + 155982 <scratch>/aux/map2.html +````` + +## `./build/ripwire . --index-out=<scratch>/aux/ci_index` + +*CI generate-and-exit: cold-parse and write BOTH committable cache families (lean + rich), no map on stdout.* + +**wall time: 6.76s** + +````` +(empty) +````` + +stderr: + +````` +ripwire: --index-out wrote <scratch>/aux/ci_index.lean.ripwirecache (40894532 bytes, lean family) +ripwire: --index-out wrote <scratch>/aux/ci_index.rich.ripwirecache (82404423 bytes, rich family) +````` + +Artifact written: + +````` + 40894532 <scratch>/aux/ci_index.lean.ripwirecache + 82404423 <scratch>/aux/ci_index.rich.ripwirecache + 123298955 total +````` + +## `./build/ripwire . --cache=<scratch>/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.85s** + +````` +<!-- ripwire map schema=ripwire.map/v1: ranked symbol map: <f p= layer=> groups <s t= n= sc= k= amb=> rows (k= rank), <c n=> resolved callees; the header comment is data. est_tokens=: price as emitted (an upper bound under compact). root=: p= relative to it. pr_iters=N: PageRank iterations. <inv listed= unlisted=>: files the ranked rows show / do not (sum = files=), each named or counted below. <entry p= n=>: 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. <ls p= n= f=>: 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 <c> 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. sc=: enclosing scope; the full id is p::sc::n (p= of the row or its <f>) and selectors take it. --> +<!-- t=modscope=a-file's-MODULE-SCOPE(n=<file-scope>):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 --> +<!-- t=type|alias|functype=a-Go-named-type-by-its-written-form:type=a-defined-type-whose-WRITTEN-form-is-not-a-struct/iface/func-literal(type-N-string;type-W-Pair-too,whatever-Pair-is-underneath),alias=type-A=B,functype=type-F-func(...) --> +<!-- t=alias|functype-in-C++-and-.h:alias=using-X=Y(also-templated-or-class-scope)or-namespace-L=lib(defs=X-prints-its-written-target-as-to=),functype=a-typedef-of-a-function-or-function-pointer-type(typedef-void(*F)(int));other-typedefs-read-t=struct --> +<!-- files=4852 symbols=45031 edges=45381 shown=3 est_tokens=4089 ambiguous=3984 unresolved=20100 locality_pinned=14 external=12460 declined=45307 extent_suspect_syms=12 macro_blanked_files=7 skipped_oversize=15 unindexed="txt:85,tsv:54,mod:33,xml:33,jsonl:26,scm:25" unindexed_exts=23 order=important-first --> +<r schema="ripwire.map/v1" root="." est_tokens="4089" pr_iters="37"> +<f p="src/infra/nodekind.h" layer="infra"> +<s t="fn" n="kindIs" sc="rw" k="0.0032"> +</s> +</f> +<f p="src/ingest_metrics.h"> +<s t="fn" n="nodeTextOf" k="0.0021"> +</s> +</f> +<f p="src/infra/namesplit.h" layer="infra"> +<s t="fn" n="isIdentChar" sc="namesplit" k="0.0020"> +</s> +</f> +<inv listed="3" unlisted="4849"> +<entry p="scripts/changelog_assemble.py" n="main"> +<c n="repoRoot"/> +<c n="fragmentNames"/> +<c n="check"/> +<c n="assembledEntries"/> +<c n="release"/> +</entry> +<entry p="scripts/merge_resolve.py" n="main"> +<c n="generator_constants"/> +<c n="git"/> +<c n="parse"/> +… [82 more display lines; full output is 10210 bytes on 1 raw line(s)] +````` + +## `./build/ripwire . --pin-census=<scratch>/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.87s** + +````` +<!-- ripwire map schema=ripwire.map/v1: ranked symbol map: <f p= layer=> groups <s t= n= sc= k= amb=> rows (k= rank), <c n=> resolved callees; the header comment is data. est_tokens=: price as emitted (an upper bound under compact). root=: p= relative to it. pr_iters=N: PageRank iterations. <inv listed= unlisted=>: files the ranked rows show / do not (sum = files=), each named or counted below. <entry p= n=>: 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. <ls p= n= f=>: 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 <c> 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. sc=: enclosing scope; the full id is p::sc::n (p= of the row or its <f>) and selectors take it. --> +<!-- t=modscope=a-file's-MODULE-SCOPE(n=<file-scope>):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 --> +<!-- t=type|alias|functype=a-Go-named-type-by-its-written-form:type=a-defined-type-whose-WRITTEN-form-is-not-a-struct/iface/func-literal(type-N-string;type-W-Pair-too,whatever-Pair-is-underneath),alias=type-A=B,functype=type-F-func(...) --> +<!-- t=alias|functype-in-C++-and-.h:alias=using-X=Y(also-templated-or-class-scope)or-namespace-L=lib(defs=X-prints-its-written-target-as-to=),functype=a-typedef-of-a-function-or-function-pointer-type(typedef-void(*F)(int));other-typedefs-read-t=struct --> +<!-- files=4852 symbols=45031 edges=45381 shown=3 est_tokens=4089 ambiguous=3984 unresolved=20100 locality_pinned=14 external=12460 declined=45307 extent_suspect_syms=12 macro_blanked_files=7 skipped_oversize=15 unindexed="txt:85,tsv:54,mod:33,xml:33,jsonl:26,scm:25" unindexed_exts=23 order=important-first --> +<r schema="ripwire.map/v1" root="." est_tokens="4089" pr_iters="37"> +<f p="src/infra/nodekind.h" layer="infra"> +<s t="fn" n="kindIs" sc="rw" k="0.0032"> +</s> +</f> +<f p="src/ingest_metrics.h"> +<s t="fn" n="nodeTextOf" k="0.0021"> +</s> +</f> +<f p="src/infra/namesplit.h" layer="infra"> +<s t="fn" n="isIdentChar" sc="namesplit" k="0.0020"> +</s> +</f> +<inv listed="3" unlisted="4849"> +<entry p="scripts/changelog_assemble.py" n="main"> +<c n="repoRoot"/> +<c n="fragmentNames"/> +<c n="check"/> +<c n="assembledEntries"/> +<c n="release"/> +</entry> +<entry p="scripts/merge_resolve.py" n="main"> +<c n="generator_constants"/> +<c n="git"/> +<c n="parse"/> +… [82 more display lines; full output is 10210 bytes on 1 raw line(s)] +````` + +Artifact written: + +````` +# ripwire pin-census v3 C=kind\tmech\tpre\tpost\tflags\tcaller_id\tcallee\ttargets(|-sep)\tline +# v3 field escape: every id and callee field is escaped, so no separator occurs inside one. A backslash is +# written \\, TAB \t, LF \n, CR \r, every other control byte 0x00-0x1f and the targets separator | as \xHH +# (lowercase hex). Split lines on LF, fields on TAB and targets on |, THEN decode. Columns are unchanged +# from v2 and an id without those bytes is spelled exactly as in v2; a C++ out-of-line template member +# 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. + 182389 <scratch>/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: 2.03s** + +````` +<!-- ripwire plan-lint schema=ripwire.plan-lint/v1: structural lint of a plan document: each finding names the section and the rule. at=: commit+dirty+shallow. file=/dialect=: the plan read and whether the PLAN dialect was detected (dialect=0: nothing to lint). cards=/ledger=: card rows found / whether the doc carries a ledger (ledger_line= names its line). git=1: git was available, so the staleness read ran; stale_commits=N: a waiting card N commits behind HEAD is stale. gating=N: findings that fail the plan (exit 2); the rest are advisory. --> +<plan-lint schema="ripwire.plan-lint/v1" file="test/planlintfix/wave.md" dialect="1" cards="3" ledger="1" ledger_line="21" at="914c4045d" git="1" stale_commits="20" gating="3"> +<card id="T1" line="10" status="check" tline="12"/> +<card id="T2" line="14" status="cross" tline="16"/> +<card id="T5" line="18" status="missing" tline="19" why="unlaunched" gating="1"/> +<ledger-orphan id="T9" line="24" gating="1"/> +<owed line="22"> +<![CDATA[- 2026-08-01 — T2 owed a re-check]]> +</owed> +<owed line="24" gating="1"> +<![CDATA[- 2026-08-03 — T9 owed a kickoff review, still pending]]> +</owed> +</plan-lint> +````` + +## `./build/ripwire . --plan-lint=test/planlintfix/wave_ledger.md` + +*The ledger-shaped fixture through the same check (exit 2: one gating card).* + +**exit code: 2** — **wall time: 1.55s** + +````` +<!-- ripwire plan-lint schema=ripwire.plan-lint/v1: structural lint of a plan document: each finding names the section and the rule. at=: commit+dirty+shallow. file=/dialect=: the plan read and whether the PLAN dialect was detected (dialect=0: nothing to lint). cards=/ledger=: card rows found / whether the doc carries a ledger (ledger_line= names its line). git=1: git was available, so the staleness read ran; stale_commits=N: a waiting card N commits behind HEAD is stale. gating=N: findings that fail the plan (exit 2); the rest are advisory. --> +<plan-lint schema="ripwire.plan-lint/v1" file="test/planlintfix/wave_ledger.md" dialect="1" cards="4" ledger="1" ledger_line="17" at="914c4045d" git="1" stale_commits="20" gating="1"> +<card id="T1" line="4" status="check" tline="6"/> +<card id="T2" line="8" status="check" tline="18" src="ledger"/> +<card id="T5" line="11" status="missing" tline="12" why="unlaunched" gating="1"/> +<card id="T7" line="14" status="check" tline="20" src="ledger"/> +</plan-lint> +````` + +## `./build/ripwire . --doctor --agent=claude` + +*--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.65s** + +````` +<!-- ripwire doctor schema=ripwire.doctor/v1: setup health: <c n= ok=> checks; exit 1 when one fails. at=: commit+dirty+shallow. n=: the check's name (binary-path, grammars, cache-dir, git, tree-sitter, index-cache, layout ...). agent=: the agent named by the agent flag; its live-integration c rows follow the built-in checks. loaded=/expected=: grammars whose tags query compiled / grammars compiled in; a shortfall fails the row. dir=: the per-user cache directory scanned (TMPDIR/XDG_CACHE_HOME ladder); unwritable fails the row. blobs=N: ripwire cache blobs in dir=; the scan stops at 4096 (blobs_floor=1 then). bytes=N: total size in bytes of the blobs counted (short when truncated=1). many=1: more than 50 blobs; an eviction-sanity flag, informational, never fails the row. truncated=1: cache-dir, blob scan cut (cap or I/O error); tracked-binaries, scan SKIPPED, stale=0 unmeasured. locks=N: advisory edit-lock files under locks/; unheld ones over a day old are swept on a cache write. volatile=: this row's attributes that read LIVE machine state; a determinism diff strips them, never the row. git=0|1: git runs from PATH; 0 fails the row (churn verbs need it). repo=0|1: the root is inside a git work tree; 0 is a diagnosis, not a failure. history=0|1: the repo has at least one commit; head= prints only when it does. head=: HEAD's short sha (9 hex, the at= width). core_abi=/cpp_grammar_abi=: tree-sitter core language ABI / the C++ grammar's ABI; informational. languages=N: distinct compiled-in grammars (the grammars row's expected=). tracked=N: git ls-files count, printed even when truncated=1 (over 20000 files skips the scan). binaries=N: tracked paths that sniff as binary content. non_git=1: no git history to compare; the row passes unscanned. stale=N: tracked binaries committed before a same-dir same-stem source changed; any fails the row. cache_version=/parser_ver_lean=/parser_ver_rich=/artifact_arch=: index identity; reuse needs all four. rich_verbs=: the verbs that consume the rich artifact (rich=); every other verb reads the lean one. source=: auto (per-root blob), cache-flag (named by the cache flag) or disabled (no-cache: nothing read). lean_path=/rich_path=: the artifact files checked; one path when the cache flag named it. lean=/rich=: can THIS binary open that artifact (ok, absent, parser-version ...); format, never freshness. fsmonitor=: the checkout's core.fsmonitor at startup: unset, builtin, off, or hook (a command git runs). neutralised=1: a hook fsmonitor was overridden to false for this run; 0 when none was needed. filter_drivers=N: filter drivers the repository's own config defines; filter_scope= local|all, filter_pinned= 1 (run with an empty command) or refused. state=: layout records agree, disagree (mixed binary: rebuild clean-first), not-checked or no-records. checked=1: the cross-unit layout comparison ran; 0 = under two comparable records. units=N: translation units that registered a layout record. types=N: layout types recorded (only those registered in src/model.h); omitted on state=disagree. checks=/passed=: checks run / how many passed; exit 1 when passed= is below checks=. built_from=: the commit this binary was built from; at= is the tree HEAD now, a mismatch is normal. self=/which=: this binary's path and the one which ripwire finds on PATH; which_version= is the version line that one prints when they differ. on_path=0|1: whether a ripwire is on PATH; 0 fails the row and hint= carries the export line. same_file=1: the PATH copy is this very file (same device and inode). same_bytes=1: a different file with identical content, a copied install (ok); 0 fails the row; unknown: a file was unreadable; the row fails unverified (hint= names it). self_mtime=/self_size=/which_mtime=/which_size=: epoch mtime and byte size of each binary. hint=: the row's verdict and fix in plain text (which binary is stale, what to run). --> +<doctor schema="ripwire.doctor/v1" checks="12" passed="10" agent="claude" at="914c4045d" built_from="914c4045d"> +<c n="binary-path" ok="0" self="./build/ripwire" which="<path>" on_path="1" same_file="0" same_bytes="0" self_mtime="1795336538" self_size="65732168" which_mtime="1793517843" which_size="58197960" which_version="ripw … [line truncated: 525 more bytes on this line] +<c n="grammars" ok="1" loaded="27" expected="27"/> +<c n="cache-dir" ok="1" dir="<tmp>" blobs="234" bytes="2071316293" many="1" truncated="0" locks="225" volatile="blobs,blobs_floor,bytes,many,truncated,locks"/> +<c n="git" ok="1" git="1" repo="1" history="1" head="914c4045d"/> +<c n="tree-sitter" ok="1" core_abi="15" cpp_grammar_abi="14" languages="27"/> +<c n="tracked-binaries" ok="1" tracked="5597" binaries="33" non_git="0" truncated="0" stale="0"/> +<c n="index-cache" ok="1" cache_version="54" parser_ver_lean="337" parser_ver_rich="338" artifact_arch="16" rich_verbs="for,uses,metrics,exemplar,context-ratio,nonlocal-state,quality-panel,verify,eval-retrieval,eval-mined,eval-skills" source="auto" lean_path="<tmp> … [line truncated: 219 more bytes on this line] +<c n="git-config-trust" ok="1" fsmonitor="unset" neutralised="0" filter_drivers="0"/> +<c n="layout" ok="1" state="agree" checked="1" units="2" types="12"/> +<c n="claude-binary" ok="0" on_path="1" same_file="0" copied_heuristic="0" hint="reinstall the current build so Claude Code shell calls and this doctor resolve the same ripwire binary"/> +<c n="claude-skills" ok="1" manifest="1" declared="16" live="16"/> +<c n="claude-hooks" ok="1" configured="1" nudge_refs="2" route_hook="1"/> +</doctor> +````` + +## `./build/ripwire . --doctor --agent=nosuch` + +*Other --agent values refuse.* + +**exit code: 1** + +````` +(empty) +````` + +stderr: + +````` +ripwire: unsupported --agent value 'nosuch' (supported: codex, claude) +````` + + +--- + +# the dirty-tree verbs (throwaway clone, NOT the read-only repo) + +Everything below runs with `cwd` = the throwaway clone at `<scratch>/dirty` (`git clone --local` of this repo, then one deliberate regression in `src/infra/sortutil.h`). The read-only repo is never touched. The binary is the same `build/ripwire`, addressed absolutely. + +## `./build/ripwire . --situ` + +*Situational report for a real diff: blast radius + tests + co-change + forgotten co-change partners.* + +**wall time: 10.22s** + +````` +ripwire situational-awareness — 1 changed file(s), 14 symbols in them +root: . +at: 914c4045d+dirty + change_set: granularity=file changed_symbols=14 file_symbols=14 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: 1049 symbols across 148 files transitively depend on these changes (showing 8 of 148 files — shown=8 total=148 capped=1 prcontext_cap=20 (--pr-context's own per-file list is cut at 20 too); next: --situ --limit=148) + counts_floor=1 graph_ambiguous=3984 graph_unresolved=20100 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/graph.h (62 dependent symbols) + src/quality.h (44 dependent symbols) + src/mcpverbs.h (41 dependent symbols) + src/verbs_for.h (33 dependent symbols) + src/backhops.h (31 dependent symbols) + src/slice.h (31 dependent symbols) + src/verbs_quality.h (29 dependent symbols) + src/resolve.h (27 dependent symbols) + [2] tests to run (12) 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: + test/verify_radix.cpp [hops=1] (run: bash test/greptiercheck.sh) + test/adaptivecutshapefix/adaptive_cut_shape_test.cpp [hops=2] (run: bash test/adaptivecutshapecheck.sh) + test/connectcore_harness.cpp [hops=2] (run: bash test/connectcorecheck.sh) + test/forrowfeatures_unit.cpp [hops=2] (run: bash test/forrowfeaturescheck.sh) + test/fuzz/readers/readers_domain.cpp [hops=2] (run: not derivable) + test/verify_csr.cpp [hops=2] (run: bash test/a9disclosurecheck.sh) + test/cloneband_harness.cpp [hops=3] (run: bash test/clonebandcheck.sh) + test/shstatus_harness.cpp [hops=3] (run: bash test/gateexitcheck.sh) + test/type3clone_harness.cpp [hops=3] (run: bash test/type3clonecheck.sh) + test/includeprecise_unit.cpp [hops=4] (run: bash test/includeprecisecheck.sh) + test/rustimport_unit.cpp [hops=4] (run: bash test/rustimportprecisecheck.sh) + test/fuzz/readers/readers_light.cpp [hops=5] (run: not derivable) + script_gates_unmodelled=952 — 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="8003": + (none — 8003 commits were mined and none co-edited a file outside your diff) + next: --test-gate +````` + +## `./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: 13.28s** + +````` +<!-- ripwire test-gate schema=ripwire.test-gate/v1: tests <t p= changed= partner= hops= run=> + untested blast radius <u sym= p= l= ccx=>; exit 4 while either exists. window: total= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). tests_capped=/untested_capped=: 1 = cut. counts_floor=1: every count is a FLOOR, never a total. graph_ambiguous=/graph_unresolved=: resolver gauge. graph_unindexed=N: N files no grammar could read (the map header's unindexed=); their calls raise neither gauge. declined_calls=K: K call sites left unbound (no evidence chose one def), in no count or row. run_unknown=1: no runner derivable (a guess would be worse). at=: commit+dirty+shallow. root=: p= relative to it. next=: the one pasteable follow-up. impacted=N: symbols that transitively call the change (changed symbols excluded). shown_tests=/shown_untested=: t rows and u rows printed, two independent counts. script_gates_unmodelled=N: test/*.sh runners in the corpus, a path count; not call-graph modelled. run_first=N: the first N t rows have the most direct evidence (changed/partner/hops=1, else nearest hops=); not a skip list. script_gates_registered=N: shell gates test/regression.sh registers as suite members. script_gates_mapped=N: registered gates with exact dependency evidence (literal paths or RIPWIRE_TEST_DEPS). script_gates_unresolved_dynamic=N: registered gates with no mappable deps; they may cover the change unlisted. ccx_bar=N: the cognitive-complexity bar a u row's ccx= is read against. change_granularity=: how the change set seeded — symbol = only symbols a git hunk (diff -U0 vs HEAD) locates inside a function/method body; file = whole changed files (an unlocated hunk — module-level, deletion, rename — returns its file to file-granular); mixed = both. changed_symbols=/file_symbols=: the seeds the walk used vs all symbols of the changed files. files_narrowed=/files_file_granular=: changed files under each treatment. diff_hunks=/diff_hunks_located=/diff_hunks_unlocated=: the hunk tally; an unlocated hunk is WHY a file went file-granular. untested_modscope=N: <file-scope> owners excluded from untested= (#324, uncallable); still in impacted=. tests=/untested=: tests to run (t total) / impacted symbols no test reaches (u total). --> +<test-gate schema="ripwire.test-gate/v1" changed="1" impacted="1049" tests="12" untested="846" untested_modscope="1" shown_tests="12" tests_capped="0" shown_untested="25" untested_capped="1" script_gates_unmodelled="952" script_gates_registered="886" script_gates_mapped="292" script_gates_unresolved … [line truncated: 447 more bytes on this line] +<t p="test/verify_radix.cpp" hops="1" run="bash test/greptiercheck.sh"/> +<t p="test/adaptivecutshapefix/adaptive_cut_shape_test.cpp" hops="2" run="bash test/adaptivecutshapecheck.sh"/> +<t p="test/connectcore_harness.cpp" hops="2" run="bash test/connectcorecheck.sh"/> +<t p="test/forrowfeatures_unit.cpp" hops="2" run="bash test/forrowfeaturescheck.sh"/> +<t p="test/fuzz/readers/readers_domain.cpp" hops="2" run_unknown="1"/> +<t p="test/verify_csr.cpp" hops="2" run="bash test/a9disclosurecheck.sh"/> +<t p="test/cloneband_harness.cpp" hops="3" run="bash test/clonebandcheck.sh"/> +<t p="test/shstatus_harness.cpp" hops="3" run="bash test/gateexitcheck.sh"/> +<t p="test/type3clone_harness.cpp" hops="3" run="bash test/type3clonecheck.sh"/> +<t p="test/includeprecise_unit.cpp" hops="4" run="bash test/includeprecisecheck.sh"/> +<t p="test/rustimport_unit.cpp" hops="4" run="bash test/rustimportprecisecheck.sh"/> +<t p="test/fuzz/readers/readers_light.cpp" hops="5" run_unknown="1"/> +<u sym="dispatchMcpLine" p="src/mcp.h" l="1151" ccx="794"/> +<u sym="runForLensPass" p="src/verbs_for.h" l="3606" ccx="706"/> +<u sym="dispatchMainBody" p="src/main.cpp" l="4711" ccx="513"/> +<u sym="computeDelta" p="src/quality.h" l="12009" ccx="318"/> +<u sym="runDefaultMap" p="src/main.cpp" l="1759" ccx="313"/> +<u sym="renderForLiteral" p="src/forliteral.h" l="4210" ccx="277"/> +<u sym="runStructureText" p="src/verbs_report.h" l="3358" ccx="270"/> +<u sym="runMaintenanceViews" p="src/verbs_report.h" l="1359" ccx="242"/> +<u sym="packSignatures" p="src/serialize.h" l="6525" ccx="235"/> +<u sym="packTaskBundleText" p="src/packtask.h" l="1448" ccx="226"/> +<u sym="astQueryGrouped" p="src/ingest_astquery.h" l="842" ccx="214"/> +<u sym="writePrContext" p="src/prcontext.h" l="1078" ccx="176"/> +<u sym="runChangeViews" p="src/verbs_change.h" l="245" ccx="163"/> +<u sym="runZoom" p="src/verbs_report.h" l="3027" ccx="160"/> +<u sym="renderForAliasHops" p="src/foraliashop.h" l="125" ccx="154"/> +<u sym="runVerify" p="src/verbs_navigate.h" l="2297" ccx="144"/> +<u sym="runBatchSub" p="src/mcpverbs.h" l="6335" ccx="142"/> +<u sym="pathBridge" p="src/pathgaps.h" l="1262" ccx="139"/> +<u sym="spliceSlotJoinRows" p="src/forslots.h" l="323" ccx="137"/> +<u sym="runArchViews" p="src/verbs_report.h" l="503" ccx="130"/> +<u sym="pathNearSink" p="src/pathgaps.h" l="778" ccx="127"/> +<u sym="packLego" p="src/serialize.h" l="10634" ccx="124"/> +<u sym="runQualityViews" p="src/verbs_quality.h" l="4027" ccx="122"/> +<u sym="packConnect" p="src/mcpverbs.h" l="4388" ccx="118"/> +<u sym="hopFacts" p="src/hoprecord.h" l="515" ccx="113"/> +</test-gate> +````` + +## `./build/ripwire . --quality-delta` + +*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: 51.91s** + +````` +<!-- ripwire quality-delta schema=ripwire.quality-delta/v1: only what the change made WORSE vs baseline=: regressions= minor= gating=; <r kind= sym= p= was= now= gating= bar=>, <sa> acked. value-ref-excluded=N: internal functions kept off because a table, field or argument in another function or at file scope holds them (matched by name, not a proven call); a floor. at=: commit+dirty+shallow. next=: the one pasteable follow-up. stale=N: ack ledger rows whose target no longer applies (sa rows); never gating. preexisting-worse=N: regressions on symbols that existed at baseline; they gate when major. new-symbol=N: NEW code; new-symbol rows never gate, except defect-shape format-arity, ceiling=, tangle. register-macro-excluded=N: symbols skipped: self-registering test/bench macros or Rust #[test]; a floor. declined-call-excluded=N: symbols kept out of dead-code only because a declined call may mean them; a floor. api-new-surface=N: new PUBLIC symbols; a count, never gates, not in regressions=. renames=/rename_window_commits=: git rename pairs read over that many commits, to re-file baseline and acks. acked_by_rename=/acked_by_content=: acked= suppressions matched via git renames / an equal body hash. renames_window_truncated=1: history is deeper than the rename window, older renames unread. r surface=: the api-surface tier, new-symbol or contract-change. acked=N: findings suppressed by the ack ledger, listed as sa rows; never gating. r sev=minor: a small numeric delta, counted in minor=, never gating (absent: major). r origin=new-symbol: a finding on NEW code; moved: its body left another name or file, never gating (absent: preexisting-worse). sa key=/why=: the stale ack's ledger hash / target-gone (names nothing now) or finding-gone (no longer fires). r members=/tokens=: a duplication row's clone group (member ids) / their shared normalized-token count. --> +<quality-delta schema="ripwire.quality-delta/v1" baseline="git-HEAD" regressions="9" minor="1" acked="0" stale="202" preexisting-worse="6" new-symbol="3" gating="5" register-macro-excluded="63" api-new-surface="2" at="914c4045d+dirty" renames="68" rename_window_commits="400" acked_by_rename="0" acke … [line truncated: 99 more bytes on this line] +<r kind="api-surface" sym="src/infra/sortutil.h::rw::sortutil::nonNegativeFloatDescKey" was="1" now="2" surface="contract-change" p="src/infra/sortutil.h:122" gating="1" next="--expand=src/infra/sortutil.h:nonNegativeFloatDescKey"/> +<r kind="complexity" sym="src/infra/sortutil.h::rw::sortutil::lessByScoreDescId" was="1" now="67" bar="15" p="src/infra/sortutil.h:62" gating="1" next="--expand=src/infra/sortutil.h:lessByScoreDescId"/> +<r kind="dead-code" sym="src/infra/sortutil.h::rw::sortutil::nonNegativeFloatAscKeyCopy" origin="new-symbol" p="src/infra/sortutil.h:132"/> +<r kind="dead-code" sym="src/infra/sortutil.h::rw::sortutil::sortScoredIdsWithOptions" origin="new-symbol" p="src/infra/sortutil.h:142"/> +<r kind="duplication" members="src/infra/sortutil.h::rw::sortutil::nonNegativeFloatAscKeyCopy | src/infra/sortutil.h::rw::sortutil::nonNegativeFloatDescKey" tokens="59" p="src/infra/sortutil.h:132" gating="1"/> +<r kind="nesting" sym="src/infra/sortutil.h::rw::sortutil::lessByScoreDescId" was="1" now="6" bar="4" p="src/infra/sortutil.h:62" gating="1" next="--expand=src/infra/sortutil.h:lessByScoreDescId"/> +<r kind="new-clone-of-reused-helper" sym="src/infra/sortutil.h::rw::sortutil::nonNegativeFloatAscKeyCopy | src/infra/sortutil.h::rw::sortutil::nonNegativeFloatDescKey" was="0" now="4" p="src/infra/sortutil.h:132" gating="1" next="--expand=src/infra/sortutil.h:nonNegativeFloatDescKey"/> +<r kind="params" sym="src/infra/sortutil.h::rw::sortutil::sortScoredIdsWithOptions" was="0" now="8" bar="5" origin="new-symbol" p="src/infra/sortutil.h:142"/> +<r kind="verbosity" sym="src/infra/sortutil.h::rw::sortutil::lessByScoreDescId" was="8" now="47" bar="60" sev="minor" p="src/infra/sortutil.h:62"/> +<sa kind="api-surface" key="085e3d408c2c4a35" why="target-gone"/> +<sa kind="api-surface" key="155d74d341a49f3c" why="target-gone"/> +<sa kind="api-surface" key="1a15386c2d1e47af" why="target-gone"/> +<sa kind="api-surface" key="298e798c7f075715" why="target-gone"/> +<sa kind="api-surface" key="56acdf9b5c314a14" why="target-gone"/> +<sa kind="api-surface" key="5a07390012b46e06" why="target-gone"/> +<sa kind="api-surface" key="6eef859578c8c376" why="target-gone"/> +<sa kind="api-surface" key="6f2394762f82a855" why="target-gone"/> +<sa kind="api-surface" key="7f2c3eefdf6e512e" why="target-gone"/> +<sa kind="api-surface" key="802e513731103806" why="target-gone"/> +<sa kind="api-surface" key="b6a24afef32a68a8" why="target-gone"/> +<sa kind="api-surface" key="c923e661c197b265" why="target-gone"/> +<sa kind="api-surface:new-symbol" key="1926b0d9e94541a0" why="target-gone"/> +<sa kind="api-surface:new-symbol" key="1d3814ba687a4aef" why="target-gone"/> +<sa kind="api-surface:new-symbol" key="1db76028879244ef" why="target-gone"/> +<sa kind="api-surface:new-symbol" key="25c9f0504fd376a4" why="target-gone"/> +<sa kind="api-surface:new-symbol" key="26aa7c55d54c4341" why="target-gone"/> +<sa kind="api-surface:new-symbol" key="26e3f9a6bff9ea57" why="target-gone"/> +<sa kind="api-surface:new-symbol" key="36e39c7ab0fc1686" why="target-gone"/> +… [184 more display lines; full output is 21712 bytes on 1 raw line(s)] +````` + +stderr: + +````` +ripwire: no ./.ripwire_quality_baseline — auto-comparing the working tree vs git HEAD (commit the baseline with --quality-baseline to pin it) +ripwire: --quality-delta gating: 5 preexisting-worse major finding(s); first: api-surface src/infra/sortutil.h::rw::sortutil::nonNegativeFloatDescKey at src/infra/sortutil.h:122 (was=1 now=2) +````` + +## `./build/ripwire . --quality-delta --legend=full` + +*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: 15.75s** + +````` +<!-- ripwire quality-delta: only what a change made WORSE against the floor baseline= names below. Descriptive: weigh and fix the real ones, do not game the number (a wrong abstraction beats a low score). THIRTEEN KINDS, and kind= on every row names which one: complexity over the ccx bar, verbosity (LOC), nesting, params, duplication, dead-code, api-surface (new public contract drift), error-masking, short-horizon-churn, new-clone-of-reused-helper, placeholder (added stub/TODO), defect-shape (defect= names it), tangle (a long function's nesting, deep share and steering locals). THREE independent axes, in this order: (1) acked findings are suppressed entirely (acked= counts them); (2) ORIGIN — a finding on a symbol that EXISTED at the baseline is preexisting-worse (no origin attribute), one that exists only because the code is NEW carries origin="new-symbol"; (3) MATERIALITY — a small numeric delta is sev="minor", and minor= counts them. EXIT 2 fires only on preexisting-worse AND major, the gating= count; new-symbol rows never gate, except defect-shape format-arity, a new function at the ceiling and a tangled new function, so exit 0 is NOT a verdict on them — nothing that existed got worse, but the new debt is yours: read them. Clone kinds are new-symbol only when EVERY member is new; short-horizon-churn is preexisting by construction. preexisting-worse= and new-symbol= partition regressions=. stale= is a FOURTH axis, never gating and never counted in regressions=: rows in the .ripwire_quality_acks ledger whose target no longer applies. api-new-surface= COUNTS the new PUBLIC symbols (never gates, not in regressions=, printed even at zero). register-macro-excluded= is a FLOOR, not a finding: symbols this run excluded from the dead-code kind because their own definition is a registered self-registering test/benchmark macro call. Never gates, never counted in regressions=, printed even at zero (zero: none excluded, not a skipped check). A gating row's next= is the one pasteable follow-up: expand on FILE:NAME, the body to fix (a duplication row names a SET and carries none). bar= on a complexity/verbosity/nesting/params row is the threshold now= is judged against (ccx 15, loc 60, nest 4, params 5). baseline="git-HEAD" means no sidecar existed, so the working tree was auto-compared against the HEAD tree — anything already committed cannot appear. at= is the git commit (plus a dirty marker when the working tree differs) this list was computed at. The registered families are doctest/Catch2 TEST_CASE, GoogleTest TEST/TEST_F/TEST_P, Google Benchmark BENCHMARK, plus any name a .ripwire_config register_macros= line adds; each registers itself through a static initializer the call graph cannot see, so zero in-edges on one is not evidence of anything. Rust #[test] and #[tokio::test] functions count too: the test harness calls them, and no call in the tree names them. declined-call-excluded= is a FLOOR, not a finding: symbols this run kept out of the dead-code kind only because a call the resolver declined to bind (the map's declined=) could have meant them. Never gates; absent at zero. value-ref-excluded= is a FLOOR, not a finding: symbols this run kept out of the dead-code kind only because a table, field, argument or registering decorator holds them as a VALUE (matched by name; it is not a proven call; the callers verb lists the sites; @classmethod-style wrappers do not count), the --dead-code verb's own rule. Never gates; absent at zero. IDENTITY across a rename or a move: a finding is keyed path::scope::name, which a rename would destroy, so the baseline and the .ripwire_quality_acks ledger are both re-filed into the CURRENT tree's identity before either is read, by two EXACT mechanisms — git's own rename record, and equality of a whitespace-and-name-scrubbed body hash — never a similarity heuristic. renames= is how many rename pairs were read (with no ledger, only the uncommitted renames or the A..B range, and the family appears only when one was read), rename_window_commits= how deep the commit window went, acked_by_rename= and acked_by_content= how many of the acked= suppressions each mechanism is responsible for. Three appear ONLY when true, so an absent one is not a silent no: renames_window_truncated= (history is deeper than the window), renames_truncated= (the pair cap was hit), renames_ambiguous= (an ancestor two current symbols both claim — refused rather than guessed). ORIGIN reads the re-filed baseline too, so a regression carried in with a rename is judged preexisting-worse and GATES instead of slipping through as new-symbol. FLOORS, stated because silence here would read as a guarantee: the two clone kinds key on a member-SET hash and are NOT re-filed, so a clone ack still dies on a rename (a clone group itself is held across a file rename git recorded); ORIGIN follows the rename record and an unchanged body (whitespace and its own name aside): a function keeps its identity across a rename or move git recorded no rename for when its body did not change; one whose body also changed reads as new-symbol, or as moved (never gating) when it is over a bar and nearly unchanged. Each sa row carries key= (the ack identity as stored) and why=, which is target-gone (the key names no symbol or group any more) or finding-gone (the target survived, this kind just does not fire on it). sym= and p=path:line name WHICH ack it is, and are present exactly when the key still names a live symbol: on every finding-gone row, on none of the target-gone rows (there is nothing left to name), and on neither clone kind — a clone key hashes a member SET that no single symbol carries, so those rows are unnameable by construction rather than guessed at. Hygiene disclosure only — the ledger file is never auto-edited. ROWS: sym= is the canonical id the finding regressed on; was= and now= carry the before/after value for the numeric kinds; p="path:line" is the locator (root-relative; the first-sorting member for the clone kinds; omitted, never faked, when none resolves). churn= and surface= are per-kind classification facets (short-horizon-churn's self/ambient split; api-surface's new-symbol/contract-change tier). churn= facets never gate alone: the kind gates only on 2+ COMMITTED in-window rewrites of the edited lines. Every row the header's gating= counter counts also carries a gating attribute set to 1 — marked positively, never by the ABSENCE of sev or origin. CLONE ROWS name the whole group rather than one symbol: members= is the member list and tokens= its shared normalized-token count (the same per-group pair the clones verb reports). idiom= names a RECOGNIZED BODY SHAPE every member spells, from a closed set of five (threshold-ladder, switch-name-table, builder-chain, one-statement, call-sequence). idiom= alone changes nothing; a group that ALSO shares no non-keyword identifier between any two members, sits in pairwise-distinct enclosing contexts, and stays under 80 normalized tokens is an idiom COLLISION rather than a copy, and is reported minor instead of gating. Break any one of those and it gates as before, idiom= and all: two bucketing ladders over the SAME enum are a copy. The shape is read off the body's token stream and not a parse tree, so a macro-assembled body classifies as whatever its raw tokens spell — the name is printed so a reader can overrule it. --> +<quality-delta baseline="git-HEAD" regressions="9" minor="1" acked="0" stale="202" preexisting-worse="6" new-symbol="3" gating="5" register-macro-excluded="63" api-new-surface="2" at="914c4045d+dirty" renames="68" rename_window_commits="400" acked_by_rename="0" acked_by_content="0" renames_window_tr … [line truncated: 65 more bytes on this line] +<r kind="api-surface" sym="src/infra/sortutil.h::rw::sortutil::nonNegativeFloatDescKey" was="1" now="2" surface="contract-change" p="src/infra/sortutil.h:122" gating="1" next="--expand=src/infra/sortutil.h:nonNegativeFloatDescKey"/> +<r kind="complexity" sym="src/infra/sortutil.h::rw::sortutil::lessByScoreDescId" was="1" now="67" bar="15" p="src/infra/sortutil.h:62" gating="1" next="--expand=src/infra/sortutil.h:lessByScoreDescId"/> +<r kind="dead-code" sym="src/infra/sortutil.h::rw::sortutil::nonNegativeFloatAscKeyCopy" origin="new-symbol" p="src/infra/sortutil.h:132"/> +<r kind="dead-code" sym="src/infra/sortutil.h::rw::sortutil::sortScoredIdsWithOptions" origin="new-symbol" p="src/infra/sortutil.h:142"/> +<r kind="duplication" members="src/infra/sortutil.h::rw::sortutil::nonNegativeFloatAscKeyCopy | src/infra/sortutil.h::rw::sortutil::nonNegativeFloatDescKey" tokens="59" p="src/infra/sortutil.h:132" gating="1"/> +<r kind="nesting" sym="src/infra/sortutil.h::rw::sortutil::lessByScoreDescId" was="1" now="6" bar="4" p="src/infra/sortutil.h:62" gating="1" next="--expand=src/infra/sortutil.h:lessByScoreDescId"/> +<r kind="new-clone-of-reused-helper" sym="src/infra/sortutil.h::rw::sortutil::nonNegativeFloatAscKeyCopy | src/infra/sortutil.h::rw::sortutil::nonNegativeFloatDescKey" was="0" now="4" p="src/infra/sortutil.h:132" gating="1" next="--expand=src/infra/sortutil.h:nonNegativeFloatDescKey"/> +<r kind="params" sym="src/infra/sortutil.h::rw::sortutil::sortScoredIdsWithOptions" was="0" now="8" bar="5" origin="new-symbol" p="src/infra/sortutil.h:142"/> +<r kind="verbosity" sym="src/infra/sortutil.h::rw::sortutil::lessByScoreDescId" was="8" now="47" bar="60" sev="minor" p="src/infra/sortutil.h:62"/> +<sa kind="api-surface" key="085e3d408c2c4a35" why="target-gone"/> +<sa kind="api-surface" key="155d74d341a49f3c" why="target-gone"/> +<sa kind="api-surface" key="1a15386c2d1e47af" why="target-gone"/> +<sa kind="api-surface" key="298e798c7f075715" why="target-gone"/> +<sa kind="api-surface" key="56acdf9b5c314a14" why="target-gone"/> +<sa kind="api-surface" key="5a07390012b46e06" why="target-gone"/> +<sa kind="api-surface" key="6eef859578c8c376" why="target-gone"/> +<sa kind="api-surface" key="6f2394762f82a855" why="target-gone"/> +<sa kind="api-surface" key="7f2c3eefdf6e512e" why="target-gone"/> +<sa kind="api-surface" key="802e513731103806" why="target-gone"/> +<sa kind="api-surface" key="b6a24afef32a68a8" why="target-gone"/> +<sa kind="api-surface" key="c923e661c197b265" why="target-gone"/> +<sa kind="api-surface:new-symbol" key="1926b0d9e94541a0" why="target-gone"/> +<sa kind="api-surface:new-symbol" key="1d3814ba687a4aef" why="target-gone"/> +<sa kind="api-surface:new-symbol" key="1db76028879244ef" why="target-gone"/> +<sa kind="api-surface:new-symbol" key="25c9f0504fd376a4" why="target-gone"/> +<sa kind="api-surface:new-symbol" key="26aa7c55d54c4341" why="target-gone"/> +<sa kind="api-surface:new-symbol" key="26e3f9a6bff9ea57" why="target-gone"/> +<sa kind="api-surface:new-symbol" key="36e39c7ab0fc1686" why="target-gone"/> +… [184 more display lines; full output is 27199 bytes on 1 raw line(s)] +````` + +stderr: + +````` +ripwire: no ./.ripwire_quality_baseline — auto-comparing the working tree vs git HEAD (commit the baseline with --quality-baseline to pin it) +ripwire: --quality-delta gating: 5 preexisting-worse major finding(s); first: api-surface src/infra/sortutil.h::rw::sortutil::nonNegativeFloatDescKey at src/infra/sortutil.h:122 (was=1 now=2) +````` + +## `./build/ripwire . --quality-delta --json` + +*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: 18.71s** + +````` +{"baseline":"git-HEAD","regressions":9,"minor":1,"acked":0,"stale":202,"preexisting-worse":6,"new-symbol":3,"gating":5,"register-macro-excluded":63,"api-new-surface":2,"at":"914c4045d+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:62","gating":true}, +{"kind":"dead-code","sym":"src/infra/sortutil.h::rw::sortutil::nonNegativeFloatAscKeyCopy","p":"src/infra/sortutil.h:132","origin":"new-symbol"}, +{"kind":"dead-code","sym":"src/infra/sortutil.h::rw::sortutil::sortScoredIdsWithOptions","p":"src/infra/sortutil.h:142","origin":"new-symbol"}, +{"kind":"duplication","members":"src/infra/sortutil.h::rw::sortutil::nonNegativeFloatAscKeyCopy | src/infra/sortutil.h::rw::sortutil::nonNegativeFloatDescKey","tokens":59,"p":"src/infra/sortutil.h:132","gating":true}, +{"kind":"nesting","sym":"src/infra/sortutil.h::rw::sortutil::lessByScoreDescId","was":1,"now":6,"p":"src/infra/sortutil.h:62","gating":true}, +{"kind":"new-clone-of-reused-helper","sym":"src/infra/sortutil.h::rw::sortutil::nonNegativeFloatAscKeyCopy | src/infra/sortutil.h::rw::sortutil::nonNegativeFloatDescKey","was":0,"now":4,"p":"src/infra/sortutil.h:132","gating":true}, +{"kind":"params","sym":"src/infra/sortutil.h::rw::sortutil::sortScoredIdsWithOptions","was":0,"now":8,"p":"src/infra/sortutil.h:142","origin":"new-symbol"}, +{"kind":"verbosity","sym":"src/infra/sortutil.h::rw::sortutil::lessByScoreDescId","was":8,"now":47,"p":"src/infra/sortutil.h:62","sev":"minor"}], +"sa":[{"kind":"api-surface","key":"085e3d408c2c4a35","why":"target-gone"}, +{"kind":"api-surface","key":"155d74d341a49f3c","why":"target-gone"}, +{"kind":"api-surface","key":"1a15386c2d1e47af","why":"target-gone"}, +{"kind":"api-surface","key":"298e798c7f075715","why":"target-gone"}, +{"kind":"api-surface","key":"56acdf9b5c314a14","why":"target-gone"}, +{"kind":"api-surface","key":"5a07390012b46e06","why":"target-gone"}, +{"kind":"api-surface","key":"6eef859578c8c376","why":"target-gone"}, +{"kind":"api-surface","key":"6f2394762f82a855","why":"target-gone"}, +{"kind":"api-surface","key":"7f2c3eefdf6e512e","why":"target-gone"}, +{"kind":"api-surface","key":"802e513731103806","why":"target-gone"}, +{"kind":"api-surface","key":"b6a24afef32a68a8","why":"target-gone"}, +{"kind":"api-surface","key":"c923e661c197b265","why":"target-gone"}, +{"kind":"api-surface:new-symbol","key":"1926b0d9e94541a0","why":"target-gone"}, +{"kind":"api-surface:new-symbol","key":"1d3814ba687a4aef","why":"target-gone"}, +{"kind":"api-surface:new-symbol","key":"1db76028879244ef","why":"target-gone"}, +{"kind":"api-surface:new-symbol","key":"25c9f0504fd376a4","why":"target-gone"}, +{"kind":"api-surface:new-symbol","key":"26aa7c55d54c4341","why":"target-gone"}, +{"kind":"api-surface:new-symbol","key":"26e3f9a6bff9ea57","why":"target-gone"}, +{"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"}, +… [181 more display lines; full output is 20432 bytes on 1 raw line(s)] +````` + +stderr: + +````` +ripwire: no ./.ripwire_quality_baseline — auto-comparing the working tree vs git HEAD (commit the baseline with --quality-baseline to pin it) +ripwire: --quality-delta gating: 5 preexisting-worse major finding(s); first: api-surface src/infra/sortutil.h::rw::sortutil::nonNegativeFloatDescKey at src/infra/sortutil.h:122 (was=1 now=2) +````` + +## `./build/ripwire . --quality-delta --quality-ack --ack-only=zzznope` + +*NEW FLAG: --ack-only matching nothing REFUSES rather than falling back to acking everything.* + +**exit code: 1** — **wall time: 12.08s** + +````` +(empty) +````` + +stderr: + +````` +ripwire: no ./.ripwire_quality_baseline — auto-comparing the working tree vs git HEAD (commit the baseline with --quality-baseline to pin it) +ripwire: ack provenance backfill — 0 clone row(s) reconstructed from the current tree, 196 re-derived, 39 left UNVERIFIED (their group was not found here — a floor, not proof it is gone), 55 left legacy (member set not found cloning here — a floor, not proof it is gone), 1297 ineligible (no cu … [line truncated: 200 more bytes on this line] +ripwire: --ack-only=zzznope matched none of the 9 finding(s) — nothing written +````` + +## `./build/ripwire . --quality-delta --quality-ack --ack-only=api-surface` + +*NEW FLAG: ack only the api-surface findings — a per-finding ratchet instead of a rubber stamp.* + +**wall time: 11.99s** + +````` +(empty) +````` + +stderr: + +````` +ripwire: no ./.ripwire_quality_baseline — auto-comparing the working tree vs git HEAD (commit the baseline with --quality-baseline to pin it) +ripwire: ack provenance backfill — 0 clone row(s) reconstructed from the current tree, 196 re-derived, 39 left UNVERIFIED (their group was not found here — a floor, not proof it is gone), 55 left legacy (member set not found cloning here — a floor, not proof it is gone), 1297 ineligible (no cu … [line truncated: 200 more bytes on this line] +ripwire: acknowledged 1 of 9 finding(s) (8 left UNACKED by --ack-only, 0 already acked) → ./.ripwire_quality_acks +````` + +## `./build/ripwire . --quality-delta` + +*Re-run after the partial ack: acked=3, the rest still gate (exit 2).* + +**exit code: 2** — **wall time: 16.98s** + +````` +<!-- ripwire quality-delta schema=ripwire.quality-delta/v1: only what the change made WORSE vs baseline=: regressions= minor= gating=; <r kind= sym= p= was= now= gating= bar=>, <sa> acked. value-ref-excluded=N: internal functions kept off because a table, field or argument in another function or at file scope holds them (matched by name, not a proven call); a floor. at=: commit+dirty+shallow. next=: the one pasteable follow-up. stale=N: ack ledger rows whose target no longer applies (sa rows); never gating. preexisting-worse=N: regressions on symbols that existed at baseline; they gate when major. new-symbol=N: NEW code; new-symbol rows never gate, except defect-shape format-arity, ceiling=, tangle. register-macro-excluded=N: symbols skipped: self-registering test/bench macros or Rust #[test]; a floor. declined-call-excluded=N: symbols kept out of dead-code only because a declined call may mean them; a floor. api-new-surface=N: new PUBLIC symbols; a count, never gates, not in regressions=. renames=/rename_window_commits=: git rename pairs read over that many commits, to re-file baseline and acks. acked_by_rename=/acked_by_content=: acked= suppressions matched via git renames / an equal body hash. renames_window_truncated=1: history is deeper than the rename window, older renames unread. acked=N: findings suppressed by the ack ledger, listed as sa rows; never gating. r sev=minor: a small numeric delta, counted in minor=, never gating (absent: major). r origin=new-symbol: a finding on NEW code; moved: its body left another name or file, never gating (absent: preexisting-worse). sa key=/why=: the stale ack's ledger hash / target-gone (names nothing now) or finding-gone (no longer fires). r members=/tokens=: a duplication row's clone group (member ids) / their shared normalized-token count. --> +<quality-delta schema="ripwire.quality-delta/v1" baseline="git-HEAD" regressions="8" minor="1" acked="1" stale="202" preexisting-worse="5" new-symbol="3" gating="4" register-macro-excluded="63" api-new-surface="2" at="914c4045d+dirty" renames="68" rename_window_commits="400" acked_by_rename="0" acke … [line truncated: 99 more bytes on this line] +<r kind="complexity" sym="src/infra/sortutil.h::rw::sortutil::lessByScoreDescId" was="1" now="67" bar="15" p="src/infra/sortutil.h:62" gating="1" next="--expand=src/infra/sortutil.h:lessByScoreDescId"/> +<r kind="dead-code" sym="src/infra/sortutil.h::rw::sortutil::nonNegativeFloatAscKeyCopy" origin="new-symbol" p="src/infra/sortutil.h:132"/> +<r kind="dead-code" sym="src/infra/sortutil.h::rw::sortutil::sortScoredIdsWithOptions" origin="new-symbol" p="src/infra/sortutil.h:142"/> +<r kind="duplication" members="src/infra/sortutil.h::rw::sortutil::nonNegativeFloatAscKeyCopy | src/infra/sortutil.h::rw::sortutil::nonNegativeFloatDescKey" tokens="59" p="src/infra/sortutil.h:132" gating="1"/> +<r kind="nesting" sym="src/infra/sortutil.h::rw::sortutil::lessByScoreDescId" was="1" now="6" bar="4" p="src/infra/sortutil.h:62" gating="1" next="--expand=src/infra/sortutil.h:lessByScoreDescId"/> +<r kind="new-clone-of-reused-helper" sym="src/infra/sortutil.h::rw::sortutil::nonNegativeFloatAscKeyCopy | src/infra/sortutil.h::rw::sortutil::nonNegativeFloatDescKey" was="0" now="4" p="src/infra/sortutil.h:132" gating="1" next="--expand=src/infra/sortutil.h:nonNegativeFloatDescKey"/> +<r kind="params" sym="src/infra/sortutil.h::rw::sortutil::sortScoredIdsWithOptions" was="0" now="8" bar="5" origin="new-symbol" p="src/infra/sortutil.h:142"/> +<r kind="verbosity" sym="src/infra/sortutil.h::rw::sortutil::lessByScoreDescId" was="8" now="47" bar="60" sev="minor" p="src/infra/sortutil.h:62"/> +<sa kind="api-surface" key="085e3d408c2c4a35" why="target-gone"/> +<sa kind="api-surface" key="155d74d341a49f3c" why="target-gone"/> +<sa kind="api-surface" key="1a15386c2d1e47af" why="target-gone"/> +<sa kind="api-surface" key="298e798c7f075715" why="target-gone"/> +<sa kind="api-surface" key="56acdf9b5c314a14" why="target-gone"/> +<sa kind="api-surface" key="5a07390012b46e06" why="target-gone"/> +<sa kind="api-surface" key="6eef859578c8c376" why="target-gone"/> +<sa kind="api-surface" key="6f2394762f82a855" why="target-gone"/> +<sa kind="api-surface" key="7f2c3eefdf6e512e" why="target-gone"/> +<sa kind="api-surface" key="802e513731103806" why="target-gone"/> +<sa kind="api-surface" key="b6a24afef32a68a8" why="target-gone"/> +<sa kind="api-surface" key="c923e661c197b265" why="target-gone"/> +<sa kind="api-surface:new-symbol" key="1926b0d9e94541a0" why="target-gone"/> +<sa kind="api-surface:new-symbol" key="1d3814ba687a4aef" why="target-gone"/> +<sa kind="api-surface:new-symbol" key="1db76028879244ef" why="target-gone"/> +<sa kind="api-surface:new-symbol" key="25c9f0504fd376a4" why="target-gone"/> +<sa kind="api-surface:new-symbol" key="26aa7c55d54c4341" why="target-gone"/> +<sa kind="api-surface:new-symbol" key="26e3f9a6bff9ea57" why="target-gone"/> +<sa kind="api-surface:new-symbol" key="36e39c7ab0fc1686" why="target-gone"/> +<sa kind="api-surface:new-symbol" key="4bce64bd920de0c3" why="target-gone"/> +… [183 more display lines; full output is 21415 bytes on 1 raw line(s)] +````` + +stderr: + +````` +ripwire: no ./.ripwire_quality_baseline — auto-comparing the working tree vs git HEAD (commit the baseline with --quality-baseline to pin it) +ripwire: --quality-delta gating: 4 preexisting-worse major finding(s); first: complexity src/infra/sortutil.h::rw::sortutil::lessByScoreDescId at src/infra/sortutil.h:62 (was=1 now=67) +````` + +## `./build/ripwire . --ack-only=gating` + +*--ack-only WITHOUT --quality-ack REFUSES loudly (exit 1, the pairing named) — it used to be silently ignored.* + +**exit code: 1** + +````` +(empty) +````` + +stderr: + +````` +ripwire: --ack-only=SUBSTR narrows --quality-ack — pass both (e.g. ripwire <dir> --quality-delta --ack-only=contract-change --quality-ack="reason") +````` + +## `./build/ripwire . --edit-check=nonNegativeFloatDescKey` + +*A real contract-change: was=1 now=2 params, with the call sites that are now provably incompatible, and a pasteable next= (--uses=SYM) on the root.* + +**wall time: 3.36s** + +````` +<!-- ripwire edit-check schema=ripwire.edit-check/v1: sym='s contract NOW vs HEAD: status=unchanged|new-symbol|contract-change; <c n= p= incompatible=1 sites_l=> callers. counts_floor=1: every count is a FLOOR, never a total. graph_ambiguous=/graph_unresolved=: resolver gauge. graph_unindexed=N: N files no grammar could read (the map header's unindexed=); their calls raise neither gauge. est_tokens=: price as emitted (an upper bound under compact). at=: commit+dirty+shallow. root=: p= relative to it. next=: the one pasteable follow-up. defs=N: overloads at this site (same file, scope, name) folded into one contract; params compared by MAX. callers=N: callers of sym= (the c rows' total; a floor). t=: sym='s kind (fn|cls|...). --> +<edit-check schema="ripwire.edit-check/v1" sym="nonNegativeFloatDescKey" t="fn" p="src/infra/sortutil.h:122" status="contract-change" defs="1" params_was="1" params_now="2" public_was="1" public_now="1" defs_was="1" defs_now="1" change="params,broken-callers" callers="4" incompatible="4" at="914c404 … [line truncated: 161 more bytes on this line] +<c n="benchScores" p="bench/bench_radix_ab.cpp:133" incompatible="1" sites_l="146,152"/> +<c n="benchAdaptive" p="bench/bench_radix_ab.cpp:157" incompatible="1" sites_l="162"/> +<c n="radixSortNonNegativeFloatsDesc" p="src/infra/sortutil.h:151" incompatible="1" sites_l="160"/> +<c n="radixSortByScoreDescId" p="src/infra/sortutil.h:166" incompatible="1" sites_l="226"/> +</edit-check> +````` + +## `./build/ripwire . --edit-check=nonNegativeFloatDescKey --legend=full` + +*The same verdict under --legend=full: the default's one compact comment (the post-edit reflex at its cheapest) becomes ~5.7 KB of prose legend, every <c incompatible=> row identical.* + +**wall time: 1.77s** + +````` +<!-- ripwire edit-check: SYM's contract (param count + publicness) NOW vs git HEAD — unchanged/new-symbol/contract-change, or no-baseline when the root has no git HEAD to compare against (not a repository, or no commit yet): then NOTHING is claimed about the contract, and a symbol is never called new for want of a baseline — plus its 1-hop callers. A caller is flagged incompatible="1" when its argument count was reliably counted and NO definition in the folded set could accept it: every one has a FIXED arity that disagrees. A variadic, defaulted or implicit-receiver definition (a Python/Ruby method, whose params counts the self/cls the call site never writes) has no fixed arity and is never flagged. That makes the ARITY half one-sided — a call the compared definitions could accept is never flagged — but it is NOT a proof that the call site binds to THIS definition. Call edges are matched by NAME, so a receiver-qualified call to a same-named callee this tool does not index (a standard-library or third-party method) is measured against the one definition it does index; a clean, compiling tree can therefore carry a nonzero incompatible= with nothing edited at all, and on a widely-shared name it can be most of that name's callers. Read incompatible= as a fact about the tree as it stands — call sites worth OPENING, not a verdict — and status= as a fact about the edit. Warm path hits the qheadsnap/qsnap cache — never a full quality-delta style recompute. defs= is how many DEFINITIONS at this site (same file, same scope, same name — the overload set) are folded into this one contract; a selector matching more than one SITE is refused instead, so defs= only ever counts overloads. params_was and params_now are the MAX over that set on each side (the same MAX the baseline snapshot stores), and publicness is the OR. That MAX has TWO consequences, in opposite directions. It can read like a break and not be one: adding a WIDER overload beside an unchanged one raises params_now with no existing definition altered, so it reports status="contract-change" with incompatible="0" and a def row still carrying the old parameter count — no seen caller breaks. And it can read like safety and not be: REMOVING an overload whose parameter count is BELOW the MAX moves neither number, because the MAX survives on both sides, while the call site that used the removed definition no longer binds. defs_was=/defs_now= is what closes that: the count of definitions sharing this symbol's DEFINITION SITE — same file, same scope, same name — on each side. That is the population the baseline snapshot buckets by, so the two numbers answer the same question and are equal on an unedited tree. A same-named definition in ANOTHER FILE is a different contract and is counted on neither side, so defs_now= agrees with the root's defs= by construction and only defs_was= can move it. status is therefore the join of THREE was-vs-now facts — the params MAX, publicness, and the definition COUNT — and change= names which of them carried it. change= adds broken-callers when a seen caller is also flagged, but never on its own — for the reason stated at the top: incompatible= describes the TREE and status= describes the EDIT, so a headline must not turn on it. RESIDUAL: an overload whose arity changes BELOW the MAX while the COUNT stays the same moves none of the three. The root's incompatible= is the COUNT of flagged callers (a c row's incompatible="1" is the per-caller flag). sites_l= rides on a flagged row only: a c row's p= is where that CALLER is DEFINED, and sites_l= is the ascending LINE list of its call-role reference sites to this name — the lines to open, the same rows the uses verb prints, including the ones whose argument count could not be counted (so sites_l= can be wider than the evidence the flag rests on). Two calls on one line are ONE site. p= is the definition the selector resolved to; when defs is above 1 EVERY folded definition is listed as its own def row (p=, t=, params=), which is what tells a widened single definition apart from an added overload. At defs="1" no def row is emitted: the root's own p=/t= is that definition, and params_now is its parameter count. next= is the one pasteable follow-up: on a contract-change the uses verb on SYM (the call sites), otherwise the test gate on the definition's file. est_tokens= prices THIS document, through the tool's ONE emitted-bytes estimator. counts_floor="1" means every count here is a FLOOR, never a total: edges are extracted from source TEXT by NAME. Missing: dynamic dispatch (virtual/interface/duck-typed), a most-vexing-parse declaration with no call expression, a function-pointer/callback bound to more than one function in scope (reassigned, table-indexed, lambda-bound, or address-taken/reference-bound), and a plain-name binding (fp=handler) whose variable type is not PROVABLY a function pointer (a same-file typedef/declarator; a HEADER typedef is missed; auto/template types are read as unpinned, so KEPT). A macro-generated call site is role="macro" only when its name uniquely names an indexed function-like #define (C-family, t="macro"); a shared name stays a plain call, an unindexed macro is no edge. Read a zero as "none found", never as "none exists". graph_ambiguous=/graph_unresolved= are the whole graph's resolver gauge (calls split over several defs / calls whose in-repo defs were all language-filtered), the map header's ambiguous=/unresolved=. graph_unindexed=N is a third gauge: files no grammar could read (the map header's unindexed=), whose calls raise neither gauge above; absent when zero, and so is this sentence. COUNTING UNIT differs by verb: callers, callees, edit-check, graph-query and pr-context counts are DISTINCT SYMBOLS (repeated calls from one caller, and calls to two overloads, collapse into ONE row; multiplicity survives only in the call graph's edge weight). The reach counts (impact's reaches=, pr-context's dependents=) are the size of a transitive reach SET, each symbol counted once. The uses verb counts call SITES, one row per occurrence — a larger count there for the same symbol is these units agreeing, not disagreeing. The map header's edges= is a unit again different — distinct (caller,callee) PAIRS — and that document carries neither this marker nor this clause. --> +<edit-check sym="nonNegativeFloatDescKey" t="fn" p="src/infra/sortutil.h:122" status="contract-change" defs="1" params_was="1" params_now="2" public_was="1" public_now="1" defs_was="1" defs_now="1" change="params,broken-callers" callers="4" incompatible="4" at="914c4045d+dirty" graph_ambiguous="3984 … [line truncated: 131 more bytes on this line] +<c n="benchScores" p="bench/bench_radix_ab.cpp:133" incompatible="1" sites_l="146,152"/> +<c n="benchAdaptive" p="bench/bench_radix_ab.cpp:157" incompatible="1" sites_l="162"/> +<c n="radixSortNonNegativeFloatsDesc" p="src/infra/sortutil.h:151" incompatible="1" sites_l="160"/> +<c n="radixSortByScoreDescId" p="src/infra/sortutil.h:166" incompatible="1" sites_l="226"/> +</edit-check> +````` + +## `./build/ripwire . --pr-context` + +*The review-evidence bundle with an actual changed file.* + +**wall time: 4.21s** + +````` +<!-- ripwire pr-context schema=ripwire.pr-context/v1: review bundle per changed file vs base=: symbols, callers, blast radius, tests, owners. window: shown= capped= (capped=1 cut). counts_floor=1: every count is a FLOOR, never a total. graph_ambiguous=/graph_unresolved=: resolver gauge. graph_unindexed=N: N files no grammar could read (the map header's unindexed=); their calls raise neither gauge. run_unknown=1: no runner derivable (a guess would be worse). <g n= p=a,b,c>: 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). 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). 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). 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. --> +<pr-context schema="ripwire.pr-context/v1" base="working-tree" root="." direction="worktree-since-head" files="1" skipped_mode_only="0" budget_tokens="8000" est_tokens="4090" trim_level="0" truncated="none" budget_default="1" at="914c4045d+dirty" graph_ambiguous="3984" graph_unresolved="20100" graph … [line truncated: 34 more bytes on this line] +<file p="src/infra/sortutil.h" symbols="14"> +<impact dependents="1049" files="148" files_other="148" shown="20" capped="1"> +<f p="src/graph.h" deps="62"/> +<f p="src/quality.h" deps="44"/> +<f p="src/mcpverbs.h" deps="41"/> +<f p="src/verbs_for.h" deps="33"/> +<f p="src/backhops.h" deps="31"/> +<f p="src/slice.h" deps="31"/> +<f p="src/verbs_quality.h" deps="29"/> +<f p="src/resolve.h" deps="27"/> +<f p="src/defectshape.h" deps="26"/> +<f p="src/verbs_navigate.h" deps="23"/> +<f p="src/crossref.h" deps="21"/> +<f p="src/layout.h" deps="21"/> +<f p="src/forreexport.h" deps="20"/> +<f p="src/main.cpp" deps="20"/> +<f p="src/search.h" deps="20"/> +<f p="src/valuerefindex.h" deps="20"/> +<f p="src/editcheck.h" deps="16"/> +<f p="src/exemplarfamily.h" deps="16"/> +<f p="src/forfilesyms.h" deps="16"/> +<f p="src/shstatus.h" deps="16"/> +</impact> +<tests count="12" shown="12" capped="0"> +<test p="test/adaptivecutshapefix/adaptive_cut_shape_test.cpp" run="bash test/adaptivecutshapecheck.sh"/> +<test p="test/cloneband_harness.cpp" run="bash test/clonebandcheck.sh"/> +<test p="test/connectcore_harness.cpp" run="bash test/connectcorecheck.sh"/> +<test p="test/forrowfeatures_unit.cpp" run="bash test/forrowfeaturescheck.sh"/> +… [107 more display lines; full output is 10225 bytes on 1 raw line(s)] +````` + +## `./build/ripwire . --map-diff --top-k=5` + +*The map re-ranked with a teleport toward the changed file (changed=1 here, not 0).* + +**wall time: 2.70s** + +````` +<!-- ripwire map-diff schema=ripwire.map-diff/v1: the ranked map anchored at at=: what the diff touched, the map's row vocabulary. est_tokens=: price as emitted (an upper bound under compact). at=: commit+dirty+shallow. root=: p= relative to it. pr_iters=N: PageRank iterations. 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. 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). changed=K: K indexed git-changed files seed the PageRank teleport (0: uniform, incl. no git). 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. sc=: enclosing scope; the full id is p::sc::n (p= of the row or its <f>) 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. --> +<!-- t=modscope=a-file's-MODULE-SCOPE(n=<file-scope>):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 --> +<!-- t=type|alias|functype=a-Go-named-type-by-its-written-form:type=a-defined-type-whose-WRITTEN-form-is-not-a-struct/iface/func-literal(type-N-string;type-W-Pair-too,whatever-Pair-is-underneath),alias=type-A=B,functype=type-F-func(...) --> +<!-- t=alias|functype-in-C++-and-.h:alias=using-X=Y(also-templated-or-class-scope)or-namespace-L=lib(defs=X-prints-its-written-target-as-to=),functype=a-typedef-of-a-function-or-function-pointer-type(typedef-void(*F)(int));other-typedefs-read-t=struct --> +<!-- files=4852 symbols=45033 edges=45382 shown=5 est_tokens=1352 ambiguous=3984 unresolved=20100 locality_pinned=14 external=12460 declined=45310 extent_suspect_syms=12 macro_blanked_files=7 changed=1 skipped_oversize=15 unindexed="txt:85,tsv:54,mod:33,xml:33,jsonl:26,scm:25" unindexed_exts=23 order=important-first --> +<r schema="ripwire.map-diff/v1" at="914c4045d+dirty" root="." est_tokens="1352" pr_iters="29"> +<f p="src/infra/sortutil.h" layer="infra"> +<s t="fn" n="radixSortByScoreDescId" sc="rw::sortutil" k="0.0913"> +<c n="lessByScoreDescId"/> +<c n="radixSortUint32ByKey"/> +<c n="nonNegativeFloatDescKey"/> +</s> +<s t="fn" n="nonNegativeFloatDescKey" sc="rw::sortutil" k="0.0717"> +</s> +<s t="fn" n="lessByScoreDescId" sc="rw::sortutil" k="0.0662"> +</s> +<s t="fn" n="lessByFromTo" sc="rw::sortutil" k="0.0649"> +</s> +</f> +<f p="src/infra/radixSort.h" layer="infra"> +<s t="fn" n="sortKeySmall" sc="radix" k="0.0828"> +</s> +</f> +</r> +````` + +## `./build/ripwire . --clones` + +*The duplicated helper the sandbox edit introduced shows up as a clone group.* + +**wall time: 1.54s** + +````` +<!-- ripwire clones schema=ripwire.clones/v1: similar normalized-token bodies: <group type=2|3 gid= tokens= n= similarity=> of <f n= p=>; 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, call-sequence. --> +<clones schema="ripwire.clones/v1" groups="177" type3="942" exempt_groups="759" idiom_groups="61" demoted_groups="30" clone_groups="469" dup_loc="9005" total_loc="333572" dup_pct="2.7" shown="80" capped="1" total="1119" has_more="1" next_offset="80" offset="0" limit="0" root="."> +<group type="2" gid="50" tokens="338" n="3"> +<f n="rw_is_ripwire_call" p="hooks/ripwire-claude-route.sh:187"/> +<f n="rw_is_ripwire_call" p="hooks/ripwire-codex-route.sh:104"/> +<f n="rw_is_ripwire_call" p="hooks/ripwire-nudge.sh:623"/> +</group> +<group type="2" gid="290" tokens="213" n="2" exempt="shell-runner"> +<f n="call_sites" p="test/declinecheck.sh:116"/> +<f n="call_sites" p="test/usesselectorcheck.sh:55"/> +</group> +<group type="2" gid="391" tokens="211" n="4" exempt="shell-runner"> +<f n="batch_sub" p="test/mcpclidiffcheck.sh:64"/> +<f n="batch_sub" p="test/mcptranchecheck.sh:55"/> +<f n="batch_sub" p="test/mcpw2fixcheck.sh:52"/> +<f n="batch_sub" p="test/mcpw3fixcheck.sh:51"/> +</group> +<group type="2" gid="243" tokens="210" n="2" exempt="shell-runner"> +<f n="mcpfor" p="test/anchorhonestycheck.sh:37"/> +<f n="mcpfor" p="test/foranchornscheck.sh:29"/> +</group> +<group type="2" gid="415" tokens="198" n="2" exempt="shell-runner"> +<f n="classify" p="test/preludevetocheck.sh:41"/> +<f n="classify" p="test/rustmacropathcheck.sh:53"/> +</group> +<group type="2" gid="285" tokens="175" n="2" exempt="shell-runner"> +<f n="mcp" p="test/pathfewestcheck.sh:320"/> +<f n="mcp" p="test/pathroutecheck.sh:468"/> +</group> +<group type="2" gid="49" tokens="163" n="3"> +… [309 more display lines; full output is 16374 bytes on 1 raw line(s)] +````` + +## `./build/ripwire . --stray-content=zz-orphan` + +*CHANGED: a ref with NO merge base with HEAD now reports v="unknown" ok="0" in its own bucket — the absence of an answer, never a claim it is merged. (The sandbox carries a deliberately parentless branch built with `git commit-tree`; a shallow CI clone puts every ref here.)* + +**wall time: 1.97s** + +````` +<!-- ripwire stray-content schema=ripwire.stray-content/v1: per local ref, lines/symbols NOT in HEAD: <ref ok= v= base= stray=>; 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. --> +<stray-content schema="ripwire.stray-content/v1" head="914c4045d" head_ref="integration/train-ge3" refs="1" blobs="0" unmerged="0" superseded="0" merged="0" unknown="1" filter="zz-orphan" at="914c4045d+dirty"> +<ref name="zz-orphan-lane" tip="a1d9e28a6" date="2026-11-22" base="" ok="0" v="unknown" stray="0" files="0" superseded="0"> +</ref> +</stray-content> +````` + +stderr: + +````` +[math degraded] crossref: no merge-base for ref (shallow clone or unrelated history?) — verdict is unknown, not merged (crossref.h:1751, std::vector<RefPlumbing> rw::crossref::probeRefBases(const std::string &, const std::vector<RefInfo> &, const std::string &) — logged once per site) +````` + +## `./build/ripwire . --stray-content=zz-orphan --plan` + +*CHANGED: --plan surfaces those same refs as an <undetermined> row rather than silently dropping them.* + +**wall time: 2.73s** + +````` +<!-- ripwire landing-plan schema=ripwire.landing-plan/v1: stranded-work landing order across refs, fewest conflicts first. at=: commit+dirty+shallow. --> +<landing-plan schema="ripwire.landing-plan/v1" head="914c4045d" refs="1" unmerged="0" superseded="0" merged="0" undetermined="1" scouted="0" bounded="0" scout-ok="1" at="914c4045d+dirty"> +<undetermined name="zz-orphan-lane" v="unknown" reason="no merge base with HEAD (shallow clone or unrelated history) — this ref could not be analysed, it is NOT known to be merged; deepen the clone and re-run"/> +</landing-plan> +````` + +stderr: + +````` +[math degraded] crossref: no merge-base for ref (shallow clone or unrelated history?) — verdict is unknown, not merged (crossref.h:1751, std::vector<RefPlumbing> rw::crossref::probeRefBases(const std::string &, const std::vector<RefInfo> &, const std::string &) — logged once per site) +````` + +## `./build/ripwire . --dmm` + +*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: 5.82s** + +````` +<!-- ripwire dmm schema=ripwire.dmm/v1: Delta Maintainability Model base=→target=: dmm= good/(good+bad) units by size_metric=; <p k= dmm= good= bad= d_low= d_high=>. at=: commit+dirty+shallow. available=0: no score at all (dmm=UNAVAILABLE, reason= says why); never read as 1.000 or 0.000. combine=pooled: root dmm= is summed good over summed good+bad of the 3 properties (ripwire's own). low_loc=/low_cx=/low_params=: a unit is LOW risk at or under these lines / cyclomatic / params. base_units=/base_volume=/target_units=/target_volume=: units with a body and their line span per side. --> +<dmm schema="ripwire.dmm/v1" base="914c4045d08e71e6e6ad23e8a9a1a6b490679aee" target="working-tree" at="914c4045d+dirty" available="1" combine="pooled" size_metric="physical-loc" low_loc="15" low_cx="5" low_params="2" dmm="0.142" good="23" bad="139" base_units="25297" base_volume="333518" target_unit … [line truncated: 33 more bytes on this line] +<p k="size" dmm="0.130" good="7" bad="47" d_low="7" d_high="47"/> +<p k="complexity" dmm="0.130" good="7" bad="47" d_low="7" d_high="47"/> +<p k="interfacing" dmm="0.167" good="9" bad="45" d_low="9" d_high="45"/> +</dmm> +````` + +## `./build/ripwire . --quality-delta --scope=src/graph.h` + +*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 <out-of-scope> with a do-not-ack banner and never gate — scoped-out-gating= says how many would have.* + +**wall time: 16.50s** + +````` +<!-- ripwire quality-delta schema=ripwire.quality-delta/v1: only what the change made WORSE vs baseline=: regressions= minor= gating=; <r kind= sym= p= was= now= gating= bar=>, <sa> acked. value-ref-excluded=N: internal functions kept off because a table, field or argument in another function or at file scope holds them (matched by name, not a proven call); a floor. at=: commit+dirty+shallow. stale=N: ack ledger rows whose target no longer applies (sa rows); never gating. preexisting-worse=N: regressions on symbols that existed at baseline; they gate when major. new-symbol=N: NEW code; new-symbol rows never gate, except defect-shape format-arity, ceiling=, tangle. register-macro-excluded=N: symbols skipped: self-registering test/bench macros or Rust #[test]; a floor. declined-call-excluded=N: symbols kept out of dead-code only because a declined call may mean them; a floor. api-new-surface=N: new PUBLIC symbols; a count, never gates, not in regressions=. renames=/rename_window_commits=: git rename pairs read over that many commits, to re-file baseline and acks. acked_by_rename=/acked_by_content=: acked= suppressions matched via git renames / an equal body hash. renames_window_truncated=1: history is deeper than the rename window, older renames unread. r surface=: the api-surface tier, new-symbol or contract-change. acked=N: findings suppressed by the ack ledger, listed as sa rows; never gating. r sev=minor: a small numeric delta, counted in minor=, never gating (absent: major). r origin=new-symbol: a finding on NEW code; moved: its body left another name or file, never gating (absent: preexisting-worse). sa key=/why=: the stale ack's ledger hash / target-gone (names nothing now) or finding-gone (no longer fires). r members=/tokens=: a duplication row's clone group (member ids) / their shared normalized-token count. --> +<quality-delta schema="ripwire.quality-delta/v1" baseline="git-HEAD" regressions="0" minor="0" acked="0" stale="202" preexisting-worse="0" new-symbol="0" gating="0" register-macro-excluded="63" api-new-surface="2" at="914c4045d+dirty" renames="68" rename_window_commits="400" acked_by_rename="0" acke … [line truncated: 156 more bytes on this line] +<out-of-scope n="9" would-gate="4" note="not yours - do not ack: these rows lie outside the scope this run named. They are disclosed rather than hidden, they never gate this exit code, and the ack refuses to write them."> +<r kind="api-surface" sym="src/infra/sortutil.h::rw::sortutil::nonNegativeFloatDescKey" was="1" now="2" surface="contract-change" p="src/infra/sortutil.h:122"/> +<r kind="complexity" sym="src/infra/sortutil.h::rw::sortutil::lessByScoreDescId" was="1" now="67" bar="15" p="src/infra/sortutil.h:62"/> +<r kind="dead-code" sym="src/infra/sortutil.h::rw::sortutil::nonNegativeFloatAscKeyCopy" origin="new-symbol" p="src/infra/sortutil.h:132"/> +<r kind="dead-code" sym="src/infra/sortutil.h::rw::sortutil::sortScoredIdsWithOptions" origin="new-symbol" p="src/infra/sortutil.h:142"/> +<r kind="duplication" members="src/infra/sortutil.h::rw::sortutil::nonNegativeFloatAscKeyCopy | src/infra/sortutil.h::rw::sortutil::nonNegativeFloatDescKey" tokens="59" p="src/infra/sortutil.h:132"/> +<r kind="nesting" sym="src/infra/sortutil.h::rw::sortutil::lessByScoreDescId" was="1" now="6" bar="4" p="src/infra/sortutil.h:62"/> +<r kind="new-clone-of-reused-helper" sym="src/infra/sortutil.h::rw::sortutil::nonNegativeFloatAscKeyCopy | src/infra/sortutil.h::rw::sortutil::nonNegativeFloatDescKey" was="0" now="4" p="src/infra/sortutil.h:132"/> +<r kind="params" sym="src/infra/sortutil.h::rw::sortutil::sortScoredIdsWithOptions" was="0" now="8" bar="5" origin="new-symbol" p="src/infra/sortutil.h:142"/> +<r kind="verbosity" sym="src/infra/sortutil.h::rw::sortutil::lessByScoreDescId" was="8" now="47" bar="60" sev="minor" p="src/infra/sortutil.h:62"/> +</out-of-scope> +<sa kind="api-surface" key="085e3d408c2c4a35" why="target-gone"/> +<sa kind="api-surface" key="155d74d341a49f3c" why="target-gone"/> +<sa kind="api-surface" key="1a15386c2d1e47af" why="target-gone"/> +<sa kind="api-surface" key="298e798c7f075715" why="target-gone"/> +<sa kind="api-surface" key="56acdf9b5c314a14" why="target-gone"/> +<sa kind="api-surface" key="5a07390012b46e06" why="target-gone"/> +<sa kind="api-surface" key="6eef859578c8c376" why="target-gone"/> +<sa kind="api-surface" key="6f2394762f82a855" why="target-gone"/> +<sa kind="api-surface" key="7f2c3eefdf6e512e" why="target-gone"/> +<sa kind="api-surface" key="802e513731103806" why="target-gone"/> +<sa kind="api-surface" key="b6a24afef32a68a8" why="target-gone"/> +<sa kind="api-surface" key="c923e661c197b265" why="target-gone"/> +<sa kind="api-surface:new-symbol" key="1926b0d9e94541a0" why="target-gone"/> +<sa kind="api-surface:new-symbol" key="1d3814ba687a4aef" why="target-gone"/> +<sa kind="api-surface:new-symbol" key="1db76028879244ef" why="target-gone"/> +<sa kind="api-surface:new-symbol" key="25c9f0504fd376a4" why="target-gone"/> +<sa kind="api-surface:new-symbol" key="26aa7c55d54c4341" why="target-gone"/> +… [186 more display lines; full output is 21682 bytes on 1 raw line(s)] +````` + +stderr: + +````` +ripwire: no ./.ripwire_quality_baseline — auto-comparing the working tree vs git HEAD (commit the baseline with --quality-baseline to pin it) +````` + +## `./build/ripwire . --quality-delta --quality-ack --scope=src/graph.h --ack-only=api-surface` + +*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: 12.50s** + +````` +(empty) +````` + +stderr: + +````` +ripwire: no ./.ripwire_quality_baseline — auto-comparing the working tree vs git HEAD (commit the baseline with --quality-baseline to pin it) +ripwire: --ack-only=api-surface selects 1 finding(s) OUT OF SCOPE for --scope=src/graph.h — refusing, and writing nothing at all: + api-surface src/infra/sortutil.h::rw::sortutil::nonNegativeFloatDescKey at src/infra/sortutil.h:122 + those rows belong to whoever is editing those paths. Acking them here writes their debt into a committed ledger under YOUR + reason string, which is how a per-finding ratchet becomes a rubber stamp. Narrow the pattern, or widen the scope if they really are yours. +````` + +## `./build/ripwire . --handoff` + +*The continuation packet with a REAL diff: verified changed symbols + blast radius + tests-to-run, then the heuristic rows.* + +**wall time: 4.81s** + +````` +<!-- ripwire handoff schema=ripwire.handoff/v1: continuation packet for the NEXT session: <verified changed= blast_files=>, <tests n=>, <heuristic n= candidates=>, <note>, <doc p=>. window: capped= (capped=1 cut). run_unknown=1: no runner derivable (a guess would be worse). est_tokens=: price as emitted (an upper bound under compact). at=: commit+dirty+shallow. root=: p= relative to it. branch=/subject=: the checked out branch and HEAD commit subject; gitok=0: the git diff probe failed, changed counts are floors. cochange_window=/cochange_commits=: the git window the cochange rows were mined in and the commits it held (0: could not look). doc s=: lexical score of that plan/design doc for the branch+subject query. t run=: the command that runs that test (run_unknown=1: none derivable). --> +<handoff schema="ripwire.handoff/v1" at="914c4045d+dirty" root="." branch="integration/train-ge3" subject="showcase: the 11-20 capture stays main's; the train re-records once at its tip" gitok="1" est_tokens="1146"> +<verified changed="1" blast_files="148"> +<f p="src/infra/sortutil.h"> +<s n="svCompare"/> +<s n="svLess"/> +<s n="sortUnique"/> +<s n="lessByScoreDescId"/> +<s n="radixSortUint32ByKey"/> +<s n="nonNegativeFloatDescKey"/> +<s n="nonNegativeFloatAscKeyCopy"/> +<s n="sortScoredIdsWithOptions"/> +<s n="radixSortNonNegativeFloatsDesc"/> +<s n="radixSortByScoreDescId"/> +<s n="radixSortByScoreDescId"/> +<s n="lessByFromTo"/> +<s n="radixSortByFromTo"/> +<s n="radixSortByFromTo"/> +</f> +<tests n="12"> +<t p="test/verify_radix.cpp" run="bash test/greptiercheck.sh"/> +<t p="test/adaptivecutshapefix/adaptive_cut_shape_test.cpp" run="bash test/adaptivecutshapecheck.sh"/> +<t p="test/connectcore_harness.cpp" run="bash test/connectcorecheck.sh"/> +<t p="test/forrowfeatures_unit.cpp" run="bash test/forrowfeaturescheck.sh"/> +<t p="test/fuzz/readers/readers_domain.cpp" run_unknown="1"/> +<t p="test/verify_csr.cpp" run="bash test/a9disclosurecheck.sh"/> +<t p="test/cloneband_harness.cpp" run="bash test/clonebandcheck.sh"/> +<t p="test/shstatus_harness.cpp" run="bash test/gateexitcheck.sh"/> +<t p="test/type3clone_harness.cpp" run="bash test/type3clonecheck.sh"/> +<t p="test/includeprecise_unit.cpp" run="bash test/includeprecisecheck.sh"/> +… [11 more display lines; full output is 2710 bytes on 1 raw line(s)] +````` + +## `./build/ripwire . --note-add="lessByScoreDescId: keep this branch-free — it sits inside the PageRank sort comparator"` + +*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.* + +````` +src/infra/sortutil.h::rw::sortutil::lessByScoreDescId 2026-11-22 keep this branch-free — it sits inside the PageRank sort comparator 914c4045d08e71e6e6ad23e8a9a1a6b490679aee integration/train-ge3 +````` + +stderr: + +````` +ripwire: --note-add: tip: notes that say "chose X over Y because Z" surface better — consider adding the why +ripwire: --note-add: target 'lessByScoreDescId' canonicalised to 'src/infra/sortutil.h::rw::sortutil::lessByScoreDescId' — that is the id --for/--expand key notes by +````` + +## `./build/ripwire . --notes` + +*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.)* + +````` +<ctx schema="ripwire.notes/v1"> +<!-- ripwire notes schema=ripwire.notes/v1: field notes by target: <target id= dangling=> holds <note d= sha= branch=>; the kept count comment: notes= rows, targets= <target> rows, dangling= targets matching nothing indexed (listed, surfaced nowhere). dangling=1: matches nothing indexed. --> +<!-- notes=3 targets=3 dangling=0 --> +<notes> +<target id="src/infra/Diagnostics.h" dangling="0"> +<note d="2026-09-12" sha="42b7c8d" branch="lane/noalias-docs"> +<![CDATA[ASSUME_NO_ALIAS is an optimizer fact in release (separate_storage) only where the compiler consumes it: clang 18+ by default, LLVM 17/AppleClang 16 via the CMake -mllvm flag (scalars only), GCC never (debug check only); never on two members of one object; ASSUME_NO_ALIAS_BUF for OWNING cont … [line truncated: 22 more bytes on this line] +</note> +</target> +<target id="src/infra/sortutil.h::rw::sortutil::lessByScoreDescId" dangling="0"> +<note d="2026-11-22" sha="914c404" branch="integration/train-ge3"> +<![CDATA[keep this branch-free — it sits inside the PageRank sort comparator]]> +</note> +</target> +<target id="test/manifestcheck.sh" dangling="0"> +<note d="2026-08-23" sha="42634f5" branch="claude/fervent-volhard-ddfd9f"> +<![CDATA[README.md's single '<N> gate scripts' claim (~line 1305) is NOT enforced — the derived-vs-stated sibling loop here covers docs/EVALS.md only. It drifted 407→451 unnoticed (fixed 2026-08-23). To close: grep both files ('file:line:' parsing) in the gateCountClaims arm.]]> +</note> +</target> +</notes> +</ctx> +````` + +## `./build/ripwire . --note-add="gitOneLine: which one?"` + +*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** + +````` +(empty) +````` + +stderr: + +````` +ripwire: --note-add: tip: notes that say "chose X over Y because Z" surface better — consider adding the why +ripwire: --note-add: target 'gitOneLine' is ambiguous — it matches 2 definitions in 2 distinct contracts, and a note keys ONE canonical id (it would surface on one of them and look absent on the rest). Qualify one: ./src/handoff.h:gitOneLine, ./src/quality.h:gitOneLine — e.g. --note-add="./src/h … [line truncated: 33 more bytes on this line] +````` + +## `./build/ripwire . --note-add="lessByScoreDescIdd: typo"` + +*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** + +````` +(empty) +````` + +stderr: + +````` +ripwire: --note-add: tip: notes that say "chose X over Y because Z" surface better — consider adding the why +ripwire: --note-add: target not found: lessByScoreDescIdd (did you mean 'lessByScoreDescId'?) (note: the lexical definition scan stopped at its budget, 4096 files or 16 MiB, before reading every file, so this miss is not proof the bytes define nothing; --grep=lessByScoreDescIdd lists its text uses) … [line truncated: 170 more bytes on this line] +````` + +## `./build/ripwire . --note-add="src/infra/sortutil.h::rw::sortutil::lessByScoreDescId: chose the flat two-branch compare over the nested ladder because the comparator sits inside the PageRank sort"` + +*The same symbol addressed by its CANONICAL id: already canonical, so nothing is rewritten and both notes land on ONE target.* + +````` +src/infra/sortutil.h::rw::sortutil::lessByScoreDescId 2026-11-22 chose the flat two-branch compare over the nested ladder because the comparator sits inside the PageRank sort 914c4045d08e71e6e6ad23e8a9a1a6b490679aee integration/train-ge3 +````` + +## `./build/ripwire . --expand=lessByScoreDescId --top-k=0` + +*Both notes riding along with the symbol's body — the <note> elements follow the body, past the display cut, so they are extracted below.* + +````` +<ctx schema="ripwire.expand/v1" root="." est_tokens="804"> +<!-- ripwire expand schema=ripwire.expand/v1: full bodies: <bodies shown= total= capped=> of <b t= l= p= n= sibs= sibs_total= sibs_capped= inc=>; <calls> +<c n= l= p=> resolved callees (p= when not the b's file). window: shown= total= capped= (capped=1 cut). est_tokens=: price as emitted (an upper bound under compact). root=: p= relative to it. inc_total=N: the file's true include/import count; inc= lists the first 24, inc_capped=1 when cut. --> +<bodies shown="1" total="1" capped="0"> +<b t="fn" l="62" p="src/infra/sortutil.h" n="lessByScoreDescId" sibs="svCompare,svLess,sortUnique,radixSortUint32ByKey,nonNegativeFloatDescKey,nonNegativeFloatAscKeyCopy,sortScoredIdsWithOptions,radixSortNonNegativeFloatsDesc,radixSortByScoreDescId,radixSortByScoreDescId,lessByFromTo,radixSortByFrom … [line truncated: 145 more bytes on this line] +<![CDATA[inline bool lessByScoreDescId( const std::vector<float>& scores, std::uint32_t a, std::uint32_t b ) noexcept +{ + if( a < scores.size() ) + { + if( b < scores.size() ) + { + if( scores[ a ] != scores[ b ] ) + { + if( scores[ a ] > scores[ b ] ) + { + if( scores[ a ] > 0.0f && scores[ b ] > 0.0f ) return true; + else if( scores[ a ] > 0.0f && scores[ b ] == 0.0f ) return true; + else if( scores[ a ] == 0.0f || scores[ b ] == 0.0f ) return true; + else return true; + } + else + { + if( scores[ b ] > 0.0f && scores[ a ] > 0.0f ) return false; + else if( scores[ b ] > 0.0f && scores[ a ] == 0.0f ) return false; + else if( scores[ b ] == 0.0f || scores[ a ] == 0.0f ) return false; + else return false; + } + } + else + { +… [22 more display lines; full output is 3086 bytes on 47 raw line(s)] +````` + +The <note> element on the same output — past the 30-line display cut above: + +````` +<note d="2026-11-22" sha="914c404" branch="integration/train-ge3"> +<![CDATA[chose the flat two-branch compare over the nested ladder because the comparator sits inside the PageRank sort]]> +</note> +<note d="2026-11-22" sha="914c404" branch="integration/train-ge3"> +<![CDATA[keep this branch-free — it sits inside the PageRank sort comparator]]> +</note> +````` + +## `./build/ripwire . --replace-symbol-body=lessByScoreDescId --edit-payload=<scratch>/aux/empty_payload.h` + +*An EMPTY payload refuses — it never implies deletion.* + +**exit code: 1** + +````` +(empty) +````` + +stderr: + +````` +ripwire: --edit-payload is empty; empty never means delete +````` + +## `./build/ripwire . --replace-symbol-body=lessByScoreDescId --edit-payload=<scratch>/aux/payload_lessByScoreDescId.h` + +*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: 9.06s** + +Input file: + +````` +inline bool lessByScoreDescId( const std::vector<float>& scores, std::uint32_t a, std::uint32_t b ) noexcept +{ + if( scores[a] != scores[b] ) + { + return scores[a] > scores[b]; + } + return a < b; +} +````` + +````` +{"applied":"replace_symbol_body","symbol":"lessByScoreDescId","file":"src/infra/sortutil.h","span":{"start":2923,"end":3136},"lines":{"start":62,"end":69},"replaced_bytes":1718,"old_file_bytes":10679,"new_file_bytes":9174,"file_eol":"lf","eol_normalized":false,"trailing_newline_folded":true,"separat … [line truncated: 725 more bytes on this line] +"graph_ambiguous":3984,"graph_unresolved":20100,"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/connectcore_harness.cpp","hops":2,"run":"bash test/connectcorecheck.sh"}, +{"p":"test/forrowfeatures_unit.cpp","hops":2,"run":"bash test/forrowfeaturescheck.sh"}, +{"p":"test/fuzz/readers/readers_domain.cpp","hops":2,"run_unknown":true}, +{"p":"test/verify_csr.cpp","hops":2,"run":"bash test/a9disclosurecheck.sh"}, +{"p":"test/cloneband_harness.cpp","hops":3,"run":"bash test/clonebandcheck.sh"}, +{"p":"test/shstatus_harness.cpp","hops":3,"run":"bash test/gateexitcheck.sh"}, +{"p":"test/type3clone_harness.cpp","hops":3,"run":"bash test/type3clonecheck.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"}, +{"p":"test/fuzz/readers/readers_light.cpp","hops":5,"run_unknown":true}], +"order":"evidence","partners":0,"run_first":1,"tests":12,"script_gates_unmodelled":952,"graph_ambiguous":3984,"graph_unresolved":20100,"graph_unindexed":313,"counts_floor":true,"memory_ceiling":"suspended for this check (the write is committed, so a refusal here could not be reported and a retry cou … [line truncated: 91 more bytes on this line] +````` + +stderr: + +````` +ripwire: cache <tmp>: 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) +ripwire edit: applied atomically; receipt carries region, blob_sha, edit_check, tests_to_run; next: bash test/greptiercheck.sh +````` + +## `./build/ripwire . --edit-check=lessByScoreDescId` + +*The closed loop: contract unchanged (same params, same publicness) after the replace — nothing provably incompatible.* + +**wall time: 2.65s** + +````` +<!-- ripwire edit-check schema=ripwire.edit-check/v1: sym='s contract NOW vs HEAD: status=unchanged|new-symbol|contract-change; <c n= p= incompatible=1 sites_l=> callers. counts_floor=1: every count is a FLOOR, never a total. graph_ambiguous=/graph_unresolved=: resolver gauge. graph_unindexed=N: N files no grammar could read (the map header's unindexed=); their calls raise neither gauge. est_tokens=: price as emitted (an upper bound under compact). at=: commit+dirty+shallow. root=: p= relative to it. next=: the one pasteable follow-up. defs=N: overloads at this site (same file, scope, name) folded into one contract; params compared by MAX. callers=N: callers of sym= (the c rows' total; a floor). t=: sym='s kind (fn|cls|...). --> +<edit-check schema="ripwire.edit-check/v1" sym="lessByScoreDescId" t="fn" p="src/infra/sortutil.h:62" status="unchanged" defs="1" callers="4" incompatible="0" at="914c4045d+dirty" graph_ambiguous="3984" graph_unresolved="20100" graph_unindexed="313" counts_floor="1" root="." next="--test-gate=src/in … [line truncated: 33 more bytes on this line] +<note d="2026-11-22" sha="914c404" branch="integration/train-ge3"> +<![CDATA[chose the flat two-branch compare over the nested ladder because the comparator sits inside the PageRank sort]]> +</note> +<note d="2026-11-22" sha="914c404" branch="integration/train-ge3"> +<![CDATA[keep this branch-free — it sits inside the PageRank sort comparator]]> +</note> +<c n="benchScores" p="bench/bench_radix_ab.cpp:133"/> +<c n="benchScoreCase" p="bench/bench_sort_large.cpp:230"/> +<c n="radixSortByScoreDescId" p="src/infra/sortutil.h:127"/> +<c n="verifyRipwireWrappers" p="test/verify_radix.cpp:249"/> +</edit-check> +````` + +## `./build/ripwire . --insert-after-symbol=lessByScoreDescId --edit-payload=<scratch>/aux/payload_note.h` + +*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: 4.46s** + +````` +{"applied":"insert_after_symbol","symbol":"lessByScoreDescId","file":"src/infra/sortutil.h","span":{"start":3136,"end":3224},"lines":{"start":69,"end":71},"replaced_bytes":0,"old_file_bytes":9174,"new_file_bytes":9262,"file_eol":"lf","eol_normalized":false,"trailing_newline_folded":true,"separator_p … [line truncated: 650 more bytes on this line] +"graph_ambiguous":3984,"graph_unresolved":20100,"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/connectcore_harness.cpp","hops":2,"run":"bash test/connectcorecheck.sh"}, +{"p":"test/forrowfeatures_unit.cpp","hops":2,"run":"bash test/forrowfeaturescheck.sh"}, +{"p":"test/fuzz/readers/readers_domain.cpp","hops":2,"run_unknown":true}, +{"p":"test/verify_csr.cpp","hops":2,"run":"bash test/a9disclosurecheck.sh"}, +{"p":"test/cloneband_harness.cpp","hops":3,"run":"bash test/clonebandcheck.sh"}, +{"p":"test/shstatus_harness.cpp","hops":3,"run":"bash test/gateexitcheck.sh"}, +{"p":"test/type3clone_harness.cpp","hops":3,"run":"bash test/type3clonecheck.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"}, +{"p":"test/fuzz/readers/readers_light.cpp","hops":5,"run_unknown":true}], +"order":"evidence","partners":0,"run_first":1,"tests":12,"script_gates_unmodelled":952,"graph_ambiguous":3984,"graph_unresolved":20100,"graph_unindexed":313,"counts_floor":true,"memory_ceiling":"suspended for this check (the write is committed, so a refusal here could not be reported and a retry cou … [line truncated: 91 more bytes on this line] +````` + +stderr: + +````` +ripwire edit: applied atomically; receipt carries region, blob_sha, edit_check, tests_to_run; next: bash test/greptiercheck.sh +````` + +## `./build/ripwire . --insert-after-symbol=lessByScoreDescId --edit-payload=<scratch>/aux/payload_note.h --no-post-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.41s** + +````` +{"applied":"insert_after_symbol","symbol":"lessByScoreDescId","file":"src/infra/sortutil.h","span":{"start":3136,"end":3224},"lines":{"start":69,"end":71},"replaced_bytes":0,"old_file_bytes":9262,"new_file_bytes":9350,"file_eol":"lf","eol_normalized":false,"trailing_newline_folded":true,"separator_p … [line truncated: 570 more bytes on this line] +````` + +stderr: + +````` +ripwire edit: applied atomically; receipt carries region, blob_sha (post-check skipped); next: --edit-check=src/infra/sortutil.h:lessByScoreDescId +````` + +## `./build/ripwire . --insert-before-symbol=nonNegativeFloatDescKey --edit-payload=<scratch>/aux/payload_note.h --edit-target-file=src/infra/sortutil.h` + +*Insert BEFORE, with --edit-target-file pinning which same-named definition (here unambiguous — the disambiguator is simply honoured).* + +**wall time: 7.81s** + +````` +{"applied":"insert_before_symbol","symbol":"nonNegativeFloatDescKey","file":"src/infra/sortutil.h","span":{"start":3656,"end":3744},"lines":{"start":87,"end":88},"replaced_bytes":0,"old_file_bytes":9350,"new_file_bytes":9438,"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:118","l":[127]}, +{"n":"radixSortByScoreDescId","p":"src/infra/sortutil.h:133","l":[193]}], +"graph_ambiguous":3984,"graph_unresolved":20100,"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/connectcore_harness.cpp","hops":2,"run":"bash test/connectcorecheck.sh"}, +{"p":"test/forrowfeatures_unit.cpp","hops":2,"run":"bash test/forrowfeaturescheck.sh"}, +{"p":"test/fuzz/readers/readers_domain.cpp","hops":2,"run_unknown":true}, +{"p":"test/verify_csr.cpp","hops":2,"run":"bash test/a9disclosurecheck.sh"}, +{"p":"test/cloneband_harness.cpp","hops":3,"run":"bash test/clonebandcheck.sh"}, +{"p":"test/shstatus_harness.cpp","hops":3,"run":"bash test/gateexitcheck.sh"}, +{"p":"test/type3clone_harness.cpp","hops":3,"run":"bash test/type3clonecheck.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"}, +{"p":"test/fuzz/readers/readers_light.cpp","hops":5,"run_unknown":true}], +"order":"evidence","partners":0,"run_first":1,"tests":12,"script_gates_unmodelled":952,"graph_ambiguous":3984,"graph_unresolved":20100,"graph_unindexed":313,"counts_floor":true,"memory_ceiling":"suspended for this check (the write is committed, so a refusal here could not be reported and a retry cou … [line truncated: 116 more bytes on this line] +````` + +stderr: + +````` +ripwire edit: applied atomically; receipt carries region, blob_sha, edit_check, tests_to_run; next: --uses=src/infra/sortutil.h:nonNegativeFloatDescKey +````` + +## `./build/ripwire . --replace-symbol-body=DoesNotExist --edit-payload=<scratch>/aux/payload_note.h` + +*An unknown TARGET refuses and leaves every file byte-identical.* + +**exit code: 1** — **wall time: 3.83s** + +````` +(empty) +````` + +stderr: + +````` +ripwire: --replace-symbol-body: symbol 'DoesNotExist' not found +````` + +## `./build/ripwire . --edit-plan=<scratch>/aux/edit_plan.json --dry-run` + +*A versioned multi-edit TRANSACTION preflighted without writing: the receipt shows what each op would read and touch.* + +**wall time: 2.16s** + +Input file: + +````` +{ + "version": 1, + "edits": [ + { + "op": "insert_before_symbol", + "target": "nonNegativeFloatDescKey", + "payload": "plan_note.h" + } + ] +} +````` + +````` +{"schema":"ripwire.edit-plan/v1","mode":"dry-run","edits":1,"files":1,"callers_union":4,"graph_ambiguous":3984,"graph_unresolved":20100,"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: 401 more bytes on this line] +````` + +## `./build/ripwire . --edit-plan=<scratch>/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: 5.58s** + +````` +{"schema":"ripwire.edit-plan/v1","mode":"apply","edits":1,"files":1,"callers_union":4,"graph_ambiguous":3984,"graph_unresolved":20100,"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: 585 more bytes on this line] +{"n":"benchAdaptive","p":"bench/bench_radix_ab.cpp:157","l":[162]}, +{"n":"radixSortNonNegativeFloatsDesc","p":"src/infra/sortutil.h:120","l":[129]}, +{"n":"radixSortByScoreDescId","p":"src/infra/sortutil.h:135","l":[195]}], +"graph_ambiguous":3984,"graph_unresolved":20100,"graph_unindexed":313,"counts_floor":true},"memory_ceiling":"suspended for this check (the write is committed, so a refusal here could not be reported and a retry could insert twice); the 10649 MiB limit was not reached"}]} +````` + +## `./build/ripwire . --edit-plan=<scratch>/aux/edit_plan.json` + +*Neither --dry-run nor --apply: the mode is explicit, so this refuses.* + +**exit code: 1** + +````` +(empty) +````` + +stderr: + +````` +ripwire: --edit-plan requires exactly one of --dry-run or --apply +````` + +## `./build/ripwire . --quality-delta` + +*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: 18.97s** + +````` +<!-- ripwire quality-delta schema=ripwire.quality-delta/v1: only what the change made WORSE vs baseline=: regressions= minor= gating=; <r kind= sym= p= was= now= gating= bar=>, <sa> acked. value-ref-excluded=N: internal functions kept off because a table, field or argument in another function or at file scope holds them (matched by name, not a proven call); a floor. at=: commit+dirty+shallow. next=: the one pasteable follow-up. stale=N: ack ledger rows whose target no longer applies (sa rows); never gating. preexisting-worse=N: regressions on symbols that existed at baseline; they gate when major. new-symbol=N: NEW code; new-symbol rows never gate, except defect-shape format-arity, ceiling=, tangle. register-macro-excluded=N: symbols skipped: self-registering test/bench macros or Rust #[test]; a floor. declined-call-excluded=N: symbols kept out of dead-code only because a declined call may mean them; a floor. api-new-surface=N: new PUBLIC symbols; a count, never gates, not in regressions=. renames=/rename_window_commits=: git rename pairs read over that many commits, to re-file baseline and acks. acked_by_rename=/acked_by_content=: acked= suppressions matched via git renames / an equal body hash. renames_window_truncated=1: history is deeper than the rename window, older renames unread. acked=N: findings suppressed by the ack ledger, listed as sa rows; never gating. r origin=new-symbol: a finding on NEW code; moved: its body left another name or file, never gating (absent: preexisting-worse). sa key=/why=: the stale ack's ledger hash / target-gone (names nothing now) or finding-gone (no longer fires). r members=/tokens=: a duplication row's clone group (member ids) / their shared normalized-token count. --> +<quality-delta schema="ripwire.quality-delta/v1" baseline="git-HEAD" regressions="5" minor="0" acked="1" stale="202" preexisting-worse="2" new-symbol="3" gating="2" register-macro-excluded="63" api-new-surface="2" at="914c4045d+dirty" renames="68" rename_window_commits="400" acked_by_rename="0" acke … [line truncated: 99 more bytes on this line] +<r kind="dead-code" sym="src/infra/sortutil.h::rw::sortutil::nonNegativeFloatAscKeyCopy" origin="new-symbol" p="src/infra/sortutil.h:101"/> +<r kind="dead-code" sym="src/infra/sortutil.h::rw::sortutil::sortScoredIdsWithOptions" origin="new-symbol" p="src/infra/sortutil.h:111"/> +<r kind="duplication" members="src/infra/sortutil.h::rw::sortutil::nonNegativeFloatAscKeyCopy | src/infra/sortutil.h::rw::sortutil::nonNegativeFloatDescKey" tokens="59" p="src/infra/sortutil.h:101" gating="1"/> +<r kind="new-clone-of-reused-helper" sym="src/infra/sortutil.h::rw::sortutil::nonNegativeFloatAscKeyCopy | src/infra/sortutil.h::rw::sortutil::nonNegativeFloatDescKey" was="0" now="4" p="src/infra/sortutil.h:101" gating="1" next="--expand=src/infra/sortutil.h:nonNegativeFloatDescKey"/> +<r kind="params" sym="src/infra/sortutil.h::rw::sortutil::sortScoredIdsWithOptions" was="0" now="8" bar="5" origin="new-symbol" p="src/infra/sortutil.h:111"/> +<sa kind="api-surface" key="085e3d408c2c4a35" why="target-gone"/> +<sa kind="api-surface" key="155d74d341a49f3c" why="target-gone"/> +<sa kind="api-surface" key="1a15386c2d1e47af" why="target-gone"/> +<sa kind="api-surface" key="298e798c7f075715" why="target-gone"/> +<sa kind="api-surface" key="56acdf9b5c314a14" why="target-gone"/> +<sa kind="api-surface" key="5a07390012b46e06" why="target-gone"/> +<sa kind="api-surface" key="6eef859578c8c376" why="target-gone"/> +<sa kind="api-surface" key="6f2394762f82a855" why="target-gone"/> +<sa kind="api-surface" key="7f2c3eefdf6e512e" why="target-gone"/> +<sa kind="api-surface" key="802e513731103806" why="target-gone"/> +<sa kind="api-surface" key="b6a24afef32a68a8" why="target-gone"/> +<sa kind="api-surface" key="c923e661c197b265" why="target-gone"/> +<sa kind="api-surface:new-symbol" key="1926b0d9e94541a0" why="target-gone"/> +<sa kind="api-surface:new-symbol" key="1d3814ba687a4aef" why="target-gone"/> +<sa kind="api-surface:new-symbol" key="1db76028879244ef" why="target-gone"/> +<sa kind="api-surface:new-symbol" key="25c9f0504fd376a4" why="target-gone"/> +<sa kind="api-surface:new-symbol" key="26aa7c55d54c4341" why="target-gone"/> +<sa kind="api-surface:new-symbol" key="26e3f9a6bff9ea57" why="target-gone"/> +<sa kind="api-surface:new-symbol" key="36e39c7ab0fc1686" why="target-gone"/> +<sa kind="api-surface:new-symbol" key="4bce64bd920de0c3" why="target-gone"/> +<sa kind="api-surface:new-symbol" key="61f0e361ef7dee27" why="target-gone"/> +<sa kind="api-surface:new-symbol" key="79625906f9f71ad0" why="target-gone"/> +<sa kind="api-surface:new-symbol" key="8ecb190954dce18a" why="target-gone"/> +… [180 more display lines; full output is 20784 bytes on 1 raw line(s)] +````` + +stderr: + +````` +ripwire: no ./.ripwire_quality_baseline — auto-comparing the working tree vs git HEAD (commit the baseline with --quality-baseline to pin it) +ripwire: --quality-delta gating: 2 preexisting-worse major finding(s); first: duplication src/infra/sortutil.h::rw::sortutil::nonNegativeFloatAscKeyCopy | src/infra/sortutil.h::rw::sortutil::nonNegativeFloatDescKey at src/infra/sortutil.h:101 (was=0 now=59) +````` + +## `./build/ripwire . --quality-baseline` + +*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: 14.48s** + +````` +(empty) +````` + +stderr: + +````` +ripwire: --quality-baseline: this tree already holds 2 gating finding(s) against HEAD — pinning here would absorb + them into the floor, and every later --quality-delta would read clean. First: duplication src/infra/sortutil.h::rw::sortutil::nonNegativeFloatAscKeyCopy | src/infra/sortutil.h::rw::sortutil::nonNegativeFloatDescKey (was=0 now=59) + Commit the tree first, or pass --allow-dirty to pin anyway (the sidecar then records the 2 absorbed, and every + report against it carries baseline_absorbed="2"). +````` + +## `./build/ripwire . --quality-baseline --allow-dirty` + +*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: 20.34s** + +````` +(empty) +````` + +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 42855 per-symbol rows, 45034 indexed symbols total) +````` + +Artifact written: + +````` + 8965615 .ripwire_quality_baseline +# ripwire quality baseline v6 — regenerate with --quality-baseline; do not hand-edit +producer 7f2bbf2e86d5e6116c232bed7599e37a11acce6fcf131765068af96b0e63fc52 +head 914c4045d08e71e6e6ad23e8a9a1a6b490679aee +dirty 1 +absorbed 2 +ccx 67c15011ee8b 0 +ccx d19d7c13cbc7 2 +ccx 1f7edbff929e5 12 +ccx 6a732f6699b +````` + +## `./build/ripwire . --quality-delta` + +*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: 16.41s** + +````` +<!-- ripwire quality-delta schema=ripwire.quality-delta/v1: only what the change made WORSE vs baseline=: regressions= minor= gating=; <r kind= sym= p= was= now= gating= bar=>, <sa> acked. value-ref-excluded=N: internal functions kept off because a table, field or argument in another function or at file scope holds them (matched by name, not a proven call); a floor. at=: commit+dirty+shallow. stale=N: ack ledger rows whose target no longer applies (sa rows); never gating. stale_by_kind=: stale= split by ack kind (kind:N,...); the sa rows are collapsed. stale_next=: the call printing the sa rows and the full header. preexisting-worse=N: regressions on symbols that existed at baseline; they gate when major. new-symbol=N: NEW code; new-symbol rows never gate, except defect-shape format-arity, ceiling=, tangle. register-macro-excluded=N: symbols skipped: self-registering test/bench macros or Rust #[test]; a floor. declined-call-excluded=N: symbols kept out of dead-code only because a declined call may mean them; a floor. api-new-surface=N: new PUBLIC symbols; a count, never gates, not in regressions=. renames=/rename_window_commits=: git rename pairs read over that many commits, to re-file baseline and acks. acked_by_rename=/acked_by_content=: acked= suppressions matched via git renames / an equal body hash. renames_window_truncated=1: history is deeper than the rename window, older renames unread. acked=N: findings suppressed by the ack ledger, listed as sa rows; never gating. --> +<quality-delta schema="ripwire.quality-delta/v1" baseline="sidecar" regressions="0" minor="0" acked="0" stale="202" preexisting-worse="0" new-symbol="0" gating="0" register-macro-excluded="63" api-new-surface="0" at="914c4045d+dirty" renames="68" rename_window_commits="400" acked_by_rename="0" acked … [line truncated: 319 more bytes on this line] +</quality-delta> +````` + + +--- + +# the MCP dialect — the same verbs over stdio JSON-RPC (one-shot exchange, not a persistent server) + +## `printf '%s\n' '{"jsonrpc":"2.0","id":1,"method":"initialize"}' '{"jsonrpc":"2.0","id":2,"method":"tools/list"}' | ./build/ripwire --mcp` + +*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.110+g914c4045d"},"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] +{"name":"find_referencing_symbols","description":"Direct (1-hop) callers of a symbol, each with a fetch_body handle. For the full transitive blast radius use 'impact', for read/write/import sites 'uses'. JSON {symbol, calledBy, defs, count, hop_tested, hop_untested, declined_calls, counts_floor}; ca … [line truncated: 945 more bytes on this line] +{"name":"grep","description":"Trigram literal search; each hit annotated with its enclosing symbol (which function/class it is in). Hits carry text; enclosing rows a fetch_body handle. pattern = the literal; in=any lifts the span tiering (default: tightest non-empty tier; rest rides as suppressed_co … [line truncated: 837 more bytes on this line] +{"name":"cochange","description":"Files that historically change together with this file — the co-edit partners. Fowler's Shotgun Surgery as change coupling. dep_capable=false (sh/md/json/binary) or no_file_edges (Go, Java: imports not resolved) makes surprising undefined, not a finding. file = th … [line truncated: 705 more bytes on this line] +{"name":"memory_recall","description":"Most relevant memory notes / docs for a task, full text — the few that matter, not the whole corpus. path = docs/memory dir; task = what you're working on; top_k = docs to return, 1..1000 (default 6), refused outside that band, never clamped; budget_tokens = … [line truncated: 790 more bytes on this line] +{"name":"situational_awareness","description":"The 5 things to know about a diff, as JSON: blast_radius, tests_to_run, forgotten (usual co-change partners missing from this diff), hotspot_alert, modules_touched. forgotten = the Shotgun Surgery check. diff/files optional — defaults to 'git diff HEA … [line truncated: 1296 more bytes on this line] +{"name":"mentions","description":"Docs (markdown plans/designs) that name a code symbol in a backtick. symbol = the code symbol name; limit/offset page the files. An @FILE:LINE line-seed rebinds to the innermost definition enclosing that line and answers for it, disclosing the rebound name as 'sym' … [line truncated: 625 more bytes on this line] +{"name":"for","description":"Task-lens ranked, signatures-only inventory of the building blocks most relevant to a task (cx=complexity, in=reuse-count). task = the task in plain words; budget_tokens = an optional soft row target (the CLI --for --token-budget). The header carries route= (which ranker … [line truncated: 1061 more bytes on this line] +{"name":"lego","description":"Interface-to-impls view for ONE named interface/base: its method contract plus EVERY implementor (own-language only), each with file path. Use when implementing against a KNOWN interface (contrast 'for', which sprays top interfaces for a task). type = interface/base nam … [line truncated: 841 more bytes on this line] +{"name":"owners","description":"Bus-factor: recency-weighted (6-month half-life) author ownership per file. symbol = optional, restricts to the file that defines it; limit/offset page the rows. at= is the commit these numbers were computed at (+dirty = the working tree differed). An @FILE:LINE line- … [line truncated: 879 more bytes on this line] +{"name":"replace_symbol_body","description":"Replace a symbol's ENTIRE definition (signature through closing brace) with new_body — splices over the full def span, preserving every byte outside it verbatim; new_body must be a complete, well-formed definition. One trailing newline folds (trailing_n … [line truncated: 1323 more bytes on this line] +{"name":"insert_before_symbol","description":"Insert text immediately BEFORE a symbol's definition (its first byte); padded to the file's own blank-line seam (separator_padded=N). Same refusal contract as replace_symbol_body (not found / ambiguous / stale index / symlink / concurrent write, file unc … [line truncated: 877 more bytes on this line] +{"name":"insert_after_symbol","description":"Insert text immediately AFTER a symbol's definition (past its final byte, which is preserved exactly); padded to the file's own blank-line seam (separator_padded=N); one trailing newline folds (trailing_newline_folded). Same refusal contract as replace_sy … [line truncated: 878 more bytes on this line] +{"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-RELATIVE (line 1 = the def's first line), clampe … [line truncated: 1049 more bytes on this line] +{"name":"exemplar","description":"BEFORE writing a function / method / class / struct / interface / variable, get the repo's single best-in-class instance of that kind to imitate — signature AND full body. chosen by ROLE, NEVER by text similarity to your task: candidates are first filtered to cogn … [line truncated: 1372 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: 869 more bytes on this line] +{"name":"quality_baseline","description":"PIN the quality floor: writes .ripwire_quality_baseline stamped with the current git HEAD sha, snapshotting complexity / duplication / dead-code / API surface. Call once at the start of non-trivial work, then quality_delta compares against this pinned floor … [line truncated: 445 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] +{"name":"uses","description":"The STATICALLY RESOLVABLE use-sites of a symbol, not just calls: role (call | read | write | import | extends), file:line, and enclosing symbol. Use to see the footprint before renaming or changing a name — find_referencing_symbols and impact follow only calls. extern … [line truncated: 1146 more bytes on this line] +{"name":"affected","description":"WHICH TESTS TO RUN for a change — test files that transitively reach the changed files/symbols, ranked by evidence (edited > partner-named > hop distance). files = changed files and/or symbols, comma-separated: each item is tried as an indexed PATH pattern first, … [line truncated: 1238 more bytes on this line] +{"name":"path_between","description":"Does A REACH B, and HOW? — the shortest directed CALL path between two symbols, hop-by-hop. reachable=\"0\" hops=\"0\" is a valid 'not reachable' answer — call edges are name-based, so a missing dynamic/callback edge can hide a real path. Named path_between … [line truncated: 709 more bytes on this line] +{"name":"connect","description":"When a task touches 2..16 named symbols, returns the minimal subgraph RELATING them - terminals, the fewest joining intermediaries (with signatures), and call edges in true direction - finding the shared-caller joins a directed path_between cannot; unrelated symbols … [line truncated: 950 more bytes on this line] +{"name":"explore","description":"ONE-call task orientation: the routed+anchored ranking, full bodies of the top hits, their 1-hop callers, field notes, and tests_to_run — ALL under one deterministic byte budget, in a fixed section order (ranking > bodies > callers > notes > tests) that degrades gr … [line truncated: 2134 more bytes on this line] +{"name":"from_trace","description":"Paste a stack trace / sanitizer report / compiler error and get it mapped onto indexed symbols, ranked INNERMOST-first: the parsed <trace> frame map, the ranked suspects' signatures, and the innermost in-corpus symbol's FULL body. Out-of-corpus frames are listed a … [line truncated: 1233 more bytes on this line] +{"name":"edit_check","description":"Just edited a symbol? Did its CONTRACT (param count + publicness) change vs git HEAD, and which 1-hop callers are NOW INCOMPATIBLE with the new arity by fixed-arity evidence (not a guess — every folded definition disagrees)? This is call sites worth OPENING, not … [line truncated: 1908 more bytes on this line] +{"name":"whereis","description":"WHERE DOES THIS CONTENT LIVE? Which branch's tree defines or mentions a symbol, HEAD first, with on-head=0 naming the case this verb exists for: content that lives only on a branch (a finished fix stranded on 1 of 30 refs). Each distinct blob is read once (content-ad … [line truncated: 1475 more bytes on this line] +{"name":"stray_content","description":"Per branch: the lines its own divergent work AUTHORED (vs its merge-base with HEAD) that the live line does NOT have. Four verdicts (unmerged+superseded+merged+unknown=refs): v=unmerged is genuinely absent; v=superseded means the live line re-implemented the wo … [line truncated: 1123 more bytes on this line] +{"name":"flags","description":"WHAT IS BUILT BUT DARK here — the answer to 'why don't I see feature X?'. Harvests all three gate patterns (ifndef/define header gates, CMake option(), getenv reads) with each gate's kind, DEFAULT, the size of the code it guards, and its read sites. When a name is bo … [line truncated: 1434 more bytes on this line] +{"name":"doc_drift","description":"WHICH OF THIS REPO'S DOC CLAIMS ARE NOW FALSE. Verifies the CHECKABLE anchors in every markdown file against the live index and returns ONLY the ones that no longer hold: file:line refs (missing-file / past-eof / line-moved), backticked symbol mentions (undefined), … [line truncated: 1167 more bytes on this line] +{"name":"slice","description":"WHERE IS THIS VARIABLE DEFINED AND USED inside one function — NAME-BASED intra-procedural def-use rows of one variable inside ONE uniquely-resolved definition (the ARISE slicer, arXiv:2605.03117). symbol alone lists the sliceable locals to pick from; add var (or spel … [line truncated: 1722 more bytes on this line] +{"name":"batch","description":"ONE-TURN CONTEXT SWEEP: answer up to 16 heterogeneous READ sub-queries in a single call (the deterministic $0 counterpart of a parallel-search agent). queries = array over the SAME path, in EITHER grammar: {verb, ...args} objects, or the CLI --batch file's own \"verb:a … [line truncated: 2040 more bytes on this line] +````` + +The manifest, summarised (name / description bytes / required args) — what the host pays in context every session: + +````` +tools= 33 manifest_bytes= 47452 (~tokens at 4 bytes/token: 11863 ) +explore desc_bytes= 1339 schema_bytes= 958 required=['task'] +batch desc_bytes= 1235 schema_bytes= 962 required=['queries'] +edit_check desc_bytes= 1180 schema_bytes= 889 required=['symbol'] +slice desc_bytes= 953 schema_bytes= 932 required=['symbol'] +whereis desc_bytes= 701 schema_bytes= 941 required=['symbol'] +flags desc_bytes= 881 schema_bytes= 720 required=[] +exemplar desc_bytes= 951 schema_bytes= 591 required=[] +replace_symbol_body desc_bytes= 865 schema_bytes= 610 required=['symbol', 'new_body'] +impact desc_bytes= 821 schema_bytes= 666 required=['symbol'] +situational_awareness desc_bytes= 864 schema_bytes= 581 required=[] +affected desc_bytes= 790 schema_bytes= 610 required=['files'] +from_trace desc_bytes= 836 schema_bytes= 559 required=['trace'] +find_symbol desc_bytes= 752 schema_bytes= 590 required=['symbol'] +doc_drift desc_bytes= 728 schema_bytes= 604 required=[] +uses desc_bytes= 626 schema_bytes= 682 required=['symbol'] +stray_content desc_bytes= 678 schema_bytes= 604 required=[] +rank_by desc_bytes= 758 schema_bytes= 481 required=[] +for desc_bytes= 453 schema_bytes= 777 required=['task'] +fetch_body desc_bytes= 623 schema_bytes= 588 required=['handle'] +connect desc_bytes= 535 schema_bytes= 580 required=['symbols'] +find_referencing_symbols desc_bytes= 505 schema_bytes= 590 required=['symbol'] +insert_after_symbol desc_bytes= 458 schema_bytes= 577 required=['symbol', 'text'] +insert_before_symbol desc_bytes= 455 schema_bytes= 578 required=['symbol', 'text'] +owners desc_bytes= 425 schema_bytes= 625 required=[] +quality_delta desc_bytes= 749 schema_bytes= 279 required=[] +lego desc_bytes= 360 schema_bytes= 651 required=['type'] +grep desc_bytes= 445 schema_bytes= 562 required=['pattern'] +memory_recall desc_bytes= 447 schema_bytes= 500 required=['task'] +path_between desc_bytes= 357 schema_bytes= 506 required=['from', 'to'] +cochange desc_bytes= 393 schema_bytes= 476 required=['file'] +analyze desc_bytes= 546 schema_bytes= 318 required=[] +mentions desc_bytes= 305 schema_bytes= 486 required=['symbol'] +quality_baseline desc_bytes= 407 schema_bytes= 193 required=[] +````` + +## `printf '%s\n' '{"jsonrpc":"2.0","id":1,"method":"initialize"}' '{"jsonrpc":"2.0","id":2,"method":"tools/list"}' | ./build/ripwire --mcp --mcp-tools=core` + +*--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.110+g914c4045d"},"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: 869 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] +{"name":"uses","description":"The STATICALLY RESOLVABLE use-sites of a symbol, not just calls: role (call | read | write | import | extends), file:line, and enclosing symbol. Use to see the footprint before renaming or changing a name — find_referencing_symbols and impact follow only calls. extern … [line truncated: 1146 more bytes on this line] +{"name":"explore","description":"ONE-call task orientation: the routed+anchored ranking, full bodies of the top hits, their 1-hop callers, field notes, and tests_to_run — ALL under one deterministic byte budget, in a fixed section order (ranking > bodies > callers > notes > tests) that degrades gr … [line truncated: 2134 more bytes on this line] +{"name":"from_trace","description":"Paste a stack trace / sanitizer report / compiler error and get it mapped onto indexed symbols, ranked INNERMOST-first: the parsed <trace> frame map, the ranked suspects' signatures, and the innermost in-corpus symbol's FULL body. Out-of-corpus frames are listed a … [line truncated: 1233 more bytes on this line] +{"name":"edit_check","description":"Just edited a symbol? Did its CONTRACT (param count + publicness) change vs git HEAD, and which 1-hop callers are NOW INCOMPATIBLE with the new arity by fixed-arity evidence (not a guess — every folded definition disagrees)? This is call sites worth OPENING, not … [line truncated: 1908 more bytes on this line] +{"name":"batch","description":"ONE-TURN CONTEXT SWEEP: answer up to 16 heterogeneous READ sub-queries in a single call (the deterministic $0 counterpart of a parallel-search agent). queries = array over the SAME path, in EITHER grammar: {verb, ...args} objects, or the CLI --batch file's own \"verb:a … [line truncated: 2040 more bytes on this line] +````` + +The core manifest, summarised (name / description bytes / required args): + +````` +tools= 8 manifest_bytes= 14192 (~tokens at 4 bytes/token: 3548 ) +explore desc_bytes= 1339 schema_bytes= 958 required=['task'] +batch desc_bytes= 1235 schema_bytes= 962 required=['queries'] +edit_check desc_bytes= 1180 schema_bytes= 889 required=['symbol'] +impact desc_bytes= 821 schema_bytes= 666 required=['symbol'] +from_trace desc_bytes= 836 schema_bytes= 559 required=['trace'] +uses desc_bytes= 626 schema_bytes= 682 required=['symbol'] +fetch_body desc_bytes= 623 schema_bytes= 588 required=['handle'] +quality_delta desc_bytes= 749 schema_bytes= 279 required=[] +````` + +## `printf '%s\n' '{"jsonrpc":"2.0","id":1,"method":"initialize"}' '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"for","arguments":{"path":".","task":"pagerank power iteration"}}}' | ./build/ripwire --mcp` + +*MCP `for`: always bundle=sigs (never the CLI's compact route), the same ranked signatures as --for.* + +**wall time: 2.59s** + +````` +{"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2025-11-25","serverInfo":{"name":"ripwire","version":"0.6.10-dev.110+g914c4045d"},"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":"<ctx task=\"pagerank power iteration\" route=\"subtoken+body\" root=\".\" confidence=\"high\" margin_pct=\"22\" at=\"914c4045d\" doc_mentions=\"4\" doc_mentions_capped=\"1\" doc_mentions_total=\"14\" bundle=\"sigs\" lens=\"churn,amp … [line truncated: 21238 more bytes on this line] +"_index":"[index: files=4852 symbols=45032 hash=8e5a0414]","_fresh":"ok"}} +````` + +## `printf '%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` + +*--mcp-legend=inline: every answer of the stdio session carries its own legend (the default, session, sends each definition once per session after the first answer).* + +**wall time: 26.77s** + +````` +{"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2025-11-25","serverInfo":{"name":"ripwire","version":"0.6.10-dev.110+g914c4045d"},"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":"<!-- ripwire whereis schema=ripwire.whereis/v1: every LOCAL ref whose tree holds sym= (refs_scanned=, blobs=), HEAD first: <hit ref= tip= date= p= l= kind= t=>. window: shown= total= capped= has_more= next_offset= offset= limit= (ca … [line truncated: 20711 more bytes on this line] +"_index":"[index: files=4852 symbols=45032 hash=8e5a0414]","_fresh":"ok"}} +{"jsonrpc":"2.0","id":3,"result":{"content":[{"type":"text","text":"<!-- ripwire whereis schema=ripwire.whereis/v1: every LOCAL ref whose tree holds sym= (refs_scanned=, blobs=), HEAD first: <hit ref= tip= date= p= l= kind= t=>. window: shown= capped= (capped=1 cut). at=: commit+dirty+shallow. next= … [line truncated: 2425 more bytes on this line] +"_index":"[index: files=4852 symbols=45032 hash=8e5a0414]","_fresh":"ok"}} +````` + +stderr: + +````` +ripwire: warning: --whereis read the newest 373 of 655 local branches; 282 older were not read (limit: 2097152 tree entries across all refs, 374 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 404 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 373 of 655 local branches; 282 older were not read (limit: 2097152 tree entries across all refs, 374 refs with HEAD at this tree's size); pass --detail=1 to read every branch, or narrow the branches with a ref-name filter +````` + +## `printf '%s\n' '{"jsonrpc":"2.0","id":1,"method":"initialize"}' '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"explore","arguments":{"path":".","task":"add a new output format flag to the CLI","budget_tokens":2000}}}' | ./build/ripwire --mcp` + +*MCP `explore` = --pack-task under a token budget, one call.* + +**wall time: 2.78s** + +````` +{"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2025-11-25","serverInfo":{"name":"ripwire","version":"0.6.10-dev.110+g914c4045d"},"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":"<ctx schema=\"ripwire.pack-task/v1\" task=\"add a new output format flag to the CLI\" route=\"subtoken+body:declined(add;218-carriers,70-defs)\" root=\".\" dropped_positive=\"2\" est_tokens=\"1432\" budget_tokens=\"2000\"><!-- ripwi … [line truncated: 3842 more bytes on this line] +"_index":"[index: files=4852 symbols=45032 hash=8e5a0414]","_fresh":"ok"}} +````` + +## `printf '%s\n' '{"jsonrpc":"2.0","id":1,"method":"initialize"}' '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"fetch_body","arguments":{"path":".","handle":"rankGraphTeleport"}}}' | ./build/ripwire --mcp` + +*MCP `fetch_body`: the lazy-body handle posture — bodies only after ranked retrieval, by bare name here.* + +**wall time: 1.60s** + +````` +{"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2025-11-25","serverInfo":{"name":"ripwire","version":"0.6.10-dev.110+g914c4045d"},"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":"{\"resolved_from_name\":\"rankGraphTeleport\",\"handle\":\"sym#cfb3dc25a9d1fa2c@e36277932d593a8b\",\"name\":\"rankGraphTeleport\",\"kind\":\"fn\",\"file\":\"src/graph.h\",\"line\":14921,\"start_line\":1,\"end_line\":29,\"total_lines … [line truncated: 1330 more bytes on this line] +"_index":"[index: files=4852 symbols=45032 hash=8e5a0414]","_fresh":"ok"}} +````` + +## `printf '%s\n' '{"jsonrpc":"2.0","id":1,"method":"initialize"}' '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"grep","arguments":{"path":".","pattern":"DISCLOSE","limit":3}}}' | ./build/ripwire --mcp` + +*MCP `grep` with paging args.* + +**wall time: 1.80s** + +````` +{"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2025-11-25","serverInfo":{"name":"ripwire","version":"0.6.10-dev.110+g914c4045d"},"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":"{\"pattern\":\"DISCLOSE\",\"root\":\".\",\"files\":292,\"shown\":3,\"capped\":true,\"total\":993,\"has_more\":true,\"next_offset\":3,\"offset\":0,\"limit\":3,\"hits_capped\":false,\"next\":\"--grep=DISCLOSE --offset=3 --legend=compa … [line truncated: 609 more bytes on this line] +{\"file\":\"src/abicheck.h\",\"line\":517,\"in\":\"abicheck::collectAuthoredSites\",\"parse_degraded\":true,\"text\":\" DISCLOSE( result, AbiResult::DisclosureWhy::NoMergeBase, \\\"abi: no merge-base for a ref (unrelated history?) — that ref is counted, not compared\\\" );\"}, +{\"file\":\"src/arch.h\",\"line\":512,\"in\":\"rw::parseArchRules\",\"text\":\" DISCLOSE( Diagnostics::answerRefused, \\\"--arch exits 1 with path:line and the reason on stderr; no report is printed\\\",\"}],\"parse_degraded_note\":\"a hit carrying parse_degraded:true sits in a file whose par … [line truncated: 465 more bytes on this line] +{\"file\":\"CMakeLists.txt\",\"line\":347}, +{\"file\":\"CMakeLists.txt\",\"line\":901}]},\"enclosing\":[{\"n\":\"path_instructions\",\"callers\":0,\"handle_omitted\":\"non-code\"}, +{\"n\":\"abicheck::collectAuthoredSites\",\"callers\":1,\"cx\":9,\"handle\":\"sym#1ab32951dcc2d860@336bb5738da2ef84\"}, +{\"n\":\"rw::parseArchRules\",\"callers\":2,\"cx\":33,\"handle\":\"sym#f5dd171cfba47899@8ee26f354c3d783f\"}]}"}], +"_index":"[index: files=4852 symbols=45032 hash=8e5a0414]","_fresh":"ok"}} +````` + +## `printf '%s\n' '{"jsonrpc":"2.0","id":1,"method":"initialize"}' '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"slice","arguments":{"path":".","symbol":"rankGraphTeleport","var":"teleport","flow":"back","depth":3}}}' | ./build/ripwire --mcp` + +*MCP `slice` — the CLI's --slice/--slice-flow/--slice-depth as one verb.* + +**wall time: 2.36s** + +````` +{"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2025-11-25","serverInfo":{"name":"ripwire","version":"0.6.10-dev.110+g914c4045d"},"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":"<!-- ripwire slice schema=ripwire.slice/v1: name-based def-use rows of one variable in one definition: <s l= k=def|use|both|scope t= [b= pp= rd=]> (rd= reaching-def lines per reach=cfg|linear), <v n= l= t=> inventory; steps=/depth= … [line truncated: 1777 more bytes on this line] +"_index":"[index: files=4852 symbols=45032 hash=8e5a0414]","_fresh":"ok"}} +````` + +## `printf '%s\n' '{"jsonrpc":"2.0","id":1,"method":"initialize"}' '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"find_symbol","arguments":{"path":".","symbol":"DoesNotExist"}}}' | ./build/ripwire --mcp` + +*MCP error shape: an unknown symbol comes back as a JSON-RPC error/refusal, not an empty success.* + +**wall time: 2.48s** + +````` +{"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2025-11-25","serverInfo":{"name":"ripwire","version":"0.6.10-dev.110+g914c4045d"},"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,"error":{"code":-32602,"message":"symbol not found: 'DoesNotExist' — pass the final name segment; add scope to disambiguate — or @FILE:LINE when you hold a location — note: the lexical definition scan stopped at its budget, 4096 files or 16 MiB, before reading every fil … [line truncated: 165 more bytes on this line] +````` + +## `printf '%s\n' '{"jsonrpc":"2.0","id":1,"method":"initialize"}' '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"batch","arguments":{"path":".","queries":[{"verb":"for","task":"incremental cache invalidation"},{"verb":"find_referencing_symbols","symbol":"rankGraphTeleport"},{"verb":"grep","pattern":"DISCLOSE","limit":2}]}}}' | ./build/ripwire --mcp` + +*MCP `batch`: three independent read queries answered in ONE round-trip — NOTE the sub-query grammar is {verb, ...args} objects with MCP verb names, not the CLI --batch file's verb:arg lines.* + +**wall time: 2.51s** + +````` +{"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2025-11-25","serverInfo":{"name":"ripwire","version":"0.6.10-dev.110+g914c4045d"},"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":"<batch schema=\"ripwire.batch/v1\" n=\"3\" requested=\"3\" cap=\"16\"><!-- ripwire batch schema=ripwire.batch/v1: n= read sub-queries in one sweep (requested=, cap=): each <q> wraps one sub-answer verbatim in CDATA. i=/verb=/ok=: su … [line truncated: 27900 more bytes on this line] +{\"name\":\"rankGraph\",\"kind\":\"fn\",\"file\":\"src/graph.h\",\"line\":14964,\"handle\":\"sym#b90da690b120eeb3@e36277932d593a8b\",\"sites_at\":[\"14968\"]}, +{\"name\":\"anchoredLexicalRank\",\"kind\":\"fn\",\"file\":\"src/graph.h\",\"line\":15633,\"handle\":\"sym#b3a5ca7873636567@e36277932d593a8b\",\"sites_at\":[\"15684\"]}, +{\"name\":\"runEval\",\"kind\":\"fn\",\"file\":\"src/eval.h\",\"line\":171,\"handle\":\"sym#358fe2cb69804698@1f9d26ff6c500240\",\"sites_at\":[\"328\"]}, +{\"name\":\"churnDecayRanking\",\"kind\":\"fn\",\"file\":\"src/main.cpp\",\"line\":1433,\"handle\":\"sym#f43b7580f05a651a@d08b788611a39f0f\",\"sites_at\":[\"1447\"]}, +{\"name\":\"churnRankedGraph\",\"kind\":\"fn\",\"file\":\"src/main.cpp\",\"line\":1472,\"handle\":\"sym#4b5b63d3932ca0ff@d08b788611a39f0f\",\"sites_at\":[\"1486\",\"1487\",\"1501\"]}, +{\"name\":\"runDefaultMap\",\"kind\":\"fn\",\"file\":\"src/main.cpp\",\"line\":1759,\"handle\":\"sym#6e2725cb96590ec8@d08b788611a39f0f\",\"sites_at\":[\"1879\"]}],\"sites_note\":\"sites_at= on a caller row: its calls of the called LEAF name, bar ones proven elsewhere, as [file:]line (space-separated … [line truncated: 1237 more bytes on this line] +{\"file\":\"src/abicheck.h\",\"line\":517,\"in\":\"abicheck::collectAuthoredSites\",\"parse_degraded\":true,\"text\":\" DISCLOSE( result, AbiResult::DisclosureWhy::NoMergeBase, \\\"abi: no merge-base for a ref (unrelated history?) — that ref is counted, not compared\\\" );\"}],\"parse_d … [line truncated: 541 more bytes on this line] +{\"file\":\"CMakeLists.txt\",\"line\":347}]},\"enclosing\":[{\"n\":\"path_instructions\",\"callers\":0,\"handle_omitted\":\"non-code\"}, +{\"n\":\"abicheck::collectAuthoredSites\",\"callers\":1,\"cx\":9,\"handle\":\"sym#1ab32951dcc2d860@336bb5738da2ef84\"}]}]]></q></batch>"}], +"_index":"[index: files=4852 symbols=45032 hash=8e5a0414]","_fresh":"ok"}} +````` + +## `printf '%s\n' '{"jsonrpc":"2.0","id":1,"method":"initialize"}' '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"batch","arguments":{"path":".","queries":["for:incremental cache invalidation","callers:rankGraphTeleport"]}}}' | ./build/ripwire --mcp` + +*The CLI --batch spelling handed to MCP `batch`: refused, with the accepted shape named.* + +**wall time: 1.93s** + +````` +{"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2025-11-25","serverInfo":{"name":"ripwire","version":"0.6.10-dev.110+g914c4045d"},"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":"<batch schema=\"ripwire.batch/v1\" n=\"2\" requested=\"2\" cap=\"16\"><!-- ripwire batch schema=ripwire.batch/v1: n= read sub-queries in one sweep (requested=, cap=): each <q> wraps one sub-answer verbatim in CDATA. i=/verb=/ok=: su … [line truncated: 27883 more bytes on this line] +{\"name\":\"rankGraph\",\"kind\":\"fn\",\"file\":\"src/graph.h\",\"line\":14964,\"handle\":\"sym#b90da690b120eeb3@e36277932d593a8b\",\"sites_at\":[\"14968\"]}, +{\"name\":\"anchoredLexicalRank\",\"kind\":\"fn\",\"file\":\"src/graph.h\",\"line\":15633,\"handle\":\"sym#b3a5ca7873636567@e36277932d593a8b\",\"sites_at\":[\"15684\"]}, +{\"name\":\"runEval\",\"kind\":\"fn\",\"file\":\"src/eval.h\",\"line\":171,\"handle\":\"sym#358fe2cb69804698@1f9d26ff6c500240\",\"sites_at\":[\"328\"]}, +{\"name\":\"churnDecayRanking\",\"kind\":\"fn\",\"file\":\"src/main.cpp\",\"line\":1433,\"handle\":\"sym#f43b7580f05a651a@d08b788611a39f0f\",\"sites_at\":[\"1447\"]}, +{\"name\":\"churnRankedGraph\",\"kind\":\"fn\",\"file\":\"src/main.cpp\",\"line\":1472,\"handle\":\"sym#4b5b63d3932ca0ff@d08b788611a39f0f\",\"sites_at\":[\"1486\",\"1487\",\"1501\"]}, +{\"name\":\"runDefaultMap\",\"kind\":\"fn\",\"file\":\"src/main.cpp\",\"line\":1759,\"handle\":\"sym#6e2725cb96590ec8@d08b788611a39f0f\",\"sites_at\":[\"1879\"]}],\"sites_note\":\"sites_at= on a caller row: its calls of the called LEAF name, bar ones proven elsewhere, as [file:]line (space-separated … [line truncated: 365 more bytes on this line] +"_index":"[index: files=4852 symbols=45032 hash=8e5a0414]","_fresh":"ok"}} +````` + +## `printf '%s\n' '{"jsonrpc":"2.0","id":1,"method":"initialize"}' '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"edit_check","arguments":{"path":".","symbol":"rankGraphTeleport"}}}' | ./build/ripwire --mcp` + +*MCP `edit_check` on a CLEAN tree.* + +**wall time: 4.92s** + +````` +{"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2025-11-25","serverInfo":{"name":"ripwire","version":"0.6.10-dev.110+g914c4045d"},"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":"<!-- ripwire edit-check schema=ripwire.edit-check/v1: sym='s contract NOW vs HEAD: status=unchanged|new-symbol|contract-change; <c n= p= incompatible=1 sites_l=> callers. counts_floor=1: every count is a FLOOR, never a total. graph_ … [line truncated: 1200 more bytes on this line] +"_index":"[index: files=4852 symbols=45032 hash=8e5a0414]","_fresh":"ok"}} +````` + +## `printf '%s\n' '{"jsonrpc":"2.0","id":1,"method":"initialize"}' '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"edit_check","arguments":{"path":".","symbol":"rankGraphTeleport","legend":"compact"}}}' | ./build/ripwire --mcp` + +*The same MCP `edit_check` with legend:"compact" — the CLI --legend=compact dialect on the MCP side (declared on the 16 XML verbs): ~5.5 KB of legend down to ~600 B, rows identical; an unknown or empty legend value is refused, never read as the default.* + +**wall time: 7.30s** + +````` +{"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2025-11-25","serverInfo":{"name":"ripwire","version":"0.6.10-dev.110+g914c4045d"},"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":"<!-- ripwire edit-check schema=ripwire.edit-check/v1: sym='s contract NOW vs HEAD: status=unchanged|new-symbol|contract-change; <c n= p= incompatible=1 sites_l=> callers. counts_floor=1: every count is a FLOOR, never a total. graph_ … [line truncated: 1200 more bytes on this line] +"_index":"[index: files=4852 symbols=45032 hash=8e5a0414]","_fresh":"ok"}} +````` + +## `printf '%s\n' '{"jsonrpc":"2.0","id":1,"method":"initialize"}' '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"nosuchverb","arguments":{"path":"."}}}' | ./build/ripwire --mcp` + +*An unknown verb name — the JSON-RPC error shape.* + +````` +{"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2025-11-25","serverInfo":{"name":"ripwire","version":"0.6.10-dev.110+g914c4045d"},"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,"error":{"code":-32602,"message":"unknown tool: 'nosuchverb' — call tools/list for the 33 available tools"}} +````` diff --git a/test/qschemetrip.hash b/test/qschemetrip.hash index 3eae000f4..af7340c97 100644 --- a/test/qschemetrip.hash +++ b/test/qschemetrip.hash @@ -1 +1 @@ -a57b75c512a18d0769a1034b24104c85ae9102a6c43c9e89a7cdee5350ee08a9 +8b4885839dab9cd966142580a2f442d5b3e53cc06ea3d856ce37236dab3727cf diff --git a/test/qschemetripcheck.sh b/test/qschemetripcheck.sh index 08d8819b8..34e13de00 100755 --- a/test/qschemetripcheck.sh +++ b/test/qschemetripcheck.sh @@ -34,6 +34,10 @@ 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-22, train ge3 (ge-runqd, qd-lessons-2-r, ge-capturetags, ge-serialize, ge-lextiers; composed on main b576a95e3): +# RE-PINNED ONCE with UPDATE_GOLDEN=1 from the composed build (hash 8b4885839d…ab3727cf). Watched text moved only by the +# qd-lessons-2 members (defectSitesOf's shell-cut counter + legacySite, logged below) on top of #715's kParserVer 337/338. +# No member bumps kParserVer, kCacheVersion (54) or kQSnapCacheScheme (38). # 2026-11-21, lane land-715 (#715 by @himanchalkaushale, #548 arm 1: Clojure calls whose list head carries metadata; stacked on # train 1118a 4b1f4516e): RE-PINNED with UPDATE_GOLDEN=1 (hash a57b75c512…5350ee08a9). Watched text: kParserVer 335 -> 337 # (rich file tag 338; the PR's 311/312 renumbered above the train's 335/336): queries/clojure/tags.scm accepts a meta_lit before a From 9683e45bd878b4a9371ff477dce89856791e02cd Mon Sep 17 00:00:00 2001 From: joyful-ii-V-I <210578314+joyful-ii-V-I@users.noreply.github.com> Date: Sun, 22 Nov 2026 06:36:30 -0500 Subject: [PATCH 35/44] test(qdentryceilingcheck): arm L reads the three-exception wording (TANGLE-GATE-B) qd-lessons-2's TANGLE-GATE-B added a third gating exception for new symbols, which turned the sentence into 'format-arity, a new function at the ceiling ... and a new one at tangle 6' (compact: 'format-arity, ceiling=, tangle'). Arm L still searched for the two-exception phrasing and found it 0 times in the full legend, the compact legend and --help=quality-delta. The phrases now match the shipped text, and the arm still requires each 'never gate, except defect-shape' occurrence to carry the ceiling exception. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --- test/qdentryceilingcheck.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/qdentryceilingcheck.sh b/test/qdentryceilingcheck.sh index 249c69e67..4f8b0de4f 100755 --- a/test/qdentryceilingcheck.sh +++ b/test/qdentryceilingcheck.sh @@ -287,9 +287,9 @@ JM="$( cd "$WORK/n4" && "$BIN" . --quality-delta --json --no-cache 2>/dev/null ) if printf '%s' "$JM" | grep -q '"origin":"moved"'; then ok "J: --json carries \"origin\":\"moved\""; else no "J: --json lacks origin moved"; fi # ═══ L) LEGEND — the exception is stated wherever the rule is ═════════════════════════════════════════ -PHRASE='new-symbol rows never gate, except defect-shape format-arity and a new function at the ceiling' +PHRASE='new-symbol rows never gate, except defect-shape format-arity, a new function at the ceiling' # TANGLE-GATE-B added a third exception after it # compact spends fewer bytes (its prose has a stair-step target): the exception names the ceiling= row it defines -CPHRASE='new-symbol rows never gate, except defect-shape format-arity or a ceiling= row' +CPHRASE='new-symbol rows never gate, except defect-shape format-arity, ceiling=' for leg in full compact; do T="$( cd "$WORK/p1" && "$BIN" . --quality-delta --no-cache --legend=$leg 2>/dev/null | tr '\n' ' ' | tr -s ' ' )" # status: output only — the L arm FAILs when the phrase count is 0 a="$( printf '%s' "$T" | grep -o 'never gate, except defect-shape' | wc -l | tr -d ' ' )" From 147c732930f6ea42d5f4c57ff6e09108302c089b Mon Sep 17 00:00:00 2001 From: joyful-ii-V-I <210578314+joyful-ii-V-I@users.noreply.github.com> Date: Sun, 22 Nov 2026 06:36:30 -0500 Subject: [PATCH 36/44] showcase: the --compress demo expands collapseBlankLineRuns (compressBody is now a one-line pipeline) ge-serialize split compressBody into stripCommentsKeepLiterals + collapseBlankLineRuns, so compressBody's own body has no comment left to strip and --compress made the demo 13 B LARGER (3459 -> 3472 B, the compress attribute): showcasecapturecheck (A) went red on the composed train. collapseBlankLineRuns shrinks 4236 -> 3984 B. The capture is re-recorded once on the tip in the next commit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --- test/showcase_capture.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/showcase_capture.py b/test/showcase_capture.py index c4b97c939..054c5c878 100644 --- a/test/showcase_capture.py +++ b/test/showcase_capture.py @@ -415,7 +415,7 @@ def add(section, cmd, what, **opts): add(S3, f"{BIN} . --outline=rankGraphTeleport:1-10 --top-k=0", "CHANGED: a line range on --outline is now STRIPPED with a stderr note (it used to refuse).") add(S3, f"{BIN} . --expand=rankGraphTeleport --top-k=0", "Full body + inline callee signatures.") add(S3, f"{BIN} . --expand=rankGraphTeleport:1-12 --top-k=0", "Body SLICE: lines 1..12 of the symbol's own body, with lines=\"lo-hi/total\" marking it partial.") -add(S3, f"{BIN} . --expand=compressBody --top-k=0 --compress", "Comments stripped + blank runs collapsed — compressBody is the function that implements --compress itself, chosen because it is comment-heavy enough to show a real reduction (the previously captioned symbol had no comments or blank runs, so before/after were byte-identical under a caption promising a difference).") +add(S3, f"{BIN} . --expand=collapseBlankLineRuns --top-k=0 --compress", "Comments stripped + blank runs collapsed — collapseBlankLineRuns is --compress's own second step (compressBody is now the one-line stripCommentsKeepLiterals-then-collapse pipeline, with nothing left to strip), chosen because it is comment-heavy enough to show a real reduction (a symbol with no comments or blank runs reads byte-identical, or a few bytes larger for the compress attribute, under a caption promising a difference).") add(S3, f"{BIN} . --expand=readAckRecords --top-k=0 --no-redact", "--no-redact: emit bodies verbatim (credential redaction is on by default).") add(S3, f"{BIN} . --pack-top-n=3 --top-k=0", "Pack the top-3 ranked symbols' full bodies (deprecated verb; see stderr).") From cbed31d4cf53e6daf15b065968e9f1feb9a17f9c Mon Sep 17 00:00:00 2001 From: joyful-ii-V-I <210578314+joyful-ii-V-I@users.noreply.github.com> Date: Sun, 22 Nov 2026 07:00:25 -0500 Subject: [PATCH 37/44] Re-record the 11-22 showcase once more on the composed tip (the --compress demo is collapseBlankLineRuns) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --- docs/COMMANDS.md | 236 ++--- docs/captures/COMMANDS_showcase_2026-11-22.md | 848 ++++++++++-------- 2 files changed, 578 insertions(+), 506 deletions(-) diff --git a/docs/COMMANDS.md b/docs/COMMANDS.md index c8ab567c2..bb62706bc 100644 --- a/docs/COMMANDS.md +++ b/docs/COMMANDS.md @@ -225,7 +225,7 @@ _Name-shaped query: the router picks name-exact BM25 (header says which/why)._ ``` $ ./build/ripwire . --for="rankGraphTeleport" -<ctx task="rankGraphTeleport" route="name-exact(rankGraphTeleport); anchors: rankGraphTeleport(src/graph.h)" root="." confidence="high" margin_pct="45" at="914c4045d" doc_mentions="2" schema="ripwire.for/v1" bundle="auto" bodies="1" doc_mentions_capped="1" doc_mentions_total="14" est_tokens="2165"> +<ctx task="rankGraphTeleport" route="name-exact(rankGraphTeleport); anchors: rankGraphTeleport(src/graph.h)" root="." confidence="high" margin_pct="45" at="147c73293" doc_mentions="2" schema="ripwire.for/v1" bundle="auto" bodies="1" doc_mentions_capped="1" doc_mentions_total="14" est_tokens="2165"> <!-- ripwire for schema=ripwire.for/v1: bundle=/bodies=/reason= the body posture; d: cx= ccx= complexity, in= callers (absent cx/ccx/in = 0), churn= amp= change, clone= tested= 1, sc= scope, id=p::sc::n; total= shown= capped=1 if cut; task= the query; d pure=1 const/constexpr sig, next= the follow-up to paste; route= name-exact(X)|subtoken+body[:broad|:declined]; confidence=/margin_pct= head score drop (low=flat); b t= n= p= l= full bodies, c n= l= p= callee signatures (p= if not b's); callers of=: the one function's 1-hop callers, s t= n= sc= p=file:line (n=Owner.name folds sc= on a member; sites_at= its calls as [file:]line, sites_total= if cut; via=name by name only), shown= of total=; d=2 rows: their callers (via=name if every path has a by-name hop), shown_d2= of d2= (d2_capped=1 if cut, else 0); capped=1 if cut; floors; next= the radius; windows=1: the radius call lists only a first page of next_total= rows (the impact verb's own count, a floor), so no page is pointed at: next= lists them all, columnar; t p= file outside sigs (weaker), t sym= its top symbols not in sigs/syms (a pointer, not the answer), r= rank (gap = trimmed); t order: code files first, then doc files (a code question); d e= its last line (absent=unknown, never 0; l= the name's line); c prov=split: a resolver split arm; may be another arm's (NOT a claim the edge is false) [doc mentions: 2 docs, 1 symbol; doc_mentions=] [floor: kept 3 of 40] --> <!-- root= is the crawl root; p= below is RELATIVE to it (single-root only; absent => p= is ingest's own path, unchanged); at=this commit(+dirty). [cut: doc_mentions_capped="1" doc_mentions_total="14" — an indexing cap dropped content not shown here] est_tokens= prices this bundle in tokens --> <sigs> @@ -262,7 +262,7 @@ _Restore the <lego>/<compose> sections the --for bundle collapses to a counted s ``` $ ./build/ripwire . --for="tree-sitter parse of a source file" --sections=lego,compose -<ctx task="tree-sitter parse of a source file" route="subtoken+body" root="." confidence="low" margin_pct="0" at="914c4045d" doc_mentions="1" schema="ripwire.for/v1" bundle="compact" bodies="0" reason="compact-route" budget_bytes="7500" est_tokens="10590"> +<ctx task="tree-sitter parse of a source file" route="subtoken+body" root="." confidence="low" margin_pct="0" at="147c73293" doc_mentions="1" schema="ripwire.for/v1" bundle="compact" bodies="0" reason="compact-route" budget_bytes="7500" est_tokens="10590"> <!-- ripwire for schema=ripwire.for/v1: bundle=/bodies=/reason= the body posture; d: cx= ccx= complexity, in= callers (absent cx/ccx/in = 0), churn= amp= change, clone= tested= 1, sc= scope, id=p::sc::n; total= shown= capped=1 if cut; task= the query; d pure=1 const/constexpr sig, next= the follow-up to paste; d same_as=N: doc+sig text as row n=N (not repeated); route= name-exact(X)|subtoken+body[:broad|:declined]; confidence=/margin_pct= head score drop (low=flat); h l= p= n=, c n= l= p= (p= if not h's; same-named joined, shown= counts them), noedge= no callee resolved; fold kind=bodies: b t= n= p= l= top ranked rows' whole bodies, not the answer; served= of total= in budget_bytes=; slice/skip p= n= l=; skip bytes= next=; a skip makes sigs next= it, sigs_next= the signatures-only re-call; d mem= an owner's direct member names only, by the index (question words first, then owner's file, path, line, name), mem_more= names cut; t p= file outside sigs (weaker), t sym= its top symbols not in sigs/syms (a pointer, not the answer), r= rank (gap = trimmed); t order: code files first, then doc files (a code question); t page rows go on to file-page row 160 (code question: 160 code rows, docs within row 160); past page 0 (code question: past 40 code rows, a doc past row 40) listed last, head files skipped; past 120 of those p= only, p_only= counts them; t folded=class=N: N p= only rows of that class (doc|config|script|testdata|other) not listed, next= pages to them; field name= type= owner= rel=: a member of owner=, rel=creates held by value, uses by reference/pointer; iface implementors=N: types implementing it, m= its method contract; d e= its last line (absent=unknown, never 0; l= the name's line) [doc mentions: 1 doc, 1 symbol; doc_mentions=] --> <!-- root= is the crawl root; p= below is RELATIVE to it (single-root only; absent => p= is ingest's own path, unchanged); at=this commit(+dirty). [budget_bytes= is the default BYTE target this ranked payload was shaped toward: row text shortens toward it, no row of the ranked head is removed for it (sigs past_target=)] [sigs capped=1 with shown=total: rows shrunk, none dropped] [sigs past_target=K: the last K rows are past the budget_bytes target, served because they are rows of the ranked head; none is cut] [sigs next=: one call serving all total= rows uncut] [docs_dropped=N: N shown rows have a doc comment not printed (r>24 always, r5..24 if capped)] [files_first=N: N rows moved so r=1..8 are distinct files' best rows, score order, a repeated name once; same rows; fold, hops keep score order]; iface implementors=N counts every type an extends/implements clause binds to it (the lego verb's count), never the rows listed: shown_implementors=K only K impl rows here (implementors_capped=1), implementors_next= lists all; implementors_floor=1 an extends clause spelled like it bound nowhere, so N may be short (not proof of another), floor_next= lists every extends site est_tokens= prices this bundle in tokens --> <sigs shown="40" total="40" capped="1" past_target="7" docs_dropped="24" files_first="7" next="--for='tree-sitter parse of a source file' --signatures-only --token-budget=5400"> @@ -289,7 +289,7 @@ _T3 opt-out: the signatures-only lens (no auto bodies, no bundle="auto" attribut ``` $ ./build/ripwire . --for="rankGraphTeleport" --signatures-only -<ctx task="rankGraphTeleport" route="name-exact(rankGraphTeleport); anchors: rankGraphTeleport(src/graph.h)" root="." confidence="high" margin_pct="45" at="914c4045d" doc_mentions="2" schema="ripwire.for/v1" doc_mentions_capped="1" doc_mentions_total="14" est_tokens="959"> +<ctx task="rankGraphTeleport" route="name-exact(rankGraphTeleport); anchors: rankGraphTeleport(src/graph.h)" root="." confidence="high" margin_pct="45" at="147c73293" doc_mentions="2" schema="ripwire.for/v1" doc_mentions_capped="1" doc_mentions_total="14" est_tokens="959"> <!-- ripwire for schema=ripwire.for/v1: bundle=/bodies=/reason= the body posture; d: cx= ccx= complexity, in= callers (absent cx/ccx/in = 0), churn= amp= change, clone= tested= 1, sc= scope, id=p::sc::n; total= shown= capped=1 if cut; task= the query; d pure=1 const/constexpr sig, next= the follow-up to paste; route= name-exact(X)|subtoken+body[:broad|:declined]; confidence=/margin_pct= head score drop (low=flat); t p= file outside sigs (weaker), t sym= its top symbols not in sigs/syms (a pointer, not the answer), r= rank (gap = trimmed); t order: code files first, then doc files (a code question); d e= its last line (absent=unknown, never 0; l= the name's line) [doc mentions: 2 docs, 1 symbol; doc_mentions=] [floor: kept 3 of 40] --> <!-- root= is the crawl root; p= below is RELATIVE to it (single-root only; absent => p= is ingest's own path, unchanged); at=this commit(+dirty). [cut: doc_mentions_capped="1" doc_mentions_total="14" — an indexing cap dropped content not shown here] est_tokens= prices this bundle in tokens --> <sigs> @@ -324,7 +324,7 @@ _Opt OUT of compact conceptual serving: restore the rank-first auto <bodies> wal ``` $ ./build/ripwire . --for="tree-sitter parse of a source file" --auto-bodies -<ctx task="tree-sitter parse of a source file" route="subtoken+body" root="." confidence="low" margin_pct="0" at="914c4045d" doc_mentions="1" schema="ripwire.for/v1" bundle="auto" bodies="5" budget_bytes="7500" est_tokens="10293"> +<ctx task="tree-sitter parse of a source file" route="subtoken+body" root="." confidence="low" margin_pct="0" at="147c73293" doc_mentions="1" schema="ripwire.for/v1" bundle="auto" bodies="5" budget_bytes="7500" est_tokens="10293"> <!-- ripwire for schema=ripwire.for/v1: bundle=/bodies=/reason= the body posture; d: cx= ccx= complexity, in= callers (absent cx/ccx/in = 0), churn= amp= change, clone= tested= 1, sc= scope, id=p::sc::n; total= shown= capped=1 if cut; task= the query; d pure=1 const/constexpr sig, next= the follow-up to paste; d same_as=N: doc+sig text as row n=N (not repeated); route= name-exact(X)|subtoken+body[:broad|:declined]; confidence=/margin_pct= head score drop (low=flat); b t= n= p= l= full bodies, c n= l= p= callee signatures (p= if not b's); t p= file outside sigs (weaker), t sym= its top symbols not in sigs/syms (a pointer, not the answer), r= rank (gap = trimmed); t order: code files first, then doc files (a code question); t page rows go on to file-page row 160 (code question: 160 code rows, docs within row 160); past page 0 (code question: past 40 code rows, a doc past row 40) listed last, head files skipped; past 120 of those p= only, p_only= counts them; t folded=class=N: N p= only rows of that class (doc|config|script|testdata|other) not listed, next= pages to them; d e= its last line (absent=unknown, never 0; l= the name's line) [doc mentions: 1 doc, 1 symbol; doc_mentions=] --> <!-- root= is the crawl root; p= below is RELATIVE to it (single-root only; absent => p= is ingest's own path, unchanged); at=this commit(+dirty). [budget_bytes= is the default BYTE target this ranked payload was shaped toward: row text shortens toward it, no row of the ranked head is removed for it (sigs past_target=)] [sigs capped=1 with shown=total: rows shrunk, none dropped] [sigs past_target=K: the last K rows are past the budget_bytes target, served because they are rows of the ranked head; none is cut] [sigs next=: one call serving all total= rows uncut] [docs_dropped=N: N shown rows have a doc comment not printed (r>24 always, r5..24 if capped)] [files_first=N: N rows moved so r=1..8 are distinct files' best rows, score order, a repeated name once; same rows; fold, hops keep score order]; lego/compose collapse to a counted stub by default (a disclosed cut): total= that section's own pre-cap row count, shown="0" capped="1" (nothing rendered here), next= names the sections=lego,compose flag that restores both sections byte-identically in one call est_tokens= prices this bundle in tokens --> <sigs shown="40" total="40" capped="1" past_target="7" docs_dropped="24" files_first="7" next="--for='tree-sitter parse of a source file' --signatures-only --token-budget=5400"> @@ -356,7 +356,7 @@ _Same query with routing forced OFF (plain subtoken+body BM25) — contrast with ``` $ ./build/ripwire . --for="rankGraphTeleport" --no-route -<ctx task="rankGraphTeleport" root="." confidence="low" margin_pct="0" at="914c4045d" doc_mentions="6" schema="ripwire.for/v1" bundle="auto" bodies="4" budget_bytes="7500" doc_mentions_capped="1" doc_mentions_total="22" est_tokens="10974"> +<ctx task="rankGraphTeleport" root="." confidence="low" margin_pct="0" at="147c73293" doc_mentions="6" schema="ripwire.for/v1" bundle="auto" bodies="4" budget_bytes="7500" doc_mentions_capped="1" doc_mentions_total="22" est_tokens="10974"> <!-- ripwire for schema=ripwire.for/v1: bundle=/bodies=/reason= the body posture; d: cx= ccx= complexity, in= callers (absent cx/ccx/in = 0), churn= amp= change, clone= tested= 1, sc= scope, id=p::sc::n; total= shown= capped=1 if cut; task= the query; d pure=1 const/constexpr sig, next= the follow-up to paste; confidence=/margin_pct= head score drop (low=flat); b t= n= p= l= full bodies, c n= l= p= callee signatures (p= if not b's); t p= file outside sigs (weaker), t sym= its top symbols not in sigs/syms (a pointer, not the answer), r= rank (gap = trimmed); t order: code files first, then doc files (a code question); t page rows go on to file-page row 160 (code question: 160 code rows, docs within row 160); past page 0 (code question: past 40 code rows, a doc past row 40) listed last, head files skipped; past 120 of those p= only, p_only= counts them; t folded=class=N: N p= only rows of that class (doc|config|script|testdata|other) not listed, next= pages to them; field name= type= owner= rel=: a member of owner=, rel=creates held by value, uses by reference/pointer; d e= its last line (absent=unknown, never 0; l= the name's line); c prov=split: a resolver split arm; may be another arm's (NOT a claim the edge is false) [doc mentions: 6 docs, 3 symbols; doc_mentions=] --> <!-- root= is the crawl root; p= below is RELATIVE to it (single-root only; absent => p= is ingest's own path, unchanged); at=this commit(+dirty). [budget_bytes= is the default BYTE target this ranked payload was shaped toward: row text shortens toward it, no row of the ranked head is removed for it (sigs past_target=)] [sigs capped=1 with shown=total: rows shrunk, none dropped] [sigs past_target=K: the last K rows are past the budget_bytes target, served because they are rows of the ranked head; none is cut] [sigs next=: one call serving all total= rows uncut] [docs_dropped=N: N shown rows have a doc comment not printed (r>24 always, r5..24 if capped)] [cut: doc_mentions_capped="1" doc_mentions_total="22" — an indexing cap dropped content not shown here] est_tokens= prices this bundle in tokens --> <sigs shown="40" total="40" capped="1" past_target="14" docs_dropped="25" next="--for=rankGraphTeleport --signatures-only --no-route --token-budget=6700"> @@ -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 -<ctx task="tree-sitter parse of a source file" route="subtoken+body" root="." confidence="low" margin_pct="0" at="914c4045d" doc_mentions="1" schema="ripwire.for/v1" bundle="compact" bodies="0" reason="compact-route" budget_bytes="7500" est_tokens="10088"> +<ctx task="tree-sitter parse of a source file" route="subtoken+body" root="." confidence="low" margin_pct="0" at="147c73293" doc_mentions="1" schema="ripwire.for/v1" bundle="compact" bodies="0" reason="compact-route" budget_bytes="7500" est_tokens="10088"> <!-- ripwire for schema=ripwire.for/v1: bundle=/bodies=/reason= the body posture; d: cx= ccx= complexity, in= callers (absent cx/ccx/in = 0), churn= amp= change, clone= tested= 1, sc= scope, id=p::sc::n; total= shown= capped=1 if cut; task= the query; d pure=1 const/constexpr sig, next= the follow-up to paste; d same_as=N: doc+sig text as row n=N (not repeated); route= name-exact(X)|subtoken+body[:broad|:declined]; confidence=/margin_pct= head score drop (low=flat); h l= p= n=, c n= l= p= (p= if not h's; same-named joined, shown= counts them), noedge= no callee resolved; fold kind=bodies: b t= n= p= l= top ranked rows' whole bodies, not the answer; served= of total= in budget_bytes=; slice/skip p= n= l=; skip bytes= next=; a skip makes sigs next= it, sigs_next= the signatures-only re-call; d mem= an owner's direct member names only, by the index (question words first, then owner's file, path, line, name), mem_more= names cut; t p= file outside sigs (weaker), t sym= its top symbols not in sigs/syms (a pointer, not the answer), r= rank (gap = trimmed); t order: code files first, then doc files (a code question); t page rows go on to file-page row 160 (code question: 160 code rows, docs within row 160); past page 0 (code question: past 40 code rows, a doc past row 40) listed last, head files skipped; past 120 of those p= only, p_only= counts them; t folded=class=N: N p= only rows of that class (doc|config|script|testdata|other) not listed, next= pages to them; d e= its last line (absent=unknown, never 0; l= the name's line) [adaptive: kept 40 of 40 - no relevance cliff (broad query saturates the score); capped at the ceiling] [doc mentions: 1 doc, 1 symbol; doc_mentions=] --> <!-- root= is the crawl root; p= below is RELATIVE to it (single-root only; absent => p= is ingest's own path, unchanged); at=this commit(+dirty). [budget_bytes= is the default BYTE target this ranked payload was shaped toward: row text shortens toward it, no row of the ranked head is removed for it (sigs past_target=)] [sigs capped=1 with shown=total: rows shrunk, none dropped] [sigs past_target=K: the last K rows are past the budget_bytes target, served because they are rows of the ranked head; none is cut] [sigs next=: one call serving all total= rows uncut] [docs_dropped=N: N shown rows have a doc comment not printed (r>24 always, r5..24 if capped)] [files_first=N: N rows moved so r=1..8 are distinct files' best rows, score order, a repeated name once; same rows; fold, hops keep score order]; lego/compose collapse to a counted stub by default (a disclosed cut): total= that section's own pre-cap row count, shown="0" capped="1" (nothing rendered here), next= names the sections=lego,compose flag that restores both sections byte-identically in one call est_tokens= prices this bundle in tokens --> <sigs shown="40" total="40" capped="1" past_target="7" docs_dropped="24" files_first="7" next="--for='tree-sitter parse of a source file' --signatures-only --adaptive --token-budget=5400"> @@ -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 -<ctx task="why does src/lexical.h chooseForRanker pick name-exact BM25" route="subtoken+body" root="." confidence="low" margin_pct="0" at="914c4045d" doc_mentions="2" schema="ripwire.for/v1" bundle="compact" bodies="0" reason="compact-route" budget_bytes="7500" doc_mentions_capped="1" doc_mentions_t … [line truncated: 28 more bytes on this line] +<ctx task="why does src/lexical.h chooseForRanker pick name-exact BM25" route="subtoken+body" root="." confidence="low" margin_pct="0" at="147c73293" doc_mentions="2" schema="ripwire.for/v1" bundle="compact" bodies="0" reason="compact-route" budget_bytes="7500" doc_mentions_capped="1" doc_mentions_t … [line truncated: 28 more bytes on this line] <!-- ripwire for schema=ripwire.for/v1: bundle=/bodies=/reason= the body posture; d: cx= ccx= complexity, in= callers (absent cx/ccx/in = 0), churn= amp= change, clone= tested= 1, sc= scope, id=p::sc::n; total= shown= capped=1 if cut; task= the query; d pure=1 const/constexpr sig, next= the follow-up to paste; route= name-exact(X)|subtoken+body[:broad|:declined]; confidence=/margin_pct= head score drop (low=flat); h l= p= n=, c n= l= p= (p= if not h's; same-named joined, shown= counts them), noedge= no callee resolved; h qword= its name (case-folded, leading _#$@ dropped) equals that question word (by name, not resolved, not the only one), first, calls to 100 (capped=1 next= all); qword_cut= owners not so served, next= the first; fold kind=bodies: b t= n= p= l= top ranked rows' whole bodies, not the answer; served= of total= in budget_bytes=; slice/skip p= n= l=; skip bytes= next=; a skip makes sigs next= it, sigs_next= the signatures-only re-call; t p= file outside sigs (weaker), t sym= its top symbols not in sigs/syms (a pointer, not the answer), r= rank (gap = trimmed); t tsym= up to 2 more file symbols named by a task word (a name match); t order: code files first, then doc files (a code question); t page rows go on to file-page row 160 (code question: 160 code rows, docs within row 160); past page 0 (code question: past 40 code rows, a doc past row 40) listed last, head files skipped; past 120 of those p= only, p_only= counts them; t folded=class=N: N p= only rows of that class (doc|config|script|testdata|other) not listed, next= pages to them; d layer=: built-in arch layer (game|infra|render|math|audio|ai|test) from a dir name in p=; d e= its last line (absent=unknown, never 0; l= the name's line); c prov=split: a resolver split arm; may be another arm's (NOT a claim the edge is false) [doc mentions: 2 docs, 1 symbol; doc_mentions=] --> <!-- root= is the crawl root; p= below is RELATIVE to it (single-root only; absent => p= is ingest's own path, unchanged); at=this commit(+dirty). [budget_bytes= is the default BYTE target this ranked payload was shaped toward: row text shortens toward it, no row of the ranked head is removed for it (sigs past_target=)] [sigs capped=1 with shown=total: rows shrunk, none dropped] [sigs past_target=K: the last K rows are past the budget_bytes target, served because they are rows of the ranked head; none is cut] [sigs sigs_next=: one call serving all total= rows uncut] [docs_dropped=N: N shown rows have a doc comment not printed (r>24 always, r5..24 if capped)] [cut: doc_mentions_capped="1" doc_mentions_total="3" — an indexing cap dropped content not shown here]; lego/compose collapse to a counted stub by default (a disclosed cut): total= that section's own pre-cap row count, shown="0" capped="1" (nothing rendered here), next= names the sections=lego,compose flag that restores both sections byte-identically in one call est_tokens= prices this bundle in tokens --> <sigs shown="40" total="40" capped="1" past_target="14" docs_dropped="30" sigs_next="--for='why does src/lexical.h chooseForRanker pick name-exact BM25' --signatures-only --no-mention-boost --token-budget=6400" next="--expand=src/eval.h:716:runEvalRetrieval"> @@ -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 -<ctx task="quality delta acks ledger rubber stamp" route="subtoken+body" root="." confidence="low" margin_pct="0" at="914c4045d" schema="ripwire.for/v1" bundle="compact" bodies="0" reason="compact-route" budget_bytes="7500" est_tokens="11923"> +<ctx task="quality delta acks ledger rubber stamp" route="subtoken+body" root="." confidence="low" margin_pct="0" at="147c73293" schema="ripwire.for/v1" bundle="compact" bodies="0" reason="compact-route" budget_bytes="7500" est_tokens="11923"> <!-- ripwire for schema=ripwire.for/v1: bundle=/bodies=/reason= the body posture; d: cx= ccx= complexity, in= callers (absent cx/ccx/in = 0), churn= amp= change, clone= tested= 1, sc= scope, id=p::sc::n; total= shown= capped=1 if cut; task= the query; d pure=1 const/constexpr sig, next= the follow-up to paste; route= name-exact(X)|subtoken+body[:broad|:declined]; confidence=/margin_pct= head score drop (low=flat); h l= p= n=, c n= l= p= (p= if not h's; same-named joined, shown= counts them), noedge= no callee resolved; h calls capped=1 next= the call listing every callee; fold kind=bodies: b t= n= p= l= top ranked rows' whole bodies, not the answer; served= of total= in budget_bytes=; slice/skip p= n= l=; skip bytes= next=; a skip makes sigs next= it, sigs_next= the signatures-only re-call; d mem= an owner's direct member names only, by the index (question words first, then owner's file, path, line, name), mem_more= names cut; t p= file outside sigs (weaker), t sym= its top symbols not in sigs/syms (a pointer, not the answer), r= rank (gap = trimmed); t order: code files first, then doc files (a code question); t page rows go on to file-page row 160 (code question: 160 code rows, docs within row 160); past page 0 (code question: past 40 code rows, a doc past row 40) listed last, head files skipped; past 120 of those p= only, p_only= counts them; t folded=class=N: N p= only rows of that class (doc|config|script|testdata|other) not listed, next= pages to them; d e= its last line (absent=unknown, never 0; l= the name's line); c prov=split: a resolver split arm; may be another arm's (NOT a claim the edge is false) --> <!-- root= is the crawl root; p= below is RELATIVE to it (single-root only; absent => p= is ingest's own path, unchanged); at=this commit(+dirty). [budget_bytes= is the default BYTE target this ranked payload was shaped toward: row text shortens toward it, no row of the ranked head is removed for it (sigs past_target=)] [sigs capped=1 with shown=total: rows shrunk, none dropped] [sigs past_target=K: the last K rows are past the budget_bytes target, served because they are rows of the ranked head; none is cut] [sigs sigs_next=: one call serving all total= rows uncut] [docs_dropped=N: N shown rows have a doc comment not printed (r>24 always, r5..24 if capped)] [files_first=N: N rows moved so r=1..8 are distinct files' best rows, score order, a repeated name once; same rows; fold, hops keep score order]; lego/compose collapse to a counted stub by default (a disclosed cut): total= that section's own pre-cap row count, shown="0" capped="1" (nothing rendered here), next= names the sections=lego,compose flag that restores both sections byte-identically in one call est_tokens= prices this bundle in tokens --> <sigs shown="40" total="40" capped="1" past_target="12" docs_dropped="27" files_first="38" sigs_next="--for='quality delta acks ledger rubber stamp' --signatures-only --no-doc-mention --token-budget=6300" next="--expand=src/verbs_quality.h:2776:refuseUnmatchedAckOnly"> @@ -540,7 +540,7 @@ _Most relevant DOCS' full bodies (markdown only) — recall what is already writ $ ./build/ripwire . --recall="quality delta gating exit codes" ripwire recall — "quality delta gating exit codes" — 146 relevant of 359 document files, best-first — total=146 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 21.925) ━━ [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.928) ━━ [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. @@ -603,20 +603,25 @@ and both are yours, because the file you write is the only thing that sets them: **Try it** -_The directory-as-knowledge-base pattern: --recall pointed at a 1503096-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 1502787-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._ ``` $ ./build/ripwire <scratch>/aux/kbcorpus --recall="field affinity cache line data layout which fields are read together" --top-k=3 --max-tokens=1200 -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 +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 33.748) ━━ [sections: 1 of 166 selected (196 in doc), section-granular; whole doc 639182 B; lines="3910-3914"; dropped_by_budget=165] [truncated: 1865 of 7797 bytes] -### `--field-affinity[=STRUCT]` +━━ commands.md (relevance 36.185) ━━ [sections: 1 of 166 selected (196 in doc), section-granular; whole doc 639729 B; lines="566-591"; dropped_by_budget=165] [truncated: 1854 of 4284 bytes] +#### Pattern: a directory of dumped tool output as a knowledge base -**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. +**Answers:** can `--recall` serve as a zero-setup knowledge base over dumped tool output — a +`git log`, an API response dump, a fetched doc, `<tool> --help` text — sitting in a scratch +directory, instead of a source repo? -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] +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: -(capped: 1 of 2 relevant document files omitted — raise --max-tokens/budget_tokens or narrow the query for 1 more (~2548-byte budget)) +... [17 more line(s); run it to see the whole thing] ``` ### `--tree` @@ -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: 914c4045d +at: 147c73293 (0 changed files — working tree is clean, nothing to analyze) ``` @@ -1207,18 +1212,18 @@ _The continuation packet for the NEXT session: <verified> disk truth (branch/sha ``` $ ./build/ripwire . --handoff <!-- ripwire handoff schema=ripwire.handoff/v1: continuation packet for the NEXT session: <verified changed= blast_files=>, <tests n=>, <heuristic n= candidates=>, <note>, <doc p=>. window: capped= (capped=1 cut). est_tokens=: price as emitted (an upper bound under compact). at=: commit+dirty+shallow. root=: p= relative to it. branch=/subject=: the checked out branch and HEAD commit subject; gitok=0: the git diff probe failed, changed counts are floors. cochange_window=/cochange_commits=: the git window the cochange rows were mined in and the commits it held (0: could not look). doc s=: lexical score of that plan/design doc for the branch+subject query. note target=/txt=: a committed notes row on this work (symbol id or path) and its text; a suggestion. --> -<handoff schema="ripwire.handoff/v1" at="914c4045d" root="." branch="integration/train-ge3" subject="showcase: the 11-20 capture stays main's; the train re-records once at its tip" gitok="1" est_tokens="889"> +<handoff schema="ripwire.handoff/v1" at="147c73293" root="." branch="integration/train-ge3" subject="showcase: the --compress demo expands collapseBlankLineRuns (compressBody is now a one-line pipeline)" gitok="1" est_tokens="883"> <verified changed="0" blast_files="0"> <tests n="0"> </tests> </verified> -<heuristic n="6" candidates="345" capped="1" cochange_window="18mo@HEAD" cochange_commits="8003"> +<heuristic n="6" candidates="349" capped="1" cochange_window="18mo@HEAD" cochange_commits="8006"> <note target="src/infra/Diagnostics.h" txt="ASSUME_NO_ALIAS is an optimizer fact in release (separate_storage) only where the compiler consumes it: clang 18+ by default, LLVM 17/AppleClang 16 via the CMake -mllvm flag (scalars only), GCC never (debug check only); never on two members of one object; … [line truncated: 57 more bytes on this line] <note target="test/manifestcheck.sh" txt="README.md's single '<N> gate scripts' claim (~line 1305) is NOT enforced — the derived-vs-stated sibling loop here covers docs/EVALS.md only. It drifted 407→451 unnoticed (fixed 2026-08-23). To close: grep both files ('file:line … [line truncated: 47 more bytes on this line] -<doc p="CHANGELOG.md" s="13.474"/> -<doc p="docs/EVALS.md" s="10.567"/> -<doc p="bench/locbench/results/r1cpp_anchorhop/GATE_DECISION_r1cpp.md" s="9.495"/> -<doc p="bench/locbench/results/vt2_pooling_freestat/FREESTAT.md" s="9.337"/> +<doc p="docs/COMMANDS.md" s="19.369"/> +<doc p="skills/ripwire-orient/compress-ladder.md" s="12.737"/> +<doc p="skills/CONSOLIDATION.md" s="11.351"/> +<doc p="skills/ripwire-orient/SKILL.md" s="9.292"/> </heuristic> ... [1 more line(s); run it to see the whole thing] ``` @@ -1542,11 +1547,11 @@ $ ./build/ripwire . --query="teleport pagerank" --top-k=5 <!-- files=4852 symbols=45031 edges=45381 shown=5 est_tokens=1513 ambiguous=3984 unresolved=20100 locality_pinned=14 external=12460 declined=45307 extent_suspect_syms=12 macro_blanked_files=7 skipped_oversize=15 unindexed="txt:85,tsv:54,mod:33,xml:33,jsonl:26,scm:25" unindexed_exts=23 order=important-first --> <r schema="ripwire.query/v1" root="." est_tokens="1513"> <f p="src/serialize.h"> -<s t="var" n="kChurnRankLegend" sc="rw" k="19.7955"> +<s t="var" n="kChurnRankLegend" sc="rw" k="19.7957"> </s> </f> <f p="src/mcpverbs.h"> -<s t="fn" n="rankByText" sc="rw" k="15.5254"> +<s t="fn" n="rankByText" sc="rw" k="15.5257"> <c n="takeRank"/> ... [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 -<ctx task="pagerank power iteration" route="subtoken+body" root="." confidence="high" margin_pct="22" at="914c4045d" doc_mentions="4" schema="ripwire.for/v1" budget_bytes="7500" doc_mentions_capped="1" doc_mentions_total="14" est_tokens="7389"> +<ctx task="pagerank power iteration" route="subtoken+body" root="." confidence="high" margin_pct="22" at="147c73293" doc_mentions="4" schema="ripwire.for/v1" budget_bytes="7500" doc_mentions_capped="1" doc_mentions_total="14" est_tokens="7389"> <!-- ripwire for schema=ripwire.for/v1: bundle=/bodies=/reason= the body posture; d: cx= ccx= complexity, in= callers (absent cx/ccx/in = 0), churn= amp= change, clone= tested= 1, sc= scope, id=p::sc::n; total= shown= capped=1 if cut; task= the query; d pure=1 const/constexpr sig, next= the follow-up to paste; d same_as=N: doc+sig text as row n=N (not repeated); route= name-exact(X)|subtoken+body[:broad|:declined]; confidence=/margin_pct= head score drop (low=flat); t p= file outside sigs (weaker), t sym= its top symbols not in sigs/syms (a pointer, not the answer), r= rank (gap = trimmed); t tsym= up to 2 more file symbols named by a task word (a name match); t order: code files first, then doc files (a code question); t page rows go on to file-page row 160 (code question: 160 code rows, docs within row 160); past page 0 (code question: past 40 code rows, a doc past row 40) listed last, head files skipped; past 120 of those p= only, p_only= counts them; t folded=class=N: N p= only rows of that class (doc|config|script|testdata|other) not listed, next= pages to them; d layer=: built-in arch layer (game|infra|render|math|audio|ai|test) from a dir name in p=; d e= its last line (absent=unknown, never 0; l= the name's line) [doc mentions: 4 docs, 2 symbols; doc_mentions=] --> <!-- root= is the crawl root; p= below is RELATIVE to it (single-root only; absent => p= is ingest's own path, unchanged); at=this commit(+dirty). [budget_bytes= is the default BYTE target this ranked payload was shaped toward: row text shortens toward it, no row of the ranked head is removed for it (sigs past_target=)] [sigs capped=1 with shown=total: rows shrunk, none dropped] [sigs past_target=K: the last K rows are past the budget_bytes target, served because they are rows of the ranked head; none is cut] [sigs next=: one call serving all total= rows uncut] [docs_dropped=N: N shown rows have a doc comment not printed (r>24 always, r5..24 if capped)] [docs_after_code=N: N doc rows of the shown set moved below its code rows; same rows, reordered, none added or removed; a question naming docs keeps score order] [files_first=N: N rows moved so r=1..8 are distinct files' best rows, score order, a repeated name once; same rows; fold, hops keep score order] [cut: doc_mentions_capped="1" doc_mentions_total="14" — an indexing cap dropped content not shown here]; lego/compose collapse to a counted stub by default (a disclosed cut): total= that section's own pre-cap row count, shown="0" capped="1" (nothing rendered here), next= names the sections=lego,compose flag that restores both sections byte-identically in one call est_tokens= prices this bundle in tokens --> <sigs shown="40" total="40" capped="1" past_target="14" docs_dropped="25" docs_after_code="5" files_first="7" next="--for='pagerank power iteration' --signatures-only --token-budget=6200"> @@ -1695,19 +1700,25 @@ Disclosed per bundle as compress="1" on the <bodies> element; without the flag, **Try it** -_Comments stripped + blank runs collapsed — compressBody is the function that implements --compress itself, chosen because it is comment-heavy enough to show a real reduction (the previously captioned symbol had no comments or blank runs, so before/after were byte-identical under a caption promising a difference)._ +_Comments stripped + blank runs collapsed — collapseBlankLineRuns is --compress's own second step (compressBody is now the one-line stripCommentsKeepLiterals-then-collapse pipeline, with nothing left to strip), chosen because it is comment-heavy enough to show a real reduction (a symbol with no comments or blank runs reads byte-identical, or a few bytes larger for the compress attribute, under a caption promising a difference)._ ``` -$ ./build/ripwire . --expand=compressBody --top-k=0 --compress -<ctx schema="ripwire.expand/v1" root="." est_tokens="906"> +$ ./build/ripwire . --expand=collapseBlankLineRuns --top-k=0 --compress +<ctx schema="ripwire.expand/v1" root="." est_tokens="1040"> <!-- ripwire expand schema=ripwire.expand/v1: full bodies: <bodies shown= total= capped=> of <b t= l= p= n= sibs= sibs_total= sibs_capped= inc=>; <calls> <c n= l= p=> 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. inc_total=N: the file's true include/import count; inc= lists the first 2 … [line truncated: 200 more bytes on this line] <bodies shown="1" total="1" capped="0" compress="1"> -<b t="fn" l="5212" p="src/serialize.h" n="compressBody" sibs="<file-scope>,xmlSafeByte,xmlScrubIsLossy,xmlControlCharRef,eraseAbsentClause,spliceClauseAfter,kXmlEscapeByteset,escapeXml,kMultiRootTableLegend,multiRootTableLegend,xmlCommentText,ctxRootOpen,ctxRootOpenParts,ctxRootJsonScrubKeys,c … [line truncated: 2003 more bytes on this line] -<![CDATA[inline std::string compressBody( std::string_view src ) +<b t="fn" l="5179" p="src/serialize.h" n="collapseBlankLineRuns" sibs="<file-scope>,xmlSafeByte,xmlScrubIsLossy,xmlControlCharRef,eraseAbsentClause,spliceClauseAfter,kXmlEscapeByteset,escapeXml,kMultiRootTableLegend,multiRootTableLegend,xmlCommentText,ctxRootOpen,ctxRootOpenParts,ctxRootJsonSc … [line truncated: 2012 more bytes on this line] +<![CDATA[inline std::string collapseBlankLineRuns( std::string_view text ) { - return collapseBlankLineRuns( stripCommentsKeepLiterals( src ) ); -}]]><calls total="2"><c n="stripCommentsKeepLiterals" l="5140">inline std::string stripCommentsKeepLiterals( std::string_view src )</c><c n="collapseBlankLineRuns" l="5179">inline std::string collapseBlankLineRuns( std::string_view text )</c></calls></b></bodies></ctx> + std::string result; + result.reserve( text.size() ); + std::size_t blanks = 0; + std::size_t pos = 0; + while( pos < text.size() ) + { + const std::size_t eol = std::min( text.find( '\n', pos ), text.size() ); +... [23 more line(s); run it to see the whole thing] ``` **Shaped by:** `--for` @@ -1869,7 +1880,7 @@ _Complexity x recent git churn (maintenance pain)._ $ ./build/ripwire . --hotspots <!-- ripwire hotspots schema=ripwire.hotspots/v1: maintenance pain = churn x ccx over window=: <f p= churn= ccx= score= top= top_ccx= top_l=>; unranked_*= no churn/complexity. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). at=: commit+dirty+shallow. root=: p= relative to it. files=/ranked=: files in the window / those with both churn and complexity; ranked + unranked_no_churn + unranked_no_complexity = files. unranked_no_churn=/unranked_no_complexity=: files left out for no commit in window= / no measured complexity. --> <!-- extent_suspect_syms=K on a row = K of the file's functions failed an extent/scope containment check (the map, the bundles and the skipped verb mark each one, reasons and all) and are LEFT OUT of that row's ccx=, score= and top=, so its ccx= is a FLOOR of the file's true sum rather than a total. unranked_extent_suspect= counts files with commits whose every scorable function was left out that way (or whose trusted remainder scores 0), so ranked= + unranked_no_churn= + unranked_no_complexity= + unranked_extent_suspect= = files= exactly. Absent = nothing excluded. --> -<hotspots schema="ripwire.hotspots/v1" window="12mo@HEAD" files="4852" ranked="1122" unranked_no_churn="0" unranked_no_complexity="3728" unranked_extent_suspect="2" shown="40" capped="1" total="1122" has_more="1" next_offset="40" offset="0" limit="0" root="." at="914c4045d"> +<hotspots schema="ripwire.hotspots/v1" window="12mo@HEAD" files="4852" ranked="1122" unranked_no_churn="0" unranked_no_complexity="3728" unranked_extent_suspect="2" shown="40" capped="1" total="1122" has_more="1" next_offset="40" offset="0" limit="0" root="." at="147c73293"> <f p="src/graph.h" churn="732" ccx="6723" score="4921236" top="buildGraph" top_ccx="1979" top_l="10846"/> <f p="src/quality.h" churn="693" ccx="2657" score="1841301" top="computeDelta" top_ccx="318" top_l="12009"/> <f p="src/serialize.h" churn="521" ccx="2407" score="1254047" top="packSignatures" top_ccx="235" top_l="6525"/> @@ -2095,7 +2106,7 @@ _Score the naming-* rules against this repo's own rename history: proxy=old/(old ``` $ ./build/ripwire . --naming-calibration <!-- ripwire naming-calibration schema=ripwire.naming-calibration/v1: naming lint rules scored against this repo's OWN rename history (a noisy proxy): <r n= old= new= fired= proxy=>. at=: commit+dirty+shallow. probed=0: no history to mine, nothing scored (r= says why); 1 = the git walk ran. pairs=N: labelled rename pairs that survived the join, the SAMPLE SIZE; a small one means nothing. candidates=N: raw substitutions mined from the patch stream before the join; FLOOR when truncated=1. commits=N: non-merge commits walked (the walk stops at 40000). hunks=N: diff hunks with content on both sides. wide_hunks=N: hunks DROPPED for exceeding the 24-line per-side pairing cap; never mined. drop_old_alive=N: candidates dropped: the old spelling is still an indexed name. drop_new_absent=N: candidates dropped: the new spelling is no eligible indexed symbol at HEAD. drop_ambiguous=N: candidates dropped: a name on both sides of several (split, rework, revert). drop_old_skipped=N: candidates dropped: the lens skips the old spelling, no rule could fire. scope=group-rule: the rule judges co-visible names, which one pair cannot evidence; unscored, not 0/0. o=/n=: one labelled pair's old (abandoned) and new (chosen) spelling. sup=N: distinct hunks that showed this substitution. p at=: path:line of the symbol the pair joined to, not a commit (the root at= is). old_fires=: rules that fired on the old spelling; absent when none. new_fires=: rules that fired on the new spelling; absent when none. --> -<naming-calibration schema="ripwire.naming-calibration/v1" probed="1" pairs="218" candidates="3155" commits="7404" hunks="147753" wide_hunks="1597" drop_old_alive="905" drop_new_absent="1837" drop_ambiguous="195" drop_old_skipped="0" at="914c4045d"> +<naming-calibration schema="ripwire.naming-calibration/v1" probed="1" pairs="218" candidates="3156" commits="7407" hunks="147972" wide_hunks="1597" drop_old_alive="905" drop_new_absent="1838" drop_ambiguous="195" drop_old_skipped="0" at="147c73293"> <r n="naming-short" old="2" new="4" fired="6" proxy="0.333"/> <r n="naming-wordy" old="1" new="1" fired="2" proxy="0.500"/> <r n="naming-series" scope="group-rule"/> @@ -2235,16 +2246,16 @@ _Files that change together in git (hidden coupling)._ ``` $ ./build/ripwire . --cochange <!-- ripwire cochange schema=ripwire.cochange/v1: files that change together in git: <pair a= b= together= deg= conf_ab= conf_ba= surprising=>, or for of= <f p= together= conf_rev=>. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). at=: commit+dirty+shallow. root=: p= relative to it. pairs=N: file pairs with 3+ shared commits in window= (after min_recur), surprising or not. sub_windows=N: equal-commit-count slices of window=; the denominator of recur=. driver=a|b: the side whose changes best imply the other's, look there first; absent on a tie. recur=K: slices of sub_windows= the pair co-changed in; 1 = one burst, not a standing coupling. --> -<cochange schema="ripwire.cochange/v1" pairs="5714" window="18mo@HEAD" sub_windows="3" shown="30" capped="1" total="5714" has_more="1" next_offset="30" offset="0" limit="0" root="." at="914c4045d"> +<cochange schema="ripwire.cochange/v1" pairs="5714" window="18mo@HEAD" sub_windows="3" shown="30" capped="1" total="5714" has_more="1" next_offset="30" offset="0" limit="0" root="." at="147c73293"> <pair a="src/aliasdef.h" b="src/ingest_sidecap.h" together="5" deg="1.00" conf_ab="1.00" conf_ba="0.03" driver="a" recur="1" surprising="1"/> <pair a="test/headsnapcachecheck.sh" b="test/qsnapcachecheck.sh" together="5" deg="1.00" conf_ab="1.00" conf_ba="0.83" driver="a" recur="3" surprising="1"/> -<pair a="src/cli.h" b="src/handoffwindow.h" together="4" deg="1.00" conf_ab="0.01" conf_ba="1.00" driver="b" recur="1" surprising="1"/> +<pair a="src/layout.h" b="test/layoutfix/attrfields.h" together="4" deg="1.00" conf_ab="0.11" conf_ba="1.00" driver="b" recur="1" surprising="1"/> <pair a="src/main.cpp" b="src/warmsnap_model.h" together="4" deg="1.00" conf_ab="0.01" conf_ba="1.00" driver="b" recur="1" surprising="1"/> +<pair a="src/cli.h" b="src/handoffwindow.h" together="4" deg="1.00" conf_ab="0.01" conf_ba="1.00" driver="b" recur="1" surprising="1"/> <pair a="src/foraliashop.h" b="src/verbs_navigate.h" together="4" deg="1.00" conf_ab="1.00" conf_ba="0.01" driver="a" recur="1" surprising="1"/> -<pair a="src/layout.h" b="test/layoutfix/attrfields.h" together="4" deg="1.00" conf_ab="0.11" conf_ba="1.00" driver="b" recur="1" surprising="1"/> -<pair a="src/ingest_valuerefs.h" b="src/pydottedpath.h" together="3" deg="1.00" conf_ab="0.04" conf_ba="1.00" driver="b" recur="1" surprising="1"/> -<pair a="test/pincensuscheck.sh" b="test/scipjoincheck.sh" together="3" deg="1.00" conf_ab="0.38" conf_ba="1.00" driver="b" recur="2" surprising="1"/> +<pair a="test/qschemetripcheck.sh" b="test/rubyrequirecheck.sh" together="3" deg="1.00" conf_ab="0.01" conf_ba="1.00" driver="b" recur="1" surprising="1"/> <pair a="test/grepcheck.sh" b="test/grepcontextcheck.sh" together="3" deg="1.00" conf_ab="0.50" conf_ba="1.00" driver="b" recur="1" surprising="1"/> +<pair a="src/arch.h" b="test/fileset_unit.cpp" together="3" deg="1.00" conf_ab="0.07" conf_ba="1.00" driver="b" recur="1" surprising="1"/> ... [22 more line(s); run it to see the whole thing] ``` @@ -2267,16 +2278,16 @@ _Only pairs whose co-change RECURS in 2+ sub-windows of the mined window (sub_wi ``` $ ./build/ripwire . --cochange --cochange-recur=2 <!-- ripwire cochange schema=ripwire.cochange/v1: files that change together in git: <pair a= b= together= deg= conf_ab= conf_ba= surprising=>, or for of= <f p= together= conf_rev=>. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). at=: commit+dirty+shallow. root=: p= relative to it. pairs=N: file pairs with 3+ shared commits in window= (after min_recur), surprising or not. sub_windows=N: equal-commit-count slices of window=; the denominator of recur=. driver=a|b: the side whose changes best imply the other's, look there first; absent on a tie. recur=K: slices of sub_windows= the pair co-changed in; 1 = one burst, not a standing coupling. --> -<cochange schema="ripwire.cochange/v1" pairs="3652" window="18mo@HEAD" sub_windows="3" min_recur="2" shown="30" capped="1" total="3652" has_more="1" next_offset="30" offset="0" limit="0" root="." at="914c4045d"> +<cochange schema="ripwire.cochange/v1" pairs="3654" window="18mo@HEAD" sub_windows="3" min_recur="2" shown="30" capped="1" total="3654" has_more="1" next_offset="30" offset="0" limit="0" root="." at="147c73293"> <pair a="test/headsnapcachecheck.sh" b="test/qsnapcachecheck.sh" together="5" deg="1.00" conf_ab="1.00" conf_ba="0.83" driver="a" recur="3" surprising="1"/> +<pair a="test/mcpslicecheck.sh" b="test/mcpverbscheck.sh" together="3" deg="1.00" conf_ab="1.00" conf_ba="0.16" driver="a" recur="2" surprising="1"/> <pair a="src/binstale.h" b="src/crossref.h" together="3" deg="1.00" conf_ab="1.00" conf_ba="0.03" driver="a" recur="2" surprising="1"/> -<pair a="bench/scip_match_diag.py" b="bench/scip_pin_precision.py" together="3" deg="1.00" conf_ab="1.00" conf_ba="0.60" driver="a" recur="2" surprising="1"/> <pair a="test/cachesplitcheck.sh" b="test/portablecachecheck.sh" together="3" deg="1.00" conf_ab="0.75" conf_ba="1.00" driver="b" recur="3" surprising="1"/> -<pair a="test/mcpslicecheck.sh" b="test/mcpverbscheck.sh" together="3" deg="1.00" conf_ab="1.00" conf_ba="0.16" driver="a" recur="2" surprising="1"/> +<pair a="bench/scip_match_diag.py" b="bench/scip_pin_precision.py" together="3" deg="1.00" conf_ab="1.00" conf_ba="0.60" driver="a" recur="2" surprising="1"/> +<pair a="test/pincensuscheck.sh" b="test/scipjoincheck.sh" together="3" deg="1.00" conf_ab="0.38" conf_ba="1.00" driver="b" recur="2" surprising="1"/> +<pair a="test/gatecountcheck.sh" b="test/regression.sh" together="3" deg="1.00" conf_ab="1.00" conf_ba="0.00" driver="a" recur="2" surprising="1"/> <pair a="test/elixircheck.sh" b="test/elixirsemanticcheck.sh" together="3" deg="1.00" conf_ab="0.13" conf_ba="1.00" driver="b" recur="2" surprising="1"/> <pair a="test/gatecountcheck.sh" b="test/manifestcheck.sh" together="3" deg="1.00" conf_ab="1.00" conf_ba="0.23" driver="a" recur="2" surprising="1"/> -<pair a="test/pincensuscheck.sh" b="test/scipjoincheck.sh" together="3" deg="1.00" conf_ab="0.38" conf_ba="1.00" driver="b" recur="2" surprising="1"/> -<pair a="test/luacheck.sh" b="test/phpcheck.sh" together="3" deg="1.00" conf_ab="0.75" conf_ba="1.00" driver="b" recur="2" surprising="1"/> ... [22 more line(s); run it to see the whole thing] ``` @@ -2293,7 +2304,7 @@ _Modularity-violation GROUPS instead of pairs: "X co-changes with {A,B,C}, none ``` $ ./build/ripwire . --cochange --cochange-groups <!-- ripwire cochange schema=ripwire.cochange/v1: files that change together in git: <pair a= b= together= deg= conf_ab= conf_ba= surprising=>, or for of= <f p= together= conf_rev=>. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). no_file_edges=LANGS: this build resolves almost none of these languages' imports to files (Go only across go.mod replace); counts over them (ca/ce and violations= of the arch verb) are floors over the resolved edges only, and a coupling number absent beside it is unknown, not zero. unknown_pairs=N: pairs left out of groups= because surprising= is unknown for them, not 0; drop the cochange-groups flag to list them. at=: commit+dirty+shallow. root=: p= relative to it. sub_windows=N: equal-commit-count slices of window=; the denominator of recur=. recur=K: slices of sub_windows= the pair co-changed in; 1 = one burst, not a standing coupling. no_file_edges=LANGS: with unknown_pairs=N, pairs whose side imports are almost never resolved to files and none links them are in no group; groups= may be low. --> -<cochange schema="ripwire.cochange/v1" groups="159" pairs_covered="1313" cover="greedy" window="18mo@HEAD" sub_windows="3" no_file_edges="java" unknown_pairs="1" shown="30" capped="1" total="159" has_more="1" next_offset="30" offset="0" limit="0" root="." at="914c4045d"> +<cochange schema="ripwire.cochange/v1" groups="159" pairs_covered="1313" cover="greedy" window="18mo@HEAD" sub_windows="3" no_file_edges="java" unknown_pairs="1" shown="30" capped="1" total="159" has_more="1" next_offset="30" offset="0" limit="0" root="." at="147c73293"> <group core="src/cli.h" partners="84"> <f p="src/abicheck.h" together="5" recur="3" conf_core="0.01"/> <f p="src/arch.h" together="7" recur="3" conf_core="0.01"/> @@ -2322,12 +2333,12 @@ _Hotspots scoped to RECENT churn (the regression lens)._ ``` $ ./build/ripwire . --hotspots --since="2 weeks ago" <!-- ripwire hotspots schema=ripwire.hotspots/v1: maintenance pain = churn x ccx over window=: <f p= churn= ccx= score= top= top_ccx= top_l=>; unranked_*= no churn/complexity. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). at=: commit+dirty+shallow. root=: p= relative to it. files=/ranked=: files in the window / those with both churn and complexity; ranked + unranked_no_churn + unranked_no_complexity = files. unranked_no_churn=/unranked_no_complexity=: files left out for no commit in window= / no measured complexity. --> -<hotspots schema="ripwire.hotspots/v1" window="2 weeks ago" files="4852" ranked="440" unranked_no_churn="3966" unranked_no_complexity="446" shown="40" capped="1" total="440" has_more="1" next_offset="40" offset="0" limit="0" root="." at="914c4045d"> +<hotspots schema="ripwire.hotspots/v1" window="2 weeks ago" files="4852" ranked="439" unranked_no_churn="3967" unranked_no_complexity="446" shown="40" capped="1" total="439" has_more="1" next_offset="40" offset="0" limit="0" root="." at="147c73293"> <f p="src/graph.h" churn="123" ccx="6723" score="826929" top="buildGraph" top_ccx="1979" top_l="10846"/> <f p="src/quality.h" churn="106" ccx="2657" score="281642" top="computeDelta" top_ccx="318" top_l="12009"/> -<f p="src/mcpverbs.h" churn="98" ccx="1369" score="134162" top="runBatchSub" top_ccx="142" top_l="6335"/> -<f p="src/serialize.h" churn="54" ccx="2407" score="129978" top="packSignatures" top_ccx="235" top_l="6525"/> -<f p="src/verbs_for.h" churn="76" ccx="1358" score="103208" top="runForLensPass" top_ccx="706" top_l="3606"/> +<f p="src/mcpverbs.h" churn="97" ccx="1369" score="132793" top="runBatchSub" top_ccx="142" top_l="6335"/> +<f p="src/serialize.h" churn="52" ccx="2407" score="125164" top="packSignatures" top_ccx="235" top_l="6525"/> +<f p="src/verbs_for.h" churn="75" ccx="1358" score="101850" top="runForLensPass" top_ccx="706" top_l="3606"/> <f p="src/resolve.h" churn="29" ccx="2566" score="74414" top="buildPreciseIncludeAdjWithContext" top_ccx="103" top_l="5588"/> <f p="src/main.cpp" churn="45" ccx="1372" score="61740" top="dispatchMainBody" top_ccx="513" top_l="4711"/> <f p="src/cli.h" churn="81" ccx="682" score="55242" top="parseArgs" top_ccx="214" top_l="5740"/> @@ -2849,7 +2860,7 @@ _Bus-factor: recency-weighted author ownership per file._ ``` $ ./build/ripwire . --owners <!-- ripwire owners schema=ripwire.owners/v1: recency-weighted author ownership (half-life 6mo): <f p= authors= bf= top= share=>; bf=1 = one person holds it. at=: commit+dirty+shallow. root=: p= relative to it. files=N: files analysed. files=N: single-author files folded into this one row; detail=1 lists each. --> -<owners schema="ripwire.owners/v1" files="4852" root="." at="914c4045d"> +<owners schema="ripwire.owners/v1" files="4852" root="." at="147c73293"> <uniform authors="1" bf="1" share="1.00" files="3755"/> <f p=".coderabbit.yaml" authors="2" bf="0" top="<author>" share="0.59"/> <f p=".github/pargates-shard-weights.json" authors="3" bf="0" top="<author>" share="0.49"/> @@ -2956,7 +2967,7 @@ _The same run, the same clone, the folded rows printed back: each stale acknowle ``` $ ./build/ripwire . --quality-delta --show-stale <!-- ripwire quality-delta schema=ripwire.quality-delta/v1: only what the change made WORSE vs baseline=: regressions= minor= gating=; <r kind= sym= p= was= now= gating= bar=>, <sa> acked. value-ref-excluded=N: internal functions kept off because a table, field or argument in another function or at file scope holds them (matched by name, not a proven call); a floor. at=: commit+dirty+shallow. stale=N: ack ledger rows whose target no longer applies (sa rows); never gating. preexisting-worse=N: regressions on symbols that existed at baseline; they gate when major. new-symbol=N: NEW code; new-symbol rows never gate, except defect-shape format-arity, ceiling=, tangle. register-macro-excluded=N: symbols skipped: self-registering test/bench macros or Rust #[test]; a floor. declined-call-excluded=N: symbols kept out of dead-code only because a declined call may mean them; a floor. api-new-surface=N: new PUBLIC symbols; a count, never gates, not in regressions=. renames=/rename_window_commits=: git rename pairs read over that many commits, to re-file baseline and acks. acked_by_rename=/acked_by_content=: acked= suppressions matched via git renames / an equal body hash. renames_window_truncated=1: history is deeper than the rename window, older renames unread. acked=N: findings suppressed by the ack ledger, listed as sa rows; never gating. sa key=/why=: the stale ack's ledger hash / target-gone (names nothing now) or finding-gone (no longer fires). --> -<quality-delta schema="ripwire.quality-delta/v1" baseline="git-HEAD" regressions="0" minor="0" acked="0" stale="203" preexisting-worse="0" new-symbol="0" gating="0" register-macro-excluded="63" api-new-surface="0" at="914c4045d+dirty" renames="68" rename_window_commits="400" acked_by_rename="0" acke … [line truncated: 99 more bytes on this line] +<quality-delta schema="ripwire.quality-delta/v1" baseline="git-HEAD" regressions="0" minor="0" acked="0" stale="203" preexisting-worse="0" new-symbol="0" gating="0" register-macro-excluded="63" api-new-surface="0" at="147c73293+dirty" renames="68" rename_window_commits="400" acked_by_rename="0" acke … [line truncated: 99 more bytes on this line] <sa kind="api-surface" key="0123456789abcdef" why="target-gone"/> <sa kind="api-surface" key="085e3d408c2c4a35" why="target-gone"/> <sa kind="api-surface" key="155d74d341a49f3c" why="target-gone"/> @@ -2985,7 +2996,7 @@ _The regression-free answer on a clone whose ledger holds stale acknowledgements ``` $ ./build/ripwire . --quality-delta <!-- ripwire quality-delta schema=ripwire.quality-delta/v1: only what the change made WORSE vs baseline=: regressions= minor= gating=; <r kind= sym= p= was= now= gating= bar=>, <sa> acked. value-ref-excluded=N: internal functions kept off because a table, field or argument in another function or at file scope holds them (matched by name, not a proven call); a floor. at=: commit+dirty+shallow. stale=N: ack ledger rows whose target no longer applies (sa rows); never gating. stale_by_kind=: stale= split by ack kind (kind:N,...); the sa rows are collapsed. stale_next=: the call printing the sa rows and the full header. preexisting-worse=N: regressions on symbols that existed at baseline; they gate when major. new-symbol=N: NEW code; new-symbol rows never gate, except defect-shape format-arity, ceiling=, tangle. register-macro-excluded=N: symbols skipped: self-registering test/bench macros or Rust #[test]; a floor. declined-call-excluded=N: symbols kept out of dead-code only because a declined call may mean them; a floor. api-new-surface=N: new PUBLIC symbols; a count, never gates, not in regressions=. renames=/rename_window_commits=: git rename pairs read over that many commits, to re-file baseline and acks. acked_by_rename=/acked_by_content=: acked= suppressions matched via git renames / an equal body hash. renames_window_truncated=1: history is deeper than the rename window, older renames unread. acked=N: findings suppressed by the ack ledger, listed as sa rows; never gating. --> -<quality-delta schema="ripwire.quality-delta/v1" baseline="git-HEAD" regressions="0" minor="0" acked="0" stale="203" preexisting-worse="0" new-symbol="0" gating="0" register-macro-excluded="63" api-new-surface="0" at="914c4045d+dirty" renames="68" rename_window_commits="400" acked_by_rename="0" acke … [line truncated: 298 more bytes on this line] +<quality-delta schema="ripwire.quality-delta/v1" baseline="git-HEAD" regressions="0" minor="0" acked="0" stale="203" preexisting-worse="0" new-symbol="0" gating="0" register-macro-excluded="63" api-new-surface="0" at="147c73293+dirty" renames="68" rename_window_commits="400" acked_by_rename="0" acke … [line truncated: 298 more bytes on this line] </quality-delta> ``` @@ -3010,7 +3021,7 @@ _The regression-free answer on a clone whose ledger holds stale acknowledgements ``` $ ./build/ripwire . --quality-delta <!-- ripwire quality-delta schema=ripwire.quality-delta/v1: only what the change made WORSE vs baseline=: regressions= minor= gating=; <r kind= sym= p= was= now= gating= bar=>, <sa> acked. value-ref-excluded=N: internal functions kept off because a table, field or argument in another function or at file scope holds them (matched by name, not a proven call); a floor. at=: commit+dirty+shallow. stale=N: ack ledger rows whose target no longer applies (sa rows); never gating. stale_by_kind=: stale= split by ack kind (kind:N,...); the sa rows are collapsed. stale_next=: the call printing the sa rows and the full header. preexisting-worse=N: regressions on symbols that existed at baseline; they gate when major. new-symbol=N: NEW code; new-symbol rows never gate, except defect-shape format-arity, ceiling=, tangle. register-macro-excluded=N: symbols skipped: self-registering test/bench macros or Rust #[test]; a floor. declined-call-excluded=N: symbols kept out of dead-code only because a declined call may mean them; a floor. api-new-surface=N: new PUBLIC symbols; a count, never gates, not in regressions=. renames=/rename_window_commits=: git rename pairs read over that many commits, to re-file baseline and acks. acked_by_rename=/acked_by_content=: acked= suppressions matched via git renames / an equal body hash. renames_window_truncated=1: history is deeper than the rename window, older renames unread. acked=N: findings suppressed by the ack ledger, listed as sa rows; never gating. --> -<quality-delta schema="ripwire.quality-delta/v1" baseline="git-HEAD" regressions="0" minor="0" acked="0" stale="203" preexisting-worse="0" new-symbol="0" gating="0" register-macro-excluded="63" api-new-surface="0" at="914c4045d+dirty" renames="68" rename_window_commits="400" acked_by_rename="0" acke … [line truncated: 298 more bytes on this line] +<quality-delta schema="ripwire.quality-delta/v1" baseline="git-HEAD" regressions="0" minor="0" acked="0" stale="203" preexisting-worse="0" new-symbol="0" gating="0" register-macro-excluded="63" api-new-surface="0" at="147c73293+dirty" renames="68" rename_window_commits="400" acked_by_rename="0" acke … [line truncated: 298 more bytes on this line] </quality-delta> ``` @@ -3035,7 +3046,7 @@ _A ref range run for two of the thirteen kinds only: the named kinds' rows are e ``` $ ./build/ripwire . --quality-delta=HEAD~1..HEAD --quality-kinds=complexity,dead-code <!-- ripwire quality-delta schema=ripwire.quality-delta/v1: only what the change made WORSE vs baseline=: regressions= minor= gating=; <r kind= sym= p= was= now= gating= bar=>, <sa> acked. value-ref-excluded=N: internal functions kept off because a table, field or argument in another function or at file scope holds them (matched by name, not a proven call); a floor. stale=N: ack ledger rows whose target no longer applies (sa rows); never gating. stale_by_kind=: stale= split by ack kind (kind:N,...); the sa rows are collapsed. stale_next=: the call printing the sa rows and the full header. preexisting-worse=N: regressions on symbols that existed at baseline; they gate when major. new-symbol=N: NEW code; new-symbol rows never gate, except defect-shape format-arity, ceiling=, tangle. register-macro-excluded=N: symbols skipped: self-registering test/bench macros or Rust #[test]; a floor. declined-call-excluded=N: symbols kept out of dead-code only because a declined call may mean them; a floor. api-new-surface=N: new PUBLIC symbols; a count, never gates, not in regressions=. renames=/rename_window_commits=: git rename pairs read over that many commits, to re-file baseline and acks. acked_by_rename=/acked_by_content=: acked= suppressions matched via git renames / an equal body hash. kinds_skipped=: kinds NOT run, so none of their rows is here and every count covers the rest; a count only they feed is absent. skipped_why=selector (the caller chose; stale acks judged for those kinds only) | memory (see ingest_scope=) | selector,memory (both). acked=N: findings suppressed by the ack ledger, listed as sa rows; never gating. base_ref=/target_ref=: the two resolved full shas a range compared (committed trees; at= omitted). churn=unavailable: range form; short-horizon-churn cannot be measured, so its silence is not no churn. --> -<quality-delta schema="ripwire.quality-delta/v1" baseline="ref-pair" regressions="0" minor="0" acked="0" stale="26" preexisting-worse="0" new-symbol="0" gating="0" register-macro-excluded="63" api-new-surface="0" base_ref="b6ae53e9f828e641b9be583700a1a6501e18ca4f" target_ref="914c4045d08e71e6e6ad23e … [line truncated: 449 more bytes on this line] +<quality-delta schema="ripwire.quality-delta/v1" baseline="ref-pair" regressions="0" minor="0" acked="0" stale="26" preexisting-worse="0" new-symbol="0" gating="0" register-macro-excluded="63" api-new-surface="0" base_ref="9683e45bd878b4a9371ff477dce89856791e02cd" target_ref="147c732930f6ea42d5f4c57 … [line truncated: 449 more bytes on this line] </quality-delta> ``` @@ -3058,7 +3069,7 @@ _The Delta Maintainability Model scalar for the WORKING TREE vs HEAD — recorde ``` $ ./build/ripwire . --dmm <!-- ripwire dmm schema=ripwire.dmm/v1: Delta Maintainability Model base=→target=: dmm= good/(good+bad) units by size_metric=; <p k= dmm= good= bad= d_low= d_high=>. at=: commit+dirty+shallow. available=0: no score at all (dmm=UNAVAILABLE, reason= says why); never read as 1.000 or 0.000. combine=pooled: root dmm= is summed good over summed good+bad of the 3 properties (ripwire's own). low_loc=/low_cx=/low_params=: a unit is LOW risk at or under these lines / cyclomatic / params. base_units=/base_volume=/target_units=/target_volume=: units with a body and their line span per side. reason=: why no score (no unit's size, complexity or params moved; a tree failed to parse ...). --> -<dmm schema="ripwire.dmm/v1" base="914c4045d08e71e6e6ad23e8a9a1a6b490679aee" target="working-tree" at="914c4045d" available="0" combine="pooled" size_metric="physical-loc" low_loc="15" low_cx="5" low_params="2" dmm="UNAVAILABLE" good="0" bad="0" base_units="25297" base_volume="333518" target_units=" … [line truncated: 147 more bytes on this line] +<dmm schema="ripwire.dmm/v1" base="147c732930f6ea42d5f4c57ff6e09108302c089b" target="working-tree" at="147c73293" available="0" combine="pooled" size_metric="physical-loc" low_loc="15" low_cx="5" low_params="2" dmm="UNAVAILABLE" good="0" bad="0" base_units="25297" base_volume="333518" target_units=" … [line truncated: 147 more bytes on this line] <p k="size" dmm="UNAVAILABLE" good="0" bad="0" d_low="0" d_high="0"/> <p k="complexity" dmm="UNAVAILABLE" good="0" bad="0" d_low="0" d_high="0"/> <p k="interfacing" dmm="UNAVAILABLE" good="0" bad="0" d_low="0" d_high="0"/> @@ -3128,7 +3139,7 @@ _OWNERSHIP partition for a shared tree: every regression here lives in src/infra ``` $ ./build/ripwire . --quality-delta --scope=src/graph.h <!-- ripwire quality-delta schema=ripwire.quality-delta/v1: only what the change made WORSE vs baseline=: regressions= minor= gating=; <r kind= sym= p= was= now= gating= bar=>, <sa> acked. value-ref-excluded=N: internal functions kept off because a table, field or argument in another function or at file scope holds them (matched by name, not a proven call); a floor. at=: commit+dirty+shallow. stale=N: ack ledger rows whose target no longer applies (sa rows); never gating. preexisting-worse=N: regressions on symbols that existed at baseline; they gate when major. new-symbol=N: NEW code; new-symbol rows never gate, except defect-shape format-arity, ceiling=, tangle. register-macro-excluded=N: symbols skipped: self-registering test/bench macros or Rust #[test]; a floor. declined-call-excluded=N: symbols kept out of dead-code only because a declined call may mean them; a floor. api-new-surface=N: new PUBLIC symbols; a count, never gates, not in regressions=. renames=/rename_window_commits=: git rename pairs read over that many commits, to re-file baseline and acks. acked_by_rename=/acked_by_content=: acked= suppressions matched via git renames / an equal body hash. renames_window_truncated=1: history is deeper than the rename window, older renames unread. r surface=: the api-surface tier, new-symbol or contract-change. acked=N: findings suppressed by the ack ledger, listed as sa rows; never gating. r sev=minor: a small numeric delta, counted in minor=, never gating (absent: major). r origin=new-symbol: a finding on NEW code; moved: its body left another name or file, never gating (absent: preexisting-worse). sa key=/why=: the stale ack's ledger hash / target-gone (names nothing now) or finding-gone (no longer fires). r members=/tokens=: a duplication row's clone group (member ids) / their shared normalized-token count. --> -<quality-delta schema="ripwire.quality-delta/v1" baseline="git-HEAD" regressions="0" minor="0" acked="0" stale="202" preexisting-worse="0" new-symbol="0" gating="0" register-macro-excluded="63" api-new-surface="2" at="914c4045d+dirty" renames="68" rename_window_commits="400" acked_by_rename="0" acke … [line truncated: 156 more bytes on this line] +<quality-delta schema="ripwire.quality-delta/v1" baseline="git-HEAD" regressions="0" minor="0" acked="0" stale="202" preexisting-worse="0" new-symbol="0" gating="0" register-macro-excluded="63" api-new-surface="2" at="147c73293+dirty" renames="68" rename_window_commits="400" acked_by_rename="0" acke … [line truncated: 156 more bytes on this line] <out-of-scope n="9" would-gate="4" note="not yours - do not ack: these rows lie outside the scope this run named. They are disclosed rather than hidden, they never gate this exit code, and the ack refuses to write them."> <r kind="api-surface" sym="src/infra/sortutil.h::rw::sortutil::nonNegativeFloatDescKey" was="1" now="2" surface="contract-change" p="src/infra/sortutil.h:122"/> <r kind="complexity" sym="src/infra/sortutil.h::rw::sortutil::lessByScoreDescId" was="1" now="67" bar="15" p="src/infra/sortutil.h:62"/> @@ -3158,7 +3169,7 @@ _Fast per-symbol post-edit contract check vs git HEAD (unchanged on a clean tree ``` $ ./build/ripwire . --edit-check=rankGraphTeleport <!-- ripwire edit-check schema=ripwire.edit-check/v1: sym='s contract NOW vs HEAD: status=unchanged|new-symbol|contract-change; <c n= p= incompatible=1 sites_l=> callers. counts_floor=1: every count is a FLOOR, never a total. graph_ambiguous=/graph_unresolved=: resolver gauge. graph_unindexed=N: N files no grammar could read (the map header's unindexed=); their calls raise neither gauge. est_tokens=: price as emitted (an upper bound under compact). at=: commit+dirty+shallow. root=: p= relative to it. next=: the one pasteable follow-up. defs=N: overloads at this site (same file, scope, name) folded into one contract; params compared by MAX. callers=N: callers of sym= (the c rows' total; a floor). t=: sym='s kind (fn|cls|...). --> -<edit-check schema="ripwire.edit-check/v1" sym="rankGraphTeleport" t="fn" p="src/graph.h:14921" status="unchanged" defs="1" callers="7" incompatible="0" at="914c4045d" graph_ambiguous="3984" graph_unresolved="20100" graph_unindexed="313" counts_floor="1" root="." next="--test-gate=src/graph.h" est_t … [line truncated: 12 more bytes on this line] +<edit-check schema="ripwire.edit-check/v1" sym="rankGraphTeleport" t="fn" p="src/graph.h:14921" status="unchanged" defs="1" callers="7" incompatible="0" at="147c73293" graph_ambiguous="3984" graph_unresolved="20100" graph_unindexed="313" counts_floor="1" root="." next="--test-gate=src/graph.h" est_t … [line truncated: 12 more bytes on this line] <c n="runEval" p="src/eval.h:171"/> <c n="rankGraph" p="src/graph.h:14964"/> <c n="anchoredLexicalRank" p="src/graph.h:15633"/> @@ -3415,7 +3426,7 @@ _Bare --slice=SYM: the INVENTORY of sliceable locals (<v n= l= t=/>), so a calle ``` $ ./build/ripwire . --slice=rankGraphTeleport <!-- ripwire slice schema=ripwire.slice/v1: name-based def-use rows of one variable in one definition: <s l= k=def|use|both|scope t= [b= pp= rd=]> (rd= reaching-def lines per reach=cfg|linear), <v n= l= t=> inventory; steps=/depth= flow. at=: commit+dirty+shallow. root=: p= relative to it. sym=/lang=: the sliced definition's name and language; p= is its file:line. vars=N: sliceable local bindings in the definition, one v row each; name one to slice it. counts=as-classified: defs=/uses=/vars=/steps= count what the name classifier rowed; neither floors nor totals. --> -<slice sym="rankGraphTeleport" p="src/graph.h:14921" t="fn" lang="cpp" schema="ripwire.slice/v1" vars="14" at="914c4045d" root="." counts="as-classified"> +<slice sym="rankGraphTeleport" p="src/graph.h:14921" t="fn" lang="cpp" schema="ripwire.slice/v1" vars="14" at="147c73293" root="." counts="as-classified"> <v n="alpha" l="14921" t="param"/> <v n="g" l="14921" t="param"/> <v n="p" l="14921" t="param"/> @@ -3452,7 +3463,7 @@ _Forward flow: which statements the seed's value reaches, at the default depth b ``` $ ./build/ripwire . --slice=rankGraphTeleport:teleport --slice-flow=fwd <!-- ripwire slice schema=ripwire.slice/v1: name-based def-use rows of one variable in one definition: <s l= k=def|use|both|scope t= [b= pp= rd=]> (rd= reaching-def lines per reach=cfg|linear), <v n= l= t=> inventory; steps=/depth= flow. at=: commit+dirty+shallow. root=: p= relative to it. sym=/lang=: the sliced definition's name and language; p= is its file:line. order=defuse: seed s rows (no v=) ranked among these rows by def-use coverage (distinct local names on the line) desc, then line; not source order, not a whole-function ranking (measured at chance — docs/EVALS.md) — flow s rows (v=) keep their (d=,l=,v=) order. counts=as-classified: defs=/uses=/vars=/steps= count what the name classifier rowed; neither floors nor totals. --> -<slice sym="rankGraphTeleport" p="src/graph.h:14921" t="fn" lang="cpp" schema="ripwire.slice/v1" var="teleport" defs="1" uses="3" reach="cfg" flow="fwd" depth="8" steps="7" order="defuse" at="914c4045d" root="." counts="as-classified"> +<slice sym="rankGraphTeleport" p="src/graph.h:14921" t="fn" lang="cpp" schema="ripwire.slice/v1" var="teleport" defs="1" uses="3" reach="cfg" flow="fwd" depth="8" steps="7" order="defuse" at="147c73293" root="." counts="as-classified"> <s l="14944" k="use" t="call-arg" rd="14926"> <![CDATA[run = pageRankDouble( g.inEdges, g.wOutDeg, teleport, rankDouble, PageRankConfig{ .alpha = double( alpha ) } );]]> </s> @@ -3533,7 +3544,7 @@ _No-LLM review-evidence bundle for the working-tree diff (clean tree = empty)._ ``` $ ./build/ripwire . --pr-context <!-- ripwire pr-context schema=ripwire.pr-context/v1: review bundle per changed file vs base=: symbols, callers, blast radius, tests, owners. counts_floor=1: every count is a FLOOR, never a total. graph_ambiguous=/graph_unresolved=: resolver gauge. graph_unindexed=N: N files no grammar could read (the map header's unindexed=); their calls raise neither gauge. 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). 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). files=N: changed files in the diff (shown= of them listed). --> -<pr-context schema="ripwire.pr-context/v1" base="working-tree" root="." direction="worktree-since-head" files="0" skipped_mode_only="0" budget_tokens="8000" est_tokens="584" trim_level="0" truncated="none" budget_default="1" at="914c4045d" graph_ambiguous="3984" graph_unresolved="20100" graph_uninde … [line truncated: 27 more bytes on this line] +<pr-context schema="ripwire.pr-context/v1" base="working-tree" root="." direction="worktree-since-head" files="0" skipped_mode_only="0" budget_tokens="8000" est_tokens="584" trim_level="0" truncated="none" budget_default="1" at="147c73293" graph_ambiguous="3984" graph_unresolved="20100" graph_uninde … [line truncated: 27 more bytes on this line] <!-- no changed files in the index (clean tree, or the diff touched only non-indexed files) --> </pr-context> ``` @@ -3559,11 +3570,11 @@ _Pairwise cross-arm conflict sites + suggested landing order (any committish sha ``` $ ./build/ripwire . --merge-scout=HEAD~2,HEAD~1 <!-- ripwire merge-scout schema=ripwire.merge-scout/v1: cross-branch overlap of arms= refs: <arm ref= base= changed= head_conflicts=>, <pair a= b= conflicts= risks=>, <landing order=>. at=: commit+dirty+shallow. head=: the HEAD commit, bare 9-hex sha (at= adds +dirty). ok=1 on an arm row means the comparison RAN, so changed=/head_conflicts= are real and may legitimately be 0 (an empty but materialized tree is a real index); ok=0 means it did not run at all. no-work note=: arm compared and has no divergent work vs its merge base, so no landing slot. --> -<merge-scout schema="ripwire.merge-scout/v1" arms="2" head="914c4045d" at="914c4045d"> -<arm ref="HEAD~2" base="739151ce9" ok="1" changed="0" head_conflicts="0"> +<merge-scout schema="ripwire.merge-scout/v1" arms="2" head="147c73293" at="147c73293"> +<arm ref="HEAD~2" base="3e2054168" ok="1" changed="0" head_conflicts="0"> <no-work note="no divergent work vs merge-base — see --stray-content"/> </arm> -<arm ref="HEAD~1" base="b6ae53e9f" ok="1" changed="0" head_conflicts="0"> +<arm ref="HEAD~1" base="9683e45bd" ok="1" changed="0" head_conflicts="0"> <no-work note="no divergent work vs merge-base — see --stray-content"/> </arm> <pair a="HEAD~2" b="HEAD~1" conflicts="0" risks="0"/> @@ -3638,7 +3649,7 @@ _A second selection, the `fix/` ref family, picked at capture time from the refs ``` $ ./build/ripwire . --stray-content=fix/ <!-- ripwire stray-content schema=ripwire.stray-content/v1: per local ref, lines/symbols NOT in HEAD: <ref ok= v= base= stray=>; 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. unknown=N: refs that could not be analysed (v=unknown, e.g. no merge base); never counted merged. --> -<stray-content schema="ripwire.stray-content/v1" head="914c4045d" head_ref="integration/train-ge3" refs="1" blobs="0" unmerged="0" superseded="0" merged="1" unknown="0" filter="fix/" at="914c4045d"> +<stray-content schema="ripwire.stray-content/v1" head="147c73293" head_ref="integration/train-ge3" refs="1" blobs="0" unmerged="0" superseded="0" merged="1" unknown="0" filter="fix/" at="147c73293"> </stray-content> ``` @@ -3663,19 +3674,19 @@ _Select the genuinely-unmerged refs of the `lane/` ref family and feed them to m ``` $ ./build/ripwire . --stray-content=lane/ --plan <!-- ripwire landing-plan schema=ripwire.landing-plan/v1: stranded-work landing order across refs, fewest conflicts first. at=: commit+dirty+shallow. --> -<landing-plan schema="ripwire.landing-plan/v1" head="914c4045d" refs="499" unmerged="61" superseded="29" merged="409" undetermined="0" scouted="1" bounded="60" scout-ok="1" at="914c4045d"> +<landing-plan schema="ripwire.landing-plan/v1" head="147c73293" refs="499" unmerged="62" superseded="29" merged="408" undetermined="0" scouted="1" bounded="61" scout-ok="1" at="147c73293"> <ref name="lane/arise-result" v="unmerged" stray="16331" files="18" scouted="1"/> <ref name="lane/margin-rescore" v="unmerged" stray="13921" files="13" scouted="0"/> -<ref name="lane/recv-xfile" v="unmerged" stray="9251" files="34" scouted="0"/> -<ref name="lane/py-local-bind" v="unmerged" stray="7081" files="8" scouted="0"/> +<ref name="lane/recv-xfile" v="unmerged" stray="9254" files="34" scouted="0"/> +<ref name="lane/py-local-bind" v="unmerged" stray="7077" files="8" scouted="0"/> <ref name="lane/served-syms-result" v="unmerged" stray="6346" files="9" scouted="0"/> <ref name="lane/orient-narrow-v3" v="unmerged" stray="3273" files="46" scouted="0"/> <ref name="lane/for-howitworks-067" v="unmerged" stray="3247" files="39" scouted="0"/> <ref name="lane/m1-lookback-harness" v="unmerged" stray="3164" files="14" scouted="0"/> <ref name="lane/orient-map-067" v="unmerged" stray="2475" files="40" scouted="0"/> <ref name="lane/parse-budget-det" v="unmerged" stray="2396" files="64" scouted="0"/> -<ref name="lane/xs-1119-d2-pin" v="unmerged" stray="2298" files="31" scouted="0"/> -<ref name="lane/qual-ns-call-bind" v="unmerged" stray="2288" files="30" scouted="0"/> +<ref name="lane/xs-1119-d2-pin" v="unmerged" stray="2306" files="31" scouted="0"/> +<ref name="lane/qual-ns-call-bind" v="unmerged" stray="2296" files="30" scouted="0"/> ... [17 more line(s); run it to see the whole thing] ``` @@ -3699,7 +3710,7 @@ _Cross-branch ABI-break gate over the `lane/` ref family: struct byte-contract d ``` $ ./build/ripwire . --stray-content=lane/ --abi <!-- ripwire abi schema=ripwire.abi/v1: cross-branch ABI-break gate: each local branch's structs on paths it authored (its diff from its merge base with HEAD), laid out lexically, compared with HEAD's; a match is omitted; exit 2 on a drift. head_ref= HEAD's branch, refs= branches read, candidates= structs HEAD declares and locates, compared= sites modelled on both sides, blobs= git blobs read; dropped= listed rows past the 12-per-ref cap; head_only= sites on paths only HEAD changed (out of scope); unmodelable= sites skipped: HEAD's copy has no model; unrelated= refs with no merge base, never compared, also in quiet=; broken_refs= refs with a drift; quiet= refs with no row (none differed or none compared); excluded_refs= refs with unlisted kinds only. window: shown= capped= (capped=1 cut). at=: commit+dirty+shallow. root=: p= relative to it. ref name= tip= date=: a branch with rows, its tip commit and date; shown=/capped=/head_only= and kind counts are its own. struct n= p= l= kind= head_size=: a struct, its file and line at HEAD, sizeof there. kind=drift: the byte contract differs (the kind that exits 2); unknown: the ref's copy could not be modelled, never read as same; absent: the ref does not define it at that path. drift= unknown= absent= count them on abi and ref; each row is on one kind count (absent at 0): their sum is the row total. ref_size= size_delta=: sizeof on the ref and its distance from head_size=, only where the ref's copy was sized; size_delta=0 is the same size, not the same layout. d n= a= b=: a differing field as type@offset at HEAD (a=) and on the ref (b=), or absent. ref_caveat k= d=: why the ref's copy is unmodelled: kind, detail. head_caveat k= d=: a limit of HEAD's own model of the struct: kind, detail. head-moved=N: the ref's copy equals its merge base's, so HEAD changed; counted, listed under detail=1. --> -<abi schema="ripwire.abi/v1" head_ref="integration/train-ge3" refs="499" candidates="3078" compared="12715" blobs="896" shown="68" capped="0" dropped="0" head_only="1113101" unmodelable="4371" unrelated="0" broken_refs="26" quiet="415" excluded_refs="49" at="914c4045d" drift="52" unknown="13" absent … [line truncated: 32 more bytes on this line] +<abi schema="ripwire.abi/v1" head_ref="integration/train-ge3" refs="499" candidates="3078" compared="12733" blobs="900" shown="70" capped="0" dropped="0" head_only="1113088" unmodelable="4384" unrelated="0" broken_refs="27" quiet="414" excluded_refs="49" at="147c73293" drift="53" unknown="14" absent … [line truncated: 32 more bytes on this line] <ref name="lane/for-tonly" tip="07f6c870d" date="2026-10-29" shown="4" capped="0" head_only="2275" drift="4" head-moved="60"> <struct n="ForLensJsonInputs" p="src/verbs_for.h" l="464" kind="drift" head_size="232" ref_size="216" size_delta="16"> <d n="graph" a="const rw::Graph*@208" b="absent"/> @@ -3734,8 +3745,8 @@ _Which ref's tree defines or mentions SYM — HEAD first, then every local branc ``` $ ./build/ripwire . --whereis=rankGraphTeleport <!-- ripwire whereis schema=ripwire.whereis/v1: every LOCAL ref whose tree holds sym= (refs_scanned=, blobs=), HEAD first: <hit ref= tip= date= p= l= kind= t=>. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). at=: commit+dirty+shallow. next=: the one pasteable follow-up. refs_omitted=K: past the ref window (512 refs; whereis: 2097152 tree entries) the newest refs by committer date were read; K older local branches were not, in no count or row (a ref-name SUBSTR filter picks which; detail=1 reads all). hits=N: occurrences in HEAD plus every scanned local ref's full tree (the total rows). on-head=1|0: whether HEAD's tree holds it; 0 beside hits = it lives only on a branch. head_labels=index: HEAD kind= from the parsed index; lexical: text heuristic. ref_labels=parsed: another ref's kind= from the index's own tags parse of its blob (one per blob and path; HEAD's own blob takes HEAD's labels); a blob with no line a loose lexical test calls worth parsing is not parsed and its rows read ref; kind=text: such a line no parse read, never a def. unparsed blobs=N: other refs' blobs holding a line worth parsing that no parse read (past the runaway guard, or the parser could not finish); those lines read kind=text; next= lifts the guard. unparsed rows=N: the kind=text rows those blobs gave. hit refs=N: N scanned refs hold this same definition (or kind=text) line (path + text); printed once for the first by name, whose ref= tip= date= l= it carries; defs page only, absent = one ref; hits= counts every copy, listing=all prints each. folded=N: def (or text) rows of other refs a listed row's refs= stands for; shown + more + folded + refs count = hits on the first page. more hits=N: rows after this page; page on with offset=next_offset. listing=defs|refs: only those kind= rows listed (defs: def and text); under defs <refs count=N next=> counts the kind=ref rows and next= lists them; the window counts listed rows; default: defs if it lists more defs than all, else if shorter; a def the parser does not model (define_method, setattr, assignment) is a counted ref. head_date=: a hit without tip= date= has tip= at=, date= this. --> -<whereis schema="ripwire.whereis/v1" sym="rankGraphTeleport" on-head="1" refs_scanned="373" blobs="10151" hits="2701870" head_labels="index" refs_omitted="282" shown="60" capped="1" total="146" has_more="1" next_offset="60" offset="0" limit="0" listing="defs" folded="1786" ref_labels="parsed" head_d … [line truncated: 32 more bytes on this line] -<unparsed blobs="404" rows="1923" next="--whereis=rankGraphTeleport --detail=1"/> +<whereis schema="ripwire.whereis/v1" sym="rankGraphTeleport" on-head="1" refs_scanned="373" blobs="10250" hits="2702085" head_labels="index" refs_omitted="282" shown="60" capped="1" total="146" has_more="1" next_offset="60" offset="0" limit="0" listing="defs" folded="1850" ref_labels="parsed" head_d … [line truncated: 32 more bytes on this line] +<unparsed blobs="407" rows="1987" next="--whereis=rankGraphTeleport --detail=1"/> <hit ref="HEAD" p="src/graph.h" l="14921" kind="def" t="inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>& p, float alpha = 0.85f )"/> <hit ref="community/pr433" tip="fafb3f267" date="2026-10-29" p="src/graph.h" l="11991" kind="text" refs="365" t="inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>& p, float alpha = 0.85f )"/> <hit ref="community/pr433" tip="fafb3f267" date="2026-10-29" p="docs/EVALS.md" l="14331" kind="text" refs="315" t="- **(i) Static.** A's diff leaves `priorwt::weight`, graph.h:4378, `biasPrior`, `rankGraphTeleport`, `rankGraph` and `diffTeleport` byte-unchanged. `rankDefaultMap`'s call sit … [line truncated: 26 more bytes on this line] @@ -3764,8 +3775,8 @@ _The same page with every t= line whole: the page above previews each line over ``` $ ./build/ripwire . --whereis=rankGraphTeleport --whereis-listing=all --whereis-full-text <!-- ripwire whereis schema=ripwire.whereis/v1: every LOCAL ref whose tree holds sym= (refs_scanned=, blobs=), HEAD first: <hit ref= tip= date= p= l= kind= t=>. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). at=: commit+dirty+shallow. next=: the one pasteable follow-up. refs_omitted=K: past the ref window (512 refs; whereis: 2097152 tree entries) the newest refs by committer date were read; K older local branches were not, in no count or row (a ref-name SUBSTR filter picks which; detail=1 reads all). hits=N: occurrences in HEAD plus every scanned local ref's full tree (the total rows). on-head=1|0: whether HEAD's tree holds it; 0 beside hits = it lives only on a branch. head_labels=index: HEAD kind= from the parsed index; lexical: text heuristic. ref_labels=parsed: another ref's kind= from the index's own tags parse of its blob (one per blob and path; HEAD's own blob takes HEAD's labels); a blob with no line a loose lexical test calls worth parsing is not parsed and its rows read ref; kind=text: such a line no parse read, never a def. unparsed blobs=N: other refs' blobs holding a line worth parsing that no parse read (past the runaway guard, or the parser could not finish); those lines read kind=text; next= lifts the guard. unparsed rows=N: the kind=text rows those blobs gave. more hits=N: rows after this page; page on with offset=next_offset. head_date=: a hit without tip= date= has tip= at=, date= this. --> -<whereis schema="ripwire.whereis/v1" sym="rankGraphTeleport" on-head="1" refs_scanned="373" blobs="10151" hits="2701870" head_labels="index" refs_omitted="282" shown="60" capped="1" total="2701870" has_more="1" next_offset="60" offset="0" limit="0" ref_labels="parsed" head_date="2026-11-22" at="914c … [line truncated: 7 more bytes on this line] -<unparsed blobs="404" rows="1923" next="--whereis=rankGraphTeleport --whereis-listing=all --detail=1"/> +<whereis schema="ripwire.whereis/v1" sym="rankGraphTeleport" on-head="1" refs_scanned="373" blobs="10250" hits="2702085" head_labels="index" refs_omitted="282" shown="60" capped="1" total="2702085" has_more="1" next_offset="60" offset="0" limit="0" ref_labels="parsed" head_date="2026-11-22" at="147c … [line truncated: 7 more bytes on this line] +<unparsed blobs="407" rows="1987" next="--whereis=rankGraphTeleport --whereis-listing=all --detail=1"/> <hit ref="HEAD" p="src/graph.h" l="14921" kind="def" t="inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>& p, float alpha = 0.85f )"/> <hit ref="HEAD" p="present/deck5_ripwire_build.js" l="1269" kind="ref" t="s.addText("$ ripwire . --callers=rankGraphTeleport", { x: 8.68, y: 2.1, w: 3.8, h: 0.3, fontFace: MONO, fontSize: 10, color: MUTED, margin: 0 });"/> <hit ref="HEAD" p="present/deck5_ripwire_build.js" l="1271" kind="ref" t="{ text: "<callers of=\"rankGraphTeleport\"\n defs=\"1\" count=\"7\" ", options: { color: TEXT } },"/> @@ -3793,8 +3804,8 @@ _The whole hit list asked for by name: under the same 60-row cap HEAD's referenc ``` $ ./build/ripwire . --whereis=rankGraphTeleport --whereis-listing=all <!-- ripwire whereis schema=ripwire.whereis/v1: every LOCAL ref whose tree holds sym= (refs_scanned=, blobs=), HEAD first: <hit ref= tip= date= p= l= kind= t=>. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). at=: commit+dirty+shallow. next=: the one pasteable follow-up. refs_omitted=K: past the ref window (512 refs; whereis: 2097152 tree entries) the newest refs by committer date were read; K older local branches were not, in no count or row (a ref-name SUBSTR filter picks which; detail=1 reads all). hits=N: occurrences in HEAD plus every scanned local ref's full tree (the total rows). on-head=1|0: whether HEAD's tree holds it; 0 beside hits = it lives only on a branch. head_labels=index: HEAD kind= from the parsed index; lexical: text heuristic. ref_labels=parsed: another ref's kind= from the index's own tags parse of its blob (one per blob and path; HEAD's own blob takes HEAD's labels); a blob with no line a loose lexical test calls worth parsing is not parsed and its rows read ref; kind=text: such a line no parse read, never a def. unparsed blobs=N: other refs' blobs holding a line worth parsing that no parse read (past the runaway guard, or the parser could not finish); those lines read kind=text; next= lifts the guard. unparsed rows=N: the kind=text rows those blobs gave. hit t_bytes=N: t= previews an N-byte line (over 300 B): 200 B at most, its first bytes cut on a UTF-8 boundary plus an ellipsis. t_cut rows=N: rows of this page whose t= is a preview (each carries t_bytes=); next= replays this page (same listing, window, rows) with every line whole. more hits=N: rows after this page; page on with offset=next_offset. head_date=: a hit without tip= date= has tip= at=, date= this. --> -<whereis schema="ripwire.whereis/v1" sym="rankGraphTeleport" on-head="1" refs_scanned="373" blobs="10151" hits="2701870" head_labels="index" refs_omitted="282" shown="60" capped="1" total="2701870" has_more="1" next_offset="60" offset="0" limit="0" ref_labels="parsed" head_date="2026-11-22" at="914c … [line truncated: 7 more bytes on this line] -<unparsed blobs="404" rows="1923" next="--whereis=rankGraphTeleport --whereis-listing=all --detail=1"/> +<whereis schema="ripwire.whereis/v1" sym="rankGraphTeleport" on-head="1" refs_scanned="373" blobs="10250" hits="2702085" head_labels="index" refs_omitted="282" shown="60" capped="1" total="2702085" has_more="1" next_offset="60" offset="0" limit="0" ref_labels="parsed" head_date="2026-11-22" at="147c … [line truncated: 7 more bytes on this line] +<unparsed blobs="407" rows="1987" next="--whereis=rankGraphTeleport --whereis-listing=all --detail=1"/> <t_cut rows="4" next="--whereis=rankGraphTeleport --whereis-listing=all --whereis-full-text"/> <hit ref="HEAD" p="src/graph.h" l="14921" kind="def" t="inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>& p, float alpha = 0.85f )"/> <hit ref="HEAD" p="present/deck5_ripwire_build.js" l="1269" kind="ref" t="s.addText("$ ripwire . --callers=rankGraphTeleport", { x: 8.68, y: 2.1, w: 3.8, h: 0.3, fontFace: MONO, fontSize: 10, color: MUTED, margin: 0 });"/> @@ -3942,7 +3953,7 @@ _Which of this repo's doc claims are now false. CHANGED: row attribute at= renam ``` $ ./build/ripwire . --doc-drift <!-- ripwire doc-drift schema=ripwire.doc-drift/v1: markdown anchors that no longer hold: <doc p=> of <a k= l= c= why= ref= want= got= tgt=>; unchecked/dated rows disclose the rest. failed_capped=/weak_capped=: 1 = cut. at=: commit+dirty+shallow. next=: the one pasteable follow-up. docs=N: markdown docs scanned for anchors; docs minus clean = the doc rows. clean=N: docs with no failed anchor (drift and dated 0); not proof every anchor was checked. checked=N: anchors verified against the index; checked + unchecked = anchors. prose=N: value anchors dropped as prose (name not in code); subtracted from anchors=, never checked. corpus=N: files the anchors were checked against (index + config/build exts); 0 = no anchor shape, no scan. drift=/dated=: anchors that no longer hold / anchors skipped as dated (unverifiable by date). unchecked=N: anchors not proved (the unchecked rows give each reason); checked + unchecked = anchors. doc shown_failed=/failed_total=: a rows printed / all failed anchors (drift+dated); cut at 12, detail=1 lifts. a kind=/rec=: dated-record, an author-dated failed anchor in dated= / its evidence: line|block|title|stamp. a sym=: the symbol the doc names on that file:line; line-moved = that symbol no longer spans the line. more weak=N: w rows of this group withheld; shown_weak + N = its n=; detail=1 lists all. shown_weak=N: w rows printed of n= (cut at 12 a doc, weak_capped=1); detail=1 lists all. w resolves-to=: the indexed symbol spanning that line; not proof it is the one the doc meant. unchecked r=/note=: why n= anchors were not proved, and what was still checked for them. dated r=/note=: the dating mark that moved n= failed anchors into dated= instead of drift=. --> -<doc-drift schema="ripwire.doc-drift/v1" docs="356" clean="321" anchors="8252" checked="3910" unchecked="4342" drift="91" dated="136" prose="26" corpus="5018" at="914c4045d" next="--doc-drift --detail=1"> +<doc-drift schema="ripwire.doc-drift/v1" docs="356" clean="321" anchors="8252" checked="3910" unchecked="4342" drift="91" dated="136" prose="26" corpus="5018" at="147c73293" next="--doc-drift --detail=1"> <doc p="docs/research/answer-completeness.md" anchors="187" checked="84" drift="16" dated="0" shown_failed="12" failed_capped="1" failed_total="16"> <a k="file-line" l="341" c="25" why="line-moved" ref="src/pageview.h:292" sym="pageDisclosure" got="(file scope)" tgt="src/pageview.h:351"/> <a k="file-line" l="349" c="99" why="line-moved" ref="src/serialize.h:4169" sym="kForLensDefaultTopN" got="append" tgt="src/serialize.h:1111"/> @@ -3976,7 +3987,7 @@ _Which of this repo's doc claims are now false. CHANGED: row attribute at= renam ``` $ ./build/ripwire . --doc-drift <!-- ripwire doc-drift schema=ripwire.doc-drift/v1: markdown anchors that no longer hold: <doc p=> of <a k= l= c= why= ref= want= got= tgt=>; unchecked/dated rows disclose the rest. failed_capped=/weak_capped=: 1 = cut. at=: commit+dirty+shallow. next=: the one pasteable follow-up. docs=N: markdown docs scanned for anchors; docs minus clean = the doc rows. clean=N: docs with no failed anchor (drift and dated 0); not proof every anchor was checked. checked=N: anchors verified against the index; checked + unchecked = anchors. prose=N: value anchors dropped as prose (name not in code); subtracted from anchors=, never checked. corpus=N: files the anchors were checked against (index + config/build exts); 0 = no anchor shape, no scan. drift=/dated=: anchors that no longer hold / anchors skipped as dated (unverifiable by date). unchecked=N: anchors not proved (the unchecked rows give each reason); checked + unchecked = anchors. doc shown_failed=/failed_total=: a rows printed / all failed anchors (drift+dated); cut at 12, detail=1 lifts. a kind=/rec=: dated-record, an author-dated failed anchor in dated= / its evidence: line|block|title|stamp. a sym=: the symbol the doc names on that file:line; line-moved = that symbol no longer spans the line. more weak=N: w rows of this group withheld; shown_weak + N = its n=; detail=1 lists all. shown_weak=N: w rows printed of n= (cut at 12 a doc, weak_capped=1); detail=1 lists all. w resolves-to=: the indexed symbol spanning that line; not proof it is the one the doc meant. unchecked r=/note=: why n= anchors were not proved, and what was still checked for them. dated r=/note=: the dating mark that moved n= failed anchors into dated= instead of drift=. --> -<doc-drift schema="ripwire.doc-drift/v1" docs="356" clean="321" anchors="8252" checked="3910" unchecked="4342" drift="91" dated="136" prose="26" corpus="5018" at="914c4045d" next="--doc-drift --detail=1"> +<doc-drift schema="ripwire.doc-drift/v1" docs="356" clean="321" anchors="8252" checked="3910" unchecked="4342" drift="91" dated="136" prose="26" corpus="5018" at="147c73293" next="--doc-drift --detail=1"> <doc p="docs/research/answer-completeness.md" anchors="187" checked="84" drift="16" dated="0" shown_failed="12" failed_capped="1" failed_total="16"> <a k="file-line" l="341" c="25" why="line-moved" ref="src/pageview.h:292" sym="pageDisclosure" got="(file scope)" tgt="src/pageview.h:351"/> <a k="file-line" l="349" c="99" why="line-moved" ref="src/serialize.h:4169" sym="kForLensDefaultTopN" got="append" tgt="src/serialize.h:1111"/> @@ -4009,8 +4020,8 @@ _Same report, with git history splitting stale mentions into deleted-by-commit v ``` $ ./build/ripwire . --doc-drift --with-history <!-- ripwire doc-drift schema=ripwire.doc-drift/v1: markdown anchors that no longer hold: <doc p=> of <a k= l= c= why= ref= want= got= tgt=>; unchecked/dated rows disclose the rest. failed_capped=/weak_capped=: 1 = cut. at=: commit+dirty+shallow. next=: the one pasteable follow-up. docs=N: markdown docs scanned for anchors; docs minus clean = the doc rows. clean=N: docs with no failed anchor (drift and dated 0); not proof every anchor was checked. checked=N: anchors verified against the index; checked + unchecked = anchors. prose=N: value anchors dropped as prose (name not in code); subtracted from anchors=, never checked. corpus=N: files the anchors were checked against (index + config/build exts); 0 = no anchor shape, no scan. drift=/dated=: anchors that no longer hold / anchors skipped as dated (unverifiable by date). unchecked=N: anchors not proved (the unchecked rows give each reason); checked + unchecked = anchors. doc shown_failed=/failed_total=: a rows printed / all failed anchors (drift+dated); cut at 12, detail=1 lifts. a kind=/rec=: dated-record, an author-dated failed anchor in dated= / its evidence: line|block|title|stamp. a sym=: the symbol the doc names on that file:line; line-moved = that symbol no longer spans the line. more weak=N: w rows of this group withheld; shown_weak + N = its n=; detail=1 lists all. shown_weak=N: w rows printed of n= (cut at 12 a doc, weak_capped=1); detail=1 lists all. w resolves-to=: the indexed symbol spanning that line; not proof it is the one the doc meant. unchecked r=/note=: why n= anchors were not proved, and what was still checked for them. dated r=/note=: the dating mark that moved n= failed anchors into dated= instead of drift=. --> -<doc-drift schema="ripwire.doc-drift/v1" docs="356" clean="327" anchors="8252" checked="3888" unchecked="4364" drift="78" dated="127" prose="26" corpus="5018" at="914c4045d" next="--doc-drift --detail=1"> -<history probed="1" head="914c4045d" commits="7404" removed-names="59523"/> +<doc-drift schema="ripwire.doc-drift/v1" docs="356" clean="327" anchors="8252" checked="3888" unchecked="4364" drift="78" dated="127" prose="26" corpus="5018" at="147c73293" next="--doc-drift --detail=1"> +<history probed="1" head="147c73293" commits="7407" removed-names="59536"/> <doc p="docs/research/answer-completeness.md" anchors="187" checked="84" drift="16" dated="0" shown_failed="12" failed_capped="1" failed_total="16"> <a k="file-line" l="341" c="25" why="line-moved" ref="src/pageview.h:292" sym="pageDisclosure" got="(file scope)" tgt="src/pageview.h:351"/> <a k="file-line" l="349" c="99" why="line-moved" ref="src/serialize.h:4169" sym="kForLensDefaultTopN" got="append" tgt="src/serialize.h:1111"/> @@ -4043,7 +4054,7 @@ _The house PLAN/DESIGN format's STRUCTURE check — never semantics; exit 2 when ``` $ ./build/ripwire . --plan-lint=test/planlintfix/wave.md <!-- ripwire plan-lint schema=ripwire.plan-lint/v1: structural lint of a plan document: each finding names the section and the rule. at=: commit+dirty+shallow. file=/dialect=: the plan read and whether the PLAN dialect was detected (dialect=0: nothing to lint). cards=/ledger=: card rows found / whether the doc carries a ledger (ledger_line= names its line). git=1: git was available, so the staleness read ran; stale_commits=N: a waiting card N commits behind HEAD is stale. gating=N: findings that fail the plan (exit 2); the rest are advisory. --> -<plan-lint schema="ripwire.plan-lint/v1" file="test/planlintfix/wave.md" dialect="1" cards="3" ledger="1" ledger_line="21" at="914c4045d" git="1" stale_commits="20" gating="3"> +<plan-lint schema="ripwire.plan-lint/v1" file="test/planlintfix/wave.md" dialect="1" cards="3" ledger="1" ledger_line="21" at="147c73293" git="1" stale_commits="20" gating="3"> <card id="T1" line="10" status="check" tline="12"/> <card id="T2" line="14" status="cross" tline="16"/> <card id="T5" line="18" status="missing" tline="19" why="unlaunched" gating="1"/> @@ -4110,7 +4121,7 @@ _A command that exits 0: a minimal success record (exit, measured duration, disc $ ./build/ripwire . --run-trace="true" <ctx schema="ripwire.from-trace/v1" task="run-trace: true"> <!-- ripwire from-trace schema=ripwire.from-trace/v1: trace frames mapped to indexed symbols, innermost first; the innermost in-corpus body included. task=: the trace source this bundle maps, verbatim (a file path, stdin, or an MCP label). run exit=: the command's OWN exit code; signal=: the signal that killed it; timed_out=1: the timeout_s= cap did. run duration_ms=: wall clock, MEASURED, not deterministic; timeout_s=: the cap it ran under. run lines=: non-empty captured lines; bytes=: the whole capture; dropped_bytes=: middle bytes the cap dropped. --> -<run exit="0" duration_ms="137" timeout_s="600" lines="0" bytes="0"/> +<run exit="0" duration_ms="82" timeout_s="600" lines="0" bytes="0"/> </ctx> ``` @@ -4270,7 +4281,7 @@ _Task lens + a compact Mermaid flowchart of the top anchors' 1-hop edges._ ``` $ ./build/ripwire . --for="pagerank power iteration" --with-graph -<ctx task="pagerank power iteration" route="subtoken+body" root="." confidence="high" margin_pct="22" at="914c4045d" doc_mentions="4" schema="ripwire.for/v1" bundle="compact" bodies="0" reason="compact-route" budget_bytes="7500" doc_mentions_capped="1" doc_mentions_total="14" est_tokens="8311"> +<ctx task="pagerank power iteration" route="subtoken+body" root="." confidence="high" margin_pct="22" at="147c73293" doc_mentions="4" schema="ripwire.for/v1" bundle="compact" bodies="0" reason="compact-route" budget_bytes="7500" doc_mentions_capped="1" doc_mentions_total="14" est_tokens="8311"> <!-- ripwire for schema=ripwire.for/v1: bundle=/bodies=/reason= the body posture; d: cx= ccx= complexity, in= callers (absent cx/ccx/in = 0), churn= amp= change, clone= tested= 1, sc= scope, id=p::sc::n; total= shown= capped=1 if cut; task= the query; d pure=1 const/constexpr sig, next= the follow-up to paste; d same_as=N: doc+sig text as row n=N (not repeated); route= name-exact(X)|subtoken+body[:broad|:declined]; confidence=/margin_pct= head score drop (low=flat); h l= p= n=, c n= l= p= (p= if not h's; same-named joined, shown= counts them), noedge= no callee resolved; fold kind=bodies: b t= n= p= l= top ranked rows' whole bodies, not the answer; served= of total= in budget_bytes=; slice/skip p= n= l=; skip bytes= next=; a skip makes sigs next= it, sigs_next= the signatures-only re-call; d mem= an owner's direct member names only, by the index (question words first, then owner's file, path, line, name), mem_more= names cut; t p= file outside sigs (weaker), t sym= its top symbols not in sigs/syms (a pointer, not the answer), r= rank (gap = trimmed); t tsym= up to 2 more file symbols named by a task word (a name match); t order: code files first, then doc files (a code question); t page rows go on to file-page row 160 (code question: 160 code rows, docs within row 160); past page 0 (code question: past 40 code rows, a doc past row 40) listed last, head files skipped; past 120 of those p= only, p_only= counts them; t folded=class=N: N p= only rows of that class (doc|config|script|testdata|other) not listed, next= pages to them; d layer=: built-in arch layer (game|infra|render|math|audio|ai|test) from a dir name in p=; d e= its last line (absent=unknown, never 0; l= the name's line); c prov=split: a resolver split arm; may be another arm's (NOT a claim the edge is false) [doc mentions: 4 docs, 2 symbols; doc_mentions=] --> <!-- root= is the crawl root; p= below is RELATIVE to it (single-root only; absent => p= is ingest's own path, unchanged); at=this commit(+dirty). [budget_bytes= is the default BYTE target this ranked payload was shaped toward: row text shortens toward it, no row of the ranked head is removed for it (sigs past_target=)] [sigs capped=1 with shown=total: rows shrunk, none dropped] [sigs past_target=K: the last K rows are past the budget_bytes target, served because they are rows of the ranked head; none is cut] [sigs sigs_next=: one call serving all total= rows uncut] [docs_dropped=N: N shown rows have a doc comment not printed (r>24 always, r5..24 if capped)] [docs_after_code=N: N doc rows of the shown set moved below its code rows; same rows, reordered, none added or removed; a question naming docs keeps score order] [files_first=N: N rows moved so r=1..8 are distinct files' best rows, score order, a repeated name once; same rows; fold, hops keep score order] [cut: doc_mentions_capped="1" doc_mentions_total="14" — an indexing cap dropped content not shown here]; lego/compose collapse to a counted stub by default (a disclosed cut): total= that section's own pre-cap row count, shown="0" capped="1" (nothing rendered here), next= names the sections=lego,compose flag that restores both sections byte-identically in one call est_tokens= prices this bundle in tokens --> <sigs shown="40" total="40" capped="1" past_target="14" docs_dropped="25" docs_after_code="5" files_first="7" sigs_next="--for='pagerank power iteration' --signatures-only --token-budget=6200" next="--expand=src/prconverge.h:73:renderDisclosure"> @@ -4348,13 +4359,13 @@ _Environment self-check: binary staleness, grammars, cache dir, git, tracked-bin ``` $ ./build/ripwire . --doctor <!-- ripwire doctor schema=ripwire.doctor/v1: setup health: <c n= ok=> checks; exit 1 when one fails. at=: commit+dirty+shallow. n=: the check's name (binary-path, grammars, cache-dir, git, tree-sitter, index-cache, layout ...). loaded=/expected=: grammars whose tags query compiled / grammars compiled in; a shortfall fails the row. dir=: the per-user cache directory scanned (TMPDIR/XDG_CACHE_HOME ladder); unwritable fails the row. blobs=N: ripwire cache blobs in dir=; the scan stops at 4096 (blobs_floor=1 then). bytes=N: total size in bytes of the blobs counted (short when truncated=1). many=1: more than 50 blobs; an eviction-sanity flag, informational, never fails the row. truncated=1: cache-dir, blob scan cut (cap or I/O error); tracked-binaries, scan SKIPPED, stale=0 unmeasured. locks=N: advisory edit-lock files under locks/; unheld ones over a day old are swept on a cache write. volatile=: this row's attributes that read LIVE machine state; a determinism diff strips them, never the row. git=0|1: git runs from PATH; 0 fails the row (churn verbs need it). repo=0|1: the root is inside a git work tree; 0 is a diagnosis, not a failure. history=0|1: the repo has at least one commit; head= prints only when it does. head=: HEAD's short sha (9 hex, the at= width). core_abi=/cpp_grammar_abi=: tree-sitter core language ABI / the C++ grammar's ABI; informational. languages=N: distinct compiled-in grammars (the grammars row's expected=). tracked=N: git ls-files count, printed even when truncated=1 (over 20000 files skips the scan). binaries=N: tracked paths that sniff as binary content. non_git=1: no git history to compare; the row passes unscanned. stale=N: tracked binaries committed before a same-dir same-stem source changed; any fails the row. cache_version=/parser_ver_lean=/parser_ver_rich=/artifact_arch=: index identity; reuse needs all four. rich_verbs=: the verbs that consume the rich artifact (rich=); every other verb reads the lean one. source=: auto (per-root blob), cache-flag (named by the cache flag) or disabled (no-cache: nothing read). lean_path=/rich_path=: the artifact files checked; one path when the cache flag named it. lean=/rich=: can THIS binary open that artifact (ok, absent, parser-version ...); format, never freshness. fsmonitor=: the checkout's core.fsmonitor at startup: unset, builtin, off, or hook (a command git runs). neutralised=1: a hook fsmonitor was overridden to false for this run; 0 when none was needed. filter_drivers=N: filter drivers the repository's own config defines; filter_scope= local|all, filter_pinned= 1 (run with an empty command) or refused. state=: layout records agree, disagree (mixed binary: rebuild clean-first), not-checked or no-records. checked=1: the cross-unit layout comparison ran; 0 = under two comparable records. units=N: translation units that registered a layout record. types=N: layout types recorded (only those registered in src/model.h); omitted on state=disagree. checks=/passed=: checks run / how many passed; exit 1 when passed= is below checks=. built_from=: the commit this binary was built from; at= is the tree HEAD now, a mismatch is normal. self=/which=: this binary's path and the one which ripwire finds on PATH; which_version= is the version line that one prints when they differ. on_path=0|1: whether a ripwire is on PATH; 0 fails the row and hint= carries the export line. same_file=1: the PATH copy is this very file (same device and inode). same_bytes=1: a different file with identical content, a copied install (ok); 0 fails the row; unknown: a file was unreadable; the row fails unverified (hint= names it). self_mtime=/self_size=/which_mtime=/which_size=: epoch mtime and byte size of each binary. hint=: the row's verdict and fix in plain text (which binary is stale, what to run). --> -<doctor schema="ripwire.doctor/v1" checks="9" passed="8" at="914c4045d" built_from="914c4045d"> -<c n="binary-path" ok="0" self="./build/ripwire" which="<path>" on_path="1" same_file="0" same_bytes="0" self_mtime="1795336538" self_size="65732168" which_mtime="1793517843" which_size="58197960" which_version="ripw … [line truncated: 525 more bytes on this line] +<doctor schema="ripwire.doctor/v1" checks="9" passed="8" at="147c73293" built_from="147c73293"> +<c n="binary-path" ok="0" self="./build/ripwire" which="<path>" on_path="1" same_file="0" same_bytes="0" self_mtime="1795347577" self_size="65732168" which_mtime="1793517843" which_size="58197960" which_version="ripw … [line truncated: 525 more bytes on this line] <c n="grammars" ok="1" loaded="27" expected="27"/> -<c n="cache-dir" ok="1" dir="<tmp>" blobs="213" bytes="2000864999" many="1" truncated="0" locks="225" volatile="blobs,blobs_floor,bytes,many,truncated,locks"/> -<c n="git" ok="1" git="1" repo="1" history="1" head="914c4045d"/> +<c n="cache-dir" ok="1" dir="<tmp>" blobs="456" bytes="2163636282" many="1" truncated="0" locks="229" volatile="blobs,blobs_floor,bytes,many,truncated,locks"/> +<c n="git" ok="1" git="1" repo="1" history="1" head="147c73293"/> <c n="tree-sitter" ok="1" core_abi="15" cpp_grammar_abi="14" languages="27"/> -<c n="tracked-binaries" ok="1" tracked="5597" binaries="33" non_git="0" truncated="0" stale="0"/> +<c n="tracked-binaries" ok="1" tracked="5598" binaries="33" non_git="0" truncated="0" stale="0"/> <c n="index-cache" ok="1" cache_version="54" parser_ver_lean="337" parser_ver_rich="338" artifact_arch="16" rich_verbs="for,uses,metrics,exemplar,context-ratio,nonlocal-state,quality-panel,verify,eval-retrieval,eval-mined,eval-skills" source="auto" lean_path="<tmp> … [line truncated: 219 more bytes on this line] <c n="git-config-trust" ok="1" fsmonitor="unset" neutralised="0" filter_drivers="0"/> <c n="layout" ok="1" state="agree" checked="1" units="2" types="12"/> @@ -4382,13 +4393,13 @@ _--doctor plus a LIVE integration inspection for one agent: PATH binary, install ``` $ ./build/ripwire . --doctor --agent=claude <!-- ripwire doctor schema=ripwire.doctor/v1: setup health: <c n= ok=> checks; exit 1 when one fails. at=: commit+dirty+shallow. n=: the check's name (binary-path, grammars, cache-dir, git, tree-sitter, index-cache, layout ...). agent=: the agent named by the agent flag; its live-integration c rows follow the built-in checks. loaded=/expected=: grammars whose tags query compiled / grammars compiled in; a shortfall fails the row. dir=: the per-user cache directory scanned (TMPDIR/XDG_CACHE_HOME ladder); unwritable fails the row. blobs=N: ripwire cache blobs in dir=; the scan stops at 4096 (blobs_floor=1 then). bytes=N: total size in bytes of the blobs counted (short when truncated=1). many=1: more than 50 blobs; an eviction-sanity flag, informational, never fails the row. truncated=1: cache-dir, blob scan cut (cap or I/O error); tracked-binaries, scan SKIPPED, stale=0 unmeasured. locks=N: advisory edit-lock files under locks/; unheld ones over a day old are swept on a cache write. volatile=: this row's attributes that read LIVE machine state; a determinism diff strips them, never the row. git=0|1: git runs from PATH; 0 fails the row (churn verbs need it). repo=0|1: the root is inside a git work tree; 0 is a diagnosis, not a failure. history=0|1: the repo has at least one commit; head= prints only when it does. head=: HEAD's short sha (9 hex, the at= width). core_abi=/cpp_grammar_abi=: tree-sitter core language ABI / the C++ grammar's ABI; informational. languages=N: distinct compiled-in grammars (the grammars row's expected=). tracked=N: git ls-files count, printed even when truncated=1 (over 20000 files skips the scan). binaries=N: tracked paths that sniff as binary content. non_git=1: no git history to compare; the row passes unscanned. stale=N: tracked binaries committed before a same-dir same-stem source changed; any fails the row. cache_version=/parser_ver_lean=/parser_ver_rich=/artifact_arch=: index identity; reuse needs all four. rich_verbs=: the verbs that consume the rich artifact (rich=); every other verb reads the lean one. source=: auto (per-root blob), cache-flag (named by the cache flag) or disabled (no-cache: nothing read). lean_path=/rich_path=: the artifact files checked; one path when the cache flag named it. lean=/rich=: can THIS binary open that artifact (ok, absent, parser-version ...); format, never freshness. fsmonitor=: the checkout's core.fsmonitor at startup: unset, builtin, off, or hook (a command git runs). neutralised=1: a hook fsmonitor was overridden to false for this run; 0 when none was needed. filter_drivers=N: filter drivers the repository's own config defines; filter_scope= local|all, filter_pinned= 1 (run with an empty command) or refused. state=: layout records agree, disagree (mixed binary: rebuild clean-first), not-checked or no-records. checked=1: the cross-unit layout comparison ran; 0 = under two comparable records. units=N: translation units that registered a layout record. types=N: layout types recorded (only those registered in src/model.h); omitted on state=disagree. checks=/passed=: checks run / how many passed; exit 1 when passed= is below checks=. built_from=: the commit this binary was built from; at= is the tree HEAD now, a mismatch is normal. self=/which=: this binary's path and the one which ripwire finds on PATH; which_version= is the version line that one prints when they differ. on_path=0|1: whether a ripwire is on PATH; 0 fails the row and hint= carries the export line. same_file=1: the PATH copy is this very file (same device and inode). same_bytes=1: a different file with identical content, a copied install (ok); 0 fails the row; unknown: a file was unreadable; the row fails unverified (hint= names it). self_mtime=/self_size=/which_mtime=/which_size=: epoch mtime and byte size of each binary. hint=: the row's verdict and fix in plain text (which binary is stale, what to run). --> -<doctor schema="ripwire.doctor/v1" checks="12" passed="10" agent="claude" at="914c4045d" built_from="914c4045d"> -<c n="binary-path" ok="0" self="./build/ripwire" which="<path>" on_path="1" same_file="0" same_bytes="0" self_mtime="1795336538" self_size="65732168" which_mtime="1793517843" which_size="58197960" which_version="ripw … [line truncated: 525 more bytes on this line] +<doctor schema="ripwire.doctor/v1" checks="12" passed="10" agent="claude" at="147c73293" built_from="147c73293"> +<c n="binary-path" ok="0" self="./build/ripwire" which="<path>" on_path="1" same_file="0" same_bytes="0" self_mtime="1795347577" self_size="65732168" which_mtime="1793517843" which_size="58197960" which_version="ripw … [line truncated: 525 more bytes on this line] <c n="grammars" ok="1" loaded="27" expected="27"/> -<c n="cache-dir" ok="1" dir="<tmp>" blobs="234" bytes="2071316293" many="1" truncated="0" locks="225" volatile="blobs,blobs_floor,bytes,many,truncated,locks"/> -<c n="git" ok="1" git="1" repo="1" history="1" head="914c4045d"/> +<c n="cache-dir" ok="1" dir="<tmp>" blobs="472" bytes="2023545840" many="1" truncated="0" locks="229" volatile="blobs,blobs_floor,bytes,many,truncated,locks"/> +<c n="git" ok="1" git="1" repo="1" history="1" head="147c73293"/> <c n="tree-sitter" ok="1" core_abi="15" cpp_grammar_abi="14" languages="27"/> -<c n="tracked-binaries" ok="1" tracked="5597" binaries="33" non_git="0" truncated="0" stale="0"/> +<c n="tracked-binaries" ok="1" tracked="5598" binaries="33" non_git="0" truncated="0" stale="0"/> <c n="index-cache" ok="1" cache_version="54" parser_ver_lean="337" parser_ver_rich="338" artifact_arch="16" rich_verbs="for,uses,metrics,exemplar,context-ratio,nonlocal-state,quality-panel,verify,eval-retrieval,eval-mined,eval-skills" source="auto" lean_path="<tmp> … [line truncated: 219 more bytes on this line] <c n="git-config-trust" ok="1" fsmonitor="unset" neutralised="0" filter_drivers="0"/> <c n="layout" ok="1" state="agree" checked="1" units="2" types="12"/> @@ -4508,7 +4519,7 @@ $ ./build/ripwire . --rank-by=churn --top-k=5 <!-- t=type|alias|functype=a-Go-named-type-by-its-written-form:type=a-defined-type-whose-WRITTEN-form-is-not-a-struct/iface/func-literal(type-N-string;type-W-Pair-too,whatever-Pair-is-underneath),alias=type-A=B,functype=type-F-func(...) --> <!-- t=alias|functype-in-C++-and-.h:alias=using-X=Y(also-templated-or-class-scope)or-namespace-L=lib(defs=X-prints-its-written-target-as-to=),functype=a-typedef-of-a-function-or-function-pointer-type(typedef-void(*F)(int));other-typedefs-read-t=struct --> <!-- files=4852 symbols=45031 edges=45381 shown=5 est_tokens=1268 ambiguous=3984 unresolved=20100 locality_pinned=14 external=12460 declined=45307 extent_suspect_syms=12 macro_blanked_files=7 skipped_oversize=15 unindexed="txt:85,tsv:54,mod:33,xml:33,jsonl:26,scm:25" unindexed_exts=23 order=important-first --> -<r schema="ripwire.map/v1" at="914c4045d" root="." rank_by="churn" window="18mo@HEAD" est_tokens="1268" pr_iters="22"> +<r schema="ripwire.map/v1" at="147c73293" root="." rank_by="churn" window="18mo@HEAD" est_tokens="1268" pr_iters="22"> <f p="src/resolve.h"> <s t="method" n="appendUint" sc="Narrower" k="0.0038"> </s> @@ -4535,25 +4546,24 @@ a trailing slash is ignored; absolute paths and '..' are refused). The global <r **Try it** -_Scope the recent-changes answer to ONE directory. The global <recent> block stays byte-identical, a second <recent scope="src"> 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 <symbols stubbed="1" would_show= next=/> 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. This page holds 2 row(s), not the usual 3: no change window on this branch held enough src/ files for a larger page to cut, so the generator fell back to a smaller one (see chooseInWindow)._ +_Scope the recent-changes answer to ONE directory. The global <recent> block stays byte-identical, a second <recent scope="src"> 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 <symbols stubbed="1" would_show= next=/> 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. This page holds 1 row(s), not the usual 3: no change window on this branch held enough src/ files for a larger page to cut, so the generator fell back to a smaller one (see chooseInWindow)._ ``` -$ ./build/ripwire . --rank-by=churn-decay --since=HEAD~12 --exclude=test --exclude=docs --exclude=skills --exclude=changelog.d --in=src --limit=2 +$ ./build/ripwire . --rank-by=churn-decay --since=HEAD~9 --exclude=test --exclude=docs --exclude=skills --exclude=changelog.d --in=src --limit=1 <!-- ripwire map schema=ripwire.map/v1: ranked symbol map: <f p= layer=> groups <s t= n= sc= k= amb=> rows (k= rank), <c n=> resolved callees; the header comment is data. window: capped= has_more= next_offset= (capped=1 cut; next_offset= pastes as offset=). est_tokens=: price as emitted (an upper bound under compact). at=: commit+dirty+shallow. root=: p= relative to it. rank_by=: the ranker behind k=. window=: the git span mined. declined=K: K calls left unbound (no evidence chose one def). external=K: K calls proven outside the tree, no edge. locality_pinned=K: K calls pinned by locality alone (a guess). <recent n= of=>: the n= newest-touched of of= touched files; <rc age_d=> days since its last commit, w= decayed weight. merge_bombs_skipped=N: N commits touching more than 100 INDEXED files skipped, uncounted; a file only they touched is absent; the window's count, so the global block only. <recent scope=DIR>: a second block riding when the global one does, DIR's files only (p= root-relative); of= is its total; capped=/has_more=/next_offset=/offset=/limit= page it, next= is that page. <symbols stubbed=1 would_show=N next=>: the symbol map in= did not ask for was not rendered; N is that run's own shown= — definitions counted individually as shown= counts them, so its rows follow from rows+sum(overloads-1)=shown (not the header's symbols= corpus count); next= fetches it. 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. next=: the one pasteable follow-up. --> <!-- t=modscope=a-file's-MODULE-SCOPE(n=<file-scope>):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 --> <!-- t=alias|functype-in-C++-and-.h:alias=using-X=Y(also-templated-or-class-scope)or-namespace-L=lib(defs=X-prints-its-written-target-as-to=),functype=a-typedef-of-a-function-or-function-pointer-type(typedef-void(*F)(int));other-typedefs-read-t=struct --> -<!-- files=648 symbols=23039 edges=31083 shown=0 est_tokens=1467 ambiguous=2764 unresolved=5488 locality_pinned=9 external=8312 declined=40001 skipped_oversize=15 unindexed="tsv:43,txt:26,scm:25,jsonl:23,expected:15,lock:7" unindexed_exts=12 order=important-first --> -<r schema="ripwire.map/v1" at="914c4045d" root="." rank_by="churn-decay" window="HEAD~12 half-life=90d" est_tokens="1467"> -<recent n="3" of="3" merge_bombs_skipped="0"> -<rc p="src/serialize.h" age_d="0" w="6"/> +<!-- files=648 symbols=23039 edges=31083 shown=0 est_tokens=1431 ambiguous=2764 unresolved=5488 locality_pinned=9 external=8312 declined=40001 skipped_oversize=15 unindexed="tsv:43,txt:26,scm:25,jsonl:23,expected:15,lock:7" unindexed_exts=12 order=important-first --> +<r schema="ripwire.map/v1" at="147c73293" root="." rank_by="churn-decay" window="HEAD~9 half-life=90d" est_tokens="1431"> +<recent n="2" of="2" merge_bombs_skipped="0"> <rc p="src/lexical.h" age_d="0" w="3"/> -<rc p="src/ingest_sidecap.h" age_d="0" w="2"/> +<rc p="src/serialize.h" age_d="0" w="2"/> </recent> -<recent scope="src" n="2" of="3" capped="1" has_more="1" next_offset="2" offset="0" limit="2" next="--rank-by=churn-decay --since=HEAD~12 --exclude=test --exclude=docs --exclude=skills --exclude=changelog.d --in=src --offset=2 --limit=2"> -<rc p="src/serialize.h" age_d="0" w="6"/> +<recent scope="src" n="1" of="2" capped="1" has_more="1" next_offset="1" offset="0" limit="1" next="--rank-by=churn-decay --since=HEAD~9 --exclude=test --exclude=docs --exclude=skills --exclude=changelog.d --in=src --offset=1 --limit=1"> <rc p="src/lexical.h" age_d="0" w="3"/> </recent> -... [2 more line(s); run it to see the whole thing] +<symbols stubbed="1" would_show="200" next="--rank-by=churn-decay --since=HEAD~9 --exclude=test --exclude=docs --exclude=skills --exclude=changelog.d"/> +</r> ``` **Shaped by:** `--external-surface`, `--doctor`, `--legend`, `--max-memory` @@ -4615,7 +4625,7 @@ _The same gating report under --legend=full — same rows, same exit 2; the defa ``` $ ./build/ripwire . --quality-delta --legend=full <!-- ripwire quality-delta: only what a change made WORSE against the floor baseline= names below. Descriptive: weigh and fix the real ones, do not game the number (a wrong abstraction beats a low score). THIRTEEN KINDS, and kind= on every row names which one: complexity over the ccx bar, verbosity (LOC), nesting, params, duplication, dead-code, api-surface (new public contract drift), error-masking, short-horizon-churn, new-clone-of-reused-helper, placeholder (added stub/TODO), defect-shape (defect= names it), tangle (a long function's nesting, deep share and steering locals). THREE independent axes, in this order: (1) acked findings are suppressed entirely (acked= counts them); (2) ORIGIN — a finding on a symbol that EXISTED at the baseline is preexisting-worse (no origin attribute), one that exists only because the code is NEW carries origin="new-symbol"; (3) MATERIALITY — a small numeric delta is sev="minor", and minor= counts them. EXIT 2 fires only on preexisting-worse AND major, the gating= count; new-symbol rows never gate, except defect-shape format-arity, a new function at the ceiling and a tangled new function, so exit 0 is NOT a verdict on them — nothing that existed got worse, but the new debt is yours: read them. Clone kinds are new-symbol only when EVERY member is new; short-horizon-churn is preexisting by construction. preexisting-worse= and new-symbol= partition regressions=. stale= is a FOURTH axis, never gating and never counted in regressions=: rows in the .ripwire_quality_acks ledger whose target no longer applies. api-new-surface= COUNTS the new PUBLIC symbols (never gates, not in regressions=, printed even at zero). register-macro-excluded= is a FLOOR, not a finding: symbols this run excluded from the dead-code kind because their own definition is a registered self-registering test/benchmark macro call. Never gates, never counted in regressions=, printed even at zero (zero: none excluded, not a skipped check). A gating row's next= is the one pasteable follow-up: expand on FILE:NAME, the body to fix (a duplication row names a SET and carries none). bar= on a complexity/verbosity/nesting/params row is the threshold now= is judged against (ccx 15, loc 60, nest 4, params 5). baseline="git-HEAD" means no sidecar existed, so the working tree was auto-compared against the HEAD tree — anything already committed cannot appear. at= is the git commit (plus a dirty marker when the working tree differs) this list was computed at. The registered families are doctest/Catch2 TEST_CASE, GoogleTest TEST/TEST_F/TEST_P, Google Benchmark BENCHMARK, plus any name a .ripwire_config register_macros= line adds; each registers itself through a static initializer the call graph cannot see, so zero in-edges on one is not evidence of anything. Rust #[test] and #[tokio::test] functions count too: the test harness calls them, and no call in the tree names them. declined-call-excluded= is a FLOOR, not a finding: symbols this run kept out of the dead-code kind only because a call the resolver declined to bind (the map's declined=) could have meant them. Never gates; absent at zero. value-ref-excluded= is a FLOOR, not a finding: symbols this run kept out of the dead-code kind only because a table, field, argument or registering decorator holds them as a VALUE (matched by name; it is not a proven call; the callers verb lists the sites; @classmethod-style wrappers do not count), the --dead-code verb's own rule. Never gates; absent at zero. IDENTITY across a rename or a move: a finding is keyed path::scope::name, which a rename would destroy, so the baseline and the .ripwire_quality_acks ledger are both re-filed into the CURRENT tree's identity before either is read, by two EXACT mechanisms — git's own rename record, and equality of a whitespace-and-name-scrubbed body hash — never a similarity heuristic. renames= is how many rename pairs were read (with no ledger, only the uncommitted renames or the A..B range, and the family appears only when one was read), rename_window_commits= how deep the commit window went, acked_by_rename= and acked_by_content= how many of the acked= suppressions each mechanism is responsible for. Three appear ONLY when true, so an absent one is not a silent no: renames_window_truncated= (history is deeper than the window), renames_truncated= (the pair cap was hit), renames_ambiguous= (an ancestor two current symbols both claim — refused rather than guessed). ORIGIN reads the re-filed baseline too, so a regression carried in with a rename is judged preexisting-worse and GATES instead of slipping through as new-symbol. FLOORS, stated because silence here would read as a guarantee: the two clone kinds key on a member-SET hash and are NOT re-filed, so a clone ack still dies on a rename (a clone group itself is held across a file rename git recorded); ORIGIN follows the rename record and an unchanged body (whitespace and its own name aside): a function keeps its identity across a rename or move git recorded no rename for when its body did not change; one whose body also changed reads as new-symbol, or as moved (never gating) when it is over a bar and nearly unchanged. Each sa row carries key= (the ack identity as stored) and why=, which is target-gone (the key names no symbol or group any more) or finding-gone (the target survived, this kind just does not fire on it). sym= and p=path:line name WHICH ack it is, and are present exactly when the key still names a live symbol: on every finding-gone row, on none of the target-gone rows (there is nothing left to name), and on neither clone kind — a clone key hashes a member SET that no single symbol carries, so those rows are unnameable by construction rather than guessed at. Hygiene disclosure only — the ledger file is never auto-edited. ROWS: sym= is the canonical id the finding regressed on; was= and now= carry the before/after value for the numeric kinds; p="path:line" is the locator (root-relative; the first-sorting member for the clone kinds; omitted, never faked, when none resolves). churn= and surface= are per-kind classification facets (short-horizon-churn's self/ambient split; api-surface's new-symbol/contract-change tier). churn= facets never gate alone: the kind gates only on 2+ COMMITTED in-window rewrites of the edited lines. Every row the header's gating= counter counts also carries a gating attribute set to 1 — marked positively, never by the ABSENCE of sev or origin. CLONE ROWS name the whole group rather than one symbol: members= is the member list and tokens= its shared normalized-token count (the same per-group pair the clones verb reports). idiom= names a RECOGNIZED BODY SHAPE every member spells, from a closed set of five (threshold-ladder, switch-name-table, builder-chain, one-statement, call-sequence). idiom= alone changes nothing; a group that ALSO shares no non-keyword identifier between any two members, sits in pairwise-distinct enclosing contexts, and stays under 80 normalized tokens is an idiom COLLISION rather than a copy, and is reported minor instead of gating. Break any one of those and it gates as before, idiom= and all: two bucketing ladders over the SAME enum are a copy. The shape is read off the body's token stream and not a parse tree, so a macro-assembled body classifies as whatever its raw tokens spell — the name is printed so a reader can overrule it. --> -<quality-delta baseline="git-HEAD" regressions="9" minor="1" acked="0" stale="202" preexisting-worse="6" new-symbol="3" gating="5" register-macro-excluded="63" api-new-surface="2" at="914c4045d+dirty" renames="68" rename_window_commits="400" acked_by_rename="0" acked_by_content="0" renames_window_tr … [line truncated: 65 more bytes on this line] +<quality-delta baseline="git-HEAD" regressions="9" minor="1" acked="0" stale="202" preexisting-worse="6" new-symbol="3" gating="5" register-macro-excluded="63" api-new-surface="2" at="147c73293+dirty" renames="68" rename_window_commits="400" acked_by_rename="0" acked_by_content="0" renames_window_tr … [line truncated: 65 more bytes on this line] <r kind="api-surface" sym="src/infra/sortutil.h::rw::sortutil::nonNegativeFloatDescKey" was="1" now="2" surface="contract-change" p="src/infra/sortutil.h:122" gating="1" next="--expand=src/infra/sortutil.h:nonNegativeFloatDescKey"/> <r kind="complexity" sym="src/infra/sortutil.h::rw::sortutil::lessByScoreDescId" was="1" now="67" bar="15" p="src/infra/sortutil.h:62" gating="1" next="--expand=src/infra/sortutil.h:lessByScoreDescId"/> <r kind="dead-code" sym="src/infra/sortutil.h::rw::sortutil::nonNegativeFloatAscKeyCopy" origin="new-symbol" p="src/infra/sortutil.h:132"/> @@ -4780,7 +4790,7 @@ $ ./build/ripwire . --map-diff --top-k=5 <!-- t=type|alias|functype=a-Go-named-type-by-its-written-form:type=a-defined-type-whose-WRITTEN-form-is-not-a-struct/iface/func-literal(type-N-string;type-W-Pair-too,whatever-Pair-is-underneath),alias=type-A=B,functype=type-F-func(...) --> <!-- t=alias|functype-in-C++-and-.h:alias=using-X=Y(also-templated-or-class-scope)or-namespace-L=lib(defs=X-prints-its-written-target-as-to=),functype=a-typedef-of-a-function-or-function-pointer-type(typedef-void(*F)(int));other-typedefs-read-t=struct --> <!-- files=4852 symbols=45031 edges=45381 shown=5 est_tokens=1322 ambiguous=3984 unresolved=20100 locality_pinned=14 external=12460 declined=45307 extent_suspect_syms=12 macro_blanked_files=7 changed=0 skipped_oversize=15 unindexed="txt:85,tsv:54,mod:33,xml:33,jsonl:26,scm:25" unindexed_exts=23 order=important-first --> -<r schema="ripwire.map-diff/v1" at="914c4045d" root="." est_tokens="1322" pr_iters="37"> +<r schema="ripwire.map-diff/v1" at="147c73293" root="." est_tokens="1322" pr_iters="37"> <f p="src/infra/nodekind.h" layer="infra"> <s t="fn" n="kindIs" sc="rw" k="0.0032"> </s> @@ -5035,7 +5045,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.110+g914c4045d"},"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.113+g147c73293"},"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] @@ -5061,11 +5071,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.110+g914c4045d"},"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.113+g147c73293"},"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":"<!-- ripwire whereis schema=ripwire.whereis/v1: every LOCAL ref whose tree holds sym= (refs_scanned=, blobs=), HEAD first: <hit ref= tip= date= p= l= kind= t=>. window: shown= total= capped= has_more= next_offset= offset= limit= (ca … [line truncated: 20711 more bytes on this line] -"_index":"[index: files=4852 symbols=45032 hash=8e5a0414]","_fresh":"ok"}} +"_index":"[index: files=4852 symbols=45032 hash=2e70d871]","_fresh":"ok"}} {"jsonrpc":"2.0","id":3,"result":{"content":[{"type":"text","text":"<!-- ripwire whereis schema=ripwire.whereis/v1: every LOCAL ref whose tree holds sym= (refs_scanned=, blobs=), HEAD first: <hit ref= tip= date= p= l= kind= t=>. window: shown= capped= (capped=1 cut). at=: commit+dirty+shallow. next= … [line truncated: 2425 more bytes on this line] -"_index":"[index: files=4852 symbols=45032 hash=8e5a0414]","_fresh":"ok"}} +"_index":"[index: files=4852 symbols=45032 hash=2e70d871]","_fresh":"ok"}} ``` ### `--mcp-tools=LIST` @@ -5080,7 +5090,7 @@ _--mcp-tools=core: the server lists only the core profile's tools (explore, batc ``` $ ./build/ripwire '%s\n' '{"jsonrpc":"2.0","id":1,"method":"initialize"}' '{"jsonrpc":"2.0","id":2,"method":"tools/list"}' | ./build/ripwire --mcp --mcp-tools=core -{"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2025-11-25","serverInfo":{"name":"ripwire","version":"0.6.10-dev.110+g914c4045d"},"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.113+g147c73293"},"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: 869 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] @@ -5257,7 +5267,7 @@ _Version + short build info._ ``` $ ./build/ripwire --version -ripwire 0.6.10-dev.110+g914c4045d (dev, AppleClang 21.0.0.21000101, emit=std::print, built_from=914c4045d) +ripwire 0.6.10-dev.113+g147c73293 (dev, AppleClang 21.0.0.21000101, emit=std::print, built_from=147c73293) ``` **Shaped by:** `--verify`, `--no-redact`, `--metrics`, `--deps`, `--naming-locals`, `--arch`, `--dry-run`, `--flags` diff --git a/docs/captures/COMMANDS_showcase_2026-11-22.md b/docs/captures/COMMANDS_showcase_2026-11-22.md index 8ff359281..5dcfb81a5 100644 --- a/docs/captures/COMMANDS_showcase_2026-11-22.md +++ b/docs/captures/COMMANDS_showcase_2026-11-22.md @@ -2,8 +2,8 @@ - **Date:** 2026-11-22 (regenerated capture; supersedes any older `docs/captures/COMMANDS_showcase_*.md`) - **Lives in `docs/captures/`** — a directory the crawl/retrieval lenses SKIP (`kCrawlSkipDirs`, src/ingest.h): a generated doc that quotes every verb's output out-scores the source for any query about the tool and was measured at 77% of `--recall` on this repo when it sat at the root. `test/argvdiffcheck.sh` harvests its `## `-heading command lines as differential vectors — keep that format. -- **Version:** `ripwire 0.6.10-dev.110+g914c4045d (dev, AppleClang 21.0.0.21000101, emit=std::print, built_from=914c4045d)` -- **Repo:** the ripwire repo @ `914c4045d` — **CLEAN — `git status --porcelain` is empty**. The diff-aware verbs (`--situ`/`--test-gate`/`--quality-delta`/`--pr-context`/`--map-diff`/`--edit-check`) answer a question about the WORKING TREE, so that condition is part of their answer and every one of their captions below states which tree it recorded against. A clean tree is the honest default for a showcase, so they appear TWICE: once here on the clean tree (their empty/exit-0 shape) and once in the final section against a throwaway `git clone --local` sandbox carrying one deliberate regression, so their real gating shapes are visible without writing a byte into the read-only repo. +- **Version:** `ripwire 0.6.10-dev.113+g147c73293 (dev, AppleClang 21.0.0.21000101, emit=std::print, built_from=147c73293)` +- **Repo:** the ripwire repo @ `147c73293` — **CLEAN — `git status --porcelain` is empty**. The diff-aware verbs (`--situ`/`--test-gate`/`--quality-delta`/`--pr-context`/`--map-diff`/`--edit-check`) answer a question about the WORKING TREE, so that condition is part of their answer and every one of their captions below states which tree it recorded against. A clean tree is the honest default for a showcase, so they appear TWICE: once here on the clean tree (their empty/exit-0 shape) and once in the final section against a throwaway `git clone --local` sandbox carrying one deliberate regression, so their real gating shapes are visible without writing a byte into the read-only repo. - **Corpus:** the ripwire repo itself (dogfood), via `./build/ripwire` - **Sandbox diff** (the last section only): `.ripwire_notes | 2 ++ .ripwire_quality_acks | 1 + @@ -23,7 +23,7 @@ *The default ranked symbol map — start here when landing cold in a repo.* -**wall time: 2.84s** +**wall time: 1.83s** ````` <!-- ripwire map schema=ripwire.map/v1: ranked symbol map: <f p= layer=> groups <s t= n= sc= k= amb=> rows (k= rank), <c n=> resolved callees; the header comment is data. est_tokens=: price as emitted (an upper bound under compact). root=: p= relative to it. pr_iters=N: PageRank iterations. data_sections_cut=N: N data Sections (headings, data keys) swapped out of this top-K for lower-ranked code rows; next= pages them first. <inv listed= unlisted=>: files the ranked rows show / do not (sum = files=), each named or counted below. <entry p= n=>: 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. <ls p= n= f=>: 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. overloads=N: N same-name defs merged in this row; shown= counts each. prov=scip|binding|import|split|final-segment: how that <c> 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. <c via="name">: that callee matched by name alone (receiver unproven); it does NOT mean the edge is false. <c x=N>: N same-named via=name rows merged; callees=FILE:SYM lists all. sc=: enclosing scope; the full id is p::sc::n (p= of the row or its <f>) and selectors take it. amb=K: K calls split over several defs. next=: the one pasteable follow-up. --> @@ -63,8 +63,6 @@ *Same map, capped to the 5 highest-ranked symbols.* -**wall time: 1.01s** - ````` <!-- ripwire map schema=ripwire.map/v1: ranked symbol map: <f p= layer=> groups <s t= n= sc= k= amb=> rows (k= rank), <c n=> resolved callees; the header comment is data. est_tokens=: price as emitted (an upper bound under compact). root=: p= relative to it. pr_iters=N: PageRank iterations. <inv listed= unlisted=>: files the ranked rows show / do not (sum = files=), each named or counted below. <entry p= n=>: 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. <ls p= n= f=>: 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 <c> 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. sc=: enclosing scope; the full id is p::sc::n (p= of the row or its <f>) and selectors take it. --> <!-- t=modscope=a-file's-MODULE-SCOPE(n=<file-scope>):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 --> @@ -230,10 +228,10 @@ ripwire: --token-budget exceeded: withheld_est_tokens=10597 > budget=100 *The task lens: ranked signatures + quality metrics framed for the task.* -**wall time: 5.80s** +**wall time: 3.56s** ````` -<ctx task="incremental cache invalidation when a file content hash changes" route="subtoken+body" root="." confidence="low" margin_pct="0" at="914c4045d" doc_mentions="5" schema="ripwire.for/v1" bundle="compact" bodies="0" reason="compact-route" budget_bytes="7500" doc_mentions_capped="1" doc_mentio … [line truncated: 31 more bytes on this line] +<ctx task="incremental cache invalidation when a file content hash changes" route="subtoken+body" root="." confidence="low" margin_pct="0" at="147c73293" doc_mentions="5" schema="ripwire.for/v1" bundle="compact" bodies="0" reason="compact-route" budget_bytes="7500" doc_mentions_capped="1" doc_mentio … [line truncated: 31 more bytes on this line] <!-- ripwire for schema=ripwire.for/v1: bundle=/bodies=/reason= the body posture; d: cx= ccx= complexity, in= callers (absent cx/ccx/in = 0), churn= amp= change, clone= tested= 1, sc= scope, id=p::sc::n; total= shown= capped=1 if cut; task= the query; d pure=1 const/constexpr sig, next= the follow-up to paste; route= name-exact(X)|subtoken+body[:broad|:declined]; confidence=/margin_pct= head score drop (low=flat); h l= p= n=, c n= l= p= (p= if not h's; same-named joined, shown= counts them), noedge= no callee resolved; h calls capped=1 next= the call listing every callee; fold kind=bodies: b t= n= p= l= top ranked rows' whole bodies, not the answer; served= of total= in budget_bytes=; slice/skip p= n= l=; skip bytes= next=; a skip makes sigs next= it, sigs_next= the signatures-only re-call; d mem= an owner's direct member names only, by the index (question words first, then owner's file, path, line, name), mem_more= names cut; t p= file outside sigs (weaker), t sym= its top symbols not in sigs/syms (a pointer, not the answer), r= rank (gap = trimmed); t order: code files first, then doc files (a code question); t page rows go on to file-page row 160 (code question: 160 code rows, docs within row 160); past page 0 (code question: past 40 code rows, a doc past row 40) listed last, head files skipped; past 120 of those p= only, p_only= counts them; t folded=class=N: N p= only rows of that class (doc|config|script|testdata|other) not listed, next= pages to them; d layer=: built-in arch layer (game|infra|render|math|audio|ai|test) from a dir name in p=; d e= its last line (absent=unknown, never 0; l= the name's line); c via=name: that callee matched by name alone, receiver unproven (NOT a claim the edge is false) [doc mentions: 5 docs, 3 symbols; doc_mentions=] --> <!-- root= is the crawl root; p= below is RELATIVE to it (single-root only; absent => p= is ingest's own path, unchanged); at=this commit(+dirty). [budget_bytes= is the default BYTE target this ranked payload was shaped toward: row text shortens toward it, no row of the ranked head is removed for it (sigs past_target=)] [sigs capped=1 with shown=total: rows shrunk, none dropped] [sigs past_target=K: the last K rows are past the budget_bytes target, served because they are rows of the ranked head; none is cut] [sigs next=: one call serving all total= rows uncut] [docs_dropped=N: N shown rows have a doc comment not printed (r>24 always, r5..24 if capped)] [files_first=N: N rows moved so r=1..8 are distinct files' best rows, score order, a repeated name once; same rows; fold, hops keep score order] [cut: doc_mentions_capped="1" doc_mentions_total="6" — an indexing cap dropped content not shown here]; lego/compose collapse to a counted stub by default (a disclosed cut): total= that section's own pre-cap row count, shown="0" capped="1" (nothing rendered here), next= names the sections=lego,compose flag that restores both sections byte-identically in one call est_tokens= prices this bundle in tokens --> <sigs shown="40" total="40" capped="1" past_target="14" docs_dropped="31" files_first="15" next="--for='incremental cache invalidation when a file content hash changes' --signatures-only --token-budget=6600"> @@ -266,14 +264,20 @@ ripwire: --token-budget exceeded: withheld_est_tokens=10597 > budget=100 … [217 more display lines; full output is 24477 bytes on 8 raw line(s)] ````` +stderr: + +````` +ripwire: cache <tmp>: over its 2048 MiB budget — evicted 101 blob(s) of other roots or other ripwire builds (this build's blobs for this root are kept) +````` + ## `./build/ripwire . --for="rankGraphTeleport"` *Name-shaped query: the router picks name-exact BM25 (header says which/why).* -**wall time: 2.06s** +**wall time: 1.47s** ````` -<ctx task="rankGraphTeleport" route="name-exact(rankGraphTeleport); anchors: rankGraphTeleport(src/graph.h)" root="." confidence="high" margin_pct="45" at="914c4045d" doc_mentions="2" schema="ripwire.for/v1" bundle="auto" bodies="1" doc_mentions_capped="1" doc_mentions_total="14" est_tokens="2165"> +<ctx task="rankGraphTeleport" route="name-exact(rankGraphTeleport); anchors: rankGraphTeleport(src/graph.h)" root="." confidence="high" margin_pct="45" at="147c73293" doc_mentions="2" schema="ripwire.for/v1" bundle="auto" bodies="1" doc_mentions_capped="1" doc_mentions_total="14" est_tokens="2165"> <!-- ripwire for schema=ripwire.for/v1: bundle=/bodies=/reason= the body posture; d: cx= ccx= complexity, in= callers (absent cx/ccx/in = 0), churn= amp= change, clone= tested= 1, sc= scope, id=p::sc::n; total= shown= capped=1 if cut; task= the query; d pure=1 const/constexpr sig, next= the follow-up to paste; route= name-exact(X)|subtoken+body[:broad|:declined]; confidence=/margin_pct= head score drop (low=flat); b t= n= p= l= full bodies, c n= l= p= callee signatures (p= if not b's); callers of=: the one function's 1-hop callers, s t= n= sc= p=file:line (n=Owner.name folds sc= on a member; sites_at= its calls as [file:]line, sites_total= if cut; via=name by name only), shown= of total=; d=2 rows: their callers (via=name if every path has a by-name hop), shown_d2= of d2= (d2_capped=1 if cut, else 0); capped=1 if cut; floors; next= the radius; windows=1: the radius call lists only a first page of next_total= rows (the impact verb's own count, a floor), so no page is pointed at: next= lists them all, columnar; t p= file outside sigs (weaker), t sym= its top symbols not in sigs/syms (a pointer, not the answer), r= rank (gap = trimmed); t order: code files first, then doc files (a code question); d e= its last line (absent=unknown, never 0; l= the name's line); c prov=split: a resolver split arm; may be another arm's (NOT a claim the edge is false) [doc mentions: 2 docs, 1 symbol; doc_mentions=] [floor: kept 3 of 40] --> <!-- root= is the crawl root; p= below is RELATIVE to it (single-root only; absent => p= is ingest's own path, unchanged); at=this commit(+dirty). [cut: doc_mentions_capped="1" doc_mentions_total="14" — an indexing cap dropped content not shown here] est_tokens= prices this bundle in tokens --> <sigs> @@ -311,7 +315,7 @@ ripwire: --token-budget exceeded: withheld_est_tokens=10597 > budget=100 *Same query with routing forced OFF (plain subtoken+body BM25) — contrast with the routed run.* ````` -<ctx task="rankGraphTeleport" root="." confidence="low" margin_pct="0" at="914c4045d" doc_mentions="6" schema="ripwire.for/v1" bundle="auto" bodies="4" budget_bytes="7500" doc_mentions_capped="1" doc_mentions_total="22" est_tokens="10974"> +<ctx task="rankGraphTeleport" root="." confidence="low" margin_pct="0" at="147c73293" doc_mentions="6" schema="ripwire.for/v1" bundle="auto" bodies="4" budget_bytes="7500" doc_mentions_capped="1" doc_mentions_total="22" est_tokens="10974"> <!-- ripwire for schema=ripwire.for/v1: bundle=/bodies=/reason= the body posture; d: cx= ccx= complexity, in= callers (absent cx/ccx/in = 0), churn= amp= change, clone= tested= 1, sc= scope, id=p::sc::n; total= shown= capped=1 if cut; task= the query; d pure=1 const/constexpr sig, next= the follow-up to paste; confidence=/margin_pct= head score drop (low=flat); b t= n= p= l= full bodies, c n= l= p= callee signatures (p= if not b's); t p= file outside sigs (weaker), t sym= its top symbols not in sigs/syms (a pointer, not the answer), r= rank (gap = trimmed); t order: code files first, then doc files (a code question); t page rows go on to file-page row 160 (code question: 160 code rows, docs within row 160); past page 0 (code question: past 40 code rows, a doc past row 40) listed last, head files skipped; past 120 of those p= only, p_only= counts them; t folded=class=N: N p= only rows of that class (doc|config|script|testdata|other) not listed, next= pages to them; field name= type= owner= rel=: a member of owner=, rel=creates held by value, uses by reference/pointer; d e= its last line (absent=unknown, never 0; l= the name's line); c prov=split: a resolver split arm; may be another arm's (NOT a claim the edge is false) [doc mentions: 6 docs, 3 symbols; doc_mentions=] --> <!-- root= is the crawl root; p= below is RELATIVE to it (single-root only; absent => p= is ingest's own path, unchanged); at=this commit(+dirty). [budget_bytes= is the default BYTE target this ranked payload was shaped toward: row text shortens toward it, no row of the ranked head is removed for it (sigs past_target=)] [sigs capped=1 with shown=total: rows shrunk, none dropped] [sigs past_target=K: the last K rows are past the budget_bytes target, served because they are rows of the ranked head; none is cut] [sigs next=: one call serving all total= rows uncut] [docs_dropped=N: N shown rows have a doc comment not printed (r>24 always, r5..24 if capped)] [cut: doc_mentions_capped="1" doc_mentions_total="22" — an indexing cap dropped content not shown here] est_tokens= prices this bundle in tokens --> <sigs shown="40" total="40" capped="1" past_target="14" docs_dropped="25" next="--for=rankGraphTeleport --signatures-only --no-route --token-budget=6700"> @@ -348,8 +352,10 @@ ripwire: --token-budget exceeded: withheld_est_tokens=10597 > 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.25s** + ````` -<ctx task="rankGraphTeleport" route="name-exact(rankGraphTeleport); anchors: rankGraphTeleport(src/graph.h)" root="." confidence="high" margin_pct="45" at="914c4045d" doc_mentions="2" schema="ripwire.for/v1" doc_mentions_capped="1" doc_mentions_total="14" est_tokens="959"> +<ctx task="rankGraphTeleport" route="name-exact(rankGraphTeleport); anchors: rankGraphTeleport(src/graph.h)" root="." confidence="high" margin_pct="45" at="147c73293" doc_mentions="2" schema="ripwire.for/v1" doc_mentions_capped="1" doc_mentions_total="14" est_tokens="959"> <!-- ripwire for schema=ripwire.for/v1: bundle=/bodies=/reason= the body posture; d: cx= ccx= complexity, in= callers (absent cx/ccx/in = 0), churn= amp= change, clone= tested= 1, sc= scope, id=p::sc::n; total= shown= capped=1 if cut; task= the query; d pure=1 const/constexpr sig, next= the follow-up to paste; route= name-exact(X)|subtoken+body[:broad|:declined]; confidence=/margin_pct= head score drop (low=flat); t p= file outside sigs (weaker), t sym= its top symbols not in sigs/syms (a pointer, not the answer), r= rank (gap = trimmed); t order: code files first, then doc files (a code question); d e= its last line (absent=unknown, never 0; l= the name's line) [doc mentions: 2 docs, 1 symbol; doc_mentions=] [floor: kept 3 of 40] --> <!-- root= is the crawl root; p= below is RELATIVE to it (single-root only; absent => p= is ingest's own path, unchanged); at=this commit(+dirty). [cut: doc_mentions_capped="1" doc_mentions_total="14" — an indexing cap dropped content not shown here] est_tokens= prices this bundle in tokens --> <sigs> @@ -377,7 +383,7 @@ ripwire: --token-budget exceeded: withheld_est_tokens=10597 > 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]).* ````` -<ctx task="tree-sitter parse of a source file" route="subtoken+body" root="." confidence="low" margin_pct="0" at="914c4045d" doc_mentions="1" schema="ripwire.for/v1" bundle="compact" bodies="0" reason="compact-route" budget_bytes="7500" est_tokens="10088"> +<ctx task="tree-sitter parse of a source file" route="subtoken+body" root="." confidence="low" margin_pct="0" at="147c73293" doc_mentions="1" schema="ripwire.for/v1" bundle="compact" bodies="0" reason="compact-route" budget_bytes="7500" est_tokens="10088"> <!-- ripwire for schema=ripwire.for/v1: bundle=/bodies=/reason= the body posture; d: cx= ccx= complexity, in= callers (absent cx/ccx/in = 0), churn= amp= change, clone= tested= 1, sc= scope, id=p::sc::n; total= shown= capped=1 if cut; task= the query; d pure=1 const/constexpr sig, next= the follow-up to paste; d same_as=N: doc+sig text as row n=N (not repeated); route= name-exact(X)|subtoken+body[:broad|:declined]; confidence=/margin_pct= head score drop (low=flat); h l= p= n=, c n= l= p= (p= if not h's; same-named joined, shown= counts them), noedge= no callee resolved; fold kind=bodies: b t= n= p= l= top ranked rows' whole bodies, not the answer; served= of total= in budget_bytes=; slice/skip p= n= l=; skip bytes= next=; a skip makes sigs next= it, sigs_next= the signatures-only re-call; d mem= an owner's direct member names only, by the index (question words first, then owner's file, path, line, name), mem_more= names cut; t p= file outside sigs (weaker), t sym= its top symbols not in sigs/syms (a pointer, not the answer), r= rank (gap = trimmed); t order: code files first, then doc files (a code question); t page rows go on to file-page row 160 (code question: 160 code rows, docs within row 160); past page 0 (code question: past 40 code rows, a doc past row 40) listed last, head files skipped; past 120 of those p= only, p_only= counts them; t folded=class=N: N p= only rows of that class (doc|config|script|testdata|other) not listed, next= pages to them; d e= its last line (absent=unknown, never 0; l= the name's line) [adaptive: kept 40 of 40 - no relevance cliff (broad query saturates the score); capped at the ceiling] [doc mentions: 1 doc, 1 symbol; doc_mentions=] --> <!-- root= is the crawl root; p= below is RELATIVE to it (single-root only; absent => p= is ingest's own path, unchanged); at=this commit(+dirty). [budget_bytes= is the default BYTE target this ranked payload was shaped toward: row text shortens toward it, no row of the ranked head is removed for it (sigs past_target=)] [sigs capped=1 with shown=total: rows shrunk, none dropped] [sigs past_target=K: the last K rows are past the budget_bytes target, served because they are rows of the ranked head; none is cut] [sigs next=: one call serving all total= rows uncut] [docs_dropped=N: N shown rows have a doc comment not printed (r>24 always, r5..24 if capped)] [files_first=N: N rows moved so r=1..8 are distinct files' best rows, score order, a repeated name once; same rows; fold, hops keep score order]; lego/compose collapse to a counted stub by default (a disclosed cut): total= that section's own pre-cap row count, shown="0" capped="1" (nothing rendered here), next= names the sections=lego,compose flag that restores both sections byte-identically in one call est_tokens= prices this bundle in tokens --> <sigs shown="40" total="40" capped="1" past_target="7" docs_dropped="24" files_first="7" next="--for='tree-sitter parse of a source file' --signatures-only --adaptive --token-budget=5400"> @@ -414,10 +420,8 @@ ripwire: --token-budget exceeded: withheld_est_tokens=10597 > budget=100 *Mention anchoring (default-on): a path and a Symbol literally named in the task get lifted; the header says what anchored.* -**wall time: 1.01s** - ````` -<ctx task="why does src/lexical.h chooseForRanker pick name-exact BM25" route="subtoken+body" root="." confidence="low" margin_pct="0" at="914c4045d" mention_anchored="3" doc_mentions="4" schema="ripwire.for/v1" bundle="compact" bodies="0" reason="compact-route" budget_bytes="7500" doc_mentions_capp … [line truncated: 49 more bytes on this line] +<ctx task="why does src/lexical.h chooseForRanker pick name-exact BM25" route="subtoken+body" root="." confidence="low" margin_pct="0" at="147c73293" mention_anchored="3" doc_mentions="4" schema="ripwire.for/v1" bundle="compact" bodies="0" reason="compact-route" budget_bytes="7500" doc_mentions_capp … [line truncated: 49 more bytes on this line] <!-- ripwire for schema=ripwire.for/v1: bundle=/bodies=/reason= the body posture; d: cx= ccx= complexity, in= callers (absent cx/ccx/in = 0), churn= amp= change, clone= tested= 1, sc= scope, id=p::sc::n; total= shown= capped=1 if cut; task= the query; d pure=1 const/constexpr sig, next= the follow-up to paste; route= name-exact(X)|subtoken+body[:broad|:declined]; confidence=/margin_pct= head score drop (low=flat); h l= p= n=, c n= l= p= (p= if not h's; same-named joined, shown= counts them), noedge= no callee resolved; h qword= its name (case-folded, leading _#$@ dropped) equals that question word (by name, not resolved, not the only one), first, calls to 100 (capped=1 next= all); qword_cut= owners not so served, next= the first; fold kind=bodies: b t= n= p= l= top ranked rows' whole bodies, not the answer; served= of total= in budget_bytes=; slice/skip p= n= l=; skip bytes= next=; a skip makes sigs next= it, sigs_next= the signatures-only re-call; t p= file outside sigs (weaker), t sym= its top symbols not in sigs/syms (a pointer, not the answer), r= rank (gap = trimmed); t tsym= up to 2 more file symbols named by a task word (a name match); t order: code files first, then doc files (a code question); t page rows go on to file-page row 160 (code question: 160 code rows, docs within row 160); past page 0 (code question: past 40 code rows, a doc past row 40) listed last, head files skipped; past 120 of those p= only, p_only= counts them; t folded=class=N: N p= only rows of that class (doc|config|script|testdata|other) not listed, next= pages to them; d layer=: built-in arch layer (game|infra|render|math|audio|ai|test) from a dir name in p=; d e= its last line (absent=unknown, never 0; l= the name's line); c prov=split: a resolver split arm; may be another arm's (NOT a claim the edge is false) [mention anchor: 1 file + 2 symbols; mention_anchored=] [doc mentions: 4 docs, 2 symbols; doc_mentions=] --> <!-- root= is the crawl root; p= below is RELATIVE to it (single-root only; absent => p= is ingest's own path, unchanged); at=this commit(+dirty). [budget_bytes= is the default BYTE target this ranked payload was shaped toward: row text shortens toward it, no row of the ranked head is removed for it (sigs past_target=)] [sigs capped=1 with shown=total: rows shrunk, none dropped] [sigs past_target=K: the last K rows are past the budget_bytes target, served because they are rows of the ranked head; none is cut] [sigs next=: one call serving all total= rows uncut] [docs_dropped=N: N shown rows have a doc comment not printed (r>24 always, r5..24 if capped)] [docs_after_code=N: N doc rows of the shown set moved below its code rows; same rows, reordered, none added or removed; a question naming docs keeps score order] [cut: doc_mentions_capped="1" doc_mentions_total="7" — an indexing cap dropped content not shown here]; lego/compose collapse to a counted stub by default (a disclosed cut): total= that section's own pre-cap row count, shown="0" capped="1" (nothing rendered here), next= names the sections=lego,compose flag that restores both sections byte-identically in one call est_tokens= prices this bundle in tokens --> <sigs shown="40" total="40" capped="1" past_target="16" docs_dropped="28" docs_after_code="2" next="--for='why does src/lexical.h chooseForRanker pick name-exact BM25' --signatures-only --token-budget=6500"> @@ -454,10 +458,8 @@ ripwire: --token-budget exceeded: withheld_est_tokens=10597 > budget=100 *Same task with the anchor disabled — the contrast the flag exists for.* -**wall time: 1.26s** - ````` -<ctx task="why does src/lexical.h chooseForRanker pick name-exact BM25" route="subtoken+body" root="." confidence="low" margin_pct="0" at="914c4045d" doc_mentions="2" schema="ripwire.for/v1" bundle="compact" bodies="0" reason="compact-route" budget_bytes="7500" doc_mentions_capped="1" doc_mentions_t … [line truncated: 28 more bytes on this line] +<ctx task="why does src/lexical.h chooseForRanker pick name-exact BM25" route="subtoken+body" root="." confidence="low" margin_pct="0" at="147c73293" doc_mentions="2" schema="ripwire.for/v1" bundle="compact" bodies="0" reason="compact-route" budget_bytes="7500" doc_mentions_capped="1" doc_mentions_t … [line truncated: 28 more bytes on this line] <!-- ripwire for schema=ripwire.for/v1: bundle=/bodies=/reason= the body posture; d: cx= ccx= complexity, in= callers (absent cx/ccx/in = 0), churn= amp= change, clone= tested= 1, sc= scope, id=p::sc::n; total= shown= capped=1 if cut; task= the query; d pure=1 const/constexpr sig, next= the follow-up to paste; route= name-exact(X)|subtoken+body[:broad|:declined]; confidence=/margin_pct= head score drop (low=flat); h l= p= n=, c n= l= p= (p= if not h's; same-named joined, shown= counts them), noedge= no callee resolved; h qword= its name (case-folded, leading _#$@ dropped) equals that question word (by name, not resolved, not the only one), first, calls to 100 (capped=1 next= all); qword_cut= owners not so served, next= the first; fold kind=bodies: b t= n= p= l= top ranked rows' whole bodies, not the answer; served= of total= in budget_bytes=; slice/skip p= n= l=; skip bytes= next=; a skip makes sigs next= it, sigs_next= the signatures-only re-call; t p= file outside sigs (weaker), t sym= its top symbols not in sigs/syms (a pointer, not the answer), r= rank (gap = trimmed); t tsym= up to 2 more file symbols named by a task word (a name match); t order: code files first, then doc files (a code question); t page rows go on to file-page row 160 (code question: 160 code rows, docs within row 160); past page 0 (code question: past 40 code rows, a doc past row 40) listed last, head files skipped; past 120 of those p= only, p_only= counts them; t folded=class=N: N p= only rows of that class (doc|config|script|testdata|other) not listed, next= pages to them; d layer=: built-in arch layer (game|infra|render|math|audio|ai|test) from a dir name in p=; d e= its last line (absent=unknown, never 0; l= the name's line); c prov=split: a resolver split arm; may be another arm's (NOT a claim the edge is false) [doc mentions: 2 docs, 1 symbol; doc_mentions=] --> <!-- root= is the crawl root; p= below is RELATIVE to it (single-root only; absent => p= is ingest's own path, unchanged); at=this commit(+dirty). [budget_bytes= is the default BYTE target this ranked payload was shaped toward: row text shortens toward it, no row of the ranked head is removed for it (sigs past_target=)] [sigs capped=1 with shown=total: rows shrunk, none dropped] [sigs past_target=K: the last K rows are past the budget_bytes target, served because they are rows of the ranked head; none is cut] [sigs sigs_next=: one call serving all total= rows uncut] [docs_dropped=N: N shown rows have a doc comment not printed (r>24 always, r5..24 if capped)] [cut: doc_mentions_capped="1" doc_mentions_total="3" — an indexing cap dropped content not shown here]; lego/compose collapse to a counted stub by default (a disclosed cut): total= that section's own pre-cap row count, shown="0" capped="1" (nothing rendered here), next= names the sections=lego,compose flag that restores both sections byte-identically in one call est_tokens= prices this bundle in tokens --> <sigs shown="40" total="40" capped="1" past_target="14" docs_dropped="30" sigs_next="--for='why does src/lexical.h chooseForRanker pick name-exact BM25' --signatures-only --no-mention-boost --token-budget=6400" next="--expand=src/eval.h:716:runEvalRetrieval"> @@ -561,7 +563,7 @@ ripwire: --token-budget exceeded: withheld_est_tokens=10597 > budget=100 ````` ripwire recall — "quality delta gating exit codes" — 146 relevant of 359 document files, best-first — total=146 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 21.925) ━━ [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.928) ━━ [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. @@ -585,7 +587,7 @@ refuses by default. -━━ CHANGELOG.md (relevance 20.987) ━━ [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 20.991) ━━ [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 @@ -600,17 +602,38 @@ ripwire: redacted 1 secret from emitted context (keyword-gated-secret=1) — pas ## `./build/ripwire <scratch>/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 1503096-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 1502787-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=957 +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.185) ━━ [sections: 1 of 166 selected (196 in doc), section-granular; whole doc 639729 B; lines="566-591"; dropped_by_budget=165] [truncated: 1854 of 4284 bytes] +#### Pattern: a directory of dumped tool output as a knowledge base -━━ commands.md (relevance 33.748) ━━ [sections: 1 of 166 selected (196 in doc), section-granular; whole doc 639182 B; lines="3910-3914"; dropped_by_budget=165] [truncated: 1865 of 7797 bytes] -### `--field-affinity[=STRUCT]` +**Answers:** can `--recall` serve as a zero-setup knowledge base over dumped tool output — a +`git log`, an API response dump, a fetched doc, `<tool> --help` text — sitting in a scratch +directory, instead of a source repo? -**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. +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: -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] +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. … (capped: 1 of 2 relevant document files omitted — raise --max-tokens/budget_tokens or narrow the query for 1 more (~2548-byte budget)) ````` @@ -663,7 +686,7 @@ ripwire: redacted 1 secret from emitted context (keyword-gated-secret=1) — pas *Self-contained HTML force-directed call graph.* -**wall time: 1.86s** +**wall time: 1.50s** ````` (empty) @@ -871,7 +894,7 @@ Artifact written: *Unknown-symbol REFUSAL shape (exit 1) with a did-you-mean from real edit distance.* -**exit code: 1** — **wall time: 1.01s** +**exit code: 1** ````` <!-- ripwire callers schema=ripwire.callers/v1: 1-hop CALLERS of of= (defs= matched, count= distinct symbols): <s t= n= p=>; hop_tested=/hop_untested=. found=0: no indexed definition matched the selector, nothing listed or counted (zero = none found, not none exists); exit stays 1. --> @@ -1204,7 +1227,7 @@ ripwire: --callers symbol not found: DoesNotExist (note: the lexical definition ````` ripwire situational-awareness — 0 changed file(s), 0 symbols in them root: . -at: 914c4045d +at: 147c73293 (0 changed files — working tree is clean, nothing to analyze) ````` @@ -1212,7 +1235,7 @@ at: 914c4045d *Pre-PR gate on a CLEAN tree: no obligations, exit 0.* -**wall time: 6.64s** +**wall time: 4.57s** ````` <!-- ripwire test-gate schema=ripwire.test-gate/v1: tests <t p= changed= partner= hops= run=> + untested blast radius <u sym= p= l= ccx=>; exit 4 while either exists. tests_capped=/untested_capped=: 1 = cut. counts_floor=1: every count is a FLOOR, never a total. graph_ambiguous=/graph_unresolved=: resolver gauge. graph_unindexed=N: N files no grammar could read (the map header's unindexed=); their calls raise neither gauge. at=: commit+dirty+shallow. next=: the one pasteable follow-up. impacted=N: symbols that transitively call the change (changed symbols excluded). shown_tests=/shown_untested=: t rows and u rows printed, two independent counts. script_gates_unmodelled=N: test/*.sh runners in the corpus, a path count; not call-graph modelled. script_gates_registered=N: shell gates test/regression.sh registers as suite members. script_gates_mapped=N: registered gates with exact dependency evidence (literal paths or RIPWIRE_TEST_DEPS). script_gates_unresolved_dynamic=N: registered gates with no mappable deps; they may cover the change unlisted. ccx_bar=N: the cognitive-complexity bar a u row's ccx= is read against. untested_modscope=N: <file-scope> owners excluded from untested= (#324, uncallable); still in impacted=. tests=/untested=: tests to run (t total) / impacted symbols no test reaches (u total). --> @@ -1359,8 +1382,6 @@ at: 914c4045d *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: 1.07s** - ````` <!-- ripwire match schema=ripwire.match/v1: tree-sitter structural query: <m p= in=> captured nodes with their enclosing symbol; grammars=/eligible_files= the scope. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). counts_floor=1: every count is a FLOOR, never a total. hits_capped=1: hits= is a floor. root=: p= relative to it. auto_captured=1: the query bound no @capture, so @m was appended to its single top-level pattern. of_files=: indexed files in all (eligible_files= of them are in the query's languages). --> <match schema="ripwire.match/v1" hits="5000" shown="100" capped="1" total="5000" has_more="1" next_offset="100" offset="0" limit="0" counts_floor="1" hits_capped="1" auto_captured="1" grammars="cpp,c,python,go,typescript,tsx,swift,objc,javascript,bash,java,csharp,php,dart,lua,gdscript" eligible_file … [line truncated: 34 more bytes on this line] @@ -1399,8 +1420,6 @@ at: 914c4045d *The same shape query WITH an explicit capture — identical hits, no auto_captured= attribute.* -**wall time: 1.03s** - ````` <!-- ripwire match schema=ripwire.match/v1: tree-sitter structural query: <m p= in=> captured nodes with their enclosing symbol; grammars=/eligible_files= the scope. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). counts_floor=1: every count is a FLOOR, never a total. hits_capped=1: hits= is a floor. root=: p= relative to it. of_files=: indexed files in all (eligible_files= of them are in the query's languages). --> <match schema="ripwire.match/v1" hits="5000" shown="100" capped="1" total="5000" has_more="1" next_offset="100" offset="0" limit="0" counts_floor="1" hits_capped="1" grammars="cpp,c,python,go,typescript,tsx,swift,objc,javascript,bash,java,csharp,php,dart,lua,gdscript" eligible_files="3634" of_files= … [line truncated: 16 more bytes on this line] @@ -1448,11 +1467,11 @@ at: 914c4045d <!-- files=4852 symbols=45031 edges=45381 shown=5 est_tokens=1513 ambiguous=3984 unresolved=20100 locality_pinned=14 external=12460 declined=45307 extent_suspect_syms=12 macro_blanked_files=7 skipped_oversize=15 unindexed="txt:85,tsv:54,mod:33,xml:33,jsonl:26,scm:25" unindexed_exts=23 order=important-first --> <r schema="ripwire.query/v1" root="." est_tokens="1513"> <f p="src/serialize.h"> -<s t="var" n="kChurnRankLegend" sc="rw" k="19.7955"> +<s t="var" n="kChurnRankLegend" sc="rw" k="19.7957"> </s> </f> <f p="src/mcpverbs.h"> -<s t="fn" n="rankByText" sc="rw" k="15.5254"> +<s t="fn" n="rankByText" sc="rw" k="15.5257"> <c n="takeRank"/> <c n="rankGraph"/> <c n="hits"/> @@ -1463,12 +1482,12 @@ at: 914c4045d </s> </f> <f p="src/gitmine.h"> -<s t="fn" n="churnPriorFromFreq" sc="rw" k="13.5824"> +<s t="fn" n="churnPriorFromFreq" sc="rw" k="13.5826"> <c n="DISCLOSE"/> </s> </f> <f p="src/pagerank.cpp"> -<s t="fn" n="pageRankDouble" sc="rw" amb="3" k="13.4173"> +<s t="fn" n="pageRankDouble" sc="rw" amb="3" k="13.4175"> <c n="ASSUME"/> … [23 more display lines; full output is 3783 bytes on 1 raw line(s)] ````` @@ -1482,10 +1501,8 @@ at: 914c4045d *Importance-weighted detail: FULL bodies for top-2, signatures for the rest.* -**wall time: 1.06s** - ````` -<ctx task="pagerank power iteration" route="subtoken+body" root="." confidence="high" margin_pct="22" at="914c4045d" doc_mentions="4" schema="ripwire.for/v1" budget_bytes="7500" doc_mentions_capped="1" doc_mentions_total="14" est_tokens="7389"> +<ctx task="pagerank power iteration" route="subtoken+body" root="." confidence="high" margin_pct="22" at="147c73293" doc_mentions="4" schema="ripwire.for/v1" budget_bytes="7500" doc_mentions_capped="1" doc_mentions_total="14" est_tokens="7389"> <!-- ripwire for schema=ripwire.for/v1: bundle=/bodies=/reason= the body posture; d: cx= ccx= complexity, in= callers (absent cx/ccx/in = 0), churn= amp= change, clone= tested= 1, sc= scope, id=p::sc::n; total= shown= capped=1 if cut; task= the query; d pure=1 const/constexpr sig, next= the follow-up to paste; d same_as=N: doc+sig text as row n=N (not repeated); route= name-exact(X)|subtoken+body[:broad|:declined]; confidence=/margin_pct= head score drop (low=flat); t p= file outside sigs (weaker), t sym= its top symbols not in sigs/syms (a pointer, not the answer), r= rank (gap = trimmed); t tsym= up to 2 more file symbols named by a task word (a name match); t order: code files first, then doc files (a code question); t page rows go on to file-page row 160 (code question: 160 code rows, docs within row 160); past page 0 (code question: past 40 code rows, a doc past row 40) listed last, head files skipped; past 120 of those p= only, p_only= counts them; t folded=class=N: N p= only rows of that class (doc|config|script|testdata|other) not listed, next= pages to them; d layer=: built-in arch layer (game|infra|render|math|audio|ai|test) from a dir name in p=; d e= its last line (absent=unknown, never 0; l= the name's line) [doc mentions: 4 docs, 2 symbols; doc_mentions=] --> <!-- root= is the crawl root; p= below is RELATIVE to it (single-root only; absent => p= is ingest's own path, unchanged); at=this commit(+dirty). [budget_bytes= is the default BYTE target this ranked payload was shaped toward: row text shortens toward it, no row of the ranked head is removed for it (sigs past_target=)] [sigs capped=1 with shown=total: rows shrunk, none dropped] [sigs past_target=K: the last K rows are past the budget_bytes target, served because they are rows of the ranked head; none is cut] [sigs next=: one call serving all total= rows uncut] [docs_dropped=N: N shown rows have a doc comment not printed (r>24 always, r5..24 if capped)] [docs_after_code=N: N doc rows of the shown set moved below its code rows; same rows, reordered, none added or removed; a question naming docs keeps score order] [files_first=N: N rows moved so r=1..8 are distinct files' best rows, score order, a repeated name once; same rows; fold, hops keep score order] [cut: doc_mentions_capped="1" doc_mentions_total="14" — an indexing cap dropped content not shown here]; lego/compose collapse to a counted stub by default (a disclosed cut): total= that section's own pre-cap row count, shown="0" capped="1" (nothing rendered here), next= names the sections=lego,compose flag that restores both sections byte-identically in one call est_tokens= prices this bundle in tokens --> <sigs shown="40" total="40" capped="1" past_target="14" docs_dropped="25" docs_after_code="5" files_first="7" next="--for='pagerank power iteration' --signatures-only --token-budget=6200"> @@ -1685,20 +1702,48 @@ ripwire: --outline=rankGraphTeleport:1-10: --outline has no line-range form — for( const double value : teleport )]]><calls total="4"><c n="biasPrior" l="14880">inline std::vector<float> biasPrior( const Graph& g, const std::vector<float>& p )</c><c n="PROFILE_SCOPE_DESCRIBE" l="1282" p="src/infra/profileScope.h">#define PROFILE_SCOPE_DESCRIBE( des … [line truncated: 411 more bytes on this line] ````` -## `./build/ripwire . --expand=compressBody --top-k=0 --compress` +## `./build/ripwire . --expand=collapseBlankLineRuns --top-k=0 --compress` -*Comments stripped + blank runs collapsed — compressBody is the function that implements --compress itself, chosen because it is comment-heavy enough to show a real reduction (the previously captioned symbol had no comments or blank runs, so before/after were byte-identical under a caption promising a difference).* +*Comments stripped + blank runs collapsed — collapseBlankLineRuns is --compress's own second step (compressBody is now the one-line stripCommentsKeepLiterals-then-collapse pipeline, with nothing left to strip), chosen because it is comment-heavy enough to show a real reduction (a symbol with no comments or blank runs reads byte-identical, or a few bytes larger for the compress attribute, under a caption promising a difference).* ````` -<ctx schema="ripwire.expand/v1" root="." est_tokens="906"> +<ctx schema="ripwire.expand/v1" root="." est_tokens="1040"> <!-- ripwire expand schema=ripwire.expand/v1: full bodies: <bodies shown= total= capped=> of <b t= l= p= n= sibs= sibs_total= sibs_capped= inc=>; <calls> <c n= l= p=> 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. inc_total=N: the file's true include/import count; inc= lists the first 2 … [line truncated: 200 more bytes on this line] <bodies shown="1" total="1" capped="0" compress="1"> -<b t="fn" l="5212" p="src/serialize.h" n="compressBody" sibs="<file-scope>,xmlSafeByte,xmlScrubIsLossy,xmlControlCharRef,eraseAbsentClause,spliceClauseAfter,kXmlEscapeByteset,escapeXml,kMultiRootTableLegend,multiRootTableLegend,xmlCommentText,ctxRootOpen,ctxRootOpenParts,ctxRootJsonScrubKeys,c … [line truncated: 2003 more bytes on this line] -<![CDATA[inline std::string compressBody( std::string_view src ) +<b t="fn" l="5179" p="src/serialize.h" n="collapseBlankLineRuns" sibs="<file-scope>,xmlSafeByte,xmlScrubIsLossy,xmlControlCharRef,eraseAbsentClause,spliceClauseAfter,kXmlEscapeByteset,escapeXml,kMultiRootTableLegend,multiRootTableLegend,xmlCommentText,ctxRootOpen,ctxRootOpenParts,ctxRootJsonSc … [line truncated: 2012 more bytes on this line] +<![CDATA[inline std::string collapseBlankLineRuns( std::string_view text ) { - return collapseBlankLineRuns( stripCommentsKeepLiterals( src ) ); -}]]><calls total="2"><c n="stripCommentsKeepLiterals" l="5140">inline std::string stripCommentsKeepLiterals( std::string_view src )</c><c n="collapseBlankLineRuns" l="5179">inline std::string collapseBlankLineRuns( std::string_view text )</c></calls></b></bodies></ctx> + std::string result; + result.reserve( text.size() ); + std::size_t blanks = 0; + std::size_t pos = 0; + while( pos < text.size() ) + { + const std::size_t eol = std::min( text.find( '\n', pos ), text.size() ); + const std::string_view line = text.substr( pos, eol - pos ); + if( line.find_first_not_of( " \t\r" ) != std::string_view::npos ) + { + blanks = 0; + result.append( line ); + if( eol < text.size() ) + { + result += '\n'; + } + } + + else if( !result.empty() && ++blanks <= 2 ) + { + result += '\n'; + } + pos = eol + 1; + } + while( !result.empty() && result.back() == '\n' ) + { + result.pop_back(); + } + return result; +}]]></b></bodies></ctx> ````` ## `./build/ripwire . --expand=readAckRecords --top-k=0 --no-redact` @@ -1868,12 +1913,12 @@ ripwire: --pack-top-n is deprecated — use --pack-task/--detail instead (unchan *Complexity x recent git churn (maintenance pain).* -**wall time: 2.08s** +**wall time: 1.40s** ````` <!-- ripwire hotspots schema=ripwire.hotspots/v1: maintenance pain = churn x ccx over window=: <f p= churn= ccx= score= top= top_ccx= top_l=>; unranked_*= no churn/complexity. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). at=: commit+dirty+shallow. root=: p= relative to it. files=/ranked=: files in the window / those with both churn and complexity; ranked + unranked_no_churn + unranked_no_complexity = files. unranked_no_churn=/unranked_no_complexity=: files left out for no commit in window= / no measured complexity. --> <!-- extent_suspect_syms=K on a row = K of the file's functions failed an extent/scope containment check (the map, the bundles and the skipped verb mark each one, reasons and all) and are LEFT OUT of that row's ccx=, score= and top=, so its ccx= is a FLOOR of the file's true sum rather than a total. unranked_extent_suspect= counts files with commits whose every scorable function was left out that way (or whose trusted remainder scores 0), so ranked= + unranked_no_churn= + unranked_no_complexity= + unranked_extent_suspect= = files= exactly. Absent = nothing excluded. --> -<hotspots schema="ripwire.hotspots/v1" window="12mo@HEAD" files="4852" ranked="1122" unranked_no_churn="0" unranked_no_complexity="3728" unranked_extent_suspect="2" shown="40" capped="1" total="1122" has_more="1" next_offset="40" offset="0" limit="0" root="." at="914c4045d"> +<hotspots schema="ripwire.hotspots/v1" window="12mo@HEAD" files="4852" ranked="1122" unranked_no_churn="0" unranked_no_complexity="3728" unranked_extent_suspect="2" shown="40" capped="1" total="1122" has_more="1" next_offset="40" offset="0" limit="0" root="." at="147c73293"> <f p="src/graph.h" churn="732" ccx="6723" score="4921236" top="buildGraph" top_ccx="1979" top_l="10846"/> <f p="src/quality.h" churn="693" ccx="2657" score="1841301" top="computeDelta" top_ccx="318" top_l="12009"/> <f p="src/serialize.h" churn="521" ccx="2407" score="1254047" top="packSignatures" top_ccx="235" top_l="6525"/> @@ -1908,7 +1953,7 @@ ripwire: --pack-top-n is deprecated — use --pack-task/--detail instead (unchan *Token-normalized duplicate bodies.* -**wall time: 2.01s** +**wall time: 1.35s** ````` <!-- ripwire clones schema=ripwire.clones/v1: similar normalized-token bodies: <group type=2|3 gid= tokens= n= similarity=> of <f n= p=>; 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, call-sequence. --> @@ -1948,40 +1993,40 @@ ripwire: --pack-top-n is deprecated — use --pack-task/--detail instead (unchan *Files that change together in git (hidden coupling).* -**wall time: 2.24s** +**wall time: 1.45s** ````` <!-- ripwire cochange schema=ripwire.cochange/v1: files that change together in git: <pair a= b= together= deg= conf_ab= conf_ba= surprising=>, or for of= <f p= together= conf_rev=>. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). at=: commit+dirty+shallow. root=: p= relative to it. pairs=N: file pairs with 3+ shared commits in window= (after min_recur), surprising or not. sub_windows=N: equal-commit-count slices of window=; the denominator of recur=. driver=a|b: the side whose changes best imply the other's, look there first; absent on a tie. recur=K: slices of sub_windows= the pair co-changed in; 1 = one burst, not a standing coupling. --> -<cochange schema="ripwire.cochange/v1" pairs="5714" window="18mo@HEAD" sub_windows="3" shown="30" capped="1" total="5714" has_more="1" next_offset="30" offset="0" limit="0" root="." at="914c4045d"> +<cochange schema="ripwire.cochange/v1" pairs="5714" window="18mo@HEAD" sub_windows="3" shown="30" capped="1" total="5714" has_more="1" next_offset="30" offset="0" limit="0" root="." at="147c73293"> <pair a="src/aliasdef.h" b="src/ingest_sidecap.h" together="5" deg="1.00" conf_ab="1.00" conf_ba="0.03" driver="a" recur="1" surprising="1"/> <pair a="test/headsnapcachecheck.sh" b="test/qsnapcachecheck.sh" together="5" deg="1.00" conf_ab="1.00" conf_ba="0.83" driver="a" recur="3" surprising="1"/> -<pair a="src/cli.h" b="src/handoffwindow.h" together="4" deg="1.00" conf_ab="0.01" conf_ba="1.00" driver="b" recur="1" surprising="1"/> +<pair a="src/layout.h" b="test/layoutfix/attrfields.h" together="4" deg="1.00" conf_ab="0.11" conf_ba="1.00" driver="b" recur="1" surprising="1"/> <pair a="src/main.cpp" b="src/warmsnap_model.h" together="4" deg="1.00" conf_ab="0.01" conf_ba="1.00" driver="b" recur="1" surprising="1"/> +<pair a="src/cli.h" b="src/handoffwindow.h" together="4" deg="1.00" conf_ab="0.01" conf_ba="1.00" driver="b" recur="1" surprising="1"/> <pair a="src/foraliashop.h" b="src/verbs_navigate.h" together="4" deg="1.00" conf_ab="1.00" conf_ba="0.01" driver="a" recur="1" surprising="1"/> -<pair a="src/layout.h" b="test/layoutfix/attrfields.h" together="4" deg="1.00" conf_ab="0.11" conf_ba="1.00" driver="b" recur="1" surprising="1"/> -<pair a="src/ingest_valuerefs.h" b="src/pydottedpath.h" together="3" deg="1.00" conf_ab="0.04" conf_ba="1.00" driver="b" recur="1" surprising="1"/> -<pair a="test/pincensuscheck.sh" b="test/scipjoincheck.sh" together="3" deg="1.00" conf_ab="0.38" conf_ba="1.00" driver="b" recur="2" surprising="1"/> +<pair a="test/qschemetripcheck.sh" b="test/rubyrequirecheck.sh" together="3" deg="1.00" conf_ab="0.01" conf_ba="1.00" driver="b" recur="1" surprising="1"/> <pair a="test/grepcheck.sh" b="test/grepcontextcheck.sh" together="3" deg="1.00" conf_ab="0.50" conf_ba="1.00" driver="b" recur="1" surprising="1"/> +<pair a="src/arch.h" b="test/fileset_unit.cpp" together="3" deg="1.00" conf_ab="0.07" conf_ba="1.00" driver="b" recur="1" surprising="1"/> +<pair a="test/rubyrecvcheck.sh" b="test/rubyrequirecheck.sh" together="3" deg="1.00" conf_ab="0.50" conf_ba="1.00" driver="b" recur="1" surprising="1"/> <pair a="test/arityfix/argtype/buf.cc" b="test/arityfix/argtype/watermark.cc" together="3" deg="1.00" conf_ab="1.00" conf_ba="1.00" recur="1" surprising="1"/> -<pair a="test/luacheck.sh" b="test/phpcheck.sh" together="3" deg="1.00" conf_ab="0.75" conf_ba="1.00" driver="b" recur="2" surprising="1"/> -<pair a="src/ingest_cache.h" b="src/refnames.h" together="3" deg="1.00" conf_ab="0.01" conf_ba="1.00" driver="b" recur="1" surprising="1"/> +<pair a="test/grepcontextcheck.sh" b="test/grepscancheck.sh" together="3" deg="1.00" conf_ab="1.00" conf_ba="1.00" recur="1" surprising="1"/> +<pair a="test/gatecountcheck.sh" b="test/regression.sh" together="3" deg="1.00" conf_ab="1.00" conf_ba="0.00" driver="a" recur="2" surprising="1"/> +<pair a="test/elixircheck.sh" b="test/elixirsemanticcheck.sh" together="3" deg="1.00" conf_ab="0.13" conf_ba="1.00" driver="b" recur="2" surprising="1"/> <pair a="test/fnslotcpp2/dep.cc" b="test/fnslotcpp2/use_bnd.cc" together="3" deg="1.00" conf_ab="1.00" conf_ba="0.75" driver="a" recur="1" surprising="1"/> +<pair a="src/verbs_report.h" b="test/fileset_unit.cpp" together="3" deg="1.00" conf_ab="0.03" conf_ba="1.00" driver="b" recur="1" surprising="1"/> +<pair a="test/mcpslicecheck.sh" b="test/mcpverbscheck.sh" together="3" deg="1.00" conf_ab="1.00" conf_ba="0.16" driver="a" recur="2" surprising="1"/> +<pair a="test/pincensuscheck.sh" b="test/scipjoincheck.sh" together="3" deg="1.00" conf_ab="0.38" conf_ba="1.00" driver="b" recur="2" surprising="1"/> <pair a="src/argtypepick.h" b="test/arityfix/argtype/watermark.cc" together="3" deg="1.00" conf_ab="0.50" conf_ba="1.00" driver="b" recur="1" surprising="1"/> <pair a="src/argtypepick.h" b="test/arityfix/argtype/buf.h" together="3" deg="1.00" conf_ab="0.50" conf_ba="1.00" driver="b" recur="1" surprising="1"/> -<pair a="test/gatecountcheck.sh" b="test/manifestcheck.sh" together="3" deg="1.00" conf_ab="1.00" conf_ba="0.23" driver="a" recur="2" surprising="1"/> <pair a="src/argtypepick.h" b="test/arityfix/argtype/buf.cc" together="3" deg="1.00" conf_ab="0.50" conf_ba="1.00" driver="b" recur="1" surprising="1"/> -<pair a="test/mcpslicecheck.sh" b="test/mcpverbscheck.sh" together="3" deg="1.00" conf_ab="1.00" conf_ba="0.16" driver="a" recur="2" surprising="1"/> -<pair a="src/arch.h" b="test/fileset_unit.cpp" together="3" deg="1.00" conf_ab="0.07" conf_ba="1.00" driver="b" recur="1" surprising="1"/> -<pair a="src/graph.h" b="test/fileset_unit.cpp" together="3" deg="1.00" conf_ab="0.00" conf_ba="1.00" driver="b" recur="1" surprising="1"/> -<pair a="bench/scip_match_diag.py" b="bench/scip_pin_precision.py" together="3" deg="1.00" conf_ab="1.00" conf_ba="0.60" driver="a" recur="2" surprising="1"/> -<pair a="test/gatecountcheck.sh" b="test/regression.sh" together="3" deg="1.00" conf_ab="1.00" conf_ba="0.00" driver="a" recur="2" surprising="1"/> +<pair a="src/compactlegend.h" b="src/similarargs.h" together="3" deg="1.00" conf_ab="0.01" conf_ba="1.00" driver="b" recur="1" surprising="1"/> <pair a="test/lib/sweeproot.sh" b="test/substrfiltercheck.sh" together="3" deg="1.00" conf_ab="1.00" conf_ba="0.27" driver="a" recur="1" surprising="1"/> -<pair a="test/grepcheck.sh" b="test/grepscancheck.sh" together="3" deg="1.00" conf_ab="0.50" conf_ba="1.00" driver="b" recur="1" surprising="1"/> -<pair a="test/rubyrecvcheck.sh" b="test/rubyrequirecheck.sh" together="3" deg="1.00" conf_ab="0.50" conf_ba="1.00" driver="b" recur="1" surprising="1"/> -<pair a="src/verbs_report.h" b="test/fileset_unit.cpp" together="3" deg="1.00" conf_ab="0.03" conf_ba="1.00" driver="b" recur="1" surprising="1"/> +<pair a="src/ingest_cache.h" b="src/refnames.h" together="3" deg="1.00" conf_ab="0.01" conf_ba="1.00" driver="b" recur="1" surprising="1"/> +<pair a="src/accessshape.h" b="test/accessshapefix/walks.cpp" together="3" deg="1.00" conf_ab="0.60" conf_ba="1.00" driver="b" recur="1" surprising="1"/> <pair a="test/cachesplitcheck.sh" b="test/portablecachecheck.sh" together="3" deg="1.00" conf_ab="0.75" conf_ba="1.00" driver="b" recur="3" surprising="1"/> -<pair a="test/grepcontextcheck.sh" b="test/grepscancheck.sh" together="3" deg="1.00" conf_ab="1.00" conf_ba="1.00" recur="1" surprising="1"/> <pair a="src/fieldaffinity.h" b="test/accessshapefix/walks.cpp" together="3" deg="1.00" conf_ab="0.33" conf_ba="1.00" driver="b" recur="1" surprising="1"/> +<pair a="bench/scip_match_diag.py" b="bench/scip_pin_precision.py" together="3" deg="1.00" conf_ab="1.00" conf_ba="0.60" driver="a" recur="2" surprising="1"/> +<pair a="test/gatecountcheck.sh" b="test/manifestcheck.sh" together="3" deg="1.00" conf_ab="1.00" conf_ba="0.23" driver="a" recur="2" surprising="1"/> <pair a="src/binstale.h" b="src/crossref.h" together="3" deg="1.00" conf_ab="1.00" conf_ba="0.03" driver="a" recur="2" surprising="1"/> </cochange> ````` @@ -1990,16 +2035,16 @@ ripwire: --pack-top-n is deprecated — use --pack-task/--detail instead (unchan *Hotspots scoped to RECENT churn (the regression lens).* -**wall time: 2.21s** +**wall time: 1.28s** ````` <!-- ripwire hotspots schema=ripwire.hotspots/v1: maintenance pain = churn x ccx over window=: <f p= churn= ccx= score= top= top_ccx= top_l=>; unranked_*= no churn/complexity. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). at=: commit+dirty+shallow. root=: p= relative to it. files=/ranked=: files in the window / those with both churn and complexity; ranked + unranked_no_churn + unranked_no_complexity = files. unranked_no_churn=/unranked_no_complexity=: files left out for no commit in window= / no measured complexity. --> -<hotspots schema="ripwire.hotspots/v1" window="2 weeks ago" files="4852" ranked="440" unranked_no_churn="3966" unranked_no_complexity="446" shown="40" capped="1" total="440" has_more="1" next_offset="40" offset="0" limit="0" root="." at="914c4045d"> +<hotspots schema="ripwire.hotspots/v1" window="2 weeks ago" files="4852" ranked="439" unranked_no_churn="3967" unranked_no_complexity="446" shown="40" capped="1" total="439" has_more="1" next_offset="40" offset="0" limit="0" root="." at="147c73293"> <f p="src/graph.h" churn="123" ccx="6723" score="826929" top="buildGraph" top_ccx="1979" top_l="10846"/> <f p="src/quality.h" churn="106" ccx="2657" score="281642" top="computeDelta" top_ccx="318" top_l="12009"/> -<f p="src/mcpverbs.h" churn="98" ccx="1369" score="134162" top="runBatchSub" top_ccx="142" top_l="6335"/> -<f p="src/serialize.h" churn="54" ccx="2407" score="129978" top="packSignatures" top_ccx="235" top_l="6525"/> -<f p="src/verbs_for.h" churn="76" ccx="1358" score="103208" top="runForLensPass" top_ccx="706" top_l="3606"/> +<f p="src/mcpverbs.h" churn="97" ccx="1369" score="132793" top="runBatchSub" top_ccx="142" top_l="6335"/> +<f p="src/serialize.h" churn="52" ccx="2407" score="125164" top="packSignatures" top_ccx="235" top_l="6525"/> +<f p="src/verbs_for.h" churn="75" ccx="1358" score="101850" top="runForLensPass" top_ccx="706" top_l="3606"/> <f p="src/resolve.h" churn="29" ccx="2566" score="74414" top="buildPreciseIncludeAdjWithContext" top_ccx="103" top_l="5588"/> <f p="src/main.cpp" churn="45" ccx="1372" score="61740" top="dispatchMainBody" top_ccx="513" top_l="4711"/> <f p="src/cli.h" churn="81" ccx="682" score="55242" top="parseArgs" top_ccx="214" top_l="5740"/> @@ -2012,8 +2057,8 @@ ripwire: --pack-top-n is deprecated — use --pack-task/--detail instead (unchan <f p="src/ingest_names.h" churn="21" ccx="958" score="20118" top="braceBlockHoldsStatement" top_ccx="33" top_l="2747"/> <f p="src/ingest_cache.h" churn="49" ccx="398" score="19502" top="saveCache" top_ccx="113" top_l="3688"/> <f p="src/ingest_sidecap.h" churn="26" ccx="717" score="18642" top="routesVisitNode" top_ccx="89" top_l="532"/> -<f p="src/forliteral.h" churn="10" ccx="1795" score="17950" top="renderForLiteral" top_ccx="277" top_l="4210"/> <f p="src/ingest_valuerefs.h" churn="11" ccx="1502" score="16522" top="classify" top_ccx="119" top_l="2479"/> +<f p="src/forliteral.h" churn="9" ccx="1795" score="16155" top="renderForLiteral" top_ccx="277" top_l="4210"/> <f p="src/crossref.h" churn="14" ccx="1147" score="16058" top="mergeBasesByOneWalk" top_ccx="45" top_l="1626"/> <f p="src/darkflags.h" churn="16" ccx="959" score="15344" top="shellExpansionAt" top_ccx="61" top_l="1138"/> <f p="src/layout.h" churn="14" ccx="1051" score="14714" top="resolveStdType" top_ccx="47" top_l="2063"/> @@ -2023,7 +2068,7 @@ ripwire: --pack-top-n is deprecated — use --pack-task/--detail instead (unchan <f p="src/ingest_astquery.h" churn="15" ccx="751" score="11265" top="astQueryGrouped" top_ccx="214" top_l="842"/> <f p="src/shstatus.h" churn="9" ccx="1211" score="10899" top="isBareRedirect" top_ccx="58" top_l="1648"/> <f p="src/verbs_report.h" churn="9" ccx="1199" score="10791" top="runStructureText" top_ccx="270" top_l="3358"/> -… [13 more display lines; full output is 5213 bytes on 1 raw line(s)] +… [13 more display lines; full output is 5212 bytes on 1 raw line(s)] ````` ## `./build/ripwire . --arch=test/archfix/rules.txt` @@ -2074,7 +2119,7 @@ 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: 1.97s** +**wall time: 1.65s** ````` <!-- ripwire lint schema=ripwire.lint/v1: AST-only checks, facts not gates: <rule name= count= shown_rows= rows_capped= count_capped=> of <f rule= p= in=>. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). findings_capped=/rows_capped=/count_capped=: 1 = cut. counts_floor=1: every count is a FLOOR, never a total. root=: p= relative to it. findings=N: findings over the printed rules; a floor when findings_capped=1. findings_next=: the call counting the floored rules' rest (count_capped=1 rules only, 10x per-rule budget). --> @@ -2420,11 +2465,11 @@ flowchart LR *Bus-factor: recency-weighted author ownership per file.* -**wall time: 1.46s** +**wall time: 1.48s** ````` <!-- ripwire owners schema=ripwire.owners/v1: recency-weighted author ownership (half-life 6mo): <f p= authors= bf= top= share=>; bf=1 = one person holds it. at=: commit+dirty+shallow. root=: p= relative to it. files=N: files analysed. files=N: single-author files folded into this one row; detail=1 lists each. --> -<owners schema="ripwire.owners/v1" files="4852" root="." at="914c4045d"> +<owners schema="ripwire.owners/v1" files="4852" root="." at="147c73293"> <uniform authors="1" bf="1" share="1.00" files="3755"/> <f p=".coderabbit.yaml" authors="2" bf="0" top="<author>" share="0.59"/> <f p=".github/pargates-shard-weights.json" authors="3" bf="0" top="<author>" share="0.49"/> @@ -2460,7 +2505,7 @@ 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.89s** +**wall time: 1.45s** ````` <!-- ripwire dead-code schema=ripwire.dead-code/v1: internal-linkage functions with no caller found in the index (not a confidence score): <d n= t= p= l=>; filter= path component. window: shown= total= (capped=1 cut). counts_floor=1: every count is a FLOOR, never a total. graph_ambiguous=/graph_unresolved=: resolver gauge. graph_unindexed=N: N files no grammar could read (the map header's unindexed=); their calls raise neither gauge. value-ref-excluded=N: internal functions kept off because a table, field or argument in another function or at file scope holds them (matched by name, not a proven call); a floor. root=: p= relative to it. evidence=: the rule every row met, internal linkage and no caller in the index; verify before deleting. register-macro-excluded=N: symbols skipped as self-registering test/bench macros (TEST, BENCHMARK...) or Rust #[test]; a floor. exported linkage=exported evidence=no-non-test-caller: PUBLIC free functions of the filtered files with no non-test caller in the graph, <e> rows after d/to; not dead, not in count=, code outside the tree may call them (zero means none found here); total= found, shown= printed (capped=1 rows cut), files= read of files_total= filtered files holding a non-internal free function with no non-test caller (first by path; total=0 can follow), unseen=N a floor on text files unread, unseen_by= the cap or failure behind each, extra=skipped verdicts fixed by indexed files so unindexed ones unread (counts, at= are floors). e n= t= p= l= v=unused no mention in any text file under the root outside its def (prose docs not read)|test-only only tests|file-only same-file words only|unknown why= names what may reach it: string (__all__, getattr, a registry key)|value|framework (decorator, hook)|import (re-export)|barrel|api|name|by-name|declined|built-name|dispatch|members|manifest|in-file|unimported|unseen; tests= text= str= imp= same= word counts, defs= overloads, at= sites to read. count=N: candidates meeting evidence= (a floor). --> @@ -2506,11 +2551,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: 33.96s** +**wall time: 25.28s** ````` <!-- ripwire quality-delta schema=ripwire.quality-delta/v1: only what the change made WORSE vs baseline=: regressions= minor= gating=; <r kind= sym= p= was= now= gating= bar=>, <sa> acked. value-ref-excluded=N: internal functions kept off because a table, field or argument in another function or at file scope holds them (matched by name, not a proven call); a floor. at=: commit+dirty+shallow. stale=N: ack ledger rows whose target no longer applies (sa rows); never gating. stale_by_kind=: stale= split by ack kind (kind:N,...); the sa rows are collapsed. stale_next=: the call printing the sa rows and the full header. preexisting-worse=N: regressions on symbols that existed at baseline; they gate when major. new-symbol=N: NEW code; new-symbol rows never gate, except defect-shape format-arity, ceiling=, tangle. register-macro-excluded=N: symbols skipped: self-registering test/bench macros or Rust #[test]; a floor. declined-call-excluded=N: symbols kept out of dead-code only because a declined call may mean them; a floor. api-new-surface=N: new PUBLIC symbols; a count, never gates, not in regressions=. renames=/rename_window_commits=: git rename pairs read over that many commits, to re-file baseline and acks. acked_by_rename=/acked_by_content=: acked= suppressions matched via git renames / an equal body hash. renames_window_truncated=1: history is deeper than the rename window, older renames unread. acked=N: findings suppressed by the ack ledger, listed as sa rows; never gating. --> -<quality-delta schema="ripwire.quality-delta/v1" baseline="git-HEAD" regressions="0" minor="0" acked="0" stale="203" preexisting-worse="0" new-symbol="0" gating="0" register-macro-excluded="63" api-new-surface="0" at="914c4045d+dirty" renames="68" rename_window_commits="400" acked_by_rename="0" acke … [line truncated: 298 more bytes on this line] +<quality-delta schema="ripwire.quality-delta/v1" baseline="git-HEAD" regressions="0" minor="0" acked="0" stale="203" preexisting-worse="0" new-symbol="0" gating="0" register-macro-excluded="63" api-new-surface="0" at="147c73293+dirty" renames="68" rename_window_commits="400" acked_by_rename="0" acke … [line truncated: 298 more bytes on this line] </quality-delta> ````` @@ -2524,11 +2569,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 <sa kind= key= why=> row under the full header — the demo row included, and no quarter of the bytes saved by silence. Refused without --quality-delta.* -**wall time: 15.46s** +**wall time: 12.49s** ````` <!-- ripwire quality-delta schema=ripwire.quality-delta/v1: only what the change made WORSE vs baseline=: regressions= minor= gating=; <r kind= sym= p= was= now= gating= bar=>, <sa> acked. value-ref-excluded=N: internal functions kept off because a table, field or argument in another function or at file scope holds them (matched by name, not a proven call); a floor. at=: commit+dirty+shallow. stale=N: ack ledger rows whose target no longer applies (sa rows); never gating. preexisting-worse=N: regressions on symbols that existed at baseline; they gate when major. new-symbol=N: NEW code; new-symbol rows never gate, except defect-shape format-arity, ceiling=, tangle. register-macro-excluded=N: symbols skipped: self-registering test/bench macros or Rust #[test]; a floor. declined-call-excluded=N: symbols kept out of dead-code only because a declined call may mean them; a floor. api-new-surface=N: new PUBLIC symbols; a count, never gates, not in regressions=. renames=/rename_window_commits=: git rename pairs read over that many commits, to re-file baseline and acks. acked_by_rename=/acked_by_content=: acked= suppressions matched via git renames / an equal body hash. renames_window_truncated=1: history is deeper than the rename window, older renames unread. acked=N: findings suppressed by the ack ledger, listed as sa rows; never gating. sa key=/why=: the stale ack's ledger hash / target-gone (names nothing now) or finding-gone (no longer fires). --> -<quality-delta schema="ripwire.quality-delta/v1" baseline="git-HEAD" regressions="0" minor="0" acked="0" stale="203" preexisting-worse="0" new-symbol="0" gating="0" register-macro-excluded="63" api-new-surface="0" at="914c4045d+dirty" renames="68" rename_window_commits="400" acked_by_rename="0" acke … [line truncated: 99 more bytes on this line] +<quality-delta schema="ripwire.quality-delta/v1" baseline="git-HEAD" regressions="0" minor="0" acked="0" stale="203" preexisting-worse="0" new-symbol="0" gating="0" register-macro-excluded="63" api-new-surface="0" at="147c73293+dirty" renames="68" rename_window_commits="400" acked_by_rename="0" acke … [line truncated: 99 more bytes on this line] <sa kind="api-surface" key="0123456789abcdef" why="target-gone"/> <sa kind="api-surface" key="085e3d408c2c4a35" why="target-gone"/> <sa kind="api-surface" key="155d74d341a49f3c" why="target-gone"/> @@ -2570,11 +2615,11 @@ 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: 14.00s** +**wall time: 10.43s** ````` <!-- ripwire edit-check schema=ripwire.edit-check/v1: sym='s contract NOW vs HEAD: status=unchanged|new-symbol|contract-change; <c n= p= incompatible=1 sites_l=> callers. counts_floor=1: every count is a FLOOR, never a total. graph_ambiguous=/graph_unresolved=: resolver gauge. graph_unindexed=N: N files no grammar could read (the map header's unindexed=); their calls raise neither gauge. est_tokens=: price as emitted (an upper bound under compact). at=: commit+dirty+shallow. root=: p= relative to it. next=: the one pasteable follow-up. defs=N: overloads at this site (same file, scope, name) folded into one contract; params compared by MAX. callers=N: callers of sym= (the c rows' total; a floor). t=: sym='s kind (fn|cls|...). --> -<edit-check schema="ripwire.edit-check/v1" sym="rankGraphTeleport" t="fn" p="src/graph.h:14921" status="unchanged" defs="1" callers="7" incompatible="0" at="914c4045d" graph_ambiguous="3984" graph_unresolved="20100" graph_unindexed="313" counts_floor="1" root="." next="--test-gate=src/graph.h" est_t … [line truncated: 12 more bytes on this line] +<edit-check schema="ripwire.edit-check/v1" sym="rankGraphTeleport" t="fn" p="src/graph.h:14921" status="unchanged" defs="1" callers="7" incompatible="0" at="147c73293" graph_ambiguous="3984" graph_unresolved="20100" graph_unindexed="313" counts_floor="1" root="." next="--test-gate=src/graph.h" est_t … [line truncated: 12 more bytes on this line] <c n="runEval" p="src/eval.h:171"/> <c n="rankGraph" p="src/graph.h:14964"/> <c n="anchoredLexicalRank" p="src/graph.h:15633"/> @@ -2585,19 +2630,13 @@ ripwire: no ./.ripwire_quality_baseline — auto-comparing the working tree vs g </edit-check> ````` -stderr: - -````` -ripwire: cache <tmp>: over its 2048 MiB budget — evicted 92 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).* ````` <!-- ripwire pr-context schema=ripwire.pr-context/v1: review bundle per changed file vs base=: symbols, callers, blast radius, tests, owners. counts_floor=1: every count is a FLOOR, never a total. graph_ambiguous=/graph_unresolved=: resolver gauge. graph_unindexed=N: N files no grammar could read (the map header's unindexed=); their calls raise neither gauge. 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). 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). files=N: changed files in the diff (shown= of them listed). --> -<pr-context schema="ripwire.pr-context/v1" base="working-tree" root="." direction="worktree-since-head" files="0" skipped_mode_only="0" budget_tokens="8000" est_tokens="584" trim_level="0" truncated="none" budget_default="1" at="914c4045d" graph_ambiguous="3984" graph_unresolved="20100" graph_uninde … [line truncated: 27 more bytes on this line] +<pr-context schema="ripwire.pr-context/v1" base="working-tree" root="." direction="worktree-since-head" files="0" skipped_mode_only="0" budget_tokens="8000" est_tokens="584" trim_level="0" truncated="none" budget_default="1" at="147c73293" graph_ambiguous="3984" graph_unresolved="20100" graph_uninde … [line truncated: 27 more bytes on this line] <!-- no changed files in the index (clean tree, or the diff touched only non-indexed files) --> </pr-context> ````` @@ -2606,29 +2645,55 @@ ripwire: cache <tmp>: over its 2048 MiB budget — evicted 92 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: 1.17s** +**wall time: 2.94s** ````` -<!-- ripwire pr-context schema=ripwire.pr-context/v1: review bundle per changed file vs base=: symbols, callers, blast radius, tests, owners. counts_floor=1: every count is a FLOOR, never a total. graph_ambiguous=/graph_unresolved=: resolver gauge. graph_unindexed=N: N files no grammar could read (the map header's unindexed=); their calls raise neither gauge. 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). 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). --> -<pr-context schema="ripwire.pr-context/v1" base="HEAD~1" root="." anchor="merge-base" base_sha="b6ae53e9f" base_moved="0" direction="head-since-fork" files="0" skipped_mode_only="0" budget_tokens="8000" est_tokens="825" trim_level="0" truncated="none" budget_default="1" at="914c4045d" graph_ambiguou … [line truncated: 73 more bytes on this line] +<!-- ripwire pr-context schema=ripwire.pr-context/v1: review bundle per changed file vs base=: symbols, callers, blast radius, tests, owners. window: shown= capped= (capped=1 cut). counts_floor=1: every count is a FLOOR, never a total. graph_ambiguous=/graph_unresolved=: resolver gauge. graph_unindexed=N: N files no grammar could read (the map header's unindexed=); their calls raise neither gauge. 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. partner deg=: of this file's commits in window=, the fraction that partner shares. partner dep_capable=0: a side cannot carry a static dependency, so surprising= is undefined. 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. <file-scope> (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. --> +<pr-context schema="ripwire.pr-context/v1" base="HEAD~1" root="." anchor="merge-base" base_sha="9683e45bd" base_moved="0" direction="head-since-fork" files="1" skipped_mode_only="0" budget_tokens="8000" est_tokens="7793" trim_level="0" truncated="none" budget_default="1" at="147c73293" graph_ambiguo … [line truncated: 74 more bytes on this line] <no-ref-work note="HEAD~1 tip == merge-base, so that ref has no divergent work of its own; this bundle is HEAD's work since the fork. For the ref's OWN diff see merge-scout or stray-content"/> -<!-- no changed files in the index (clean tree, or the diff touched only non-indexed files) --> -</pr-context> +<file p="test/showcase_capture.py" symbols="131"> +<impact dependents="3" files="1" files_other="1" shown="1" capped="0"> +<f p="bench/routing_ab_report.py" deps="3"/> +</impact> +<tests count="0" shown="0" capped="0"> +</tests> +<changed-symbols count="131"> +<s t="modscope" n="<file-scope>" p="test/showcase_capture.py:1" callers="0" shown="0" capped="0"> +</s> +<s t="var" n="REPO" p="test/showcase_capture.py:8" callers="0" shown="0" capped="0"> +</s> +<s t="var" n="SCRATCH" p="test/showcase_capture.py:9" callers="0" shown="0" capped="0"> +</s> +<s t="var" n="BIN" p="test/showcase_capture.py:10" callers="0" shown="0" capped="0"> +</s> +<s t="var" n="ABIN" p="test/showcase_capture.py:11" callers="0" shown="0" capped="0"> +</s> +<s t="var" n="DIRTY" p="test/showcase_capture.py:12" callers="0" shown="0" capped="0"> +</s> +<s t="var" n="CLEAN" p="test/showcase_capture.py:13" callers="0" shown="0" capped="0"> +</s> +<s t="var" n="AUX" p="test/showcase_capture.py:14" callers="0" shown="0" capped="0"> +</s> +<s t="fn" n="explode" p="test/showcase_capture.py:34" callers="1" shown="1" capped="0"> +<caller t="fn" n="fmt_block" p="test/showcase_capture.py:49"/> +</s> +<s t="fn" n="fmt_block" p="test/showcase_capture.py:49" callers="1" shown="1" capped="0"> +… [299 more display lines; full output is 19481 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: 19.88s** +**wall time: 15.95s** ````` <!-- ripwire merge-scout schema=ripwire.merge-scout/v1: cross-branch overlap of arms= refs: <arm ref= base= changed= head_conflicts=>, <pair a= b= conflicts= risks=>, <landing order=>. at=: commit+dirty+shallow. head=: the HEAD commit, bare 9-hex sha (at= adds +dirty). ok=1 on an arm row means the comparison RAN, so changed=/head_conflicts= are real and may legitimately be 0 (an empty but materialized tree is a real index); ok=0 means it did not run at all. no-work note=: arm compared and has no divergent work vs its merge base, so no landing slot. --> -<merge-scout schema="ripwire.merge-scout/v1" arms="2" head="914c4045d" at="914c4045d"> -<arm ref="HEAD~2" base="739151ce9" ok="1" changed="0" head_conflicts="0"> +<merge-scout schema="ripwire.merge-scout/v1" arms="2" head="147c73293" at="147c73293"> +<arm ref="HEAD~2" base="3e2054168" ok="1" changed="0" head_conflicts="0"> <no-work note="no divergent work vs merge-base — see --stray-content"/> </arm> -<arm ref="HEAD~1" base="b6ae53e9f" ok="1" changed="0" head_conflicts="0"> +<arm ref="HEAD~1" base="9683e45bd" ok="1" changed="0" head_conflicts="0"> <no-work note="no divergent work vs merge-base — see --stray-content"/> </arm> <pair a="HEAD~2" b="HEAD~1" conflicts="0" risks="0"/> @@ -2640,11 +2705,11 @@ ripwire: cache <tmp>: over its 2048 MiB budget — evicted 92 blob(s) of other r *Which refs of the `lane/` ref family still hold divergent authored work vs HEAD, with verdicts.* -**wall time: 5.86s** +**wall time: 4.77s** ````` <!-- ripwire stray-content schema=ripwire.stray-content/v1: per local ref, lines/symbols NOT in HEAD: <ref ok= v= base= stray=>; 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. authored=N: lines this ref authored in the file vs its merge base. del=N: base lines this ref removed (0 = pure addition). redone=N: of del=, the base lines HEAD removed too (the supersession evidence). sim=: minhash containment, 0 to 1, of the ref's blob in HEAD's (pure-addition evidence). head-touched=1: the live line changed this path since the merge base. more files=N: N more file rows of this ref withheld; shown + N = the ref's files=; detail=1 lists all. unknown=N: refs that could not be analysed (v=unknown, e.g. no merge base); never counted merged. file p=: the stray file, repo-relative. --> -<stray-content schema="ripwire.stray-content/v1" head="914c4045d" head_ref="integration/train-ge3" refs="499" blobs="2194" unmerged="61" superseded="29" merged="409" unknown="0" filter="lane/" at="914c4045d"> +<stray-content schema="ripwire.stray-content/v1" head="147c73293" head_ref="integration/train-ge3" refs="499" blobs="2294" unmerged="62" superseded="29" merged="408" unknown="0" filter="lane/" at="147c73293"> <ref name="lane/arise-result" tip="13292db7a" date="2026-09-23" base="60b65f026" ok="1" v="unmerged" stray="16331" files="18" superseded="55"> <file p="bench/slice/results/arise_line_rank_prereg/narrowpool-results.json" v="unmerged" stray="8629" authored="8629" del="0" redone="0" sim="0.00" head-touched="0"/> <file p="bench/slice/results/arise_line_rank_prereg/results.json" v="unmerged" stray="3810" authored="3810" del="0" redone="0" sim="0.00" head-touched="0"/> @@ -2673,18 +2738,16 @@ ripwire: cache <tmp>: over its 2048 MiB budget — evicted 92 blob(s) of other r <file p="bench/locbench/results/served_syms_prereg/instance_ids.txt" v="unmerged" stray="92" authored="92" del="0" redone="0" sim="0.00" head-touched="0"/> <file p="bench/locbench/results/margin_rescore/POPULATION.md" v="unmerged" stray="63" authored="63" del="0" redone="0" sim="0.00" head-touched="0"/> <file p="bench/locbench/results/served_syms_prereg/POPULATION.md" v="unmerged" stray="62" authored="62" del="0" redone="0" sim="0.00" head-touched="0"/> -… [822 more display lines; full output is 92874 bytes on 1 raw line(s)] +… [837 more display lines; full output is 94631 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: 1.42s** - ````` <!-- ripwire stray-content schema=ripwire.stray-content/v1: per local ref, lines/symbols NOT in HEAD: <ref ok= v= base= stray=>; 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. unknown=N: refs that could not be analysed (v=unknown, e.g. no merge base); never counted merged. --> -<stray-content schema="ripwire.stray-content/v1" head="914c4045d" head_ref="integration/train-ge3" refs="1" blobs="0" unmerged="0" superseded="0" merged="1" unknown="0" filter="fix/" at="914c4045d"> +<stray-content schema="ripwire.stray-content/v1" head="147c73293" head_ref="integration/train-ge3" refs="1" blobs="0" unmerged="0" superseded="0" merged="1" unknown="0" filter="fix/" at="147c73293"> </stray-content> ````` @@ -2692,53 +2755,53 @@ ripwire: cache <tmp>: over its 2048 MiB budget — evicted 92 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: 18.19s** +**wall time: 11.62s** ````` <!-- ripwire landing-plan schema=ripwire.landing-plan/v1: stranded-work landing order across refs, fewest conflicts first. at=: commit+dirty+shallow. --> -<landing-plan schema="ripwire.landing-plan/v1" head="914c4045d" refs="499" unmerged="61" superseded="29" merged="409" undetermined="0" scouted="1" bounded="60" scout-ok="1" at="914c4045d"> +<landing-plan schema="ripwire.landing-plan/v1" head="147c73293" refs="499" unmerged="62" superseded="29" merged="408" undetermined="0" scouted="1" bounded="61" scout-ok="1" at="147c73293"> <ref name="lane/arise-result" v="unmerged" stray="16331" files="18" scouted="1"/> <ref name="lane/margin-rescore" v="unmerged" stray="13921" files="13" scouted="0"/> -<ref name="lane/recv-xfile" v="unmerged" stray="9251" files="34" scouted="0"/> -<ref name="lane/py-local-bind" v="unmerged" stray="7081" files="8" scouted="0"/> +<ref name="lane/recv-xfile" v="unmerged" stray="9254" files="34" scouted="0"/> +<ref name="lane/py-local-bind" v="unmerged" stray="7077" files="8" scouted="0"/> <ref name="lane/served-syms-result" v="unmerged" stray="6346" files="9" scouted="0"/> <ref name="lane/orient-narrow-v3" v="unmerged" stray="3273" files="46" scouted="0"/> <ref name="lane/for-howitworks-067" v="unmerged" stray="3247" files="39" scouted="0"/> <ref name="lane/m1-lookback-harness" v="unmerged" stray="3164" files="14" scouted="0"/> <ref name="lane/orient-map-067" v="unmerged" stray="2475" files="40" scouted="0"/> <ref name="lane/parse-budget-det" v="unmerged" stray="2396" files="64" scouted="0"/> -<ref name="lane/xs-1119-d2-pin" v="unmerged" stray="2298" files="31" scouted="0"/> -<ref name="lane/qual-ns-call-bind" v="unmerged" stray="2288" files="30" scouted="0"/> -<ref name="lane/import-proved-splits" v="unmerged" stray="2280" files="30" scouted="0"/> -<ref name="lane/small-edges-1118" v="unmerged" stray="2168" files="6" scouted="0"/> -<ref name="lane/go-cpp-edges" v="unmerged" stray="2146" files="7" scouted="0"/> +<ref name="lane/xs-1119-d2-pin" v="unmerged" stray="2306" files="31" scouted="0"/> +<ref name="lane/qual-ns-call-bind" v="unmerged" stray="2296" files="30" scouted="0"/> +<ref name="lane/import-proved-splits" v="unmerged" stray="2288" files="30" scouted="0"/> +<ref name="lane/small-edges-1118" v="unmerged" stray="2176" files="6" scouted="0"/> +<ref name="lane/go-cpp-edges" v="unmerged" stray="2154" files="7" scouted="0"/> <ref name="lane/served-syms-prereg" v="unmerged" stray="2135" files="5" scouted="0"/> -<ref name="lane/edge-strays-1118" v="unmerged" stray="2090" files="17" scouted="0"/> +<ref name="lane/edge-strays-1118" v="unmerged" stray="2100" files="17" scouted="0"/> <ref name="lane/crossctx-external-prereg" v="unmerged" stray="2055" files="7" scouted="0"/> <ref name="lane/no-skip-ingest" v="unmerged" stray="1860" files="52" scouted="0"/> <ref name="lane/for-noise" v="unmerged" stray="1821" files="47" scouted="0"/> <ref name="lane/std-namesake" v="unmerged" stray="1753" files="9" scouted="0"/> +<ref name="lane/secscan-353" v="unmerged" stray="1752" files="95" scouted="0"/> <ref name="lane/for-tonly" v="unmerged" stray="1728" files="11" scouted="0"/> <ref name="lane/arise-line-ranking" v="unmerged" stray="1538" files="7" scouted="0"/> <ref name="lane/for-noise-body-slot" v="unmerged" stray="1524" files="39" scouted="0"/> <ref name="lane/row-features-2" v="unmerged" stray="1218" files="11" scouted="0"/> <ref name="lane/research-abstention" v="unmerged" stray="899" files="3" scouted="0"/> <ref name="lane/agent-trap" v="unmerged" stray="857" files="13" scouted="0"/> -<ref name="lane/row-features" v="unmerged" stray="840" files="10" scouted="0"/> -… [286 more display lines; full output is 31579 bytes on 1 raw line(s)] +… [287 more display lines; full output is 31658 bytes on 1 raw line(s)] ````` stderr: ````` -ripwire: warning: --plan scouted 1 of 61 unmerged branches for conflicts and landing order (limit: 12 arms, and 8192 indexed files across the arms); pass --detail=1 to scout every unmerged branch +ripwire: warning: --plan scouted 1 of 62 unmerged branches for conflicts and landing order (limit: 12 arms, and 8192 indexed files across the arms); pass --detail=1 to scout every unmerged branch ````` ## `./build/ripwire . --stray-content=zzzz-no-such-ref --plan` *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.77s** +**exit code: 1** — **wall time: 1.16s** ````` (empty) @@ -2755,11 +2818,11 @@ 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: 40.36s** +**exit code: 2** — **wall time: 34.82s** ````` <!-- ripwire abi schema=ripwire.abi/v1: cross-branch ABI-break gate: each local branch's structs on paths it authored (its diff from its merge base with HEAD), laid out lexically, compared with HEAD's; a match is omitted; exit 2 on a drift. head_ref= HEAD's branch, refs= branches read, candidates= structs HEAD declares and locates, compared= sites modelled on both sides, blobs= git blobs read; dropped= listed rows past the 12-per-ref cap; head_only= sites on paths only HEAD changed (out of scope); unmodelable= sites skipped: HEAD's copy has no model; unrelated= refs with no merge base, never compared, also in quiet=; broken_refs= refs with a drift; quiet= refs with no row (none differed or none compared); excluded_refs= refs with unlisted kinds only. window: shown= capped= (capped=1 cut). at=: commit+dirty+shallow. root=: p= relative to it. ref name= tip= date=: a branch with rows, its tip commit and date; shown=/capped=/head_only= and kind counts are its own. struct n= p= l= kind= head_size=: a struct, its file and line at HEAD, sizeof there. kind=drift: the byte contract differs (the kind that exits 2); unknown: the ref's copy could not be modelled, never read as same; absent: the ref does not define it at that path. drift= unknown= absent= count them on abi and ref; each row is on one kind count (absent at 0): their sum is the row total. ref_size= size_delta=: sizeof on the ref and its distance from head_size=, only where the ref's copy was sized; size_delta=0 is the same size, not the same layout. d n= a= b=: a differing field as type@offset at HEAD (a=) and on the ref (b=), or absent. ref_caveat k= d=: why the ref's copy is unmodelled: kind, detail. head_caveat k= d=: a limit of HEAD's own model of the struct: kind, detail. head-moved=N: the ref's copy equals its merge base's, so HEAD changed; counted, listed under detail=1. --> -<abi schema="ripwire.abi/v1" head_ref="integration/train-ge3" refs="499" candidates="3078" compared="12715" blobs="896" shown="68" capped="0" dropped="0" head_only="1113101" unmodelable="4371" unrelated="0" broken_refs="26" quiet="415" excluded_refs="49" at="914c4045d" drift="52" unknown="13" absent … [line truncated: 32 more bytes on this line] +<abi schema="ripwire.abi/v1" head_ref="integration/train-ge3" refs="499" candidates="3078" compared="12733" blobs="900" shown="70" capped="0" dropped="0" head_only="1113088" unmodelable="4384" unrelated="0" broken_refs="27" quiet="414" excluded_refs="49" at="147c73293" drift="53" unknown="14" absent … [line truncated: 32 more bytes on this line] <ref name="lane/for-tonly" tip="07f6c870d" date="2026-10-29" shown="4" capped="0" head_only="2275" drift="4" head-moved="60"> <struct n="ForLensJsonInputs" p="src/verbs_for.h" l="464" kind="drift" head_size="232" ref_size="216" size_delta="16"> <d n="graph" a="const rw::Graph*@208" b="absent"/> @@ -2788,28 +2851,28 @@ ripwire: --plan: --stray-content=zzzz-no-such-ref matches no local ref — a zer <d n="callerHopPresent" a="bool@271" b="bool@268"/> <d n="callerHopRanked" a="bool@272" b="bool@269"/> <d n="callerHopSubject" a="bool@273" b="absent"/> -… [734 more display lines; full output is 54263 bytes on 1 raw line(s)] +… [743 more display lines; full output is 54765 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 renders two pages under the same 60-row cap, the definitions page (kind="def" rows and the kind="text" lines no parse read, the references counted in <refs count= next=>) and the whole list, and serves the definitions page when it shows more definitions, whatever its bytes, else only when it is strictly shorter. Here the branches' copies sit in blobs past the parse guard (<unparsed>, kind="text", never counted as definitions), so both pages show HEAD's one definition and the default serves the shorter whole list: that definition, then HEAD's references.* -**wall time: 18.15s** +**wall time: 14.09s** ````` <!-- ripwire whereis schema=ripwire.whereis/v1: every LOCAL ref whose tree holds sym= (refs_scanned=, blobs=), HEAD first: <hit ref= tip= date= p= l= kind= t=>. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). at=: commit+dirty+shallow. next=: the one pasteable follow-up. refs_omitted=K: past the ref window (512 refs; whereis: 2097152 tree entries) the newest refs by committer date were read; K older local branches were not, in no count or row (a ref-name SUBSTR filter picks which; detail=1 reads all). hits=N: occurrences in HEAD plus every scanned local ref's full tree (the total rows). on-head=1|0: whether HEAD's tree holds it; 0 beside hits = it lives only on a branch. head_labels=index: HEAD kind= from the parsed index; lexical: text heuristic. ref_labels=parsed: another ref's kind= from the index's own tags parse of its blob (one per blob and path; HEAD's own blob takes HEAD's labels); a blob with no line a loose lexical test calls worth parsing is not parsed and its rows read ref; kind=text: such a line no parse read, never a def. unparsed blobs=N: other refs' blobs holding a line worth parsing that no parse read (past the runaway guard, or the parser could not finish); those lines read kind=text; next= lifts the guard. unparsed rows=N: the kind=text rows those blobs gave. hit refs=N: N scanned refs hold this same definition (or kind=text) line (path + text); printed once for the first by name, whose ref= tip= date= l= it carries; defs page only, absent = one ref; hits= counts every copy, listing=all prints each. folded=N: def (or text) rows of other refs a listed row's refs= stands for; shown + more + folded + refs count = hits on the first page. more hits=N: rows after this page; page on with offset=next_offset. listing=defs|refs: only those kind= rows listed (defs: def and text); under defs <refs count=N next=> counts the kind=ref rows and next= lists them; the window counts listed rows; default: defs if it lists more defs than all, else if shorter; a def the parser does not model (define_method, setattr, assignment) is a counted ref. head_date=: a hit without tip= date= has tip= at=, date= this. --> -<whereis schema="ripwire.whereis/v1" sym="rankGraphTeleport" on-head="1" refs_scanned="373" blobs="10151" hits="2701870" head_labels="index" refs_omitted="282" shown="60" capped="1" total="146" has_more="1" next_offset="60" offset="0" limit="0" listing="defs" folded="1786" ref_labels="parsed" head_d … [line truncated: 32 more bytes on this line] -<unparsed blobs="404" rows="1923" next="--whereis=rankGraphTeleport --detail=1"/> +<whereis schema="ripwire.whereis/v1" sym="rankGraphTeleport" on-head="1" refs_scanned="373" blobs="10250" hits="2702085" head_labels="index" refs_omitted="282" shown="60" capped="1" total="146" has_more="1" next_offset="60" offset="0" limit="0" listing="defs" folded="1850" ref_labels="parsed" head_d … [line truncated: 32 more bytes on this line] +<unparsed blobs="407" rows="1987" next="--whereis=rankGraphTeleport --detail=1"/> <hit ref="HEAD" p="src/graph.h" l="14921" kind="def" t="inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>& p, float alpha = 0.85f )"/> <hit ref="community/pr433" tip="fafb3f267" date="2026-10-29" p="src/graph.h" l="11991" kind="text" refs="365" t="inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>& p, float alpha = 0.85f )"/> <hit ref="community/pr433" tip="fafb3f267" date="2026-10-29" p="docs/EVALS.md" l="14331" kind="text" refs="315" t="- **(i) Static.** A's diff leaves `priorwt::weight`, graph.h:4378, `biasPrior`, `rankGraphTeleport`, `rankGraph` and `diffTeleport` byte-unchanged. `rankDefaultMap`'s call sit … [line truncated: 26 more bytes on this line] <hit ref="community/pr433" tip="fafb3f267" date="2026-10-29" p="docs/EVALS.md" l="14449" kind="text" refs="315" t="- Gate S (i): `priorwt::weight`, the `priorWeight` assignment, `biasPrior`, `rankGraphTeleport`, `rankGraph`, `diffTeleport`"/> -<hit ref="fix/hub-fold-fix1" tip="347613a6e" date="2026-10-26" p="src/main.cpp" l="1478" kind="text" refs="181" t="rw::RankedGraph ranked = isDecay ? rankGraphTeleport( d.g, churnDecayTeleportWorkspace( rootDirs, d.ing, &hasChurnEvidence ) )"/> +<hit ref="fix/hub-fold-fix1" tip="347613a6e" date="2026-10-26" p="src/main.cpp" l="1478" kind="text" refs="236" t="rw::RankedGraph ranked = isDecay ? rankGraphTeleport( d.g, churnDecayTeleportWorkspace( rootDirs, d.ing, &hasChurnEvidence ) )"/> <hit ref="fix/hub-fold-fix1" tip="347613a6e" date="2026-10-26" p="test/showcase_capture.py" l="174" kind="text" refs="22" t="#0 0x102f4a1c8 in rw::rankGraphTeleport(Graph const&, std::vector<float> const&, float) src/graph.h:{TELEPORT_LN}"/> <hit ref="integration/train-1106a" tip="0e7be4adc" date="2026-11-06" p="test/grepbytescheck.sh" l="129" kind="text" refs="5" t="# rankGraphTeleport (24 hits: one function and its doc mentions)."/> -<hit ref="integration/train-1106a" tip="0e7be4adc" date="2026-11-06" p="docs/COMMANDS.md" l="1626" kind="text" refs="149" t="<![CDATA[inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>& p, float alpha = 0.85f )"/> -<hit ref="integration/train-1106a" tip="0e7be4adc" date="2026-11-06" p="docs/COMMANDS.md" l="1657" kind="text" refs="149" t="<![CDATA[inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>& p, float alpha = 0.85f )"/> +<hit ref="integration/train-1106a" tip="0e7be4adc" date="2026-11-06" p="docs/COMMANDS.md" l="1626" kind="text" refs="150" t="<![CDATA[inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>& p, float alpha = 0.85f )"/> +<hit ref="integration/train-1106a" tip="0e7be4adc" date="2026-11-06" p="docs/COMMANDS.md" l="1657" kind="text" refs="150" t="<![CDATA[inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>& p, float alpha = 0.85f )"/> <hit ref="integration/train-1111i" tip="dbb6e80a8" date="2026-11-15" p="docs/captures/COMMANDS_showcase_2026-11-13.md" l="151" kind="text" refs="13" t="<![CDATA[inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>& p, float alpha = 0.85f )"/> <hit ref="integration/train-1111i" tip="dbb6e80a8" date="2026-11-15" p="docs/captures/COMMANDS_showcase_2026-11-13.md" l="311" kind="text" refs="13" t="<![CDATA[inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>& p, float alpha = 0.85f )"/> <hit ref="integration/train-1111i" tip="dbb6e80a8" date="2026-11-15" p="docs/captures/COMMANDS_showcase_2026-11-13.md" l="1663" kind="text" refs="13" t="<![CDATA[inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>& p, float alpha = 0.85f )"/> @@ -2835,19 +2898,19 @@ stderr: ````` ripwire: warning: --whereis read the newest 373 of 655 local branches; 282 older were not read (limit: 2097152 tree entries across all refs, 374 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 404 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 407 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 before any branch row arrives, so it can show fewer definitions than the definitions page. The default serves this page only when both show the same definitions and the definitions page is not strictly shorter (a tie serves this page), as above: here it is the default's own page, HEAD's one definition and then its references.* -**wall time: 18.17s** +**wall time: 13.94s** ````` <!-- ripwire whereis schema=ripwire.whereis/v1: every LOCAL ref whose tree holds sym= (refs_scanned=, blobs=), HEAD first: <hit ref= tip= date= p= l= kind= t=>. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). at=: commit+dirty+shallow. next=: the one pasteable follow-up. refs_omitted=K: past the ref window (512 refs; whereis: 2097152 tree entries) the newest refs by committer date were read; K older local branches were not, in no count or row (a ref-name SUBSTR filter picks which; detail=1 reads all). hits=N: occurrences in HEAD plus every scanned local ref's full tree (the total rows). on-head=1|0: whether HEAD's tree holds it; 0 beside hits = it lives only on a branch. head_labels=index: HEAD kind= from the parsed index; lexical: text heuristic. ref_labels=parsed: another ref's kind= from the index's own tags parse of its blob (one per blob and path; HEAD's own blob takes HEAD's labels); a blob with no line a loose lexical test calls worth parsing is not parsed and its rows read ref; kind=text: such a line no parse read, never a def. unparsed blobs=N: other refs' blobs holding a line worth parsing that no parse read (past the runaway guard, or the parser could not finish); those lines read kind=text; next= lifts the guard. unparsed rows=N: the kind=text rows those blobs gave. hit t_bytes=N: t= previews an N-byte line (over 300 B): 200 B at most, its first bytes cut on a UTF-8 boundary plus an ellipsis. t_cut rows=N: rows of this page whose t= is a preview (each carries t_bytes=); next= replays this page (same listing, window, rows) with every line whole. more hits=N: rows after this page; page on with offset=next_offset. head_date=: a hit without tip= date= has tip= at=, date= this. --> -<whereis schema="ripwire.whereis/v1" sym="rankGraphTeleport" on-head="1" refs_scanned="373" blobs="10151" hits="2701870" head_labels="index" refs_omitted="282" shown="60" capped="1" total="2701870" has_more="1" next_offset="60" offset="0" limit="0" ref_labels="parsed" head_date="2026-11-22" at="914c … [line truncated: 7 more bytes on this line] -<unparsed blobs="404" rows="1923" next="--whereis=rankGraphTeleport --whereis-listing=all --detail=1"/> +<whereis schema="ripwire.whereis/v1" sym="rankGraphTeleport" on-head="1" refs_scanned="373" blobs="10250" hits="2702085" head_labels="index" refs_omitted="282" shown="60" capped="1" total="2702085" has_more="1" next_offset="60" offset="0" limit="0" ref_labels="parsed" head_date="2026-11-22" at="147c … [line truncated: 7 more bytes on this line] +<unparsed blobs="407" rows="1987" next="--whereis=rankGraphTeleport --whereis-listing=all --detail=1"/> <t_cut rows="4" next="--whereis=rankGraphTeleport --whereis-listing=all --whereis-full-text"/> <hit ref="HEAD" p="src/graph.h" l="14921" kind="def" t="inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>& p, float alpha = 0.85f )"/> <hit ref="HEAD" p="present/deck5_ripwire_build.js" l="1269" kind="ref" t="s.addText("$ ripwire . --callers=rankGraphTeleport", { x: 8.68, y: 2.1, w: 3.8, h: 0.3, fontFace: MONO, fontSize: 10, color: MUTED, margin: 0 });"/> @@ -2882,18 +2945,18 @@ stderr: ````` ripwire: warning: --whereis read the newest 373 of 655 local branches; 282 older were not read (limit: 2097152 tree entries across all refs, 374 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 404 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 407 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 thirteen 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: 16.21s** +**wall time: 11.72s** ````` <!-- ripwire quality-delta schema=ripwire.quality-delta/v1: only what the change made WORSE vs baseline=: regressions= minor= gating=; <r kind= sym= p= was= now= gating= bar=>, <sa> acked. value-ref-excluded=N: internal functions kept off because a table, field or argument in another function or at file scope holds them (matched by name, not a proven call); a floor. stale=N: ack ledger rows whose target no longer applies (sa rows); never gating. stale_by_kind=: stale= split by ack kind (kind:N,...); the sa rows are collapsed. stale_next=: the call printing the sa rows and the full header. preexisting-worse=N: regressions on symbols that existed at baseline; they gate when major. new-symbol=N: NEW code; new-symbol rows never gate, except defect-shape format-arity, ceiling=, tangle. register-macro-excluded=N: symbols skipped: self-registering test/bench macros or Rust #[test]; a floor. declined-call-excluded=N: symbols kept out of dead-code only because a declined call may mean them; a floor. api-new-surface=N: new PUBLIC symbols; a count, never gates, not in regressions=. renames=/rename_window_commits=: git rename pairs read over that many commits, to re-file baseline and acks. acked_by_rename=/acked_by_content=: acked= suppressions matched via git renames / an equal body hash. kinds_skipped=: kinds NOT run, so none of their rows is here and every count covers the rest; a count only they feed is absent. skipped_why=selector (the caller chose; stale acks judged for those kinds only) | memory (see ingest_scope=) | selector,memory (both). acked=N: findings suppressed by the ack ledger, listed as sa rows; never gating. base_ref=/target_ref=: the two resolved full shas a range compared (committed trees; at= omitted). churn=unavailable: range form; short-horizon-churn cannot be measured, so its silence is not no churn. --> -<quality-delta schema="ripwire.quality-delta/v1" baseline="ref-pair" regressions="0" minor="0" acked="0" stale="26" preexisting-worse="0" new-symbol="0" gating="0" register-macro-excluded="63" api-new-surface="0" base_ref="b6ae53e9f828e641b9be583700a1a6501e18ca4f" target_ref="914c4045d08e71e6e6ad23e … [line truncated: 449 more bytes on this line] +<quality-delta schema="ripwire.quality-delta/v1" baseline="ref-pair" regressions="0" minor="0" acked="0" stale="26" preexisting-worse="0" new-symbol="0" gating="0" register-macro-excluded="63" api-new-surface="0" base_ref="9683e45bd878b4a9371ff477dce89856791e02cd" target_ref="147c732930f6ea42d5f4c57 … [line truncated: 449 more bytes on this line] </quality-delta> ````` @@ -2901,12 +2964,12 @@ ripwire: warning: --whereis left 404 branch blobs unparsed, their rows kind=text *The same page with every t= line whole: the page above previews each line over 300 B (200 B and t_bytes=, the <t_cut rows= next=> naming this call), and --whereis-full-text replays it with the same listing, window, rows and labels. MCP: full_text=true.* -**wall time: 16.58s** +**wall time: 13.98s** ````` <!-- ripwire whereis schema=ripwire.whereis/v1: every LOCAL ref whose tree holds sym= (refs_scanned=, blobs=), HEAD first: <hit ref= tip= date= p= l= kind= t=>. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). at=: commit+dirty+shallow. next=: the one pasteable follow-up. refs_omitted=K: past the ref window (512 refs; whereis: 2097152 tree entries) the newest refs by committer date were read; K older local branches were not, in no count or row (a ref-name SUBSTR filter picks which; detail=1 reads all). hits=N: occurrences in HEAD plus every scanned local ref's full tree (the total rows). on-head=1|0: whether HEAD's tree holds it; 0 beside hits = it lives only on a branch. head_labels=index: HEAD kind= from the parsed index; lexical: text heuristic. ref_labels=parsed: another ref's kind= from the index's own tags parse of its blob (one per blob and path; HEAD's own blob takes HEAD's labels); a blob with no line a loose lexical test calls worth parsing is not parsed and its rows read ref; kind=text: such a line no parse read, never a def. unparsed blobs=N: other refs' blobs holding a line worth parsing that no parse read (past the runaway guard, or the parser could not finish); those lines read kind=text; next= lifts the guard. unparsed rows=N: the kind=text rows those blobs gave. more hits=N: rows after this page; page on with offset=next_offset. head_date=: a hit without tip= date= has tip= at=, date= this. --> -<whereis schema="ripwire.whereis/v1" sym="rankGraphTeleport" on-head="1" refs_scanned="373" blobs="10151" hits="2701870" head_labels="index" refs_omitted="282" shown="60" capped="1" total="2701870" has_more="1" next_offset="60" offset="0" limit="0" ref_labels="parsed" head_date="2026-11-22" at="914c … [line truncated: 7 more bytes on this line] -<unparsed blobs="404" rows="1923" next="--whereis=rankGraphTeleport --whereis-listing=all --detail=1"/> +<whereis schema="ripwire.whereis/v1" sym="rankGraphTeleport" on-head="1" refs_scanned="373" blobs="10250" hits="2702085" head_labels="index" refs_omitted="282" shown="60" capped="1" total="2702085" has_more="1" next_offset="60" offset="0" limit="0" ref_labels="parsed" head_date="2026-11-22" at="147c … [line truncated: 7 more bytes on this line] +<unparsed blobs="407" rows="1987" next="--whereis=rankGraphTeleport --whereis-listing=all --detail=1"/> <hit ref="HEAD" p="src/graph.h" l="14921" kind="def" t="inline RankedGraph rankGraphTeleport( const Graph& g, const std::vector<float>& p, float alpha = 0.85f )"/> <hit ref="HEAD" p="present/deck5_ripwire_build.js" l="1269" kind="ref" t="s.addText("$ ripwire . --callers=rankGraphTeleport", { x: 8.68, y: 2.1, w: 3.8, h: 0.3, fontFace: MONO, fontSize: 10, color: MUTED, margin: 0 });"/> <hit ref="HEAD" p="present/deck5_ripwire_build.js" l="1271" kind="ref" t="{ text: "<callers of=\"rankGraphTeleport\"\n defs=\"1\" count=\"7\" ", options: { color: TEXT } },"/> @@ -2941,22 +3004,22 @@ stderr: ````` ripwire: warning: --whereis read the newest 373 of 655 local branches; 282 older were not read (limit: 2097152 tree entries across all refs, 374 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 404 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 407 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 <fate> row (never / removed-by-commit) for names no tree carries.* -**wall time: 18.14s** +**wall time: 18.79s** ````` <!-- ripwire whereis schema=ripwire.whereis/v1: every LOCAL ref whose tree holds sym= (refs_scanned=, blobs=), HEAD first: <hit ref= tip= date= p= l= kind= t=>. window: shown= capped= (capped=1 cut). at=: commit+dirty+shallow. next=: the one pasteable follow-up. refs_omitted=K: past the ref window (512 refs; whereis: 2097152 tree entries) the newest refs by committer date were read; K older local branches were not, in no count or row (a ref-name SUBSTR filter picks which; detail=1 reads all). hits=N: occurrences in HEAD plus every scanned local ref's full tree (the total rows). on-head=1|0: whether HEAD's tree holds it; 0 beside hits = it lives only on a branch. head_labels=index: HEAD kind= from the parsed index; lexical: text heuristic. ref_labels=parsed: another ref's kind= from the index's own tags parse of its blob (one per blob and path; HEAD's own blob takes HEAD's labels); a blob with no line a loose lexical test calls worth parsing is not parsed and its rows read ref; kind=text: such a line no parse read, never a def. hit refs=N: N scanned refs hold this same definition (or kind=text) line (path + text); printed once for the first by name, whose ref= tip= date= l= it carries; defs page only, absent = one ref; hits= counts every copy, listing=all prints each. folded=N: def (or text) rows of other refs a listed row's refs= stands for; shown + more + folded + refs count = hits on the first page. listing=defs|refs: only those kind= rows listed (defs: def and text); under defs <refs count=N next=> counts the kind=ref rows and next= lists them; the window counts listed rows; default: defs if it lists more defs than all, else if shorter; a def the parser does not model (define_method, setattr, assignment) is a counted ref. head_date=: a hit without tip= date= has tip= at=, date= this. --> -<whereis schema="ripwire.whereis/v1" sym="computeOnePairOverlap" on-head="1" refs_scanned="373" blobs="10151" hits="163932" head_labels="index" refs_omitted="282" shown="2" capped="0" listing="defs" folded="372" ref_labels="parsed" head_date="2026-11-22" at="914c4045d"> -<history probed="1" head="914c4045d" commits="7404" removed-names="59523"/> +<whereis schema="ripwire.whereis/v1" sym="computeOnePairOverlap" on-head="1" refs_scanned="373" blobs="10250" hits="163938" head_labels="index" refs_omitted="282" shown="2" capped="0" listing="defs" folded="372" ref_labels="parsed" head_date="2026-11-22" at="147c73293"> +<history probed="1" head="147c73293" commits="7407" removed-names="59536"/> <hit ref="HEAD" p="src/mergescout.h" l="696" kind="def" t="inline PairOverlap computeOnePairOverlap( std::size_t a, std::size_t b, const Arm& armA, const Arm& armB )"/> <hit ref="community/pr433" tip="fafb3f267" date="2026-10-29" p="src/mergescout.h" l="696" kind="def" refs="373" t="inline PairOverlap computeOnePairOverlap( std::size_t a, std::size_t b, const Arm& armA, const Arm& armB )"/> -<refs count="163558" next="--whereis=computeOnePairOverlap --whereis-listing=refs"/> +<refs count="163564" next="--whereis=computeOnePairOverlap --whereis-listing=refs"/> </whereis> ````` @@ -2970,7 +3033,7 @@ ripwire: warning: --whereis read the newest 373 of 655 local branches; 282 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.05s** +**wall time: 1.12s** ````` <!-- ripwire flags schema=ripwire.flags/v1: BUILT but DARK: <gate name= kind=compile|cmake|env default= dark= regions=/loc=(#if only) reads= p= l=> with <read p= l=> sites. writes_capped=/reads_capped=: 1 = cut. next=: the one pasteable follow-up. gates=/dark_gates=: gate rows (never cut) / those whose default keeps the guarded code out of the build. compile=/cmake=/env=: gates by kind: ifndef/define header gate, CMake option(), getenv read. files=N: files this verb scanned for gates (source + CMakeLists), wider than the map's corpus. --> @@ -3065,10 +3128,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: 1.56s** +**wall time: 1.57s** ````` -{"v":1,"verb":"plan-lanes","at":"914c4045d","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":4852,"symbols":45032,"edges":453 … [line truncated: 338 more bytes on this line] +{"v":1,"verb":"plan-lanes","at":"147c73293","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":4852,"symbols":45032,"edges":453 … [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"}, @@ -3105,7 +3168,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: 1.67s** +**wall time: 1.64s** Input file: @@ -3116,7 +3179,7 @@ write regression tests for the new filter ````` ````` -{"v":1,"verb":"plan-lanes","at":"914c4045d","root":".","task":null,"source":"brief","requested":3,"lane_count":3,"claim_key":"path+scope+name","on_conflict":"producing-lane-rebases","corpus":{"files":4852,"symbols":45032,"edges":45381,"ambiguous":3984,"unresolved":20100},"carve":null,"core":{"files" … [line truncated: 4 more bytes on this line] +{"v":1,"verb":"plan-lanes","at":"147c73293","root":".","task":null,"source":"brief","requested":3,"lane_count":3,"claim_key":"path+scope+name","on_conflict":"producing-lane-rebases","corpus":{"files":4852,"symbols":45032,"edges":45381,"ambiguous":3984,"unresolved":20100},"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":689,"ord":0,"overloads":1,"amb":0,"cx":1,"ccx":0,"churn":676,"tested":0}, @@ -3233,7 +3296,7 @@ ripwire: --layout: 'Lang' is an enum, --layout models structs (a scoped/unscoped ````` <!-- ripwire doc-drift schema=ripwire.doc-drift/v1: markdown anchors that no longer hold: <doc p=> of <a k= l= c= why= ref= want= got= tgt=>; unchecked/dated rows disclose the rest. failed_capped=/weak_capped=: 1 = cut. at=: commit+dirty+shallow. next=: the one pasteable follow-up. docs=N: markdown docs scanned for anchors; docs minus clean = the doc rows. clean=N: docs with no failed anchor (drift and dated 0); not proof every anchor was checked. checked=N: anchors verified against the index; checked + unchecked = anchors. prose=N: value anchors dropped as prose (name not in code); subtracted from anchors=, never checked. corpus=N: files the anchors were checked against (index + config/build exts); 0 = no anchor shape, no scan. drift=/dated=: anchors that no longer hold / anchors skipped as dated (unverifiable by date). unchecked=N: anchors not proved (the unchecked rows give each reason); checked + unchecked = anchors. doc shown_failed=/failed_total=: a rows printed / all failed anchors (drift+dated); cut at 12, detail=1 lifts. a kind=/rec=: dated-record, an author-dated failed anchor in dated= / its evidence: line|block|title|stamp. a sym=: the symbol the doc names on that file:line; line-moved = that symbol no longer spans the line. more weak=N: w rows of this group withheld; shown_weak + N = its n=; detail=1 lists all. shown_weak=N: w rows printed of n= (cut at 12 a doc, weak_capped=1); detail=1 lists all. w resolves-to=: the indexed symbol spanning that line; not proof it is the one the doc meant. unchecked r=/note=: why n= anchors were not proved, and what was still checked for them. dated r=/note=: the dating mark that moved n= failed anchors into dated= instead of drift=. --> -<doc-drift schema="ripwire.doc-drift/v1" docs="356" clean="321" anchors="8252" checked="3910" unchecked="4342" drift="91" dated="136" prose="26" corpus="5018" at="914c4045d" next="--doc-drift --detail=1"> +<doc-drift schema="ripwire.doc-drift/v1" docs="356" clean="321" anchors="8252" checked="3910" unchecked="4342" drift="91" dated="136" prose="26" corpus="5018" at="147c73293" next="--doc-drift --detail=1"> <doc p="docs/research/answer-completeness.md" anchors="187" checked="84" drift="16" dated="0" shown_failed="12" failed_capped="1" failed_total="16"> <a k="file-line" l="341" c="25" why="line-moved" ref="src/pageview.h:292" sym="pageDisclosure" got="(file scope)" tgt="src/pageview.h:351"/> <a k="file-line" l="349" c="99" why="line-moved" ref="src/serialize.h:4169" sym="kForLensDefaultTopN" got="append" tgt="src/serialize.h:1111"/> @@ -3271,7 +3334,7 @@ ripwire: --layout: 'Lang' is an enum, --layout models structs (a scoped/unscoped ````` <!-- ripwire doc-drift schema=ripwire.doc-drift/v1: markdown anchors that no longer hold: <doc p=> of <a k= l= c= why= ref= want= got= tgt=>; unchecked/dated rows disclose the rest. failed_capped=/weak_capped=: 1 = cut. at=: commit+dirty+shallow. next=: the one pasteable follow-up. docs=N: markdown docs scanned for anchors; docs minus clean = the doc rows. clean=N: docs with no failed anchor (drift and dated 0); not proof every anchor was checked. checked=N: anchors verified against the index; checked + unchecked = anchors. prose=N: value anchors dropped as prose (name not in code); subtracted from anchors=, never checked. corpus=N: files the anchors were checked against (index + config/build exts); 0 = no anchor shape, no scan. drift=/dated=: anchors that no longer hold / anchors skipped as dated (unverifiable by date). unchecked=N: anchors not proved (the unchecked rows give each reason); checked + unchecked = anchors. doc shown_failed=/failed_total=: a rows printed / all failed anchors (drift+dated); cut at 12, detail=1 lifts. a kind=/rec=: dated-record, an author-dated failed anchor in dated= / its evidence: line|block|title|stamp. a sym=: the symbol the doc names on that file:line; line-moved = that symbol no longer spans the line. more weak=N: w rows of this group withheld; shown_weak + N = its n=; detail=1 lists all. shown_weak=N: w rows printed of n= (cut at 12 a doc, weak_capped=1); detail=1 lists all. w resolves-to=: the indexed symbol spanning that line; not proof it is the one the doc meant. unchecked r=/note=: why n= anchors were not proved, and what was still checked for them. dated r=/note=: the dating mark that moved n= failed anchors into dated= instead of drift=. --> -<doc-drift schema="ripwire.doc-drift/v1" docs="356" clean="321" anchors="8252" checked="3910" unchecked="4342" drift="91" dated="136" prose="26" corpus="5018" at="914c4045d" next="--doc-drift --detail=1"> +<doc-drift schema="ripwire.doc-drift/v1" docs="356" clean="321" anchors="8252" checked="3910" unchecked="4342" drift="91" dated="136" prose="26" corpus="5018" at="147c73293" next="--doc-drift --detail=1"> <doc p="docs/research/answer-completeness.md" anchors="187" checked="84" drift="16" dated="0" shown_failed="12" failed_capped="1" failed_total="16"> <a k="file-line" l="341" c="25" why="line-moved" ref="src/pageview.h:292" sym="pageDisclosure" got="(file scope)" tgt="src/pageview.h:351"/> <a k="file-line" l="349" c="99" why="line-moved" ref="src/serialize.h:4169" sym="kForLensDefaultTopN" got="append" tgt="src/serialize.h:1111"/> @@ -3339,8 +3402,8 @@ Tail of the same output — the `<gateability>` section: ````` <!-- ripwire doc-drift schema=ripwire.doc-drift/v1: markdown anchors that no longer hold: <doc p=> of <a k= l= c= why= ref= want= got= tgt=>; unchecked/dated rows disclose the rest. failed_capped=/weak_capped=: 1 = cut. at=: commit+dirty+shallow. next=: the one pasteable follow-up. docs=N: markdown docs scanned for anchors; docs minus clean = the doc rows. clean=N: docs with no failed anchor (drift and dated 0); not proof every anchor was checked. checked=N: anchors verified against the index; checked + unchecked = anchors. prose=N: value anchors dropped as prose (name not in code); subtracted from anchors=, never checked. corpus=N: files the anchors were checked against (index + config/build exts); 0 = no anchor shape, no scan. drift=/dated=: anchors that no longer hold / anchors skipped as dated (unverifiable by date). unchecked=N: anchors not proved (the unchecked rows give each reason); checked + unchecked = anchors. doc shown_failed=/failed_total=: a rows printed / all failed anchors (drift+dated); cut at 12, detail=1 lifts. a kind=/rec=: dated-record, an author-dated failed anchor in dated= / its evidence: line|block|title|stamp. a sym=: the symbol the doc names on that file:line; line-moved = that symbol no longer spans the line. more weak=N: w rows of this group withheld; shown_weak + N = its n=; detail=1 lists all. shown_weak=N: w rows printed of n= (cut at 12 a doc, weak_capped=1); detail=1 lists all. w resolves-to=: the indexed symbol spanning that line; not proof it is the one the doc meant. unchecked r=/note=: why n= anchors were not proved, and what was still checked for them. dated r=/note=: the dating mark that moved n= failed anchors into dated= instead of drift=. --> -<doc-drift schema="ripwire.doc-drift/v1" docs="356" clean="327" anchors="8252" checked="3888" unchecked="4364" drift="78" dated="127" prose="26" corpus="5018" at="914c4045d" next="--doc-drift --detail=1"> -<history probed="1" head="914c4045d" commits="7404" removed-names="59523"/> +<doc-drift schema="ripwire.doc-drift/v1" docs="356" clean="327" anchors="8252" checked="3888" unchecked="4364" drift="78" dated="127" prose="26" corpus="5018" at="147c73293" next="--doc-drift --detail=1"> +<history probed="1" head="147c73293" commits="7407" removed-names="59536"/> <doc p="docs/research/answer-completeness.md" anchors="187" checked="84" drift="16" dated="0" shown_failed="12" failed_capped="1" failed_total="16"> <a k="file-line" l="341" c="25" why="line-moved" ref="src/pageview.h:292" sym="pageDisclosure" got="(file scope)" tgt="src/pageview.h:351"/> <a k="file-line" l="349" c="99" why="line-moved" ref="src/serialize.h:4169" sym="kForLensDefaultTopN" got="append" tgt="src/serialize.h:1111"/> @@ -3527,7 +3590,7 @@ AddressSanitizer:DEADLYSIGNAL *Task lens + a compact Mermaid flowchart of the top anchors' 1-hop edges.* ````` -<ctx task="pagerank power iteration" route="subtoken+body" root="." confidence="high" margin_pct="22" at="914c4045d" doc_mentions="4" schema="ripwire.for/v1" bundle="compact" bodies="0" reason="compact-route" budget_bytes="7500" doc_mentions_capped="1" doc_mentions_total="14" est_tokens="8311"> +<ctx task="pagerank power iteration" route="subtoken+body" root="." confidence="high" margin_pct="22" at="147c73293" doc_mentions="4" schema="ripwire.for/v1" bundle="compact" bodies="0" reason="compact-route" budget_bytes="7500" doc_mentions_capped="1" doc_mentions_total="14" est_tokens="8311"> <!-- ripwire for schema=ripwire.for/v1: bundle=/bodies=/reason= the body posture; d: cx= ccx= complexity, in= callers (absent cx/ccx/in = 0), churn= amp= change, clone= tested= 1, sc= scope, id=p::sc::n; total= shown= capped=1 if cut; task= the query; d pure=1 const/constexpr sig, next= the follow-up to paste; d same_as=N: doc+sig text as row n=N (not repeated); route= name-exact(X)|subtoken+body[:broad|:declined]; confidence=/margin_pct= head score drop (low=flat); h l= p= n=, c n= l= p= (p= if not h's; same-named joined, shown= counts them), noedge= no callee resolved; fold kind=bodies: b t= n= p= l= top ranked rows' whole bodies, not the answer; served= of total= in budget_bytes=; slice/skip p= n= l=; skip bytes= next=; a skip makes sigs next= it, sigs_next= the signatures-only re-call; d mem= an owner's direct member names only, by the index (question words first, then owner's file, path, line, name), mem_more= names cut; t p= file outside sigs (weaker), t sym= its top symbols not in sigs/syms (a pointer, not the answer), r= rank (gap = trimmed); t tsym= up to 2 more file symbols named by a task word (a name match); t order: code files first, then doc files (a code question); t page rows go on to file-page row 160 (code question: 160 code rows, docs within row 160); past page 0 (code question: past 40 code rows, a doc past row 40) listed last, head files skipped; past 120 of those p= only, p_only= counts them; t folded=class=N: N p= only rows of that class (doc|config|script|testdata|other) not listed, next= pages to them; d layer=: built-in arch layer (game|infra|render|math|audio|ai|test) from a dir name in p=; d e= its last line (absent=unknown, never 0; l= the name's line); c prov=split: a resolver split arm; may be another arm's (NOT a claim the edge is false) [doc mentions: 4 docs, 2 symbols; doc_mentions=] --> <!-- root= is the crawl root; p= below is RELATIVE to it (single-root only; absent => p= is ingest's own path, unchanged); at=this commit(+dirty). [budget_bytes= is the default BYTE target this ranked payload was shaped toward: row text shortens toward it, no row of the ranked head is removed for it (sigs past_target=)] [sigs capped=1 with shown=total: rows shrunk, none dropped] [sigs past_target=K: the last K rows are past the budget_bytes target, served because they are rows of the ranked head; none is cut] [sigs sigs_next=: one call serving all total= rows uncut] [docs_dropped=N: N shown rows have a doc comment not printed (r>24 always, r5..24 if capped)] [docs_after_code=N: N doc rows of the shown set moved below its code rows; same rows, reordered, none added or removed; a question naming docs keeps score order] [files_first=N: N rows moved so r=1..8 are distinct files' best rows, score order, a repeated name once; same rows; fold, hops keep score order] [cut: doc_mentions_capped="1" doc_mentions_total="14" — an indexing cap dropped content not shown here]; lego/compose collapse to a counted stub by default (a disclosed cut): total= that section's own pre-cap row count, shown="0" capped="1" (nothing rendered here), next= names the sections=lego,compose flag that restores both sections byte-identically in one call est_tokens= prices this bundle in tokens --> <sigs shown="40" total="40" capped="1" past_target="14" docs_dropped="25" docs_after_code="5" files_first="7" sigs_next="--for='pagerank power iteration' --signatures-only --token-budget=6200" next="--expand=src/prconverge.h:73:renderDisclosure"> @@ -3564,7 +3627,7 @@ AddressSanitizer:DEADLYSIGNAL *Per-file metrics as CodeCharta cc.json.* -**wall time: 1.12s** +**wall time: 1.15s** ````` (empty) @@ -3581,7 +3644,7 @@ Artifact written: *One-turn sweep: 4 newline-delimited verb:arg sub-queries answered in ONE deduped <batch>.* -**wall time: 1.82s** +**wall time: 1.91s** Input file: @@ -3596,7 +3659,7 @@ lego:Vehicle <batch schema="ripwire.batch/v1" n="4" requested="4" cap="16"> <!-- ripwire batch schema=ripwire.batch/v1: n= read sub-queries in one sweep (requested=, cap=): each <q> wraps one sub-answer verbatim in CDATA. i=/verb=/ok=: sub-query index, its verb text, 1 answered (payload in CDATA) or 0 failed. <file-scope> (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. --> <q i="0" verb="for" ok="1"> -<![CDATA[<ctx task="incremental cache invalidation" route="subtoken+body" root="." confidence="low" margin_pct="0" at="914c4045d" doc_mentions="3" bundle="sigs" lens="churn,amp,tested" budget_bytes="7500" est_tokens="9860"> +<![CDATA[<ctx task="incremental cache invalidation" route="subtoken+body" root="." confidence="low" margin_pct="0" at="147c73293" doc_mentions="3" bundle="sigs" lens="churn,amp,tested" budget_bytes="7500" est_tokens="9860"> <!-- ripwire lens for "incremental cache invalidation" [doc mentions: 3 docs discussing 2 top-ranked symbols surfaced; doc_mentions= on the root repeats the doc count]: reusable building blocks (cx=complexity, in=reuse-count; an absent cx/ccx/in is 0) — prefer composing/reusing these over reimplementing; sc=scope (full id p::sc::n); route= name-exact(X)|subtoken+body[:broad|:declined]; bundle=sigs: signatures only in this bundle, no inline bodies — fetch a symbol's full body with the fetch_body verb [confidence= derives from the ranked head's largest relative score drop (margin_pct=, whole percent, 0 = none; the same gap the adaptive flag cuts at). low = flat ranking: treat the set as a starting point, not an answer]; lens="churn,amp,tested": the three per-row quality columns the CLI for lens carries and this dialect does NOT (they need a git and a quality pass this server does not run per request); an absent column here means NOT MEASURED, never measured-and-zero; est_tokens= prices this bundle in tokens; tail: file-grain rows, WEAKER evidence than the ranked rows: first the positive-score files NOT among the shown sigs rows, the files of trimmed rows first, best-symbol rank order; then the file page's first 40 rows not listed above, file-first (the IDF share of the query's subtokens its top 8 symbols cover); sym= its top symbols by lens rank, minus names a sigs row or the syms block shows (a pointer, not the answer); total=every positive-score file, shown=printed, capped=1 when they differ, next= the page from its first unprinted row. r= on a ranked row is its 1-based rank in this lens ranking, rows in r= order, p= the file (a gap = a budget-trimmed row); tail order on this code question: every code file of both parts first, each part in the order above, then the doc files (.md, .rst, a Sphinx .txt page) in that order; tail walk: the page rows go on to the file page's first 160 rows (a code question: its first 160 code rows, plus the doc rows within its first 160 rows); a row past page 0 (a code question: past its first 40 code rows, a doc past row 40) comes after every page 0 row, skips files the head shows and carries sym= too; past 120 such rows p= only, p_only= counts them; tail folded=class=N: on a code question, N rows past page 0 of that file class (doc, config, script, testdata, other) are not listed, unless the task names the class (adding a new X, or a quoted message, keeps doc and config); next= pages from the first one; e= on a d row: the 1-based line where that definition ends, body-inclusive; absent when the extent is not known (extent_suspect, docs, config), never 0; l= is the line of the definition's name, so a definition can start above l=; lego/compose collapse to a counted stub by default (a disclosed cut): total= that section's own pre-cap row count, shown="0" capped="1" (nothing rendered here), next= names the sections=lego,compose flag that restores both sections byte-identically in one call --> <!-- root= is the crawl root; p= below is RELATIVE to it (single-root only; absent => p= is ingest's own path, unchanged); at=this commit(+dirty). [budget_bytes= is the default BYTE target this ranked payload was shaped toward: row text shortens toward it, no row of the ranked head is removed for it (sigs past_target=)] [sigs capped=1 with shown=total: rows shrunk, none dropped] [sigs past_target=K: the last K rows are past the budget_bytes target, served because they are rows of the ranked head; none is cut] [sigs next_budget_tokens=: call this tool again with that budget_tokens to get all total= rows uncut] [docs_dropped=N: N shown rows have a doc comment not printed (r>24 always, r5..24 if capped)] [docs_after_code=N: N doc rows of the shown set moved below its code rows; same rows, reordered, none added or removed; a question naming docs keeps score order] [files_first=N: N rows moved so r=1..8 are distinct files' best rows, score order, a repeated name once; same rows; fold, hops keep score order] --> <!-- <d cx= ccx=>: cyclomatic/cognitive complexity. layer=: built-in arch layer (game|infra|render|math|audio|ai|test) from a dir name in p=; absent if none. task=: the query. d n= l=: the symbol's name and def line. d pure=1: const/constexpr signature (Swift: non-mutating) and no transitive side effect found; a hint. --> @@ -3635,17 +3698,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: 5.94s** +**exit code: 1** — **wall time: 6.23s** ````` <!-- ripwire doctor schema=ripwire.doctor/v1: setup health: <c n= ok=> checks; exit 1 when one fails. at=: commit+dirty+shallow. n=: the check's name (binary-path, grammars, cache-dir, git, tree-sitter, index-cache, layout ...). loaded=/expected=: grammars whose tags query compiled / grammars compiled in; a shortfall fails the row. dir=: the per-user cache directory scanned (TMPDIR/XDG_CACHE_HOME ladder); unwritable fails the row. blobs=N: ripwire cache blobs in dir=; the scan stops at 4096 (blobs_floor=1 then). bytes=N: total size in bytes of the blobs counted (short when truncated=1). many=1: more than 50 blobs; an eviction-sanity flag, informational, never fails the row. truncated=1: cache-dir, blob scan cut (cap or I/O error); tracked-binaries, scan SKIPPED, stale=0 unmeasured. locks=N: advisory edit-lock files under locks/; unheld ones over a day old are swept on a cache write. volatile=: this row's attributes that read LIVE machine state; a determinism diff strips them, never the row. git=0|1: git runs from PATH; 0 fails the row (churn verbs need it). repo=0|1: the root is inside a git work tree; 0 is a diagnosis, not a failure. history=0|1: the repo has at least one commit; head= prints only when it does. head=: HEAD's short sha (9 hex, the at= width). core_abi=/cpp_grammar_abi=: tree-sitter core language ABI / the C++ grammar's ABI; informational. languages=N: distinct compiled-in grammars (the grammars row's expected=). tracked=N: git ls-files count, printed even when truncated=1 (over 20000 files skips the scan). binaries=N: tracked paths that sniff as binary content. non_git=1: no git history to compare; the row passes unscanned. stale=N: tracked binaries committed before a same-dir same-stem source changed; any fails the row. cache_version=/parser_ver_lean=/parser_ver_rich=/artifact_arch=: index identity; reuse needs all four. rich_verbs=: the verbs that consume the rich artifact (rich=); every other verb reads the lean one. source=: auto (per-root blob), cache-flag (named by the cache flag) or disabled (no-cache: nothing read). lean_path=/rich_path=: the artifact files checked; one path when the cache flag named it. lean=/rich=: can THIS binary open that artifact (ok, absent, parser-version ...); format, never freshness. fsmonitor=: the checkout's core.fsmonitor at startup: unset, builtin, off, or hook (a command git runs). neutralised=1: a hook fsmonitor was overridden to false for this run; 0 when none was needed. filter_drivers=N: filter drivers the repository's own config defines; filter_scope= local|all, filter_pinned= 1 (run with an empty command) or refused. state=: layout records agree, disagree (mixed binary: rebuild clean-first), not-checked or no-records. checked=1: the cross-unit layout comparison ran; 0 = under two comparable records. units=N: translation units that registered a layout record. types=N: layout types recorded (only those registered in src/model.h); omitted on state=disagree. checks=/passed=: checks run / how many passed; exit 1 when passed= is below checks=. built_from=: the commit this binary was built from; at= is the tree HEAD now, a mismatch is normal. self=/which=: this binary's path and the one which ripwire finds on PATH; which_version= is the version line that one prints when they differ. on_path=0|1: whether a ripwire is on PATH; 0 fails the row and hint= carries the export line. same_file=1: the PATH copy is this very file (same device and inode). same_bytes=1: a different file with identical content, a copied install (ok); 0 fails the row; unknown: a file was unreadable; the row fails unverified (hint= names it). self_mtime=/self_size=/which_mtime=/which_size=: epoch mtime and byte size of each binary. hint=: the row's verdict and fix in plain text (which binary is stale, what to run). --> -<doctor schema="ripwire.doctor/v1" checks="9" passed="8" at="914c4045d" built_from="914c4045d"> -<c n="binary-path" ok="0" self="./build/ripwire" which="<path>" on_path="1" same_file="0" same_bytes="0" self_mtime="1795336538" self_size="65732168" which_mtime="1793517843" which_size="58197960" which_version="ripw … [line truncated: 525 more bytes on this line] +<doctor schema="ripwire.doctor/v1" checks="9" passed="8" at="147c73293" built_from="147c73293"> +<c n="binary-path" ok="0" self="./build/ripwire" which="<path>" on_path="1" same_file="0" same_bytes="0" self_mtime="1795347577" self_size="65732168" which_mtime="1793517843" which_size="58197960" which_version="ripw … [line truncated: 525 more bytes on this line] <c n="grammars" ok="1" loaded="27" expected="27"/> -<c n="cache-dir" ok="1" dir="<tmp>" blobs="213" bytes="2000864999" many="1" truncated="0" locks="225" volatile="blobs,blobs_floor,bytes,many,truncated,locks"/> -<c n="git" ok="1" git="1" repo="1" history="1" head="914c4045d"/> +<c n="cache-dir" ok="1" dir="<tmp>" blobs="456" bytes="2163636282" many="1" truncated="0" locks="229" volatile="blobs,blobs_floor,bytes,many,truncated,locks"/> +<c n="git" ok="1" git="1" repo="1" history="1" head="147c73293"/> <c n="tree-sitter" ok="1" core_abi="15" cpp_grammar_abi="14" languages="27"/> -<c n="tracked-binaries" ok="1" tracked="5597" binaries="33" non_git="0" truncated="0" stale="0"/> +<c n="tracked-binaries" ok="1" tracked="5598" binaries="33" non_git="0" truncated="0" stale="0"/> <c n="index-cache" ok="1" cache_version="54" parser_ver_lean="337" parser_ver_rich="338" artifact_arch="16" rich_verbs="for,uses,metrics,exemplar,context-ratio,nonlocal-state,quality-panel,verify,eval-retrieval,eval-mined,eval-skills" source="auto" lean_path="<tmp> … [line truncated: 219 more bytes on this line] <c n="git-config-trust" ok="1" fsmonitor="unset" neutralised="0" filter_drivers="0"/> <c n="layout" ok="1" state="agree" checked="1" units="2" types="12"/> @@ -3698,7 +3761,7 @@ 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: 1.39s** +**wall time: 1.58s** ````` <!-- ripwire map schema=ripwire.map/v1: ranked symbol map: <f p= layer=> groups <s t= n= sc= k= amb=> rows (k= rank), <c n=> resolved callees; the header comment is data. est_tokens=: price as emitted (an upper bound under compact). at=: commit+dirty+shallow. root=: p= relative to it. pr_iters=N: PageRank iterations. rank_by=: the ranker behind k=. window=: the git span mined. 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. overloads=N: N same-name defs merged in this row; shown= counts each. 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. sc=: enclosing scope; the full id is p::sc::n (p= of the row or its <f>) and selectors take it. --> @@ -3706,7 +3769,7 @@ ripwire scan: 0 finding(s) total (26 skill file(s) scanned, 0 unscannable file(s <!-- t=type|alias|functype=a-Go-named-type-by-its-written-form:type=a-defined-type-whose-WRITTEN-form-is-not-a-struct/iface/func-literal(type-N-string;type-W-Pair-too,whatever-Pair-is-underneath),alias=type-A=B,functype=type-F-func(...) --> <!-- t=alias|functype-in-C++-and-.h:alias=using-X=Y(also-templated-or-class-scope)or-namespace-L=lib(defs=X-prints-its-written-target-as-to=),functype=a-typedef-of-a-function-or-function-pointer-type(typedef-void(*F)(int));other-typedefs-read-t=struct --> <!-- files=4852 symbols=45031 edges=45381 shown=5 est_tokens=1268 ambiguous=3984 unresolved=20100 locality_pinned=14 external=12460 declined=45307 extent_suspect_syms=12 macro_blanked_files=7 skipped_oversize=15 unindexed="txt:85,tsv:54,mod:33,xml:33,jsonl:26,scm:25" unindexed_exts=23 order=important-first --> -<r schema="ripwire.map/v1" at="914c4045d" root="." rank_by="churn" window="18mo@HEAD" est_tokens="1268" pr_iters="22"> +<r schema="ripwire.map/v1" at="147c73293" root="." rank_by="churn" window="18mo@HEAD" est_tokens="1268" pr_iters="22"> <f p="src/resolve.h"> <s t="method" n="appendUint" sc="Narrower" k="0.0038"> </s> @@ -3727,28 +3790,26 @@ ripwire scan: 0 finding(s) total (26 skill file(s) scanned, 0 unscannable file(s </r> ````` -## `./build/ripwire . --rank-by=churn-decay --since=HEAD~12 --exclude=test --exclude=docs --exclude=skills --exclude=changelog.d --in=src --limit=2` +## `./build/ripwire . --rank-by=churn-decay --since=HEAD~9 --exclude=test --exclude=docs --exclude=skills --exclude=changelog.d --in=src --limit=1` -*Scope the recent-changes answer to ONE directory. The global <recent> block stays byte-identical, a second <recent scope="src"> 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 <symbols stubbed="1" would_show= next=/> 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. This page holds 2 row(s), not the usual 3: no change window on this branch held enough src/ files for a larger page to cut, so the generator fell back to a smaller one (see chooseInWindow).* +*Scope the recent-changes answer to ONE directory. The global <recent> block stays byte-identical, a second <recent scope="src"> 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 <symbols stubbed="1" would_show= next=/> 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. This page holds 1 row(s), not the usual 3: no change window on this branch held enough src/ files for a larger page to cut, so the generator fell back to a smaller one (see chooseInWindow).* -**wall time: 1.68s** +**wall time: 1.86s** ````` <!-- ripwire map schema=ripwire.map/v1: ranked symbol map: <f p= layer=> groups <s t= n= sc= k= amb=> rows (k= rank), <c n=> resolved callees; the header comment is data. window: capped= has_more= next_offset= (capped=1 cut; next_offset= pastes as offset=). est_tokens=: price as emitted (an upper bound under compact). at=: commit+dirty+shallow. root=: p= relative to it. rank_by=: the ranker behind k=. window=: the git span mined. declined=K: K calls left unbound (no evidence chose one def). external=K: K calls proven outside the tree, no edge. locality_pinned=K: K calls pinned by locality alone (a guess). <recent n= of=>: the n= newest-touched of of= touched files; <rc age_d=> days since its last commit, w= decayed weight. merge_bombs_skipped=N: N commits touching more than 100 INDEXED files skipped, uncounted; a file only they touched is absent; the window's count, so the global block only. <recent scope=DIR>: a second block riding when the global one does, DIR's files only (p= root-relative); of= is its total; capped=/has_more=/next_offset=/offset=/limit= page it, next= is that page. <symbols stubbed=1 would_show=N next=>: the symbol map in= did not ask for was not rendered; N is that run's own shown= — definitions counted individually as shown= counts them, so its rows follow from rows+sum(overloads-1)=shown (not the header's symbols= corpus count); next= fetches it. 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. next=: the one pasteable follow-up. --> <!-- t=modscope=a-file's-MODULE-SCOPE(n=<file-scope>):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 --> <!-- t=alias|functype-in-C++-and-.h:alias=using-X=Y(also-templated-or-class-scope)or-namespace-L=lib(defs=X-prints-its-written-target-as-to=),functype=a-typedef-of-a-function-or-function-pointer-type(typedef-void(*F)(int));other-typedefs-read-t=struct --> -<!-- files=648 symbols=23039 edges=31083 shown=0 est_tokens=1467 ambiguous=2764 unresolved=5488 locality_pinned=9 external=8312 declined=40001 skipped_oversize=15 unindexed="tsv:43,txt:26,scm:25,jsonl:23,expected:15,lock:7" unindexed_exts=12 order=important-first --> -<r schema="ripwire.map/v1" at="914c4045d" root="." rank_by="churn-decay" window="HEAD~12 half-life=90d" est_tokens="1467"> -<recent n="3" of="3" merge_bombs_skipped="0"> -<rc p="src/serialize.h" age_d="0" w="6"/> +<!-- files=648 symbols=23039 edges=31083 shown=0 est_tokens=1431 ambiguous=2764 unresolved=5488 locality_pinned=9 external=8312 declined=40001 skipped_oversize=15 unindexed="tsv:43,txt:26,scm:25,jsonl:23,expected:15,lock:7" unindexed_exts=12 order=important-first --> +<r schema="ripwire.map/v1" at="147c73293" root="." rank_by="churn-decay" window="HEAD~9 half-life=90d" est_tokens="1431"> +<recent n="2" of="2" merge_bombs_skipped="0"> <rc p="src/lexical.h" age_d="0" w="3"/> -<rc p="src/ingest_sidecap.h" age_d="0" w="2"/> +<rc p="src/serialize.h" age_d="0" w="2"/> </recent> -<recent scope="src" n="2" of="3" capped="1" has_more="1" next_offset="2" offset="0" limit="2" next="--rank-by=churn-decay --since=HEAD~12 --exclude=test --exclude=docs --exclude=skills --exclude=changelog.d --in=src --offset=2 --limit=2"> -<rc p="src/serialize.h" age_d="0" w="6"/> +<recent scope="src" n="1" of="2" capped="1" has_more="1" next_offset="1" offset="0" limit="1" next="--rank-by=churn-decay --since=HEAD~9 --exclude=test --exclude=docs --exclude=skills --exclude=changelog.d --in=src --offset=1 --limit=1"> <rc p="src/lexical.h" age_d="0" w="3"/> </recent> -<symbols stubbed="1" would_show="200" next="--rank-by=churn-decay --since=HEAD~12 --exclude=test --exclude=docs --exclude=skills --exclude=changelog.d"/> +<symbols stubbed="1" would_show="200" next="--rank-by=churn-decay --since=HEAD~9 --exclude=test --exclude=docs --exclude=skills --exclude=changelog.d"/> </r> ````` @@ -3794,19 +3855,19 @@ ripwire: --rank-by: unknown value 'bogus' (supported: pagerank|authority|hub|rrf ````` <!-- ripwire candidates: flat top K export for an external reranker. r=rank(1 based) s=SCORE n=name id=canonical k=KIND-tag p=path l=line. Note k= is the kind here and the PageRank score in the ranked map; on this row the score is s=. Root: count= rows exported of total= RANKED CORPUS symbols (total is the corpus size, never a match count), capped="1" means the top-k cut dropped some; route= names the ranker (s= is comparable only within one route); anchored= counts query-mention lifts (0 = the anchor ran and moved nothing); weak="1" means the top raw lexical score is below the confidence bar, so these rows rest on thin textual evidence; doc_tier= names the query SHAPE (a pasted trace, a pasted bug-report form) that scored documents down for this run, absent when none did. --> <candidates count="5" total="45032" capped="1" route="subtoken+body" anchored="0"> -<cand r="1" s="14.7662" n="spanTierMemoPath" id="src/ingest_astquery.h::rw::spanTierMemoPath" k="fn" p="src/ingest_astquery.h" l="1588"> +<cand r="1" s="14.7673" n="spanTierMemoPath" id="src/ingest_astquery.h::rw::spanTierMemoPath" k="fn" p="src/ingest_astquery.h" l="1588"> <sig>inline std::string spanTierMemoPath( const std::string& diskPath )</sig> </cand> -<cand r="2" s="9.38714" n="legoImplementorsOnSurface" id="src/serialize.h::rw::legoImplementorsOnSurface" k="fn" p="src/serialize.h" l="10321"> +<cand r="2" s="9.38773" n="legoImplementorsOnSurface" id="src/serialize.h::rw::legoImplementorsOnSurface" k="fn" p="src/serialize.h" l="10321"> <sig>inline std::vector<std::vector<NodeId>> legoImplementorsOnSurface( const IngestResult& ing, const std::vector<std::vector<NodeId>>& implementors, const std::vector<NodeId>& surfaceIds )</sig> </cand> -<cand r="3" s="8.12141" n="See the map — not just the numbers" id="README.md::Rip'n Fast. Fewer Tokens. Better Code.::See the map — not just the numbers" k="sec" p="README.md" l="426"> +<cand r="3" s="8.12199" n="See the map — not just the numbers" id="README.md::Rip'n Fast. Fewer Tokens. Better Code.::See the map — not just the numbers" k="sec" p="README.md" l="426"> <sig>### See the map — not just the numbers</sig> </cand> -<cand r="4" s="7.13298" n="receiptNextFor" id="src/mcpedit.h::mcpedit::receiptNextFor" k="fn" p="src/mcpedit.h" l="1103"> +<cand r="4" s="7.13312" n="receiptNextFor" id="src/mcpedit.h::mcpedit::receiptNextFor" k="fn" p="src/mcpedit.h" l="1103"> <sig>inline std::string receiptNextFor( const std::string& fileIdentity, const std::string& symbolName, const std::string& foldJson, const std::string& firstTestRun )</sig> </cand> -<cand r="5" s="6.95707" n="AncestorCacheScope" id="src/infra/tsparent.h::AncestorCacheScope::AncestorCacheScope" k="fn" p="src/infra/tsparent.h" l="177"> +<cand r="5" s="6.95808" n="AncestorCacheScope" id="src/infra/tsparent.h::AncestorCacheScope::AncestorCacheScope" k="fn" p="src/infra/tsparent.h" l="177"> <sig>AncestorCacheScope( TSNode root, bool enabled ) : previous( tAncestorCache )</sig> </cand> </candidates> @@ -3862,12 +3923,12 @@ ripwire: --json is not yet supported for --hotspots — supported: the default m *Pagination: 3 items, skipping the first 3 (deterministic seams).* -**wall time: 1.39s** +**wall time: 1.93s** ````` <!-- ripwire hotspots schema=ripwire.hotspots/v1: maintenance pain = churn x ccx over window=: <f p= churn= ccx= score= top= top_ccx= top_l=>; unranked_*= no churn/complexity. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). at=: commit+dirty+shallow. root=: p= relative to it. files=/ranked=: files in the window / those with both churn and complexity; ranked + unranked_no_churn + unranked_no_complexity = files. unranked_no_churn=/unranked_no_complexity=: files left out for no commit in window= / no measured complexity. --> <!-- extent_suspect_syms=K on a row = K of the file's functions failed an extent/scope containment check (the map, the bundles and the skipped verb mark each one, reasons and all) and are LEFT OUT of that row's ccx=, score= and top=, so its ccx= is a FLOOR of the file's true sum rather than a total. unranked_extent_suspect= counts files with commits whose every scorable function was left out that way (or whose trusted remainder scores 0), so ranked= + unranked_no_churn= + unranked_no_complexity= + unranked_extent_suspect= = files= exactly. Absent = nothing excluded. --> -<hotspots schema="ripwire.hotspots/v1" window="12mo@HEAD" files="4852" ranked="1122" unranked_no_churn="0" unranked_no_complexity="3728" unranked_extent_suspect="2" shown="3" capped="1" total="1122" has_more="1" next_offset="6" offset="3" limit="3" root="." at="914c4045d"> +<hotspots schema="ripwire.hotspots/v1" window="12mo@HEAD" files="4852" ranked="1122" unranked_no_churn="0" unranked_no_complexity="3728" unranked_extent_suspect="2" shown="3" capped="1" total="1122" has_more="1" next_offset="6" offset="3" limit="3" root="." at="147c73293"> <f p="src/mcpverbs.h" churn="676" ccx="1369" score="925444" top="runBatchSub" top_ccx="142" top_l="6335"/> <f p="src/main.cpp" churn="514" ccx="1372" score="705208" top="dispatchMainBody" top_ccx="513" top_l="4711"/> <f p="src/verbs_for.h" churn="422" ccx="1358" score="573076" top="runForLensPass" top_ccx="706" top_l="3606"/> @@ -3960,7 +4021,7 @@ 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: 1.15s** +**wall time: 1.06s** ````` <!-- ripwire map-diff schema=ripwire.map-diff/v1: the ranked map anchored at at=: what the diff touched, the map's row vocabulary. est_tokens=: price as emitted (an upper bound under compact). at=: commit+dirty+shallow. root=: p= relative to it. pr_iters=N: PageRank iterations. 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. 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). changed=K: K indexed git-changed files seed the PageRank teleport (0: uniform, incl. no git). 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. sc=: enclosing scope; the full id is p::sc::n (p= of the row or its <f>) 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. --> @@ -3968,7 +4029,7 @@ stderr: <!-- t=type|alias|functype=a-Go-named-type-by-its-written-form:type=a-defined-type-whose-WRITTEN-form-is-not-a-struct/iface/func-literal(type-N-string;type-W-Pair-too,whatever-Pair-is-underneath),alias=type-A=B,functype=type-F-func(...) --> <!-- t=alias|functype-in-C++-and-.h:alias=using-X=Y(also-templated-or-class-scope)or-namespace-L=lib(defs=X-prints-its-written-target-as-to=),functype=a-typedef-of-a-function-or-function-pointer-type(typedef-void(*F)(int));other-typedefs-read-t=struct --> <!-- files=4852 symbols=45031 edges=45381 shown=5 est_tokens=1322 ambiguous=3984 unresolved=20100 locality_pinned=14 external=12460 declined=45307 extent_suspect_syms=12 macro_blanked_files=7 changed=0 skipped_oversize=15 unindexed="txt:85,tsv:54,mod:33,xml:33,jsonl:26,scm:25" unindexed_exts=23 order=important-first --> -<r schema="ripwire.map-diff/v1" at="914c4045d" root="." est_tokens="1322" pr_iters="37"> +<r schema="ripwire.map-diff/v1" at="147c73293" root="." est_tokens="1322" pr_iters="37"> <f p="src/infra/nodekind.h" layer="infra"> <s t="fn" n="kindIs" sc="rw" k="0.0032"> </s> @@ -4003,7 +4064,7 @@ stderr: *Force a cold parse (bypass the warm TMPDIR cache) — shows the cold-vs-warm cost.* -**wall time: 2.41s** +**wall time: 2.38s** ````` <!-- ripwire map schema=ripwire.map/v1: ranked symbol map: <f p= layer=> groups <s t= n= sc= k= amb=> rows (k= rank), <c n=> resolved callees; the header comment is data. est_tokens=: price as emitted (an upper bound under compact). root=: p= relative to it. pr_iters=N: PageRank iterations. <inv listed= unlisted=>: files the ranked rows show / do not (sum = files=), each named or counted below. <entry p= n=>: 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. <ls p= n= f=>: 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 <c> 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. sc=: enclosing scope; the full id is p::sc::n (p= of the row or its <f>) and selectors take it. --> @@ -4043,7 +4104,7 @@ stderr: *Explicit incremental cache at a path OUTSIDE the repo (first call writes it).* -**wall time: 2.61s** +**wall time: 2.76s** ````` <!-- ripwire map schema=ripwire.map/v1: ranked symbol map: <f p= layer=> groups <s t= n= sc= k= amb=> rows (k= rank), <c n=> resolved callees; the header comment is data. est_tokens=: price as emitted (an upper bound under compact). root=: p= relative to it. pr_iters=N: PageRank iterations. <inv listed= unlisted=>: files the ranked rows show / do not (sum = files=), each named or counted below. <entry p= n=>: 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. <ls p= n= f=>: 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 <c> 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. sc=: enclosing scope; the full id is p::sc::n (p= of the row or its <f>) and selectors take it. --> @@ -4079,6 +4140,12 @@ stderr: … [82 more display lines; full output is 10210 bytes on 1 raw line(s)] ````` +stderr: + +````` +ripwire: cache <tmp>: over its 2048 MiB budget — evicted 10 blob(s) of other roots or other ripwire builds (this build's blobs for this root are kept) +````` + Artifact written: ````` @@ -4143,7 +4210,7 @@ ripwire: --scip=does_not_exist.scip: cannot open the index — refusing rather t *Multi-root workspace: ONE merged graph over two roots, paths labeled <root>/<rel>.* -**wall time: 2.44s** +**wall time: 3.27s** ````` <!-- ripwire map schema=ripwire.map/v1: ranked symbol map: <f p= layer=> groups <s t= n= sc= k= amb=> rows (k= rank), <c n=> resolved callees; the header comment is data. est_tokens=: price as emitted (an upper bound under compact). <root label= p=>: a workspace root; label= prefixes every p=/id=. pr_iters=N: PageRank iterations. 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. 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). roots=N: N workspace roots. 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. sc=: enclosing scope; the full id is p::sc::n (p= of the row or its <f>) and selectors take it. --> @@ -4182,7 +4249,7 @@ ripwire: --scip=does_not_exist.scip: cannot open the index — refusing rather t *Self-eval: co-change recall vs BM25.* -**wall time: 23.05s** +**wall time: 21.89s** ````` ripwire --eval (co-change recovery, averaged over 80 historical commits) @@ -4210,7 +4277,7 @@ ripwire --eval (co-change recovery, averaged over 80 historical commits) *Known-item retrieval eval: MRR + recall@k per ranker per query mode.* -**wall time: 246.88s** +**wall time: 240.15s** ````` ripwire --eval-retrieval (known-item, 4000 doc-commented symbols; gold is in-corpus by construction) @@ -4239,7 +4306,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: 12.84s** +**exit code: 3** — **wall time: 7.44s** Input file: @@ -4355,7 +4422,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.110+g914c4045d (dev, AppleClang 21.0.0.21000101, emit=std::print, built_from=914c4045d) +ripwire 0.6.10-dev.113+g147c73293 (dev, AppleClang 21.0.0.21000101, emit=std::print, built_from=147c73293) ````` @@ -4468,11 +4535,11 @@ ripwire: --verify claim not recognized: 'frobnicate(x)' — unknown shape word. *Bare --slice=SYM: the INVENTORY of sliceable locals (<v n= l= t=/>), so a caller can pick VAR.* -**wall time: 1.08s** +**wall time: 1.14s** ````` <!-- ripwire slice schema=ripwire.slice/v1: name-based def-use rows of one variable in one definition: <s l= k=def|use|both|scope t= [b= pp= rd=]> (rd= reaching-def lines per reach=cfg|linear), <v n= l= t=> inventory; steps=/depth= flow. at=: commit+dirty+shallow. root=: p= relative to it. sym=/lang=: the sliced definition's name and language; p= is its file:line. vars=N: sliceable local bindings in the definition, one v row each; name one to slice it. counts=as-classified: defs=/uses=/vars=/steps= count what the name classifier rowed; neither floors nor totals. --> -<slice sym="rankGraphTeleport" p="src/graph.h:14921" t="fn" lang="cpp" schema="ripwire.slice/v1" vars="14" at="914c4045d" root="." counts="as-classified"> +<slice sym="rankGraphTeleport" p="src/graph.h:14921" t="fn" lang="cpp" schema="ripwire.slice/v1" vars="14" at="147c73293" root="." counts="as-classified"> <v n="alpha" l="14921" t="param"/> <v n="g" l="14921" t="param"/> <v n="p" l="14921" t="param"/> @@ -4494,11 +4561,9 @@ ripwire: --verify claim not recognized: 'frobnicate(x)' — unknown shape word. *Intra-procedural def-use slice of ONE variable: one <s> row per line touching it, k=def|use|both, reaching definitions flow-sensitive (reach=cfg).* -**wall time: 1.24s** - ````` <!-- ripwire slice schema=ripwire.slice/v1: name-based def-use rows of one variable in one definition: <s l= k=def|use|both|scope t= [b= pp= rd=]> (rd= reaching-def lines per reach=cfg|linear), <v n= l= t=> inventory; steps=/depth= flow. at=: commit+dirty+shallow. root=: p= relative to it. sym=/lang=: the sliced definition's name and language; p= is its file:line. order=defuse: seed s rows (no v=) ranked among these rows by def-use coverage (distinct local names on the line) desc, then line; not source order, not a whole-function ranking (measured at chance — docs/EVALS.md) — flow s rows (v=) keep their (d=,l=,v=) order. counts=as-classified: defs=/uses=/vars=/steps= count what the name classifier rowed; neither floors nor totals. --> -<slice sym="rankGraphTeleport" p="src/graph.h:14921" t="fn" lang="cpp" schema="ripwire.slice/v1" var="teleport" defs="1" uses="3" reach="cfg" order="defuse" at="914c4045d" root="." counts="as-classified"> +<slice sym="rankGraphTeleport" p="src/graph.h:14921" t="fn" lang="cpp" schema="ripwire.slice/v1" var="teleport" defs="1" uses="3" reach="cfg" order="defuse" at="147c73293" root="." counts="as-classified"> <s l="14944" k="use" t="call-arg" rd="14926"> <![CDATA[run = pageRankDouble( g.inEdges, g.wOutDeg, teleport, rankDouble, PageRankConfig{ .alpha = double( alpha ) } );]]> </s> @@ -4518,11 +4583,9 @@ 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.48s** - ````` <!-- ripwire slice schema=ripwire.slice/v1: name-based def-use rows of one variable in one definition: <s l= k=def|use|both|scope t= [b= pp= rd=]> (rd= reaching-def lines per reach=cfg|linear), <v n= l= t=> inventory; steps=/depth= flow. at=: commit+dirty+shallow. root=: p= relative to it. sym=/lang=: the sliced definition's name and language; p= is its file:line. order=defuse: seed s rows (no v=) ranked among these rows by def-use coverage (distinct local names on the line) desc, then line; not source order, not a whole-function ranking (measured at chance — docs/EVALS.md) — flow s rows (v=) keep their (d=,l=,v=) order. counts=as-classified: defs=/uses=/vars=/steps= count what the name classifier rowed; neither floors nor totals. --> -<slice sym="rankGraphTeleport" p="src/graph.h:14921" t="fn" lang="cpp" schema="ripwire.slice/v1" var="teleport" defs="1" uses="3" reach="cfg" flow="back" depth="3" steps="3" order="defuse" at="914c4045d" root="." counts="as-classified"> +<slice sym="rankGraphTeleport" p="src/graph.h:14921" t="fn" lang="cpp" schema="ripwire.slice/v1" var="teleport" defs="1" uses="3" reach="cfg" flow="back" depth="3" steps="3" order="defuse" at="147c73293" root="." counts="as-classified"> <s l="14944" k="use" t="call-arg" rd="14926"> <![CDATA[run = pageRankDouble( g.inEdges, g.wOutDeg, teleport, rankDouble, PageRankConfig{ .alpha = double( alpha ) } );]]> </s> @@ -4551,11 +4614,9 @@ 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.23s** - ````` <!-- ripwire slice schema=ripwire.slice/v1: name-based def-use rows of one variable in one definition: <s l= k=def|use|both|scope t= [b= pp= rd=]> (rd= reaching-def lines per reach=cfg|linear), <v n= l= t=> inventory; steps=/depth= flow. at=: commit+dirty+shallow. root=: p= relative to it. sym=/lang=: the sliced definition's name and language; p= is its file:line. order=defuse: seed s rows (no v=) ranked among these rows by def-use coverage (distinct local names on the line) desc, then line; not source order, not a whole-function ranking (measured at chance — docs/EVALS.md) — flow s rows (v=) keep their (d=,l=,v=) order. counts=as-classified: defs=/uses=/vars=/steps= count what the name classifier rowed; neither floors nor totals. --> -<slice sym="rankGraphTeleport" p="src/graph.h:14921" t="fn" lang="cpp" schema="ripwire.slice/v1" var="teleport" defs="1" uses="3" reach="cfg" flow="fwd" depth="8" steps="7" order="defuse" at="914c4045d" root="." counts="as-classified"> +<slice sym="rankGraphTeleport" p="src/graph.h:14921" t="fn" lang="cpp" schema="ripwire.slice/v1" var="teleport" defs="1" uses="3" reach="cfg" flow="fwd" depth="8" steps="7" order="defuse" at="147c73293" root="." counts="as-classified"> <s l="14944" k="use" t="call-arg" rd="14926"> <![CDATA[run = pageRankDouble( g.inEdges, g.wOutDeg, teleport, rankDouble, PageRankConfig{ .alpha = double( alpha ) } );]]> </s> @@ -4628,11 +4689,11 @@ 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.11s** +**wall time: 1.25s** ````` <!-- ripwire slice schema=ripwire.slice/v1: name-based def-use rows of one variable in one definition: <s l= k=def|use|both|scope t= [b= pp= rd=]> (rd= reaching-def lines per reach=cfg|linear), <v n= l= t=> inventory; steps=/depth= flow. at=: commit+dirty+shallow. root=: p= relative to it. sym=/lang=: the sliced definition's name and language; p= is its file:line. order=defuse: seed s rows (no v=) ranked among these rows by def-use coverage (distinct local names on the line) desc, then line; not source order, not a whole-function ranking (measured at chance — docs/EVALS.md) — flow s rows (v=) keep their (d=,l=,v=) order. counts=as-classified: defs=/uses=/vars=/steps= count what the name classifier rowed; neither floors nor totals. --> -<slice sym="rankGraphTeleport" p="src/graph.h:14921" t="fn" lang="cpp" schema="ripwire.slice/v1" var="teleport" defs="1" uses="3" reach="cfg" order="defuse" at="914c4045d" root="." counts="as-classified"> +<slice sym="rankGraphTeleport" p="src/graph.h:14921" t="fn" lang="cpp" schema="ripwire.slice/v1" var="teleport" defs="1" uses="3" reach="cfg" order="defuse" at="147c73293" root="." counts="as-classified"> <s l="14944" k="use" t="call-arg" rd="14926"> <![CDATA[run = pageRankDouble( g.inEdges, g.wOutDeg, teleport, rankDouble, PageRankConfig{ .alpha = double( alpha ) } );]]> </s> @@ -4652,7 +4713,7 @@ 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: 2.26s** +**wall time: 1.23s** ````` <!-- ripwire pattern schema=ripwire.pattern/v1: structural pattern hits with their enclosing symbol. window: shown= capped= (capped=1 cut). hits_capped=1: hits= is a floor. root=: p= relative to it. q=: the pattern as given; grammars=/shapes=: grammars it resolved for and the node kind it became in each; unsupported=: families this verb never serves. eligible_files=/skipped_files=/of_files=: files scanned / served-language files it did not resolve for, never read / all indexed. m p= in=: the hit's file:line and its enclosing symbol; the text is the matched node. --> @@ -4665,7 +4726,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: 1.96s** +**wall time: 1.40s** ````` <!-- ripwire pattern schema=ripwire.pattern/v1: structural pattern hits with their enclosing symbol. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). ellipsis_capped=: 1 = cut. hits_capped=1: hits= is a floor. root=: p= relative to it. q=: the pattern as given; grammars=/shapes=: grammars it resolved for and the node kind it became in each; unsupported=: families this verb never serves. eligible_files=/skipped_files=/of_files=: files scanned / served-language files it did not resolve for, never read / all indexed. ellipsis=first-match: one first-match-wins probe, not exhaustive; ellipsis_bound= its sibling cap; ellipsis_skipped= nodes abandoned over it (a floor). m p= in=: the hit's file:line and its enclosing symbol; the text is the matched node. --> @@ -4965,10 +5026,10 @@ ripwire: --grep given twice; did you mean --grep='A' --and='B'? *The --for compact legend (ripwire.for/v1) — every data/completeness attribute kept.* -**wall time: 1.89s** +**wall time: 1.30s** ````` -<ctx task="tree-sitter parse of a source file" route="subtoken+body" root="." confidence="low" margin_pct="0" at="914c4045d" doc_mentions="1" schema="ripwire.for/v1" bundle="compact" bodies="0" reason="compact-route" budget_bytes="7500" est_tokens="10042"> +<ctx task="tree-sitter parse of a source file" route="subtoken+body" root="." confidence="low" margin_pct="0" at="147c73293" doc_mentions="1" schema="ripwire.for/v1" bundle="compact" bodies="0" reason="compact-route" budget_bytes="7500" est_tokens="10042"> <!-- ripwire for schema=ripwire.for/v1: bundle=/bodies=/reason= the body posture; d: cx= ccx= complexity, in= callers (absent cx/ccx/in = 0), churn= amp= change, clone= tested= 1, sc= scope, id=p::sc::n; total= shown= capped=1 if cut; task= the query; d pure=1 const/constexpr sig, next= the follow-up to paste; d same_as=N: doc+sig text as row n=N (not repeated); route= name-exact(X)|subtoken+body[:broad|:declined]; confidence=/margin_pct= head score drop (low=flat); h l= p= n=, c n= l= p= (p= if not h's; same-named joined, shown= counts them), noedge= no callee resolved; fold kind=bodies: b t= n= p= l= top ranked rows' whole bodies, not the answer; served= of total= in budget_bytes=; slice/skip p= n= l=; skip bytes= next=; a skip makes sigs next= it, sigs_next= the signatures-only re-call; d mem= an owner's direct member names only, by the index (question words first, then owner's file, path, line, name), mem_more= names cut; t p= file outside sigs (weaker), t sym= its top symbols not in sigs/syms (a pointer, not the answer), r= rank (gap = trimmed); t order: code files first, then doc files (a code question); t page rows go on to file-page row 160 (code question: 160 code rows, docs within row 160); past page 0 (code question: past 40 code rows, a doc past row 40) listed last, head files skipped; past 120 of those p= only, p_only= counts them; t folded=class=N: N p= only rows of that class (doc|config|script|testdata|other) not listed, next= pages to them; d e= its last line (absent=unknown, never 0; l= the name's line) [doc mentions: 1 doc, 1 symbol; doc_mentions=] --> <!-- root= is the crawl root; p= below is RELATIVE to it (single-root only; absent => p= is ingest's own path, unchanged); at=this commit(+dirty). [budget_bytes= is the default BYTE target this ranked payload was shaped toward: row text shortens toward it, no row of the ranked head is removed for it (sigs past_target=)] [sigs capped=1 with shown=total: rows shrunk, none dropped] [sigs past_target=K: the last K rows are past the budget_bytes target, served because they are rows of the ranked head; none is cut] [sigs next=: one call serving all total= rows uncut] [docs_dropped=N: N shown rows have a doc comment not printed (r>24 always, r5..24 if capped)] [files_first=N: N rows moved so r=1..8 are distinct files' best rows, score order, a repeated name once; same rows; fold, hops keep score order]; lego/compose collapse to a counted stub by default (a disclosed cut): total= that section's own pre-cap row count, shown="0" capped="1" (nothing rendered here), next= names the sections=lego,compose flag that restores both sections byte-identically in one call est_tokens= prices this bundle in tokens --> <sigs shown="40" total="40" capped="1" past_target="7" docs_dropped="24" files_first="7" next="--for='tree-sitter parse of a source file' --signatures-only --token-budget=5400"> @@ -5005,10 +5066,10 @@ ripwire: --grep given twice; did you mean --grep='A' --and='B'? *Restore the <lego>/<compose> sections the --for bundle collapses to a counted stub by default (this is the stub's own next= spelling).* -**wall time: 3.42s** +**wall time: 2.10s** ````` -<ctx task="tree-sitter parse of a source file" route="subtoken+body" root="." confidence="low" margin_pct="0" at="914c4045d" doc_mentions="1" schema="ripwire.for/v1" bundle="compact" bodies="0" reason="compact-route" budget_bytes="7500" est_tokens="10590"> +<ctx task="tree-sitter parse of a source file" route="subtoken+body" root="." confidence="low" margin_pct="0" at="147c73293" doc_mentions="1" schema="ripwire.for/v1" bundle="compact" bodies="0" reason="compact-route" budget_bytes="7500" est_tokens="10590"> <!-- ripwire for schema=ripwire.for/v1: bundle=/bodies=/reason= the body posture; d: cx= ccx= complexity, in= callers (absent cx/ccx/in = 0), churn= amp= change, clone= tested= 1, sc= scope, id=p::sc::n; total= shown= capped=1 if cut; task= the query; d pure=1 const/constexpr sig, next= the follow-up to paste; d same_as=N: doc+sig text as row n=N (not repeated); route= name-exact(X)|subtoken+body[:broad|:declined]; confidence=/margin_pct= head score drop (low=flat); h l= p= n=, c n= l= p= (p= if not h's; same-named joined, shown= counts them), noedge= no callee resolved; fold kind=bodies: b t= n= p= l= top ranked rows' whole bodies, not the answer; served= of total= in budget_bytes=; slice/skip p= n= l=; skip bytes= next=; a skip makes sigs next= it, sigs_next= the signatures-only re-call; d mem= an owner's direct member names only, by the index (question words first, then owner's file, path, line, name), mem_more= names cut; t p= file outside sigs (weaker), t sym= its top symbols not in sigs/syms (a pointer, not the answer), r= rank (gap = trimmed); t order: code files first, then doc files (a code question); t page rows go on to file-page row 160 (code question: 160 code rows, docs within row 160); past page 0 (code question: past 40 code rows, a doc past row 40) listed last, head files skipped; past 120 of those p= only, p_only= counts them; t folded=class=N: N p= only rows of that class (doc|config|script|testdata|other) not listed, next= pages to them; field name= type= owner= rel=: a member of owner=, rel=creates held by value, uses by reference/pointer; iface implementors=N: types implementing it, m= its method contract; d e= its last line (absent=unknown, never 0; l= the name's line) [doc mentions: 1 doc, 1 symbol; doc_mentions=] --> <!-- root= is the crawl root; p= below is RELATIVE to it (single-root only; absent => p= is ingest's own path, unchanged); at=this commit(+dirty). [budget_bytes= is the default BYTE target this ranked payload was shaped toward: row text shortens toward it, no row of the ranked head is removed for it (sigs past_target=)] [sigs capped=1 with shown=total: rows shrunk, none dropped] [sigs past_target=K: the last K rows are past the budget_bytes target, served because they are rows of the ranked head; none is cut] [sigs next=: one call serving all total= rows uncut] [docs_dropped=N: N shown rows have a doc comment not printed (r>24 always, r5..24 if capped)] [files_first=N: N rows moved so r=1..8 are distinct files' best rows, score order, a repeated name once; same rows; fold, hops keep score order]; iface implementors=N counts every type an extends/implements clause binds to it (the lego verb's count), never the rows listed: shown_implementors=K only K impl rows here (implementors_capped=1), implementors_next= lists all; implementors_floor=1 an extends clause spelled like it bound nowhere, so N may be short (not proof of another), floor_next= lists every extends site est_tokens= prices this bundle in tokens --> <sigs shown="40" total="40" capped="1" past_target="7" docs_dropped="24" files_first="7" next="--for='tree-sitter parse of a source file' --signatures-only --token-budget=5400"> @@ -5045,10 +5106,10 @@ ripwire: --grep given twice; did you mean --grep='A' --and='B'? *Opt OUT of compact conceptual serving: restore the rank-first auto <bodies> walk (bundle="auto").* -**wall time: 3.52s** +**wall time: 1.39s** ````` -<ctx task="tree-sitter parse of a source file" route="subtoken+body" root="." confidence="low" margin_pct="0" at="914c4045d" doc_mentions="1" schema="ripwire.for/v1" bundle="auto" bodies="5" budget_bytes="7500" est_tokens="10293"> +<ctx task="tree-sitter parse of a source file" route="subtoken+body" root="." confidence="low" margin_pct="0" at="147c73293" doc_mentions="1" schema="ripwire.for/v1" bundle="auto" bodies="5" budget_bytes="7500" est_tokens="10293"> <!-- ripwire for schema=ripwire.for/v1: bundle=/bodies=/reason= the body posture; d: cx= ccx= complexity, in= callers (absent cx/ccx/in = 0), churn= amp= change, clone= tested= 1, sc= scope, id=p::sc::n; total= shown= capped=1 if cut; task= the query; d pure=1 const/constexpr sig, next= the follow-up to paste; d same_as=N: doc+sig text as row n=N (not repeated); route= name-exact(X)|subtoken+body[:broad|:declined]; confidence=/margin_pct= head score drop (low=flat); b t= n= p= l= full bodies, c n= l= p= callee signatures (p= if not b's); t p= file outside sigs (weaker), t sym= its top symbols not in sigs/syms (a pointer, not the answer), r= rank (gap = trimmed); t order: code files first, then doc files (a code question); t page rows go on to file-page row 160 (code question: 160 code rows, docs within row 160); past page 0 (code question: past 40 code rows, a doc past row 40) listed last, head files skipped; past 120 of those p= only, p_only= counts them; t folded=class=N: N p= only rows of that class (doc|config|script|testdata|other) not listed, next= pages to them; d e= its last line (absent=unknown, never 0; l= the name's line) [doc mentions: 1 doc, 1 symbol; doc_mentions=] --> <!-- root= is the crawl root; p= below is RELATIVE to it (single-root only; absent => p= is ingest's own path, unchanged); at=this commit(+dirty). [budget_bytes= is the default BYTE target this ranked payload was shaped toward: row text shortens toward it, no row of the ranked head is removed for it (sigs past_target=)] [sigs capped=1 with shown=total: rows shrunk, none dropped] [sigs past_target=K: the last K rows are past the budget_bytes target, served because they are rows of the ranked head; none is cut] [sigs next=: one call serving all total= rows uncut] [docs_dropped=N: N shown rows have a doc comment not printed (r>24 always, r5..24 if capped)] [files_first=N: N rows moved so r=1..8 are distinct files' best rows, score order, a repeated name once; same rows; fold, hops keep score order]; lego/compose collapse to a counted stub by default (a disclosed cut): total= that section's own pre-cap row count, shown="0" capped="1" (nothing rendered here), next= names the sections=lego,compose flag that restores both sections byte-identically in one call est_tokens= prices this bundle in tokens --> <sigs shown="40" total="40" capped="1" past_target="7" docs_dropped="24" files_first="7" next="--for='tree-sitter parse of a source file' --signatures-only --token-budget=5400"> @@ -5085,10 +5146,10 @@ ripwire: --grep given twice; did you mean --grep='A' --and='B'? *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: 2.57s** +**wall time: 1.65s** ````` -<ctx task="quality delta acks ledger rubber stamp" route="subtoken+body" root="." confidence="low" margin_pct="0" at="914c4045d" doc_mentions="1" schema="ripwire.for/v1" bundle="compact" bodies="0" reason="compact-route" budget_bytes="7500" est_tokens="11969"> +<ctx task="quality delta acks ledger rubber stamp" route="subtoken+body" root="." confidence="low" margin_pct="0" at="147c73293" doc_mentions="1" schema="ripwire.for/v1" bundle="compact" bodies="0" reason="compact-route" budget_bytes="7500" est_tokens="11969"> <!-- ripwire for schema=ripwire.for/v1: bundle=/bodies=/reason= the body posture; d: cx= ccx= complexity, in= callers (absent cx/ccx/in = 0), churn= amp= change, clone= tested= 1, sc= scope, id=p::sc::n; total= shown= capped=1 if cut; task= the query; d pure=1 const/constexpr sig, next= the follow-up to paste; route= name-exact(X)|subtoken+body[:broad|:declined]; confidence=/margin_pct= head score drop (low=flat); h l= p= n=, c n= l= p= (p= if not h's; same-named joined, shown= counts them), noedge= no callee resolved; h calls capped=1 next= the call listing every callee; fold kind=bodies: b t= n= p= l= top ranked rows' whole bodies, not the answer; served= of total= in budget_bytes=; slice/skip p= n= l=; skip bytes= next=; a skip makes sigs next= it, sigs_next= the signatures-only re-call; d mem= an owner's direct member names only, by the index (question words first, then owner's file, path, line, name), mem_more= names cut; t p= file outside sigs (weaker), t sym= its top symbols not in sigs/syms (a pointer, not the answer), r= rank (gap = trimmed); t order: code files first, then doc files (a code question); t page rows go on to file-page row 160 (code question: 160 code rows, docs within row 160); past page 0 (code question: past 40 code rows, a doc past row 40) listed last, head files skipped; past 120 of those p= only, p_only= counts them; t folded=class=N: N p= only rows of that class (doc|config|script|testdata|other) not listed, next= pages to them; d e= its last line (absent=unknown, never 0; l= the name's line); c prov=split: a resolver split arm; may be another arm's (NOT a claim the edge is false) [doc mentions: 1 doc, 1 symbol; doc_mentions=] --> <!-- root= is the crawl root; p= below is RELATIVE to it (single-root only; absent => p= is ingest's own path, unchanged); at=this commit(+dirty). [budget_bytes= is the default BYTE target this ranked payload was shaped toward: row text shortens toward it, no row of the ranked head is removed for it (sigs past_target=)] [sigs capped=1 with shown=total: rows shrunk, none dropped] [sigs past_target=K: the last K rows are past the budget_bytes target, served because they are rows of the ranked head; none is cut] [sigs sigs_next=: one call serving all total= rows uncut] [docs_dropped=N: N shown rows have a doc comment not printed (r>24 always, r5..24 if capped)] [files_first=N: N rows moved so r=1..8 are distinct files' best rows, score order, a repeated name once; same rows; fold, hops keep score order]; lego/compose collapse to a counted stub by default (a disclosed cut): total= that section's own pre-cap row count, shown="0" capped="1" (nothing rendered here), next= names the sections=lego,compose flag that restores both sections byte-identically in one call est_tokens= prices this bundle in tokens --> <sigs shown="40" total="40" capped="1" past_target="13" docs_dropped="27" files_first="38" sigs_next="--for='quality delta acks ledger rubber stamp' --signatures-only --token-budget=6400" next="--expand=src/verbs_quality.h:2776:refuseUnmatchedAckOnly"> @@ -5118,7 +5179,7 @@ ripwire: --grep given twice; did you mean --grep='A' --and='B'? <d l="3320" e="3336" n="qdStaleFold" p="src/verbs_quality.h" cx="7" ccx="4" in="1" churn="209" amp="312" r="19">std::optional<QdStaleFold> qdStaleFold( const QdReport& rep, const Escape& ex )</d> <t p="src/quality.h" sym="IdentityHealing" r="20"/> <t p="src/verbs_quality.h" sym="emitQdVerdict" r="21"/> -… [410 more display lines; full output is 41503 bytes on 132 raw line(s)] +… [413 more display lines; full output is 41657 bytes on 135 raw line(s)] ````` stderr: @@ -5131,10 +5192,10 @@ ripwire: redacted 1 secret from emitted context (keyword-gated-secret=1) — pas *The same task with doc-mention surfacing OFF — the contrast the flag exists for (no [doc mentions] clause, one fewer row).* -**wall time: 2.18s** +**wall time: 1.28s** ````` -<ctx task="quality delta acks ledger rubber stamp" route="subtoken+body" root="." confidence="low" margin_pct="0" at="914c4045d" schema="ripwire.for/v1" bundle="compact" bodies="0" reason="compact-route" budget_bytes="7500" est_tokens="11923"> +<ctx task="quality delta acks ledger rubber stamp" route="subtoken+body" root="." confidence="low" margin_pct="0" at="147c73293" schema="ripwire.for/v1" bundle="compact" bodies="0" reason="compact-route" budget_bytes="7500" est_tokens="11923"> <!-- ripwire for schema=ripwire.for/v1: bundle=/bodies=/reason= the body posture; d: cx= ccx= complexity, in= callers (absent cx/ccx/in = 0), churn= amp= change, clone= tested= 1, sc= scope, id=p::sc::n; total= shown= capped=1 if cut; task= the query; d pure=1 const/constexpr sig, next= the follow-up to paste; route= name-exact(X)|subtoken+body[:broad|:declined]; confidence=/margin_pct= head score drop (low=flat); h l= p= n=, c n= l= p= (p= if not h's; same-named joined, shown= counts them), noedge= no callee resolved; h calls capped=1 next= the call listing every callee; fold kind=bodies: b t= n= p= l= top ranked rows' whole bodies, not the answer; served= of total= in budget_bytes=; slice/skip p= n= l=; skip bytes= next=; a skip makes sigs next= it, sigs_next= the signatures-only re-call; d mem= an owner's direct member names only, by the index (question words first, then owner's file, path, line, name), mem_more= names cut; t p= file outside sigs (weaker), t sym= its top symbols not in sigs/syms (a pointer, not the answer), r= rank (gap = trimmed); t order: code files first, then doc files (a code question); t page rows go on to file-page row 160 (code question: 160 code rows, docs within row 160); past page 0 (code question: past 40 code rows, a doc past row 40) listed last, head files skipped; past 120 of those p= only, p_only= counts them; t folded=class=N: N p= only rows of that class (doc|config|script|testdata|other) not listed, next= pages to them; d e= its last line (absent=unknown, never 0; l= the name's line); c prov=split: a resolver split arm; may be another arm's (NOT a claim the edge is false) --> <!-- root= is the crawl root; p= below is RELATIVE to it (single-root only; absent => p= is ingest's own path, unchanged); at=this commit(+dirty). [budget_bytes= is the default BYTE target this ranked payload was shaped toward: row text shortens toward it, no row of the ranked head is removed for it (sigs past_target=)] [sigs capped=1 with shown=total: rows shrunk, none dropped] [sigs past_target=K: the last K rows are past the budget_bytes target, served because they are rows of the ranked head; none is cut] [sigs sigs_next=: one call serving all total= rows uncut] [docs_dropped=N: N shown rows have a doc comment not printed (r>24 always, r5..24 if capped)] [files_first=N: N rows moved so r=1..8 are distinct files' best rows, score order, a repeated name once; same rows; fold, hops keep score order]; lego/compose collapse to a counted stub by default (a disclosed cut): total= that section's own pre-cap row count, shown="0" capped="1" (nothing rendered here), next= names the sections=lego,compose flag that restores both sections byte-identically in one call est_tokens= prices this bundle in tokens --> <sigs shown="40" total="40" capped="1" past_target="12" docs_dropped="27" files_first="38" sigs_next="--for='quality delta acks ledger rubber stamp' --signatures-only --no-doc-mention --token-budget=6300" next="--expand=src/verbs_quality.h:2776:refuseUnmatchedAckOnly"> @@ -5204,22 +5265,22 @@ ripwire: --safe-delete symbol not found: DoesNotExist (note: the lexical definit *The continuation packet for the NEXT session: <verified> disk truth (branch/sha, changed symbols, blast radius, tests) + <heuristic> labeled suggestions. Recorded against a CLEAN tree.* -**wall time: 5.64s** +**wall time: 3.08s** ````` <!-- ripwire handoff schema=ripwire.handoff/v1: continuation packet for the NEXT session: <verified changed= blast_files=>, <tests n=>, <heuristic n= candidates=>, <note>, <doc p=>. window: capped= (capped=1 cut). est_tokens=: price as emitted (an upper bound under compact). at=: commit+dirty+shallow. root=: p= relative to it. branch=/subject=: the checked out branch and HEAD commit subject; gitok=0: the git diff probe failed, changed counts are floors. cochange_window=/cochange_commits=: the git window the cochange rows were mined in and the commits it held (0: could not look). doc s=: lexical score of that plan/design doc for the branch+subject query. note target=/txt=: a committed notes row on this work (symbol id or path) and its text; a suggestion. --> -<handoff schema="ripwire.handoff/v1" at="914c4045d" root="." branch="integration/train-ge3" subject="showcase: the 11-20 capture stays main's; the train re-records once at its tip" gitok="1" est_tokens="889"> +<handoff schema="ripwire.handoff/v1" at="147c73293" root="." branch="integration/train-ge3" subject="showcase: the --compress demo expands collapseBlankLineRuns (compressBody is now a one-line pipeline)" gitok="1" est_tokens="883"> <verified changed="0" blast_files="0"> <tests n="0"> </tests> </verified> -<heuristic n="6" candidates="345" capped="1" cochange_window="18mo@HEAD" cochange_commits="8003"> +<heuristic n="6" candidates="349" capped="1" cochange_window="18mo@HEAD" cochange_commits="8006"> <note target="src/infra/Diagnostics.h" txt="ASSUME_NO_ALIAS is an optimizer fact in release (separate_storage) only where the compiler consumes it: clang 18+ by default, LLVM 17/AppleClang 16 via the CMake -mllvm flag (scalars only), GCC never (debug check only); never on two members of one object; … [line truncated: 57 more bytes on this line] <note target="test/manifestcheck.sh" txt="README.md's single '<N> gate scripts' claim (~line 1305) is NOT enforced — the derived-vs-stated sibling loop here covers docs/EVALS.md only. It drifted 407→451 unnoticed (fixed 2026-08-23). To close: grep both files ('file:line … [line truncated: 47 more bytes on this line] -<doc p="CHANGELOG.md" s="13.474"/> -<doc p="docs/EVALS.md" s="10.567"/> -<doc p="bench/locbench/results/r1cpp_anchorhop/GATE_DECISION_r1cpp.md" s="9.495"/> -<doc p="bench/locbench/results/vt2_pooling_freestat/FREESTAT.md" s="9.337"/> +<doc p="docs/COMMANDS.md" s="19.369"/> +<doc p="skills/ripwire-orient/compress-ladder.md" s="12.737"/> +<doc p="skills/CONSOLIDATION.md" s="11.351"/> +<doc p="skills/ripwire-orient/SKILL.md" s="9.292"/> </heuristic> </handoff> ````` @@ -5228,19 +5289,18 @@ 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: 5.03s** +**wall time: 2.78s** ````` -<!-- ripwire handoff schema=ripwire.handoff/v1: continuation packet for the NEXT session: <verified changed= blast_files=>, <tests n=>, <heuristic n= candidates=>, <note>, <doc p=>. window: capped= (capped=1 cut). est_tokens=: price as emitted (an upper bound under compact). over_ceiling=1: budget not met. withheld=: rows the budget cut. at=: commit+dirty+shallow. root=: p= relative to it. branch=/subject=: the checked out branch and HEAD commit subject; gitok=0: the git diff probe failed, changed counts are floors. cochange_window=/cochange_commits=: the git window the cochange rows were mined in and the commits it held (0: could not look). doc s=: lexical score of that plan/design doc for the branch+subject query. note target=/txt=: a committed notes row on this work (symbol id or path) and its text; a suggestion. budget=: the token-budget cap this packet was fitted to; est_tokens= prices what it delivers. withheld_rows=N: heuristic rows the budget dropped (withheld=1 says so); verified rows are never dropped. --> -<handoff schema="ripwire.handoff/v1" at="914c4045d" root="." branch="integration/train-ge3" subject="showcase: the 11-20 capture stays main's; the train re-records once at its tip" gitok="1" budget="1200" withheld="1" withheld_rows="3" est_tokens="944" over_ceiling="1"> +<!-- ripwire handoff schema=ripwire.handoff/v1: continuation packet for the NEXT session: <verified changed= blast_files=>, <tests n=>, <heuristic n= candidates=>, <note>, <doc p=>. window: capped= (capped=1 cut). est_tokens=: price as emitted (an upper bound under compact). withheld=: rows the budget cut. at=: commit+dirty+shallow. root=: p= relative to it. branch=/subject=: the checked out branch and HEAD commit subject; gitok=0: the git diff probe failed, changed counts are floors. cochange_window=/cochange_commits=: the git window the cochange rows were mined in and the commits it held (0: could not look). note target=/txt=: a committed notes row on this work (symbol id or path) and its text; a suggestion. budget=: the token-budget cap this packet was fitted to; est_tokens= prices what it delivers. withheld_rows=N: heuristic rows the budget dropped (withheld=1 says so); verified rows are never dropped. --> +<handoff schema="ripwire.handoff/v1" at="147c73293" root="." branch="integration/train-ge3" subject="showcase: the --compress demo expands collapseBlankLineRuns (compressBody is now a one-line pipeline)" gitok="1" budget="1200" withheld="1" withheld_rows="4" est_tokens="886"> <verified changed="0" blast_files="0"> <tests n="0"> </tests> </verified> -<heuristic n="3" candidates="345" capped="1" cochange_window="18mo@HEAD" cochange_commits="8003"> +<heuristic n="2" candidates="349" capped="1" cochange_window="18mo@HEAD" cochange_commits="8006"> <note target="src/infra/Diagnostics.h" txt="ASSUME_NO_ALIAS is an optimizer fact in release (separate_storage) only where the compiler consumes it: clang 18+ by default, LLVM 17/AppleClang 16 via the CMake -mllvm flag (scalars only), GCC never (debug check only); never on two members of one object; … [line truncated: 57 more bytes on this line] <note target="test/manifestcheck.sh" txt="README.md's single '<N> gate scripts' claim (~line 1305) is NOT enforced — the derived-vs-stated sibling loop here covers docs/EVALS.md only. It drifted 407→451 unnoticed (fixed 2026-08-23). To close: grep both files ('file:line … [line truncated: 47 more bytes on this line] -<doc p="CHANGELOG.md" s="13.474"/> </heuristic> </handoff> ````` @@ -5287,8 +5347,6 @@ ripwire: --safe-delete symbol not found: DoesNotExist (note: the lexical definit *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.97s** - ````` <!-- ripwire map schema=ripwire.map/v1: ranked symbol map: <f p= layer=> groups <s t= n= sc= k= amb=> rows (k= rank), <c n=> resolved callees; the header comment is data. est_tokens=: price as emitted (an upper bound under compact). root=: p= relative to it. pr_iters=N: PageRank iterations. <inv listed= unlisted=>: files the ranked rows show / do not (sum = files=), each named or counted below. <entry p= n=>: 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. <ls p= n= f=>: 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 <c> 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. sc=: enclosing scope; the full id is p::sc::n (p= of the row or its <f>) and selectors take it. --> <!-- t=modscope=a-file's-MODULE-SCOPE(n=<file-scope>):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 --> @@ -5377,7 +5435,7 @@ ripwire: --no-stable is read only by --mcp/--listen (it opts out of the stable o <ctx schema="ripwire.from-trace/v1" task="run-trace: cat <scratch>/aux/asan_trace_now.txt; exit 1" next="--slice=@src/graph.h:14923" est_tokens="2727"> <!-- ripwire from-trace schema=ripwire.from-trace/v1: trace frames mapped to indexed symbols, innermost first; the innermost in-corpus body included. window: shown= total= capped= (capped=1 cut). est_tokens=: price as emitted (an upper bound under compact). <d r=N>: rank N in this ranking, rows in r= order. <d cx= ccx=>: cyclomatic/cognitive complexity. <d in=N>: N callers in the index (absent: not measured). sc=: enclosing scope; the full id is p::sc::n (p= of the row or its <f>) and selectors take it. next=: the one pasteable follow-up. task=: the trace source this bundle maps, verbatim (a file path, stdin, or an MCP label). src=/format=: the trace read and its dominant frame format, python|asan|node|compiler|generic. frame_lines=/parsed=: frame-shaped input lines / those yielding a path:line; the rest matched no format. in_corpus=: parsed frames in indexed files; always suspects= + merged= + unresolved=. suspects=/merged=/unresolved=: frame rows / folded into a claimed symbol / unresolved rows (indexed file, no def). skipped=N: frames outside every root, listed as skipped rows, never ranked. rank=N: frame order, innermost in-corpus first; p= is the trace's own path:line, defs are sigs l=. resolved_by=name|line: bound by the frame's own name, else by the def enclosing its line. innermost=1: the innermost in-corpus frame (rank 1); its full body is served. run exit=: the command's OWN exit code; signal=: the signal that killed it; timed_out=1: the timeout_s= cap did. run duration_ms=: wall clock, MEASURED, not deterministic; timeout_s=: the cap it ran under. run lines=: non-empty captured lines; bytes=: the whole capture; dropped_bytes=: middle bytes the cap dropped. lines view=tail: the last shown= of total= output lines; view=relevant: shown= of relevant= error/frame-shaped ones. lines relevant=N: captured lines that are error-marked or frame-shaped; the relevant view picks from these. frame n= t=: the bound symbol's name and kind (fn|cls|...); d, b and c n=: a ranked row's, a body's, a callee's name. --> <!-- ledger: budget=7500 bytes (allowance 9583 bytes = ceiling + the single-entry overshoot a whole first signature costs) --> -<run exit="1" duration_ms="294" timeout_s="600" lines="9" bytes="606"/> +<run exit="1" duration_ms="94" timeout_s="600" lines="9" bytes="606"/> <lines view="relevant" shown="7" relevant="7" total="9"> <![CDATA[AddressSanitizer:DEADLYSIGNAL ==41337==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000018 (pc 0x000102f4a1c8 bp 0x00016d2f1a40 sp 0x00016d2f19e0 T0) @@ -5423,7 +5481,7 @@ ripwire: --no-stable is read only by --mcp/--listen (it opts out of the stable o ````` <ctx schema="ripwire.from-trace/v1" task="run-trace: true"> <!-- ripwire from-trace schema=ripwire.from-trace/v1: trace frames mapped to indexed symbols, innermost first; the innermost in-corpus body included. task=: the trace source this bundle maps, verbatim (a file path, stdin, or an MCP label). run exit=: the command's OWN exit code; signal=: the signal that killed it; timed_out=1: the timeout_s= cap did. run duration_ms=: wall clock, MEASURED, not deterministic; timeout_s=: the cap it ran under. run lines=: non-empty captured lines; bytes=: the whole capture; dropped_bytes=: middle bytes the cap dropped. --> -<run exit="0" duration_ms="137" timeout_s="600" lines="0" bytes="0"/> +<run exit="0" duration_ms="82" timeout_s="600" lines="0" bytes="0"/> </ctx> ````` @@ -5431,12 +5489,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.62s** +**exit code: 4** — **wall time: 2.25s** ````` <ctx schema="ripwire.from-trace/v1" task="run-trace: sleep 30"> <!-- ripwire from-trace schema=ripwire.from-trace/v1: trace frames mapped to indexed symbols, innermost first; the innermost in-corpus body included. task=: the trace source this bundle maps, verbatim (a file path, stdin, or an MCP label). run duration_ms=: wall clock, MEASURED, not deterministic; timeout_s=: the cap it ran under. run lines=: non-empty captured lines; bytes=: the whole capture; dropped_bytes=: middle bytes the cap dropped. run frames=0: the command FAILED but its output carried no mappable frame, so no bundle follows. --> -<run timed_out="1" signal="9" duration_ms="2003" timeout_s="2" lines="0" bytes="0" frames="0"/> +<run timed_out="1" signal="9" duration_ms="2001" timeout_s="2" lines="0" bytes="0" frames="0"/> </ctx> ````` @@ -5471,7 +5529,7 @@ 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: 9.50s** +**wall time: 5.90s** ````` <!-- ripwire quality-panel schema=ripwire.quality-panel/v1: every quality family in ONE report, ranked by distinct families fired: <s p= n= fam= of= fired= join=>; bar_*= thresholds. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). at=: commit+dirty+shallow. root=: p= relative to it. preset=: strict (5 stable families, cut 2), default (6, cut 2), lenient (6, cut 1); selects, never weights. families=6: evidence families: structural lexical confusion historical colocation state. enabled=/enabled_n=: the families this preset COUNTS, and how many. cut=N: distinct enabled families that must fire for a row to rank. cut_reachable=0: cut= exceeds the evaluable families (of=); a corpus fact, never a clean bill of health. eligible=N: functions/methods with a body; ranked= + below_cut= + no_family= = eligible=, always. ranked=N: rows that met the cut (total=); only shown= print, page with offset=. below_cut=N: fired at least one enabled family, but fewer than cut=. no_family=N: no enabled family fired; unavailable= families were never measured. bar_ccx=/bar_loc=/bar_nest=/bar_params=: absolute bars: cognitive complexity, lines, nesting, params. rcut=/rmeasured=: readability decile width (rrank= under it fires) / functions measured. hcut=/hranked=: file churn decile width / files with an in-window commit (hranked=0 voids historical). window=: the git churn window hrank= and churn= are counted over (RELATIVE to this corpus). ccut=/cranked=: colocation decile width / functions reading any outside definition (0 voids it). cfiles=/cscope=: files the confusion atom rules read / eligible symbols in them. lscope=N: symbols the lexical naming rules read. sfiles=/sscope=: files the state lens reads / symbols in them. cells=N: non-local mutable cells the state lens found. tested_scope=N: symbols an indexed test reaches; at 0 no row can carry join=deep+untested. deep_untested=N: rows carrying join=deep+untested across the WHOLE set, not just this page. e f=: the fired family this evidence row belongs to. counted=1: this preset counts the family toward fam=; 0 = fired, not counted. why=: the measurements that crossed (rule*N fired N times; hrank=/churn= are the file's, inherited). --> @@ -5585,7 +5643,7 @@ 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: 4.20s** +**wall time: 2.65s** ````` <!-- ripwire nonlocal-state schema=ripwire.nonlocal-state/v1: per function, the non-local MUTABLE state it reaches: <fn p= n= writes= reads=> over <cell n= p= dir= via=> rows. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). cells_capped=: 1 = cut. counts_floor=1: every count is a FLOOR, never a total. graph_ambiguous=/graph_unresolved=: resolver gauge. graph_unindexed=N: N files no grammar could read (the map header's unindexed=); their calls raise neither gauge. root=: p= relative to it. cells=N: mutable non-local cells found in the corpus (globals, statics, Python module globals; FLOOR). functions=N: functions reaching at least one cell, directly or via callees (all rows, before paging). direct_writes=/direct_reads=: the writes=/reads= cells this function's OWN body writes/reads. cells_total=N: distinct cells reached (read and written counts once); at most 12 cell rows print. at=/at_dir=: one own-body use site (may be more) and what own-body sites do (can be narrower than dir=). shown_cells=N: cell rows printed of cells_total= (cap 12); cells_capped=1 on the row is the cut. unanalyzed_langs=/unanalyzed_files=: indexed languages (and their files) this lens skips; NOT zero cells. --> @@ -5625,7 +5683,7 @@ 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.46s** +**wall time: 3.96s** ````` <!-- ripwire ensemble schema=ripwire.ensemble/v1: four orthogonal evidence families joined, ranked by DISTINCT families fired (no composite score): <s p= n= fam= of= fired=>. window: total= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). syms_capped=/files_capped=: 1 = cut. at=: commit+dirty+shallow. root=: p= relative to it. eligible=N: functions and methods with a body, the denominator; ranked + no_family = eligible. no_family=N: eligible symbols where no family fired. bar_ccx=/bar_loc=/bar_nest=/bar_params=: absolute structural bars: cognitive cx, lines, nesting, params. rcut=N: ranks the worst readability decile covers (1 to 40); rrank= inside it fires structural. rmeasured=N: functions the readability lens measured. hcut=N: file ranks the worst churn decile covers (1 to 40); hrank= inside it fires historical. hranked=N: files with any in-window commit; 0 = historical family unavailable. cfiles=N: indexed files the confusion (atom) pack can read: C/C++/ObjC/CUDA. cscope=N: eligible symbols in those files; 0 = confusion family unavailable. lscope=N: eligible symbols in a language the naming pack reads; 0 = lexical family unavailable. shown_syms=N: symbol rows printed; the rest page with offset=next_offset. shown_files=N: file rows printed (fixed cap 20, not paged); files_capped=1 = rows dropped. e f=: the fired family: structural, lexical, confusion or historical. why=: the measurements that crossed, space separated; rule*N = that rule fired N times. top=: the file's most corroborated symbol (most families on one symbol). top_l=: that symbol's line. top_fam=N: families fired on top=, the stronger claim; file rows rank by it. union_fam=N: distinct families firing anywhere in the file (weaker: may be different symbols). union=: the names of those families. syms=N: symbols in the file where at least one family fired. families=N: evidence families joined; ranked=N: symbols at least one fired on; window=: the git span the historical family read. --> @@ -5665,7 +5723,7 @@ 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.62s** +**wall time: 1.97s** ````` <!-- ripwire field-affinity schema=ripwire.field-affinity/v1: fields read together but declared far apart vs 64-byte lines: <s n= p=> structs, <pair a= b= fns= dist=>, <finding k= f= g=>. window: shown= capped= (capped=1 cut). counts_floor=1: every count is a FLOOR, never a total. root=: p= relative to it. block=64: ASSUMED cache-line bytes; all geometry (dist= wt= ln= lines= findings) is against it. model=lp64-approx: sizes/offsets are the layout verb's LP64 standard-layout MODEL, not the real ABI. weighting=fanin-floor: w= sums 1 + fan-in per co-accessing fn; a reachability proxy, not a frequency. aggregates=N: C-family structs/classes the layout model located a body for (the scanned universe). files=N: C-family files declaring at least one struct/class the modelling pass visited. fns_scanned=N: C-family functions/methods with a readable body scanned for dot/arrow member accesses. accesses=N: member-access sites tied to one aggregate field (FLOOR: bare in-method names uncounted). amb_skipped=N: access sites REFUSED, not guessed: 2+ aggregates declare that field name; in no count here. structs=N: aggregates with 1+ attributed access; the top 20 by sepcost= print (shown=/capped=). findings=N: split-line + straddle findings over ALL structs=, not just the printed rows. min_fns=2: a pair fires split-line only when co-accessed by this many distinct functions. as_loops=N: for-loops the static advance-shape pass classified corpus-wide; report-only, never ranks. as_index=/as_chase=/as_mixed=/as_unknown=: as_loops= by advance shape (chase = pointer chase). agg=: the aggregate keyword (struct, class ...). modeled=1: layout model placed the fields; 0 = affinity only, no geometry, no finding (why= says why). fields=N: fields declared (before the touched-only filter). touched=N: fields with 1+ attributed access; at most 32 f rows print. pairs=N: co-accessed field pairs in all; at most 12 pair rows print (most fns= first). sepcost=: sum over measured pairs of fns x (1 - wt); the struct ranking key. findings=N: this struct's findings, every one printed. size=/align=/lines=: modeled sizeof, alignment, cache lines spanned (modeled=1 only). acc=N: member-access sites attributed to this field (FLOOR). sz=B: the field's modeled size in bytes (absent when the model could not size it). off=/ln=: modeled byte offset and its cache line (off/64); placed=0 instead when the model refused. w=: sum of 1 + fan-in over the co-accessing functions; a static reachability proxy, never a frequency. wt=: separation weight (64 - dist)/64, 0.00 = the two can never share a line; measured=0 instead when unplaced. wt=0.00: split-line fires only when the pair can never share a 64-byte line. w=: the split-line pair's 1 + fan-in weight sum (proxy); straddle rows carry none. off=/sz=/crosses=: straddle field offset, size, and the line its last byte lands on (lines start at off/64). fanin=N: this function's caller count (the w= proxy input). touched=N: distinct fields of this struct the function touches (named in f=); at most 8 fn rows of fns= print. scope=: the function's PROFILE_SCOPE description (first 120 chars), a counter to confirm with. scopes=N: distinct PROFILE_SCOPEs among the co-accessing functions (the scope children). status=: instrumented (a scope exists to measure) or uninstrumented (no witness yet). counter=: the hardware counter to compare across the two layouts. hint=: how to add the missing instrumentation (uninstrumented only). as_stem_ambiguous=/as_stem_unowned=/as_stem_nonptr=: chase names REFUSED - 2+ owners / no owner / owner type has no pointer marker. --> @@ -5705,7 +5763,7 @@ 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: 1.72s** +**wall time: 2.15s** ````` <!-- ripwire field-affinity schema=ripwire.field-affinity/v1: fields read together but declared far apart vs 64-byte lines: <s n= p=> structs, <pair a= b= fns= dist=>, <finding k= f= g=>. window: shown= capped= (capped=1 cut). counts_floor=1: every count is a FLOOR, never a total. root=: p= relative to it. sym=: the struct asked for; only its own fields and pairs are reported. block=64: ASSUMED cache-line bytes; all geometry (dist= wt= ln= lines= findings) is against it. model=lp64-approx: sizes/offsets are the layout verb's LP64 standard-layout MODEL, not the real ABI. weighting=fanin-floor: w= sums 1 + fan-in per co-accessing fn; a reachability proxy, not a frequency. aggregates=N: C-family structs/classes the layout model located a body for (the scanned universe). files=N: C-family files declaring at least one struct/class the modelling pass visited. fns_scanned=N: C-family functions/methods with a readable body scanned for dot/arrow member accesses. accesses=N: member-access sites tied to one aggregate field (FLOOR: bare in-method names uncounted). amb_skipped=N: access sites REFUSED, not guessed: 2+ aggregates declare that field name; in no count here. structs=N: aggregates with 1+ attributed access; the top 20 by sepcost= print (shown=/capped=). findings=N: split-line + straddle findings over ALL structs=, not just the printed rows. min_fns=2: a pair fires split-line only when co-accessed by this many distinct functions. as_loops=N: for-loops the static advance-shape pass classified corpus-wide; report-only, never ranks. as_index=/as_chase=/as_mixed=/as_unknown=: as_loops= by advance shape (chase = pointer chase). agg=: the aggregate keyword (struct, class ...). modeled=1: layout model placed the fields; 0 = affinity only, no geometry, no finding (why= says why). fields=N: fields declared (before the touched-only filter). touched=N: fields with 1+ attributed access; at most 32 f rows print. pairs=N: co-accessed field pairs in all; at most 12 pair rows print (most fns= first). sepcost=: sum over measured pairs of fns x (1 - wt); the struct ranking key. findings=N: this struct's findings, every one printed. size=/align=/lines=: modeled sizeof, alignment, cache lines spanned (modeled=1 only). acc=N: member-access sites attributed to this field (FLOOR). sz=B: the field's modeled size in bytes (absent when the model could not size it). off=/ln=: modeled byte offset and its cache line (off/64); placed=0 instead when the model refused. fanin=N: this function's caller count (the w= proxy input). touched=N: distinct fields of this struct the function touches (named in f=); at most 8 fn rows of fns= print. scopes=N: distinct PROFILE_SCOPEs among the co-accessing functions (the scope children). status=: instrumented (a scope exists to measure) or uninstrumented (no witness yet). counter=: the hardware counter to compare across the two layouts. as_stem_ambiguous=/as_stem_unowned=/as_stem_nonptr=: chase names REFUSED - 2+ owners / no owner / owner type has no pointer marker. --> @@ -5770,11 +5828,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: 19.33s** +**wall time: 15.64s** ````` <!-- ripwire naming-calibration schema=ripwire.naming-calibration/v1: naming lint rules scored against this repo's OWN rename history (a noisy proxy): <r n= old= new= fired= proxy=>. at=: commit+dirty+shallow. probed=0: no history to mine, nothing scored (r= says why); 1 = the git walk ran. pairs=N: labelled rename pairs that survived the join, the SAMPLE SIZE; a small one means nothing. candidates=N: raw substitutions mined from the patch stream before the join; FLOOR when truncated=1. commits=N: non-merge commits walked (the walk stops at 40000). hunks=N: diff hunks with content on both sides. wide_hunks=N: hunks DROPPED for exceeding the 24-line per-side pairing cap; never mined. drop_old_alive=N: candidates dropped: the old spelling is still an indexed name. drop_new_absent=N: candidates dropped: the new spelling is no eligible indexed symbol at HEAD. drop_ambiguous=N: candidates dropped: a name on both sides of several (split, rework, revert). drop_old_skipped=N: candidates dropped: the lens skips the old spelling, no rule could fire. scope=group-rule: the rule judges co-visible names, which one pair cannot evidence; unscored, not 0/0. o=/n=: one labelled pair's old (abandoned) and new (chosen) spelling. sup=N: distinct hunks that showed this substitution. p at=: path:line of the symbol the pair joined to, not a commit (the root at= is). old_fires=: rules that fired on the old spelling; absent when none. new_fires=: rules that fired on the new spelling; absent when none. --> -<naming-calibration schema="ripwire.naming-calibration/v1" probed="1" pairs="218" candidates="3155" commits="7404" hunks="147753" wide_hunks="1597" drop_old_alive="905" drop_new_absent="1837" drop_ambiguous="195" drop_old_skipped="0" at="914c4045d"> +<naming-calibration schema="ripwire.naming-calibration/v1" probed="1" pairs="218" candidates="3156" commits="7407" hunks="147972" wide_hunks="1597" drop_old_alive="905" drop_new_absent="1838" drop_ambiguous="195" drop_old_skipped="0" at="147c73293"> <r n="naming-short" old="2" new="4" fired="6" proxy="0.333"/> <r n="naming-wordy" old="1" new="1" fired="2" proxy="0.500"/> <r n="naming-series" scope="group-rule"/> @@ -5807,7 +5865,7 @@ 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: 4.17s** +**wall time: 3.91s** ````` <!-- ripwire lint schema=ripwire.lint/v1: AST-only checks, facts not gates: <rule name= count= shown_rows= rows_capped= count_capped=> of <f rule= p= in=>. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). findings_capped=/rows_capped=/count_capped=: 1 = cut. counts_floor=1: every count is a FLOOR, never a total. root=: p= relative to it. findings=N: findings over the printed rules; a floor when findings_capped=1. findings_next=: the call counting the floored rules' rest (count_capped=1 rules only, 10x per-rule budget). --> @@ -5923,7 +5981,7 @@ ripwire.path/v1 <path>: one DIRECTED call path from= to to=, each <s t= n= p=> 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.31s** +**wall time: 2.16s** ````` <!-- ripwire lint schema=ripwire.lint/v1: AST-only checks, facts not gates: <rule name= count= shown_rows= rows_capped= count_capped=> of <f rule= p= in=>. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). rows_capped=: 1 = cut. root=: p= relative to it. findings=N: findings over the printed rules; a floor when findings_capped=1. --> @@ -5963,7 +6021,7 @@ ripwire.path/v1 <path>: one DIRECTED call path from= to to=, each <s t= n= p=> a *DROP two families, applied after selection; the raw select=/ignore= you passed rides on the root.* -**wall time: 2.90s** +**wall time: 2.49s** ````` <!-- ripwire lint schema=ripwire.lint/v1: AST-only checks, facts not gates: <rule name= count= shown_rows= rows_capped= count_capped=> of <f rule= p= in=>. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). findings_capped=/rows_capped=/count_capped=: 1 = cut. counts_floor=1: every count is a FLOOR, never a total. root=: p= relative to it. findings=N: findings over the printed rules; a floor when findings_capped=1. findings_next=: the call counting the floored rules' rest (count_capped=1 rules only, 10x per-rule budget). --> @@ -6003,7 +6061,7 @@ ripwire.path/v1 <path>: one DIRECTED call path from= to to=, each <s t= n= p=> 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.70s** +**wall time: 3.26s** ````` <!-- ripwire lint schema=ripwire.lint/v1: AST-only checks, facts not gates: <rule name= count= shown_rows= rows_capped= count_capped=> of <f rule= p= in=>. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). findings_capped=/rows_capped=/count_capped=: 1 = cut. counts_floor=1: every count is a FLOOR, never a total. root=: p= relative to it. findings=N: findings over the printed rules; a floor when findings_capped=1. findings_next=: the call counting the floored rules' rest (count_capped=1 rules only, 10x per-rule budget). --> @@ -6020,7 +6078,7 @@ ripwire.path/v1 <path>: one DIRECTED call path from= to to=, each <s t= n= p=> a *Pasting that findings_next=: the same rule under a 10x budget counts its true total — no count_capped=, no findings_next=.* -**wall time: 2.59s** +**wall time: 3.07s** ````` <!-- ripwire lint schema=ripwire.lint/v1: AST-only checks, facts not gates: <rule name= count= shown_rows= rows_capped= count_capped=> of <f rule= p= in=>. window: shown= capped= (capped=1 cut). rows_capped=: 1 = cut. root=: p= relative to it. findings=N: findings over the printed rules; a floor when findings_capped=1. --> @@ -6050,7 +6108,7 @@ ripwire.path/v1 <path>: one DIRECTED call path from= to to=, each <s t= n= p=> 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.99s** +**exit code: 1** — **wall time: 2.05s** ````` (empty) @@ -6066,7 +6124,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.23s** +**exit code: 1** — **wall time: 2.15s** ````` (empty) @@ -6082,7 +6140,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.40s** +**wall time: 3.22s** ````` {"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] @@ -6144,11 +6202,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: 4.86s** +**wall time: 4.94s** ````` <!-- ripwire dmm schema=ripwire.dmm/v1: Delta Maintainability Model base=→target=: dmm= good/(good+bad) units by size_metric=; <p k= dmm= good= bad= d_low= d_high=>. at=: commit+dirty+shallow. available=0: no score at all (dmm=UNAVAILABLE, reason= says why); never read as 1.000 or 0.000. combine=pooled: root dmm= is summed good over summed good+bad of the 3 properties (ripwire's own). low_loc=/low_cx=/low_params=: a unit is LOW risk at or under these lines / cyclomatic / params. base_units=/base_volume=/target_units=/target_volume=: units with a body and their line span per side. reason=: why no score (no unit's size, complexity or params moved; a tree failed to parse ...). --> -<dmm schema="ripwire.dmm/v1" base="914c4045d08e71e6e6ad23e8a9a1a6b490679aee" target="working-tree" at="914c4045d" available="0" combine="pooled" size_metric="physical-loc" low_loc="15" low_cx="5" low_params="2" dmm="UNAVAILABLE" good="0" bad="0" base_units="25297" base_volume="333518" target_units=" … [line truncated: 147 more bytes on this line] +<dmm schema="ripwire.dmm/v1" base="147c732930f6ea42d5f4c57ff6e09108302c089b" target="working-tree" at="147c73293" available="0" combine="pooled" size_metric="physical-loc" low_loc="15" low_cx="5" low_params="2" dmm="UNAVAILABLE" good="0" bad="0" base_units="25297" base_volume="333518" target_units=" … [line truncated: 147 more bytes on this line] <p k="size" dmm="UNAVAILABLE" good="0" bad="0" d_low="0" d_high="0"/> <p k="complexity" dmm="UNAVAILABLE" good="0" bad="0" d_low="0" d_high="0"/> <p k="interfacing" dmm="UNAVAILABLE" good="0" bad="0" d_low="0" d_high="0"/> @@ -6159,11 +6217,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: 15.17s** +**wall time: 14.02s** ````` <!-- ripwire dmm schema=ripwire.dmm/v1: Delta Maintainability Model base=→target=: dmm= good/(good+bad) units by size_metric=; <p k= dmm= good= bad= d_low= d_high=>. at=: commit+dirty+shallow. available=0: no score at all (dmm=UNAVAILABLE, reason= says why); never read as 1.000 or 0.000. combine=pooled: root dmm= is summed good over summed good+bad of the 3 properties (ripwire's own). low_loc=/low_cx=/low_params=: a unit is LOW risk at or under these lines / cyclomatic / params. base_units=/base_volume=/target_units=/target_volume=: units with a body and their line span per side. reason=: why no score (no unit's size, complexity or params moved; a tree failed to parse ...). --> -<dmm schema="ripwire.dmm/v1" base="b6ae53e9f828e641b9be583700a1a6501e18ca4f" target="914c4045d08e71e6e6ad23e8a9a1a6b490679aee" at="914c4045d" available="0" combine="pooled" size_metric="physical-loc" low_loc="15" low_cx="5" low_params="2" dmm="UNAVAILABLE" good="0" bad="0" base_units="25297" base_vo … [line truncated: 175 more bytes on this line] +<dmm schema="ripwire.dmm/v1" base="9683e45bd878b4a9371ff477dce89856791e02cd" target="147c732930f6ea42d5f4c57ff6e09108302c089b" at="147c73293" available="0" combine="pooled" size_metric="physical-loc" low_loc="15" low_cx="5" low_params="2" dmm="UNAVAILABLE" good="0" bad="0" base_units="25297" base_vo … [line truncated: 175 more bytes on this line] <p k="size" dmm="UNAVAILABLE" good="0" bad="0" d_low="0" d_high="0"/> <p k="complexity" dmm="UNAVAILABLE" good="0" bad="0" d_low="0" d_high="0"/> <p k="interfacing" dmm="UNAVAILABLE" good="0" bad="0" d_low="0" d_high="0"/> @@ -6174,14 +6232,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: 12.63s** +**wall time: 12.48s** ````` -<!-- ripwire dmm schema=ripwire.dmm/v1: Delta Maintainability Model base=→target=: dmm= good/(good+bad) units by size_metric=; <p k= dmm= good= bad= d_low= d_high=>. at=: commit+dirty+shallow. available=0: no score at all (dmm=UNAVAILABLE, reason= says why); never read as 1.000 or 0.000. combine=pooled: root dmm= is summed good over summed good+bad of the 3 properties (ripwire's own). low_loc=/low_cx=/low_params=: a unit is LOW risk at or under these lines / cyclomatic / params. base_units=/base_volume=/target_units=/target_volume=: units with a body and their line span per side. --> -<dmm schema="ripwire.dmm/v1" base="8e1c5d3957f5dc6beb9169df28789aaf8d962670" target="914c4045d08e71e6e6ad23e8a9a1a6b490679aee" at="914c4045d" available="1" combine="pooled" size_metric="physical-loc" low_loc="15" low_cx="5" low_params="2" dmm="0.979" good="141" bad="3" base_units="25287" base_volume … [line truncated: 54 more bytes on this line] -<p k="size" dmm="0.912" good="31" bad="3" d_low="31" d_high="3"/> -<p k="complexity" dmm="1.000" good="34" bad="0" d_low="34" d_high="0"/> -<p k="interfacing" dmm="1.000" good="76" bad="0" d_low="55" d_high="-21"/> +<!-- ripwire dmm schema=ripwire.dmm/v1: Delta Maintainability Model base=→target=: dmm= good/(good+bad) units by size_metric=; <p k= dmm= good= bad= d_low= d_high=>. at=: commit+dirty+shallow. available=0: no score at all (dmm=UNAVAILABLE, reason= says why); never read as 1.000 or 0.000. combine=pooled: root dmm= is summed good over summed good+bad of the 3 properties (ripwire's own). low_loc=/low_cx=/low_params=: a unit is LOW risk at or under these lines / cyclomatic / params. base_units=/base_volume=/target_units=/target_volume=: units with a body and their line span per side. reason=: why no score (no unit's size, complexity or params moved; a tree failed to parse ...). --> +<dmm schema="ripwire.dmm/v1" base="914c4045d08e71e6e6ad23e8a9a1a6b490679aee" target="147c732930f6ea42d5f4c57ff6e09108302c089b" at="147c73293" available="0" combine="pooled" size_metric="physical-loc" low_loc="15" low_cx="5" low_params="2" dmm="UNAVAILABLE" good="0" bad="0" base_units="25297" base_vo … [line truncated: 175 more bytes on this line] +<p k="size" dmm="UNAVAILABLE" good="0" bad="0" d_low="0" d_high="0"/> +<p k="complexity" dmm="UNAVAILABLE" good="0" bad="0" d_low="0" d_high="0"/> +<p k="interfacing" dmm="UNAVAILABLE" good="0" bad="0" d_low="0" d_high="0"/> </dmm> ````` @@ -6189,11 +6247,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: 2.35s** +**wall time: 1.73s** ````` <!-- ripwire cochange schema=ripwire.cochange/v1: files that change together in git: <pair a= b= together= deg= conf_ab= conf_ba= surprising=>, or for of= <f p= together= conf_rev=>. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). no_file_edges=LANGS: this build resolves almost none of these languages' imports to files (Go only across go.mod replace); counts over them (ca/ce and violations= of the arch verb) are floors over the resolved edges only, and a coupling number absent beside it is unknown, not zero. unknown_pairs=N: pairs left out of groups= because surprising= is unknown for them, not 0; drop the cochange-groups flag to list them. at=: commit+dirty+shallow. root=: p= relative to it. sub_windows=N: equal-commit-count slices of window=; the denominator of recur=. recur=K: slices of sub_windows= the pair co-changed in; 1 = one burst, not a standing coupling. no_file_edges=LANGS: with unknown_pairs=N, pairs whose side imports are almost never resolved to files and none links them are in no group; groups= may be low. --> -<cochange schema="ripwire.cochange/v1" groups="159" pairs_covered="1313" cover="greedy" window="18mo@HEAD" sub_windows="3" no_file_edges="java" unknown_pairs="1" shown="30" capped="1" total="159" has_more="1" next_offset="30" offset="0" limit="0" root="." at="914c4045d"> +<cochange schema="ripwire.cochange/v1" groups="159" pairs_covered="1313" cover="greedy" window="18mo@HEAD" sub_windows="3" no_file_edges="java" unknown_pairs="1" shown="30" capped="1" total="159" has_more="1" next_offset="30" offset="0" limit="0" root="." at="147c73293"> <group core="src/cli.h" partners="84"> <f p="src/abicheck.h" together="5" recur="3" conf_core="0.01"/> <f p="src/arch.h" together="7" recur="3" conf_core="0.01"/> @@ -6229,41 +6287,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: 2.18s** +**wall time: 2.28s** ````` <!-- ripwire cochange schema=ripwire.cochange/v1: files that change together in git: <pair a= b= together= deg= conf_ab= conf_ba= surprising=>, or for of= <f p= together= conf_rev=>. window: shown= total= capped= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). at=: commit+dirty+shallow. root=: p= relative to it. pairs=N: file pairs with 3+ shared commits in window= (after min_recur), surprising or not. sub_windows=N: equal-commit-count slices of window=; the denominator of recur=. driver=a|b: the side whose changes best imply the other's, look there first; absent on a tie. recur=K: slices of sub_windows= the pair co-changed in; 1 = one burst, not a standing coupling. --> -<cochange schema="ripwire.cochange/v1" pairs="3652" window="18mo@HEAD" sub_windows="3" min_recur="2" shown="30" capped="1" total="3652" has_more="1" next_offset="30" offset="0" limit="0" root="." at="914c4045d"> +<cochange schema="ripwire.cochange/v1" pairs="3654" window="18mo@HEAD" sub_windows="3" min_recur="2" shown="30" capped="1" total="3654" has_more="1" next_offset="30" offset="0" limit="0" root="." at="147c73293"> <pair a="test/headsnapcachecheck.sh" b="test/qsnapcachecheck.sh" together="5" deg="1.00" conf_ab="1.00" conf_ba="0.83" driver="a" recur="3" surprising="1"/> +<pair a="test/mcpslicecheck.sh" b="test/mcpverbscheck.sh" together="3" deg="1.00" conf_ab="1.00" conf_ba="0.16" driver="a" recur="2" surprising="1"/> <pair a="src/binstale.h" b="src/crossref.h" together="3" deg="1.00" conf_ab="1.00" conf_ba="0.03" driver="a" recur="2" surprising="1"/> -<pair a="bench/scip_match_diag.py" b="bench/scip_pin_precision.py" together="3" deg="1.00" conf_ab="1.00" conf_ba="0.60" driver="a" recur="2" surprising="1"/> <pair a="test/cachesplitcheck.sh" b="test/portablecachecheck.sh" together="3" deg="1.00" conf_ab="0.75" conf_ba="1.00" driver="b" recur="3" surprising="1"/> -<pair a="test/mcpslicecheck.sh" b="test/mcpverbscheck.sh" together="3" deg="1.00" conf_ab="1.00" conf_ba="0.16" driver="a" recur="2" surprising="1"/> +<pair a="bench/scip_match_diag.py" b="bench/scip_pin_precision.py" together="3" deg="1.00" conf_ab="1.00" conf_ba="0.60" driver="a" recur="2" surprising="1"/> +<pair a="test/pincensuscheck.sh" b="test/scipjoincheck.sh" together="3" deg="1.00" conf_ab="0.38" conf_ba="1.00" driver="b" recur="2" surprising="1"/> +<pair a="test/gatecountcheck.sh" b="test/regression.sh" together="3" deg="1.00" conf_ab="1.00" conf_ba="0.00" driver="a" recur="2" surprising="1"/> <pair a="test/elixircheck.sh" b="test/elixirsemanticcheck.sh" together="3" deg="1.00" conf_ab="0.13" conf_ba="1.00" driver="b" recur="2" surprising="1"/> <pair a="test/gatecountcheck.sh" b="test/manifestcheck.sh" together="3" deg="1.00" conf_ab="1.00" conf_ba="0.23" driver="a" recur="2" surprising="1"/> -<pair a="test/pincensuscheck.sh" b="test/scipjoincheck.sh" together="3" deg="1.00" conf_ab="0.38" conf_ba="1.00" driver="b" recur="2" surprising="1"/> <pair a="test/luacheck.sh" b="test/phpcheck.sh" together="3" deg="1.00" conf_ab="0.75" conf_ba="1.00" driver="b" recur="2" surprising="1"/> -<pair a="test/gatecountcheck.sh" b="test/regression.sh" together="3" deg="1.00" conf_ab="1.00" conf_ba="0.00" driver="a" recur="2" surprising="1"/> -<pair a="src/cli.h" b="src/sarif.h" together="6" deg="0.86" conf_ab="0.01" conf_ba="0.86" driver="b" recur="2" surprising="1"/> <pair a="src/abicheck.h" b="src/landingplan.h" together="6" deg="0.86" conf_ab="0.40" conf_ba="0.86" driver="b" recur="3" surprising="1"/> +<pair a="src/cli.h" b="src/sarif.h" together="6" deg="0.86" conf_ab="0.01" conf_ba="0.86" driver="b" recur="2" surprising="1"/> <pair a="hooks/ripwire-claude-route.sh" b="hooks/ripwire-codex-route.sh" together="20" deg="0.83" conf_ab="0.83" conf_ba="0.83" recur="3" surprising="1"/> <pair a="test/headsnapcachecheck.sh" b="test/qsnapprefetchcheck.sh" together="4" deg="0.80" conf_ab="0.80" conf_ba="0.67" driver="a" recur="2" surprising="1"/> <pair a="test/anchorcheck.sh" b="test/routecheck.sh" together="15" deg="0.79" conf_ab="0.79" conf_ba="0.71" driver="a" recur="3" surprising="1"/> <pair a="src/ingest_cache.h" b="src/quality.h" together="291" deg="0.78" conf_ab="0.78" conf_ba="0.44" driver="a" recur="3" surprising="1"/> <pair a="hooks/ripwire-claude-route.sh" b="hooks/ripwire-claude-toolroute.sh" together="6" deg="0.75" conf_ab="0.25" conf_ba="0.75" driver="b" recur="2" surprising="1"/> -<pair a="test/tracecheck.sh" b="test/w3fixbudgetcheck.sh" together="3" deg="0.75" conf_ab="0.75" conf_ba="0.75" recur="2" surprising="1"/> +<pair a="test/estchargecheck.sh" b="test/w3fixbudgetcheck.sh" together="3" deg="0.75" conf_ab="0.04" conf_ba="0.75" driver="b" recur="2" surprising="1"/> <pair a="test/estchargecheck.sh" b="test/tracecheck.sh" together="3" deg="0.75" conf_ab="0.04" conf_ba="0.75" driver="b" recur="2" surprising="1"/> <pair a="test/dartcheck.sh" b="test/elixircheck.sh" together="3" deg="0.75" conf_ab="0.75" conf_ba="0.13" driver="a" recur="2" surprising="1"/> -<pair a="test/estchargecheck.sh" b="test/w3fixbudgetcheck.sh" together="3" deg="0.75" conf_ab="0.04" conf_ba="0.75" driver="b" recur="2" surprising="1"/> -<pair a="src/infra/diagnostics.cpp" b="test/diagnotice_harness.cpp" together="3" deg="0.75" conf_ab="0.30" conf_ba="0.75" driver="b" recur="2" surprising="1"/> +<pair a="test/tracecheck.sh" b="test/w3fixbudgetcheck.sh" together="3" deg="0.75" conf_ab="0.75" conf_ba="0.75" recur="2" surprising="1"/> <pair a="test/cachesplitcheck.sh" b="test/evictioncheck.sh" together="3" deg="0.75" conf_ab="0.75" conf_ba="0.23" driver="a" recur="2" surprising="1"/> +<pair a="src/infra/diagnostics.cpp" b="test/diagnotice_harness.cpp" together="3" deg="0.75" conf_ab="0.30" conf_ba="0.75" driver="b" recur="2" surprising="1"/> <pair a="hooks/ripwire-claude-route.sh" b="test/routehookcheck.sh" together="14" deg="0.74" conf_ab="0.58" conf_ba="0.74" driver="b" recur="2" surprising="1"/> <pair a="src/ingest_model.h" b="src/model.h" together="53" deg="0.74" conf_ab="0.74" conf_ba="0.16" driver="a" recur="3" surprising="1"/> <pair a="src/quality.h" b="src/tsprobe.cpp" together="8" deg="0.73" conf_ab="0.01" conf_ba="0.73" driver="b" recur="3" surprising="1"/> <pair a="src/commentcoherence.h" b="src/readability.h" together="5" deg="0.71" conf_ab="0.71" conf_ba="0.42" driver="a" recur="2" surprising="1"/> <pair a="hooks/ripwire-codex-route.sh" b="test/codexpromptroutecheck.sh" together="7" deg="0.70" conf_ab="0.29" conf_ba="0.70" driver="b" recur="2" surprising="1"/> <pair a="src/graph.h" b="src/ingest_ruby.h" together="7" deg="0.70" conf_ab="0.01" conf_ba="0.70" driver="b" recur="2" surprising="1"/> -<pair a="src/ingest_cache.h" b="src/ingest_ruby.h" together="7" deg="0.70" conf_ab="0.02" conf_ba="0.70" driver="b" recur="2" surprising="1"/> +<pair a="src/ingest_ruby.h" b="src/model.h" together="7" deg="0.70" conf_ab="0.70" conf_ba="0.02" driver="a" recur="2" surprising="1"/> </cochange> ````` @@ -6271,7 +6329,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: 2.14s** +**wall time: 2.07s** ````` (empty) @@ -6287,7 +6345,7 @@ Artifact written: *CI generate-and-exit: cold-parse and write BOTH committable cache families (lean + rich), no map on stdout.* -**wall time: 6.76s** +**wall time: 5.52s** ````` (empty) @@ -6297,22 +6355,22 @@ stderr: ````` ripwire: --index-out wrote <scratch>/aux/ci_index.lean.ripwirecache (40894532 bytes, lean family) -ripwire: --index-out wrote <scratch>/aux/ci_index.rich.ripwirecache (82404423 bytes, rich family) +ripwire: --index-out wrote <scratch>/aux/ci_index.rich.ripwirecache (82404940 bytes, rich family) ````` Artifact written: ````` 40894532 <scratch>/aux/ci_index.lean.ripwirecache - 82404423 <scratch>/aux/ci_index.rich.ripwirecache - 123298955 total + 82404940 <scratch>/aux/ci_index.rich.ripwirecache + 123299472 total ````` ## `./build/ripwire . --cache=<scratch>/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.85s** +**wall time: 1.53s** ````` <!-- ripwire map schema=ripwire.map/v1: ranked symbol map: <f p= layer=> groups <s t= n= sc= k= amb=> rows (k= rank), <c n=> resolved callees; the header comment is data. est_tokens=: price as emitted (an upper bound under compact). root=: p= relative to it. pr_iters=N: PageRank iterations. <inv listed= unlisted=>: files the ranked rows show / do not (sum = files=), each named or counted below. <entry p= n=>: 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. <ls p= n= f=>: 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 <c> 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. sc=: enclosing scope; the full id is p::sc::n (p= of the row or its <f>) and selectors take it. --> @@ -6406,11 +6464,11 @@ Artifact written: *The house PLAN/DESIGN format's STRUCTURE check — never semantics; exit 2 when a card or ledger row gates.* -**exit code: 2** — **wall time: 2.03s** +**exit code: 2** — **wall time: 2.27s** ````` <!-- ripwire plan-lint schema=ripwire.plan-lint/v1: structural lint of a plan document: each finding names the section and the rule. at=: commit+dirty+shallow. file=/dialect=: the plan read and whether the PLAN dialect was detected (dialect=0: nothing to lint). cards=/ledger=: card rows found / whether the doc carries a ledger (ledger_line= names its line). git=1: git was available, so the staleness read ran; stale_commits=N: a waiting card N commits behind HEAD is stale. gating=N: findings that fail the plan (exit 2); the rest are advisory. --> -<plan-lint schema="ripwire.plan-lint/v1" file="test/planlintfix/wave.md" dialect="1" cards="3" ledger="1" ledger_line="21" at="914c4045d" git="1" stale_commits="20" gating="3"> +<plan-lint schema="ripwire.plan-lint/v1" file="test/planlintfix/wave.md" dialect="1" cards="3" ledger="1" ledger_line="21" at="147c73293" git="1" stale_commits="20" gating="3"> <card id="T1" line="10" status="check" tline="12"/> <card id="T2" line="14" status="cross" tline="16"/> <card id="T5" line="18" status="missing" tline="19" why="unlaunched" gating="1"/> @@ -6428,11 +6486,11 @@ Artifact written: *The ledger-shaped fixture through the same check (exit 2: one gating card).* -**exit code: 2** — **wall time: 1.55s** +**exit code: 2** ````` <!-- ripwire plan-lint schema=ripwire.plan-lint/v1: structural lint of a plan document: each finding names the section and the rule. at=: commit+dirty+shallow. file=/dialect=: the plan read and whether the PLAN dialect was detected (dialect=0: nothing to lint). cards=/ledger=: card rows found / whether the doc carries a ledger (ledger_line= names its line). git=1: git was available, so the staleness read ran; stale_commits=N: a waiting card N commits behind HEAD is stale. gating=N: findings that fail the plan (exit 2); the rest are advisory. --> -<plan-lint schema="ripwire.plan-lint/v1" file="test/planlintfix/wave_ledger.md" dialect="1" cards="4" ledger="1" ledger_line="17" at="914c4045d" git="1" stale_commits="20" gating="1"> +<plan-lint schema="ripwire.plan-lint/v1" file="test/planlintfix/wave_ledger.md" dialect="1" cards="4" ledger="1" ledger_line="17" at="147c73293" git="1" stale_commits="20" gating="1"> <card id="T1" line="4" status="check" tline="6"/> <card id="T2" line="8" status="check" tline="18" src="ledger"/> <card id="T5" line="11" status="missing" tline="12" why="unlaunched" gating="1"/> @@ -6444,17 +6502,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.65s** +**exit code: 1** — **wall time: 10.68s** ````` <!-- ripwire doctor schema=ripwire.doctor/v1: setup health: <c n= ok=> checks; exit 1 when one fails. at=: commit+dirty+shallow. n=: the check's name (binary-path, grammars, cache-dir, git, tree-sitter, index-cache, layout ...). agent=: the agent named by the agent flag; its live-integration c rows follow the built-in checks. loaded=/expected=: grammars whose tags query compiled / grammars compiled in; a shortfall fails the row. dir=: the per-user cache directory scanned (TMPDIR/XDG_CACHE_HOME ladder); unwritable fails the row. blobs=N: ripwire cache blobs in dir=; the scan stops at 4096 (blobs_floor=1 then). bytes=N: total size in bytes of the blobs counted (short when truncated=1). many=1: more than 50 blobs; an eviction-sanity flag, informational, never fails the row. truncated=1: cache-dir, blob scan cut (cap or I/O error); tracked-binaries, scan SKIPPED, stale=0 unmeasured. locks=N: advisory edit-lock files under locks/; unheld ones over a day old are swept on a cache write. volatile=: this row's attributes that read LIVE machine state; a determinism diff strips them, never the row. git=0|1: git runs from PATH; 0 fails the row (churn verbs need it). repo=0|1: the root is inside a git work tree; 0 is a diagnosis, not a failure. history=0|1: the repo has at least one commit; head= prints only when it does. head=: HEAD's short sha (9 hex, the at= width). core_abi=/cpp_grammar_abi=: tree-sitter core language ABI / the C++ grammar's ABI; informational. languages=N: distinct compiled-in grammars (the grammars row's expected=). tracked=N: git ls-files count, printed even when truncated=1 (over 20000 files skips the scan). binaries=N: tracked paths that sniff as binary content. non_git=1: no git history to compare; the row passes unscanned. stale=N: tracked binaries committed before a same-dir same-stem source changed; any fails the row. cache_version=/parser_ver_lean=/parser_ver_rich=/artifact_arch=: index identity; reuse needs all four. rich_verbs=: the verbs that consume the rich artifact (rich=); every other verb reads the lean one. source=: auto (per-root blob), cache-flag (named by the cache flag) or disabled (no-cache: nothing read). lean_path=/rich_path=: the artifact files checked; one path when the cache flag named it. lean=/rich=: can THIS binary open that artifact (ok, absent, parser-version ...); format, never freshness. fsmonitor=: the checkout's core.fsmonitor at startup: unset, builtin, off, or hook (a command git runs). neutralised=1: a hook fsmonitor was overridden to false for this run; 0 when none was needed. filter_drivers=N: filter drivers the repository's own config defines; filter_scope= local|all, filter_pinned= 1 (run with an empty command) or refused. state=: layout records agree, disagree (mixed binary: rebuild clean-first), not-checked or no-records. checked=1: the cross-unit layout comparison ran; 0 = under two comparable records. units=N: translation units that registered a layout record. types=N: layout types recorded (only those registered in src/model.h); omitted on state=disagree. checks=/passed=: checks run / how many passed; exit 1 when passed= is below checks=. built_from=: the commit this binary was built from; at= is the tree HEAD now, a mismatch is normal. self=/which=: this binary's path and the one which ripwire finds on PATH; which_version= is the version line that one prints when they differ. on_path=0|1: whether a ripwire is on PATH; 0 fails the row and hint= carries the export line. same_file=1: the PATH copy is this very file (same device and inode). same_bytes=1: a different file with identical content, a copied install (ok); 0 fails the row; unknown: a file was unreadable; the row fails unverified (hint= names it). self_mtime=/self_size=/which_mtime=/which_size=: epoch mtime and byte size of each binary. hint=: the row's verdict and fix in plain text (which binary is stale, what to run). --> -<doctor schema="ripwire.doctor/v1" checks="12" passed="10" agent="claude" at="914c4045d" built_from="914c4045d"> -<c n="binary-path" ok="0" self="./build/ripwire" which="<path>" on_path="1" same_file="0" same_bytes="0" self_mtime="1795336538" self_size="65732168" which_mtime="1793517843" which_size="58197960" which_version="ripw … [line truncated: 525 more bytes on this line] +<doctor schema="ripwire.doctor/v1" checks="12" passed="10" agent="claude" at="147c73293" built_from="147c73293"> +<c n="binary-path" ok="0" self="./build/ripwire" which="<path>" on_path="1" same_file="0" same_bytes="0" self_mtime="1795347577" self_size="65732168" which_mtime="1793517843" which_size="58197960" which_version="ripw … [line truncated: 525 more bytes on this line] <c n="grammars" ok="1" loaded="27" expected="27"/> -<c n="cache-dir" ok="1" dir="<tmp>" blobs="234" bytes="2071316293" many="1" truncated="0" locks="225" volatile="blobs,blobs_floor,bytes,many,truncated,locks"/> -<c n="git" ok="1" git="1" repo="1" history="1" head="914c4045d"/> +<c n="cache-dir" ok="1" dir="<tmp>" blobs="472" bytes="2023545840" many="1" truncated="0" locks="229" volatile="blobs,blobs_floor,bytes,many,truncated,locks"/> +<c n="git" ok="1" git="1" repo="1" history="1" head="147c73293"/> <c n="tree-sitter" ok="1" core_abi="15" cpp_grammar_abi="14" languages="27"/> -<c n="tracked-binaries" ok="1" tracked="5597" binaries="33" non_git="0" truncated="0" stale="0"/> +<c n="tracked-binaries" ok="1" tracked="5598" binaries="33" non_git="0" truncated="0" stale="0"/> <c n="index-cache" ok="1" cache_version="54" parser_ver_lean="337" parser_ver_rich="338" artifact_arch="16" rich_verbs="for,uses,metrics,exemplar,context-ratio,nonlocal-state,quality-panel,verify,eval-retrieval,eval-mined,eval-skills" source="auto" lean_path="<tmp> … [line truncated: 219 more bytes on this line] <c n="git-config-trust" ok="1" fsmonitor="unset" neutralised="0" filter_drivers="0"/> <c n="layout" ok="1" state="agree" checked="1" units="2" types="12"/> @@ -6491,12 +6549,12 @@ Everything below runs with `cwd` = the throwaway clone at `<scratch>/dirty` (`gi *Situational report for a real diff: blast radius + tests + co-change + forgotten co-change partners.* -**wall time: 10.22s** +**wall time: 9.57s** ````` ripwire situational-awareness — 1 changed file(s), 14 symbols in them root: . -at: 914c4045d+dirty +at: 147c73293+dirty change_set: granularity=file changed_symbols=14 file_symbols=14 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: 1049 symbols across 148 files transitively depend on these changes (showing 8 of 148 files — shown=8 total=148 capped=1 prcontext_cap=20 (--pr-context's own per-file list is cut at 20 too); next: --situ --limit=148) counts_floor=1 graph_ambiguous=3984 graph_unresolved=20100 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] @@ -6522,8 +6580,8 @@ at: 914c4045d+dirty test/rustimport_unit.cpp [hops=4] (run: bash test/rustimportprecisecheck.sh) test/fuzz/readers/readers_light.cpp [hops=5] (run: not derivable) script_gates_unmodelled=952 — 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="8003": - (none — 8003 commits were mined and none co-edited a file outside your diff) + [3] co-change — usually edited with these but NOT in your diff (0) window="18mo@HEAD" commits="8006": + (none — 8006 commits were mined and none co-edited a file outside your diff) next: --test-gate ````` @@ -6531,7 +6589,7 @@ at: 914c4045d+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: 13.28s** +**exit code: 4** — **wall time: 9.93s** ````` <!-- ripwire test-gate schema=ripwire.test-gate/v1: tests <t p= changed= partner= hops= run=> + untested blast radius <u sym= p= l= ccx=>; exit 4 while either exists. window: total= has_more= next_offset= offset= limit= (capped=1 cut; next_offset= pastes as offset=). tests_capped=/untested_capped=: 1 = cut. counts_floor=1: every count is a FLOOR, never a total. graph_ambiguous=/graph_unresolved=: resolver gauge. graph_unindexed=N: N files no grammar could read (the map header's unindexed=); their calls raise neither gauge. declined_calls=K: K call sites left unbound (no evidence chose one def), in no count or row. run_unknown=1: no runner derivable (a guess would be worse). at=: commit+dirty+shallow. root=: p= relative to it. next=: the one pasteable follow-up. impacted=N: symbols that transitively call the change (changed symbols excluded). shown_tests=/shown_untested=: t rows and u rows printed, two independent counts. script_gates_unmodelled=N: test/*.sh runners in the corpus, a path count; not call-graph modelled. run_first=N: the first N t rows have the most direct evidence (changed/partner/hops=1, else nearest hops=); not a skip list. script_gates_registered=N: shell gates test/regression.sh registers as suite members. script_gates_mapped=N: registered gates with exact dependency evidence (literal paths or RIPWIRE_TEST_DEPS). script_gates_unresolved_dynamic=N: registered gates with no mappable deps; they may cover the change unlisted. ccx_bar=N: the cognitive-complexity bar a u row's ccx= is read against. change_granularity=: how the change set seeded — symbol = only symbols a git hunk (diff -U0 vs HEAD) locates inside a function/method body; file = whole changed files (an unlocated hunk — module-level, deletion, rename — returns its file to file-granular); mixed = both. changed_symbols=/file_symbols=: the seeds the walk used vs all symbols of the changed files. files_narrowed=/files_file_granular=: changed files under each treatment. diff_hunks=/diff_hunks_located=/diff_hunks_unlocated=: the hunk tally; an unlocated hunk is WHY a file went file-granular. untested_modscope=N: <file-scope> owners excluded from untested= (#324, uncallable); still in impacted=. tests=/untested=: tests to run (t total) / impacted symbols no test reaches (u total). --> @@ -6580,11 +6638,11 @@ at: 914c4045d+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: 51.91s** +**exit code: 2** — **wall time: 39.64s** ````` <!-- ripwire quality-delta schema=ripwire.quality-delta/v1: only what the change made WORSE vs baseline=: regressions= minor= gating=; <r kind= sym= p= was= now= gating= bar=>, <sa> acked. value-ref-excluded=N: internal functions kept off because a table, field or argument in another function or at file scope holds them (matched by name, not a proven call); a floor. at=: commit+dirty+shallow. next=: the one pasteable follow-up. stale=N: ack ledger rows whose target no longer applies (sa rows); never gating. preexisting-worse=N: regressions on symbols that existed at baseline; they gate when major. new-symbol=N: NEW code; new-symbol rows never gate, except defect-shape format-arity, ceiling=, tangle. register-macro-excluded=N: symbols skipped: self-registering test/bench macros or Rust #[test]; a floor. declined-call-excluded=N: symbols kept out of dead-code only because a declined call may mean them; a floor. api-new-surface=N: new PUBLIC symbols; a count, never gates, not in regressions=. renames=/rename_window_commits=: git rename pairs read over that many commits, to re-file baseline and acks. acked_by_rename=/acked_by_content=: acked= suppressions matched via git renames / an equal body hash. renames_window_truncated=1: history is deeper than the rename window, older renames unread. r surface=: the api-surface tier, new-symbol or contract-change. acked=N: findings suppressed by the ack ledger, listed as sa rows; never gating. r sev=minor: a small numeric delta, counted in minor=, never gating (absent: major). r origin=new-symbol: a finding on NEW code; moved: its body left another name or file, never gating (absent: preexisting-worse). sa key=/why=: the stale ack's ledger hash / target-gone (names nothing now) or finding-gone (no longer fires). r members=/tokens=: a duplication row's clone group (member ids) / their shared normalized-token count. --> -<quality-delta schema="ripwire.quality-delta/v1" baseline="git-HEAD" regressions="9" minor="1" acked="0" stale="202" preexisting-worse="6" new-symbol="3" gating="5" register-macro-excluded="63" api-new-surface="2" at="914c4045d+dirty" renames="68" rename_window_commits="400" acked_by_rename="0" acke … [line truncated: 99 more bytes on this line] +<quality-delta schema="ripwire.quality-delta/v1" baseline="git-HEAD" regressions="9" minor="1" acked="0" stale="202" preexisting-worse="6" new-symbol="3" gating="5" register-macro-excluded="63" api-new-surface="2" at="147c73293+dirty" renames="68" rename_window_commits="400" acked_by_rename="0" acke … [line truncated: 99 more bytes on this line] <r kind="api-surface" sym="src/infra/sortutil.h::rw::sortutil::nonNegativeFloatDescKey" was="1" now="2" surface="contract-change" p="src/infra/sortutil.h:122" gating="1" next="--expand=src/infra/sortutil.h:nonNegativeFloatDescKey"/> <r kind="complexity" sym="src/infra/sortutil.h::rw::sortutil::lessByScoreDescId" was="1" now="67" bar="15" p="src/infra/sortutil.h:62" gating="1" next="--expand=src/infra/sortutil.h:lessByScoreDescId"/> <r kind="dead-code" sym="src/infra/sortutil.h::rw::sortutil::nonNegativeFloatAscKeyCopy" origin="new-symbol" p="src/infra/sortutil.h:132"/> @@ -6627,11 +6685,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: 15.75s** +**exit code: 2** — **wall time: 16.81s** ````` <!-- ripwire quality-delta: only what a change made WORSE against the floor baseline= names below. Descriptive: weigh and fix the real ones, do not game the number (a wrong abstraction beats a low score). THIRTEEN KINDS, and kind= on every row names which one: complexity over the ccx bar, verbosity (LOC), nesting, params, duplication, dead-code, api-surface (new public contract drift), error-masking, short-horizon-churn, new-clone-of-reused-helper, placeholder (added stub/TODO), defect-shape (defect= names it), tangle (a long function's nesting, deep share and steering locals). THREE independent axes, in this order: (1) acked findings are suppressed entirely (acked= counts them); (2) ORIGIN — a finding on a symbol that EXISTED at the baseline is preexisting-worse (no origin attribute), one that exists only because the code is NEW carries origin="new-symbol"; (3) MATERIALITY — a small numeric delta is sev="minor", and minor= counts them. EXIT 2 fires only on preexisting-worse AND major, the gating= count; new-symbol rows never gate, except defect-shape format-arity, a new function at the ceiling and a tangled new function, so exit 0 is NOT a verdict on them — nothing that existed got worse, but the new debt is yours: read them. Clone kinds are new-symbol only when EVERY member is new; short-horizon-churn is preexisting by construction. preexisting-worse= and new-symbol= partition regressions=. stale= is a FOURTH axis, never gating and never counted in regressions=: rows in the .ripwire_quality_acks ledger whose target no longer applies. api-new-surface= COUNTS the new PUBLIC symbols (never gates, not in regressions=, printed even at zero). register-macro-excluded= is a FLOOR, not a finding: symbols this run excluded from the dead-code kind because their own definition is a registered self-registering test/benchmark macro call. Never gates, never counted in regressions=, printed even at zero (zero: none excluded, not a skipped check). A gating row's next= is the one pasteable follow-up: expand on FILE:NAME, the body to fix (a duplication row names a SET and carries none). bar= on a complexity/verbosity/nesting/params row is the threshold now= is judged against (ccx 15, loc 60, nest 4, params 5). baseline="git-HEAD" means no sidecar existed, so the working tree was auto-compared against the HEAD tree — anything already committed cannot appear. at= is the git commit (plus a dirty marker when the working tree differs) this list was computed at. The registered families are doctest/Catch2 TEST_CASE, GoogleTest TEST/TEST_F/TEST_P, Google Benchmark BENCHMARK, plus any name a .ripwire_config register_macros= line adds; each registers itself through a static initializer the call graph cannot see, so zero in-edges on one is not evidence of anything. Rust #[test] and #[tokio::test] functions count too: the test harness calls them, and no call in the tree names them. declined-call-excluded= is a FLOOR, not a finding: symbols this run kept out of the dead-code kind only because a call the resolver declined to bind (the map's declined=) could have meant them. Never gates; absent at zero. value-ref-excluded= is a FLOOR, not a finding: symbols this run kept out of the dead-code kind only because a table, field, argument or registering decorator holds them as a VALUE (matched by name; it is not a proven call; the callers verb lists the sites; @classmethod-style wrappers do not count), the --dead-code verb's own rule. Never gates; absent at zero. IDENTITY across a rename or a move: a finding is keyed path::scope::name, which a rename would destroy, so the baseline and the .ripwire_quality_acks ledger are both re-filed into the CURRENT tree's identity before either is read, by two EXACT mechanisms — git's own rename record, and equality of a whitespace-and-name-scrubbed body hash — never a similarity heuristic. renames= is how many rename pairs were read (with no ledger, only the uncommitted renames or the A..B range, and the family appears only when one was read), rename_window_commits= how deep the commit window went, acked_by_rename= and acked_by_content= how many of the acked= suppressions each mechanism is responsible for. Three appear ONLY when true, so an absent one is not a silent no: renames_window_truncated= (history is deeper than the window), renames_truncated= (the pair cap was hit), renames_ambiguous= (an ancestor two current symbols both claim — refused rather than guessed). ORIGIN reads the re-filed baseline too, so a regression carried in with a rename is judged preexisting-worse and GATES instead of slipping through as new-symbol. FLOORS, stated because silence here would read as a guarantee: the two clone kinds key on a member-SET hash and are NOT re-filed, so a clone ack still dies on a rename (a clone group itself is held across a file rename git recorded); ORIGIN follows the rename record and an unchanged body (whitespace and its own name aside): a function keeps its identity across a rename or move git recorded no rename for when its body did not change; one whose body also changed reads as new-symbol, or as moved (never gating) when it is over a bar and nearly unchanged. Each sa row carries key= (the ack identity as stored) and why=, which is target-gone (the key names no symbol or group any more) or finding-gone (the target survived, this kind just does not fire on it). sym= and p=path:line name WHICH ack it is, and are present exactly when the key still names a live symbol: on every finding-gone row, on none of the target-gone rows (there is nothing left to name), and on neither clone kind — a clone key hashes a member SET that no single symbol carries, so those rows are unnameable by construction rather than guessed at. Hygiene disclosure only — the ledger file is never auto-edited. ROWS: sym= is the canonical id the finding regressed on; was= and now= carry the before/after value for the numeric kinds; p="path:line" is the locator (root-relative; the first-sorting member for the clone kinds; omitted, never faked, when none resolves). churn= and surface= are per-kind classification facets (short-horizon-churn's self/ambient split; api-surface's new-symbol/contract-change tier). churn= facets never gate alone: the kind gates only on 2+ COMMITTED in-window rewrites of the edited lines. Every row the header's gating= counter counts also carries a gating attribute set to 1 — marked positively, never by the ABSENCE of sev or origin. CLONE ROWS name the whole group rather than one symbol: members= is the member list and tokens= its shared normalized-token count (the same per-group pair the clones verb reports). idiom= names a RECOGNIZED BODY SHAPE every member spells, from a closed set of five (threshold-ladder, switch-name-table, builder-chain, one-statement, call-sequence). idiom= alone changes nothing; a group that ALSO shares no non-keyword identifier between any two members, sits in pairwise-distinct enclosing contexts, and stays under 80 normalized tokens is an idiom COLLISION rather than a copy, and is reported minor instead of gating. Break any one of those and it gates as before, idiom= and all: two bucketing ladders over the SAME enum are a copy. The shape is read off the body's token stream and not a parse tree, so a macro-assembled body classifies as whatever its raw tokens spell — the name is printed so a reader can overrule it. --> -<quality-delta baseline="git-HEAD" regressions="9" minor="1" acked="0" stale="202" preexisting-worse="6" new-symbol="3" gating="5" register-macro-excluded="63" api-new-surface="2" at="914c4045d+dirty" renames="68" rename_window_commits="400" acked_by_rename="0" acked_by_content="0" renames_window_tr … [line truncated: 65 more bytes on this line] +<quality-delta baseline="git-HEAD" regressions="9" minor="1" acked="0" stale="202" preexisting-worse="6" new-symbol="3" gating="5" register-macro-excluded="63" api-new-surface="2" at="147c73293+dirty" renames="68" rename_window_commits="400" acked_by_rename="0" acked_by_content="0" renames_window_tr … [line truncated: 65 more bytes on this line] <r kind="api-surface" sym="src/infra/sortutil.h::rw::sortutil::nonNegativeFloatDescKey" was="1" now="2" surface="contract-change" p="src/infra/sortutil.h:122" gating="1" next="--expand=src/infra/sortutil.h:nonNegativeFloatDescKey"/> <r kind="complexity" sym="src/infra/sortutil.h::rw::sortutil::lessByScoreDescId" was="1" now="67" bar="15" p="src/infra/sortutil.h:62" gating="1" next="--expand=src/infra/sortutil.h:lessByScoreDescId"/> <r kind="dead-code" sym="src/infra/sortutil.h::rw::sortutil::nonNegativeFloatAscKeyCopy" origin="new-symbol" p="src/infra/sortutil.h:132"/> @@ -6674,10 +6732,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: 18.71s** +**exit code: 2** — **wall time: 17.15s** ````` -{"baseline":"git-HEAD","regressions":9,"minor":1,"acked":0,"stale":202,"preexisting-worse":6,"new-symbol":3,"gating":5,"register-macro-excluded":63,"api-new-surface":2,"at":"914c4045d+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":202,"preexisting-worse":6,"new-symbol":3,"gating":5,"register-macro-excluded":63,"api-new-surface":2,"at":"147c73293+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:62","gating":true}, {"kind":"dead-code","sym":"src/infra/sortutil.h::rw::sortutil::nonNegativeFloatAscKeyCopy","p":"src/infra/sortutil.h:132","origin":"new-symbol"}, {"kind":"dead-code","sym":"src/infra/sortutil.h::rw::sortutil::sortScoredIdsWithOptions","p":"src/infra/sortutil.h:142","origin":"new-symbol"}, @@ -6721,7 +6779,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: 12.08s** +**exit code: 1** — **wall time: 12.11s** ````` (empty) @@ -6739,7 +6797,7 @@ ripwire: --ack-only=zzznope matched none of the 9 finding(s) — nothing written *NEW FLAG: ack only the api-surface findings — a per-finding ratchet instead of a rubber stamp.* -**wall time: 11.99s** +**wall time: 13.96s** ````` (empty) @@ -6757,11 +6815,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: 16.98s** +**exit code: 2** — **wall time: 19.92s** ````` <!-- ripwire quality-delta schema=ripwire.quality-delta/v1: only what the change made WORSE vs baseline=: regressions= minor= gating=; <r kind= sym= p= was= now= gating= bar=>, <sa> acked. value-ref-excluded=N: internal functions kept off because a table, field or argument in another function or at file scope holds them (matched by name, not a proven call); a floor. at=: commit+dirty+shallow. next=: the one pasteable follow-up. stale=N: ack ledger rows whose target no longer applies (sa rows); never gating. preexisting-worse=N: regressions on symbols that existed at baseline; they gate when major. new-symbol=N: NEW code; new-symbol rows never gate, except defect-shape format-arity, ceiling=, tangle. register-macro-excluded=N: symbols skipped: self-registering test/bench macros or Rust #[test]; a floor. declined-call-excluded=N: symbols kept out of dead-code only because a declined call may mean them; a floor. api-new-surface=N: new PUBLIC symbols; a count, never gates, not in regressions=. renames=/rename_window_commits=: git rename pairs read over that many commits, to re-file baseline and acks. acked_by_rename=/acked_by_content=: acked= suppressions matched via git renames / an equal body hash. renames_window_truncated=1: history is deeper than the rename window, older renames unread. acked=N: findings suppressed by the ack ledger, listed as sa rows; never gating. r sev=minor: a small numeric delta, counted in minor=, never gating (absent: major). r origin=new-symbol: a finding on NEW code; moved: its body left another name or file, never gating (absent: preexisting-worse). sa key=/why=: the stale ack's ledger hash / target-gone (names nothing now) or finding-gone (no longer fires). r members=/tokens=: a duplication row's clone group (member ids) / their shared normalized-token count. --> -<quality-delta schema="ripwire.quality-delta/v1" baseline="git-HEAD" regressions="8" minor="1" acked="1" stale="202" preexisting-worse="5" new-symbol="3" gating="4" register-macro-excluded="63" api-new-surface="2" at="914c4045d+dirty" renames="68" rename_window_commits="400" acked_by_rename="0" acke … [line truncated: 99 more bytes on this line] +<quality-delta schema="ripwire.quality-delta/v1" baseline="git-HEAD" regressions="8" minor="1" acked="1" stale="202" preexisting-worse="5" new-symbol="3" gating="4" register-macro-excluded="63" api-new-surface="2" at="147c73293+dirty" renames="68" rename_window_commits="400" acked_by_rename="0" acke … [line truncated: 99 more bytes on this line] <r kind="complexity" sym="src/infra/sortutil.h::rw::sortutil::lessByScoreDescId" was="1" now="67" bar="15" p="src/infra/sortutil.h:62" gating="1" next="--expand=src/infra/sortutil.h:lessByScoreDescId"/> <r kind="dead-code" sym="src/infra/sortutil.h::rw::sortutil::nonNegativeFloatAscKeyCopy" origin="new-symbol" p="src/infra/sortutil.h:132"/> <r kind="dead-code" sym="src/infra/sortutil.h::rw::sortutil::sortScoredIdsWithOptions" origin="new-symbol" p="src/infra/sortutil.h:142"/> @@ -6820,11 +6878,11 @@ ripwire: --ack-only=SUBSTR narrows --quality-ack — pass both (e.g. ripwire <di *A real contract-change: was=1 now=2 params, with the call sites that are now provably incompatible, and a pasteable next= (--uses=SYM) on the root.* -**wall time: 3.36s** +**wall time: 2.41s** ````` <!-- ripwire edit-check schema=ripwire.edit-check/v1: sym='s contract NOW vs HEAD: status=unchanged|new-symbol|contract-change; <c n= p= incompatible=1 sites_l=> callers. counts_floor=1: every count is a FLOOR, never a total. graph_ambiguous=/graph_unresolved=: resolver gauge. graph_unindexed=N: N files no grammar could read (the map header's unindexed=); their calls raise neither gauge. est_tokens=: price as emitted (an upper bound under compact). at=: commit+dirty+shallow. root=: p= relative to it. next=: the one pasteable follow-up. defs=N: overloads at this site (same file, scope, name) folded into one contract; params compared by MAX. callers=N: callers of sym= (the c rows' total; a floor). t=: sym='s kind (fn|cls|...). --> -<edit-check schema="ripwire.edit-check/v1" sym="nonNegativeFloatDescKey" t="fn" p="src/infra/sortutil.h:122" status="contract-change" defs="1" params_was="1" params_now="2" public_was="1" public_now="1" defs_was="1" defs_now="1" change="params,broken-callers" callers="4" incompatible="4" at="914c404 … [line truncated: 161 more bytes on this line] +<edit-check schema="ripwire.edit-check/v1" sym="nonNegativeFloatDescKey" t="fn" p="src/infra/sortutil.h:122" status="contract-change" defs="1" params_was="1" params_now="2" public_was="1" public_now="1" defs_was="1" defs_now="1" change="params,broken-callers" callers="4" incompatible="4" at="147c732 … [line truncated: 161 more bytes on this line] <c n="benchScores" p="bench/bench_radix_ab.cpp:133" incompatible="1" sites_l="146,152"/> <c n="benchAdaptive" p="bench/bench_radix_ab.cpp:157" incompatible="1" sites_l="162"/> <c n="radixSortNonNegativeFloatsDesc" p="src/infra/sortutil.h:151" incompatible="1" sites_l="160"/> @@ -6836,11 +6894,11 @@ ripwire: --ack-only=SUBSTR narrows --quality-ack — pass both (e.g. ripwire <di *The same verdict under --legend=full: the default's one compact comment (the post-edit reflex at its cheapest) becomes ~5.7 KB of prose legend, every <c incompatible=> row identical.* -**wall time: 1.77s** +**wall time: 1.65s** ````` <!-- ripwire edit-check: SYM's contract (param count + publicness) NOW vs git HEAD — unchanged/new-symbol/contract-change, or no-baseline when the root has no git HEAD to compare against (not a repository, or no commit yet): then NOTHING is claimed about the contract, and a symbol is never called new for want of a baseline — plus its 1-hop callers. A caller is flagged incompatible="1" when its argument count was reliably counted and NO definition in the folded set could accept it: every one has a FIXED arity that disagrees. A variadic, defaulted or implicit-receiver definition (a Python/Ruby method, whose params counts the self/cls the call site never writes) has no fixed arity and is never flagged. That makes the ARITY half one-sided — a call the compared definitions could accept is never flagged — but it is NOT a proof that the call site binds to THIS definition. Call edges are matched by NAME, so a receiver-qualified call to a same-named callee this tool does not index (a standard-library or third-party method) is measured against the one definition it does index; a clean, compiling tree can therefore carry a nonzero incompatible= with nothing edited at all, and on a widely-shared name it can be most of that name's callers. Read incompatible= as a fact about the tree as it stands — call sites worth OPENING, not a verdict — and status= as a fact about the edit. Warm path hits the qheadsnap/qsnap cache — never a full quality-delta style recompute. defs= is how many DEFINITIONS at this site (same file, same scope, same name — the overload set) are folded into this one contract; a selector matching more than one SITE is refused instead, so defs= only ever counts overloads. params_was and params_now are the MAX over that set on each side (the same MAX the baseline snapshot stores), and publicness is the OR. That MAX has TWO consequences, in opposite directions. It can read like a break and not be one: adding a WIDER overload beside an unchanged one raises params_now with no existing definition altered, so it reports status="contract-change" with incompatible="0" and a def row still carrying the old parameter count — no seen caller breaks. And it can read like safety and not be: REMOVING an overload whose parameter count is BELOW the MAX moves neither number, because the MAX survives on both sides, while the call site that used the removed definition no longer binds. defs_was=/defs_now= is what closes that: the count of definitions sharing this symbol's DEFINITION SITE — same file, same scope, same name — on each side. That is the population the baseline snapshot buckets by, so the two numbers answer the same question and are equal on an unedited tree. A same-named definition in ANOTHER FILE is a different contract and is counted on neither side, so defs_now= agrees with the root's defs= by construction and only defs_was= can move it. status is therefore the join of THREE was-vs-now facts — the params MAX, publicness, and the definition COUNT — and change= names which of them carried it. change= adds broken-callers when a seen caller is also flagged, but never on its own — for the reason stated at the top: incompatible= describes the TREE and status= describes the EDIT, so a headline must not turn on it. RESIDUAL: an overload whose arity changes BELOW the MAX while the COUNT stays the same moves none of the three. The root's incompatible= is the COUNT of flagged callers (a c row's incompatible="1" is the per-caller flag). sites_l= rides on a flagged row only: a c row's p= is where that CALLER is DEFINED, and sites_l= is the ascending LINE list of its call-role reference sites to this name — the lines to open, the same rows the uses verb prints, including the ones whose argument count could not be counted (so sites_l= can be wider than the evidence the flag rests on). Two calls on one line are ONE site. p= is the definition the selector resolved to; when defs is above 1 EVERY folded definition is listed as its own def row (p=, t=, params=), which is what tells a widened single definition apart from an added overload. At defs="1" no def row is emitted: the root's own p=/t= is that definition, and params_now is its parameter count. next= is the one pasteable follow-up: on a contract-change the uses verb on SYM (the call sites), otherwise the test gate on the definition's file. est_tokens= prices THIS document, through the tool's ONE emitted-bytes estimator. counts_floor="1" means every count here is a FLOOR, never a total: edges are extracted from source TEXT by NAME. Missing: dynamic dispatch (virtual/interface/duck-typed), a most-vexing-parse declaration with no call expression, a function-pointer/callback bound to more than one function in scope (reassigned, table-indexed, lambda-bound, or address-taken/reference-bound), and a plain-name binding (fp=handler) whose variable type is not PROVABLY a function pointer (a same-file typedef/declarator; a HEADER typedef is missed; auto/template types are read as unpinned, so KEPT). A macro-generated call site is role="macro" only when its name uniquely names an indexed function-like #define (C-family, t="macro"); a shared name stays a plain call, an unindexed macro is no edge. Read a zero as "none found", never as "none exists". graph_ambiguous=/graph_unresolved= are the whole graph's resolver gauge (calls split over several defs / calls whose in-repo defs were all language-filtered), the map header's ambiguous=/unresolved=. graph_unindexed=N is a third gauge: files no grammar could read (the map header's unindexed=), whose calls raise neither gauge above; absent when zero, and so is this sentence. COUNTING UNIT differs by verb: callers, callees, edit-check, graph-query and pr-context counts are DISTINCT SYMBOLS (repeated calls from one caller, and calls to two overloads, collapse into ONE row; multiplicity survives only in the call graph's edge weight). The reach counts (impact's reaches=, pr-context's dependents=) are the size of a transitive reach SET, each symbol counted once. The uses verb counts call SITES, one row per occurrence — a larger count there for the same symbol is these units agreeing, not disagreeing. The map header's edges= is a unit again different — distinct (caller,callee) PAIRS — and that document carries neither this marker nor this clause. --> -<edit-check sym="nonNegativeFloatDescKey" t="fn" p="src/infra/sortutil.h:122" status="contract-change" defs="1" params_was="1" params_now="2" public_was="1" public_now="1" defs_was="1" defs_now="1" change="params,broken-callers" callers="4" incompatible="4" at="914c4045d+dirty" graph_ambiguous="3984 … [line truncated: 131 more bytes on this line] +<edit-check sym="nonNegativeFloatDescKey" t="fn" p="src/infra/sortutil.h:122" status="contract-change" defs="1" params_was="1" params_now="2" public_was="1" public_now="1" defs_was="1" defs_now="1" change="params,broken-callers" callers="4" incompatible="4" at="147c73293+dirty" graph_ambiguous="3984 … [line truncated: 131 more bytes on this line] <c n="benchScores" p="bench/bench_radix_ab.cpp:133" incompatible="1" sites_l="146,152"/> <c n="benchAdaptive" p="bench/bench_radix_ab.cpp:157" incompatible="1" sites_l="162"/> <c n="radixSortNonNegativeFloatsDesc" p="src/infra/sortutil.h:151" incompatible="1" sites_l="160"/> @@ -6852,11 +6910,11 @@ ripwire: --ack-only=SUBSTR narrows --quality-ack — pass both (e.g. ripwire <di *The review-evidence bundle with an actual changed file.* -**wall time: 4.21s** +**wall time: 5.56s** ````` <!-- ripwire pr-context schema=ripwire.pr-context/v1: review bundle per changed file vs base=: symbols, callers, blast radius, tests, owners. window: shown= capped= (capped=1 cut). counts_floor=1: every count is a FLOOR, never a total. graph_ambiguous=/graph_unresolved=: resolver gauge. graph_unindexed=N: N files no grammar could read (the map header's unindexed=); their calls raise neither gauge. run_unknown=1: no runner derivable (a guess would be worse). <g n= p=a,b,c>: 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). 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). 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). 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. --> -<pr-context schema="ripwire.pr-context/v1" base="working-tree" root="." direction="worktree-since-head" files="1" skipped_mode_only="0" budget_tokens="8000" est_tokens="4090" trim_level="0" truncated="none" budget_default="1" at="914c4045d+dirty" graph_ambiguous="3984" graph_unresolved="20100" graph … [line truncated: 34 more bytes on this line] +<pr-context schema="ripwire.pr-context/v1" base="working-tree" root="." direction="worktree-since-head" files="1" skipped_mode_only="0" budget_tokens="8000" est_tokens="4090" trim_level="0" truncated="none" budget_default="1" at="147c73293+dirty" graph_ambiguous="3984" graph_unresolved="20100" graph … [line truncated: 34 more bytes on this line] <file p="src/infra/sortutil.h" symbols="14"> <impact dependents="1049" files="148" files_other="148" shown="20" capped="1"> <f p="src/graph.h" deps="62"/> @@ -6892,7 +6950,7 @@ ripwire: --ack-only=SUBSTR narrows --quality-ack — pass both (e.g. ripwire <di *The map re-ranked with a teleport toward the changed file (changed=1 here, not 0).* -**wall time: 2.70s** +**wall time: 3.35s** ````` <!-- ripwire map-diff schema=ripwire.map-diff/v1: the ranked map anchored at at=: what the diff touched, the map's row vocabulary. est_tokens=: price as emitted (an upper bound under compact). at=: commit+dirty+shallow. root=: p= relative to it. pr_iters=N: PageRank iterations. 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. 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). changed=K: K indexed git-changed files seed the PageRank teleport (0: uniform, incl. no git). 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. sc=: enclosing scope; the full id is p::sc::n (p= of the row or its <f>) 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. --> @@ -6900,7 +6958,7 @@ ripwire: --ack-only=SUBSTR narrows --quality-ack — pass both (e.g. ripwire <di <!-- t=type|alias|functype=a-Go-named-type-by-its-written-form:type=a-defined-type-whose-WRITTEN-form-is-not-a-struct/iface/func-literal(type-N-string;type-W-Pair-too,whatever-Pair-is-underneath),alias=type-A=B,functype=type-F-func(...) --> <!-- t=alias|functype-in-C++-and-.h:alias=using-X=Y(also-templated-or-class-scope)or-namespace-L=lib(defs=X-prints-its-written-target-as-to=),functype=a-typedef-of-a-function-or-function-pointer-type(typedef-void(*F)(int));other-typedefs-read-t=struct --> <!-- files=4852 symbols=45033 edges=45382 shown=5 est_tokens=1352 ambiguous=3984 unresolved=20100 locality_pinned=14 external=12460 declined=45310 extent_suspect_syms=12 macro_blanked_files=7 changed=1 skipped_oversize=15 unindexed="txt:85,tsv:54,mod:33,xml:33,jsonl:26,scm:25" unindexed_exts=23 order=important-first --> -<r schema="ripwire.map-diff/v1" at="914c4045d+dirty" root="." est_tokens="1352" pr_iters="29"> +<r schema="ripwire.map-diff/v1" at="147c73293+dirty" root="." est_tokens="1352" pr_iters="29"> <f p="src/infra/sortutil.h" layer="infra"> <s t="fn" n="radixSortByScoreDescId" sc="rw::sortutil" k="0.0913"> <c n="lessByScoreDescId"/> @@ -6925,7 +6983,7 @@ ripwire: --ack-only=SUBSTR narrows --quality-ack — pass both (e.g. ripwire <di *The duplicated helper the sandbox edit introduced shows up as a clone group.* -**wall time: 1.54s** +**wall time: 2.48s** ````` <!-- ripwire clones schema=ripwire.clones/v1: similar normalized-token bodies: <group type=2|3 gid= tokens= n= similarity=> of <f n= p=>; 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, call-sequence. --> @@ -6965,12 +7023,12 @@ ripwire: --ack-only=SUBSTR narrows --quality-ack — pass both (e.g. ripwire <di *CHANGED: a ref with NO merge base with HEAD now reports v="unknown" ok="0" in its own bucket — the absence of an answer, never a claim it is merged. (The sandbox carries a deliberately parentless branch built with `git commit-tree`; a shallow CI clone puts every ref here.)* -**wall time: 1.97s** +**wall time: 2.73s** ````` <!-- ripwire stray-content schema=ripwire.stray-content/v1: per local ref, lines/symbols NOT in HEAD: <ref ok= v= base= stray=>; 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. --> -<stray-content schema="ripwire.stray-content/v1" head="914c4045d" head_ref="integration/train-ge3" refs="1" blobs="0" unmerged="0" superseded="0" merged="0" unknown="1" filter="zz-orphan" at="914c4045d+dirty"> -<ref name="zz-orphan-lane" tip="a1d9e28a6" date="2026-11-22" base="" ok="0" v="unknown" stray="0" files="0" superseded="0"> +<stray-content schema="ripwire.stray-content/v1" head="147c73293" head_ref="integration/train-ge3" refs="1" blobs="0" unmerged="0" superseded="0" merged="0" unknown="1" filter="zz-orphan" at="147c73293+dirty"> +<ref name="zz-orphan-lane" tip="df6e2c92d" date="2026-11-22" base="" ok="0" v="unknown" stray="0" files="0" superseded="0"> </ref> </stray-content> ````` @@ -6985,11 +7043,11 @@ stderr: *CHANGED: --plan surfaces those same refs as an <undetermined> row rather than silently dropping them.* -**wall time: 2.73s** +**wall time: 3.03s** ````` <!-- ripwire landing-plan schema=ripwire.landing-plan/v1: stranded-work landing order across refs, fewest conflicts first. at=: commit+dirty+shallow. --> -<landing-plan schema="ripwire.landing-plan/v1" head="914c4045d" refs="1" unmerged="0" superseded="0" merged="0" undetermined="1" scouted="0" bounded="0" scout-ok="1" at="914c4045d+dirty"> +<landing-plan schema="ripwire.landing-plan/v1" head="147c73293" refs="1" unmerged="0" superseded="0" merged="0" undetermined="1" scouted="0" bounded="0" scout-ok="1" at="147c73293+dirty"> <undetermined name="zz-orphan-lane" v="unknown" reason="no merge base with HEAD (shallow clone or unrelated history) — this ref could not be analysed, it is NOT known to be merged; deepen the clone and re-run"/> </landing-plan> ````` @@ -7004,11 +7062,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: 5.82s** +**wall time: 6.47s** ````` <!-- ripwire dmm schema=ripwire.dmm/v1: Delta Maintainability Model base=→target=: dmm= good/(good+bad) units by size_metric=; <p k= dmm= good= bad= d_low= d_high=>. at=: commit+dirty+shallow. available=0: no score at all (dmm=UNAVAILABLE, reason= says why); never read as 1.000 or 0.000. combine=pooled: root dmm= is summed good over summed good+bad of the 3 properties (ripwire's own). low_loc=/low_cx=/low_params=: a unit is LOW risk at or under these lines / cyclomatic / params. base_units=/base_volume=/target_units=/target_volume=: units with a body and their line span per side. --> -<dmm schema="ripwire.dmm/v1" base="914c4045d08e71e6e6ad23e8a9a1a6b490679aee" target="working-tree" at="914c4045d+dirty" available="1" combine="pooled" size_metric="physical-loc" low_loc="15" low_cx="5" low_params="2" dmm="0.142" good="23" bad="139" base_units="25297" base_volume="333518" target_unit … [line truncated: 33 more bytes on this line] +<dmm schema="ripwire.dmm/v1" base="147c732930f6ea42d5f4c57ff6e09108302c089b" target="working-tree" at="147c73293+dirty" available="1" combine="pooled" size_metric="physical-loc" low_loc="15" low_cx="5" low_params="2" dmm="0.142" good="23" bad="139" base_units="25297" base_volume="333518" target_unit … [line truncated: 33 more bytes on this line] <p k="size" dmm="0.130" good="7" bad="47" d_low="7" d_high="47"/> <p k="complexity" dmm="0.130" good="7" bad="47" d_low="7" d_high="47"/> <p k="interfacing" dmm="0.167" good="9" bad="45" d_low="9" d_high="45"/> @@ -7019,11 +7077,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 <out-of-scope> with a do-not-ack banner and never gate — scoped-out-gating= says how many would have.* -**wall time: 16.50s** +**wall time: 20.13s** ````` <!-- ripwire quality-delta schema=ripwire.quality-delta/v1: only what the change made WORSE vs baseline=: regressions= minor= gating=; <r kind= sym= p= was= now= gating= bar=>, <sa> acked. value-ref-excluded=N: internal functions kept off because a table, field or argument in another function or at file scope holds them (matched by name, not a proven call); a floor. at=: commit+dirty+shallow. stale=N: ack ledger rows whose target no longer applies (sa rows); never gating. preexisting-worse=N: regressions on symbols that existed at baseline; they gate when major. new-symbol=N: NEW code; new-symbol rows never gate, except defect-shape format-arity, ceiling=, tangle. register-macro-excluded=N: symbols skipped: self-registering test/bench macros or Rust #[test]; a floor. declined-call-excluded=N: symbols kept out of dead-code only because a declined call may mean them; a floor. api-new-surface=N: new PUBLIC symbols; a count, never gates, not in regressions=. renames=/rename_window_commits=: git rename pairs read over that many commits, to re-file baseline and acks. acked_by_rename=/acked_by_content=: acked= suppressions matched via git renames / an equal body hash. renames_window_truncated=1: history is deeper than the rename window, older renames unread. r surface=: the api-surface tier, new-symbol or contract-change. acked=N: findings suppressed by the ack ledger, listed as sa rows; never gating. r sev=minor: a small numeric delta, counted in minor=, never gating (absent: major). r origin=new-symbol: a finding on NEW code; moved: its body left another name or file, never gating (absent: preexisting-worse). sa key=/why=: the stale ack's ledger hash / target-gone (names nothing now) or finding-gone (no longer fires). r members=/tokens=: a duplication row's clone group (member ids) / their shared normalized-token count. --> -<quality-delta schema="ripwire.quality-delta/v1" baseline="git-HEAD" regressions="0" minor="0" acked="0" stale="202" preexisting-worse="0" new-symbol="0" gating="0" register-macro-excluded="63" api-new-surface="2" at="914c4045d+dirty" renames="68" rename_window_commits="400" acked_by_rename="0" acke … [line truncated: 156 more bytes on this line] +<quality-delta schema="ripwire.quality-delta/v1" baseline="git-HEAD" regressions="0" minor="0" acked="0" stale="202" preexisting-worse="0" new-symbol="0" gating="0" register-macro-excluded="63" api-new-surface="2" at="147c73293+dirty" renames="68" rename_window_commits="400" acked_by_rename="0" acke … [line truncated: 156 more bytes on this line] <out-of-scope n="9" would-gate="4" note="not yours - do not ack: these rows lie outside the scope this run named. They are disclosed rather than hidden, they never gate this exit code, and the ack refuses to write them."> <r kind="api-surface" sym="src/infra/sortutil.h::rw::sortutil::nonNegativeFloatDescKey" was="1" now="2" surface="contract-change" p="src/infra/sortutil.h:122"/> <r kind="complexity" sym="src/infra/sortutil.h::rw::sortutil::lessByScoreDescId" was="1" now="67" bar="15" p="src/infra/sortutil.h:62"/> @@ -7065,7 +7123,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: 12.50s** +**exit code: 1** — **wall time: 14.73s** ````` (empty) @@ -7085,11 +7143,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.81s** +**wall time: 4.82s** ````` <!-- ripwire handoff schema=ripwire.handoff/v1: continuation packet for the NEXT session: <verified changed= blast_files=>, <tests n=>, <heuristic n= candidates=>, <note>, <doc p=>. window: capped= (capped=1 cut). run_unknown=1: no runner derivable (a guess would be worse). est_tokens=: price as emitted (an upper bound under compact). at=: commit+dirty+shallow. root=: p= relative to it. branch=/subject=: the checked out branch and HEAD commit subject; gitok=0: the git diff probe failed, changed counts are floors. cochange_window=/cochange_commits=: the git window the cochange rows were mined in and the commits it held (0: could not look). doc s=: lexical score of that plan/design doc for the branch+subject query. t run=: the command that runs that test (run_unknown=1: none derivable). --> -<handoff schema="ripwire.handoff/v1" at="914c4045d+dirty" root="." branch="integration/train-ge3" subject="showcase: the 11-20 capture stays main's; the train re-records once at its tip" gitok="1" est_tokens="1146"> +<handoff schema="ripwire.handoff/v1" at="147c73293+dirty" root="." branch="integration/train-ge3" subject="showcase: the --compress demo expands collapseBlankLineRuns (compressBody is now a one-line pipeline)" gitok="1" est_tokens="1140"> <verified changed="1" blast_files="148"> <f p="src/infra/sortutil.h"> <s n="svCompare"/> @@ -7118,15 +7176,17 @@ ripwire: --ack-only=api-surface selects 1 finding(s) OUT OF SCOPE for --scope=sr <t p="test/shstatus_harness.cpp" run="bash test/gateexitcheck.sh"/> <t p="test/type3clone_harness.cpp" run="bash test/type3clonecheck.sh"/> <t p="test/includeprecise_unit.cpp" run="bash test/includeprecisecheck.sh"/> -… [11 more display lines; full output is 2710 bytes on 1 raw line(s)] +… [11 more display lines; full output is 2697 bytes on 1 raw line(s)] ````` ## `./build/ripwire . --note-add="lessByScoreDescId: keep this branch-free — it sits inside the PageRank sort comparator"` *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.18s** + ````` -src/infra/sortutil.h::rw::sortutil::lessByScoreDescId 2026-11-22 keep this branch-free — it sits inside the PageRank sort comparator 914c4045d08e71e6e6ad23e8a9a1a6b490679aee integration/train-ge3 +src/infra/sortutil.h::rw::sortutil::lessByScoreDescId 2026-11-22 keep this branch-free — it sits inside the PageRank sort comparator 147c732930f6ea42d5f4c57ff6e09108302c089b integration/train-ge3 ````` stderr: @@ -7151,7 +7211,7 @@ ripwire: --note-add: target 'lessByScoreDescId' canonicalised to 'src/infra/sort </note> </target> <target id="src/infra/sortutil.h::rw::sortutil::lessByScoreDescId" dangling="0"> -<note d="2026-11-22" sha="914c404" branch="integration/train-ge3"> +<note d="2026-11-22" sha="147c732" branch="integration/train-ge3"> <![CDATA[keep this branch-free — it sits inside the PageRank sort comparator]]> </note> </target> @@ -7185,7 +7245,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.65s** ````` (empty) @@ -7202,8 +7262,10 @@ 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: 1.89s** + ````` -src/infra/sortutil.h::rw::sortutil::lessByScoreDescId 2026-11-22 chose the flat two-branch compare over the nested ladder because the comparator sits inside the PageRank sort 914c4045d08e71e6e6ad23e8a9a1a6b490679aee integration/train-ge3 +src/infra/sortutil.h::rw::sortutil::lessByScoreDescId 2026-11-22 chose the flat two-branch compare over the nested ladder because the comparator sits inside the PageRank sort 147c732930f6ea42d5f4c57ff6e09108302c089b integration/train-ge3 ````` ## `./build/ripwire . --expand=lessByScoreDescId --top-k=0` @@ -7247,10 +7309,10 @@ src/infra/sortutil.h::rw::sortutil::lessByScoreDescId 2026-11-22 chose the flat The <note> element on the same output — past the 30-line display cut above: ````` -<note d="2026-11-22" sha="914c404" branch="integration/train-ge3"> +<note d="2026-11-22" sha="147c732" branch="integration/train-ge3"> <![CDATA[chose the flat two-branch compare over the nested ladder because the comparator sits inside the PageRank sort]]> </note> -<note d="2026-11-22" sha="914c404" branch="integration/train-ge3"> +<note d="2026-11-22" sha="147c732" branch="integration/train-ge3"> <![CDATA[keep this branch-free — it sits inside the PageRank sort comparator]]> </note> ````` @@ -7275,7 +7337,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: 9.06s** +**wall time: 9.28s** Input file: @@ -7310,7 +7372,7 @@ inline bool lessByScoreDescId( const std::vector<float>& scores, std::uint32_t a stderr: ````` -ripwire: cache <tmp>: 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) +ripwire: cache <tmp>: over its 2048 MiB budget — evicted 73 blob(s) of other roots or other ripwire builds (this build's blobs for this root are kept) ripwire edit: applied atomically; receipt carries region, blob_sha, edit_check, tests_to_run; next: bash test/greptiercheck.sh ````` @@ -7318,15 +7380,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: 2.65s** +**wall time: 2.57s** ````` <!-- ripwire edit-check schema=ripwire.edit-check/v1: sym='s contract NOW vs HEAD: status=unchanged|new-symbol|contract-change; <c n= p= incompatible=1 sites_l=> callers. counts_floor=1: every count is a FLOOR, never a total. graph_ambiguous=/graph_unresolved=: resolver gauge. graph_unindexed=N: N files no grammar could read (the map header's unindexed=); their calls raise neither gauge. est_tokens=: price as emitted (an upper bound under compact). at=: commit+dirty+shallow. root=: p= relative to it. next=: the one pasteable follow-up. defs=N: overloads at this site (same file, scope, name) folded into one contract; params compared by MAX. callers=N: callers of sym= (the c rows' total; a floor). t=: sym='s kind (fn|cls|...). --> -<edit-check schema="ripwire.edit-check/v1" sym="lessByScoreDescId" t="fn" p="src/infra/sortutil.h:62" status="unchanged" defs="1" callers="4" incompatible="0" at="914c4045d+dirty" graph_ambiguous="3984" graph_unresolved="20100" graph_unindexed="313" counts_floor="1" root="." next="--test-gate=src/in … [line truncated: 33 more bytes on this line] -<note d="2026-11-22" sha="914c404" branch="integration/train-ge3"> +<edit-check schema="ripwire.edit-check/v1" sym="lessByScoreDescId" t="fn" p="src/infra/sortutil.h:62" status="unchanged" defs="1" callers="4" incompatible="0" at="147c73293+dirty" graph_ambiguous="3984" graph_unresolved="20100" graph_unindexed="313" counts_floor="1" root="." next="--test-gate=src/in … [line truncated: 33 more bytes on this line] +<note d="2026-11-22" sha="147c732" branch="integration/train-ge3"> <![CDATA[chose the flat two-branch compare over the nested ladder because the comparator sits inside the PageRank sort]]> </note> -<note d="2026-11-22" sha="914c404" branch="integration/train-ge3"> +<note d="2026-11-22" sha="147c732" branch="integration/train-ge3"> <![CDATA[keep this branch-free — it sits inside the PageRank sort comparator]]> </note> <c n="benchScores" p="bench/bench_radix_ab.cpp:133"/> @@ -7340,7 +7402,7 @@ 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: 4.46s** +**wall time: 6.59s** ````` {"applied":"insert_after_symbol","symbol":"lessByScoreDescId","file":"src/infra/sortutil.h","span":{"start":3136,"end":3224},"lines":{"start":69,"end":71},"replaced_bytes":0,"old_file_bytes":9174,"new_file_bytes":9262,"file_eol":"lf","eol_normalized":false,"trailing_newline_folded":true,"separator_p … [line truncated: 650 more bytes on this line] @@ -7369,7 +7431,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.41s** +**wall time: 5.10s** ````` {"applied":"insert_after_symbol","symbol":"lessByScoreDescId","file":"src/infra/sortutil.h","span":{"start":3136,"end":3224},"lines":{"start":69,"end":71},"replaced_bytes":0,"old_file_bytes":9262,"new_file_bytes":9350,"file_eol":"lf","eol_normalized":false,"trailing_newline_folded":true,"separator_p … [line truncated: 570 more bytes on this line] @@ -7385,7 +7447,7 @@ 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: 7.81s** +**wall time: 6.48s** ````` {"applied":"insert_before_symbol","symbol":"nonNegativeFloatDescKey","file":"src/infra/sortutil.h","span":{"start":3656,"end":3744},"lines":{"start":87,"end":88},"replaced_bytes":0,"old_file_bytes":9350,"new_file_bytes":9438,"file_eol":"lf","eol_normalized":false,"trailing_newline_folded":false,"sep … [line truncated: 753 more bytes on this line] @@ -7417,7 +7479,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: 3.83s** +**exit code: 1** — **wall time: 2.62s** ````` (empty) @@ -7433,7 +7495,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.16s** +**wall time: 3.82s** Input file: @@ -7458,7 +7520,7 @@ Input file: *The same plan committed: per-file locks, re-verify-before-write, atomic rename, rollback on a later failure.* -**wall time: 5.58s** +**wall time: 8.48s** ````` {"schema":"ripwire.edit-plan/v1","mode":"apply","edits":1,"files":1,"callers_union":4,"graph_ambiguous":3984,"graph_unresolved":20100,"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: 585 more bytes on this line] @@ -7488,11 +7550,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: 18.97s** +**exit code: 2** — **wall time: 16.92s** ````` <!-- ripwire quality-delta schema=ripwire.quality-delta/v1: only what the change made WORSE vs baseline=: regressions= minor= gating=; <r kind= sym= p= was= now= gating= bar=>, <sa> acked. value-ref-excluded=N: internal functions kept off because a table, field or argument in another function or at file scope holds them (matched by name, not a proven call); a floor. at=: commit+dirty+shallow. next=: the one pasteable follow-up. stale=N: ack ledger rows whose target no longer applies (sa rows); never gating. preexisting-worse=N: regressions on symbols that existed at baseline; they gate when major. new-symbol=N: NEW code; new-symbol rows never gate, except defect-shape format-arity, ceiling=, tangle. register-macro-excluded=N: symbols skipped: self-registering test/bench macros or Rust #[test]; a floor. declined-call-excluded=N: symbols kept out of dead-code only because a declined call may mean them; a floor. api-new-surface=N: new PUBLIC symbols; a count, never gates, not in regressions=. renames=/rename_window_commits=: git rename pairs read over that many commits, to re-file baseline and acks. acked_by_rename=/acked_by_content=: acked= suppressions matched via git renames / an equal body hash. renames_window_truncated=1: history is deeper than the rename window, older renames unread. acked=N: findings suppressed by the ack ledger, listed as sa rows; never gating. r origin=new-symbol: a finding on NEW code; moved: its body left another name or file, never gating (absent: preexisting-worse). sa key=/why=: the stale ack's ledger hash / target-gone (names nothing now) or finding-gone (no longer fires). r members=/tokens=: a duplication row's clone group (member ids) / their shared normalized-token count. --> -<quality-delta schema="ripwire.quality-delta/v1" baseline="git-HEAD" regressions="5" minor="0" acked="1" stale="202" preexisting-worse="2" new-symbol="3" gating="2" register-macro-excluded="63" api-new-surface="2" at="914c4045d+dirty" renames="68" rename_window_commits="400" acked_by_rename="0" acke … [line truncated: 99 more bytes on this line] +<quality-delta schema="ripwire.quality-delta/v1" baseline="git-HEAD" regressions="5" minor="0" acked="1" stale="202" preexisting-worse="2" new-symbol="3" gating="2" register-macro-excluded="63" api-new-surface="2" at="147c73293+dirty" renames="68" rename_window_commits="400" acked_by_rename="0" acke … [line truncated: 99 more bytes on this line] <r kind="dead-code" sym="src/infra/sortutil.h::rw::sortutil::nonNegativeFloatAscKeyCopy" origin="new-symbol" p="src/infra/sortutil.h:101"/> <r kind="dead-code" sym="src/infra/sortutil.h::rw::sortutil::sortScoredIdsWithOptions" origin="new-symbol" p="src/infra/sortutil.h:111"/> <r kind="duplication" members="src/infra/sortutil.h::rw::sortutil::nonNegativeFloatAscKeyCopy | src/infra/sortutil.h::rw::sortutil::nonNegativeFloatDescKey" tokens="59" p="src/infra/sortutil.h:101" gating="1"/> @@ -7535,7 +7597,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: 14.48s** +**exit code: 1** — **wall time: 14.11s** ````` (empty) @@ -7554,7 +7616,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: 20.34s** +**wall time: 18.89s** ````` (empty) @@ -7570,10 +7632,10 @@ ripwire: wrote ./.ripwire_quality_baseline (snapshot of 42855 per-symbol rows, 4 Artifact written: ````` - 8965615 .ripwire_quality_baseline + 8965619 .ripwire_quality_baseline # ripwire quality baseline v6 — regenerate with --quality-baseline; do not hand-edit producer 7f2bbf2e86d5e6116c232bed7599e37a11acce6fcf131765068af96b0e63fc52 -head 914c4045d08e71e6e6ad23e8a9a1a6b490679aee +head 147c732930f6ea42d5f4c57ff6e09108302c089b dirty 1 absorbed 2 ccx 67c15011ee8b 0 @@ -7586,11 +7648,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: 16.41s** +**wall time: 16.58s** ````` <!-- ripwire quality-delta schema=ripwire.quality-delta/v1: only what the change made WORSE vs baseline=: regressions= minor= gating=; <r kind= sym= p= was= now= gating= bar=>, <sa> acked. value-ref-excluded=N: internal functions kept off because a table, field or argument in another function or at file scope holds them (matched by name, not a proven call); a floor. at=: commit+dirty+shallow. stale=N: ack ledger rows whose target no longer applies (sa rows); never gating. stale_by_kind=: stale= split by ack kind (kind:N,...); the sa rows are collapsed. stale_next=: the call printing the sa rows and the full header. preexisting-worse=N: regressions on symbols that existed at baseline; they gate when major. new-symbol=N: NEW code; new-symbol rows never gate, except defect-shape format-arity, ceiling=, tangle. register-macro-excluded=N: symbols skipped: self-registering test/bench macros or Rust #[test]; a floor. declined-call-excluded=N: symbols kept out of dead-code only because a declined call may mean them; a floor. api-new-surface=N: new PUBLIC symbols; a count, never gates, not in regressions=. renames=/rename_window_commits=: git rename pairs read over that many commits, to re-file baseline and acks. acked_by_rename=/acked_by_content=: acked= suppressions matched via git renames / an equal body hash. renames_window_truncated=1: history is deeper than the rename window, older renames unread. acked=N: findings suppressed by the ack ledger, listed as sa rows; never gating. --> -<quality-delta schema="ripwire.quality-delta/v1" baseline="sidecar" regressions="0" minor="0" acked="0" stale="202" preexisting-worse="0" new-symbol="0" gating="0" register-macro-excluded="63" api-new-surface="0" at="914c4045d+dirty" renames="68" rename_window_commits="400" acked_by_rename="0" acked … [line truncated: 319 more bytes on this line] +<quality-delta schema="ripwire.quality-delta/v1" baseline="sidecar" regressions="0" minor="0" acked="0" stale="202" preexisting-worse="0" new-symbol="0" gating="0" register-macro-excluded="63" api-new-surface="0" at="147c73293+dirty" renames="68" rename_window_commits="400" acked_by_rename="0" acked … [line truncated: 319 more bytes on this line] </quality-delta> ````` @@ -7604,7 +7666,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.110+g914c4045d"},"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.113+g147c73293"},"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] @@ -7684,7 +7746,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.110+g914c4045d"},"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.113+g147c73293"},"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: 869 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] @@ -7713,33 +7775,33 @@ quality_delta desc_bytes= 749 schema_bytes= 279 required=[] *MCP `for`: always bundle=sigs (never the CLI's compact route), the same ranked signatures as --for.* -**wall time: 2.59s** +**wall time: 3.73s** ````` -{"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2025-11-25","serverInfo":{"name":"ripwire","version":"0.6.10-dev.110+g914c4045d"},"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":"<ctx task=\"pagerank power iteration\" route=\"subtoken+body\" root=\".\" confidence=\"high\" margin_pct=\"22\" at=\"914c4045d\" doc_mentions=\"4\" doc_mentions_capped=\"1\" doc_mentions_total=\"14\" bundle=\"sigs\" lens=\"churn,amp … [line truncated: 21238 more bytes on this line] -"_index":"[index: files=4852 symbols=45032 hash=8e5a0414]","_fresh":"ok"}} +{"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2025-11-25","serverInfo":{"name":"ripwire","version":"0.6.10-dev.113+g147c73293"},"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":"<ctx task=\"pagerank power iteration\" route=\"subtoken+body\" root=\".\" confidence=\"high\" margin_pct=\"22\" at=\"147c73293\" doc_mentions=\"4\" doc_mentions_capped=\"1\" doc_mentions_total=\"14\" bundle=\"sigs\" lens=\"churn,amp … [line truncated: 21238 more bytes on this line] +"_index":"[index: files=4852 symbols=45032 hash=2e70d871]","_fresh":"ok"}} ````` ## `printf '%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` *--mcp-legend=inline: every answer of the stdio session carries its own legend (the default, session, sends each definition once per session after the first answer).* -**wall time: 26.77s** +**wall time: 28.08s** ````` -{"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2025-11-25","serverInfo":{"name":"ripwire","version":"0.6.10-dev.110+g914c4045d"},"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.113+g147c73293"},"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":"<!-- ripwire whereis schema=ripwire.whereis/v1: every LOCAL ref whose tree holds sym= (refs_scanned=, blobs=), HEAD first: <hit ref= tip= date= p= l= kind= t=>. window: shown= total= capped= has_more= next_offset= offset= limit= (ca … [line truncated: 20711 more bytes on this line] -"_index":"[index: files=4852 symbols=45032 hash=8e5a0414]","_fresh":"ok"}} +"_index":"[index: files=4852 symbols=45032 hash=2e70d871]","_fresh":"ok"}} {"jsonrpc":"2.0","id":3,"result":{"content":[{"type":"text","text":"<!-- ripwire whereis schema=ripwire.whereis/v1: every LOCAL ref whose tree holds sym= (refs_scanned=, blobs=), HEAD first: <hit ref= tip= date= p= l= kind= t=>. window: shown= capped= (capped=1 cut). at=: commit+dirty+shallow. next= … [line truncated: 2425 more bytes on this line] -"_index":"[index: files=4852 symbols=45032 hash=8e5a0414]","_fresh":"ok"}} +"_index":"[index: files=4852 symbols=45032 hash=2e70d871]","_fresh":"ok"}} ````` stderr: ````` ripwire: warning: --whereis read the newest 373 of 655 local branches; 282 older were not read (limit: 2097152 tree entries across all refs, 374 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 404 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 407 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 373 of 655 local branches; 282 older were not read (limit: 2097152 tree entries across all refs, 374 refs with HEAD at this tree's size); pass --detail=1 to read every branch, or narrow the branches with a ref-name filter ````` @@ -7747,34 +7809,34 @@ ripwire: warning: --whereis read the newest 373 of 655 local branches; 282 older *MCP `explore` = --pack-task under a token budget, one call.* -**wall time: 2.78s** +**wall time: 2.12s** ````` -{"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2025-11-25","serverInfo":{"name":"ripwire","version":"0.6.10-dev.110+g914c4045d"},"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.113+g147c73293"},"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":"<ctx schema=\"ripwire.pack-task/v1\" task=\"add a new output format flag to the CLI\" route=\"subtoken+body:declined(add;218-carriers,70-defs)\" root=\".\" dropped_positive=\"2\" est_tokens=\"1432\" budget_tokens=\"2000\"><!-- ripwi … [line truncated: 3842 more bytes on this line] -"_index":"[index: files=4852 symbols=45032 hash=8e5a0414]","_fresh":"ok"}} +"_index":"[index: files=4852 symbols=45032 hash=2e70d871]","_fresh":"ok"}} ````` ## `printf '%s\n' '{"jsonrpc":"2.0","id":1,"method":"initialize"}' '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"fetch_body","arguments":{"path":".","handle":"rankGraphTeleport"}}}' | ./build/ripwire --mcp` *MCP `fetch_body`: the lazy-body handle posture — bodies only after ranked retrieval, by bare name here.* -**wall time: 1.60s** +**wall time: 1.40s** ````` -{"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2025-11-25","serverInfo":{"name":"ripwire","version":"0.6.10-dev.110+g914c4045d"},"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.113+g147c73293"},"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":"{\"resolved_from_name\":\"rankGraphTeleport\",\"handle\":\"sym#cfb3dc25a9d1fa2c@e36277932d593a8b\",\"name\":\"rankGraphTeleport\",\"kind\":\"fn\",\"file\":\"src/graph.h\",\"line\":14921,\"start_line\":1,\"end_line\":29,\"total_lines … [line truncated: 1330 more bytes on this line] -"_index":"[index: files=4852 symbols=45032 hash=8e5a0414]","_fresh":"ok"}} +"_index":"[index: files=4852 symbols=45032 hash=2e70d871]","_fresh":"ok"}} ````` ## `printf '%s\n' '{"jsonrpc":"2.0","id":1,"method":"initialize"}' '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"grep","arguments":{"path":".","pattern":"DISCLOSE","limit":3}}}' | ./build/ripwire --mcp` *MCP `grep` with paging args.* -**wall time: 1.80s** +**wall time: 1.50s** ````` -{"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2025-11-25","serverInfo":{"name":"ripwire","version":"0.6.10-dev.110+g914c4045d"},"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.113+g147c73293"},"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":"{\"pattern\":\"DISCLOSE\",\"root\":\".\",\"files\":292,\"shown\":3,\"capped\":true,\"total\":993,\"has_more\":true,\"next_offset\":3,\"offset\":0,\"limit\":3,\"hits_capped\":false,\"next\":\"--grep=DISCLOSE --offset=3 --legend=compa … [line truncated: 609 more bytes on this line] {\"file\":\"src/abicheck.h\",\"line\":517,\"in\":\"abicheck::collectAuthoredSites\",\"parse_degraded\":true,\"text\":\" DISCLOSE( result, AbiResult::DisclosureWhy::NoMergeBase, \\\"abi: no merge-base for a ref (unrelated history?) — that ref is counted, not compared\\\" );\"}, {\"file\":\"src/arch.h\",\"line\":512,\"in\":\"rw::parseArchRules\",\"text\":\" DISCLOSE( Diagnostics::answerRefused, \\\"--arch exits 1 with path:line and the reason on stderr; no report is printed\\\",\"}],\"parse_degraded_note\":\"a hit carrying parse_degraded:true sits in a file whose par … [line truncated: 465 more bytes on this line] @@ -7782,29 +7844,29 @@ ripwire: warning: --whereis read the newest 373 of 655 local branches; 282 older {\"file\":\"CMakeLists.txt\",\"line\":901}]},\"enclosing\":[{\"n\":\"path_instructions\",\"callers\":0,\"handle_omitted\":\"non-code\"}, {\"n\":\"abicheck::collectAuthoredSites\",\"callers\":1,\"cx\":9,\"handle\":\"sym#1ab32951dcc2d860@336bb5738da2ef84\"}, {\"n\":\"rw::parseArchRules\",\"callers\":2,\"cx\":33,\"handle\":\"sym#f5dd171cfba47899@8ee26f354c3d783f\"}]}"}], -"_index":"[index: files=4852 symbols=45032 hash=8e5a0414]","_fresh":"ok"}} +"_index":"[index: files=4852 symbols=45032 hash=2e70d871]","_fresh":"ok"}} ````` ## `printf '%s\n' '{"jsonrpc":"2.0","id":1,"method":"initialize"}' '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"slice","arguments":{"path":".","symbol":"rankGraphTeleport","var":"teleport","flow":"back","depth":3}}}' | ./build/ripwire --mcp` *MCP `slice` — the CLI's --slice/--slice-flow/--slice-depth as one verb.* -**wall time: 2.36s** +**wall time: 2.54s** ````` -{"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2025-11-25","serverInfo":{"name":"ripwire","version":"0.6.10-dev.110+g914c4045d"},"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.113+g147c73293"},"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":"<!-- ripwire slice schema=ripwire.slice/v1: name-based def-use rows of one variable in one definition: <s l= k=def|use|both|scope t= [b= pp= rd=]> (rd= reaching-def lines per reach=cfg|linear), <v n= l= t=> inventory; steps=/depth= … [line truncated: 1777 more bytes on this line] -"_index":"[index: files=4852 symbols=45032 hash=8e5a0414]","_fresh":"ok"}} +"_index":"[index: files=4852 symbols=45032 hash=2e70d871]","_fresh":"ok"}} ````` ## `printf '%s\n' '{"jsonrpc":"2.0","id":1,"method":"initialize"}' '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"find_symbol","arguments":{"path":".","symbol":"DoesNotExist"}}}' | ./build/ripwire --mcp` *MCP error shape: an unknown symbol comes back as a JSON-RPC error/refusal, not an empty success.* -**wall time: 2.48s** +**wall time: 2.41s** ````` -{"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2025-11-25","serverInfo":{"name":"ripwire","version":"0.6.10-dev.110+g914c4045d"},"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.113+g147c73293"},"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,"error":{"code":-32602,"message":"symbol not found: 'DoesNotExist' — pass the final name segment; add scope to disambiguate — or @FILE:LINE when you hold a location — note: the lexical definition scan stopped at its budget, 4096 files or 16 MiB, before reading every fil … [line truncated: 165 more bytes on this line] ````` @@ -7812,10 +7874,10 @@ ripwire: warning: --whereis read the newest 373 of 655 local branches; 282 older *MCP `batch`: three independent read queries answered in ONE round-trip — NOTE the sub-query grammar is {verb, ...args} objects with MCP verb names, not the CLI --batch file's verb:arg lines.* -**wall time: 2.51s** +**wall time: 2.11s** ````` -{"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2025-11-25","serverInfo":{"name":"ripwire","version":"0.6.10-dev.110+g914c4045d"},"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.113+g147c73293"},"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":"<batch schema=\"ripwire.batch/v1\" n=\"3\" requested=\"3\" cap=\"16\"><!-- ripwire batch schema=ripwire.batch/v1: n= read sub-queries in one sweep (requested=, cap=): each <q> wraps one sub-answer verbatim in CDATA. i=/verb=/ok=: su … [line truncated: 27900 more bytes on this line] {\"name\":\"rankGraph\",\"kind\":\"fn\",\"file\":\"src/graph.h\",\"line\":14964,\"handle\":\"sym#b90da690b120eeb3@e36277932d593a8b\",\"sites_at\":[\"14968\"]}, {\"name\":\"anchoredLexicalRank\",\"kind\":\"fn\",\"file\":\"src/graph.h\",\"line\":15633,\"handle\":\"sym#b3a5ca7873636567@e36277932d593a8b\",\"sites_at\":[\"15684\"]}, @@ -7826,17 +7888,17 @@ ripwire: warning: --whereis read the newest 373 of 655 local branches; 282 older {\"file\":\"src/abicheck.h\",\"line\":517,\"in\":\"abicheck::collectAuthoredSites\",\"parse_degraded\":true,\"text\":\" DISCLOSE( result, AbiResult::DisclosureWhy::NoMergeBase, \\\"abi: no merge-base for a ref (unrelated history?) — that ref is counted, not compared\\\" );\"}],\"parse_d … [line truncated: 541 more bytes on this line] {\"file\":\"CMakeLists.txt\",\"line\":347}]},\"enclosing\":[{\"n\":\"path_instructions\",\"callers\":0,\"handle_omitted\":\"non-code\"}, {\"n\":\"abicheck::collectAuthoredSites\",\"callers\":1,\"cx\":9,\"handle\":\"sym#1ab32951dcc2d860@336bb5738da2ef84\"}]}]]></q></batch>"}], -"_index":"[index: files=4852 symbols=45032 hash=8e5a0414]","_fresh":"ok"}} +"_index":"[index: files=4852 symbols=45032 hash=2e70d871]","_fresh":"ok"}} ````` ## `printf '%s\n' '{"jsonrpc":"2.0","id":1,"method":"initialize"}' '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"batch","arguments":{"path":".","queries":["for:incremental cache invalidation","callers:rankGraphTeleport"]}}}' | ./build/ripwire --mcp` *The CLI --batch spelling handed to MCP `batch`: refused, with the accepted shape named.* -**wall time: 1.93s** +**wall time: 1.98s** ````` -{"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2025-11-25","serverInfo":{"name":"ripwire","version":"0.6.10-dev.110+g914c4045d"},"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.113+g147c73293"},"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":"<batch schema=\"ripwire.batch/v1\" n=\"2\" requested=\"2\" cap=\"16\"><!-- ripwire batch schema=ripwire.batch/v1: n= read sub-queries in one sweep (requested=, cap=): each <q> wraps one sub-answer verbatim in CDATA. i=/verb=/ok=: su … [line truncated: 27883 more bytes on this line] {\"name\":\"rankGraph\",\"kind\":\"fn\",\"file\":\"src/graph.h\",\"line\":14964,\"handle\":\"sym#b90da690b120eeb3@e36277932d593a8b\",\"sites_at\":[\"14968\"]}, {\"name\":\"anchoredLexicalRank\",\"kind\":\"fn\",\"file\":\"src/graph.h\",\"line\":15633,\"handle\":\"sym#b3a5ca7873636567@e36277932d593a8b\",\"sites_at\":[\"15684\"]}, @@ -7844,31 +7906,31 @@ ripwire: warning: --whereis read the newest 373 of 655 local branches; 282 older {\"name\":\"churnDecayRanking\",\"kind\":\"fn\",\"file\":\"src/main.cpp\",\"line\":1433,\"handle\":\"sym#f43b7580f05a651a@d08b788611a39f0f\",\"sites_at\":[\"1447\"]}, {\"name\":\"churnRankedGraph\",\"kind\":\"fn\",\"file\":\"src/main.cpp\",\"line\":1472,\"handle\":\"sym#4b5b63d3932ca0ff@d08b788611a39f0f\",\"sites_at\":[\"1486\",\"1487\",\"1501\"]}, {\"name\":\"runDefaultMap\",\"kind\":\"fn\",\"file\":\"src/main.cpp\",\"line\":1759,\"handle\":\"sym#6e2725cb96590ec8@d08b788611a39f0f\",\"sites_at\":[\"1879\"]}],\"sites_note\":\"sites_at= on a caller row: its calls of the called LEAF name, bar ones proven elsewhere, as [file:]line (space-separated … [line truncated: 365 more bytes on this line] -"_index":"[index: files=4852 symbols=45032 hash=8e5a0414]","_fresh":"ok"}} +"_index":"[index: files=4852 symbols=45032 hash=2e70d871]","_fresh":"ok"}} ````` ## `printf '%s\n' '{"jsonrpc":"2.0","id":1,"method":"initialize"}' '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"edit_check","arguments":{"path":".","symbol":"rankGraphTeleport"}}}' | ./build/ripwire --mcp` *MCP `edit_check` on a CLEAN tree.* -**wall time: 4.92s** +**wall time: 7.07s** ````` -{"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2025-11-25","serverInfo":{"name":"ripwire","version":"0.6.10-dev.110+g914c4045d"},"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.113+g147c73293"},"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":"<!-- ripwire edit-check schema=ripwire.edit-check/v1: sym='s contract NOW vs HEAD: status=unchanged|new-symbol|contract-change; <c n= p= incompatible=1 sites_l=> callers. counts_floor=1: every count is a FLOOR, never a total. graph_ … [line truncated: 1200 more bytes on this line] -"_index":"[index: files=4852 symbols=45032 hash=8e5a0414]","_fresh":"ok"}} +"_index":"[index: files=4852 symbols=45032 hash=2e70d871]","_fresh":"ok"}} ````` ## `printf '%s\n' '{"jsonrpc":"2.0","id":1,"method":"initialize"}' '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"edit_check","arguments":{"path":".","symbol":"rankGraphTeleport","legend":"compact"}}}' | ./build/ripwire --mcp` *The same MCP `edit_check` with legend:"compact" — the CLI --legend=compact dialect on the MCP side (declared on the 16 XML verbs): ~5.5 KB of legend down to ~600 B, rows identical; an unknown or empty legend value is refused, never read as the default.* -**wall time: 7.30s** +**wall time: 6.01s** ````` -{"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2025-11-25","serverInfo":{"name":"ripwire","version":"0.6.10-dev.110+g914c4045d"},"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.113+g147c73293"},"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":"<!-- ripwire edit-check schema=ripwire.edit-check/v1: sym='s contract NOW vs HEAD: status=unchanged|new-symbol|contract-change; <c n= p= incompatible=1 sites_l=> callers. counts_floor=1: every count is a FLOOR, never a total. graph_ … [line truncated: 1200 more bytes on this line] -"_index":"[index: files=4852 symbols=45032 hash=8e5a0414]","_fresh":"ok"}} +"_index":"[index: files=4852 symbols=45032 hash=2e70d871]","_fresh":"ok"}} ````` ## `printf '%s\n' '{"jsonrpc":"2.0","id":1,"method":"initialize"}' '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"nosuchverb","arguments":{"path":"."}}}' | ./build/ripwire --mcp` @@ -7876,6 +7938,6 @@ ripwire: warning: --whereis read the newest 373 of 655 local branches; 282 older *An unknown verb name — the JSON-RPC error shape.* ````` -{"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2025-11-25","serverInfo":{"name":"ripwire","version":"0.6.10-dev.110+g914c4045d"},"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.113+g147c73293"},"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,"error":{"code":-32602,"message":"unknown tool: 'nosuchverb' — call tools/list for the 33 available tools"}} ````` From df9f835f44d08c7060927aefe95fcf7883239a9d Mon Sep 17 00:00:00 2001 From: joyful-ii-V-I <210578314+joyful-ii-V-I@users.noreply.github.com> Date: Sun, 22 Nov 2026 09:12:59 -0500 Subject: [PATCH 38/44] refactor(quality): QdRowModel's row layout enum is RowShape, not Shape MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ge-runqd named the nested enum QdRowModel::Shape. On ripwire's own tree that added a 25th definition named Shape, and --lego=Shape now picked src/verbs_quality.h's enum (no methods) over the test fixtures' C++ interface, so a9disclosurecheck §A9.4 lost its <m pure="1"> row on every CI leg. The binary's --lego is unchanged: main's b576a95e3 binary gives the same answer on the train tree, and both binaries give the <m> row on main's tree. The name is now specific to what it is, and Shape keeps its one interface. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --- src/verbs_quality.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/verbs_quality.h b/src/verbs_quality.h index f0f227702..c423345bb 100644 --- a/src/verbs_quality.h +++ b/src/verbs_quality.h @@ -3122,8 +3122,8 @@ struct QdRowModel // and a param-count contract-change (was/now = the real counts). was/now print whenever they differ from each other, // so the contract-change case's was=/now= is visible while the new-symbol case's meaningless was="0" now="0" is // omitted, matching its old sym-only shape. - enum class Shape : std::uint8_t { Members, SymOnly, WasNow }; - Shape shape = Shape::WasNow; + enum class RowShape : std::uint8_t { Members, SymOnly, WasNow }; + RowShape shape = RowShape::WasNow; std::string sym; // quality::displaySym, unescaped: members= for Members, sym= otherwise bool gating = false; // P2.5: the exit predicate (quality::rowGates), stated per row; never on a disclosed row // B10.2 — the optional classification facet: its attribute NAME is chosen by kind (quality::facetAttrName, the ONE @@ -3137,9 +3137,9 @@ QdRowModel qdRowModel( const rw::quality::Regression& r, bool gatingAllowed, std { using namespace rw; QdRowModel m; - m.shape = r.kind == "duplication" ? QdRowModel::Shape::Members - : ( r.kind == "dead-code" || ( r.kind == "api-surface" && r.was == r.now ) ) ? QdRowModel::Shape::SymOnly - : QdRowModel::Shape::WasNow; + m.shape = r.kind == "duplication" ? QdRowModel::RowShape::Members + : ( r.kind == "dead-code" || ( r.kind == "api-surface" && r.was == r.now ) ) ? QdRowModel::RowShape::SymOnly + : QdRowModel::RowShape::WasNow; m.sym = quality::displaySym( r.sym, deltaRoot ); m.gating = gatingAllowed && quality::rowGates( r ); m.facetName = r.facet.empty() ? nullptr : quality::facetAttrName( r.kind ); @@ -3189,14 +3189,14 @@ void emitQdXmlRow( std::FILE* out, const rw::quality::Regression& r, const QdRow common += m.gating ? " gating=\"1\"" : ""; switch( m.shape ) { - case QdRowModel::Shape::Members: + case QdRowModel::RowShape::Members: rw::emitTo( out, "<r kind=\"duplication\" members=\"{}\" tokens=\"{}\"{}{}/>", ex( m.sym ), r.now, common, quality::tangleRowAttrs( r, /*json=*/false, ex ) ); // QD-IDIOM-ELEMTYPE: why= when the operand path demoted it return; - case QdRowModel::Shape::SymOnly: + case QdRowModel::RowShape::SymOnly: rw::emitTo( out, "<r kind=\"{}\" sym=\"{}\"{}{}/>", r.kind, ex( m.sym ), common, qdExpandNextAttr( r, m ) ); return; - case QdRowModel::Shape::WasNow: + case QdRowModel::RowShape::WasNow: // P8 (L7): bar= is the threshold beside the number it judges, on the four numeric kinds (quality.h's // kCcxBar/kLocBar/kNestBar/kParamBar), so was=/now= read without the legend. QD-ENTRY-CEILING: ceiling= is the // ceiling a NEW function reached, beside the gating= it causes; QD-UNCHECKED-STATUS: call= is the call whose @@ -3214,7 +3214,7 @@ void emitQdJsonRow( std::FILE* out, const rw::quality::Regression& r, const QdRo { using namespace rw; rw::emitTo( out, "{{\"kind\":\"{}\"", jsonStr( r.kind ) ); - if( m.shape == QdRowModel::Shape::Members ) + if( m.shape == QdRowModel::RowShape::Members ) { rw::emitTo( out, ",\"members\":\"{}\",\"tokens\":{}", jsonStr( m.sym ), r.now ); } @@ -3222,7 +3222,7 @@ void emitQdJsonRow( std::FILE* out, const rw::quality::Regression& r, const QdRo { rw::emitTo( out, ",\"sym\":\"{}\"", jsonStr( m.sym ) ); } - if( m.shape == QdRowModel::Shape::WasNow ) + if( m.shape == QdRowModel::RowShape::WasNow ) { rw::emitTo( out, ",\"was\":{},\"now\":{}", quality::rowValueText( r, r.was ), quality::rowValueText( r, r.now ) ); } From c54b1110723e71142339df9101997c6899ee2a37 Mon Sep 17 00:00:00 2001 From: joyful-ii-V-I <210578314+joyful-ii-V-I@users.noreply.github.com> Date: Sun, 22 Nov 2026 09:12:59 -0500 Subject: [PATCH 39/44] skills: quality-bar description fits the 5,400-char set budget (5,416 -> 5,396) TANGLE-GATE-B's third exception pushed the skill set over skilldescbudgetcheck's ceiling. Same meaning, fewer words: 'new functions at the ceiling or tangled'; 'a one-line fix'. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --- skills/ripwire-quality-bar/SKILL.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/skills/ripwire-quality-bar/SKILL.md b/skills/ripwire-quality-bar/SKILL.md index 6a1b062e0..3d4491500 100644 --- a/skills/ripwire-quality-bar/SKILL.md +++ b/skills/ripwire-quality-bar/SKILL.md @@ -3,8 +3,8 @@ name: ripwire-quality-bar description: > Code QUALITY of what YOU just wrote, before commit/'done' or a cleanup: --quality-delta lists what got WORSE in 13 kinds; exit 2 if old code did (new-symbol rows never gate, - except defect-shape format-arity, a new function at the ceiling and a tangled new one); the fix each shape calls for. - Merge safety → change-check. Even a single-line leaf fix runs it. + except defect-shape format-arity, new functions at the ceiling or tangled); the fix each shape calls for. + Merge safety → change-check. Even a one-line fix runs it. allowed-tools: Bash, Read --- From 98f2b820aafab2354412b287b471f214b9a9c904 Mon Sep 17 00:00:00 2001 From: joyful-ii-V-I <210578314+joyful-ii-V-I@users.noreply.github.com> Date: Sun, 22 Nov 2026 09:12:59 -0500 Subject: [PATCH 40/44] docs: refresh the counts snapshot (gates.scripts 854 -> 866; gendocsmergecheck D) python3 docs/counts_snapshot.py refresh, as the gate asks: the snapshot lagged main + the train by 12 gate scripts, over the drift bound of 10. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --- README.md | 6 +++--- docs/EVALS.md | 6 +++--- docs/LIMITS.md | 10 +++++----- docs/TUNING.md | 24 ++++++++++++------------ docs/counts.tsv | 24 ++++++++++++------------ present/deck5_ripwire_build.js | 6 +++--- 6 files changed, 38 insertions(+), 38 deletions(-) diff --git a/README.md b/README.md index 7c9565406..4ebc3e184 100644 --- a/README.md +++ b/README.md @@ -1825,9 +1825,9 @@ wrong, and it has. These are the results that say so, all in-tree, all published ### In the tests <details> -<summary><b>854 gate scripts</b> (counts snapshot 2026-11-18), five contracts no unit test can hold, and the house rule: write the gate before the code it measures</summary> <!-- gatecount --> +<summary><b>866 gate scripts</b> (counts snapshot 2026-11-22), five contracts no unit test can hold, and the house rule: write the gate before the code it measures</summary> <!-- gatecount --> -`test/regression.sh` named **854 gate scripts** at the counts snapshot 2026-11-18 and is the authoritative list; <!-- gatecount --> +`test/regression.sh` named **866 gate scripts** at the counts snapshot 2026-11-22 and is the authoritative list; <!-- gatecount --> `python3 test/pargates.py . ./build/ripwire -j 6` runs the same set in parallel. On top of them sit the contracts that do not fit a unit test: two runs byte-identical, warm output identical to cold, output that pipes clean through `xmllint --noout`, a sanitizer build with `-fno-sanitize-recover=all`, and a @@ -1836,7 +1836,7 @@ and requires stdout, stderr and exit code to match on each. The gate count above are the dated counts snapshot in `docs/counts.tsv` (`python3 docs/counts_snapshot.py show` prints today's numbers beside it), so two open changes that each add a gate or a cap never conflict on a total. -Another gate derives the cap inventory. At the counts snapshot 2026-11-18 the tool had 440 compile-time caps and 10 ranking parameters. +Another gate derives the cap inventory. At the counts snapshot 2026-11-22 the tool had 454 compile-time caps and 10 ranking parameters. [`docs/LIMITS.md`](docs/LIMITS.md) lists each cap, its value, and whether the file discloses a truncation when the cap fires, and `python3 docs/limits_build.py --check` proves that list against `src/`. [`docs/TUNING.md`](docs/TUNING.md) lists the measured cost of the caps the sweep has measured, and names diff --git a/docs/EVALS.md b/docs/EVALS.md index c536c25c8..c216b2a09 100644 --- a/docs/EVALS.md +++ b/docs/EVALS.md @@ -21,7 +21,7 @@ section, and it is not an afterthought. | **Co-change / known-item evals** | `--eval`, `--eval-retrieval` (see `bench/ANSWERQUALITY.md`) | Whether the tool surfaces the other files a real historical commit touched; and known-item retrieval across four rankers. | | **Ensemble calibration harness** | `bench/ensemblecal/` | Whether `--ensemble`'s four evidence families are actually orthogonal, how often each fires, how stable each is across commits — and the preset ladder derived from that (§9). | | **Differential argv harness** | `test/argvdiffcheck.sh` | That a refactor changed *nothing observable*: two binaries, every argv vector, stdout + stderr + exit code byte-identical. | -| **The gate suite** | `test/regression.sh`, `test/pargates.py` | 854 gate scripts (counts snapshot 2026-11-18) plus the determinism, cache-transparency and golden contracts. <!-- gatecount --> | +| **The gate suite** | `test/regression.sh`, `test/pargates.py` | 866 gate scripts (counts snapshot 2026-11-22) plus the determinism, cache-transparency and golden contracts. <!-- gatecount --> | | **`--quality-delta`** | `src/quality.h` | Ten measured code-quality failure modes, reported only where a change made them worse. | ### The labeling protocol (why the held-out eval is allowed to disagree with the ranker) @@ -5888,7 +5888,7 @@ copy here would be exactly the dialect divergence that gate exists to catch. Com tags, wrap, stable-order defaults), seven individually invoked standalone gates (`g1freshcheck`, `skillscan`, `htmlexport`, `compresscheck`, `handoffcheck`, `releaseinstallcheck`, `taskroutecheck`), and a single loop -(**854 gate scripts** at the counts snapshot 2026-11-18; `test/manifestcheck.sh` proves every listed name exists on disk). <!-- gatecount --> +(**866 gate scripts** at the counts snapshot 2026-11-22; `test/manifestcheck.sh` proves every listed name exists on disk). <!-- gatecount --> `python3 test/pargates.py . ./build/ripwire -j 6` runs the same scripts in parallel so a full verification fits in one sitting. It does not modify `regression.sh`. @@ -7067,7 +7067,7 @@ Listed because the reason is more useful than the silence. shipped**. See `bench/locbench/anchorhop_calib.json`. The mention anchor's reproducible numbers are the ablations in §4. - **A single round gate-count.** Two in-tree numbers disagree (`test/pargates.py`'s docstring says - ~210; `test/argvdiffcheck.sh` says 200+), while the loop in `test/regression.sh` names 854 at the counts snapshot 2026-11-18. The <!-- gatecount --> + ~210; `test/argvdiffcheck.sh` says 200+), while the loop in `test/regression.sh` names 866 at the counts snapshot 2026-11-22. The <!-- gatecount --> loop is the authority; the stale docstrings are a known drift. Since 2026-09-10 the number is not written by hand anywhere, and since 2026-11-02 it is the dated counts snapshot `docs/counts.tsv` (so two open changes that each add a gate never conflict on it): `docs/gatecount_build.py` rewrites diff --git a/docs/LIMITS.md b/docs/LIMITS.md index fcfefb56e..8f11388cc 100644 --- a/docs/LIMITS.md +++ b/docs/LIMITS.md @@ -45,16 +45,16 @@ revived against this residual: it counted line-match attempts BETWEEN engine cal answers and still bounded nothing inside one call.) **Totals are a dated snapshot.** Every total on this page (the table below, the class counts, the -file count) is the counts snapshot taken 2026-11-18 (`docs/counts.tsv`), so two open changes that each add a +file count) is the counts snapshot taken 2026-11-22 (`docs/counts.tsv`), so two open changes that each add a cap do not both rewrite the same line; the per-file tables are re-read from `src/` on every run. `python3 docs/counts_snapshot.py show` prints today's numbers beside these. | total caps | files | caps whose file discloses | caps whose file discloses NOTHING | | --- | --- | --- | --- | -| 440 | 149 | 288 | **152** | +| 454 | 156 | 289 | **165** | Plus 10 ranking and apportionment parameters, in their own table below: they are not caps, they -are not counted as caps, and 440 + 10 is the 450 constants this generator parses out of `src/`. +are not counted as caps, and 454 + 10 is the 464 constants this generator parses out of `src/`. ## INDEXING, OUTPUT or BOUNDARY — which half of the answer a cap bounds @@ -72,8 +72,8 @@ None of them truncates anything, so none can be judged by `shown=`/`total=` and a disclosure — labelling them OUTPUT would ask for a `capped="1"` that could never honestly fire. The distinction was named in review on #108 and the rows below now carry it. -The `class` column below carries that answer where it is known. **143 of 440 caps are classified -(51 INDEXING, 46 OUTPUT, 46 BOUNDARY); the remaining 297 render `—`, which means NOT YET +The `class` column below carries that answer where it is known. **146 of 454 caps are classified +(54 INDEXING, 46 OUTPUT, 46 BOUNDARY); the remaining 308 render `—`, which means NOT YET CLASSIFIED — never "neither".** Classifications live in `docs/limits_classes.tsv`, a sidecar with a known expiry: the tag belongs on the declaration itself, and this file exists only because the round that diff --git a/docs/TUNING.md b/docs/TUNING.md index dfb1c6913..00cf7ab70 100644 --- a/docs/TUNING.md +++ b/docs/TUNING.md @@ -13,31 +13,31 @@ invocations at the default value and at a probe value. The tunable binary is byt to production at defaults; that control is what makes these numbers mean anything. **The census is a dated snapshot.** The first two columns below and the paragraph after them are -the counts snapshot taken 2026-11-18 (`docs/counts.tsv`), so two open changes that each add a cap do not +the counts snapshot taken 2026-11-22 (`docs/counts.tsv`), so two open changes that each add a cap do not both rewrite them; the per-cap tables are re-read from `src/` on every run. `python3 docs/counts_snapshot.py show` prints today's numbers beside these. | cap declarations | distinct names | tunable | must stay `constexpr` | move >= 1 invocation | move nothing measurable | | --- | --- | --- | --- | --- | --- | -| 318 | 317 | 112 | 12 | **37** | 75 | +| 325 | 324 | 112 | 12 | **37** | 75 | -The first two columns are not the same number, and the gap is not a rounding: `src/` holds **318 cap -declarations** under **317 distinct names** (`kRowCap` declared in more than one file). The sweep +The first two columns are not the same number, and the gap is not a rounding: `src/` holds **325 cap +declarations** under **324 distinct names** (`kRowCap` declared in more than one file). The sweep patches by NAME, so its own population is NAMES and not declarations — and the two columns beside those are frozen at the commit named under Provenance while this census is re-read from `src/` on -every run, which makes them a third population again. Enumerated over the 317 names `src/` declares -today: **111 tunable**, **12 must stay `constexpr`**, and **194 declared since the sweep was +every run, which makes them a third population again. Enumerated over the 324 names `src/` declares +today: **111 tunable**, **12 must stay `constexpr`**, and **201 declared since the sweep was prepared, which no measurement has touched** (`kAliasHopDepth`, `kAliasPeelDepth`, -`kAliasTargetCap`, `kBackHopWidth`, `kBaseScopeScanCap`, `kBridgeMaxHops`, +188 more). 111 + 12 + -194 = 317, and `emit` refuses to render a partition that does not add up. The `tunable` column above -reads 112 rather than 111 because one name the sweep classified is no longer declared in `src/` at -all: `kSituTestRowsShown`. Quoting "113 of 318" would be wrong in both halves at once, which is the -shape of error a generated table exists to prevent. +`kAliasTargetCap`, `kBackHopWidth`, `kBaseScopeScanCap`, `kBestSinceMaxBlobs`, +195 more). 111 + 12 ++ 201 = 324, and `emit` refuses to render a partition that does not add up. The `tunable` column +above reads 112 rather than 111 because one name the sweep classified is no longer declared in +`src/` at all: `kSituTestRowsShown`. Quoting "113 of 325" would be wrong in both halves at once, +which is the shape of error a generated table exists to prevent. ## Read this ratio before the tables **37 of 112 tunable caps move any invocation at all. 75 move nothing measurable.** That is the -finding, and it says what NOT to do: this is not a 318-cap audit. Most of these constants are +finding, and it says what NOT to do: this is not a 325-cap audit. Most of these constants are inert on real invocations and should be left alone. The work worth doing is the small set below, plus the caps that fire SILENTLY — a cap that bites without disclosing is a defect independent of whether its value is right, and that fix is both cheaper and larger than any retuning. diff --git a/docs/counts.tsv b/docs/counts.tsv index 60268d18f..ab92cbeaf 100644 --- a/docs/counts.tsv +++ b/docs/counts.tsv @@ -2,23 +2,23 @@ # docs/LIMITS.md, docs/TUNING.md, the deck). Generated, do not edit: `python3 docs/counts_snapshot.py refresh` # re-takes it from the tree; `check` compares it with the tree. A feature PR leaves it alone, which is what keeps # two open PRs that each add a gate or a cap from conflicting on a total. -taken 2026-11-18 -gates.scripts 854 +taken 2026-11-22 +gates.scripts 866 limits.boundary 46 -limits.caps 440 -limits.constants 450 -limits.disclosing 288 -limits.files 149 -limits.indexing 51 +limits.caps 454 +limits.constants 464 +limits.disclosing 289 +limits.files 156 +limits.indexing 54 limits.output 46 limits.parameters 10 -limits.silent 152 +limits.silent 165 tuning.constexpr_live 12 -tuning.declarations 318 +tuning.declarations 325 tuning.duplicated `kRowCap` tuning.gone 1 tuning.gone_shown `kSituTestRowsShown` -tuning.names 317 +tuning.names 324 tuning.tunable_live 111 -tuning.unswept 194 -tuning.unswept_shown `kAliasHopDepth`, `kAliasPeelDepth`, `kAliasTargetCap`, `kBackHopWidth`, `kBaseScopeScanCap`, `kBridgeMaxHops`, +188 more +tuning.unswept 201 +tuning.unswept_shown `kAliasHopDepth`, `kAliasPeelDepth`, `kAliasTargetCap`, `kBackHopWidth`, `kBaseScopeScanCap`, `kBestSinceMaxBlobs`, +195 more diff --git a/present/deck5_ripwire_build.js b/present/deck5_ripwire_build.js index c9e2d6694..fae98e258 100644 --- a/present/deck5_ripwire_build.js +++ b/present/deck5_ripwire_build.js @@ -1326,7 +1326,7 @@ function storyCards(s, { kick, head, stories, footText }){ kicker(s, "// how it stays true", AMBER); title(s, "Proven, not promised"); const cards = [ - ["854 gate scripts", "the suite runs on every push — plus determinism, cache-transparency and golden contracts; the gate count itself is a dated snapshot of the runner's own loop (counts snapshot 2026-11-18)"], // gatecount + ["866 gate scripts", "the suite runs on every push — plus determinism, cache-transparency and golden contracts; the gate count itself is a dated snapshot of the runner's own loop (counts snapshot 2026-11-22)"], // gatecount ["byte-identical, always", "two runs over the same tree produce the same bytes; warm equals cold. Enforced in CI, twice — Release AND a plain flavour, because NDEBUG once blinded a whole class of checks"], ["differential refactoring", "a refactor must prove it changed nothing observable: two binaries, hundreds of argv vectors, stdout + stderr + exit codes byte-identical"], ["held-out labels, authored blind", "eval labels were written by reading source before the ranker ever ran on them — so the eval is allowed to say the ranker is wrong. It has."], @@ -1350,7 +1350,7 @@ function storyCards(s, { kick, head, stories, footText }){ title(s, "Claims you can trust, because we publish what failed", { size: 32 }); card(s, MX, 1.72, 3.86, 1.72); - stat(s, "854", "gate scripts named by test/regression.sh — and the COUNT is the counts snapshot 2026-11-18 of that loop, checked exact at every refresh and release", // gatecount + stat(s, "866", "gate scripts named by test/regression.sh — and the COUNT is the counts snapshot 2026-11-22 of that loop, checked exact at every refresh and release", // gatecount MX+0.15, 1.86, 3.56, CYAN, { bsize: 42, bh: 0.66, lsize: 9.5 }); card(s, 4.68, 1.72, 3.86, 1.72, CARD2); stat(s, "8", "registered NEGATIVES — changes built, gated green, measured against a band written before the code, and reverted rather than tuned", @@ -1740,7 +1740,7 @@ function storyCards(s, { kick, head, stories, footText }){ ["196 long flags · 39 slides", "bash test/deckclaimcheck.sh"], ["every --flag named here exists", "bash test/deckcheck.sh"], ["74.7% fewer element bytes", "bash test/showcasecapturecheck.sh"], - ["854 gate scripts (counts snapshot 2026-11-18)", "bash test/manifestcheck.sh"], // gatecount + ["866 gate scripts (counts snapshot 2026-11-22)", "bash test/manifestcheck.sh"], // gatecount ["49 repos · 79 papers · 237 surveyed","bash test/readmedriftcheck.sh"], ["the ten moments, any row", "ripwire . --callers=SYM | wc -c"], ["the head-to-head table", "bench/headtohead/r4-2026-08-06/"], From 50c9b66dee5b45575448341101831ac4fbb0cb03 Mon Sep 17 00:00:00 2001 From: joyful-ii-V-I <210578314+joyful-ii-V-I@users.noreply.github.com> Date: Sun, 22 Nov 2026 09:30:33 -0500 Subject: [PATCH 41/44] fix(quality): --ack-only's "gating" is an exact token; the verdict fold keeps shell_cut= Two CodeRabbit findings on #721 (both qd-only; answers unchanged): - ackOnlySelects tested "gating" after the kind/sym/facet substring checks, so --ack-only=gating also selected never-gating rows on a symbol such as gatingHelper (acked 3 of 3 where 1 gates). The exact token now answers only rowGates && inScope; every other token keeps substring matching. ackonlycheck (5): red on cbed31d4c ("acknowledged 3 of 3"), green here (1 of 3). - qdNothingElseToDisclose did not know shell_cut=, so an identity tree with a stale ack folded to the root line and dropped the nesting-budget disclosure (--show-stale and --json kept it). A nonzero shellCut now blocks the verdict-only fold. shellnestcheck (f): red on cbed31d4c, green here. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --- src/verbs_quality.h | 15 +++++++++++---- test/ackonlycheck.sh | 18 ++++++++++++++++++ test/shellnestcheck.sh | 16 ++++++++++++++++ 3 files changed, 45 insertions(+), 4 deletions(-) diff --git a/src/verbs_quality.h b/src/verbs_quality.h index c423345bb..7415b2add 100644 --- a/src/verbs_quality.h +++ b/src/verbs_quality.h @@ -2676,10 +2676,16 @@ bool ackOnlySelects( std::string_view ackOnly, const rw::quality::Regression& r, return true; } const bool gates = rw::quality::rowGates( r ) && inScope; + // "gating" is RESERVED: the exact token answers only "would this row exit 2", never a substring of a symbol such as + // gatingHelper (CR721 — a substring hit acked a never-gating row, or refused the command on an out-of-scope one). const auto patternSelects = [ & ]( std::string_view pat ) { + if( pat == "gating" ) + { + return gates; + } return !pat.empty() && ( r.kind.find( pat ) != std::string::npos || r.sym.find( pat ) != std::string::npos - || ( !r.facet.empty() && r.facet.find( pat ) != std::string::npos ) || ( pat == "gating" && gates ) ); + || ( !r.facet.empty() && r.facet.find( pat ) != std::string::npos ) ); }; for( std::string_view rest = ackOnly; !rest.empty(); ) { @@ -3303,15 +3309,16 @@ struct QdStaleFold }; // The identity-tree verdict's precondition: a working-tree answer whose floor is this tree's own snapshot -// (head_basis="identity") with no scope, foreign or accepted ack, config warning, absorbed debt, new public surface or -// unreadable sidecar line to disclose — so the root line alone loses nothing. +// (head_basis="identity") with no scope, foreign or accepted ack, config warning, absorbed debt, new public surface, +// unreadable sidecar line or shell scan the nesting budget cut (shell_cut=, CR721) to disclose — so the root line alone +// loses nothing. bool qdNothingElseToDisclose( const QdReport& rep ) { const QdComparison& c = rep.c; const DeltaBasis& basis = c.basis; return !c.refPair && basis.headBasis != nullptr && std::string_view( basis.headBasis ) == "identity" && !c.scope.active() && c.part.foreignAcks.empty() && c.part.ackedCount == 0 && rep.configDiag.total() == 0 && rep.baselineAbsorbed == 0 - && basis.apiNewSurface == 0 && basis.baseSel.sidecarBadLines == 0 && basis.acksBadLines == 0; + && basis.apiNewSurface == 0 && basis.baseSel.sidecarBadLines == 0 && basis.acksBadLines == 0 && basis.extras.shellCut == 0; } // The stale fold this answer could ship (whether it PAYS is emitQualityDeltaXml's to measure), or nullopt when it has a diff --git a/test/ackonlycheck.sh b/test/ackonlycheck.sh index 7ed8fe796..451d2f1c4 100755 --- a/test/ackonlycheck.sh +++ b/test/ackonlycheck.sh @@ -115,5 +115,23 @@ rc=$? if [ $rc -eq 0 ]; then ok "--ack-only=gating clears the gate (exit 0)"; else no "--ack-only=gating left exit $rc"; fi if grep -q 'gating="0"' "$TMP/all.xml"; then ok "…and the header agrees (gating=\"0\")"; else no "…but the header still counts gating findings"; fi +# 5) CR721: "gating" is a RESERVED token, not a substring. A new symbol named gatingHelper carries never-gating +# new-symbol rows (params, dead-code); --ack-only=gating must ack only the one gating contract-change, never those +# rows because "gating" occurs in their sym=. RED before CR721 (train GE3 cbed31d4c): "acknowledged 3 of 3". +R5="$TMP/repo5"; mkdir -p "$R5"; cd "$R5"; git init -q .; git config user.email t@t; git config user.name t +printf '#pragma once\ninline int alpha( int a ) { return a; }\n' > lib.h +git add lib.h; git commit -qm base; "$BIN" . --quality-baseline >/dev/null 2>&1 +printf '#pragma once\ninline int alpha( int a, int b ) { return a + b; }\ninline int gatingHelper( int a, int b, int c ) { return a + b + c; }\n' > lib.h +"$BIN" . --quality-delta >"$TMP/g5.xml" 2>/dev/null +n5="$( grep -oE '<r [^>]*sym="gatingHelper"[^>]*' "$TMP/g5.xml" | wc -l | tr -d ' ' )" +if [ "${n5:-0}" -ge 1 ] && ! grep -oE '<r [^>]*sym="gatingHelper"[^>]*' "$TMP/g5.xml" | grep -q 'gating="1"'; then + ok "(5) premise: $n5 never-gating row(s) on gatingHelper" +else no "(5) premise: want >=1 non-gating gatingHelper row, got $n5: $( grep -oE '<r [^>]*' "$TMP/g5.xml" | tr '\n' ' ' )"; fi +"$BIN" . --quality-delta --ack-only=gating --quality-ack="the gating one" >/dev/null 2>"$TMP/g5.err" +a5="$( grep -c '^ack ' .ripwire_quality_acks 2>/dev/null )" +if grep -q 'acknowledged 1 of ' "$TMP/g5.err" && [ "${a5:-0}" = 1 ] && grep -q '^ack api-surface .*facet=contract-change' .ripwire_quality_acks; then + ok "(5) --ack-only=gating acks only the gating row, not gatingHelper's: $( head -1 "$TMP/g5.err" )" +else no "(5) --ack-only=gating swept in gatingHelper by substring: $( head -1 "$TMP/g5.err" ); ack lines: ${a5:-0}"; fi + [ "$fail" = 0 ] && echo "ALL PASS" || echo "FAILURES ABOVE" exit $fail diff --git a/test/shellnestcheck.sh b/test/shellnestcheck.sh index 50aa0f91d..f87fd5fd2 100755 --- a/test/shellnestcheck.sh +++ b/test/shellnestcheck.sh @@ -15,6 +15,7 @@ # (n1) UNDER THE BUDGET: a function ending in a case with no *) arm (unhandled-arm), 40 subshells deep: the unhandled-arm row is still found # and there is no shell_cut= (the budget cut nothing real). Red on a build with a budget under 40. # (n2) SHALLOW: the same file at depth 1: no shell_cut= (premise for n1: the row exists without nesting too). +# (f) FOLD: the subshell script committed with one stale ack: the identity-tree verdict fold keeps shell_cut="1". # Usage: test/shellnestcheck.sh [BIN] set -u ROOT="$( cd "$( dirname "$0" )/.." && pwd )" @@ -76,5 +77,20 @@ for n in 40 1; do else no "($label) case $n deep: want an unhandled-arm row in deep_check.sh and no shell_cut=; got row='${row:-none}' shell_cut='${c:-none}'"; fi done +# (f) CR721 FOLD: the deep script COMMITTED (tree = HEAD, head_basis="identity") plus one stale ack: the verdict-only fold +# (the root line alone) must still carry shell_cut="1" — it is a disclosure, so the fold must not win. --show-stale is the +# premise (the unfolded root has it). RED before CR721 (train GE3 cbed31d4c): the folded root had no shell_cut=. +R="$TMP/r-fold"; mkdir -p "$R/test"; "${G[@]}" -C "$R" init -q; echo 'echo hi' >"$R/test/a.sh"; gen subshell 5000 "$R/test/deep_check.sh" +printf '# ripwire quality acks v1\nack complexity 0123456789abcdef 5 a target long gone\n' >"$R/.ripwire_quality_acks" +"${G[@]}" -C "$R" add -A && "${G[@]}" -C "$R" commit -qm a +"$BIN" "$R" --quality-delta --no-cache --show-stale >"$TMP/fold-full.xml" 2>/dev/null +"$BIN" "$R" --quality-delta --no-cache >"$TMP/fold.xml" 2>/dev/null; frc=$? +full="$( grep -oE '<quality-delta [^>]*' "$TMP/fold-full.xml" )"; root="$( grep -oE '<quality-delta [^>]*' "$TMP/fold.xml" )" +if printf '%s' "$full" | grep -q 'head_basis="identity"' && printf '%s' "$full" | grep -q 'stale="1"' && [ "$( cutof "$TMP/fold-full.xml" )" = 1 ]; then + ok "(f) premise: identity tree, one stale ack, --show-stale root has shell_cut=\"1\"" +else no "(f) premise: want head_basis=identity, stale=1 and shell_cut=1 under --show-stale; got: $full"; fi +if [ "$frc" = 0 ] && [ "$( cutof "$TMP/fold.xml" )" = 1 ]; then ok "(f) the default (folded) answer keeps shell_cut=\"1\"" +else no "(f) the default answer dropped shell_cut= (rc=$frc): $root"; fi + [ "$fail" = 0 ] && echo "shellnestcheck: PASS" || echo "shellnestcheck: FAIL" exit "$fail" From a362e429d76a4172483561f63091343caefd3fbd Mon Sep 17 00:00:00 2001 From: joyful-ii-V-I <210578314+joyful-ii-V-I@users.noreply.github.com> Date: Sun, 22 Nov 2026 09:56:37 -0500 Subject: [PATCH 42/44] fix(quality): CR721 qd-only findings: clone-group next=, cut shell trees, pin-refusal units, a supervised shellnestcheck CodeRabbit review on #721 (cbed31d4c). Every change here is --quality-delta / gate-only; answers are unchanged. - qdExpandNextAttr: no --expand next= on new-clone-of-reused-helper (sym= is the member list, p= the first member's), as for duplication. qoriginoraclecheck (e2): red on main b576a95e3 and cbed31d4c (next="--expand='copy.cpp:reinvented | sharedHelper'"). - scanVacuousAssertBash: a tree the nesting budget cut is not judged (a guard past the cut is invisible); shell_cut= still discloses it. shellnestcheck (v) red on cbed31d4c, (v0) premise. - the dirty --quality-baseline refusal prints was/now via rowValueText (tangle 10.5, not 105). tanglecheck (p1) red on cbed31d4c. - shellnestcheck: every scan runs under a 60 s alarm (cap60), so a hang fails instead of stalling. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --- src/defectshape.h | 10 ++++++++-- src/verbs_quality.h | 10 ++++++---- test/qoriginoraclecheck.sh | 9 +++++++++ test/shellnestcheck.sh | 38 +++++++++++++++++++++++++++++++++----- test/tanglecheck.sh | 15 +++++++++++++++ 5 files changed, 71 insertions(+), 11 deletions(-) diff --git a/src/defectshape.h b/src/defectshape.h index a607d8e12..f063f22c9 100644 --- a/src/defectshape.h +++ b/src/defectshape.h @@ -4077,8 +4077,14 @@ inline std::vector<Site> scanVacuousAssertBash( std::string_view src, const std: { return {}; } - const rw::shstatus::Tree tree = parseShellScan( src, cut ); - const rw::shstatus::Analysis an = rw::shstatus::analyze( tree, src ); + const rw::shstatus::Tree tree = parseShellScan( src, cut ); + if( tree.cut ) + { + // CR721: a guard PAST the cut (a presence test after the absence assertion it protects) is invisible to the prefix, + // so the prefix alone would call that assertion vacuous. A cut tree is not judged; shell_cut= already says so. + return {}; + } + const rw::shstatus::Analysis an = rw::shstatus::analyze( tree, src ); const va::Script script( src, tree, an ); return script.sites(); } diff --git a/src/verbs_quality.h b/src/verbs_quality.h index 7415b2add..6ebc5d8e3 100644 --- a/src/verbs_quality.h +++ b/src/verbs_quality.h @@ -2313,7 +2313,7 @@ DirtyPinVerdict inspectDirtyBaselinePin( const MainDispatch& d, const std::strin if( verdict.firstRow.empty() ) { verdict.firstRow = r.kind + " " + quality::displaySym( r.sym, cfg.rootPath ) - + " (was=" + std::to_string( r.was ) + " now=" + std::to_string( r.now ) + ")"; + + " (was=" + quality::rowValueText( r, r.was ) + " now=" + quality::rowValueText( r, r.now ) + ")"; // CR721: tangle in display units } } return verdict; @@ -3155,11 +3155,13 @@ QdRowModel qdRowModel( const rw::quality::Regression& r, bool gatingAllowed, std // P3 (L7, nextverb.h): a GATING row hands the agent the body to fix — --expand=FILE:NAME (the file-qualified selector, so // a same-named symbol elsewhere cannot answer). The name is the sym key's last :: segment. Only the sym-carrying shapes ask: -// a Members row (duplication) names a SET and has no single body to open. Nor does a FILE-anchored defect-shape row -// (top-level code: sym= is the path, and --expand=FILE:FILE matches no symbol). Empty when the row offers no body. +// a Members row (duplication) names a SET and has no single body to open; nor does new-clone-of-reused-helper, whose sym= is +// the same member list (CR721: its "last :: segment" was "a | b", and p= belongs to the first member). Nor does a +// FILE-anchored defect-shape row (top-level code: sym= is the path, and --expand=FILE:FILE matches no symbol). Empty when +// the row offers no body. std::string qdExpandNextAttr( const rw::quality::Regression& r, const QdRowModel& m ) { - if( !m.gating || r.path.empty() || ( r.kind == "defect-shape" && r.sym == r.path ) ) + if( !m.gating || r.path.empty() || r.kind == "new-clone-of-reused-helper" || ( r.kind == "defect-shape" && r.sym == r.path ) ) { return std::string(); } diff --git a/test/qoriginoraclecheck.sh b/test/qoriginoraclecheck.sh index e271f479d..802866035 100755 --- a/test/qoriginoraclecheck.sh +++ b/test/qoriginoraclecheck.sh @@ -202,5 +202,14 @@ PE="$( cd "$P" && "$BIN" . --quality-delta --no-cache 2>/dev/null )" printf '%s' "$PE" | grep -q 'kind="new-clone-of-reused-helper"' \ && ok "a new clone of a PREEXISTING reused helper is still reported (the kind is narrowed, not emptied)" \ || { no "the reuse-decline kind no longer fires on its own headline case"; printf '%s' "$PE" | tr '<' '\n' | grep '^r kind='; } +# (e2) CR721: that row's sym= is a member LIST and p= is the first member's, so it hands no --expand next= (a single-body +# selector would be "FILE:a | b", which resolves nothing). Premise: the row is there and gates. RED before CR721 +# (main b576a95e3 and train GE3 cbed31d4c): next="--expand='copy.cpp:… | …'". +crow="$( printf '%s' "$PE" | grep -oE '<r kind="new-clone-of-reused-helper"[^>]*' | head -1 )" +case "$crow" in + *'gating="1"'*next=*) no "(e2) the gating clone-group row offers a single-body next=: $crow" ;; + *'gating="1"'*) ok "(e2) the gating clone-group row carries no next=: $crow" ;; + *) no "(e2) PREMISE: want a gating new-clone-of-reused-helper row, got '${crow:-none}'" ;; +esac [ "$fail" -eq 0 ] && echo "qoriginoraclecheck: ALL PASS" || { echo "qoriginoraclecheck: SOME CHECKS FAILED"; exit 1; } diff --git a/test/shellnestcheck.sh b/test/shellnestcheck.sh index f87fd5fd2..73e09211d 100755 --- a/test/shellnestcheck.sh +++ b/test/shellnestcheck.sh @@ -15,6 +15,7 @@ # (n1) UNDER THE BUDGET: a function ending in a case with no *) arm (unhandled-arm), 40 subshells deep: the unhandled-arm row is still found # and there is no shell_cut= (the budget cut nothing real). Red on a build with a budget under 40. # (n2) SHALLOW: the same file at depth 1: no shell_cut= (premise for n1: the row exists without nesting too). +# (v) CUT TREE: an absence assertion whose guard lies past the cut is not judged vacuous (premise v0: the facet is live). # (f) FOLD: the subshell script committed with one stale ack: the identity-tree verdict fold keeps shell_cut="1". # Usage: test/shellnestcheck.sh [BIN] set -u @@ -31,6 +32,9 @@ ok(){ printf ' PASS %s\n' "$*" || { fail=1; printf ' FAIL could not write th no(){ printf ' FAIL %s\n' "$*"; fail=1; } echo "shellnestcheck: BIN=$BIN" G=( git -c user.name=t -c user.email=t@t -c commit.gpgsign=false ) +# cap60 CMD...: the 60 s deadline is ENFORCED, not just measured after the fact (CR721): SIGALRM kills a hung scan (rc 142), which +# every arm below reads as a failure, so regression.sh never stalls on this gate. +cap60(){ perl -e 'alarm 60; exec @ARGV or exit 127' "$@"; } # gen KIND N OUT — one script nested N levels in one shape (python: no shell recursion of our own) gen(){ python3 - "$1" "$2" "$3" <<'PY' @@ -56,19 +60,19 @@ cutof(){ grep -oE '<quality-delta [^>]*' "$1" | grep -oE ' shell_cut="[0-9]+"' | for k in subshell group if quote subst; do R="$( repo "$k" 5000 )"; s=$( date +%s ) - "$BIN" "$R" --quality-delta --no-cache >"$TMP/$k.xml" 2>"$TMP/$k.err"; rc=$?; t=$(( $( date +%s ) - s )) + cap60 "$BIN" "$R" --quality-delta --no-cache >"$TMP/$k.xml" 2>"$TMP/$k.err"; rc=$?; t=$(( $( date +%s ) - s )) c="$( cutof "$TMP/$k.xml" )" if { [ "$rc" = 0 ] || [ "$rc" = 2 ]; } && [ "$t" -le 60 ] && [ "${c:-0}" = 1 ]; then ok "($k) 5000 deep: rc=$rc in ${t}s, shell_cut=\"$c\"" else no "($k) 5000 deep: want rc 0/2 within 60 s and shell_cut=\"1\"; got rc=$rc in ${t}s, shell_cut='${c:-none}' ($( tail -c 160 "$TMP/$k.err" | tr '\n' ' ' ))"; fi done R="$TMP/r-subshell-5000" -"$BIN" "$R" --quality-delta --json --no-cache >"$TMP/j.json" 2>/dev/null; jrc=$? +cap60 "$BIN" "$R" --quality-delta --json --no-cache >"$TMP/j.json" 2>/dev/null; jrc=$? j="$( python3 -c 'import json,sys; print(json.load(open(sys.argv[1])).get("shell_cut","absent"))' "$TMP/j.json" 2>/dev/null || echo unparseable )" if { [ "$jrc" = 0 ] || [ "$jrc" = 2 ]; } && [ "$j" = 1 ]; then ok "(j) --json: \"shell_cut\":1"; else no "(j) --json: want rc 0/2 and \"shell_cut\":1, got rc=$jrc '$j'"; fi for n in 40 1; do R="$( repo case "$n" )" - "$BIN" "$R" --quality-delta --no-cache >"$TMP/case$n.xml" 2>/dev/null; crc=$? + cap60 "$BIN" "$R" --quality-delta --no-cache >"$TMP/case$n.xml" 2>/dev/null; crc=$? case "$crc" in 0|2) ;; *) no "(case $n) --quality-delta exited $crc";; esac row="$( grep -oE '<r kind="defect-shape"[^>]*defect="unhandled-arm"[^>]*>' "$TMP/case$n.xml" | grep 'deep_check.sh' | head -1 )" c="$( cutof "$TMP/case$n.xml" )" @@ -83,8 +87,8 @@ done R="$TMP/r-fold"; mkdir -p "$R/test"; "${G[@]}" -C "$R" init -q; echo 'echo hi' >"$R/test/a.sh"; gen subshell 5000 "$R/test/deep_check.sh" printf '# ripwire quality acks v1\nack complexity 0123456789abcdef 5 a target long gone\n' >"$R/.ripwire_quality_acks" "${G[@]}" -C "$R" add -A && "${G[@]}" -C "$R" commit -qm a -"$BIN" "$R" --quality-delta --no-cache --show-stale >"$TMP/fold-full.xml" 2>/dev/null -"$BIN" "$R" --quality-delta --no-cache >"$TMP/fold.xml" 2>/dev/null; frc=$? +cap60 "$BIN" "$R" --quality-delta --no-cache --show-stale >"$TMP/fold-full.xml" 2>/dev/null +cap60 "$BIN" "$R" --quality-delta --no-cache >"$TMP/fold.xml" 2>/dev/null; frc=$? full="$( grep -oE '<quality-delta [^>]*' "$TMP/fold-full.xml" )"; root="$( grep -oE '<quality-delta [^>]*' "$TMP/fold.xml" )" if printf '%s' "$full" | grep -q 'head_basis="identity"' && printf '%s' "$full" | grep -q 'stale="1"' && [ "$( cutof "$TMP/fold-full.xml" )" = 1 ]; then ok "(f) premise: identity tree, one stale ack, --show-stale root has shell_cut=\"1\"" @@ -92,5 +96,29 @@ else no "(f) premise: want head_basis=identity, stale=1 and shell_cut=1 under -- if [ "$frc" = 0 ] && [ "$( cutof "$TMP/fold.xml" )" = 1 ]; then ok "(f) the default (folded) answer keeps shell_cut=\"1\"" else no "(f) the default answer dropped shell_cut= (rc=$frc): $root"; fi +# (v) CR721 CUT TREE NOT JUDGED: an absence assertion, a 5,000-deep group, then the presence guard that protects it. The parse +# stops inside the group, so the guard is invisible; the vacuous-assert facet must not judge the prefix (shell_cut="1" says +# the file was cut). Premise (v0): the same assertion with NO guard and no nesting rows vacuous-assert (the facet is live). +# RED before CR721 (train GE3 cbed31d4c): a vacuous-assert row at test/deep_check.sh:4. +vgen(){ python3 - "$1" "$2" "$3" <<'PY' +import sys +n, guard, out = int(sys.argv[1]), sys.argv[2] == "guard", sys.argv[3] +s = '#!/usr/bin/env bash\nset -u\nOUT="$( ./tool --run )"\n' +s += "printf '%s' \"$OUT\" | grep -q 'bad' && echo \"FAIL bad\" || echo \"PASS no bad\"\n" +if n: s += "( " * n + "false" + " )" * n + "\n" +if guard: s += "printf '%s' \"$OUT\" | grep -q 'good' && echo \"PASS good\" || echo \"FAIL no good\"\n" +open(out, "w").write(s) +PY +} +vrepo(){ local R="$TMP/v-$1"; mkdir -p "$R/test"; "${G[@]}" -C "$R" init -q; echo 'echo hi' >"$R/test/a.sh" + "${G[@]}" -C "$R" add -A && "${G[@]}" -C "$R" commit -qm a; vgen "$2" "$3" "$R/test/deep_check.sh"; printf '%s' "$R"; } +vac(){ grep -oE '<r kind="defect-shape"[^>]*defect="vacuous-assert"[^>]*' "$1" | grep 'deep_check.sh'; } +R="$( vrepo v0 0 noguard )"; cap60 "$BIN" "$R" --quality-delta --no-cache >"$TMP/v0.xml" 2>/dev/null +if [ -n "$( vac "$TMP/v0.xml" )" ]; then ok "(v0) premise: the unguarded absence assertion rows vacuous-assert"; else no "(v0) premise: no vacuous-assert row on the unguarded script"; fi +R="$( vrepo v 5000 guard )"; cap60 "$BIN" "$R" --quality-delta --no-cache >"$TMP/v.xml" 2>/dev/null; vrc=$? +vr="$( vac "$TMP/v.xml" )"; c="$( cutof "$TMP/v.xml" )" +if { [ "$vrc" = 0 ] || [ "$vrc" = 2 ]; } && [ -z "$vr" ] && [ "${c:-0}" = 1 ]; then ok "(v) cut tree: no vacuous-assert row, shell_cut=\"1\"" +else no "(v) cut tree: want no vacuous-assert row and shell_cut=\"1\"; got rc=$vrc row='${vr:-none}' shell_cut='${c:-none}'"; fi + [ "$fail" = 0 ] && echo "shellnestcheck: PASS" || echo "shellnestcheck: FAIL" exit "$fail" diff --git a/test/tanglecheck.sh b/test/tanglecheck.sh index ebbbda3e0..8fb4ed705 100755 --- a/test/tanglecheck.sh +++ b/test/tanglecheck.sh @@ -8,6 +8,7 @@ # names the nesting, fix= an extraction with its lines, locals= the flag. # (b1) CROSSING: crossing was 100 flat lines (score 0) and now has tangled's body: a preexisting row (no origin=) with gating="1". # (b2) TEST CODE: harnessmain, new under test/ with tangled's body: a row with sev="minor" and no gating= (premise: the row exists). +# (p1) PIN UNITS: the dirty-tree --quality-baseline refusal names a tangle row as "was=10.5 now=10.9", like the delta row. # (b3) EXIT: the answer exits 2 and the root's gating= counts at least t1 + b1; the stderr line names a tangled new function. # (n1) LONG SEQUENTIAL, (n2) LONG ORCHESTRATOR, (n3) FLAT DISPATCHER, (n4) SHORT NESTED HELPER: no tangle row. Each counts its # premise in --metrics first (the function is there, and n3/n4 really reach depth 4+) and FAILS on a zero premise. @@ -186,5 +187,19 @@ else no "(j) --json: '$jt' (tangle rows, improved) vs XML $tangles rows"; fi # (d) if cmp -s "$Q" "$Q.2"; then ok "(d) two runs byte-identical"; else no "(d) two runs differ"; fi +# (p1) CR721 PIN UNITS: --quality-baseline on a dirty tree whose one gating row is a tangle (grow1 over the bar, growing) refuses +# and names that row in the SAME display units as the --quality-delta row (was="10.5" now="10.9"), not raw tenths. +# RED before CR721 (train GE3 cbed31d4c): "First: tangle grow1 (was=105 now=109)". +P="$TMP/pin"; mkdir -p "$P/src"; "${G[@]}" -C "$P" init -q +g1(){ python3 -c 'import sys; sys.path.insert(0, sys.argv[1]); import tanglefixtures as t; open(sys.argv[2], "w").write("#include <vector>\n" + t.overbar("grow1", int(sys.argv[3]), mult=17))' "$ROOT/test/lib" "$P/src/grow1.cpp" "$1"; } +g1 40; "${G[@]}" -C "$P" add -A && "${G[@]}" -C "$P" commit -qm v1; g1 42 +pr="$( "$BIN" "$P" --quality-delta --no-cache 2>/dev/null | grep -oE '<r kind="tangle"[^>]*sym="grow1"[^>]*gating="1"[^>]*' )" +pw="$( attr "$pr" was )"; pn="$( attr "$pr" now )" +"$BIN" "$P" --quality-baseline --no-cache >/dev/null 2>"$TMP/pin.err"; prc=$? +first="$( tr '\n' ' ' <"$TMP/pin.err" | grep -oE 'First: [^)]*\)' )" +if [ -z "$pr" ] || [ "${pw#*.}" = "$pw" ]; then no "(p1) PREMISE: want a gating tangle row on grow1 with a decimal was=, got '${pr:-none}'" +elif [ "$prc" = 1 ] && [ "$first" = "First: tangle grow1 (was=$pw now=$pn)" ]; then ok "(p1) the pin refusal names the tangle row in display units: $first" +else no "(p1) want rc 1 and 'First: tangle grow1 (was=$pw now=$pn)', got rc=$prc '$first'"; fi + [ "$fail" = 0 ] && echo "tanglecheck: PASS" || echo "tanglecheck: FAIL" exit "$fail" From 4cce67d57d631947c25751c94d0edbf386e5aac5 Mon Sep 17 00:00:00 2001 From: joyful-ii-V-I <210578314+joyful-ii-V-I@users.noreply.github.com> Date: Sun, 22 Nov 2026 10:14:52 -0500 Subject: [PATCH 43/44] skills: quality-bar keeps its pinned phrases; the trim comes from unpinned words (5,397 chars) c54b11107's trim reworded two phrases that gates pin: defectshapecheck "surfaces" needs the exception as "a new function at the ceiling and a tangled new one", and agentloopcodexcheck needs "single-line leaf fix" in the frontmatter. Both are restored. The 16+ chars now come from "Code QUALITY of what YOU just wrote" -> "QUALITY of code YOU just wrote", "or a cleanup" -> "or cleanup" and "the fix each shape calls for" -> "each shape's fix". skilldescbudgetcheck: set total 5,397 of 5,400. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --- skills/ripwire-quality-bar/SKILL.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/skills/ripwire-quality-bar/SKILL.md b/skills/ripwire-quality-bar/SKILL.md index 3d4491500..ea4da8d8d 100644 --- a/skills/ripwire-quality-bar/SKILL.md +++ b/skills/ripwire-quality-bar/SKILL.md @@ -1,10 +1,10 @@ --- name: ripwire-quality-bar description: > - Code QUALITY of what YOU just wrote, before commit/'done' or a cleanup: --quality-delta + QUALITY of code YOU just wrote, before commit/'done' or cleanup: --quality-delta lists what got WORSE in 13 kinds; exit 2 if old code did (new-symbol rows never gate, - except defect-shape format-arity, new functions at the ceiling or tangled); the fix each shape calls for. - Merge safety → change-check. Even a one-line fix runs it. + except defect-shape format-arity, a new function at the ceiling and a tangled new one); each shape's fix. + Merge safety → change-check. Even a single-line leaf fix runs it. allowed-tools: Bash, Read --- From 6964b9dbb9acb924f3f97e16d6018719a95cbc3b Mon Sep 17 00:00:00 2001 From: joyful-ii-V-I <210578314+joyful-ii-V-I@users.noreply.github.com> Date: Sun, 22 Nov 2026 12:14:46 -0500 Subject: [PATCH 44/44] test: the CR721 arms test each new call's exit status (prereview CI10) ackonlycheck (5) now requires --quality-baseline rc 0, the delta rc 2 and the ack rc 0 beside its output checks (still red on cbed31d4c: "acknowledged 3 of 3", green here). tanglecheck (p1)'s piped premise call states why its status is not read: an empty row fails the premise arm. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --- test/ackonlycheck.sh | 14 +++++++------- test/tanglecheck.sh | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/test/ackonlycheck.sh b/test/ackonlycheck.sh index 451d2f1c4..2faa7b289 100755 --- a/test/ackonlycheck.sh +++ b/test/ackonlycheck.sh @@ -120,18 +120,18 @@ if grep -q 'gating="0"' "$TMP/all.xml"; then ok "…and the header agrees (gatin # rows because "gating" occurs in their sym=. RED before CR721 (train GE3 cbed31d4c): "acknowledged 3 of 3". R5="$TMP/repo5"; mkdir -p "$R5"; cd "$R5"; git init -q .; git config user.email t@t; git config user.name t printf '#pragma once\ninline int alpha( int a ) { return a; }\n' > lib.h -git add lib.h; git commit -qm base; "$BIN" . --quality-baseline >/dev/null 2>&1 +git add lib.h; git commit -qm base; "$BIN" . --quality-baseline >/dev/null 2>&1; b5=$? printf '#pragma once\ninline int alpha( int a, int b ) { return a + b; }\ninline int gatingHelper( int a, int b, int c ) { return a + b + c; }\n' > lib.h -"$BIN" . --quality-delta >"$TMP/g5.xml" 2>/dev/null +"$BIN" . --quality-delta >"$TMP/g5.xml" 2>/dev/null; d5=$? n5="$( grep -oE '<r [^>]*sym="gatingHelper"[^>]*' "$TMP/g5.xml" | wc -l | tr -d ' ' )" -if [ "${n5:-0}" -ge 1 ] && ! grep -oE '<r [^>]*sym="gatingHelper"[^>]*' "$TMP/g5.xml" | grep -q 'gating="1"'; then +if [ "$b5" = 0 ] && [ "$d5" = 2 ] && [ "${n5:-0}" -ge 1 ] && ! grep -oE '<r [^>]*sym="gatingHelper"[^>]*' "$TMP/g5.xml" | grep -q 'gating="1"'; then ok "(5) premise: $n5 never-gating row(s) on gatingHelper" -else no "(5) premise: want >=1 non-gating gatingHelper row, got $n5: $( grep -oE '<r [^>]*' "$TMP/g5.xml" | tr '\n' ' ' )"; fi -"$BIN" . --quality-delta --ack-only=gating --quality-ack="the gating one" >/dev/null 2>"$TMP/g5.err" +else no "(5) premise: want baseline rc 0 (got $b5), delta rc 2 (got $d5) and >=1 non-gating gatingHelper row, got $n5: $( grep -oE '<r [^>]*' "$TMP/g5.xml" | tr '\n' ' ' )"; fi +"$BIN" . --quality-delta --ack-only=gating --quality-ack="the gating one" >/dev/null 2>"$TMP/g5.err"; k5=$? a5="$( grep -c '^ack ' .ripwire_quality_acks 2>/dev/null )" -if grep -q 'acknowledged 1 of ' "$TMP/g5.err" && [ "${a5:-0}" = 1 ] && grep -q '^ack api-surface .*facet=contract-change' .ripwire_quality_acks; then +if [ "$k5" = 0 ] && grep -q 'acknowledged 1 of ' "$TMP/g5.err" && [ "${a5:-0}" = 1 ] && grep -q '^ack api-surface .*facet=contract-change' .ripwire_quality_acks; then ok "(5) --ack-only=gating acks only the gating row, not gatingHelper's: $( head -1 "$TMP/g5.err" )" -else no "(5) --ack-only=gating swept in gatingHelper by substring: $( head -1 "$TMP/g5.err" ); ack lines: ${a5:-0}"; fi +else no "(5) --ack-only=gating swept in gatingHelper by substring: $( head -1 "$TMP/g5.err" ) (rc=$k5); ack lines: ${a5:-0}"; fi [ "$fail" = 0 ] && echo "ALL PASS" || echo "FAILURES ABOVE" exit $fail diff --git a/test/tanglecheck.sh b/test/tanglecheck.sh index 8fb4ed705..948b3c414 100755 --- a/test/tanglecheck.sh +++ b/test/tanglecheck.sh @@ -193,7 +193,7 @@ if cmp -s "$Q" "$Q.2"; then ok "(d) two runs byte-identical"; else no "(d) two r P="$TMP/pin"; mkdir -p "$P/src"; "${G[@]}" -C "$P" init -q g1(){ python3 -c 'import sys; sys.path.insert(0, sys.argv[1]); import tanglefixtures as t; open(sys.argv[2], "w").write("#include <vector>\n" + t.overbar("grow1", int(sys.argv[3]), mult=17))' "$ROOT/test/lib" "$P/src/grow1.cpp" "$1"; } g1 40; "${G[@]}" -C "$P" add -A && "${G[@]}" -C "$P" commit -qm v1; g1 42 -pr="$( "$BIN" "$P" --quality-delta --no-cache 2>/dev/null | grep -oE '<r kind="tangle"[^>]*sym="grow1"[^>]*gating="1"[^>]*' )" +pr="$( "$BIN" "$P" --quality-delta --no-cache 2>/dev/null | grep -oE '<r kind="tangle"[^>]*sym="grow1"[^>]*gating="1"[^>]*' )" # status: the delta exits 2 on this gating row; an empty $pr FAILs the (p1) premise below pw="$( attr "$pr" was )"; pn="$( attr "$pr" now )" "$BIN" "$P" --quality-baseline --no-cache >/dev/null 2>"$TMP/pin.err"; prc=$? first="$( tr '\n' ' ' <"$TMP/pin.err" | grep -oE 'First: [^)]*\)' )"