Skip to content

Save all of a room edit or none of it - #186

Merged
pancakereport merged 7 commits into
mainfrom
room-edit-atomic
Nov 18, 2026
Merged

pancakereport merged 7 commits into
mainfrom
room-edit-atomic

Conversation

@pancakereport

@pancakereport pancakereport commented Nov 18, 2026 •

Copy link
Copy Markdown

Closes #184

Editing a room set its new name and start time on the room, then updated the seats. If the seats failed validation, the error was flashed but the commit still went ahead, so the new name and time were saved while the page said the edit failed.

The edit form only makes movable seats with whole-number counts, so its seats can't fail validation today. This keeps a failed seat edit from saving the name and time if that changes (e.g. editing fixed seats).

Now:

  • Seats fail validation: the edit is rolled back so nothing is saved, and the form stays up with what staff entered, along with the error and a note that nothing was saved, so they can fix the seats and resubmit.
  • New start time clashes with another room: the form also stays up with what was entered, so another time can be picked. It used to go back to the exam page and lose the edit.
  • The form can't be shown again (the room was deleted meanwhile, or the database is down): it goes back to the exam page with the error, rather than an error page.
  • Unexpected error updating seats or saving: as before, this rolls back (which already undid the name and time) and redirects with a reference.
  • The database goes down as a save breaks a constraint (on any page): if the rollback, or looking for the clash, fails too, staff now get the unexpected-error message instead of an error page.

Success messages

Deleting, importing offerings and students, assigning and emailing already said when they worked; creating, editing and toggling exams, and importing or editing rooms, didn't. They now do:

  • "Created exam '…'." / "Saved exam '…'."
  • "Activated exam '…'." / "Deactivated exam '…'." Nothing is said when the exam stays as it was: deactivating the only active exam leaves it active, which the existing info message already explains.
  • "Imported room '…'." / "Saved room '…'."
  • "Imported N rooms." once for a master sheet import, next to an error for each room that failed. Flashes are kept in the session cookie, so one per room could overflow it for a large import and lose every message.

Tests

  • A seat validation failure or a start time clash re-renders the form with the entered name and the message, and leaves the room's name and start time unchanged.
  • A seat validation failure with the database down goes back to the exam page with the message.
  • An unexpected seat failure leaves the room's name and start time unchanged.
  • A seat failure, or a clash on saving, with the database going down (even rollbacks failing), or the room deleted meanwhile, goes back to the exam page with a message.
  • Each success message above, including toggling with and without a change, and the master sheet count.

🤖 Generated with Claude Code

When the new seats fail validation, roll back so the new name and start
time aren't saved either, and keep the form up with what was entered so
the seats can be fixed. Say when an edit was saved.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

🚀 Staging Preview Deployed!

URL: https://preview-seating-pr-186-137456085712.us-west1.run.app

@codecov

codecov Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.12%. Comparing base (c8cbda2) to head (380cfef).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #186      +/-   ##
==========================================
+ Coverage   92.97%   93.12%   +0.15%     
==========================================
  Files          36       36              
  Lines        2774     2807      +33     
==========================================
+ Hits         2579     2614      +35     
+ Misses        195      193       -2     
Flag Coverage Δ
e2e 33.21% <9.43%> (-0.26%) ⬇️
unit 93.12% <100.00%> (+0.15%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

pancakereport and others added 6 commits November 18, 2026 13:27
Deleting, importing offerings and students, assigning and emailing
already said when they worked; creating, editing and toggling exams and
importing rooms didn't. Toggling says nothing when the exam stays as it
was (deactivating the only active exam leaves it active).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- A room edit whose new start time clashes with another room now keeps
  the form up with what was entered, as a seat error does, instead of
  going back to the exam page and losing the edit.
- Showing the form again loads the room first, and goes back to the
  exam page if it can't (deleted meanwhile, or the database is down);
  the rollback after a seat error no longer raises if it fails.
- Importing rooms from the master sheet says how many were imported in
  one message, rather than one per room: flashes are kept in the
  session cookie, which is small.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A save that broke a constraint rolled back unguarded, and so did the
rollback after looking for the clash failed: if the database went down
then, the rollback's error escaped and staff got an error page instead
of a message. Both now go through one helper that rolls back and says
whether it could, as do the room form's error paths; when even the
rollback fails, the clash isn't looked for.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@pancakereport
pancakereport merged commit 7262a83 into main Nov 18, 2026
15 checks passed
@pancakereport
pancakereport deleted the room-edit-atomic branch November 18, 2026 22:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Editing a room saves its new name and time even when the seats fail to update

1 participant