Commit 570d337
feat(abi-verify): teach the converter Zig reserved words (standards#92 follow-up) (#15)
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>1 parent aa2484c commit 570d337
2 files changed
Lines changed: 118 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
71 | 116 | | |
72 | 117 | | |
73 | 118 | | |
| |||
82 | 127 | | |
83 | 128 | | |
84 | 129 | | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
85 | 164 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
98 | | - | |
99 | | - | |
100 | | - | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
101 | 112 | | |
102 | 113 | | |
103 | 114 | | |
104 | | - | |
105 | | - | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
106 | 123 | | |
107 | 124 | | |
108 | | - | |
| 125 | + | |
109 | 126 | | |
110 | 127 | | |
111 | 128 | | |
| |||
171 | 188 | | |
172 | 189 | | |
173 | 190 | | |
174 | | - | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
175 | 202 | | |
176 | 203 | | |
177 | | - | |
178 | | - | |
| 204 | + | |
| 205 | + | |
179 | 206 | | |
180 | 207 | | |
181 | 208 | | |
| |||
205 | 232 | | |
206 | 233 | | |
207 | 234 | | |
208 | | - | |
209 | | - | |
| 235 | + | |
| 236 | + | |
210 | 237 | | |
211 | 238 | | |
212 | 239 | | |
| |||
0 commit comments