Skip to content

Make quarto-error-reporting catalog-agnostic; extract quarto-error-catalog (bd-egcyeym9, Phase 2)#349

Merged
cscheid merged 2 commits into
mainfrom
feature/bd-egcyeym9-error-reporting-split
Jun 27, 2026
Merged

Make quarto-error-reporting catalog-agnostic; extract quarto-error-catalog (bd-egcyeym9, Phase 2)#349
cscheid merged 2 commits into
mainfrom
feature/bd-egcyeym9-error-reporting-split

Conversation

@cscheid

@cscheid cscheid commented Jun 27, 2026

Copy link
Copy Markdown
Member

Phase 2 of extracting quarto-error-reporting out of the monorepo (strand bd-egcyeym9): make the crate catalog-agnostic so it can ship to non-Quarto consumers, while q2 keeps its Q-* codes and quarto.org docs URLs. No crate leaves the repo in this PR — that's Phase 3.

Builds on #348 (Phase 1: quarto-source-map already published & consumed from crates.io).

Two commits

1. refactor: make catalog-agnostic + extract quarto-error-catalog

  • quarto-error-reporting gains a CatalogProvider trait + EmptyCatalog default + a std::sync::OnceLock registry + install_catalog(). get_docs_url/get_error_info/get_subsystem keep their exact signatures but delegate to the installed provider. The embedded ERROR_CATALOG static + include_str! are gone; once_cell dropped.
  • New quarto-error-catalog crate holds error_catalog.json (git-moved), the QuartoCatalog provider, and install(). The 10 data-presence tests + the example move here; 3 install/delegation integration tests added.
  • The q2 binary main() installs the catalog. WASM deliberately does not — it never surfaces docs URLs (JsonDiagnostic has no docs_url field), and installing would include_str! the 46 KB catalog into the bundle, past hub-client's 35 MiB PWA precache limit. A legitimate EmptyCatalog embedder.
  • audit-error-codes.py + ~25 path references repointed to crates/quarto-error-catalog/.

2. build: gate the json wire shape behind a default-off json feature

  • schemarsoptional; [features] json = ["dep:schemars"]; json.rs module + schema_drift test gated. The 4 wire-symbol consumers opt in. cargo tree confirms schemars is absent by default, present with --features json.

Why this is low-risk

A full workspace audit showed the catalog is entirely decoupled from production rendering: nothing reads docs_url() in any output path, and zero snapshots contain a docs URL. So the carve-out is behaviour-neutral.

Verification

  • cargo nextest run --workspace10240 passed
  • cargo xtask verifyall 14 steps green (incl. WASM build + hub-client tests)
  • cargo build -p quarto-error-reporting (default features) builds with no schemars

Next (Phase 3)

Point the Phase-1 repo/publish machinery at quarto-error-reporting (now ready) → posit-dev/ repo + crates.io, then cut q2 over.

🤖 Generated with Claude Code

cscheid and others added 2 commits June 27, 2026 16:22
…r-catalog (bd-egcyeym9)

Phase 2 (carve-out) of pulling quarto-error-reporting out of the monorepo: sever
the Q-* catalog *data* from the reporting host so the crate can ship to non-Quarto
consumers, while q2 keeps its codes/URLs.

quarto-error-reporting (now catalog-agnostic):
- New CatalogProvider trait + EmptyCatalog default + a process-wide
  std::sync::OnceLock registry + install_catalog().
- get_docs_url/get_error_info/get_subsystem keep their exact signatures (the
  &'static lifetime survives via catalog(): &'static dyn CatalogProvider) but now
  delegate to the installed provider; None when nothing is installed.
- Removed the embedded ERROR_CATALOG static + include_str!(error_catalog.json);
  dropped the now-unused once_cell dep (registry uses std OnceLock).

quarto-error-catalog (new crate): carries error_catalog.json (git-moved), the
ERROR_CATALOG map, QuartoCatalog: CatalogProvider, and install(). The 10
data-presence tests + the example move here; 3 install/delegation integration
tests added.

Wiring:
- The q2 binary main() installs the catalog. The WASM bridge deliberately does
  NOT (it never surfaces docs URLs — JsonDiagnostic has no docs_url field — and
  installing would include_str! the 46 KB catalog into the bundle, past
  hub-client's 35 MiB PWA precache limit). A legitimate EmptyCatalog embedder.
- The two quarto-core data-presence #[test]s query quarto_error_catalog::ERROR_CATALOG
  directly (dev-dep added).
- audit-error-codes.py + ~25 path references repointed to crates/quarto-error-catalog/.

The catalog is fully decoupled from production rendering (docs_url has zero
consumers; no snapshot contains a URL), so this is behaviour-neutral: full
workspace nextest stays at 10240 passing and cargo xtask verify is green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…on` feature (bd-egcyeym9)

The json.rs wire shape (JsonDiagnostic etc.) carries `schemars` and Quarto's
`quarto.org` schema URLs — both Quarto policy. Make it opt-in so the
soon-to-be-published quarto-error-reporting is lean for non-Quarto consumers:

- `schemars` becomes `optional = true`; new `[features] json = ["dep:schemars"]`.
- `lib.rs`: `pub mod json` + its re-export gated behind `#[cfg(feature = "json")]`.
- `tests/schema_drift.rs`: `#![cfg(feature = "json")]` (empty test binary when off).
- The 4 crates that use the wire symbols (quarto, quarto-core, quarto-preview,
  wasm-quarto-hub-client) enable `features = ["json"]`.

`cargo tree` confirms `schemars` is absent under default features and present with
`--features json`. `to_json` (uses serde_json::json!, not the module) and
coalesce.rs stay unconditional. In the q2 workspace json is on via feature
unification, so the wire shape and schema_drift test build as before.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@cscheid cscheid merged commit e014af5 into main Jun 27, 2026
5 checks passed
@cscheid cscheid deleted the feature/bd-egcyeym9-error-reporting-split branch June 27, 2026 21:44
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.

1 participant