Repository navigation
#1745: An agent's Undo no longer asks about a subscribed calendar's event that it keeps - #1750
Conversation
…dar's event that it keeps Before an agent's Undo or Redo, MailCraft works out which appointments it would take away, so that it can ask about any of their windows with unsaved changes. It counted an event of a subscribed calendar among them when the calendar's refresh had brought the event after the step and the clock had then moved to another zone, or when the calendar was subscribed after the step. Undo and Redo keep those events, so the question was asked for nothing. event_as_then now answers "stays" first for an event of a calendar subscribed now. Where those events show after a zone move is UCSLabs#1709 and is not changed here. This answers CodeRabbit's last comment on UCSLabs#1710. Human-reviewed, AI-assisted, nobody's mailbox harmed.
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
There was a problem hiding this comment.
🤖 Automated review of 2748e95
The change correctly implements the logic to exclude subscribed calendar events from the Undo/Redo gate's questions. By checking if the current mailbox (now) has a subscribed calendar for an event, the function now returns false, preventing the agent from asking about these read-only events, which aligns with the intended behavior that they persist through undo/redo operations. The extensive test coverage provided confirms this fix across numerous complex state transitions (zone moves, subscriptions, history steps). No defects found.
No issues found.
✅ Approved: no unresolved findings at [P4] MINOR (Quality) or above.
Model google/gemma-4-e4b · skill code-change-review · 4 files reviewed. Reply to an inline comment to discuss it.
benandez
left a comment
There was a problem hiding this comment.
Read event_as_then against subscribed_stay and events_stay in crates/engine/src/undo.rs. subscribed_stay runs last and re-inserts every event whose calendar is subscribed in now from now, whatever then has, so answering "not taken away" first for those events matches what Undo and Redo do. For events of other calendars the new expression is equal to the old one: (None, _) => true and (Some(was), _) => was && is != Some(true) collapse to is_none_or(|was| was) once the now-subscribed case has returned early. The matrix test compares the gate with the real edit.undo/edit.redo both ways, and the existing "never says less than the undo does" test still covers the other direction. No findings. Fragments are present.



Closes #1745
What changes for the person using MailCraft
Before an agent's Undo or Redo, MailCraft works out which appointments it would take away, so that it can ask about any of their windows with unsaved changes. It no longer counts an event of a subscribed (Internet) calendar among them, since Undo and Redo keep those events as they are. Before this change it did when the calendar's refresh had brought the event after the step and the computer had then moved to another time zone, and also, with no zone move at all, when the calendar was subscribed after the step (or removed and subscribed to again). The owner could then be asked about a window that the Undo wouldn't close. The answer was only ever too cautious; it never missed an event that goes. Nothing else changes: where a subscribed calendar's events show after an Undo across a zone move is #1709, and this doesn't fix it.
This answers CodeRabbit's last comment on #1710 (
undo.rs,event_as_then), which was merged before it was addressed.How it was checked
crates/engine/src/cmd/remote/undo_gate_tests.rs›a_subscribed_event_a_refresh_brought_is_said_to_stay_through_an_undo_after_a_zone_move: CodeRabbit's case, Undo and then Redo, with the zone move settled or not. It fails with main'sundo.rs(logs/red-01.log: "Unsettled: Match two said to go with the undo") and passes with the fix (logs/green-02.log).Same file ›
a_calendar_subscribed_after_the_step_keeps_its_events_through_the_undo_and_is_said_to: the calendar subscribed after the step, in all five zone states including no move at all; it also checks that the Undo and Redo really ran (the step's appointment goes and comes back). It fails with main'sundo.rsat the first state, no move (logs/red-01.log: "Not: Match one said to go with the undo"), and passes with the fix.Same file ›
the_undo_gate_says_exactly_what_happens_to_the_subscribed_calendars_events: for every subscribed event, over 6 steps × 3 things done to the subscriptions after the step (nothing, another calendar subscribed, the calendar removed and subscribed again) × 5 downloads × 5 zone states × a redo with or without another move, what is said is compared with what the realedit.undo/edit.redothen does. With main'sundo.rs: 564 mismatches, all "said to go, stayed" and all before an Undo; with the fix: none (logs/red-01.log,logs/green-02.log). Each check is counted once, and floors make sure it reaches subscribed events (2,880 compared, in 900 worlds that each run a real Undo and Redo), a zone moved among them (768) and a calendar subscribed after the step (1,260).The existing
the_undo_gate_never_says_less_than_the_undo_doespasses with main'sundo.rsand with the fix, so over its matrix no event the Undo takes away is said to stay.Mutants of the changed function, each run against the engine's 249
undotests (mutants.txt,logs/mut-*.log). A no-op baseline passes, and main's own body fails 3 tests. Of 13 mutants, 11 are killed. The two that look at the step's calendar instead of the current one (subscribed(then) == Some(true), andsubscribed(now)only when the step's mailbox has that calendar) passed every test before this change. They now fail the calendar-subscribed-after-the-step test and the matrix (420 mismatches each). Two survive, and are believed equivalent in every state that commands can reach (reasoned, not proven):Reviewed, not a test (on the same
undo.rschange over 3e04914, whoseundo.rs,session.rsandundo_gate_tests.rsmain has unchanged): across the full gate matrix every other answer is the same before and after (74,504 for other events, 30,000 for ids that aren't events, 6,000 Delete questions); only the too-cautious answers for subscribed events changed. A reviewer's differential over 258,770 predictions found 0 under-reports added and every over-report for subscribed events gone, and a window probe showed a subscribed appointment's window can hold unsaved changes, so the extra question was visible.cargo xtask ci, all 14 steps, on the committed head of this branch (rebased on main b1e2d1c), with a clean tree before and after; also on the same four files over 198fac9 before the rebase.Not exercised: the window itself in this branch (no window run), other platforms.
cargo xtask cipassesA crash or data-loss fix has its regression test
"Allow edits by maintainers" is ticked (the box beside Create pull request)
I have signed the CLA, or will by commenting on this pull request
Human-reviewed, AI-assisted, nobody's mailbox harmed.
Summary by CodeRabbit