Skip to content

fix(agc_assembly): real per-function args count, earn a manual-verification badge - #1952

Merged
squid-protocol merged 2 commits into
mainfrom
fix/agc-assembly-args-real-count
Aug 20, 2026
Merged

fix(agc_assembly): real per-function args count, earn a manual-verification badge#1952
squid-protocol merged 2 commits into
mainfrom
fix/agc-assembly-args-real-count

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Summary

  • detector.py's generic args derivation does a single .search() (first match only) against each function body, then splits that one match's text on whitespace. AGC assembly's args regex only ever matches EBANK= (1 token) or OPCODE<ws>REGISTER (always exactly 2 tokens), so every function's value was capped at a near-meaningless 0/1/2 regardless of how many registers it actually touched -- not a real argument count.
  • Adds _count_agc_register_args, wired into _slice_by_labels the same way ABAP's own _count_abap_declared_params overrides the generic derivation: counts the number of DISTINCT registers (A/Q/L/Z) referenced anywhere in the body via a real math/memory opcode (.findall, not search-then-split), plus one more if an EBANK=/FBANK=/BBANK= bank-context assignment is present. Corpus-wide total moved 469 -> 296 (a real, varying signal now).
  • Hand-verified against 5 functions across 4 files (see manual_verification.json's new agc_assembly.args entry).
  • Extends tri_comparison_chart.py's manual-verification badge mechanism (previously gated on "the whole language has exactly one tool") to also recognize a narrower, metric-specific case: a language can have real ctags coverage for func/class while ctags structurally cannot ever report args at all (no signature: field for Asm-parsed files). Gated strictly on ARGS_GRANULARITY's "proxy"/"program_level" categories -- never the default per-function case, where a missing second tool really would just mean "not yet compared."
  • Chart now shows 296/296§ with a real GitGalaxy badge on agc_assembly's Args Found panel, instead of the old bare 469§ proxy marker.
  • Golden master fixtures re-blessed (update_golden_master.py, both venvs) -- all diffs trace to agc_assembly's Input Parameters values plus expected downstream 3D-layout ripple.

Test plan

  • pytest tests/extraction/languages/test_agc_assembly.py tests/extraction/languages/test_agc_assembly_strict.py tests/core_engine/ -- 785 passed, 1 xfailed
  • crucible_check.py -- clean on both full-precision and zero-dependency venvs
  • ruff_audit.py --ci / mypy_audit.py --ci -- no new findings
  • Chart regeneration diff manually reviewed -- scoped to agc_assembly's Args Found panel only

🤖 Generated with Claude Code

squid-protocol and others added 2 commits August 20, 2026 15:24
…ication badge

detector.py's generic args derivation does a single .search() (first match
only) against each function body, then splits that one match's text on
whitespace. AGC assembly's args regex only ever matches "EBANK=" (1 token)
or "OPCODE<ws>REGISTER" (always exactly 2 tokens), so every function's args
value was capped at a near-meaningless 0/1/2 regardless of how many
registers it actually touched -- not a real argument count, closer to "does
this function contain a recognizable calling-convention idiom at all".

Adds _count_agc_register_args, wired into _slice_by_labels the same way
ABAP's own _count_abap_declared_params overrides the generic derivation:
counts the number of DISTINCT registers (A/Q/L/Z) referenced anywhere in
the body via a real math/memory opcode (findall, not search-then-split),
plus one more if an EBANK=/FBANK=/BBANK= bank-context assignment is
present. Corpus-wide total moved 469 -> 296 (a real, varying per-function
signal now, not three fixed buckets). Hand-verified against 5 functions
across 4 files (see manual_verification.json's new agc_assembly.args entry
for the full note).

ctags emits no signature: field for Asm-parsed files, so this metric can
never be cross-tool corroborated even though agc_assembly has real ctags
coverage for func/class existence. Extends tri_comparison_chart.py's
manual-verification badge mechanism (previously gated on "the whole
language has exactly one tool") to also recognize this narrower,
metric-specific case -- gated strictly on ARGS_GRANULARITY's "proxy"/
"program_level" categories, never the default per_function case where a
missing second tool really would just mean "not yet compared". Chart now
shows 296/296 (verified badge) instead of the old bare 469 proxy marker.

Golden master fixtures re-blessed (tests/tools/update_golden_master.py,
both full-precision and zero-dependency venvs) -- all 102 diffs traced to
agc_assembly's Input Parameters values changing plus expected downstream
ripple in the global 3D spatial normalization. crucible_check.py passes
clean on both venvs; 785 tests pass (agc_assembly's own 231 + core_engine).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
--ours conflict resolution during rebase onto main (PR #1950) left this
generated report stale; regenerated fresh per the standard false-conflict
resolution procedure.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@squid-protocol
squid-protocol merged commit 6bc9f6c into main Aug 20, 2026
27 checks passed
@squid-protocol
squid-protocol deleted the fix/agc-assembly-args-real-count branch August 20, 2026 19:28
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

squid-protocol added a commit that referenced this pull request Aug 20, 2026
…nting (#1955)

Same generic single-.search()-then-split derivation bug as agc_assembly
(#1949's fix, PR #1952): assembly's args regex has exactly one capturing
group, so every match's text has no comma/whitespace to split on -- every
function was capped at a bare 0/1 regardless of how many calling-convention
registers it actually referenced (rdi/rsi/rdx/rcx/r8/r9/xmm0-7 for x86-64
SysV, x0-7/w0-7/v0-7 for ARM AAPCS, ax/bx/cx/dx/si/di for legacy 16-bit).

Adds _count_assembly_register_args (mirrors _count_agc_register_args's
pattern): counts DISTINCT argument-passing registers referenced anywhere in
the body via .findall, canonicalizing different-width references to the
same physical register (edi/rdi, w3/x3, al/ah/ax) to one slot via
_ASSEMBLY_ARG_REG_CANON_RE. Hand-verified against matrixmultneon.s's `main`
(args=10: x0, x1, v0-v7 -- confirmed by reading every real register
reference in the function body, including inside a .macro definition its
call sites expand).

Also validates both assembly tri-comparison function-existence ledger
shapes. Confirmed mechanisms: a dot-prefix NASM/GAS local-label naming
split (both tools find the same real label, ctags strips the leading dot
GitGalaxy preserves -- a name-string artifact, not a detection gap); a
genuine ctags gap on purely-numeric local labels (.1/.2, neither tagged
under any name); the SAME #1949 detector.py bug (RELINT-style truncation /
single-line-block discard) independently confirmed live here too
(del_command, C, prtstr); a correct-by-design GitGalaxy exclusion for
GCC's .L-prefix local-label convention (.Lenv0/.Largv0, both real data
labels ctags over-tags); and a genuine GitGalaxy precision gap -- unlike
agc_assembly's opcode-coupled func_start, generic assembly's has no
following-instruction requirement, so it also matches pure data/constant
labels (max_entries, *.ident, str.*) ctags is comparatively more
conservative about. No credit/debit either direction -- real wins and
real gaps mix within both shapes. ctags legitimately earns its first
chart badge on assembly's Func Precision panel as a result (92.6% vs
GitGalaxy's 85%) -- an honest result, not forced.

Golden master fixtures re-blessed (both venvs); crucible_check.py passes
clean; 785 tests pass (assembly's own 231 + core_engine).

Co-authored-by: Joe Esquibel <squid-protocol@users.noreply.github.com>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant