fix: respect entity_type param and map purpose→type for context mints#12
fix: respect entity_type param and map purpose→type for context mints#12chitcommit merged 2 commits intomainfrom
Conversation
The canonical governance (chittycanon://gov/governance#core-types) mandates 5 entity types: P/L/T/E/A. Several code paths only accepted 4, rejecting Authority (A): - config/index.js entityTypes map - services/vrf-generator.js validation - agents/validator.js validTypes array Also fixes the pipeline to map "context" and "agent" purposes to Person (P) instead of defaulting to Thing (T), and respects explicit entity_type query parameter override in the API handler. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The entity_type query parameter was being ignored — only `type` and `for` were read. When `for=context`, the raw value "context" had no mapping in ENTITY_TYPES, causing fallback to T (Thing) instead of P (Person). Changes: - Add entity_type as highest-priority param (explicit override) - Add PURPOSE_ENTITY_MAP for purpose values (context→person, claude→person) - Fixes contexts always getting T instead of P Ref: chittycanon://gov/governance#core-types Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ❌ Deployment failed View logs |
chittyid | c8dfaa3 | Mar 17 2026, 12:54 AM |
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
📝 WalkthroughWalkthroughThe pull request adds a new entity type 'A' (Authority) to the ChittyID system and introduces an optional override mechanism for entity type selection during ID generation. Entity type validations, configuration mappings, and purpose-to-type mappings are updated across the service layers to support the new type and override functionality. Changes
Sequence DiagramsequenceDiagram
participant Client
participant API as API Handler
participant Pipeline as ChittyPipeline
participant Config as Config
participant Service as ID Service
Client->>API: POST request with entity_type parameter
API->>API: Extract entity_type override from URL
API->>Pipeline: process(request, purpose, entityTypeOverride)
Pipeline->>Config: Validate entityTypeOverride against allowed types
alt Override valid
Pipeline->>Pipeline: Use entityTypeOverride
else Override invalid or not provided
Pipeline->>Pipeline: Map purpose to entity type
end
Pipeline->>Service: Generate ID with selected entity type
Service->>Service: Validate entity type in ["P","L","T","E","A"]
Service-->>Pipeline: Return generated ID
Pipeline-->>API: Return ID response
API-->>Client: ChittyID response
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
Poem
✨ Finishing Touches
🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
entity_typequery param was ignored — onlytypeandforwere readfor=contextmapped to raw "context" which had no entry inENTITY_TYPES, defaulting toT(Thing)entity_typeis highest priority, and aPURPOSE_ENTITY_MAPresolves purpose values likecontext→person(P)Root cause
Test plan
GET /api/get-chittyid?for=contextreturns entity typePGET /api/get-chittyid?entity_type=Preturns entity typePGET /api/get-chittyid?for=thingstill returnsTGET /api/get-chittyid?type=personstill returnsPcan chitty authenticate-contextRelated
🤖 Generated with Claude Code
Summary by CodeRabbit