Repository navigation
fix(engine): say which history an edit's memory check dropped (#2431) - #2460
Conversation
…st what it doesn't check (opengeos#2431)
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
| } | ||
| session.active_layer = Some(session.map().layer_by_name("rows").unwrap().id); | ||
| session.undo_memory.memory = Some(4); | ||
| assert!(session.run("edit.setValue", &json!({"layer": "rows", "row": 0, "field": "text", "value": "d"})).is_err()); |
There was a problem hiding this comment.
Test coverage (confidence ~80%). This assertion only checks that the edit fails. It does not check why, so the premise of the test ("the edit would not fit even with no history") is unverified: an unrelated error, such as a wrong layer or field, would also pass. The neighbouring tests at lines 683-684 and 727-730 check the message. Suggested change:
| assert!(session.run("edit.setValue", &json!({"layer": "rows", "row": 0, "field": "text", "value": "d"})).is_err()); | |
| let err = session.run("edit.setValue", &json!({"layer": "rows", "row": 0, "field": "text", "value": "d"})).unwrap_err(); | |
| assert!(err.contains("not enough memory"), "{err}"); |
| // Not taken by a copy, but the history changed while a background edit ran (another | ||
| // edit, Undo, trimming): the steps can't follow on from it. Rare, and not about making | ||
| // room, so said each time. | ||
| Some(_) => { |
There was a problem hiding this comment.
AGENTS.md (confidence ~45%, a judgment call for maintainers). AGENTS.md says a loss gets "one notice per kind with a count". This arm says the drop again on every occurrence (the PR body says so on purpose, as it is rare). The earlier say_room() gate limits the make-room notice to once a project, so this arm is now the only path that can repeat a notice of the same kind. Either keep the per-occurrence notice and say so in the PR's Suggested AGENTS.md additions, or gate it the same way. The message text and the (N Undo or Redo steps) count look right: the foreground path always passes in_place = true, so this arm is only reached from the background and reclaim paths where history moved on.
Code reviewBugs
Security
Performance
Quality
AGENTS.md
Test coverage
Prior reviews
Change sizeCompared with the base branch: the whole PR, merge base 82526c3 to head 4366e46.
|
📖 Docs preview
GitHub Pages takes a minute or two to publish a new commit. |
Summary
Follow-up to #2445 (#2431 fix 3, part 1), from its last reviews.
.view()commands, so they don't count as edits. The test pins that.Not changed: an edit whose own rules refuse it after it wrote (calculation rules, validation in
design::apply) has used the steps set aside for it. The guide already says so: "One that fails after it started copying has used them, as a finished edit would have."Reach every surface
Session::notify_text, as before.Testing
cargo fmt,clippy -D warnings(engine),cargo test -p rustgis-engine,cargo xtask test-hygiene, andRUSTFLAGS='-D warnings' cargo build --locked --target wasm32-unknown-unknown -p rustgis-web.undo_and_redo_run_when_an_edit_would_not_fit, which is new, and the cancelled-edit test, which now checks the new text and that it doesn't say "make room".UI evidence
No change to panes or dialogs. Two notice texts changed; they are quoted above.
Related issue
Part of #2431
Summary by CodeRabbit