diff --git a/README.md b/README.md index 8af3e94..7d80c3b 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,7 @@ This is useful for: - [Implementation status](docs/implementation-status.md) - [Installation](docs/installation.md) - [Usage guide](docs/usage.md) +- [Deterministic output](docs/deterministic-output.md) - [JSON contract](docs/json-contract.md) - [Confidence model](docs/confidence.md) - [JSON schema](schema/prmaven-report.schema.json) diff --git a/docs/deterministic-output.md b/docs/deterministic-output.md new file mode 100644 index 0000000..afb6ecb --- /dev/null +++ b/docs/deterministic-output.md @@ -0,0 +1,47 @@ +# Deterministic Output + +PR Maven CLI uses deterministic output to mean that the same supported Maven artifacts, in the same project layout, produce the same explanation and the same structured report. + +Deterministic output is important because developers, maintainers, CI jobs, and automated tooling need stable evidence before deciding what failed and how to reproduce it. + +## Deterministic Text + +Deterministic text is the human-readable output printed by commands such as: + +```bash +prmaven fails -project . +``` + +For the same issue in the same project, deterministic text should keep: + +- the same section order; +- the same field order; +- the same module, plugin, phase, report, test, message, confidence, and reproduction content when the source artifacts do not change; +- the same no-failure wording when no supported findings are present. + +The text format is meant for humans, so wording may improve over time. When wording changes intentionally, golden tests should be updated in the same pull request and the change should be documented as user-facing output. + +## Deterministic JSON + +Deterministic JSON is the structured output printed by commands such as: + +```bash +prmaven why -project . -format json +``` + +For the same issue in the same project, deterministic JSON should keep: + +- the same top-level structure; +- the same field names; +- the same stable field ordering produced by the CLI; +- the same values when the source artifacts do not change; +- slash-separated relative paths, including on Windows; +- additive compatibility for consumers that ignore unknown future fields. + +The JSON format is meant for CI systems, bots, internal tools, and automated coding workflows. Its field-level contract is documented in [JSON Contract](json-contract.md). + +## What Deterministic Does Not Mean + +Deterministic output does not mean the project can never improve wording, add JSON fields, support new report formats, or change behavior through an explicit compatibility note. + +It means changes should be intentional, reviewable, covered by tests or fixtures, and explainable from local Maven evidence rather than random ordering or subjective interpretation. diff --git a/docs/json-contract.md b/docs/json-contract.md index 1936dfd..26bf37b 100644 --- a/docs/json-contract.md +++ b/docs/json-contract.md @@ -2,6 +2,8 @@ PR Maven CLI emits JSON for CI systems, bots, and coding agents that need deterministic Maven failure context. +For the meaning of deterministic JSON output and how it relates to human-readable text output, read [Deterministic Output](deterministic-output.md). + Run: ```bash diff --git a/docs/project-context.md b/docs/project-context.md index d230e09..c69996a 100644 --- a/docs/project-context.md +++ b/docs/project-context.md @@ -140,6 +140,8 @@ PR Maven CLI emits: Text output should stay concise and actionable. JSON output should remain compatible with consumers that ignore unknown future fields. +For the terminology behind deterministic text and deterministic JSON, read [Deterministic Output](deterministic-output.md). + ## Validation Requirements Before a change is considered production-safe, the project should validate: