feat(abi-verify): teach the converter Zig reserved words (standards#9…#33
Closed
hyperpolymath wants to merge 1 commit into
Closed
feat(abi-verify): teach the converter Zig reserved words (standards#9…#33hyperpolymath wants to merge 1 commit into
hyperpolymath wants to merge 1 commit into
Conversation
…2 follow-up)
Phase 2's spot-check across the boj-server cartridge corpus found that
when an Idris2 variant snake_cases to a Zig reserved word, the cartridge
renames the Zig identifier to avoid the collision (e.g. `Error → err`
in airtable-mcp, postgresql-mcp). The verifier raised this as
`variant-missing-in-zig` + `variant-extra-in-zig` — a false-positive
class that masked real findings.
## Changes
- `manifest_schema.rs`:
- `ZIG_RESERVED` — Zig 0.15.x reserved-word list (50 keywords)
- `is_zig_reserved(word)` — predicate
- `zig_reserved_workaround(word)` — cartridge convention table
(`error → err` is the verified case; generic `<name>_` fallback
for future cartridges that pick a different rename)
- `zig_variant_candidates(idris_name)` — returns the snake_case form,
plus the workaround when the snake_case is reserved
- `verify.rs`:
- enum-variant lookup tries every candidate; first match wins
- `manifest_keys` records every candidate so the accept-by-omission
check doesn't flag a Zig variant the manifest legitimately covers
- transition-table resolution uses candidates symmetrically (so
`Error → SomeState` in the manifest matches `err → some_state`
in the Zig switch)
- finding messages now name every candidate tried, not just the
snake_case form
## Verified
- 43 lib tests green (was 39; +4 new in `manifest_schema::tests`)
- `airtable-mcp` was DRIFT (Error→err false-positive), is now CLEAN
- `postgresql-mcp` now passes the reserved-word check; remaining drift
is a separate naming-convention issue (`BeginTransaction → begin_tx`,
abbreviation, not reserved-word — out of scope for this PR)
- `ssg-mcp`, `k9iser-mcp` unchanged (still clean)
- `007-mcp` still DRIFT (`ToolRisk` missing in Zig — that's a real
cartridge defect, not a verifier defect, will be fixed separately)
## Note on `type`
`type` is a Zig **primitive** (alongside `bool`, `u32`, etc.), not a
reserved keyword — it's a legal identifier in enum contexts. Explicit
test pinning this so a future reader doesn't add it to the reserved
list by mistake.
Refs hyperpolymath/standards#92
Refs hyperpolymath/standards#89
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Owner
Author
|
Closing as superseded. Branch tip ( |
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.
…2 follow-up)
Phase 2's spot-check across the boj-server cartridge corpus found that when an Idris2 variant snake_cases to a Zig reserved word, the cartridge renames the Zig identifier to avoid the collision (e.g.
Error → errin airtable-mcp, postgresql-mcp). The verifier raised this asvariant-missing-in-zig+variant-extra-in-zig— a false-positive class that masked real findings.Changes
manifest_schema.rs:ZIG_RESERVED— Zig 0.15.x reserved-word list (50 keywords)is_zig_reserved(word)— predicatezig_reserved_workaround(word)— cartridge convention table (error → erris the verified case; generic<name>_fallback for future cartridges that pick a different rename)zig_variant_candidates(idris_name)— returns the snake_case form, plus the workaround when the snake_case is reservedverify.rs:manifest_keysrecords every candidate so the accept-by-omission check doesn't flag a Zig variant the manifest legitimately coversError → SomeStatein the manifest matcheserr → some_statein the Zig switch)Verified
manifest_schema::tests)airtable-mcpwas DRIFT (Error→err false-positive), is now CLEANpostgresql-mcpnow passes the reserved-word check; remaining drift is a separate naming-convention issue (BeginTransaction → begin_tx, abbreviation, not reserved-word — out of scope for this PR)ssg-mcp,k9iser-mcpunchanged (still clean)007-mcpstill DRIFT (ToolRiskmissing in Zig — that's a real cartridge defect, not a verifier defect, will be fixed separately)Note on
typetypeis a Zig primitive (alongsidebool,u32, etc.), not a reserved keyword — it's a legal identifier in enum contexts. Explicit test pinning this so a future reader doesn't add it to the reserved list by mistake.Refs hyperpolymath/standards#92
Refs hyperpolymath/standards#89
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