Repository navigation
Report YAML syntax errors as located Q-1-1 (quarto-yaml 0.4.0) - #805
Merged
Merged
Conversation
…eak; span lost in quarto-yaml Plan skeleton + repro. The precise position is dropped upstream (quarto-yaml From<ScanError> sets location: None); code/title are fixable in pampa. Audit lists the other user-reachable Q-0-99 sites. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…yvxq) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… (bd-x30aq7ae) Malformed frontmatter surfaced as Q-0-99 with an internal source path in the title and a whole-block span. quarto-yaml 0.4.0 now locates scan errors (qy-scan-error-location-f9r4yvxq); frontmatter emits Q-1-1 'YAML Syntax Error' at the offending character. 0.4.0 also drops the position text from the error message, which every site that stringified quarto_yaml::Error relied on. Those now go through shared helpers so no position is lost: - _quarto.yml, profile overlays/_quarto.yml.local, _metadata.yml: located Q-1-1 via QuartoError::Parse (config_sources::yaml_parse_error) - extension manifests, _variables.yml, language term files, quarto use: '<message> (line L, column C)' (describe_yaml_error) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…0-99 tests (bd-x30aq7ae) The scanner reports a missing closer at end of input, past the trailing newline, which put the caret on the closing --- of front matter or on a cell's first code line. Clamp such locations to the end of the YAML's last content. Tests that pinned the old behavior now expect Q-1-1: preview_static_e2e (3 asserts), render_once page_error_is_reported_not_fatal, and the book broken-front-matter test (its summary is now the catalog title; the front-matter context is asserted via the chapter diagnostic's hint). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…x30aq7ae) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
✅ 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.
Fixes bd-x30aq7ae: a malformed YAML front-matter block was reported as Q-0-99 with an internal source path in the title (
(at crates/pampa/src/utils/diagnostic_collector.rs:45)) and a span over the whole block. It now reports as Q-1-1 "YAML Syntax Error", located at the character where parsing failed.The precise position comes from quarto-yaml 0.4.0 (posit-dev/quarto-yaml#21, upstream strand
qy-scan-error-location-f9r4yvxq). Scan errors now carrylocation, and the message no longer embeds position text. Plan:claude-notes/plans/2026-10-08-frontmatter-yaml-error-code.md.What changed
quarto-yaml0.3.0 → 0.4.0.pampa::utils::yaml_syntax_error: shared helpers that turn aquarto_yaml::Errorinto either a Q-1-1 diagnostic builder or prose ending in(line L, column C). It also contains the end-of-input clamp described below.pampa/src/pandoc/meta.rs): emits a located Q-1-1 diagnostic with a hint naming the front matter.parse_filecallers ended in… at byte N line L column C, and that line number was file-relative and correct. After the bump, these sites would have printed no position at all:QuartoError::Parse, with the file content registered under quarto-yaml's FileId (config_sources::yaml_parse_error):_quarto.yml, profile overlays and_quarto.yml.local,_metadata.yml.describe_yaml_error: extension manifests (shown inside a Q-16-1 warning), the_variables.ymlwarning, language term files (×2), and thequarto useconfig loader.CellOptionsError::location(). They gain precise spans automatically.[a, bwith no]) at end of input, which is past the trailing newline. That put the caret on the closing---of front matter, or on a code cell's first code line. Such locations are now pulled back to the end of the YAML's last content:title: [unclosedpoints at 2:17.Regression report: changed tests
Every existing test whose assertions changed:
quarto::preview_static_e2e::a_failing_rerender_reports_diagnostics_and_does_not_reloadQ-0-99Q-1-1(2 asserts)quarto::preview_static_e2e::boot_with_a_failing_page_still_serves_the_restQ-0-99Q-1-1quartorender_once_tests::page_error_is_reported_not_fatalQ-0-99Q-1-1quarto-core::pandoc_request_books::a_chapter_with_broken_front_matter_fails_before_any_chapter_rendersout.error.to_lowercase().contains("front")out.error == "YAML Syntax Error", and the chapter's Q-1-1 diagnostic has a hint containing "front matter"PandocRequestOutcome.erroris the title of the first error. The old title was "Failed to parse YAML frontmatter: …"; the new one is the catalog title, so the one-line summary no longer says "front matter". The context moved into the diagnostic's hint, which this test now asserts. This was a design decision (catalog title + hint); if hub-client surfaces onlyerror, a custom title may be preferable.quarto-coreproject::…::test_directory_metadata_invalid_yaml_failsto_string()contains "metadata"/"parse"/"yaml"QuartoError::Parsewith one Q-1-1 diagnostic, and the render contains_metadata.yml:1:quarto-core::project_profile_overlays::overlay_yaml_parse_error_aborts_discoveryresult.is_err()_quarto-prod.ymlwith that file's content registeredUnchanged on purpose:
ipynb_content_processor::cell_option_yaml_error_lands_in_owning_cellfailed after the bump alone. The caret had moved to row 1 (print(1)), off the#| error: [unclosedoption line. The end-of-input clamp fixes this, and the test passes unmodified.pampa::test_warningsstill pins Q-0-99 for the caption-without-table fallback, which is out of scope (see follow-ups).New tests
pampa::test_frontmatter_yaml_syntax_error: Q-1-1 with no internal path, the exact offending byte, non-ASCII text before the error, and an end-of-input error staying in bounds.pampautils::yaml_syntax_error::tests: location and fallback,describe_yaml_error, the end-of-input clamp, andline_columnon char boundaries.project_profile_overlays::base_config_yaml_syntax_error_is_located_q_1_1:_quarto.yml:3:6._variables.ymlwarning, andquarto use.Not covered by a test
Display(Parse error: {ScanError}, which ends inat byte N line L column C). They were not captured from a pre-change binary. The front-matter "before" was captured:claude-notes/plans/frontmatter-yaml-error-code-investigation/.Verification
cargo xtask verify --skip-css-lint:smoke_all, whose failing cases all fail for local engine reasons: R/knitr "R process failed", and great_tables/pandas missing for Jupyter. The same documents fail on unmodifiedmainin this environment.test:wasm: all pass.--skip-css-lintis needed becausemainis red onlint:css.npm run lint:css -w hub-clientalso selects the nestedhub-client/vscode-sync-experimentworkspace. This is unrelated to this PR and tracked inbd-verify-css-lint-nested-ws-r0dd5vdk.Follow-ups filed
bd-caption-warning-q099-5krqlz6w: "Caption found without a preceding table" fallback is still Q-0-99 with a path in the title.bd-depth-limit-q099-f1q9vqjw: "too deeply nested" is Q-0-99 with no location.bd-metadata-yml-error-swallowed-b8sjkxek: a malformed_metadata.ymlis silently ignored (metadata_merge.rscalls.unwrap_or_default()). This predates this PR. The error is now structured, but it still never reaches the user.🤖 Generated with Claude Code