Skip to content

Engine: wrapper-aware counts beside the literal rules -- wrapped_<rule> (#3313 step 4) - #3337

Merged
squid-protocol merged 2 commits into
mainfrom
feat/3313-wrapper-aware-counts
Sep 23, 2026
Merged

squid-protocol merged 2 commits into
mainfrom
feat/3313-wrapper-aware-counts

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Step 4 of epic #3313, the step whose acceptance evidence the epic was built for. It reports a wrapper-aware count beside each literal rule the wrapper channel covers. No score reads it.

Acceptance: curl 8.17 → 8.18 (C family, full clones)

literal memory_alloc wrapped literal + wrapped
curl 8.17 1,197 1,432 2,629
curl 8.18 171 2,548 2,719
change −86% +3.4%

The literal column reproduces temporal-crucible's #3003 finding exactly (1,197 → 171). Literal plus wrapped shows the allocation surface moving behind curlx_* rather than vanishing. CPython 3.14 reads 226 literal + 1,848 wrapped.

What

  • wrapped_<rule> for debug_prints, panics_and_aborts and memory_alloc: per file, the unqualified call sites in that file that resolve to a project wrapper recorded in wrapper_data, using step 3's resolution unchanged.
    • Stored on file_data (0 when none), and the same three summed onto repo_data from the snapshot's own rows.
    • Recomputed every scan, full or delta, from the persisted wrapper_facts; never restored.
  • Contract: docs/wrapper_aware_count_contract.md. Kind site, unit sites (the literal rule's unit), so literal + wrapped counts distinct sites that reach the behaviour directly or through a wrapper. Corollaries:
    1. a literal hit is never a wrapped hit;
    2. a macro body is not a call site;
    3. a chain is several sites, each counted once;
    4. resolution and scope are step 3's;
    5. 0 outside the measured scope means "not measured", not "none".
  • Decisions:
    • D1, no score reads it: a guard test fails if anything under gitgalaxy/metrics/ references a wrapped_* key. A score that reads it is a separate, measured score-contract change.
    • D2, it is never folded into the literal column. The stream contract's corollary 3 now says so. docs/signal_contracts.md was re-rendered, which also picks up the calls_out row and two helper keys that other merged PRs had left unrendered.
    • D3, the report surfaces are presence-keyed:
      • the audit report's 12. Calls Through Idiom Wrappers block shows literal vs wrapped per rule, only on files with wrapped sites;
      • the LLM brief's section 14 opens with repo-wide literal + wrapped = total per rule.

Verification

  • Tests: tests/core_engine/test_wrapper_aware_counts.py pins:

    • per-file attribution (the WRF caller gets 3; the defining file gets 0, since its own print/stop are literal hits);
    • the chain corollary (curl curl_free → curlx_free);
    • the file_data/repo_data write path;
    • delta recomputation to identical counts;
    • recorder/resolver rule-list sync;
    • the D1 guard.

    Full suite: 10,568 passed.

  • audit_check with CI's pinned ruff 0.16.0: all clear. The signal-contract audit reports no new findings.

  • Golden masters, re-blessed against crucible v1.4.0: exactly 32 differences per fixture, every one an added 12. Calls Through Idiom Wrappers block. No signal, score or coordinate moved.

🤖 Generated with Claude Code

https://claude.ai/code/session_01PderVG28YMuzeSP6XH8yi5

squid-protocol and others added 2 commits September 23, 2026 09:10
…e> (#3313 step 4)

Per file and rule, the unqualified call sites that resolve to a project
wrapper recorded in wrapper_data (step 3's resolution, unchanged): file_data
wrapped_debug_prints / wrapped_panics_and_aborts / wrapped_memory_alloc, and
the same three summed onto repo_data. Same unit as the literal rule (sites),
never folded into it; literal + wrapped counts distinct sites that reach the
behaviour directly or through a wrapper.

Contract: docs/wrapper_aware_count_contract.md (corollaries + D1 no score
reads it, guarded by a test over gitgalaxy/metrics; D2 never folded into the
literal column; D3 presence-keyed report surfaces). Stream contract
corollary 3 points to it (sheet re-rendered; it also picks up rows other
merged PRs left unrendered).

Report surfaces: audit '12. Calls Through Idiom Wrappers' (literal vs
wrapped, calling files only) and LLM brief section 14 repo totals.

Acceptance (curl, C family): literal memory_alloc 1197 -> 171 across the
8.17 -> 8.18 refactor, literal + wrapped 2629 -> 2719 (+3.4%).

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01PderVG28YMuzeSP6XH8yi5
32 differences per fixture, every one an added '12. Calls Through Idiom
Wrappers' block (literal vs wrapped sites) on a file whose call sites reach a
recorded wrapper. No signal, score or coordinate moved.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01PderVG28YMuzeSP6XH8yi5
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-protocol
squid-protocol merged commit 48efa45 into main Sep 23, 2026
39 of 40 checks passed
@squid-protocol
squid-protocol deleted the feat/3313-wrapper-aware-counts branch September 23, 2026 13:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature, sensor, or structural signature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant