fix(checker): re-synth ctor args against partially-generic params so concrete Nat components obligate (#1010) - #1011
Conversation
…concrete Nat components obligate (#1010) Every re-synthesis in the generic-call argument loop was gated on the WHOLE parameter being typevar-free, so a constructor argument against @pair<Nat, T> was never re-typed against its instantiated parameter — the concrete Nat component's narrowing target went unrecorded and the E503 obligation was silently lost (verify-clean negative into a Nat; the fully-concrete analogue obligates). Constructor-expression arguments now re-synth against the instantiated param even when typevars remain: the #971 fill adopts component-wise, typevar components stay unconstrained, and each field's target records exactly as on the concrete path. Provably-negative and unconstrained @int shapes are E503; requires(@Int.0 >= 0) discharges Tier-1; genuine Nat values stay clean. Runtime-guard half for generic fields unchanged (documented under #754/#757) — the static promise is what #1010 restored. Found by the PR #1009 review. Five pinning tests, revert mutant killed. Co-Authored-By: Claude <noreply@anthropic.invalid>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🔗 Linked repositories identifiedCodeRabbit considers these linked repositories for cross-repo context during reviews:
📝 WalkthroughWalkthroughThe call checker now re-synthesises partially-generic constructor arguments so concrete ChangesNat obligation verification
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related issues
Possibly related PRs
Suggested labels: 🚥 Pre-merge checks | ✅ 8✅ Passed checks (8 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## release/v0.1.4 #1011 +/- ##
===============================================
Coverage 93.48% 93.49%
===============================================
Files 96 96
Lines 31900 31905 +5
Branches 456 456
===============================================
+ Hits 29823 29828 +5
Misses 2064 2064
Partials 13 13
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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 `@tests/test_verifier_nat_obligations.py`:
- Around line 1550-1612: Strengthen the tests in
test_generic_ctor_param_negative_nat_component_e503,
test_generic_ctor_param_opaque_int_component_obligated,
test_generic_ctor_param_proved_int_component_tier1, and
test_concrete_ctor_param_negative_nat_component_e503 to assert the exact E503
diagnostic for failures and explicitly verify that the constrained case
completes at Tier 1 rather than merely having no errors. Reuse the test helpers
or result fields that expose error_code and verification tier, keeping the
existing diagnostic description checks.
🪄 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 Plus
Run ID: 399eaf40-3be7-4165-aeaf-36718dd42b9c
⛔ Files ignored due to path filters (2)
docs/SKILL.mdis excluded by!docs/**docs/llms-full.txtis excluded by!docs/**
📒 Files selected for processing (8)
CHANGELOG.mdKNOWN_ISSUES.mdREADME.mdROADMAP.mdSKILL.mdTESTING.mdtests/test_verifier_nat_obligations.pyvera/checker/calls.py
🔗 Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
aallan/vera-bench(manual)
💤 Files with no reviewable changes (2)
- KNOWN_ISSUES.md
- SKILL.md
…x entry above The #993 bullet said #1010 was 'tracked in KNOWN_ISSUES'; its fix now sits directly above in the same [Unreleased] batch and the row is deleted, so the clause was self-contradictory in the extracted notes. Skip-changelog: prose reconciliation within [Unreleased] itself, no code change Co-Authored-By: Claude <noreply@anthropic.invalid>
Code review (pr-review-toolkit, LIGHT tier) — reportAn Opus code-reviewer agent reviewed 09a8d82 via a base-vs-PR differential over ~20 hand-built adversarial programs run through the real check+verify pipeline, plus a revert-mutant check. Verdict: no findings at confidence ≥ 80; recommended for merge. Per focus area:
One ~60%-confidence docs nit (the #993 CHANGELOG entry's now-stale 'tracked in KNOWN_ISSUES' clause) is fixed in the follow-up docs commit. |
…1010 pins (PR #1011 review) The E503 shapes now assert error_code explicitly and the constrained case asserts the nat_bind obligation status is 'verified' — mere error-absence could not distinguish a Tier-3 runtime fallback. Skip-changelog: test-assertion strengthening only, behavior unchanged Co-Authored-By: Claude <noreply@anthropic.invalid>
Restores the static E503
@Nat-narrowing promise for the concrete components of a partially-generic constructor argument.Root cause
Every re-synthesis in the generic-call argument loop (
vera/checker/calls.py) is gated on the whole parameter type being typevar-free. A constructor argument against@Pair<Nat, T>was therefore never re-typed against its instantiated parameter: the concreteNatcomponent's narrowing target went unrecorded, the verifier's ctor-field walker (which resolves generic fields via the recorded instantiated target, #747) found nothing, andwants(MkPair(0 - 5, None))checked, verified clean, and silently stored the negative. The fully-concrete@Pair<Nat, Int>analogue obligates correctly — the generic path just never reached the same machinery.Fix
One block in the argument loop: constructor-expression arguments are re-synthesized against the instantiated parameter even when type variables remain. The #971 bidirectional fill adopts component-wise (typevar components stay unconstrained), and the ctor check records each field's target exactly as on the concrete path. No verifier change needed — its walker already consults the recorded target.
Result parity with the concrete path, all pinned:
MkPair(0 - 5, None)as@Pair<Nat, T>→ E503 (was verify-clean, silent negative)MkPair(@Int.0, None)underrequires(true)→ E503 with counterexample (matches concrete verdict)requires(@Int.0 >= 0)→ discharges Tier-1MkPair(5, None)→ verify-clean (no false positive)The runtime-guard half for generic fields is unchanged and stays documented under the #754/#757 limitation rows — the static promise is what #1010 restored.
Validation
Five tests in
tests/test_verifier_nat_obligations.py(TestGenericCtorParamNatObligation1010), RED-first for the two broken shapes; revert-the-fix mutant killed. Full gate: 7,370 tests green, mypy/ruff clean, 157 conformance, 37 examples, doc-count/limitations-sync/site-asset gates green. Docs: KNOWN_ISSUES + SKILL rows deleted, CHANGELOG[Unreleased]entry, counts reconciled.Closes #1010
🤖 Generated with Claude Code
Summary by CodeRabbit
E503checks for negative values passed toNatcomponents within partially generic constructor arguments (issue#1010).