refactor: decompose ultra receipt validator semantics#14
Conversation
Closes #11 Split _validate_schema_subset (cyclomatic complexity 58) into 8 focused helpers: - _validate_ref - _validate_oneof - _validate_type - _validate_const_enum - _validate_object_keywords - _validate_array_keywords - _validate_string_keywords - _validate_number_keywords Split _validate_receipt_semantics (cyclomatic complexity 58) into 7 domain helpers: - _validate_schema_identity - _validate_model_semantics - _validate_telemetry_semantics - _validate_assessment_semantics - _validate_delegation_lanes_semantics - _validate_outcome_semantics - _validate_routing_semantics Added 24 direct helper unit tests (HelperUnitTests class) covering edge cases, error paths, and type guards. Results: - All 99 tests + 96 subtests pass - Branch coverage on validator: 85% (exceeds 80% requirement) - Ruff: clean - mypy: clean - Bandit: zero findings - Zero runtime dependencies preserved - Deterministic sorted JSON-path error messages preserved - All valid/invalid fixture outcomes preserved - No v0.1 schema contract changes
|
Warning Review limit reached
Next review available in: 3 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?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 reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. 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, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
✨ 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 |
Peer ReviewThis PR decomposes the monolithic Verdict: APPROVEFindings
|
|
Initial review pass — pinned head Evidence:
Findings:
Next review focus: Check routing defaults, fallback/fail-closed behavior, schema compatibility, and negative-path tests before treating the policy as executable. Gate: CONTINUE. This is an evidence-backed triage comment, not final merge approval; promotion still requires content validation against this exact head and the repository's review rules. |
Summary
_validate_schema_subset(cyclomatic complexity 58) into 8 focused helpers_validate_receipt_semantics(cyclomatic complexity 58) into 7 domain helpersCloses #11
Changes
Schema-keyword validation split
_validate_ref— $ref resolution_validate_oneof— oneOf branch matching_validate_type— type keyword_validate_const_enum— const and enum keywords_validate_object_keywords— required, properties, additionalProperties_validate_array_keywords— minItems, maxItems, uniqueItems, items_validate_string_keywords— minLength, pattern, format_validate_number_keywords— finite, minimum, maximumReceipt cross-field rules split by domain
_validate_schema_identity— schema_id and schema_version_validate_model_semantics— model.orchestration_agent_count_validate_telemetry_semantics— telemetry metric units, finiteness, integer constraints_validate_assessment_semantics— duplicate_work and synthesis_loss_validate_delegation_lanes_semantics— lane uniqueness, state, timing_validate_outcome_semantics— outcome_improvement_validate_routing_semantics— routing_decision consistencyAcceptance criteria
Scope boundary
No v0.1 schema contract or route policy changes. Mechanical decomposition only.
Validation