fix(abi-verify): tolerate non-canonical Zig switch arm false shorthand#36
Merged
Merged
Conversation
`abi-verify`'s Zig FFI parser bombed on 5 cartridges' `isValidTransition`
switch arms because their terminal-state arm body is the literal
`false` (no outgoing transitions allowed) rather than the canonical
`to == .<v>` chunk form:
fn isValidTransition(from: BspState, to: BspState) bool {
return switch (from) {
...
.exited => false, // <-- parser bombed here
};
}
The Zig is well-formed and the semantics ("empty allowed-set") are
clear; the verifier just didn't accept the shorthand.
`parse_arm_targets` now detects this form (body trimmed of trailing
`,`/`;` and whitespace equals `false`) and returns the empty vec —
equivalent to the "this state has no allowed outgoing transitions"
manifest semantics, which is exactly what the cartridges intend.
End-to-end verified against the 5 cartridges named in the issue
(after a fresh `cargo build --release`):
bsp-mcp → parses cleanly; surfaces real drift on BspCapability
container-mcp → abi-verify OK
dap-mcp → parses cleanly; surfaces real drift on StepGranularity
lsp-mcp → parses cleanly; surfaces real drift on CompletionKind
vault-mcp → parses cleanly; surfaces real drift on IdentityType
All 5 now produce either exit 0 (clean) or a real drift diagnosis,
which is precisely the acceptance criterion in iseriser#19. The
post-parse drift findings are separate per-cartridge issues — not
verifier defects — and out of scope for this PR.
44 lib tests + 9 integration tests pass.
Refs hyperpolymath/standards#92 (Phase 2 allowlist expansion).
Refs #19.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
abi-verify's Zig FFI parser bombed on 5 cartridges'isValidTransitionswitch arms because their terminal-state arm body is the literalfalse(no outgoing transitions allowed) rather than the canonicalto == .<v>chunk form:The Zig is well-formed and the semantics ("empty allowed-set") are clear; the verifier just didn't accept the shorthand.
parse_arm_targetsnow detects this form (body trimmed of trailing,/;and whitespace equalsfalse) and returns the empty vec — equivalent to the "this state has no allowed outgoing transitions" manifest semantics, which is exactly what the cartridges intend.End-to-end verified against the 5 cartridges named in the issue (after a fresh
cargo build --release):bsp-mcp → parses cleanly; surfaces real drift on BspCapability
container-mcp → abi-verify OK
dap-mcp → parses cleanly; surfaces real drift on StepGranularity
lsp-mcp → parses cleanly; surfaces real drift on CompletionKind
vault-mcp → parses cleanly; surfaces real drift on IdentityType
All 5 now produce either exit 0 (clean) or a real drift diagnosis, which is precisely the acceptance criterion in iseriser#19. The post-parse drift findings are separate per-cartridge issues — not verifier defects — and out of scope for this PR.
44 lib tests + 9 integration tests pass.
Refs hyperpolymath/standards#92 (Phase 2 allowlist expansion). Refs #19.
Summary
Changes
RSR Quality Checklist
Required
just testor equivalent)just fmtor equivalent)unsafeblocks without// SAFETY:commentsbelieve_me,unsafeCoerce,Obj.magic,Admitted,sorry).envfiles includedAs Applicable
.machine_readable/STATE.a2mlupdated (if project state changed).machine_readable/ECOSYSTEM.a2mlupdated (if integrations changed).machine_readable/META.a2mlupdated (if architectural decisions changed)TOPOLOGY.mdupdated (if architecture changed)CHANGELOGor release notes updatedsrc/interface/abi/andsrc/interface/ffi/consistent)Testing
Screenshots