Make quarto-error-reporting catalog-agnostic; extract quarto-error-catalog (bd-egcyeym9, Phase 2)#349
Merged
Conversation
…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>
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.
Phase 2 of extracting
quarto-error-reportingout of the monorepo (strand bd-egcyeym9): make the crate catalog-agnostic so it can ship to non-Quarto consumers, while q2 keeps itsQ-*codes andquarto.orgdocs URLs. No crate leaves the repo in this PR — that's Phase 3.Builds on #348 (Phase 1:
quarto-source-mapalready published & consumed from crates.io).Two commits
1.
refactor: make catalog-agnostic + extractquarto-error-catalogquarto-error-reportinggains aCatalogProvidertrait +EmptyCatalogdefault + astd::sync::OnceLockregistry +install_catalog().get_docs_url/get_error_info/get_subsystemkeep their exact signatures but delegate to the installed provider. The embeddedERROR_CATALOGstatic +include_str!are gone;once_celldropped.quarto-error-catalogcrate holdserror_catalog.json(git-moved), theQuartoCatalogprovider, andinstall(). The 10 data-presence tests + the example move here; 3 install/delegation integration tests added.q2binarymain()installs the catalog. WASM deliberately does not — it never surfaces docs URLs (JsonDiagnostichas nodocs_urlfield), and installing wouldinclude_str!the 46 KB catalog into the bundle, past hub-client's 35 MiB PWA precache limit. A legitimateEmptyCatalogembedder.audit-error-codes.py+ ~25 path references repointed tocrates/quarto-error-catalog/.2.
build: gate the json wire shape behind a default-offjsonfeatureschemars→optional;[features] json = ["dep:schemars"];json.rsmodule +schema_drifttest gated. The 4 wire-symbol consumers opt in.cargo treeconfirmsschemarsis 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 --workspace— 10240 passedcargo xtask verify— all 14 steps green (incl. WASM build + hub-client tests)cargo build -p quarto-error-reporting(default features) builds with no schemarsNext (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