Repository navigation
test(storage): cover assertion overlay parity (#1883) - #2078
Conversation
Problem: #1883 still needed public-surface evidence for assertion-backed overlay parity and for the explicit tag/metadata table-backed exception. Helper-level tests covered much of the substrate, but they did not prove the Polylogue facade paths preserve assertion metadata. What changed: add user-state contract tests for public blackboard writes carrying author/evidence/staleness/context policy into NOTE assertions, and for tag/metadata mutations remaining table-backed user metadata rather than lifecycle assertions. Verification: - nix develop --command devtools test tests/unit/storage/test_user_state_contracts.py - nix develop --command devtools verify --quick Ref #1883
Problem: default devtools verify can terminate a long pytest-testmon run before pytest-json-report or JUnit flushes, leaving report_path null and no node-level evidence for failures observed before timeout. What changed: load a small pytest plugin during verify pytest lanes that writes per-test call outcomes to .cache/verify/current-pytest-events.jsonl, persist captured pytest output to .cache/verify/current-pytest-output.log, expose both paths in verify metadata, and clear stale artifacts before each pytest step. Verification: - nix develop --command devtools test tests/unit/devtools/test_verify.py tests/unit/storage/test_user_state_contracts.py - nix develop --command devtools verify --quick Ref #2006
|
Warning Review limit reached
More reviews will be available in 51 minutes and 54 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughAdds ChangesPytest Progress Plugin and Verify Artifacts
User State Storage Contract Tests
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8c0a2e945e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
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 `@devtools/pytest_progress_plugin.py`:
- Around line 37-39: The file write operations for the event ledger
(path.parent.mkdir and path.open with handle.write) can raise OSError which will
cause the pytest hook to fail entirely. Wrap these write operations in a
try-except block that catches OSError and handles it gracefully by logging the
error without re-raising the exception, ensuring that telemetry failures do not
cause the pytest run to fail.
🪄 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: a0e07f46-315a-4ba8-b2d8-6617fc6f016b
📒 Files selected for processing (4)
devtools/pytest_progress_plugin.pydevtools/verify.pytests/unit/devtools/test_verify.pytests/unit/storage/test_user_state_contracts.py
Problem: review found that the new verify event ledger missed setup/teardown failures and could let optional telemetry write failures escape from the pytest hook. What changed: record failed setup/teardown reports in addition to normal call reports, make event-file writes best-effort on OSError, and add direct plugin tests for setup failure capture and write-failure containment. Verification: - nix develop --command devtools test tests/unit/devtools/test_verify.py tests/unit/devtools/test_pytest_progress_plugin.py - nix develop --command devtools verify --quick Ref #2006
|
Addressed both review findings in 011b828: the pytest event plugin now records failed setup/teardown reports as well as call reports, and event-ledger writes are best-effort on OSError so telemetry cannot fail pytest. Added direct plugin tests for both behaviors. Pre-push quick gate passed at 011b828. |
|
Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.
Only the rows listed above are dispositioned. Held findings remain open. |
Summary
Adds public-surface assertion parity coverage for #1883 and fixes the verification harness gap that surfaced while running the default baseline. The storage tests now prove blackboard writes through
Polylogue.post_blackboard_note()preserve assertion metadata, and they prove ordinary session tags/session metadata remain the intentional table-backed user metadata exception rather than lifecycle assertions.Problem
#1883 had helper-level assertion write-through coverage and readiness audit coverage, but the durable public-facade proof was incomplete for two important cases: blackboard assertion metadata and the explicit tags/metadata exception. While validating the branch,
devtools verifyselected a very large pytest-testmon set, ran for 45 minutes, then timed out at 82%. Because pytest-json-report never flushed, verify reportedreport_path: nulland lost node-level failure evidence despite many visible failures. That made the broad gate hard to act on.Solution
tests/unit/storage/test_user_state_contracts.pywith public-facade assertions for blackboard author/evidence/staleness/context-policy metadata.Polylogue.add_tag()andPolylogue.set_metadata(), matching Unify user overlays as evidence-linked assertions #1883's current design: simple tag/metadata rows are user metadata, not assertion lifecycle claims.devtools.pytest_progress_plugin, loaded by everydevtools verifypytest lane, which writes per-test call outcomes incrementally to.cache/verify/current-pytest-events.jsonl..cache/verify/current-pytest-output.logand expose both paths in verify metadata so timeout/stall terminations leave usable evidence.Verification
nix develop --command devtools test tests/unit/storage/test_user_state_contracts.py->9 passed.nix develop --command devtools test tests/unit/devtools/test_verify.py tests/unit/storage/test_user_state_contracts.py->52 passed.nix develop --command devtools verify --quick->exit_code: 0at8c0a2e94.nix develop --command devtools verifybefore the harness fix: static gates passed, pytest-testmon timed out after 2700s at 82% withreport_path: null. This PR fixes that evidence-loss path; I did not rerun another 45-minute default baseline after the harness patch.Ref #1883
Ref #2006
Summary by CodeRabbit
Tests
Chores