feat(render): add --strict to promote warning diagnostics to errors#362
Merged
Merged
Conversation
…bd-yjs54ptg, GH #220) Warnings are promoted to error severity at the ProjectRenderSummary boundary — the single seam every structured diagnostic flows through before printing/counting — so text output, --json-errors, the counts clause, and the exit code all agree, and future warnings participate automatically. The render itself still completes; --fail-fast keeps its stop-at-first-failure meaning. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
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.
Closes #220.
Summary
Adds a
--strictflag toq2 renderthat treats warnings as errors, for CI use. Warning diagnostics are promoted to error severity (kind: Warning→kind: Error) on the completedProjectRenderSummary— the single seam every structured diagnostic flows through before anything is printed or counted — so the text output,--json-errorswire output, the error/warning counts clause, and the exit code all agree. Because promotion happens at the aggregation boundary rather than at emission sites, any warning added anywhere in the pipeline in the future (stages, transforms, Lua filters, project post-render) automatically participates in strict mode with no per-call-site opt-in.Design notes, alternatives considered, and the architecture map are in
claude-notes/plans/2026-07-02-strict-mode-warnings-as-errors.md(braid strand bd-yjs54ptg).Semantics
--strict: behavior unchanged.--strict: everything still renders (the flag changes the outcome, not the control flow), then diagnostics print with error severity and the command exits 1 if any former warning or error is present.Info/Noteare untouched.--fail-fast, which keeps meaning "stop at first failure" — a promoted warning does not stop the render.q2 preview/ hub-client stay deliberately lenient per Decision D1 (bd-creo).Implementation
ProjectRenderSummary::promote_warnings_to_errors()inquarto-corecovers all four diagnostic sources (pass-1/pass-2 failure diagnostics, project diagnostics, per-output diagnostics via a newOutputDiagnostics::diagnostics_mut).should_exit_nonzerogains a strict arm; it defensively also fails on surviving warnings so the gate is correct independent of promotion order.quarto-error-reportingcrate is untouched — severity policy stays consumer-side.Testing
TDD: 7 CLI integration tests (
crates/quarto/tests/integration/strict_mode.rs) written first and confirmed failing, spawning the realq2binary against an unresolved-crossref fixture; plus 7 unit tests for the promotion method and the exit gate.cargo nextest run --workspace: 9884 passed. Fullcargo xtask verify(incl. WASM/hub-client leg) green.End-to-end, output inspected:
Follow-up
bd-zcjtaz78 (discovered during this work): Error-kind diagnostics on successful outputs print as
errorbut exit 0 without--strict— the non-strict gate deliberately keeps that behavior in this PR.🤖 Generated with Claude Code