test(vba): cover rule scan and structural gates - #172
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #165
Summary
TDD evidence
px vitest run tests/extraction-vba-rule-fields.test.ts tests/extraction-vba-rule-table.test.ts\ (54 passed)
pm run build`n
Review
Independent reliability review found no blocking or important findings.