Commit 6ed3ee7
feat(verify): verify_capabilities + verify_access_sites passes (proposal 0002 §Gate 4) (#109)
## Summary
Closes proposal 0002 §Gate 4 (\`verify_access_sites\` cross-section
pass) and the equivalent for proposal 0001's capabilities carrier. Both
proposals are now ~95% through acceptance criteria.
## New public API
- \`CapabilitiesError\` + \`verify_capabilities_from_module\` (gated
\`unstable-l15\`)
- \`AccessSiteError\` + \`verify_access_sites_from_module\` (gated
\`unstable-l2\`)
- Section-name constants for both
## Checks performed
### \`verify_capabilities\`
- Per-function \`func_idx\` is within module function count (import +
locally-defined)
- Per-function \`required\` capability index is within capability-table
bounds
### \`verify_access_sites\`
- **\`MissingDependentRegions\`** (proposal 0002 §"Producer obligations"
#2): access-sites without regions is a hard error. Also fires if regions
present but unparseable (version mismatch).
- Per-entry \`func_idx\` in module function count
- Per-entry \`region_id\` in regions table
- Per-entry \`field_id\` in target region's field table (skipped if
region_id was out of range)
### Deliberately out of scope (deferred)
- **DistinctCaps**: codec parser already normalises \`required\` to
sorted+deduped form. Verifying strictly-increasing wire emission would
need pre-normalisation byte access. Defer as a producer-side property
test.
- **AccessSiteMisalignment**: would require parsing function bodies to
verify \`instruction_byte_offset\` lands on a typed access opcode.
Proposal 0002 explicitly defers this.
## Tests (+11)
5 capabilities + 6 access-sites verifier tests using \`wasm-encoder\` to
build minimal valid modules with the relevant custom sections (and
matching Function+Code sections — required for wasm validation).
| features | tests passed |
|--------------------------------|--------------|
| (default) | 43 |
| \`unstable-l2\` | 65 (+6) |
| \`unstable-l15\` | 55 (+5) |
| \`unstable-l2,unstable-l15\` | 77 (+11) |
## Acceptance progress after this lands
**Proposal 0001** (regions + capabilities):
- ✅ Criterion 1 — paired sign-off
- ⏳ Criterion 2 — wire-vs-Idris2-spec review (proof-side write-up)
- ✅ Criterion 3 — codec landed
- ✅ Criterion 4 — spec doc (#108)
- ✅ Criterion 5 — cross-repo issues filed
- ✅ + capabilities verifier pass (this PR, not in criteria but completes
the matching pair to regions parsing)
**Proposal 0002** (access-sites):
- ✅ Gates 1, 2, 3, 5
- ✅ **Gate 4** — this PR
- ⏳ Gate 6 — producer codegen issues for access-sites
## Test plan
- [x] \`cargo build\` (default features) succeeds
- [x] \`cargo test --lib\` (4 feature combos): 43 / 65 / 55 / 77 pass /
0 fail
- [x] No regression in integration suite
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 4436e1e commit 6ed3ee7
2 files changed
Lines changed: 626 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
141 | 206 | | |
142 | 207 | | |
143 | 208 | | |
| |||
151 | 216 | | |
152 | 217 | | |
153 | 218 | | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
154 | 263 | | |
155 | 264 | | |
156 | 265 | | |
| |||
0 commit comments