Add typed assertion-kind constants - #107
Merged
Merged
Conversation
Structured consumers previously compared assertion families through undocumented string literals. Expose AssertionKind constants and use the type throughout outcomes, failures, and evaluation errors while preserving every serialized value and allowing custom assertion kinds. Co-Authored-By: OpenAI Codex (GPT-5) <noreply@openai.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Library consumers must compare assertion families through raw strings, making structured result handling typo-prone and undiscoverable.
FailureCodeandEvaluationErrorCodealready provide typed discriminators, butAssertion.Kind,Outcome.Kind,Failure.Kind, andEvaluationError.Kindexpose plain strings. This inconsistency would become costly once v0.4.0 publishes the package contract.Solution
Introduce
AssertionKindand exported constants across the public result model without changing their string values.Before:
After:
Built-in assertions now return the corresponding constant. The type remains an open string type, so external packages can define custom assertion families rather than being restricted to the built-in set. CLI output and machine-visible values remain byte-for-byte compatible.
No visual change: this changes a Go API type without changing CLI rendering.
Other Changes
🤖 Generated with Claude Code