Add immutability principle#55
Merged
Merged
Conversation
- Add Section 2.11 'Immutable Report Artifacts' to Design Principles - Add immutability note to Section 5.3 (reportId) - Add immutability requirements to Section 19.1 (Producer Conformance) - Add immutability expectations to Section 19.2 (Consumer Conformance)
There was a problem hiding this comment.
Pull request overview
This PR updates the CTRF specification to clarify an “immutability” principle: once a CTRF report is emitted as an artifact, it should be treated as a stable snapshot, and post-processing should produce a new document (with a new reportId) rather than modifying an existing artifact.
Changes:
- Adds Design Principle §2.11 describing emitted CTRF reports as immutable artifacts and positioning post-processing as producing a new document.
- Clarifies
reportIdguidance to emphasize distinct report instances for post-processed outputs. - Extends producer/consumer conformance guidance to discourage mutation of emitted reports and reliance on in-place modification.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| spec/ctrf.md | Adds an immutability principle, reinforces reportId semantics for derived reports, and updates producer/consumer conformance guidance. |
| CHANGELOG.md | Records the immutability guidance under Unreleased changes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+1788
to
+1790
| - MAY include `insights` if historical or aggregate data is available | ||
| - SHOULD treat emitted CTRF documents as immutable artifacts | ||
| - SHOULD emit a new CTRF document when performing post-processing after initial report generation and, when `reportId` is used, assign a different `reportId` value rather than modifying an emitted CTRF document |
Ma11hewThomas
marked this pull request as ready for review
July 26, 2026 14:17
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 immutability principle to the CTRF specification.
The core idea is that an emitted CTRF report should be treated as an immutable artifact: a fixed snapshot of test results at the time it was produced. Producers can still build or transform reports internally before emission, but once a report has been written, published, uploaded, or otherwise made available as an artifact, consumers and downstream systems should treat it as stable.
Why This Matters
Immutability gives CTRF reports stronger artifact semantics for CI systems, report stores, dashboards, and downstream analysis.
It supports:
This is especially important for workflows that merge shards, enrich report metadata, compute insights, or otherwise post-process test output after initial report generation.
Behavior Clarified
This PR clarifies that post-processing should produce a new CTRF document rather than mutate an already-emitted one.
Examples of post-processing include:
When a new CTRF document is produced through that kind of post-processing, it should receive a new
reportId.Implementation Details
This PR updates
spec/ctrf.mdonly, plus the changelog.Spec changes:
2.11Immutable Report ArtifactsreportIdnote in Section5.3reportIdwhen post-processing after initial report generationChangelog changes:
Compatibility
This is a documentation/specification clarification. It does not change the JSON Schema and does not alter document validation.
The change strengthens the intended artifact model without invalidating existing CTRF documents.
Validation
jsonschema validate schema/ctrf.schema.json examples/*.jsonjsonschema test tests/ctrf.test.jsonjsonschema test tests/normativejsonschema test tests/informative