Skip to content

Accept an IndependenceBasis member as itself in _basis_of - #108

Merged
Silentpartnercoding merged 1 commit into
mainfrom
agent/basis-of-enum-members
Aug 18, 2026
Merged

Accept an IndependenceBasis member as itself in _basis_of#108
Silentpartnercoding merged 1 commit into
mainfrom
agent/basis-of-enum-members

Conversation

@Silentpartnercoding

Copy link
Copy Markdown
Owner

One branch plus four regression tests.

The bug

_basis_of resolved the basis with IndependenceBasis(str(raw)).

IndependenceBasis mixes in str — but Enum.__str__ wins, so str() on a member returns "IndependenceBasis.ATTESTED", not "attested". Lookup raised ValueError and the basis fell through to UNKNOWN.

So a caller passing the vocabulary's own members — the natural, type-correct call — had every basis silently downgraded.

What it did and didn't affect

It failed in the conservative direction: no verdict was ever more confident than the evidence allowed. And nothing recorded is affected — every caller in this repo annotates the field str | None and passes strings.

It still mattered. attested_margin and the ATTESTED path in asymmetric_verdict key off this value. A downgrade doesn't merely lose a label — it removes a root from the attested count, which is an input to a decision, not a description of one. An attested counterexample handed in as an enum member could read INDETERMINATE where REFUTED was correct.

The fix

A member is returned as itself. The string path is unchanged and remains the normal one. Unrecognised values — wrong case, near misses, empty string, non-strings — still read as UNKNOWN.

Tests

Four new, all of which fail without the branch (verified by removing it and re-running: 4 failures). One pins str(IndependenceBasis.ATTESTED) != "attested" so the branch isn't later deleted as redundant by someone who reasonably assumes a str-mixin stringifies to its value.

full suite   247 tests, OK

Found while building the NIST independence fixture (#107), where passing the enum produced weakest basis: unknown for claims explicitly marked declared.

🤖 Generated with Claude Code

`_basis_of` resolved the basis with `IndependenceBasis(str(raw))`.
`IndependenceBasis` mixes in `str`, but `Enum.__str__` wins, so `str()` on a
member returns "IndependenceBasis.ATTESTED" rather than "attested". Lookup then
raised ValueError and the basis fell through to UNKNOWN.

The effect: a caller passing the vocabulary's own members -- the natural,
type-correct call -- had every basis silently downgraded. It failed in the
conservative direction, so no verdict was ever more confident than the evidence
allowed, and nothing recorded is affected: every caller in this repository
annotates the field `str | None` and passes strings.

It still mattered. `attested_margin` and the ATTESTED path in
`asymmetric_verdict` key off this value, so a downgrade does not merely lose a
label -- it removes a root from the attested count, which is an input to a
decision. An attested counterexample handed in as an enum member could read as
INDETERMINATE where REFUTED was correct.

One branch: a member is returned as itself. The string path is unchanged and
remains the normal one. Unrecognised values -- wrong case, near misses, empty,
non-strings -- still read as UNKNOWN.

Four new tests, all of which fail without the branch. One pins
`str(IndependenceBasis.ATTESTED) != "attested"`, so the branch is not later
deleted as redundant by someone who assumes a str-mixin stringifies to its
value.

  full suite   247 tests, OK

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@Silentpartnercoding
Silentpartnercoding marked this pull request as ready for review August 18, 2026 19:17
@Silentpartnercoding
Silentpartnercoding merged commit e5fc8bc into main Aug 18, 2026
6 checks passed
@Silentpartnercoding
Silentpartnercoding deleted the agent/basis-of-enum-members branch August 18, 2026 19:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant