Skip to content

Coalesce repeated per-page render diagnostics + restore config source snippets (bd-mg3ckvp7) - #449

Merged
cscheid merged 1 commit into
mainfrom
feature/bd-mg3ckvp7-coalesce-repeated-diagnostics
Aug 1, 2026
Merged

Coalesce repeated per-page render diagnostics + restore config source snippets (bd-mg3ckvp7)#449
cscheid merged 1 commit into
mainfrom
feature/bd-mg3ckvp7-coalesce-repeated-diagnostics

Conversation

@cscheid

@cscheid cscheid commented Jul 31, 2026

Copy link
Copy Markdown
Member

Problem

A problem anchored in a shared file is re-diagnosed by every page's render pipeline and printed once per page. On the connect-docs testbed (external-sources/connect-docs/docs-quarto-2): 186 identical Q-13-2 "Navbar references missing document" warnings, one per rendered page, all caused by a single bad navbar href in _quarto.yml — and none of them naming the source file, because the per-document SourceContexts never register _quarto.yml's hash-based FileId.

Changes

Building on bd-9hlja (which coalesced pass2_failures only and explicitly deferred this case):

  1. RenderToFileResult.input_path (quarto-core): successful-render results now carry their input path — the exact gap bd-9hlja recorded as the blocker.
  2. Coalesced emission (crates/quarto/src/commands/render.rs): per-page diagnostics from successful renders route through coalesce_by_source from quarto-error-reporting 0.2.1, whose path-aware LocationKey (posit-dev/quarto-error-reporting#3) makes cross-document grouping safe for sequential per-doc FileIds. One emission per distinct source span, with an Affected files: tail. Print-only: diagnostic_counts(), --strict promotion, exit codes, and --json-errors are unchanged.
  3. Config snippet restoration (attach_config_source): when a coalesced group's location FileId matches quarto_yaml::file_id_for_filename(config_path) and isn't resolvable in the carried context, the config file's content is registered under that id so the ariadne snippet renders. Best-effort; any failure degrades to the previous span-less block.

Dep bump: quarto-error-reporting 0.1.0 → 0.2.1 in the workspace and in crates/wasm-quarto-hub-client/Cargo.toml (independent pin outside the workspace).

Result on the testbed

Q-13-2 went 186 → 1, and the single warning now points at the offending line:

Warning: [Q-13-2] Navbar references missing document
    ╭─[ …/docs-quarto-2/_quarto.yml:44:15 ]
 44 │         file: api/index.qmd
    │               ──────┬──────
    │                     ╰──────── 'api/index.qmd' is not in the project index.
────╯
ℹ Check the spelling, or confirm the target file is included in the render set.
Affected files: …/admin/access-controls/index.qmd, … (and 183 others)

Exit code unchanged (pre-existing Q-5-3 errors). Remaining repeated classes (Q-12-7 ×15, Q-2-9 ×88, unknown shortcodes ×75) verified to be genuinely distinct source locations.

Tests

4 new integration tests in crates/quarto/tests/integration/coalesced_diagnostics.rs, all written red-first:

  • coalescing across pages (exactly one Q-13-2, tail names all pages)
  • (and N others) display cap
  • singleton keeps the legacy no-tail shape
  • config-anchored group renders the _quarto.yml snippet

Verification: full workspace suite (10,810 passed), full cargo xtask verify exit 0 (covers the 0.2.1 bump through the WASM/hub legs), final cargo xtask verify --skip-hub-build exit 0, clippy + fmt clean.

Plan + full diagnosis: claude-notes/plans/2026-07-31-repeated-diagnostics-coalescing.md. Known pre-existing flake collect_reverification_skips_rereferenced_candidate (bd-ce1mv6xv) surfaced once during local verification; unrelated to this diff.

🤖 Generated with Claude Code

…ce snippets (bd-mg3ckvp7)

A problem anchored in a shared file — the motivating case is a broken
navbar href in _quarto.yml — was re-diagnosed by every page's render
pipeline and printed once per page: 186 identical Q-13-2 warnings on
the connect-docs testbed, none of them naming the source. Three
changes, building on bd-9hlja's coalescer:

- RenderToFileResult now carries input_path (the gap bd-9hlja
  recorded), so successful-render per-page diagnostics can be
  attributed to their page.
- print_render_diagnostics_text routes those diagnostics through
  coalesce_by_source from quarto-error-reporting 0.2.1, whose new
  path-aware LocationKey (posit-dev/quarto-error-reporting#3) makes
  cross-document grouping safe for sequential per-doc FileIds. One
  emission per distinct source span, with an "Affected files:" tail.
  Print-only: counts, --strict promotion, exit codes, and
  --json-errors are unchanged.
- attach_config_source registers the project config file's content
  under its quarto_yaml hash FileId at print time, so config-anchored
  groups render the ariadne snippet (file, line, offending span)
  instead of a span-less block.

Dep bump: quarto-error-reporting 0.1.0 -> 0.2.1 in the workspace and
in crates/wasm-quarto-hub-client (independent pin outside the
workspace).

Testbed result: Q-13-2 186 -> 1, now pointing at _quarto.yml:44:15.

Plan + diagnosis: claude-notes/plans/2026-07-31-repeated-diagnostics-coalescing.md

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@posit-snyk-bot

posit-snyk-bot commented Jul 31, 2026

Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@cscheid
cscheid merged commit 58990c5 into main Aug 1, 2026
8 checks passed
@cscheid
cscheid deleted the feature/bd-mg3ckvp7-coalesce-repeated-diagnostics branch August 1, 2026 01:37
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