Add IO.sleep, IO.time, IO.stderr (closes #463, v0.0.114)#491
Conversation
Three new operations on the built-in IO effect: - IO.sleep(@nat) -> Unit # pause for N milliseconds - IO.time(@Unit) -> @nat # current Unix time in ms - IO.stderr(@string) -> Unit # write to stderr Implementation trail: - environment.py: three OpInfo entries on the IO EffectInfo. - codegen/api.py: host_sleep (time.sleep), host_time (time.time * 1000, i64), host_stderr (writes to sys.stderr or optional capture buffer). - ExecuteResult gains a `stderr: str` field (empty by default to preserve the pre-#463 shape). execute() gains a `capture_stderr: bool = False` parameter so tests can opt in without leaking to the real stderr. - codegen/assembly.py: three _IO_IMPORTS entries (sleep param i64, time result i64, stderr param i32 i32). - wasm/context.py: _is_void_expr now treats IO.sleep and IO.stderr as void like IO.print, so trailing statements don't emit a spurious `drop`. - browser/runtime.mjs: hostSleep busy-waits on performance.now (Atomics.wait unavailable on main thread; long sleeps block rendering), hostTime = Date.now() as BigInt, hostStderr captures to stderrBuf with getStderr()/clearStderr() accessors. Reset path includes stderrBuf. - browser/harness.mjs: emits `stderr` alongside `stdout` in the JSON output so test_browser.py can assert on captured stderr. Tests: - tests/conformance/ch07_io_time_stderr.vera — exercises time + stderr together; level=run. (Sleep excluded — wall-clock timing is inherently flaky; covered by unit tests instead.) - tests/test_codegen.py: 5 new tests (time returns positive Nat, sleep completes, sleep(0) no-op, stderr captured when requested, stderr empty by default). - tests/test_browser.py: 3 new tests (stderr capture, time past epoch, sleep completes). Documentation: - SKILL.md: IO table updated from 7 ops to 10; browser-runtime paragraph extended to cover the new ops. - spec/12-runtime.md: three new host-import rows, three new §12.4.1.x subsections (sleep/time/stderr), browser comparison table extended. - CHANGELOG.md: v0.0.114 section with the full write-up. - Doc-count sweep: 73 → 74 conformance, 3,338 → 3,351 tests, test_browser/test_codegen/test_codegen_monomorphize line counts, test count references in README/FAQ/AGENTS/TESTING/ROADMAP. Also bundled in this PR (ROADMAP → HISTORY shuffle for #480, which should have been in #489 but was missed): - HISTORY.md gains three Stage 11 entries: #484 widen header, #480 iterative combinators, and the v0.0.114 #463 entry. - ROADMAP.md removes #480 row from "What's next", removes the #463 standalone bullet from Phase 4a, adjusts the reshape paragraph and capability-expansion examples list to match. Version bump: v0.0.113 → v0.0.114 in pyproject.toml, vera/__init__.py, docs/index.html, README.md. Co-Authored-By: Claude <noreply@anthropic.invalid>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #491 +/- ##
=======================================
Coverage 90.27% 90.28%
=======================================
Files 58 58
Lines 19980 20052 +72
Branches 225 228 +3
=======================================
+ Hits 18037 18104 +67
- Misses 1939 1944 +5
Partials 4 4
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:
|
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdds IO.sleep, IO.time and IO.stderr end-to-end: environment registration, WAT import signatures, Python/browser host implementations with optional stderr capture, tests and conformance entries, docs/ROADMAP/CHANGELOG/HISTORY updates, pre-push hook addition, and version bump to 0.0.114. Changes
Sequence Diagram(s)sequenceDiagram
participant Test as rgba(31,119,180,0.5) Test/Harness
participant Execute as rgba(44,160,44,0.5) Execute()
participant WASM as rgba(214,39,40,0.5) Compiled WASM
participant Host as rgba(148,103,189,0.5) Host bindings
participant Runtime as rgba(140,86,75,0.5) Python/Browser runtime
Test->>Execute: call execute(capture_stderr=bool)
Execute->>WASM: instantiate & call entry
WASM->>Host: call import vera.time / vera.sleep / vera.stderr
Host->>Runtime: dispatch to Python or Browser implementation
Runtime-->>Host: return value / append stderr
Host-->>WASM: return to module
WASM-->>Execute: normal return or trap
Execute-->>Test: return ExecuteResult(stdout, stderr, state)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested labels
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 8
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
FAQ.md (1)
206-210:⚠️ Potential issue | 🟡 MinorIO operations list is now outdated in project status.
After adding
IO.sleep,IO.time, andIO.stderr, the bullet at Line 210 still lists only the older IO set. Please expand that list to keep the FAQ accurate.As per coding guidelines: "
**/*.md: Review Markdown files for factual accuracy against the codebase, broken links, and outdated information."🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@FAQ.md` around lines 206 - 210, Update the IO operations bullet to reflect the current API by adding the new IO functions IO.sleep, IO.time, and IO.stderr to the existing list (which currently mentions print, read_line, read_file, write_file, args, exit, get_env); locate the FAQ.md bullet that enumerates IO operations and expand it to include IO.sleep, IO.time, and IO.stderr so the documentation matches the codebase.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@ROADMAP.md`:
- Around line 34-45: Remove the shipped issue references from ROADMAP.md by
deleting mentions of `#463` and `#480` (and any retrospective phrasing around them)
so the roadmap only lists future work; then add one-line entries for each
shipped item to the appropriate Stage 9 row in HISTORY.md (e.g., "Closed `#463` —
IO.sleep/time/stderr" and "Closed `#480` — prerequisite structural refactor")
ensuring the HISTORY.md entry format matches existing Stage 9 table rows and
that surrounding ROADMAP.md prose remains grammatically correct after removal.
In `@spec/12-runtime.md`:
- Around line 218-254: Update the count of IO host function bindings in section
12.4.1 to reflect the three new ops (IO.sleep, IO.time, IO.stderr) so the text
that currently reads "seven host function bindings" now says "ten host function
bindings" (or equivalent) and ensure any nearby summary/listing references match
the definitions of 12.4.1.1 through 12.4.1.10.
In `@TESTING.md`:
- Line 58: Update the IO coverage line in TESTING.md that references
`test_codegen.py` to include the new IO operations by adding "sleep, time,
stderr" to the existing list of covered IO ops; find the table row mentioning
`test_codegen.py` and append these three symbols to the IO section so the
documentation matches the current codebase.
In `@tests/conformance/manifest.json`:
- Around line 565-577: Add a non-runtime conformance case for IO.sleep by adding
a new manifest entry similar to "ch07_io_time_stderr" but with a unique id
(e.g., "ch07_io_sleep"), file "ch07_io_sleep.vera", chapter 7, title mentioning
IO.sleep, level set to "check" or "verify", spec_ref "Section 7.2", and features
including "io_effect" and "io_sleep"; also create the corresponding
tests/conformance/ch07_io_sleep.vera file (simple deterministic check for
IO.sleep behavior) so the manifest references an actual test program.
In `@tests/test_codegen.py`:
- Around line 7186-7204: The test test_io_stderr_default_not_captured currently
only asserts exec_result.stderr == "" but needs to also assert that stdout
remains empty to ensure no cross-stream leakage; update the
test_io_stderr_default_not_captured function to include an explicit assertion on
exec_result.stdout (e.g., assert exec_result.stdout == "") immediately after the
stderr assertion so both streams are validated when capture_stderr is not
enabled.
- Around line 7127-7128: The test uses a hard-coded epoch threshold to validate
IO.time which can fail on skewed/frozen clocks; change the assertion to capture
host time immediately before and/or after running the command and assert
int(exec_result.stdout) falls between those captured host timestamps (e.g.,
record host_time_before and host_time_after around the execution and assert
host_time_before <= int(exec_result.stdout) <= host_time_after) so the check
compares against the actual host clock rather than a fixed epoch constant.
In `@vera/browser/harness.mjs`:
- Around line 89-92: Update the example/documentation comment that describes the
emitted JSON to reflect the new shape which now includes stderr; locate the
comment next to the output object construction (variable output) where
getStdout(), getStderr(), and getState() are used and modify the example JSON to
include a stderr field alongside stdout and state (and remove any stale fields),
so the documented schema matches the actual emitted object.
In `@vera/codegen/api.py`:
- Around line 104-108: The ExecuteResult dataclass field order was changed
causing the public positional constructor to shift; restore the original
positional shape by reordering the fields so they are defined as value, stdout,
state, exit_code (and keep stderr as a defaulted field after state or keep it as
a keyword-only with a default) — update the ExecuteResult declaration (the
dataclass and its field definitions: value, stdout, state, stderr, exit_code) so
state appears before stderr and stderr retains its default "" to avoid breaking
external positional call sites.
---
Outside diff comments:
In `@FAQ.md`:
- Around line 206-210: Update the IO operations bullet to reflect the current
API by adding the new IO functions IO.sleep, IO.time, and IO.stderr to the
existing list (which currently mentions print, read_line, read_file, write_file,
args, exit, get_env); locate the FAQ.md bullet that enumerates IO operations and
expand it to include IO.sleep, IO.time, and IO.stderr so the documentation
matches the codebase.
🪄 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: 4dedca6d-4f11-435c-9e9f-f8fab5ad5273
⛔ Files ignored due to path filters (6)
docs/SKILL.mdis excluded by!docs/**docs/index.htmlis excluded by!docs/**docs/index.mdis excluded by!docs/**docs/llms-full.txtis excluded by!docs/**docs/llms.txtis excluded by!docs/**tests/conformance/ch07_io_time_stderr.verais excluded by!**/*.vera
📒 Files selected for processing (22)
AGENTS.mdCHANGELOG.mdCLAUDE.mdFAQ.mdHISTORY.mdREADME.mdROADMAP.mdSKILL.mdTESTING.mdpyproject.tomlscripts/check_skill_examples.pyspec/12-runtime.mdtests/conformance/manifest.jsontests/test_browser.pytests/test_codegen.pyvera/__init__.pyvera/browser/harness.mjsvera/browser/runtime.mjsvera/codegen/api.pyvera/codegen/assembly.pyvera/environment.pyvera/wasm/context.py
Nine findings; eight fixed, one already handled by the PR itself. Fixed: - ExecuteResult field order restored: `stderr` moved to the end of the dataclass (after `exit_code`) so the public positional constructor shape — `(value, stdout, state, exit_code)` — stays backwards-compatible for external callers. Default `""` preserves the pre-#463 behaviour. - spec/12-runtime.md: "seven host function bindings" → "ten"; harness registration example extended to include `vera.sleep`, `vera.time`, `vera.stderr`. - TESTING.md: test_codegen.py IO coverage description extended to include `sleep, time, stderr`. - tests/conformance/ch07_io_sleep.vera added at level `verify` — exercises the type/contract path for IO.sleep without depending on wall-clock timing. Unique manifest entry; spec §7.2 ref. - test_io_stderr_default_not_captured: added `assert exec_result.stdout == ""` — confirms no cross-stream leakage when a program calls only IO.stderr. - test_io_time_returns_positive_nat: replaced the hardcoded `> 1_700_000_000_000` threshold with a bracketed comparison against `time.time()` captured before/after execution. Stable on hosts with skewed or frozen clocks. - vera/browser/harness.mjs: header comment now describes the emitted JSON shape with all current fields including `stderr`. - ROADMAP.md: retrospective mentions of `#463` and `#480` removed from the reshape paragraph and the Phase 4a context; standalone references replaced with generic "iterative WASM pattern shared by array_map/array_filter/array_fold". ROADMAP now lists only future work, with completed items in HISTORY.md. - FAQ.md: IO operations bullet expanded to include `sleep, time, stderr`. Also bundled: - uv.lock regenerated after the v0.0.113 → v0.0.114 bump (unblocks the CI lint job that was failing on `uv lock --check`). Doc-count sweep reconciles the new ch07_io_sleep.vera addition: 74 → 75 conformance programs, 3,351 → 3,356 tests, and drift in test_codegen.py line count. Co-Authored-By: Claude <noreply@anthropic.invalid>
|
@coderabbitai Fixed in c90c7c3 — the FAQ's "Full IO operations" bullet now reads: |
|
Tip For best results, initiate chat on the files or code changes.
|
There was a problem hiding this comment.
Actionable comments posted: 6
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@spec/12-runtime.md`:
- Around line 572-574: Update the browser public API snippet in Section 12.9.2
so it matches the runtime and Section 12.9.3 by adding the stderr helpers to the
exported/imported names; specifically include getStderr alongside getStdout,
getState, and resetState (referencing the getStderr symbol) so the example shows
the same public API surface as documented elsewhere. Ensure the snippet
imports/exports getStderr in the same style as the other helpers and that any
example usage reflects reading the stderr capture via getStderr().
- Around line 42-44: Section 12.2.3 currently overstates that any IO operation
other than `print` and `exit` requires `$alloc`; update the paragraph to state
that only IO imports which allocate or return heap data require `$alloc`, and
explicitly note that `vera.sleep`, `vera.time`, and `vera.stderr` (which map to
`IO.sleep`, `IO.time`, `IO.stderr`) do not allocate or return heap data and
therefore do not require `$alloc`; reference the `$alloc` symbol and the IO
import names (`vera.sleep`, `vera.time`, `vera.stderr`, `IO.sleep`, `IO.time`,
`IO.stderr`) and adjust the example/contract text in section 12.2.3 accordingly
so the claim matches these cases.
In `@TESTING.md`:
- Line 9: Summary: The aggregate test count in TESTING.md is inconsistent with
the component counts; update either the total "3,356" or the component numbers
"3,344 passed, 11 skipped" so they sum correctly. Fix: open TESTING.md, locate
the table row containing "3,356 across 28 files (~34,000 lines of test code;
3,344 passed, 11 skipped)" and adjust the numeric values so the sum matches
(change the total to 3,355 or modify the passed/skipped counts to sum to 3,356),
and then commit the corrected markdown.
- Around line 109-110: The TESTING.md prose mismatches the table: after raising
the `verify` count to 4 the paragraph still states “Three programs” and lists
only three files; update the paragraph under the `verify`/`run` table to reflect
four programs by either adding the missing fourth program to the list or
changing the sentence to the correct count, and ensure the listed filenames
match the actual verify-level test files referenced by the `verify` table entry.
- Line 76: The table row for `test_conformance.py` lists 375 tests but the "Via
pytest" example still says `365 tests`; update the "Via pytest" example string
(the text containing "Via pytest" and "365 tests") to `375 tests` so both
references match, and scan TESTING.md for any other occurrences of `365 tests`
or the conformance total and make them consistent with `375` (reference:
`test_conformance.py` and the "Via pytest" example text).
🪄 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: 0a20afc7-9111-494d-b99d-7fde89c6f3fe
⛔ Files ignored due to path filters (5)
docs/SKILL.mdis excluded by!docs/**docs/llms-full.txtis excluded by!docs/**docs/llms.txtis excluded by!docs/**tests/conformance/ch07_io_sleep.verais excluded by!**/*.verauv.lockis excluded by!**/*.lock,!uv.lock
📒 Files selected for processing (12)
AGENTS.mdCLAUDE.mdFAQ.mdREADME.mdROADMAP.mdSKILL.mdTESTING.mdspec/12-runtime.mdtests/conformance/manifest.jsontests/test_codegen.pyvera/browser/harness.mjsvera/codegen/api.py
Six new findings, all addressed: spec/12-runtime.md: - §12.9.2 Public API snippet now imports and uses `getStderr` alongside `getStdout`, matching §12.9.3 and the runtime's actual exports. - §12.2.3's `$alloc` requirement paragraph no longer over-claims "any IO operation other than print and exit" — sleep, time, and stderr also don't allocate. Revised wording enumerates the five operations that do require `$alloc` (read_line / read_file / write_file / args / get_env) and names the five that don't. TESTING.md: - Summary row arithmetic fixed: 3,344 passed + 12 skipped = 3,356 (was `11 skipped`, off by one). - Prose at §Conformance Levels updated: "Four programs at verify level" (was "Three") with `ch07_io_sleep` added to the list. - "Via pytest (parametrized — 365 tests)" → "375 tests" to match the `test_conformance.py` row in the main table. - Hook count 24 → 25 (both prose and table) after adding the new pre-push hook below. Hygiene bump: add `uv-lock-check` pre-push hook (local preventative for the CI lint failure this PR itself hit). CI already runs `uv lock --check` in the lint job; adding the same check locally at pre-push catches version-bump lockfile staleness before the push goes out. Mirrors the pattern established by #478's CHANGELOG-at-pre-push hook. Also documented in CONTRIBUTING.md with its own subsection. Co-Authored-By: Claude <noreply@anthropic.invalid>
§12.6.1's pipeline summary now reads `ExecuteResult (value + stdout + stderr + state)` (was missing stderr). §12.6.4 retitled "Stdout and Stderr Capture" and extended with a paragraph explaining the opt-in nature of capture: `IO.stderr` writes go to the host's real stderr by default, and `execute(capture_stderr= True)` routes them into `ExecuteResult.stderr` for test inspection. When the flag is False, `ExecuteResult.stderr` is an empty string — preserves the pre-#463 result shape for backward compatibility. Also regenerated site assets (docs/llms.txt etc.) so they mirror the updated spec. Co-Authored-By: Claude <noreply@anthropic.invalid>
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@CONTRIBUTING.md`:
- Line 88: The sentence claiming "23 run on every commit after `pre-commit
install`" is inaccurate because many commit-stage hooks are file/type-gated in
`.pre-commit-config.yaml`; update the wording to say "23 commit-stage hooks" (or
equivalent) and clarify that some of those run only when matching files are
staged, keep the note that the two push-stage hooks are
`check-changelog-updated` and `uv-lock-check`, and ensure the Markdown review
rule `**/*.md` remains consistent with the actual gating behavior described.
In `@TESTING.md`:
- Line 9: The summary line under the "Tests" table showing "12 skipped"
conflicts with the "Skipped-tests" breakdown that lists and enumerates 11 cases;
update the markdown so both places report the same skipped count: either add the
missing skipped case to the "Skipped-tests" section or change the table summary
from "12 skipped" to "11 skipped" (ensure the table row labeled "**Tests**" and
the "Skipped-tests" enumeration match exactly), and run a quick grep of the
enumerated case headings to confirm all skipped items are present and correctly
numbered.
- Line 377: The statement claiming "23 run on every commit" is inaccurate
because many hooks use trigger filters (`files`/`types`) and only run when those
filters match; update the sentence that starts "Every push is checked by 25
hooks..." to say that there are 25 configured hooks (23 that are configured to
run on commits but are subject to per-hook `files`/`types` filters, and
2—`check-changelog-updated`, `uv-lock-check`—that run only at push time with
`--hook-type pre-push`), and make the same clarification where the numeric claim
appears again (the other occurrence referencing 406) so the README reflects
trigger-based execution rather than "every commit".
🪄 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: c389ac76-2e35-4794-aba8-b5784567a3f4
📒 Files selected for processing (4)
.pre-commit-config.yamlCONTRIBUTING.mdTESTING.mdspec/12-runtime.md
Three CodeRabbit findings: 1. CONTRIBUTING.md line 88 / TESTING.md line 377 both claimed "23 run on every commit after `pre-commit install`" — inaccurate because most commit-stage hooks use per-hook `files:` / `types:` filters (grep of `.pre-commit-config.yaml` finds ten such filters). Revised wording: "23 are configured at the commit stage … Many commit-stage hooks use per-hook `files:` / `types:` filters and only fire when matching files are staged — a docs- only commit triggers a small subset, a compiler-level commit triggers most." 2. TESTING.md Skipped-tests enumeration was stale: summary said 12 skipped, table listed only 11. The missing row is `test_run[ch07_io_sleep]` — the verify-level conformance test added earlier in this PR auto-skips its `run` stage, same pattern as the other verify-level programs. Added the row and updated the intro sentence "reports 12 skipped tests". 3. `scripts/check_doc_counts.py` regex widened to accept "checked by N configured hooks" as well as "checked by N hooks", so the new wording stays enforceable. Co-Authored-By: Claude <noreply@anthropic.invalid>
|
@coderabbitai Three follow-up findings addressed in e63f72d: CONTRIBUTING.md line 88 and TESTING.md line 377 — both claimed "23 run on every commit", which is inaccurate. Many commit-stage hooks use per-hook TESTING.md line 9 — summary-vs-enumeration mismatch ( Also widened the regex in |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 6669 🏁 Script executed: Length of output: 798
The # line 241 — still the old pattern
m = re.search(r"checked by (\d+) hooks", contrib_md)CONTRIBUTING.md now reads The fix is one character group, mirroring line 199: m = re.search(r"checked by (\d+) (?:configured )?hooks", contrib_md)🧠 Learnings used |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@scripts/check_doc_counts.py`:
- Line 199: The CONTRIBUTING.md hook-count regex is stricter than the TESTING.md
one; update the parsing so both accept the optional "configured " token. Replace
the existing literal pattern used for CONTRIBUTING.md (the one matching "checked
by (\d+) hooks") with the same flexible pattern r"checked by (\d+) (?:configured
)?hooks" (or factor both into a shared constant) so counts like "checked by 25
configured hooks" are recognized; ensure the change is applied where
CONTRIBUTING.md is parsed in scripts/check_doc_counts.py.
🪄 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: 93a164ae-c1e5-4478-b262-8a320dec2d0e
📒 Files selected for processing (3)
CONTRIBUTING.mdTESTING.mdscripts/check_doc_counts.py
The previous CodeRabbit round widened the TESTING.md regex to accept "checked by N configured hooks" but missed the parallel site for CONTRIBUTING.md (line 241). Both files now contain the "configured hooks" wording, so the strict regex was silently failing to match in CONTRIBUTING.md — the `if m:` guard then skipped the check entirely, which would let stale counts pass undetected. Both regexes now read `r"checked by (\d+) (?:configured )?hooks"` and accept either wording. Verified by manual `re.search` against the live CONTRIBUTING.md text and by re-running `scripts/check_doc_counts.py` (still consistent at 25 hooks). Co-Authored-By: Claude <noreply@anthropic.invalid>
|
@coderabbitai Fixed in 6aea03b — Good catch — verified that without this fix the strict regex didn't match "checked by 25 configured hooks" and the Kept the patterns inline rather than extracting a shared constant — the script has many similar inline regexes and factoring just this one out would be inconsistent. Happy to revisit if a third site appears. |
|
Tip For best results, initiate chat on the files or code changes.
🧠 Learnings used |
Seven findings across two reviews; five fixed, one declined, plus
the CI lint failure resolved.
Fixed:
- ROADMAP "Where we are" paragraph now lists Random in the algebraic
effects enumeration; mirrored in README's "Key features delivered"
line so both docs are in sync.
- ROADMAP bottom "**by the numbers**" bold string updated from
"113 tagged releases" to "115 tagged releases (as of v0.0.115)" —
matches README's v0.0.115 count and makes the datum explicit.
- random_int test seeded with `random.seed(0)` and now asserts
`low in produced and high in produced` — explicitly verifies the
inclusive-range contract rather than just the cardinality of the
produced set.
- random_bool test also seeded; replaces the probabilistic
`25 <= total <= 75` bound with a deterministic
`{0, 1}.issubset(observed)` — no more flake risk.
- All four Random tests gain WAT import-gating assertions: each
asserts the op-specific `$vera.random_*` import IS present, and
the other two Random imports are NOT — confirms
`_random_ops_used` gating works op-by-op and catches regressions
where all three imports would be emitted unconditionally.
- Browser runtime's `random_int` gains a safe-integer range guard:
if `lowBig < Number.MIN_SAFE_INTEGER` or `highBig > Number
.MAX_SAFE_INTEGER`, throws a descriptive Error ("bounds exceed
JavaScript safe integer range…") instead of silently producing
wrong values via BigInt→Number precision loss. Also checks
`highBig >= lowBig` with its own message.
Declined:
- "spec/12-runtime.md line 406: import says random_int, should say
random_bool" — file already says "random_bool" in both places
(verified via `git show 0f3049b:spec/12-runtime.md`); CodeRabbit
misread the diff. No change needed.
CI lint fix:
- SKILL.md allowlist line-number drift from the Random section
insertion: 25 entries past the insertion point shifted by +1 or
+35 (depending on which hunk they fell after). `fix_allowlists
.py --fix` failed to detect the drift (same silent-OK bug as on
#491). Manually updated all 25 entries; `check_skill_examples
.py` now reports all 105 Vera blocks parse or are allowlisted.
Co-Authored-By: Claude <noreply@anthropic.invalid>
Summary
Three new operations on the built-in
IOeffect. Closes #463.IO.sleep(@Nat) -> Unit— pause for N millisecondsIO.time(@Unit) -> @Nat— current Unix time in millisecondsIO.stderr(@String) -> Unit— write to stderr separate from stdoutEnables animation loops, frame-budget computation, elapsed-time measurement, and stderr-separated CLI tools. Discovered missing while a model wrote Conway's Game of Life in Vera.
Implementation
environment.py: threeOpInfoentries added to the built-inIOEffectInfo.codegen/api.py:host_sleep(→time.sleep),host_time(→int(time.time() * 1000), i64),host_stderr(→sys.stderror optional in-memory buffer).execute()gainscapture_stderr: bool = False;ExecuteResultgainsstderr: strfield (empty by default to preserve shape).codegen/assembly.py: three new_IO_IMPORTSentries.wasm/context.py:_is_void_exprnow treatsIO.sleepandIO.stderras void (likeIO.print), so trailing statements don't emit a spuriousdrop.browser/runtime.mjs:hostSleepbusy-waits onperformance.now()(Atomics.waitunavailable on the main thread),hostTime = BigInt(Date.now()),hostStderrcaptures to a buffer exposed viagetStderr()/clearStderr().reset()includesstderrBuf.browser/harness.mjs: emitsstderralongsidestdoutin the JSON output.Tests
tests/conformance/ch07_io_time_stderr.vera— time + stderr together; level=run. (Sleep excluded: wall-clock timing is inherently flaky — covered in unit tests instead.)tests/test_codegen.py— 5 new tests.tests/test_browser.py— 3 new tests.Documentation
SKILL.md: IO table now lists 10 operations (was 7); browser-runtime paragraph extended.spec/12-runtime.md: three host-import rows, three new §12.4.1.x subsections (sleep/time/stderr), browser comparison table extended.CHANGELOG.md: v0.0.114 section cut.Also bundled
The ROADMAP → HISTORY shuffle for #480, which should have been in #489 but was missed:
Version bump
v0.0.113 → v0.0.114. Tagged on branch; per the release workflow the tag will move to main HEAD after merge and a GitHub release will follow.
Test plan
mypy vera/cleanpytest tests/ -q— 3,340 passed, 11 skipped (8 new)vera runagainst a manual sleep+time+stderr program🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Bug Fixes
Performance Improvements
Tests
Chores