You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Comprehensive PR review (code-reviewer + pr-test-analyzer +
comment-analyzer + silent-failure-hunter, all in parallel)
surfaced 9 actionable items. Addressed 7, deferred 2 with
reasons.
**Critical**
1. **CHANGELOG test count** (comment-analyzer + code-reviewer).
The Tests section said "5 new tests" but the class actually
has 6 (the JSON sibling added in round 3 wasn't back-
propagated). Updated to 6 with the new bullet.
2. **`host_html_parse` broad-except swallowed `_wrap_handle`
invariant violations** (silent-failure-hunter). The
`except Exception as exc:` at `vera/codegen/api.py:2784`
converted any RuntimeError (including the new #578 range-
check raise) into a user-domain `Result.Err` string,
masking real invariant violations as "malformed HTML"
errors. Narrowed to `(ValueError, TypeError, AttributeError)`
matching the sibling `host_json_parse` pattern.
**Important**
3. **`_wrap_handle` range guard had zero unit tests** (pr-test-
analyzer, rating 7). Extracted the validator to a module-
level `_validate_wrap_handle` helper so it can be unit-
tested directly without standing up a wasmtime instance.
`_wrap_handle` now calls the helper. Added 5 tests
covering all failure modes:
- `test_validate_wrap_handle_accepts_valid_range` (0, 1,
12345, 0x7FFFFFFE, 0x7FFFFFFF)
- `test_validate_wrap_handle_rejects_negative` (-1, -12345)
- `test_validate_wrap_handle_rejects_at_2gb_boundary`
(0x80000000)
- `test_validate_wrap_handle_rejects_above_32bit`
(0x100000000, 0x100000001 — the round-1 bit-only check
would have missed these)
- `test_validate_wrap_handle_rejects_non_int` (None, "5",
1.5, [1], {})
4. **GC mark phase missing defense-in-depth narrative** (silent-
failure-hunter). The conservative scan's heap-range check
relies on the disjointness invariant (`heap_ptr < 2 GiB` so
tagged handles `>= 2 GiB` can never match). Added a
substantial comment block at the scan site documenting the
invariant and pointing at the two structural tests that pin
it. Comment-only (no runtime cost in the GC hot path); the
structural tests are the mechanical defense.
**Comment accuracy** (comment-analyzer)
5. `test_json_round_trip_uses_host_side_mask` referenced
`json_serde.py` line 213 by hardcoded number — drifts on
any nearby edit. Replaced with the "unknown JObject
handle" warning reference.
6. `2 GB` → `2 GiB` throughout (assembly.py + tests/test_
codegen.py). Strictly `0x80000000 = 2 GiB` (binary), not
2 GB (decimal = ~1.86 GiB).
7. `"Practical Vera programs use <100 MB"` was an
unsubstantiated claim stated as fact. Reworded to
`"Programs we have measured stay well below the 2 GiB
ceiling"`.
8. The class docstring's `gc_heap_start (~147 KiB)` figure
actually depends on the string-pool size (`data_end + 144
KiB`). Softened to `~144 KiB above the data section, so
roughly 144 KiB plus the string-pool size`.
**Deferred with reason**
9. `$alloc` heap-ceiling trap is bare `unreachable`, surfaces
via the trap classifier as `"unreachable"` kind with the
match-arm Fix message (silent-failure-hunter, Important).
Polishing this requires either a host-import call from
`$alloc` to populate `last_violation` (cost on the hot path)
or a new classifier kind with a heuristic detector
(brittle). Practical programs never reach this trap
(heap << 2 GiB), so deferred. Marked with a TODO inside
`assembly.py` as a Python comment (NOT a WAT comment — a
WAT comment between `if` and `unreachable` would break the
adjacent-sequence regex in `test_alloc_emits_heap_ceiling_
guard`).
The other declined findings from the agents:
- silent-failure-hunter `read_json` warn → raise (pre-existing
behavior, separate concern)
- silent-failure-hunter `_call_register_wrapper` early-return
→ assert (pre-existing pattern, out of scope)
- silent-failure-hunter wasmtime trap-text enrichment (would
need last_violation channel work; separate PR)
- code-reviewer i32.add wraparound at heap-ceiling guard
(confidence 60 — self-flagged; defended upstream by
`memory.grow` and 31-bit-size invariant)
Validation: pytest 3,874/3,874 ✓ (added 5 new tests),
mypy clean, ruff S clean, all 18 pre-commit hooks green,
doc-counts consistent (1,111 → 1,116 tests in
test_codegen.py; total 3,899 → 3,904).
Co-Authored-By: Claude <noreply@anthropic.invalid>
Copy file name to clipboardExpand all lines: CHANGELOG.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
17
17
18
18
### Tests
19
19
20
-
-`tests/test_codegen.py::TestWrapperHandleTagging578` — 5 new tests pinning the contract: (1) wrap site emits `i32.const 0x80000000; i32.or`, (2) unwrap site emits `i32.load offset=4; i32.const 0x7FFFFFFF; i32.and`, (3) `$alloc` body contains the heap-ceiling guard, (4) end-to-end wrap/unwrap round trip preserves the original handle (a Map insert + lookup), (5) `html_to_string` produces the correct length output — pinning that the host-side `read_html` mask is in place (without it the attribute dict lookup would miss and the rendered HTML would be missing the `title="..."` attribute).
20
+
-`tests/test_codegen.py::TestWrapperHandleTagging578` — 6 new tests pinning the contract: (1) wrap site emits `i32.const 0x80000000; i32.or`, (2) unwrap site emits `i32.load offset=4; i32.const 0x7FFFFFFF; i32.and`, (3) `$alloc` body contains the heap-ceiling guard (ordered 8-instruction sequence pinned by adjacent-sequence regex), (4) end-to-end wrap/unwrap round trip preserves the original handle (a Map insert + lookup), (5) `html_to_string` produces the correct length output — pinning that the host-side `read_html` mask is in place (without it the attribute dict lookup would miss and the rendered HTML would be missing the `title="..."` attribute), (6) `json_stringify(JObject(...))` produces the correct length — sibling test for the host-side `read_json` mask (which lives in `vera/wasm/json_serde.py` and bypasses the WAT unwrap helper just like `read_html` does).
Vera is in **active development** at v0.0.155 — 810+ commits, 155 releases, 3,899 tests, 96% code coverage, 86 conformance programs, 34 examples, and a 13-chapter specification. See **[HISTORY.md](HISTORY.md)** for how the compiler was built.
184
+
Vera is in **active development** at v0.0.155 — 810+ commits, 155 releases, 3,904 tests, 96% code coverage, 86 conformance programs, 34 examples, and a 13-chapter specification. See **[HISTORY.md](HISTORY.md)** for how the compiler was built.
185
185
186
186
The reference compiler — parser, AST, type checker, contract verifier (Z3), WASM code generator, module system, browser runtime, and runtime contract insertion — is working. The language specification is in draft across [13 chapters](spec/).
0 commit comments