Add identity model#57
Merged
Merged
Conversation
- Add normative Section 4.9 Identity and Lineage Model with uniqueness and stability tables for all seven identity layers - Add runId (root): logical test run identifier - Add testId (test): stable test-case identifier (string, not UUID-constrained) - Add executionId (test): per-execution identifier within a run - Add attemptId (retryAttempt): per-retry-attempt identifier - Add attachmentId (attachment): per-attachment-reference identifier - Add shardId (environment): shard/partition label - Update reportId description to clarify as document artifact identifier - Deprecate tests[].id in favour of testId - Update Section 2.4 design principle to cover full identity model - Update Section 19 conformance (producer and consumer) - Update Appendix B references from id to testId - Update Appendix D.5 comprehensive example with all identity fields - Update schema with all new optional fields and deprecation note
There was a problem hiding this comment.
Pull request overview
This PR expands CTRF’s identifier semantics by introducing an optional, layered Identity Model (document, run, test case, execution, retry attempt, attachment, shard) and updates the spec, JSON Schema, examples, and normative tests to support these new fields while preserving backward compatibility with tests[].id.
Changes:
- Adds new optional identity fields (
runId,testId,executionId,attemptId,attachmentId,shardId) and documents their intended scopes and stability in the spec. - Updates
schema/ctrf.schema.json(and the embedded normative schema inspec/ctrf.md) with the new fields plusminLength: 1constraints for identifier strings. - Extends normative test suites and examples to validate identity field types/constraints and demonstrate repeated
testIdwith differingexecutionId.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/normative/valid-documents.test.json | Adds a valid normative case demonstrating repeated testId with different executionId values. |
| tests/normative/type-validation.test.json | Adds negative type-validation cases for the new identity fields. |
| tests/normative/string-constraints.test.json | Adds empty-string constraint cases for new identifier fields (and needs one more for baseline). |
| spec/ctrf.md | Introduces and normatively defines the Identity Model; updates field docs and embedded schema. |
| schema/ctrf.schema.json | Implements Identity Model fields and non-empty string constraints in the normative JSON Schema. |
| examples/comprehensive.json | Updates the comprehensive example to include the new identity fields. |
| CHANGELOG.md | Records the Identity Model addition in the changelog. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Ma11hewThomas
marked this pull request as ready for review
July 26, 2026 17:55
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
Adds an optional identity model to CTRF so reports can distinguish between document identity, logical run identity, stable test-case identity, execution identity, retry-attempt identity, attachment identity, and shard identity.
The goal is to avoid overloading a single
idfield and give producers and consumers clearer semantics for cross-run analysis, sharding, retries, artifact correlation, and future derived-report work.What Changed
Identity Modelprinciple.Identity Modelsection covering:reportIdfor the emitted CTRF document artifactrunIdfor the logical test runtestIdfor the stable logical test caseexecutionIdfor a concrete test execution within a runattemptIdfor an individual retry attemptattachmentIdfor a specific attachment reference instanceshardIdfor the shard or partition that produced the documentreportIdidentifies the report artifact/content, not the logical test run.reportId, while materially changed, regenerated, merged, filtered, or transformed reports should receive a newreportId.runIdas a top-level field.tests[].idas a legacy compatibility field and stated that new producers should prefertests[].testId.testIdandexecutionId.attemptId.attachmentIdin both test attachments and retry-attempt attachments.shardId.minLength: 1constraints for identifier strings so empty IDs are rejected.testIdgeneration with canonical strings as the primary producer-generated form, while keeping UUID v5 and hashes as optional deterministic encodings.testIdwith differentexecutionIdvalues.Why
CTRF currently has
reportIdat the document level andidat the test level, but those identifiers do not cover all correlation needs clearly.In practice, producers and consumers need to distinguish:
This PR introduces those layers as optional fields so existing documents remain valid, while producers that need stronger correlation semantics have a clear standard shape.
Compatibility
This is intended to be backward compatible:
tests[].idremains valid.tests[].idis retained as a legacy compatibility field.testIdwhen bothidandtestIdare present.testIdvalues generated by different producers are globally comparable unless the producers document a shared generation scheme.Out Of Scope
This PR defines identity primitives only. It does not define provenance, derivation, parent/child report relationships, transformation history, or trust metadata. Those concepts can build on these identifiers in a future change.
Assessment Notes
This branch was rebased onto the latest
mainafter the immutability and namespace guidance changes landed.During preparation:
extraguidance.spec/ctrf.mdwas synced exactly withschema/ctrf.schema.json.testIdwording was tightened so producers keep it stable within their own documented scope, without implying independent producers will generate globally comparable values.Follow-Up
This change will require downstream follow-up after the core spec/schema change lands.
Expected follow-up areas:
ctrf-js: types, helpers, schema exports, fixtures, and deprecatedidhandling.ctrf-web: documentation, examples, and migration guidance foridtotestId.ctrf-cli: bundled schema, validation fixtures, and user-facing validation/output messaging.Validation
jsonschema validate schema/ctrf.schema.json examples/*.jsonjsonschema test tests/ctrf.test.jsonjsonschema test tests/normativejsonschema test tests/informativespec/ctrf.mdmatchesschema/ctrf.schema.jsonextrause namespaced keys where present