Skip to content

feat(core): add PartialValidationResult with tri-state semantics #898

Closed

Description

@planetf1

What

Add PartialValidationResult to mellea/core/requirement.py alongside the existing ValidationResult (line 19). It has a tri-state success field: "pass", "fail", or "unknown".

Why

ValidationResult is binary. During streaming, a requirement may not yet have enough data to decide — it needs a third state to defer judgement until more chunks have arrived or the stream ends. This is the foundation for all streaming validation work.

Implementation

Add to mellea/core/requirement.py:

  • Class PartialValidationResult with:
    • success: Literal["pass", "fail", "unknown"] (required)
    • reason: str | None (optional keyword, default None)
    • score: float | None (optional keyword, default None)
  • Follow the existing ValidationResult pattern: private fields with property accessors, not a @dataclass
  • Add PartialValidationResult to __all__ in mellea/core/__init__.py

Acceptance criteria

  • PartialValidationResult exists in mellea/core/requirement.py
  • success accepts "pass", "fail", and "unknown" — rejects other values (enforced via Literal)
  • reason and score are optional keyword arguments defaulting to None
  • Exported from mellea.core via __all__ in mellea/core/__init__.py
  • Unit tests added to test/core/ covering construction and all three states
  • Class docstring states that "pass" is informational in Phase 1 — the orchestrator always calls validate() at stream end for non-"fail" requirements; mid-stream "pass" does not short-circuit final validation
  • Google-style docstring on the class

Size

Small — new class plus tests. No existing code changes.

Part of #891

Activity

  1. added
    enhancement
    good first issue
    on Apr 22, 2026
  2. self-assigned this
    on Apr 22, 2026
  3. added this to the Release 0.5.0 milestone on Apr 22, 2026
  4. planetf1 commented on Apr 24, 2026

    @planetf1
    ContributorAuthor

    Implementation note: Follow the existing ValidationResult pattern in the same file (private fields, property accessors). The class is small — main thing to get right is that success is enforced via Literal["pass", "fail", "unknown"] at construction time, not just as a type hint. Check how ValidationResult handles its success: bool field for the pattern to follow.

  5. added a commit that references this issue on Apr 24, 2026
    57c58fc
  6. added a commit that references this issue on Apr 27, 2026
    96d221a
  7. added a commit that references this issue on May 27, 2026
    7d06188
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementgood first issue

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions