Repository navigation
fix(engine): check that an edit's copy fits beside what the session holds #2445
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
b79431d
21d4657
36abfd5
1295c03
dab75a1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -668,6 +668,8 @@ fn set_value(s: &mut Session, p: &Json) -> CmdResult { | |
| let (ty, field) = ds.fields.get(fi).map(|f| (f.ty, f.name.clone())).ok_or("no field")?; | ||
| let v = typed(raw, ty)?; | ||
| let loss = numeric_loss(&input, &v, ty); | ||
| // Looked at before writing: a write copies rows shared with the Undo snapshot (#2431). | ||
| ds.features.get(row).and_then(|f| f.attrs.get(fi)).ok_or("no such row")?; | ||
| let cell = ds.features.get_mut(row).and_then(|f| f.attrs.get_mut(fi)).ok_or("no such row")?; | ||
| *cell = v; | ||
| let table = ds.name.clone(); | ||
|
|
@@ -684,6 +686,8 @@ fn set_value(s: &mut Session, p: &Json) -> CmdResult { | |
| let v = typed(raw, ty)?; | ||
| // Keep the existing finite coercion, but say when it discards information. | ||
| let loss = numeric_loss(&input, &v, ty); | ||
| // Looked at before writing: a write copies rows shared with the Undo snapshot (#2431). | ||
| l.dataset.features.get(row).and_then(|f| f.attrs.get(fi)).ok_or("no such row")?; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug, same class elsewhere (confidence: high on the mechanism; it only matters under memory pressure): this pre-check is the right fix for
Both should use
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in 1295c03. The other handlers that write before their last check aren't changed one by one. Instead, the user guide now says what holds: an edit that fails before it starts copying gives the steps back, and one that fails after it started copying has used them, as a finished edit would have.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug (confidence about 60%). This pre-check covers the type, row and field checks, but The earlier thread on Options: run the design checks before
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Left as it is, and documented. A rule that refuses the edit after the row was written has already started the copy, so the steps set aside for it are spent, as they would be for an edit that went through. The user guide says so: "One that fails after it started copying has used them, as a finished edit would have." Moving every |
||
| let f = l.dataset.features.get_mut(row).ok_or("no such row")?; | ||
| let before = f.clone(); | ||
| let cell = f.attrs.get_mut(fi).ok_or("no such row")?; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit (quality, minor): every caller discards the
boolthis returns (let (res, _) = …inlib.rsandreads.rs,.0indispatch.rs), and the session decides what to say from the slot's state instead. Either return justR, which drops thefiredcomputation inrows_copy::with, or use the flag somewhere. Left for the release quality pass if you prefer.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left for the release quality pass.