Repository navigation
fix(engine): Import QGIS Style reads its file and images on a thread, with Cancel (#2620) - #2676
Conversation
…error, not a skipped image (opengeos#2620)
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
| } | ||
|
|
||
| /// The read `style.importQgis` makes before it runs in the desktop app: on a thread of its own, with | ||
| /// Cancel. A request that is wrong gives nothing, or its error: the command says why. It holds a |
There was a problem hiding this comment.
The doc overstates what style_ahead does with a wrong request. It returns None for a request with no usable layer, and no read is placed; the command then gives its error when it runs. A read that fails (a missing or unparseable file) is not returned here at all: it is carried inside StyleAhead and given to the command on landing. Suggested wording:
| /// Cancel. A request that is wrong gives nothing, or its error: the command says why. It holds a | |
| /// Cancel. A request that is wrong gives nothing: no read is placed, and the command gives its error when it runs. A read that fails lands with its error. It holds a |
Category: quality
Code reviewNo bugs, crash paths, silent data loss or security issues found. I checked the new background read against the existing Prior reviews: none on this PR, so no concerns were left alone. Bugs
Security
Performance
Quality
AGENTS.md
Everything else in the AGENTS.md checklist I could verify holds: the Change sizeCompared: the whole PR against main (merge base 4bbe5be to PR head 0d44e06).
|
📖 Docs previewCommit |
Summary
style.importQgisread its.qml(up to 256 MiB), parsed it (up to 64 MiB of XML) and read and decoded each raster image marker's image on the window's thread, with no Cancel (raised in review of #2612).In the desktop app it is now a read made ahead (in
reads::IN_BACKGROUND), as Size by Field and Column Statistics are:reads::preparereads and parses the style on a thread of its own, and the command takes the result when it lands. The read looks at Cancel after the file read, before each image and once the parse is done, so a Cancel during the images is the cancelled error, not a style with skipped images. The style is applied only on landing, so a cancelled import leaves the layer as it was, and the landing is one Undo step. A layer renamed while its style was read is refused ("the layer was renamed while its style was read: import it again"), as the read used the old name.Every other caller (the command line, Python, scripts and models, the Assistant and MCP, the browser, which has no read thread) reads where the command runs, as before. The single file read and the XML parse don't look at Cancel inside them (bounded by the 256 MiB and 64 MiB limits), and there is no progress count, only the background-read bar's busy indicator.
project.importQgisstill runs on the window's thread (#2476). It shares the image reader, and a script or model runs it under Cancel, so it gains the same look once its parse is done: a Cancel during its images adds no layers, rather than an import with skipped images. No test drives that project path's Cancel.Memory: one copy of the command's own
textordata(at most 64 MiB, or its base64) while the read runs; no layer or raster data is copied.docs/user-guide/workspace.mdnames it among the reads made on a thread.Testing
qgis_style_import_reads_its_files_ahead(engine): the style is read ahead; it still lands after the.qmland image are deleted; the notes and marker match the inline route for a clean PNG and a lossy GIF; Undo; a Cancel at every check, on the read thread and run inline under a probe, ends as the cancelled error with the project unchanged; a rename between the read and the landing is refused. Before the change it failed (the command wasn't among those that prepare background work); without the look after the parse it fails (the file, the image and the parse's end look: 2).style.importQgisis registered inreads::IN_BACKGROUND, andcancellation.rsreads it with a raster marker image, solong_commandsruns it in both Cancel sweeps.a_qgis_style_is_read_on_a_thread_before_it_lands(ui-egui readjob): the job starts as "Import QGIS Style", the layer is styled only on landing, a lossy GIF is noted once on landing, a clean style says nothing, and Undo.cargo test -p rustgis-engine --libwith the qgis/style import,cancel,similar,hostile_params_never_panicandpermission_policyfilters;cargo test -p rustgis-ui-egui --lib readjob; clippy with-D warningson engine and ui-egui.origin/main(8265123) with this branch and one other of mine (fix/2447-terrain-block-keys) merged: pre-commit on every file,cargo fmt --check, clippy with-D warnings,cargo test --workspace(8721 passed, 0 failed),cargo xtask layers,cargo xtask schema --checkwith the fixtures checked against the schema and test hygiene,cargo xtask rows, and the Python package's tests (maturin + pytest, 44 passed). Not run here: the wasm32 build (no clang on this machine; CI's Web app job checks it), macOS and Windows.UI evidence
No new UI: the existing background-read bar (busy indicator and Cancel) shows while a QGIS style imports. No screenshot taken.
Related issue
Closes #2620. #2476 (
project.importQgisoff the window) is a separate change and stays open.Summary by CodeRabbit