Skip to content

test(vba): cover rule scan and structural gates - #172

Merged
ardelperal merged 4 commits into
mainfrom
test/165-vba-rule-field-behavior
Jul 18, 2026
Merged

test(vba): cover rule scan and structural gates#172
ardelperal merged 4 commits into
mainfrom
test/165-vba-rule-field-behavior

Conversation

@ardelperal

Copy link
Copy Markdown
Owner

Closes #165

Summary

  • add behavior coverage for masked, unmasked, and dual scan modes
  • pin procedure, type-block, and enum-block rule gates
  • make the dispatcher honor each rule's declared scan mode

TDD evidence

  • RED: 13 failures across four controlled gate/masking mutations
  • RED: 3 scan-mode tests failed before \matchRuleForScan\ existed
  • GREEN:
    px vitest run tests/extraction-vba-rule-fields.test.ts tests/extraction-vba-rule-table.test.ts\ (54 passed)
  • Full VBA suite: 514 passed, 1 skipped, 0 failed

  • pm run build`n

Review

Independent reliability review found no blocking or important findings.

opencode and others added 4 commits July 18, 2026 11:17
The declarative VbaExtractionRule table (issue #153) exposes two
gating fields that production rules actually use today:

  - scan: 'masked'    (call-sweep)  - matches against the masked line
  - requires: 'inside-procedure'  (call-sweep)  - gates by closure proc stack
  - requires: 'outside-type-block' / 'inside-type-block'  (declarations)
  - requires: 'outside-enum-block' / 'inside-enum-block'  (enums-consts)

The existing rule-table suite (extraction-vba-rule-table.test.ts) only
pins the SHAPE of rules (id, description, pattern, emit). A future
refactor that breaks the masking or gating semantics would pass that
suite unchanged.

Add a 24-test behavior suite that drives the dispatchers directly with
minimal synthetic fixtures (no Access binary, no full orchestrator, no
SQLite) and pins the per-field semantics end-to-end. The dispatcher-
level tests are mirrored by four VbaExtractor end-to-end tests so the
gating also survives the full preprocessing + walker + finalize path.

RED/GREEN evidence (controlled mutations on the current production
codebase, all reverted):

  * drop the masked-line contract in call-sweep (use raw 'line'
    instead of 'callScanLine'):
      - does NOT fire when Set x = New <Type> is inside a string lit
      - does NOT fire when Set x = New <Type> is in an unterminated
        string fragment
      - end-to-end Set y = New GhostType hidden in a string lit
    => 3 failures, all on masked-line tests.

  * drop the requires: 'inside-procedure' gate in call-sweep:
      - set-new does NOT fire for module-level Set x = New <Type>
      - set-call does NOT fire at module level
      - end-to-end module-level Set x = New Foo
    => 3 failures, all on inside-procedure tests.

  * drop the type-block gates in declarations:
      - event-decl does NOT fire inside a Type / End Type block
      - type-start does NOT fire inside an open type block
      - dll-declare does NOT fire inside a Type / End Type block
      - end-to-end Event Y inside a Type X / End Type
    => 4 failures, all on type-block tests.

  * drop the enum-block gates in enums-consts (and pin the proc-start
    side-effect on ctx.procStack for stronger mutation sensitivity):
      - const-decl does NOT fire inside an Enum / End Enum block
      - proc-start does NOT fire inside an enum block
      - end-to-end Const X = 1 inside an Enum Y / End Enum
    => 3 failures, all on enum-block tests.

Total: 13 RED-with-mutation findings across 4 surgical mutations,
covering every production gating path. After revert, all 24 tests
in the new file pass; the full VBA suite (515 tests) still passes
(514 passed, 1 pre-existing skip).

No production changes; no public API change. CHANGELOG notes the
strengthened regression protection under Unreleased / New Features.

Refs #165
@ardelperal ardelperal added the area:vba VBA/Access-specific work (parent codegraph product) label Jul 18, 2026
@ardelperal
ardelperal merged commit 425e33a into main Jul 18, 2026
3 checks passed
@ardelperal
ardelperal deleted the test/165-vba-rule-field-behavior branch July 18, 2026 09:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:vba VBA/Access-specific work (parent codegraph product)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test: vba-extractor — add behavior tests for scan and requires rule fields

1 participant