Repository navigation
test(engine): the cancel tests run every read made ahead, from one registry - #2662
Conversation
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
| // The Add Service dialog replays supplied metadata off the desktop frame too. | ||
| let params = json!({"url":"https://maps.example.org/dataset","type":"ogcapi","text":"{\"collections\":[]}"}); | ||
| for command in ["service.layers", "service.add"] { | ||
| covered.borrow_mut().insert(command); |
There was a problem hiding this comment.
Low severity, test accuracy. This marks service.add as covered before the if !boundaries || … that skips it in the boundary sweep. The same happens for edit.previewShapeConversion a few lines down. The coverage assertion at the end runs in both modes, so the boundary pass only passes because these names were marked there without running. The first-check pass does run both, so the guard still works, but the boundary pass isn't checking what the comment says it checks. A clean fix would be to assert coverage only when !boundaries, or to track coverage per mode. I'm not suggesting a one-line change because that restructures the assertion.
There was a problem hiding this comment.
Fixed in 89008c7: a read is marked as run only where it runs, and the registry check belongs to the first-check pass, which reaches every read. The boundary sweep no longer claims the two it leaves out.
Code reviewI found no bugs or security issues in the changed code. The PR is test plumbing: it moves the read-ahead id lists into one registry, removes the unused I did not run the tests or the wasm build. I had no shell, so Bugs: none found. Security: none found. The rewritten Performance: none found. The one changed hot path, the tool start check in Quality:
AGENTS.md: the updated "Never hold the window" line matches the new registry, and the PR updates the rule as the guidelines require. Changed-surface reach is described in the PR body. I checked the wasm-only and desktop-only branches in Prior reviews: there were no existing threads on this PR, so nothing was left alone as already raised. Change sizeCompared with the base branch (merge base 9ac6068 to PR head 4032491), across the whole PR.
|
📖 Docs preview
GitHub Pages takes a minute or two to publish a new commit. Newer commits from the fork aren't published until a maintainer adds the |
…gistry The commands the desktop app reads ahead on a thread of its own were named in three hand-kept places (the reads::prepare match, the admission check in dispatch.rs and long_commands), and long_commands had fallen behind: Load All, Convert To Annotation, Reload Data, Run Model, the tile archive reload and repair, the Error Inspector and Source File State were never run under Cancel. They are now listed once, in reads::IN_BACKGROUND, which prepare and admission both read; long_commands fails unless it runs every one there (and every table edit) or names why it doesn't in its exemptions. All eight now run in both cancel tests. A model's tool looked at Cancel between steps without counting the look, so the first-check test saw a cancelled run that never looked; that check now counts, like the work's own checks. cmd::tiles::NETWORK, a list of network commands nothing but three tests read, is removed: each command's declared effects (Effect::Network) are what the policy uses, and those tests now check them.
…runs The boundary sweep marked service.add and edit.previewShapeConversion as run though it leaves them out, so the registry check passed there without them. The check now belongs to the first-check pass, which reaches every read.
4032491 to
89008c7
Compare
| "copernicus.login", | ||
| ]; | ||
|
|
||
| /// Registers commands for tile-layer sources, drawing properties, coverage and celestial bodies. |
There was a problem hiding this comment.
The description says every id on the removed NETWORK list already declares Effect::Network, and that doesn't hold for map.body. It was on the list, but it is declared with .effects(crate::policy::Effects::NONE) (crates/engine/src/cmd/tiles.rs:42). map.body switches the basemap to remote planetary tiles, so the map fetches from the network when drawn. A plugin without the network permission could therefore run it. The fixed host list limits the exposure, and I haven't traced every path, so my confidence is medium. Either declare Effect::Network on map.body, or say in the PR why it is not a network command.
Category: security
There was a problem hiding this comment.
No permission changes. On main the removed list is read only by three tests; a plugin call's effects come from policy::command_effects, which gives map.body Effect::Network per call unless basemap is false (policy/effects.rs:57). The description overstated it and is corrected: every id but map.body declares the effect on its spec.
| ) && crate::cmd::edit::table_edit_in_background(command).is_none() | ||
| { | ||
| return Err("only Add Data, Load All, Repair/Reload Data, Convert To Annotation, models, scripts, tile archives, service reads, topology, Source File State, Read Original Image Grid, Preview Shape Conversion, Column Statistics, Similar and Size by Field prepare background work".into()); | ||
| if crate::cmd::reads::in_background(command).is_none() { |
There was a problem hiding this comment.
The registry isn't the only copy of these ids. start_scoped_archive_read still has its own hardcoded list of eight ids and its own error text (dispatch.rs:129-143). Its error text also still lists different commands from the new message. The names are duplicated as well: reads::IN_BACKGROUND and about a dozen reads::ahead("…") constructors (for example repair.rs:208, publish.rs:198, layer.rs:4452) each hardcode a progress name. The work's own name wins whenever work exists, so a drift between them would go unnoticed. Consider having the scoped path check in_background as well, and taking the name from the registry, or a test that the two names match. Confidence high.
Category: quality
There was a problem hiding this comment.
The scoped list names a different property (which reads may start scoped), and the description lists it among the lists left alone. Checking it against the registry and taking the progress names from one place are left for the release quality pass.
| let control = current.as_ref().unwrap_or(control); | ||
| let t0 = now_ms(); | ||
| if control.is_cancelled() { | ||
| // A look at Cancel as the work's own are (counted for a test's control): a model's or script's |
There was a problem hiding this comment.
Nits, grouped: the comment reads "A look at Cancel as the work's own are", which is hard to parse. "As the work's own checks are" would say it. The new not_in_background message (reads.rs:252) is also much less helpful than the old one, which listed the commands that do prepare background work. The behaviour change is fine: in production looked_at counts only for a test control, so the pre-start check behaves as before.
Category: quality
There was a problem hiding this comment.
Left for the release quality pass: the comment's wording, and naming the commands in the refusal.
Code reviewBugs: None found. I checked the Security:
Performance: None found. Quality:
AGENTS.md: No breaks found. The AGENTS.md update matches the code. Already raised, left alone: 1. The prior thread on the boundary sweep marking Change sizeCompared: the whole PR against main (merge base 35abb81 to PR head 89008c7).
|
Summary
The cancel tests covered only the read-ahead commands someone remembered to add. AGENTS.md said read-ahead commands have "no registry: add its call to
long_commandsby hand", and eight never got added: Load All Features, Convert To Annotation, Reload Data, Run Model, the tile archive reload and repair, the Error Inspector and Source File State. These commands are now listed in one place, and the test fails when one of them is missing.reads::IN_BACKGROUNDlists every command read ahead, with the name its progress shows.reads::prepareand the admission check inpolicy/dispatch.rsboth read it. Before, each had its own copy of the id list and its own hand-written error naming the commands, and those copies drifted apart.long_commandsrecords every command it runs as a read. It then checks that set against the registry plusedit::TABLE_EDITS, and fails unless each command is run or listed in its exemptions with a reason. The exemption list is empty: all eight missing commands now run in both cancel tests.cmd::tiles::NETWORKremoved. Only three tests read this list. Plugins and the policy use each command's declaredEffect::Network(with per-call additions inpolicy/effects.rs), and every id on the list already declares it, exceptmap.body, whose network reach is decided per call there (it fetches unlessbasemapis false). Removing the list changes no permission: nothing but the tests read it. The three tests now check the declaration, so a new network command no longer needs adding to a second list. The last two ids added to it,stac.addBandsandstac.addIndexin chore(sweep): data fixes from the release quality pass #2648, already declaredEffect::Network.This addresses part of #2641 (the read-ahead commands missing from
long_commands). It doesn't change how a plugin call is found to reach files: the special cases by command id inpolicy/effects.rsare the open design in #1316, and they are left as they are.Reach: this is registry and test plumbing in
rustgis-engine. The desktop app, CLI, Python and the phone dispatch through the sameread_ahead, and what each command does is unchanged. In the browser, each command prepares the same work as before (none for the desktop-only reads). The ribbon, shortcuts, command search, Assistant, MCP and plugins see no new command or parameter. Nothing new is saved, so there is nothing to undo or reopen. It adds no copy of layer data.Testing
cargo fmt --all --check,cargo clippy -p rustgis-engine --all-targets -D warnings,cargo check -p rustgis-engine --target wasm32-unknown-unknownwith-D warningscargo test -p rustgis-engine --lib: 2036 passed. Both cancel tests run the eight newly covered commands.data.similarto the hand-kept lists: it is now one registry entry, run by both cancel tests. The registry check is made in the first-check pass, which reaches every read; the boundary sweep leaves outservice.addandedit.previewShapeConversion. Both cancel tests pass on the rebased head, and the fork's CI passed on it.source.syncState) makeslong_commands_stop_when_cancelled_while_they_runfail, naming the missing command. Without thegp.rschange, the same test fails onmodel.runwith "didn't reach Cancel".UI evidence
No visible UI change.
Related issue
Part of #2641.