Skip to content

Add immutability principle#55

Merged
Ma11hewThomas merged 4 commits into
mainfrom
spec/add-immutability-principle
Jul 26, 2026
Merged

Add immutability principle#55
Ma11hewThomas merged 4 commits into
mainfrom
spec/add-immutability-principle

Conversation

@Ma11hewThomas

Copy link
Copy Markdown
Collaborator

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:

  • auditability of test results
  • reproducibility of analysis
  • stable caching and artifact storage
  • compatibility with hashing, signing, and deduplication
  • a clearer separation between raw emitted results and derived reports

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:

  • merging shard reports
  • adding metadata after initial generation
  • computing derived insights
  • producing a derived or enriched report for another system

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.md only, plus the changelog.

Spec changes:

  • Adds Section 2.11 Immutable Report Artifacts
  • Adds a reportId note in Section 5.3
  • Adds producer conformance guidance:
    • producers should treat emitted CTRF documents as immutable artifacts
    • producers should emit a new CTRF document with a new reportId when post-processing after initial report generation
  • Adds consumer conformance guidance:
    • consumers should assume CTRF documents are immutable once emitted
    • consumers must not rely on in-place modification of existing reports

Changelog changes:

  • Adds an Unreleased entry for the immutability guidance

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/*.json
  • jsonschema test tests/ctrf.test.json
  • jsonschema test tests/normative
  • jsonschema test tests/informative

- 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)

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 reportId guidance 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 thread spec/ctrf.md Outdated
Comment thread spec/ctrf.md Outdated
Comment thread CHANGELOG.md Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

Comment thread spec/ctrf.md
Comment thread spec/ctrf.md Outdated
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
Ma11hewThomas marked this pull request as ready for review July 26, 2026 14:17
@Ma11hewThomas
Ma11hewThomas merged commit 6d2d47a into main Jul 26, 2026
2 checks passed
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.

2 participants