Skip to content

Add Http effect with get and post operations (#57)#357

Merged
aallan merged 4 commits into
mainfrom
feat/http-effect
Mar 26, 2026
Merged

Add Http effect with get and post operations (#57)#357
aallan merged 4 commits into
mainfrom
feat/http-effect

Conversation

@aallan

@aallan aallan commented Mar 25, 2026

Copy link
Copy Markdown
Owner

Summary

Completes the critical path dependency chain: MapJSONHTTP → Server → MCP.

Http effect

effect Http {
  op get(String -> Result<String, String>);
  op post(String, String -> Result<String, String>);
}
  • Host-backed algebraic effect following the IO pattern — functions must declare `effects()`
  • Python runtime: `urllib.request` (zero dependencies)
  • Browser runtime: synchronous `XMLHttpRequest`
  • Result return type: matches `IO.read_file` and `json_parse` patterns — network calls fail gracefully
  • Json composition: `json_parse(Http.get(url))` is the canonical pattern

New files

File Purpose
`examples/http.vera` JSONPlaceholder API example
`tests/conformance/ch09_http.vera` Conformance test (level: check)

Known limitations (filed as issues)

Issue Limitation
#351 No custom headers
#352 No HTTP status code access
#353 No request timeout control
#354 POST sends body without Content-Type
#355 Browser uses deprecated synchronous XHR
#356 No PUT, PATCH, DELETE methods

Documentation

  • Spec §9.5.3: full API docs, removed "(Future)"
  • SKILL.md: Http section with examples
  • README.md: Http code example, limitations in Known Bugs
  • ROADMAP.md: Http marked complete, dependency chain updated
  • FAQ.md: "How does HTTP work in Vera?"
  • docs/index.html: Http highlighted as key feature
  • Version bumped to v0.0.99

Closes #57.

Test plan

  • All 3,012 tests pass (12 new: 6 checker + 6 codegen)
  • All 21 pre-commit hooks pass
  • 62 conformance programs pass
  • 28 examples pass check + verify
  • mypy clean
  • CI passes

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • HTTP added as a built-in effect with Http.get()/Http.post() returning Result<String, String>; usable with JSON composition and supported in browser and Python runtimes.
  • Known Limitations

    • GET/POST only; no custom headers, other methods, status codes, timeouts, streaming or cookie/session support.
  • Tests

    • New conformance test and expanded unit/integration coverage for HTTP; conformance/examples counts increased.
  • Documentation

    • Docs, FAQs, roadmap and changelog updated to describe HTTP behaviour and limits.
  • Chores

    • Project version bumped to 0.0.99.

effect Http {
  op get(String -> Result<String, String>);
  op post(String, String -> Result<String, String>);
}

Host-backed algebraic effect following the IO pattern. Python runtime
uses urllib.request (zero dependencies). Browser runtime uses
synchronous XMLHttpRequest. Functions must declare effects(<Http>).

New conformance test ch09_http (62 programs). New example http.vera
(JSONPlaceholder API). 12 new unit tests (6 checker + 6 codegen).
Version bump to v0.0.99.

Known limitations filed as #351-#356: no custom headers, no status
codes, no timeout, no Content-Type, browser uses deprecated XHR,
no PUT/PATCH/DELETE.

Closes #57.

Co-Authored-By: Claude <noreply@anthropic.invalid>
@coderabbitai

coderabbitai Bot commented Mar 25, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

This PR adds a built‑in Http algebraic effect (Http.get / Http.post) returning Result<String, String>, updates spec/docs/tests/site metadata for v0.0.99, and implements compiler/runtime plumbing for conditional HTTP host imports (Python and browser), plus tests and allowlist adjustments.

Changes

Cohort / File(s) Summary
Specification & Effect Definition
spec/09-standard-library.md, vera/environment.py
Documented Http effect and operations; signatures changed to return Result<String, String>; Http registered in the type environment.
Compiler: Compilability & Operation Tracking
vera/codegen/compilability.py, vera/codegen/core.py, vera/codegen/functions.py
Recognise Http as compilable effect requiring memory; track HTTP ops in _http_ops_used; propagate set into CompileResult.
Compiler: WASM Translation
vera/wasm/calls.py, vera/wasm/context.py, vera/wasm/inference.py, vera/codegen/assembly.py
Translate Http qualified calls to host imports http_get/http_post; treat Http calls as producing values; add conditional WAT imports and export alloc when HTTP ops present.
Host Implementations
vera/codegen/api.py, vera/browser/runtime.mjs
Python host bindings using urllib.request.urlopen for GET/POST returning ADT Result; browser runtime registers synchronous XMLHttpRequest handlers mapped to vera.http_get/vera.http_post.
Conformance & Unit Tests
tests/conformance/manifest.json, tests/test_checker.py, tests/test_codegen.py
Added ch09_http conformance entry; new TestHttpChecker and TestHttpCollection tests for typing, arity, effect declaration, codegen imports and runtime behaviour.
Verification, README & Tests Metrics
tests/test_verifier.py, tests/test_readme.py, TESTING.md, scripts/*.py, scripts/build_site.py
Incremented counts (conformance: 61→62, examples: 27→28, tests, README block counts); updated allowlists and script line-number mappings to reflect added Http content.
Documentation & Release
CHANGELOG.md, AGENTS.md, CLAUDE.md, FAQ.md, README.md, ROADMAP.md, SKILL.md, vera/README.md, pyproject.toml, vera/__init__.py
Bumped version to 0.0.99; documented Http effect with usage/composition and explicit known limitations; marked HTTP complete in roadmap; harmonised docs and changelog.
WASM/Context State
vera/wasm/context.py, vera/wasm/*
Added internal _http_ops_used tracking and adjusted void/value inference for Http qualified calls.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant VeraProgram as Vera program
    participant WASM as Wasm module
    participant Host as Host import (Python/Browser)
    participant Network as Remote HTTP server

    VeraProgram->>WASM: call Http.get(url) (effects(<Http>))
    WASM->>Host: invoke import vera.http_get(urlPtr, urlLen)
    Host->>Network: perform HTTP GET (urllib / XHR)
    Network-->>Host: response or network error
    Host-->>WASM: return Result.Ok(responseText) or Result.Err(errorMsg)
    WASM-->>VeraProgram: return Result<String, String>
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested labels

compiler, tests, spec, ci, docs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'Add Http effect with get and post operations (#57)' directly and clearly describes the main change: implementing a built-in Http algebraic effect with get and post operations, addressing issue #57.
Linked Issues check ✅ Passed The PR comprehensively implements issue #57: Http is now a built-in algebraic effect with get/post operations returning Result<String, String>, functions declare effects() for network access, and runtime handlers provide both Python (urllib) and browser (XMLHttpRequest) implementations.
Out of Scope Changes check ✅ Passed All changes are in-scope: Http effect specification, standard library documentation, type environment setup, code generation, runtime bindings, test coverage, and version bump to v0.0.99. No unrelated refactorings or feature changes detected.
Docstring Coverage ✅ Passed Docstring coverage is 86.84% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/http-effect

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov

codecov Bot commented Mar 25, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 53.53535% with 46 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.22%. Comparing base (991cf65) to head (dcd7afa).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
vera/browser/runtime.mjs 10.86% 41 Missing ⚠️
vera/wasm/context.py 25.00% 3 Missing ⚠️
vera/codegen/api.py 92.30% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #357      +/-   ##
==========================================
- Coverage   91.41%   91.22%   -0.20%     
==========================================
  Files          48       48              
  Lines       18333    18429      +96     
  Branches      213      215       +2     
==========================================
+ Hits        16760    16811      +51     
- Misses       1569     1614      +45     
  Partials        4        4              
Flag Coverage Δ
javascript 55.07% <10.86%> (-1.11%) ⬇️
python 95.35% <90.56%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 11

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
scripts/build_site.py (1)

110-129: ⚠️ Potential issue | 🟡 Minor

Keep llms.txt aligned with the new Http copy.

build_index_md() now advertises Http, but the build_llms_txt() prose earlier in this file still lists only IO/State/Exceptions/Async. After regeneration the site’s two AI-facing entry points will disagree about the effect surface in the same release.

Also applies to: 303-327

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/build_site.py` around lines 110 - 129, The build_llms_txt() output
was not updated to include the new Http effect, causing inconsistency with
build_index_md(); update build_llms_txt() so its prose lists Http alongside
IO/State/Exceptions/Async (and any other effects advertised by
build_index_md()), and ensure the same effect wording and order are used; check
the related block around lines referenced (other occurrences ~303-327) for
duplicate text generation and update those too so both entry points
(build_llms_txt and build_index_md) produce identical effect-surface
descriptions.
🤖 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 25-28: The roadmap text incorrectly states that HTTP requires JSON
bodies and mixes WASI versions; update the paragraph to say Http ships raw
String request/response bodies (so JSON is optional, not a prerequisite), change
the WASI reference for incoming-handler support to match the rest of the file
(use WASI 0.3 if other references use 0.3), and ensure the dependency chain
wording (Map → JSON → HTTP Server → MCP Server) reflects that JSON and HTTP are
separate optional steps; also apply the same corrections to the related entries
mentioned (lines referenced as 62-64) so all mentions and issue IDs (`#58`, `#57`,
`#237/`#305/#306) and phrasing are consistent across the file.

In `@scripts/check_skill_examples.py`:
- Around line 118-121: The ALLOWLIST dict has duplicate numeric keys (e.g., key
1289 and key 1464) causing silent overwrites; open the ALLOWLIST literal, remove
or merge the duplicated entries so each key appears only once (preserve all
intended tuple values by combining them if needed), and ensure the final dict
contains unique keys corresponding to the original allowlist intent; check the
ALLOWLIST variable in scripts/check_skill_examples.py and update any tests or
comments that referenced the removed duplicate entries.

In `@scripts/check_spec_examples.py`:
- Around line 249-250: The spec example for fetch_both is now type-incorrect
because the Http API returns Result<String, String> not Json; update the spec
block in spec/09-standard-library.md (the fetch_both example that uses
async(Http.get(...))) to reflect the new Http signature and correct types (e.g.,
handle the Result<String,String> from Http.get, map or parse the Ok String into
Json or adjust fetch_both's return type to Future<Result<...>>), and remove the
CHECK_ALLOWLIST entry that hides this stale example in
scripts/check_spec_examples.py so the test validates the corrected spec instead
of skipping it. Ensure you update the fetch_both example and any type
annotations in that block to be consistent with async(Http.get(...)) returning a
future over Result<String,String>.

In `@tests/test_checker.py`:
- Around line 2123-2129: Extend the Http.post tests by adding a negative
type-check case alongside the existing test_http_post_type_checks: call the test
helper used for failures (e.g., _check_bad) with a snippet invoking Http.post
where the body argument is the wrong type (for example `@Int` instead of `@String`)
so the checker flags a type error; place this new assertion near
test_http_post_type_checks and reference Http.post and the _check_bad helper to
locate where to add it.

In `@tests/test_codegen.py`:
- Around line 9059-9078: Update the two tests so they not only assert the
expected import is present but also assert the other sibling import is absent:
in test_http_get_compiles (which checks for "http_get") also assert that
"http_post" is not in result.wat, and in test_http_post_compiles (which checks
for "http_post") also assert that "http_get" is not in result.wat; locate these
tests by their function names test_http_get_compiles and test_http_post_compiles
and add the negated assertions against result.wat.
- Around line 9139-9161: The test test_http_post_mocked only asserts the success
path for Http.post; add two checks: (1) a failure-path test that mocks
urllib.request.urlopen to raise an HTTP error (or return a mock that yields an
error response) and assert the function returns Err and its payload propagates,
and (2) a request-shape assertion inside the existing patch (or a new test) that
inspects the arguments passed to urllib.request.urlopen (e.g., using patch
side_effect or MagicMock.assert_called_with) to verify the POST URL and body are
set correctly; update references in the test function test_http_post_mocked (and
any new test functions) and keep using _compile_ok and execute to run the
compiled source so the added mocks exercise Http.post semantics.

In `@tests/test_verifier.py`:
- Around line 1601-1603: Update the stale docstring string that currently reads
"145 T1 / 15 T3 without module resolution" to the correct baseline "162 T1 / 17
T3 without module resolution" so it matches the assertions (assert t1 == 162,
assert t3 == 17, assert total == 179) in tests/test_verifier.py; locate the
docstring containing the exact phrase "145 T1 / 15 T3 without module resolution"
and replace it with "162 T1 / 17 T3 without module resolution".

In `@vera/browser/runtime.mjs`:
- Around line 1609-1644: The HTTP host imports (imports.vera.http_get and
imports.vera.http_post created in buildImportObject) currently assume
XMLHttpRequest and fail on Node.js; update both bindings to detect runtime: if
typeof XMLHttpRequest !== "undefined" keep the existing synchronous XHR code;
else if typeof fetch !== "undefined" implement an alternative using fetch (use
async/await and integrate with your async WebAssembly strategy — e.g., asyncify
or returning a promise to the host) to produce
allocResultOkString/allocResultErrString responses; otherwise return an explicit
allocResultErrString("Unsupported runtime: no XMLHttpRequest or fetch
available") so Node.js runs get a clear unsupported-runtime error. Ensure you
update both http_get and http_post functions accordingly.

In `@vera/codegen/compilability.py`:
- Around line 39-40: The mixed-effect diagnostic message needs to include "Http"
in the list of currently compilable effects; locate the code that builds/emits
the mixed-effect warning (the same module where eff.name == "Http" and
self._needs_memory is set) and update the rationale string that currently lists
"pure/IO/State/Exn/Async" to also include "Http" so effects(<Http, Foo>) reports
Http as supported in the mixed-effect warning.

In `@vera/wasm/calls.py`:
- Around line 353-357: The Http branch that emits host calls (when
call.qualifier == "Http") forgets to mark that the module needs allocator
plumbing; update the branch handling for these calls (the block that computes
wasm_name, adds to self._http_ops_used, and appends the instruction) to also set
self.needs_alloc = True so allocator wiring is kept when only Http.get/post are
used — ensure this is done before emitting or registering the call (refer to
variables/methods: call.qualifier, wasm_name, self._http_ops_used,
instructions.append, and self.needs_alloc).

In `@vera/wasm/context.py`:
- Around line 392-395: The code currently assumes any qualified effect call
that's not "Http" is void (using expr.qualifier), which is wrong and breaks
value-returning effects like State.get; change the logic to determine void-ness
by consulting the effect's actual signature instead of hard-coding defaults:
look up the effect descriptor/signature for expr.qualifier (e.g., from the
module/effects registry or whatever structure holds effect metadata used
elsewhere in this file) and return False only if that signature indicates a
value/Result is returned (otherwise True), so ExprStmt handling correctly drops
or preserves stack values based on the effect's real return type.

---

Outside diff comments:
In `@scripts/build_site.py`:
- Around line 110-129: The build_llms_txt() output was not updated to include
the new Http effect, causing inconsistency with build_index_md(); update
build_llms_txt() so its prose lists Http alongside IO/State/Exceptions/Async
(and any other effects advertised by build_index_md()), and ensure the same
effect wording and order are used; check the related block around lines
referenced (other occurrences ~303-327) for duplicate text generation and update
those too so both entry points (build_llms_txt and build_index_md) produce
identical effect-surface descriptions.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: cf7643ec-9680-481f-b29f-58276494c6c3

📥 Commits

Reviewing files that changed from the base of the PR and between 991cf65 and 59aa851.

⛔ Files ignored due to path filters (6)
  • docs/index.html is excluded by !docs/**
  • docs/index.md is excluded by !docs/**
  • docs/llms-full.txt is excluded by !docs/**
  • docs/llms.txt is excluded by !docs/**
  • examples/http.vera is excluded by !**/*.vera
  • tests/conformance/ch09_http.vera is excluded by !**/*.vera
📒 Files selected for processing (31)
  • AGENTS.md
  • CHANGELOG.md
  • CLAUDE.md
  • FAQ.md
  • README.md
  • ROADMAP.md
  • SKILL.md
  • TESTING.md
  • pyproject.toml
  • scripts/build_site.py
  • scripts/check_readme_examples.py
  • scripts/check_skill_examples.py
  • scripts/check_spec_examples.py
  • spec/09-standard-library.md
  • tests/conformance/manifest.json
  • tests/test_checker.py
  • tests/test_codegen.py
  • tests/test_readme.py
  • tests/test_verifier.py
  • vera/README.md
  • vera/__init__.py
  • vera/browser/runtime.mjs
  • vera/codegen/api.py
  • vera/codegen/assembly.py
  • vera/codegen/compilability.py
  • vera/codegen/core.py
  • vera/codegen/functions.py
  • vera/environment.py
  • vera/wasm/calls.py
  • vera/wasm/context.py
  • vera/wasm/inference.py
👮 Files not reviewed due to content moderation or server errors (6)
  • README.md
  • SKILL.md
  • FAQ.md
  • vera/codegen/api.py
  • TESTING.md
  • spec/09-standard-library.md

Comment thread ROADMAP.md
Comment thread scripts/check_skill_examples.py Outdated
Comment thread scripts/check_spec_examples.py Outdated
Comment thread tests/test_checker.py
Comment thread tests/test_codegen.py
Comment thread tests/test_verifier.py
Comment thread vera/browser/runtime.mjs
Comment thread vera/codegen/compilability.py
Comment thread vera/wasm/calls.py
Comment thread vera/wasm/context.py Outdated
- Fix duplicate allowlist keys in check_skill_examples.py (1289, 1464)
- Set needs_alloc for Http qualified calls
- Add Http to compilability diagnostic message
- Add test_http_post_wrong_type checker test
- Add per-operation import gating tests (get-only, post-only)
- Add Http to build_site.py effects listing
- Fix ROADMAP WASI version and Http body description
- Improve _is_void_expr comment for future effect extensibility
- Fix doc counts (3,015 tests)

Co-Authored-By: Claude <noreply@anthropic.invalid>
@aallan

aallan commented Mar 25, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai Fixed the outside-diff item: build_site.py now lists Http alongside IO/State/Exceptions/Async in both the llms.txt summary and the chapter 7 description (commit 7ae2cb2).

@coderabbitai

coderabbitai Bot commented Mar 25, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

@aallan Thanks for closing the loop — confirmed, build_site.py now correctly surfaces Http in both the llms.txt capability summary and the Chapter 7 algebraic-effects description. That's the outside-diff item fully resolved. ✅

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

♻️ Duplicate comments (2)
tests/test_codegen.py (1)

9167-9190: ⚠️ Potential issue | 🟠 Major

Http.post runtime test still misses request semantics and error-path coverage.

At Line 9187, the mock accepts any call shape, so a method/body wiring regression would still pass. Add request-shape assertions and a failing Http.post path.

Proposed test tightening
     def test_http_post_mocked(self) -> None:
@@
-        with patch("urllib.request.urlopen", return_value=mock_resp):
+        with patch("urllib.request.urlopen", return_value=mock_resp) as mock_urlopen:
             exec_result = execute(result)
             assert exec_result.value == 7
+            req = mock_urlopen.call_args.args[0]
+            assert req.full_url == "http://example.com"
+            assert req.get_method() == "POST"
+            assert req.data == b"data"
+
+    def test_http_post_mocked_failure(self) -> None:
+        """Mocked Http.post failure returns Err."""
+        from unittest.mock import patch
+
+        source = """
+public fn main(-> `@Int`)
+  requires(true) ensures(true) effects(<Http>)
+{
+  let `@Result`<String, String> = Http.post("http://example.com", "data");
+  match `@Result`<String, String>.0 {
+    Ok(`@String`) -> 0,
+    Err(`@String`) -> string_length(`@String.0`)
+  }
+}
+"""
+        result = _compile_ok(source)
+        with patch("urllib.request.urlopen", side_effect=Exception("post failed")):
+            exec_result = execute(result)
+            assert exec_result.value is not None
+            assert exec_result.value > 0

As per coding guidelines: add codegen/runtime tests for built-in functions covering normal cases, edge cases (empty inputs, zero values), and composition with other built-ins.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/test_codegen.py` around lines 9167 - 9190, Update the
test_http_post_mocked test to assert the actual request shape passed to
urllib.request.urlopen and to add a failing Http.post path: instrument the
MagicMock or patch for urllib.request.urlopen to validate the request URL,
method/body/headers expected by Http.post (so failures in wiring are caught) and
add a second subtest where urlopen raises an exception or returns an error
response to exercise the Err branch of the compiled code; adjust usages of test
helper functions (_compile_ok, execute) and the mock_resp setup in this test to
verify both success (response body "created") and error behaviors for Http.post.
tests/test_checker.py (1)

2112-2173: ⚠️ Potential issue | 🟡 Minor

Missing negative test for Http.post body parameter.

The test suite lacks coverage for an incorrect body argument type. A previous review comment requested test_http_post_wrong_body_type, and whilst you indicated it was fixed in 7ae2cb2, the test does not appear in this diff.

Currently, test_http_post_wrong_type (lines 2155-2161) validates rejection of Http.post(42, "body") (wrong URL type), but there's no test for Http.post("url", 42) (wrong body type). Multi-parameter built-ins elsewhere in this file (e.g., json_array_get, line 2070) test each parameter independently.

🧪 Proposed test addition
     def test_http_post_wrong_type(self) -> None:
         """Http.post(42, "body") with Int URL is a type error."""
         _check_err("""
 public fn post(`@Unit` -> `@Result`<String, String>)
   requires(true) ensures(true) effects(<Http>)
 { Http.post(42, "body") }
 """, "type")
 
+    def test_http_post_wrong_body_type(self) -> None:
+        """Http.post("url", 42) with Int body is a type error."""
+        _check_err("""
+public fn post(`@String` -> `@Result`<String, String>)
+  requires(true) ensures(true) effects(<Http>)
+{ Http.post(`@String.0`, 42) }
+""", "type")
+
     def test_http_with_io(self) -> None:

As per coding guidelines: Add type checker tests in tests/test_checker.py for built-in functions, with at minimum one test with correct types and one with a wrong argument type.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/test_checker.py` around lines 2112 - 2173, Add a new negative test
method in the TestHttpChecker class named test_http_post_wrong_body_type that
mirrors test_http_post_wrong_type but passes a String URL and an Int body (e.g.
Http.post(`@String.0`, 42)) and asserts a type error via _check_err with the
"type" message; place it alongside the other tests in TestHttpChecker so the
body-parameter type rejection for Http.post is covered.
🤖 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`:
- Line 62: Replace the phrase "HTTP effect — requires JSON for request/response
bodies." in ROADMAP.md with wording that matches the accurate behavior described
earlier (HTTP returns raw String and JSON parsing is separate), e.g. "HTTP
effect — composes with JSON for typed API responses" so the document is
consistent with the Http operation description that returns raw `String`.

In `@tests/test_codegen.py`:
- Around line 9107-9116: Update the test `test_http_no_imports_when_unused` (or
add a new sibling test) to cover the declared-but-unused edge `effects(<Http>)`:
change the `source` program's signature to use `effects(<Http>)` instead of
`effects(pure)` (or create a second `source` with `effects(<Http>)`) and call
`_compile_ok(source)` as before; then assert that `"http_get"` and `"http_post"`
are not present in `result.wat`. Ensure you reference the same helper
`_compile_ok` and keep the assertions identical to the existing ones.

---

Duplicate comments:
In `@tests/test_checker.py`:
- Around line 2112-2173: Add a new negative test method in the TestHttpChecker
class named test_http_post_wrong_body_type that mirrors
test_http_post_wrong_type but passes a String URL and an Int body (e.g.
Http.post(`@String.0`, 42)) and asserts a type error via _check_err with the
"type" message; place it alongside the other tests in TestHttpChecker so the
body-parameter type rejection for Http.post is covered.

In `@tests/test_codegen.py`:
- Around line 9167-9190: Update the test_http_post_mocked test to assert the
actual request shape passed to urllib.request.urlopen and to add a failing
Http.post path: instrument the MagicMock or patch for urllib.request.urlopen to
validate the request URL, method/body/headers expected by Http.post (so failures
in wiring are caught) and add a second subtest where urlopen raises an exception
or returns an error response to exercise the Err branch of the compiled code;
adjust usages of test helper functions (_compile_ok, execute) and the mock_resp
setup in this test to verify both success (response body "created") and error
behaviors for Http.post.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 0681605f-900a-4cfe-9cc9-5d0e029fc6e9

📥 Commits

Reviewing files that changed from the base of the PR and between 59aa851 and 7ae2cb2.

⛔ Files ignored due to path filters (1)
  • docs/llms.txt is excluded by !docs/**
📒 Files selected for processing (9)
  • ROADMAP.md
  • TESTING.md
  • scripts/build_site.py
  • scripts/check_skill_examples.py
  • tests/test_checker.py
  • tests/test_codegen.py
  • vera/codegen/compilability.py
  • vera/wasm/calls.py
  • vera/wasm/context.py

Comment thread ROADMAP.md Outdated
Comment thread tests/test_codegen.py
aallan and others added 2 commits March 26, 2026 09:38
- Fix fetch_both spec example: correct types to Result<String, String>,
  move from CHECK_ALLOWLIST to ALLOWLIST as FUTURE (async not compiled)
- Add XMLHttpRequest guard in browser runtime: returns clear Err on
  Node.js instead of crashing with "XMLHttpRequest is not defined"
- Fix ROADMAP wording: Http returns raw String, JSON is separate
- Add test_http_declared_but_unused: effects(<Http>) with no ops
- Fix duplicate allowlist keys (1289, 1464) in check_skill_examples.py
- Fix doc counts (3,016 tests)

Co-Authored-By: Claude <noreply@anthropic.invalid>
README.md and spec had fabricated descriptions (streaming, cookies,
session management) that do not match the actual filed issues
(#351-#356). Corrected to match exact issue titles.

Co-Authored-By: Claude <noreply@anthropic.invalid>
@aallan

aallan commented Mar 26, 2026

Copy link
Copy Markdown
Owner Author

Merging with codecov/patch at 90.56% (target 95.36%). The ~5% gap is structural:

  • vera/browser/runtime.mjs — JS code invisible to pytest-cov (tracked by Improve browser runtime (runtime.mjs) test coverage to >80% #349)
  • vera/codegen/api.py — HTTP host function closures only executed with mocked urllib (2 tests do this but the closure bodies have branches for error paths)
  • vera/wasm/context.py line 395 — defensive fallback for unknown qualified calls (unreachable with current effect set)

Project coverage is 95.35% (-0.02% from baseline). All 3,016 tests pass.

@aallan

aallan commented Mar 26, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai help

@coderabbitai

coderabbitai Bot commented Mar 26, 2026

Copy link
Copy Markdown

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

CodeRabbit commands

These commands are invoked using PR/Issue comments.

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai evaluate custom pre-merge check --instructions <custom-checks-instructions> --name <custom-checks-title> [--mode <error|warning>] to validate the custom pre-merge checks instructions. Defaults to error when --mode is omitted.
    • @coderabbitai ignore pre-merge checks to override pre-merge checks and get an approval on PR.
    • @coderabbitai run pre-merge checks to run pre-merge checks on the pull request.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve merge conflict to automatically resolve merge conflicts.
  • @coderabbitai autofix to automatically fix issues identified in unresolved review comments.
  • @coderabbitai resolve to resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai generate configuration to create a PR that adds the current resolved configuration as .coderabbit.yaml (or show it if already present).
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Status, support, documentation and community

  • Visit our status page to check the current availability of CodeRabbit.
  • Create a ticket on our support page for assistance with any issues or questions.
  • Visit our documentation site for detailed information on how to use CodeRabbit.
  • Join our Discord community to connect with other users and get help from the community.
  • Follow us on X/Twitter for updates and announcements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Network access effect (<Http>)

1 participant