Repository navigation
refactor(test): harden verification fixture contracts (#374) - #374
Conversation
Problem: shared verification helpers still allowed loose payload shapes after the semantic-precision renewal. Storage test helpers used the same dictionary alias for JSON metadata and internal model-construction payloads, and archive scenarios could still smuggle raw content-block dictionaries into cross-surface fixtures. What changed: split storage helper JSON validation from record payload construction, reject non-JSON metadata and content-block fragments at helper boundaries, add typed ScenarioContentBlock fixtures for authored archive scenarios, and register a focused validation lane for the renewed fixture contracts. Generated quality and verification catalogs were refreshed from the updated lane and operation metadata. Verification: devtools run-validation-lanes --lane verification-substrate-contracts passed; targeted infra/devtools tests passed; targeted mypy and ruff checks passed; devtools render-all --check passed; devtools verify passed. Closes #267
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughIntroduces a new validation lane Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Poem
🚥 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 docstrings
🧪 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 |
|
@codex review |
|
Codex Review: Didn't find any major issues. You're on a roll. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
## Summary Tighten the shared verification substrate so authored scenarios and storage-record helpers use explicit typed contracts instead of legacy loose payload shapes. ## Problem Issue #267 identified that renewed source/schema/storage semantics could still drift because tests and verification helpers preserved older dictionary-shaped shortcuts. Before implementation, the issue was strengthened with a concrete fixture-boundary target: storage helpers conflated JSON metadata with internal Pydantic model payloads, and archive scenarios still accepted raw content-block dictionaries. Closes #267 ## Solution - Added typed `ScenarioContentBlock` fixtures for authored archive scenarios and made raw dictionary content blocks fail at scenario seed time. - Split storage helper JSON validation from internal `RecordPayload` construction while preserving existing low-level builder convenience. - Validated provider metadata, attachment metadata, content-block tool input, and content-block metadata as JSON-compatible at the shared helper boundary. - Added focused infra tests for invalid legacy shapes and valid JSON content-block preservation. - Added a `verification-substrate-contracts` validation lane plus declared operation metadata for fixture seeding/building, then regenerated quality and verification catalogs. ## Verification - `pytest -q tests/infra/test_storage_records.py tests/infra/test_archive_scenarios.py tests/infra/test_json_contracts.py tests/unit/devtools/test_validation_lanes.py` -> 154 passed initially, then 160 passed after fixes and projection coverage - `devtools run-validation-lanes --lane verification-substrate-contracts` -> 13 passed - `ruff check tests/infra/storage_records.py tests/infra/archive_scenarios.py tests/infra/test_storage_records.py tests/infra/test_archive_scenarios.py devtools/validation_lane_catalog_contracts.py tests/unit/devtools/test_validation_lanes.py polylogue/operations/specs.py tests/unit/storage/test_repository_lifecycle_laws.py` -> passed - `mypy tests/infra/storage_records.py tests/infra/archive_scenarios.py tests/unit/ui/test_ui_visual.py tests/unit/core/conftest.py tests/unit/storage/test_store_ops.py polylogue/operations/specs.py` -> no issues - `pytest -q tests/infra/test_storage_records.py tests/infra/test_archive_scenarios.py tests/infra/test_json_contracts.py tests/unit/devtools/test_validation_lanes.py tests/unit/devtools/test_scenario_projections.py tests/unit/storage/test_scale.py::TestPerformanceBudget::test_has_tool_use_filter_budget` -> 160 passed - `devtools render-all --check` -> generated surfaces in sync - `devtools verify` -> all checks passed - `git push -u origin feature/refactor/verification-substrate-contracts` -> pre-push quick verification passed
Summary
Tighten the shared verification substrate so authored scenarios and storage-record helpers use explicit typed contracts instead of legacy loose payload shapes.
Problem
Issue #267 identified that renewed source/schema/storage semantics could still drift because tests and verification helpers preserved older dictionary-shaped shortcuts. Before implementation, the issue was strengthened with a concrete fixture-boundary target: storage helpers conflated JSON metadata with internal Pydantic model payloads, and archive scenarios still accepted raw content-block dictionaries.
Closes #267
Solution
ScenarioContentBlockfixtures for authored archive scenarios and made raw dictionary content blocks fail at scenario seed time.RecordPayloadconstruction while preserving existing low-level builder convenience.verification-substrate-contractsvalidation lane plus declared operation metadata for fixture seeding/building, then regenerated quality and verification catalogs.Verification
pytest -q tests/infra/test_storage_records.py tests/infra/test_archive_scenarios.py tests/infra/test_json_contracts.py tests/unit/devtools/test_validation_lanes.py-> 154 passed initially, then 160 passed after fixes and projection coveragedevtools run-validation-lanes --lane verification-substrate-contracts-> 13 passedruff check tests/infra/storage_records.py tests/infra/archive_scenarios.py tests/infra/test_storage_records.py tests/infra/test_archive_scenarios.py devtools/validation_lane_catalog_contracts.py tests/unit/devtools/test_validation_lanes.py polylogue/operations/specs.py tests/unit/storage/test_repository_lifecycle_laws.py-> passedmypy tests/infra/storage_records.py tests/infra/archive_scenarios.py tests/unit/ui/test_ui_visual.py tests/unit/core/conftest.py tests/unit/storage/test_store_ops.py polylogue/operations/specs.py-> no issuespytest -q tests/infra/test_storage_records.py tests/infra/test_archive_scenarios.py tests/infra/test_json_contracts.py tests/unit/devtools/test_validation_lanes.py tests/unit/devtools/test_scenario_projections.py tests/unit/storage/test_scale.py::TestPerformanceBudget::test_has_tool_use_filter_budget-> 160 passeddevtools render-all --check-> generated surfaces in syncdevtools verify-> all checks passedgit push -u origin feature/refactor/verification-substrate-contracts-> pre-push quick verification passedSummary by CodeRabbit
New Features
Improvements
Tests