Tetris experiment: 2 codegen bugs + 6 friction features + ROADMAP updates#623
Tetris experiment: 2 codegen bugs + 6 friction features + ROADMAP updates#623aallan wants to merge 1 commit into
Conversation
…ates An agent attempting to write terminal Tetris on Vera 0.0.138 surfaced two new closure-codegen bugs and a substantial friction list. This PR files all of it as GitHub issues and lands them in KNOWN_ISSUES.md / ROADMAP.md in the right places. Bugs (filed + reproduced on current main, added to KNOWN_ISSUES.md): * #615 -- Non-contiguous outer-Int capture in closures miscompiles. Closure that references @Int.k while skipping @Int.j (0 < j < k) emits malformed WASM: tail-shaped expressions trap at instantiation, body shapes with subsequent let-pushes silently produce wrong values. vera check is silent. Hit *everywhere* in the Tetris collision-check; required helper-function workarounds throughout. * #614 -- Closure capturing data ADT and passing it to a function call emits malformed WASM (unknown table 0: table index out of bounds). vera check is silent. Single-variant ADTs reproduce identically. Hypothesised same root cause as #615 in the closure-lifter env-struct serialisation -- one fix may close both. Both promoted to top of stabilisation tier in ROADMAP.md (#615 first since silent miscompute is the most severe failure mode). Friction features (filed as separate issues, added to ROADMAP.md): * #616 -- nat_add / nat_sub_sat / nat_mul built-ins (Phase 4c). Most painful gap by frequency: today, adding two Nats requires a five-line int_to_nat round-trip with an unreachable None arm. * #617 -- Anonymous tuples with destructuring (Speculative). The friction doc explicitly de-prioritises this -- the slot system needs a story for tuples, and the existing workarounds (Array<Int> / single-variant ADT) work today. * #618 -- IO.read_char / Terminal effect (Phase 2c). Tetris is fundamentally real-time but IO.read_line is line-buffered, forcing the agent to ship a turn-based variant. Pairs with #609 / #610 for browser real-time programs. * #619 -- Single-keyword pure / io shorthand for the vacuous contract preamble (Phase 4d). Strict superset of existing syntax. * #620 -- Optional field names in data declarations (Phase 4d) for --explain-slots and error-message use. Slot semantics unchanged. * #621 -- debug effect permitted in any effect row (Phase 3c). Single privileged escape hatch for diagnostic stderr; effect-system and verifier-invisible; strippable in production. * #622 -- SKILL.md polish: array_join cross-reference + decreases-with-+1 idiom example (Phase 3c, documentation-only). ROADMAP changes: * Stabilisation tier expanded from 7 to 9 items; #614 and #615 inserted at the top. Agent-integration tier renumbered 8/9/10 to 10/11/12. * Phase 2c gains #618 (IO.read_char / Terminal effect). * Phase 3c gains #621 (debug effect) + #622 (SKILL polish). * Phase 4c gains #616 (nat_add / nat_sub_sat / nat_mul). * New Phase 4d "Language ergonomics" with #619 (pure shorthand) + #620 (optional field names). * Speculative tier gains #617 (tuples) with explicit trigger condition. KNOWN_ISSUES.md gains entries for #614 and #615 in the Bugs section. Source friction documents from the Tetris experiment are referenced in each issue; one reproducer per bug archived in /tmp/tetris-repros/ during this session and confirmed reproducing on commit ec46cf8. Co-Authored-By: Claude <noreply@anthropic.invalid>
📝 WalkthroughWalkthroughKNOWN_ISSUES.md and ROADMAP.md updated to document closure-capture WASM miscompilation failures, reorder stabilisation-tier priorities with the new issues elevated, and add planned work items for Milestones 2–4 covering IO, debugging, standard library completeness, and speculative language features. ChangesProject Status & Tracking Documentation
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related issues
Possibly related PRs
Suggested labels
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@ROADMAP.md`:
- Line 194: The list item for issue `#621` contains a trailing table delimiter
character '|' at the end of the line (the stray pipe), which triggers accidental
table syntax in Markdown; remove the trailing '|' from the "[`#621`] ... |" list
entry so the item ends cleanly without the pipe character (update the line
containing the "#621" bullet to delete the final '|').
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 5807b642-c790-4b2e-8034-221e614e5ee8
📒 Files selected for processing (2)
KNOWN_ISSUES.mdROADMAP.md
|
Folding into #613 — the user correctly pointed out everything should be in one PR. Reopening this work as additional commits on the claude/roadmap-trim-retrospective branch backing #613, after critically re-evaluating each friction item against Vera's design principles (mandatory contracts, De Bruijn slot indexing, effect-row visibility) rather than just transcribing the friction-doc proposals. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #623 +/- ##
=======================================
Coverage 90.92% 90.92%
=======================================
Files 59 59
Lines 22997 22997
Branches 259 259
=======================================
Hits 20910 20910
Misses 2080 2080
Partials 7 7
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Fold the Tetris-experiment work into this PR (was opened as #623, which is now closed in favour of bundling here). Bugs (filed + reproduced on current main, added to KNOWN_ISSUES.md): * #615 -- Non-contiguous outer-Int capture in closures miscompiles (silent wrong result OR trap, depending on body shape). Hit *everywhere* in the Tetris collision-check; required helper-function workarounds throughout. * #614 -- Closure capturing data ADT and passing it to a function call emits malformed WASM. Single-variant ADTs reproduce identically. Hypothesised same root cause as #615 in the closure-lifter env-struct serialisation. Both promoted to top of stabilisation tier in ROADMAP (#615 first since silent miscompute is the most severe failure mode). Friction items: each evaluated against Vera's design principles rather than just transcribed from the friction document. Kept as-is (no design tension): * #618 -- IO.read_char / Terminal effect (Phase 2c) * #622 -- SKILL.md polish: array_join cross-reference + decreases idiom example (Phase 3c) Reframed against design principles: * #616 -- nat ops. Ship total nat_add + nat_mul (Phase 4c); reject saturating nat_sub_sat -- saturating papers over the underflow obligation that refinement types are designed to surface. The underflow case is fixed cheaper by #552 generalising @nat invariant checking. * #620 -- optional field names in data declarations (Phase 4d, new "Cosmetic / advisory additions" phase). Issue body now carries four load-bearing guardrails: names never bindable in patterns, semantics-irrelevant, no compiler enforcement, mixed/anonymous forms must coexist. Sharpens the "cosmetic only" framing so this cannot drift into named-binding territory. * #621 -- debug effect. Reframed as a *visible* first-class effect uniquely composable with pure (effects(pure | <Debug>)), not the effect-system-invisible version the friction doc proposed. The invisible version contradicted the load-bearing effect-row visibility property; the visible version preserves the design while still solving the closure-debugging friction. Closed as design-rejected: * #617 -- anonymous tuples with let (x, y) = ... destructuring. Destructuring sugar introduces named locals, which contradict Vera's De Bruijn slot indexing. The friction doc itself de-prioritised this; the data Pair { Pair(A, B) } workaround is the design-aligned answer. * #619 -- pure / io single-keyword shorthand. Directly undermines the mandatory contract preamble's role as a forcing function. 60 lines of vacuous preamble for 20 helpers is the design working as intended -- it makes "vacuous because lazy" and "vacuous because thoughtful" typographically distinct. ROADMAP changes: * Stabilisation tier expanded from 7 to 9 items; #614 / #615 inserted at top. Agent-integration tier renumbered 8/9/10 -> 10/11/12. * Phase 2c gains #618. * Phase 3c gains #621 + #622. * Phase 4c gains #616 (nat_add + nat_mul; nat_sub_sat rejected). * New Phase 4d "Cosmetic / advisory additions" with #620. KNOWN_ISSUES.md gains entries for #614 and #615 in the Bugs section. Co-Authored-By: Claude <noreply@anthropic.invalid>
Summary
An agent attempting to write terminal Tetris on Vera 0.0.138 surfaced two new closure-codegen bugs and a substantial friction list. This PR files all of it as GitHub issues and lands the entries in
KNOWN_ISSUES.md/ROADMAP.md.Bugs reproduced on current main and filed (added to KNOWN_ISSUES.md)
@Int.kwhile skipping@Int.j(0 < j < k) emits malformed WASM: tail-shaped expressions trap at instantiation, body shapes with subsequentlet-pushes silently produce wrong values.vera checkis silent. Hit everywhere in the Tetris collision check; required helper-function workarounds throughout.dataADT and passing it to a function call emits malformed WASM (unknown table 0: table index out of bounds).vera checkis silent. Single-variant ADTs reproduce identically. Hypothesised same root cause as Non-contiguous capture of outer Int slots in closure miscompiles (trap or silent wrong result) #615 in the closure-lifter env-struct serialisation — one fix may close both.Both promoted to the top of the stabilisation tier in
ROADMAP.md(#615 first, since silent miscompute is the most severe failure mode).Friction features filed (added to appropriate ROADMAP phases)
nat_add/nat_sub_sat/nat_mulbuilt-ins (Phase 4c). Most painful gap by frequency.IO.read_char/Terminaleffect (Phase 2c). Pairs with Browser runtime: implement IO.sleep via JSPI (or Asyncify fallback) so animations don't freeze the tab #609 / Browser runtime: interpret a minimal ANSI escape subset so terminal-style Vera programs render unchanged #610 for browser real-time programs.pure/ioshorthand for the vacuous contract preamble (Phase 4d).datadeclarations (Phase 4d). Cosmetic, slot semantics unchanged.debugeffect permitted in any effect row, includingpure(Phase 3c).array_joincross-reference +decreases-with-+1 idiom example (Phase 3c, documentation-only).ROADMAP changes
Note on coordination with #613
This branch is on the un-trimmed ROADMAP because PR #613 (the trim) is still open. The new tier-table rows added here are conflict-free with #613 — the trim only touches the prose around the table, not the table rows themselves. Whichever lands first, the other rebases cleanly.
Test plan
ec46cf8):unknown table 0: table index out of boundsat offset 1374.fits = falseinstead offits = true.result: [13, 24, 35, 46]correctly.python scripts/check_doc_counts.py— consistent (38 KNOWN_ISSUES entries, was 36)python scripts/check_limitations_sync.py— consistentpython scripts/check_site_assets.py— up to dateSummary by CodeRabbit
Documentation