Skip to content

[FEATURE]: CMF extension types in Rust #17

Closed

Description

@terylt

Epic: CPEX Rust Core (#12)

Summary

Implement the full CMF extension type system in cpex-core with compile-time enforcement of mutability tiers. Replace the current Phase 1 stubs (Extensions, FilteredExtensions) with the complete typed extension model matching the Python implementation.

Motivation

The current Rust core has stub extensions with only labels and custom fields. The full extension model — with immutable, monotonic, guarded, and mutable tiers — is needed for real policy evaluation, identity resolution, and session management.

Scope

Extension Types

  • SecurityExtension — MonotonicSet<String> for labels (add-only, no remove), SubjectExtension (immutable), ObjectSecurityProfile, DataPolicy
  • DelegationExtension — append-only chain with scope narrowing enforcement
  • MetaExtension — immutable tags, scope, properties
  • HttpExtension — Guarded<T> requiring WriteToken for mutation
  • RequestExtension, AgentExtension, MCPExtension, CompletionExtension, ProvenanceExtension, LLMExtension, FrameworkExtension — all immutable
  • Extensions container with all slots

Capability-Gated Filtering

  • filter_extensions() — build FilteredExtensions per plugin based on declared capabilities
  • Slot registry mapping each extension field to its mutability tier and required capability
  • Read/write capability semantics (write implies read, subject sub-field capabilities)

Merge and Validation

  • merge_extensions() — accept back only writable slots, validate tier constraints
  • validate_tier_constraints() — immutable rejected, monotonic superset-checked, guarded requires capability

Acceptance Criteria

  • MonotonicSet has no remove() — compile-time enforced
  • DelegationExtension.push() rejects scope escalation
  • Guarded<T> requires WriteToken for write access
  • filter_extensions() hides extensions the plugin hasn't declared capabilities for
  • merge_extensions() rejects immutable modifications and monotonic removals

References

  • CMF Specification
  • cpex/framework/extensions/ (Python implementation)
  • cpex/framework/extensions/tiers.py (slot registry, filter, merge)
  • cpex/framework/session.py (session store)

Activity

  1. added this to the 0.2.0 milestone on Apr 17, 2026
  2. added
    enhancement
    on Apr 17, 2026
  3. moved this from Backlog to In progress in CPEXon Apr 29, 2026
  4. moved this from In progress to Done in CPEXon May 4, 2026
  5. closed this as completedby moving to Done in CPEXon May 4, 2026
  6. added theissue type on Jun 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancement

Type

Projects

  • Status
    Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions