Feature: Unified context fragment model hierarchies The core ContextFragment, FragmentProvenance, ContextBudget, and ContextPayload types extend their CRP base counterparts, ensuring isinstance compatibility across the model hierarchy. Background: Given the unified model modules are available # --------------------------------------------------------------- # isinstance compatibility # --------------------------------------------------------------- Scenario: Core FragmentProvenance is instance of CRP FragmentProvenance Given a core FragmentProvenance with resource_uri "project://test" Then the provenance should be an instance of CRP FragmentProvenance And the provenance resource_type should be "unknown" And the provenance strategy should be empty Scenario: Core FragmentProvenance inherits CRP strategy field Given a core FragmentProvenance for strategy "tier_retrieval" with resource_uri "project://test" Then the provenance strategy should be "tier_retrieval" And the provenance resource_type should be "unknown" Scenario: Core ContextFragment is instance of CRP ContextFragment Given a core ContextFragment with uko_node "project://app/main.py" and content "hello" Then the fragment should be an instance of CRP ContextFragment And the unified fragment tier should be "warm" And the unified fragment fragment_id should be non-empty Scenario: Core ContextFragment has ULID fragment_id by default Given a core ContextFragment with uko_node "project://test" and content "test content" Then the unified fragment fragment_id should be 26 characters Scenario: Core ContextFragment created_at is auto-populated Given a core ContextFragment with uko_node "project://test" and content "test content" Then the unified fragment created_at should be a recent datetime # --------------------------------------------------------------- # Immutability (frozen) # --------------------------------------------------------------- Scenario: Core ContextFragment is frozen Given a core ContextFragment with uko_node "project://frozen" and content "frozen" When I attempt to mutate the fragment uko_node Then a frozen mutation error should be raised Scenario: Core ContextBudget is frozen Given a core ContextBudget with max_tokens 4096 and reserved_tokens 512 When I attempt to mutate the budget max_tokens Then a frozen mutation error should be raised Scenario: CRP FragmentProvenance is frozen Given a CRP FragmentProvenance with resource_uri "test://crp" When I attempt to mutate the CRP provenance resource_uri Then a frozen mutation error should be raised # --------------------------------------------------------------- # Equality across hierarchy # --------------------------------------------------------------- Scenario: Two core fragments with same data are equal Given two core ContextFragments with identical fields Then the two fragments should be equal Scenario: Core ContextBudget strict validation rejects equal reserved and max When I create a core ContextBudget with reserved_tokens equal to max_tokens Then a validation error should be raised for strict budget