feat: Trust Model v2 — 4-state unification (v0.2.0)#1
Merged
Conversation
added 4 commits
May 24, 2026 12:41
CAP-009: Replace 5-state trust model with cleaner 4-state progression.
- Remove indexed/claimed states, add signed state
- Add normalize_legacy_state() for backward compatibility
- Update entry criteria: audited requires canonical_name+description,
signed requires fingerprint+signature
- Expand test coverage for new state transitions
Update trust.py to 4-state model (discovered→audited→verified→signed). Add normalize_legacy_state() as both module function and TrustMachine method. Fix test assertion for removed indexed_at behavior. All 55 tests pass.
Search with min_trust_state now handles legacy states (indexed→audited, claimed→verified) and includes legacy aliases in the IN clause so rows with legacy state values still match.
New CHANGELOG.md documenting trust model v2 (4-state unification), legacy state normalization, TrustMachine, and search filter fix. Version bump from 0.1.0 to 0.2.0.
typelicious
pushed a commit
that referenced
this pull request
Jun 3, 2026
Closes the "17 pre-existing TrustState.AUDITED failures" technical debt flagged in launch-prd.md §10 risk register. Tests now align with the v2 5-state model from PR #1 (Trust Model v2 — 4-state unification). Changes: - TrustState.AUDITED → TrustState.PENDING_REVIEW (19 references) - "audited" string literals → "pending_review" (10 references) - ordering test: len 4 → 5, last item SIGNED → DEPRECATED - Method renames for clarity: test_transition_discovered_to_audited → test_transition_discovered_to_pending_review test_transition_audited_to_verified_(requires|with)_publisher → test_transition_pending_review_to_verified_* test_downgrade_verified_to_audited → test_downgrade_verified_to_pending_review test_downgrade_audited_to_discovered → test_downgrade_pending_review_to_discovered test_entry_criteria_audited → test_entry_criteria_pending_review - normalize_legacy_state tests updated to reflect actual mapping: "indexed" → "pending_review" (was incorrectly expecting "audited") passthrough test uses "pending_review" (since "audited" is now a mapped legacy state, not a passthrough) Verified: PYTHONPATH=src pytest tests/test_models.py → 55 passed (was collecting 0 with errors). One legacy docstring at line 223 still references "audited" as historical context — intentional. Side-finding (not in this PR): src/capacium_models/models.py has 5 datetime.utcnow() calls; FIX-G-004 missed them. Will be tracked in separate cleanup issue.
typelicious
added a commit
that referenced
this pull request
Jun 3, 2026
#2) * fix(stream-f): centralize trust badges + 5-state vocab (FIX-F-001, FIX-F-002) - Add TRUST_BADGES dict with 5-state v2 canonical labels: discovered, pending_review, verified, signed, deprecated - Add get_trust_badge() helper with legacy state normalization (audited → pending_review, claimed → verified) - Re-export from package __init__ for downstream consumers (capacium-exchange, capacium-mcp, capacium-bridge) Single source of truth prevents vocabulary drift across surfaces. Required by FIX-F-001 (centralize trust badges in capacium-models). * test: migrate test_models.py from v1 4-state to v2 5-state vocabulary Closes the "17 pre-existing TrustState.AUDITED failures" technical debt flagged in launch-prd.md §10 risk register. Tests now align with the v2 5-state model from PR #1 (Trust Model v2 — 4-state unification). Changes: - TrustState.AUDITED → TrustState.PENDING_REVIEW (19 references) - "audited" string literals → "pending_review" (10 references) - ordering test: len 4 → 5, last item SIGNED → DEPRECATED - Method renames for clarity: test_transition_discovered_to_audited → test_transition_discovered_to_pending_review test_transition_audited_to_verified_(requires|with)_publisher → test_transition_pending_review_to_verified_* test_downgrade_verified_to_audited → test_downgrade_verified_to_pending_review test_downgrade_audited_to_discovered → test_downgrade_pending_review_to_discovered test_entry_criteria_audited → test_entry_criteria_pending_review - normalize_legacy_state tests updated to reflect actual mapping: "indexed" → "pending_review" (was incorrectly expecting "audited") passthrough test uses "pending_review" (since "audited" is now a mapped legacy state, not a passthrough) Verified: PYTHONPATH=src pytest tests/test_models.py → 55 passed (was collecting 0 with errors). One legacy docstring at line 223 still references "audited" as historical context — intentional. Side-finding (not in this PR): src/capacium_models/models.py has 5 datetime.utcnow() calls; FIX-G-004 missed them. Will be tracked in separate cleanup issue. --------- Co-authored-by: André Lange <andre.lange@typelicious.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.
Summary
discovered → audited → verified → signed)LEGACY_STATE_MAPwithnormalize_legacy_state()for backward compat (indexed→audited,claimed→verified)transition(),promote(),demote(), reason trackingmin_trust_statefilter normalizes legacy states and includes aliases in SQL IN clauseTest plan