maniator / maniator/verticopolis

[P3] schedule-dirty-noop-edits: the unsaved-changes flag tracks handlers running, not the schedule changing

Open
#669 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
5
Forks
1
PR merge metrics
No merged PRs in 30d

Description

Deferred from /bmad-code-review of the pinned dialog footer (PR #664, v1.104.0). Edge Case Hunter finding.

state.dirty in src/ui/uiElevatorSchedule.ts is set because a handler ran, not because the working copy actually changed. That produces two mismatches in opposite directions:

  • False positive. A stepper already clamped at its limit, or a preset that reapplies the values already in place, marks the dialog dirty. The player then sees "You have unsaved changes." over a schedule identical to the saved one, and Esc arms a discard guard for nothing.
  • False negative. The Serve toggle re-snaps homeFloors inside afterStops without setting the flag. Unserving a floor that cars were homed on rewrites the home assignments, and Esc can then discard that silently, leaving cars homed on floors the shaft no longer serves.

The second is the one that costs work, and it is the same class of bug #664 set out to fix: a real edit the player is never told about.

Fix when picked up: snapshot the working copy (a serialization is enough) before each handler and set dirty from an actual comparison rather than from the call. Cover both directions with tests: a clamped no-op edit leaves the dialog clean, and a Serve toggle that re-homes cars marks it dirty.

/bmad-code-review.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read src/ui/uiElevatorSchedule.ts and trace the schedule handlers that update state.dirty, starting with the clamped stepper, preset, and Serve-toggle paths. Add or locate tests covering both a clamped no-op and Serve-triggered re-homing; done means only actual working-copy changes mark the dialog dirty.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.