Skip to content

test(extraction): harden agc_assembly extraction coverage (#857) - #931

Merged
squid-protocol merged 2 commits into
mainfrom
extraction-hardening-agc-assembly
Aug 1, 2026
Merged

test(extraction): harden agc_assembly extraction coverage (#857)#931
squid-protocol merged 2 commits into
mainfrom
extraction-hardening-agc-assembly

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

This PR resolves #857 by hardening the extraction test coverage for agc_assembly.

Changes:

  • Test file created: Created tests/extraction/languages/test_agc_assembly.py following the methodology in how_to_harden_extraction.md.
  • Cases mapped: Added roughly 136 tests mapping the 3 extraction rules in scope for AGC (func_start, args, _dependency_capture), categorized across valid, invalid, and pathological cases.
  • Migration completed: Removed agc_assembly from the old monolithic dicts (test_function_extraction_strict.py and test_dependency_extraction_strict.py).
  • Results: Evaluated the patterns locally. The current AGC regexes in language_standards.py were already extremely robust, and passed all tests flawlessly (no false positive captures or missing captures). Thus, no changes to language_standards.py were required.

Resolves #857

@squid-protocol squid-protocol added testing Unit, integration, and E2E pipeline verification core-engine Modifications to the central physics and parsing engine labels Aug 1, 2026
@github-actions

github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

- Migrated agc_assembly out of monolithic dicts.
- Created ~136 tests for func_start, args, and _dependency_capture.
- Verified valid, invalid, and pathological cases.
- AGC regexes proved robust; no changes to language_standards.py required.
Reviewed the prior test-authoring pass (136 tests, claimed zero bugs
found, "patterns already extremely robust") given every other language
in this epic found real bugs. Found two significant, corpus-validated
bugs the original review missed:

- `func_start`'s opcode whitelist covered only 16 real instructions,
  missing ~25 opcodes this SAME file's own sibling rules (`branch`,
  `args`, `safety`, `state_mutation`) already recognize as legitimate --
  CAF, TCF, XCH, LXCH, QXCH, AD, ADS, SU, MULT, DV, MASK, INCR, AUG, DIM,
  DAS, RELINT, EDRUPT, BZE, BMN, RESUME, RETURN, TCR, GOTO, RVQ. `CAF`
  (Clear and Add Fixed) alone has 94 occurrences in the real Apollo 11
  corpus -- on par with CA/CS/TS as one of the most common AGC
  instructions -- and was entirely invisible as a subroutine anchor.

- `args`'s register-coupling opcode list was missing AUG/DIM/INCR, real
  instructions this file's own `state_mutation` rule already recognizes,
  so `AUG A`/`DIM Q`/`INCR A` (a register explicitly coupled to a real
  opcode, exactly what this rule exists to capture) were invisible.

Confirmed both fixes' real-world impact directly against the Apollo 11
(Luminary/Comanche) source corpus in language-crucible: func_start's
total matches rose from 609 to 812 (+33%), with zero new false positives
against data/constant pseudo-ops (OCT/OCTAL/DEC/2DEC/ADRES/EQUALS all
correctly stay excluded -- those mark data declarations, not subroutine
entries). Both fixes verified linear-time (no ReDoS).

The original test suite's own `invalid` list literally asserted
"MYLABEL\tTCF INTERNAL" must NOT match, with the comment "TCF is not in
the opcode list" -- true of the code as written, false of real AGC
assembly. Fixed the test file: moved TCF (and CAF/XCH/LXCH/AD/MASK/INCR/
RELINT) to valid cases, added dedicated regression tests for both bugs
documenting the corpus-validated before/after counts, added AUG/DIM/INCR
valid cases for args, and cleaned up two stray blank-line artifacts left
in the old monolithic dict files by the migration.

crucible_check.py showed a real diff, confirmed the only CONTENT changes
(not global-aggregate/topological-coordinate ripple, an expected side
effect of agc_assembly's structural mass shifting) were in agc_assembly
itself -- real Apollo 11 subroutines (SPVAC, NEXTCORE, JOBWAKE3,
SUPDXCHZ, VACFOUND) previously silently merged into a preceding
function's body now correctly resolve as their own boundaries. Golden
master fixtures re-blessed.

Also rebased this branch onto latest main: it had accidentally bundled
an already-separately-merged, unrelated kotlin fix (#899/#929) from
before that work was cleanly split into its own PR. The rebase dropped
the now-redundant duplicate commits automatically (git detected their
patch content was already upstream).

Epic #813 updated with 3 new recurring bug classes (58-60), including a
meta-lesson about AI-authored test coverage validating against existing
implementation behavior rather than real-world ground truth.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@squid-protocol
squid-protocol force-pushed the extraction-hardening-agc-assembly branch from eb143ef to a6bfb60 Compare August 1, 2026 02:38
@squid-protocol
squid-protocol merged commit 577ab55 into main Aug 1, 2026
28 checks passed
@squid-protocol
squid-protocol deleted the extraction-hardening-agc-assembly branch August 1, 2026 02:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core-engine Modifications to the central physics and parsing engine testing Unit, integration, and E2E pipeline verification

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Extraction hardening: agc_assembly

1 participant