Skip to content

Add unit tests for schema parsing functions (parse_review_decision, parse_sanity_result, etc.) #67

@wittekin

Description

@wittekin

Problem

src/millstone/policy/schemas.py contains complex multi-layer fallback parsing logic (JSON → regex → heuristics) for:

  • parse_review_decision
  • parse_sanity_result
  • parse_builder_completion
  • parse_design_review

These are safety gates — a parsing bug could cause millstone to approve bad code or reject good code. The fallback paths are currently untested at the unit level; they're only exercised indirectly through integration tests.

Fix

Add tests/unit/test_schemas.py (~200 LoC) covering each parser with:

  • Valid structured JSON input
  • JSON embedded in prose ("Here is my review:\njson\n{...}")
  • Malformed JSON that triggers regex fallback
  • Completely invalid/garbage input
  • Edge cases: empty string, whitespace-only, non-ASCII

This ensures the fallback chain works correctly and any changes to parsing logic are caught immediately.

Metadata

Metadata

Assignees

No one assigned

    Labels

    millstonemillstone self-development tasks

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions