Skip to content

fix(cli): restore Authority (A) and canonical segment widths in ChittyID patterns - #25

Draft
chitcommit wants to merge 1 commit into
mainfrom
fix/chittyid-canonical-format
Draft

fix(cli): restore Authority (A) and canonical segment widths in ChittyID patterns#25
chitcommit wants to merge 1 commit into
mainfrom
fix/chittyid-canonical-format

Conversation

@chitcommit

Copy link
Copy Markdown
Member

Problem

The service that owns the ChittyID format shipped CLI validators that violate it.

chitty-cli.ts CHITTYID_PATTERNS.structured used [PLTE] — silently dropping A (Authority), one of the five core types (chittycanon://gov/governance#core-types). Every Authority-type ChittyID failed validation in the format's own repo.

extended required a 1-char segment 8, so it matched no real ID at all. Worse: it left the type segment fully open, and because isChittyId() ORs the patterns, that let a non-canonical entity type pass the entire check.

Evidence

Tested against live-minted IDs from registry.chitty.cc/api/v1/tools:

Pattern Before After
structured rejects all A-type IDs; \d{2,4} YYMM; digit-only seg8 accepts P/L/T/E/A, YYMM, alphanumeric seg 7–8
extended matched no real ID; accepted entity type X matches real IDs; enforces [PLTEA]

This repo's own CHARTER.md:81, README.md:26, and CLAUDE.md:22 all specify VV-G-LLL-SSSS-T-YYMM-C-XX — the docs were already right; only the code disagreed.

LLL is alphanumeric to cover both live USA and the documented 001 (CP-A-001-1234-P-2509-I-82).

Not in scope

src/hybrid/master-entity-schema.js and src/hybrid/id-translation-worker.js describe a different legacy "legal ID" whose own example (01-N-USA-1234-P-25-3-X) contradicts its own pattern. Neither is reachable from worker.js (id-translation-worker.js is referenced by nothing). Changing that layer's semantics needs its own decision rather than a drive-by edit.

Validation

Patterns parsed out of the edited file and run against 5 real/documented IDs and 5 malformed inputs: all real accepted, all malformed rejected.

🤖 Generated with Claude Code

https://claude.ai/code/session_01DHwB8WGY7wkS3kQMGC8pTL

…yID patterns

chitty-cli's `structured` pattern used [PLTE], silently dropping A
(Authority) — a direct violation of chittycanon://gov/governance#core-types
in the service that owns the format. It also allowed \d{2,4} for YYMM and
required digits in the final segment.

`extended` required a 1-char segment 8, so it matched no real ID, and left
its type segment fully open — because isChittyId() ORs the patterns, that
let a non-canonical entity type pass the whole check. Compatibility relaxes
segment shape, not the entity-type set.

Widths now follow VV-G-LLL-SSSS-T-YYMM-C-XX per this repo's own
CHARTER/README/CLAUDE. LLL is alphanumeric to cover both live 'USA' and the
documented '001'.

Not touched: src/hybrid/{master-entity-schema,id-translation-worker}.js
describe a different legacy "legal ID" whose example contradicts its own
pattern, and neither is reachable from worker.js. Changing that layer's
semantics needs its own decision.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DHwB8WGY7wkS3kQMGC8pTL
@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: f2454a31-8105-454a-ba7e-8bab09a337b7

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
chittyid af9e426 Jul 31 2026, 02:39 AM

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