Repository navigation
Conversation
Keep eager configuration validation available while allowing hosts to compile and cache only languages they use. Propagate deferred query errors and include a cold initialization comparison example. AI-assisted with Codex. Agent-Session: 01a1197a-7e1b-7742-a9bd-04ed4353bed1
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.
Summary
Config::compile()builds Tree-sitter annotation and highlighting queries for every configured language, even when a host only needs one. Add an opt-inConfig::prepare()that assembles sources immediately and compiles each language, including its embedded languages, on first use. Cache successful results and errors per configuration.Language lookup now returns
Result; diff entry points propagate configuration errors while retaining typedQueryConflicterrors insideanyhow::Error. CLI debug callers use their already-validated configuration.This PR contains only the core change and a native timing example. It is based on
codex/reapply-diffr-after-release, independently of #1011. The browser's one-line switch fromcompile()toprepare()was used for measurements but is intentionally left in the website branch. No deployment is included.Evidence
Measured locally with Node 24.18.1 and release WASM on the browser branch containing #1011. Timings exclude download, WASM compilation/instantiation, and rendering; these are individual local runs, not CI performance thresholds.
Differconstructorask-composer.tsxdiff from PR #998All 18 existing browser corpus responses are JSON-identical before and after this change. The browser engine's five native integration tests passed with the opt-in. The new core regression exercises an invalid Rust query: eager compilation rejects it immediately; prepared configuration can diff Python; repeated Rust diffs return the named query error rather than panic.
Native reproduction from
diffr/, using separate processes to keep each initialization cold:The example reports initialization, first TSX diff, their combined time, and warm diff time. It measures the core pipeline, without browser plugins or UI. On this machine with Rust 1.99 release builds, eager initialization plus first diff took 1,614 ms versus 53 ms for lazy preparation (3.4 ms preparation + 49.7 ms first diff). Warm diff time was 112–113 µs for both. These native numbers use the small inline TSX example, not the PR #998 workload above.
Validation:
cargo test --locked(596 passed across the workspace, including the 294 language-context cases and WASM plugin integration),cargo fmt --all -- --check, andgit diff --check.Merge Danger
Door: two-way; no persisted data changes.
Blast Radius: shared core API.
Params::languagebecomes fallible and diff entry points returnanyhow::Result, requiring downstream direct callers to handle errors. ExistingConfig::compile()callers retain eager validation. Hosts opting intoprepare()discover invalid query syntax/tags only when that language is first used, and pay that language's compilation cost on its first diff. Query sources remain in memory for deferred compilation. Browser adoption and any change to the CLI's validation policy are separate.AI-assisted implementation and validation with Codex.