feat: validate vera run commands in examples/README.md (#361)#444
Conversation
Add scripts/check_examples_readme.py which: - Parses all table rows in examples/README.md - Extracts vera run commands from the Run column - Verifies each referenced .vera file exists - Verifies --fn <name> functions are actually public in the source Wire into pre-commit (triggered on examples/README.md or .vera changes) and CI (runs alongside check_examples.py). All 28 current commands pass. Closes #361 Co-Authored-By: Claude <noreply@anthropic.invalid>
|
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 ignored due to path filters (1)
📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdds a new CLI script Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Dev as Developer
participant Git as Git
participant PreCommit as Pre-commit
participant CI as CI
participant Script as Validator (check_examples_readme.py)
participant FS as Repo Filesystem
Dev->>Git: commit / push
Git->>PreCommit: run local hooks
PreCommit->>Script: execute validator
Script->>FS: read `examples/README.md`
Script->>FS: read referenced `examples/*.vera`
Script-->>PreCommit: exit 0 / exit 1
Note over Git,CI: On push, CI workflow triggers
Git->>CI: start `lint` job
CI->>Script: run validation step
Script->>FS: read README and .vera files
Script-->>CI: exit 0 on pass, exit 1 on failure
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 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 unit tests (beta)
Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #444 +/- ##
=======================================
Coverage 90.32% 90.32%
=======================================
Files 49 49
Lines 19335 19335
Branches 220 220
=======================================
Hits 17464 17464
Misses 1867 1867
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:
|
Add hook table row, update lint job description, and remove #361 from the open CI issues table now that it is resolved. Co-Authored-By: Claude <noreply@anthropic.invalid>
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
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_examples_readme.py`:
- Around line 36-50: The parse_run_command function can IndexError if the
command contains no file path; update parse_run_command to defensively validate
the trimmed `rest` before calling `rest.split()[0]`: after stripping and
removing the "--" args, check if `rest` is empty or contains only
flags/whitespace, and if so raise a clear ValueError (or return a controlled
sentinel) that includes the original `cmd`; preserve existing `--fn` extraction
(fn_match) and only read the file_path when the check passes so you never call
rest.split()[0] on an empty list.
🪄 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: b8351657-89c1-44c5-96eb-42225aae410d
📒 Files selected for processing (6)
.github/workflows/ci.yml.pre-commit-config.yamlCLAUDE.mdCONTRIBUTING.mdTESTING.mdscripts/check_examples_readme.py
If rest is empty after stripping (e.g. a malformed 'vera run ' cell), rest.split()[0] raises a cryptic IndexError. Check first and raise a ValueError with the original command string for clear diagnostics. Co-Authored-By: Claude <noreply@anthropic.invalid>
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_examples_readme.py`:
- Around line 78-87: parse_run_command can raise ValueError and currently will
crash the script; wrap the call to parse_run_command(cmd) inside a try/except
ValueError block in the loop over commands (the same loop that assigns lineno,
cmd and computes vera_file) and on exception append a failure to failures
(including lineno, the original cmd and the exception message) and continue, so
malformed commands are reported consistently instead of producing a traceback.
🪄 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: 0d6016fb-52a3-47b3-bc67-16d07f1588a7
📒 Files selected for processing (1)
scripts/check_examples_readme.py
The previous commit added the raise but left the call site unguarded, so a malformed command would still crash with a traceback. Wrap the call in try/except and append to failures for consistent reporting. Co-Authored-By: Claude <noreply@anthropic.invalid>
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_examples_readme.py`:
- Around line 42-52: The parsing assumes the first token is the file path but
never removes the parsed --fn argument from rest, so commands like "vera run
--fn foo examples/bar.vera" yield tokens[0] == "--fn"; modify the logic after
detecting fn_match (variable fn_match and fn_name) to strip the entire matched
substring (the "--fn" plus its value) from rest before splitting into tokens,
then recompute tokens and set file_path from the first non-empty token; ensure
the same behavior when --fn is absent.
🪄 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: f343b43b-35e6-4f26-be31-ee3a2fd1fe04
📒 Files selected for processing (1)
scripts/check_examples_readme.py
- Remove #361 from ROADMAP CI tooling table (completed) - Add v0.0.107 one-liner to HISTORY.md Stage 9 table - Add v0.0.107 CHANGELOG entry with link reference - Bump version in vera/__init__.py, pyproject.toml, README.md, ROADMAP.md - Regenerate site assets Co-Authored-By: Claude <noreply@anthropic.invalid>
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 `@HISTORY.md`:
- Line 222: The HISTORY.md entry added for "v0.0.107" requires updating the
aggregate count under the "By the numbers" section (the "106 tagged releases"
total) to reflect the new release; find the "By the numbers" summary and change
the tagged releases total from 106 to 107 so the document remains consistent
with the newly added "v0.0.107" entry.
🪄 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: 136fb850-1aab-4205-995c-95d9ac5e18ec
⛔ Files ignored due to path filters (4)
docs/index.mdis excluded by!docs/**docs/llms-full.txtis excluded by!docs/**docs/llms.txtis excluded by!docs/**docs/sitemap.xmlis excluded by!docs/**
📒 Files selected for processing (6)
CHANGELOG.mdHISTORY.mdREADME.mdROADMAP.mdpyproject.tomlvera/__init__.py
check_version_sync.py checks docs/index.html separately from the site assets regenerated by build_site.py — this one needs a manual update. Co-Authored-By: Claude <noreply@anthropic.invalid>
Co-Authored-By: Claude <noreply@anthropic.invalid>
Summary
scripts/check_examples_readme.pywhich parses everyvera runcommand in theexamples/README.mdtable and validates: (1) the referenced.verafile exists, (2) if--fn <name>is specified,public fn <name>appears in that fileexamples/README.mdor.verafile changes) and CI (runs alongsidecheck_examples.py)All 28 current run commands pass.
Test plan
python scripts/check_examples_readme.pypasses locallyexamples/Closes #361
🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Chores
Documentation