Skip to content

feat: render masked diagnostics for a task result - #663

Merged
josegonzalez merged 2 commits into
mainfrom
647-masked-diagnostics
Oct 22, 2026
Merged

josegonzalez merged 2 commits into
mainfrom
647-masked-diagnostics

Conversation

@josegonzalez

Copy link
Copy Markdown
Member

sdk.Diagnostics turns a plan result, a task's output state or a read error into masked error and warning entries, each with a stable reason, a short summary and a detail carrying the command's output, so an embedder no longer masks each field or formats each error type itself. The CLI's plan and apply output, human and JSON, now render every task error and warning through the same helper, and print exactly what they printed before. WarnReasonServiceOptionDrift is now exported to the sdk.

There is no visible change to CLI output: the plan and apply lines, the apply continuation lines, and the JSON error, stdout, stderr, exit_code, reason and message fields are byte-identical, and a new test pins that for a failed command, an ssh failure, a version refusal, a missing app, an unreadable state and a generic error. The JSON event schema is unchanged.

Decisions: WarnReasonServiceOptionDrift is exported because a warning diagnostic carries its reason as the key to branch on, and an embedder needs every key it can receive. SSHError stays unaliased: the ssh diagnostic reason gives an embedder the transport-failure branch without the type, and the type's fields hold unmasked text that Diagnostics exists to keep out of view. A transport failure is classified before a version error, so a version that could not be read because ssh failed reports as an ssh failure, which matches the CLI's long-standing ssh: label. Diagnostics masks every string it returns, summaries included, since it cannot tell server text from recipe values; the CLI's own --app and path arguments never pass through it. Errors come before warnings in the returned list, and an unsupported input type returns a single error diagnostic naming it rather than nothing.

Closes #647

A task read in a state that owns its whole collection, `set` or `clear`, now reports `exists` true whenever the read succeeds, with the empty collection as observed, across `ReadTask`, `ReadAddress`, `PlanResult.Exists` and the `Exists` an apply returns. The additive states keep reporting whether the members they name are there, and a missing app or service is still an `ObjectMissingError`, so `docket read` exits 0 rather than 2 for an empty collection.
@josegonzalez josegonzalez added the enhancement New feature or request label Oct 22, 2026
@josegonzalez
josegonzalez force-pushed the 647-masked-diagnostics branch from a0dad55 to 58cd8a1 Compare October 22, 2026 02:37
@josegonzalez
josegonzalez changed the base branch from main to 639-empty-collection-exists October 22, 2026 02:37
`sdk.Diagnostics` turns a plan result, a task's output state or a read error into masked error and warning entries, each with a stable reason, a short summary and a detail carrying the command's output, so an embedder no longer masks each field or formats each error type itself. The CLI's plan and apply output, human and JSON, now render every task error and warning through the same helper, and print exactly what they printed before. `WarnReasonServiceOptionDrift` is now exported to the sdk.
@josegonzalez
josegonzalez force-pushed the 647-masked-diagnostics branch from 58cd8a1 to 2801941 Compare October 22, 2026 02:58
@josegonzalez
josegonzalez changed the base branch from 639-empty-collection-exists to main October 22, 2026 03:10
@josegonzalez
josegonzalez merged commit 5a5bd26 into main Oct 22, 2026
20 checks passed
@josegonzalez
josegonzalez deleted the 647-masked-diagnostics branch October 22, 2026 03:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: render masked diagnostics for a task result

1 participant