Repository navigation
Reliability: fetch timeouts, no panics on I/O, stdio integration tests (1/4) - #41
Merged
Merged
Conversation
…rors - One shared HTTP client for all fetches, with a 10 s connect and a 30 s request timeout. Before, every fetch built a new client without timeouts, so a host that never answered kept that load pending forever. - A response whose body cannot be read is an error instead of a panic (`resp.text().await.unwrap()`). - `file:` URLs are read through `to_file_path`, which decodes percent-escapes; `Url::path` kept them, so a path with a space failed. - No panic when a built-in ontology has no cache location, when the world does not answer during `initialize`, or on an unbound SPARQL variable. Tests: a host that accepts but never answers times out, and a `file:` URL with an escaped space is read.
`swls/tests/stdio.rs` starts the real binary and talks JSON-RPC to it the way an editor does, so `Backend`, positions, the file system and the cache are exercised for real. The ECS-level harness bypasses all of that, which is how earlier position and lifecycle bugs slipped through. Each test uses private cache and config directories and only built-in ontologies, so no network is needed: - completion right after `foaf:`, hover on the first character of a term, and goto-definition into the read-only cached ontology; - `didClose` clears the document's diagnostics; - a request for an unknown document is answered, and the server keeps working afterwards.
A regression test for a reported setup: a mapping that imports its shapes with a relative `owl:imports <./shape.ttl>`, a `foaf:Person` that already has `foaf:name`, and completion on the empty line after it. The missing required `foaf:name22` must be the first suggestion, followed by the template that adds it, and `foaf:name` must not be promoted. Checked as Turtle and TriG, and at the end of an unfinished file. The test fails against the server from before "suggest predicates that shapes require first" (the first suggestion is the `foaf` prefix) and passes now.
A panic inside a system ended the task that owns the world, and Bevy only re-inserts a schedule after it finishes, so the server kept accepting requests that were never answered. The world loop now catches the panic, reports it on stderr and exits, so the editor restarts the server and shows the error in its log. Panics in background fetch tasks are unaffected.
Cargo 1.100 warns that `package.homepage` equal to `package.repository` is redundant, once per crate. components-rs keeps its own, different homepage.
This was referenced Nov 18, 2026
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.
First of four stacked PRs: reliability → responsiveness → correctness → features. Each later PR is based on the previous one's branch.
Fetching
swls/<version>user agent. Before, every fetch built a new client without timeouts, so a host that never answered kept a load pending forever.resp.text().await.unwrap()).file:URLs: they are read throughto_file_path, which decodes percent-escapes.Url::pathkept them, so a path with a space failed.No more panics or hangs
initialize, or on an unbound SPARQL variable.Integration tests over stdio
swls/tests/stdio.rsstarts the real binary and talks JSON-RPC to it the way an editor does. That exercisesBackend, positions, the file system and the cache, which the ECS-level harness bypasses. Each test uses private cache and config directories and only built-in ontologies, so no network is needed.completion right after
foaf:, hover on the first character of a term, and goto-definition into the read-only cached ontology;didCloseclears the document's diagnostics;a request for an unknown document is answered, and the server keeps working afterwards;
required shape properties are suggested first, for a reported setup:
owl:imports <./shape.ttl>;foaf:Personthat already hasfoaf:name;foaf:name22first, then the template, and does not promotefoaf:name;This test fails against the server from before Suggest predicates that shapes require first #40 and passes now.
Housekeeping
package.homepagefields are gone. Cargo 1.100 warns about them once per crate. components-rs keeps its own, different homepage.Testing
cargo test --workspace(587 tests),cargo fmt --all --checkandcargo clippy --workspace --all-targets -- -D warningson Rust 1.100 pass.file:URL with an escaped space is read.