Skip to content

Fix http.vera example: add main function#358

Merged
aallan merged 5 commits into
mainfrom
fix/http-example-main
Mar 26, 2026
Merged

Fix http.vera example: add main function#358
aallan merged 5 commits into
mainfrom
fix/http-example-main

Conversation

@aallan

@aallan aallan commented Mar 26, 2026

Copy link
Copy Markdown
Owner

Summary

  • examples/http.vera had no main function — vera run failed
  • Used IO.println which does not exist (correct: IO.print)
  • Fixed README code block to use correct function signature
  • Updated verifier tier counts

Test plan

  • vera check examples/http.vera passes
  • vera verify examples/http.vera passes
  • All 21 pre-commit hooks pass
  • CI passes

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation

    • Updated HTTP example to accept a provided URL, validate input, improve JSON handling and surface clearer error messages.
  • Known Bugs and Limitations

    • Added two entries documenting recent parsing/ABI and duplicate-type issues.
  • Examples

    • Added an examples index describing 28 runnable example programs with usage commands.
  • Tests

    • Adjusted verification counters and updated allowlist references to keep tests in sync with examples.
  • Chores

    • Updated README parsing checks to reflect shifted example locations.

The example had no main function and used IO.println (does not exist).
Added main that calls fetch_title and prints the result via IO.print.
Fixed README code block to use correct signature.

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

coderabbitai Bot commented Mar 26, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: ebdbf522-8b49-4a31-a4cb-db99c3ab7a83

📥 Commits

Reviewing files that changed from the base of the PR and between 69d89ed and 99ecba0.

📒 Files selected for processing (1)
  • TESTING.md

📝 Walkthrough

Walkthrough

README HTTP example updated: fetch_title changed from public @Int to private @String with a string-length precondition and uses the input URL; JSON Ok branch reformatted. README allowlist fence start adjusted (690→700); related CI checker and tests updated; verifier counts changed; examples index added.

Changes

Cohort / File(s) Summary
Documentation HTTP Example
README.md
Replaced example fetch_title signature: visibility publicprivate, parameter type @Int@String, precondition @Int.0 > 0string_length(@String.0) > 0; Http.get now uses @String.0; Ok JSON handling reformatted into a multi-line nested match preserving case mappings (parse failure → Err(@String.0), missing "title"Err("missing title field"), present "title"Ok(...)).
Readme allowlist & CI checker
scripts/check_readme_examples.py, tests/test_readme.py
Adjusted allowlist opening fence line number for the “Project Roadmap” Vera block from 690700 so the checker and test target the updated code-fence location.
Verifier tests
tests/test_verifier.py
Updated expected aggregate verification counts in TestAdtDecreasesVerification.test_overall_tier_counts: Tier1 t1 162→163, Tier3 runtime t3 17→18, overall total 179→181.
Examples index
examples/README.md
Added new examples index documenting 28 .vera example programs with run instructions (vera run / --fn) and categorised descriptions.
Testing docs
TESTING.md
Added “Open CI/Tooling Issues” section listing two tracked CI/test-infrastructure items (browser runtime coverage, examples README CI validation).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

ci, tests, docs

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title references adding a main function, but the primary changes involve updating the fetch_title example signature, visibility, and precondition, plus allowlist adjustments and verifier counts. Consider a title that captures the main refactoring scope: e.g. 'Refactor fetch_title example: change signature and add main function' or 'Update fetch_title example and allowlist entries for http.vera'.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% 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 unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/http-example-main

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

@codecov

codecov Bot commented Mar 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.22%. Comparing base (9bc26cb) to head (99ecba0).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #358   +/-   ##
=======================================
  Coverage   91.22%   91.22%           
=======================================
  Files          48       48           
  Lines       18429    18429           
  Branches      215      215           
=======================================
  Hits        16811    16811           
  Misses       1614     1614           
  Partials        4        4           
Flag Coverage Δ
javascript 55.07% <ø> (ø)
python 95.35% <ø> (ø)

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.

Caution

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

⚠️ Outside diff range comments (1)
tests/test_verifier.py (1)

1590-1591: ⚠️ Potential issue | 🟡 Minor

Update stale tier-count docstring to match current expectations.

Line 1591 still states 145 T1 / 15 T3, but Lines 1601-1603 assert 163 / 18 / 181. Please synchronise the docstring with the asserted values to avoid misleading future debugging.

Suggested patch
-        """All examples together: 145 T1 / 15 T3 without module resolution."""
+        """All examples together: 163 T1 / 18 T3 (181 total) without module resolution."""
As per coding guidelines `tests/**/*.py`: These are pytest test files. Review for correctness and coverage gaps.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/test_verifier.py` around lines 1590 - 1591, The docstring on
test_overall_tier_counts is stale ("145 T1 / 15 T3") and should be updated to
match the current assertions (the values asserted as 163 / 18 / 181); locate the
test_overall_tier_counts function and replace the docstring text to reflect the
asserted counts (e.g., "All examples together: 163 T1 / 18 T3 / 181 total" or
equivalent wording that matches the 163 / 18 / 181 assertions).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@tests/test_verifier.py`:
- Around line 1590-1591: The docstring on test_overall_tier_counts is stale
("145 T1 / 15 T3") and should be updated to match the current assertions (the
values asserted as 163 / 18 / 181); locate the test_overall_tier_counts function
and replace the docstring text to reflect the asserted counts (e.g., "All
examples together: 163 T1 / 18 T3 / 181 total" or equivalent wording that
matches the 163 / 18 / 181 assertions).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 712bd45a-73d3-4688-803a-37357c676a7d

📥 Commits

Reviewing files that changed from the base of the PR and between 9bc26cb and 0b1745f.

⛔ Files ignored due to path filters (1)
  • examples/http.vera is excluded by !**/*.vera
📒 Files selected for processing (4)
  • README.md
  • scripts/check_readme_examples.py
  • tests/test_readme.py
  • tests/test_verifier.py

Index table showing what each example demonstrates and how to run it.
Examples with main run directly; others use --fn to call exports.

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

@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: 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 `@examples/README.md`:
- Around line 23-77: The README tables list inline commands that are not
currently validated; extend the validation by adding a new check (or enhancing
check_readme_examples.py) to parse examples/README.md table cells, extract
commands (look for "vera run <path> [--fn <name>]"), and verify referenced files
exist and that if a --fn is provided the target .vera file exports/contains that
function (reuse/extend functions like parse_table_commands, extract_command,
verify_file_exists, and verify_fn_flag or create
validate_readme_table_commands). Wire this new validator into CI (same job that
runs check_examples.py/check_readme_examples.py) so failures in
examples/README.md break the build.
🪄 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: d6d9fd86-238b-43d5-924a-be99a6cd6174

📥 Commits

Reviewing files that changed from the base of the PR and between 0b1745f and 36900b2.

📒 Files selected for processing (1)
  • examples/README.md

Comment thread examples/README.md
aallan and others added 2 commits March 26, 2026 10:39
- #359: collections.vera WAT compilation fails (i32_pair in closure param)
- #360: modules.vera E609 (duplicate prelude types across imports)
Both pass check+verify but fail at vera run.

Co-Authored-By: Claude <noreply@anthropic.invalid>
Co-Authored-By: Claude <noreply@anthropic.invalid>
Surface tracked CI improvements (#349, #361) so they are visible
to humans browsing the testing documentation.

Co-Authored-By: Claude <noreply@anthropic.invalid>
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.

1 participant