Skip to content

feat(web): ask the scope before editing an Event that repeats - #236

Merged
mwg-bender[bot] merged 2 commits into
devfrom
feat/204-edit-scope
Nov 25, 2026
Merged

mwg-bender[bot] merged 2 commits into
devfrom
feat/204-edit-scope

Conversation

@mwg-bender

@mwg-bender mwg-bender Bot commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

Summary

Update Event on an Occurrence (an Event with a SeriesId) now asks which events take the change. The question is the reusable ScopeDialog from #234, shown over the Edit Event dialog. It is titled "Update repeating event", the group label is "What to update", nothing is pre-selected, Confirm stays disabled until a choice is made, and it is not destructive:

Option Confirm text Route
This event only Update this event PUT api/events/{id} (the existing save; the API marks the Occurrence Modified)
This and following events Update this and following GET api/series/{seriesId}, then PUT api/series/{seriesId}?scope=following&occurrence={eventId} with If-Match set to the ETag that was read
All future events Update all future events GET api/series/{seriesId}, then PUT api/series/{seriesId}?scope=all with If-Match set to the ETag that was read

A standalone Event saves exactly as before (same dialog, same route, no question). An Occurrence with no changes also saves as before, with no question.

A Series holds the name, the time of day and Unique games only. All three options are offered only when the change touches nothing but those three. A changed date or any changed slot (a roll, a replaced activity, an added or removed slot) offers "This event only" alone, with the line "A changed date or changed activities apply to this event only."

Refs #100, #204

Change (Web only)

  • Services/SeriesService.cs: GetAsync(seriesId) returns SeriesRead.Stored(series, eTag) or SeriesRead.Failed(message). UpdateAsync(series, eTag, scope, occurrenceId) sends PUT api/series/{id}?scope=all or ?scope=following&occurrence={id} with If-Match (passed through as read).
  • Shared/Events/SeriesEdit.cs (new, pure: no JS, no clock, no services) holds:
    • Compare: what changed;
    • Question: the options, wording and confirm texts;
    • Body: the stored Series with only the name, the start's time of day and Unique games only replaced;
    • OtherDay: the check for a time that falls on another day.
  • Shared/Events/EventEditDialog.razor.cs (new partial) adds AskScope, ScopeConfirmed/ScopeCancelled, DropScope and UpdateSeriesAsync. EventEditDialog.razor is 371 lines, under 400. It renders the ScopeDialog, and Escape or overlay clicks drop the question first. The edit dialog's TrapFocus is released while the question is open, so focus returns into the open Edit dialog. SendAsync now runs through RunAsync, the one busy guard (_generating), so a double click sends once on every route. A failure keeps the dialog open with The event was not saved. {API message}.
  • Tests (new files, each under 400 lines):
    • OccurrenceEditScopeTests (21) and OccurrenceEditGuardTests (18), on a shared OccurrenceEditFixture;
    • SeriesEditTests (22, pure);
    • SeriesServiceTests (+7);
    • two rows in ServiceRouteContractTests.
  • ServiceRouteContractTests was not in the card's list. Its existing EveryPublicServiceMethodHasARowInTheTable fails for any new public service method until that method has a row, so the file had to change.
  • Nothing in API, Shared, Api.Tests, docs or .github/.

Validation

All runs are by the worker (Nerd's dispatched worker, t_816d92da).

Cold build and tests:

Base 916eba8 After 1a0a814
Build 0 errors, 0 warnings 0 errors, 0 warnings
Api.Tests 870 passed + 4 skipped 870 passed + 4 skipped
Web.Tests 1092 1160 (+68)
E2E (no stack) 5 passed + 12 skipped 5 passed + 12 skipped

No test was removed, renamed or split.

Mutations: 29 break-it mutations, all killed. The list, with the tests that failed, is in the evidence file on the card. M23 removes ScopeDialog's answer guard. It is killed by the existing ScopeDialogTests.AFastSecondAnswer_CountsOnce, which is outside the edit-scope filter.

Live (with-slot.sh, headless Chromium, America/Chicago):

Flow Branch Control (origin/dev)
F1 standalone Update, no question PASS PASS
F2 weekly Series from the dialog: name-only change asks three scopes; This event only renames one row, which is Modified; the Series is unchanged PASS FAIL (no question, expected)
F3 All future events renames every future unmodified Occurrence, not the Modified one PASS FAIL (expected)
F4 This and following: the old Series ends before the Occurrence (splitAt = its key), a second Series starts there, earlier Occurrences keep the old name PASS FAIL (expected)
F5 changed date: only This event only, with the reason line PASS FAIL (expected)
F6 Cancel keeps the Edit dialog open, with its values and focus in it, and sends nothing PASS FAIL (expected)
F7 stale ETag (the Series is edited through the API between the browser's GET and PUT, scripted with a route hook) shows the 409 text in the dialog PASS FAIL (expected)
F8 keyboard only: arrow keys choose, Enter on Confirm PASS FAIL (expected)

The date in F5 was typed and confirmed with Enter. The calendar popup does not open in headless Chromium.

E2E against the branch stack: 17/17 passed on a fresh stack. Run on the same stack straight after F1-F8, 14 passed and 3 failed: DeleteEvent_ConfirmationNamesIt_CancelKeepsIt_ConfirmRemovesIt, RapidSecondClick_OnConfirmedEventDelete_SendsOneRequest and SelectWinner_OnEventWithTwoSelections_SavesAndShowsTheWinner. Each of them waits for its own row button, and the row is not shown. Plain origin/dev (916eba8) gives exactly the same 3 failures in the same order (control F1-F8, then E2E). So this comes from data seeded before the suite, not from this change (see Observations).

Observations (not fixed)

  • The E2E suite assumes a near-empty Events list. After the Events the F1-F8 flows seed first (one standalone Event plus five weekly Series with their Occurrences), 3 flows cannot find their own row. This happens on dev too. The suite should search for its row, or page to it.

Notes

  • Stored time and offset. A series scope reads the dialog's time at the stored Series start's UTC offset, not at the browser's offset, and the new start keeps that offset. "All future events" keeps the stored start's day. "This and following" starts on the day of the edited Occurrence's OccurrenceKey at that offset, at the new time of day. The API reads the body's start as the new Series' start and requires it after every earlier Occurrence's key. If the new time lands on another calendar day at the Series' offset (possible only when the browser's offset differs), the dialog refuses after the GET and before any PUT: "At the series' own UTC offset this time falls on another day, so only this event can take it. Choose This event only, or another time."
  • Unrolled Occurrence. An Occurrence that has not been rolled yet (0 slots), with a change, now saves with 0 slots (the API accepts an Occurrence with none). Before this change the dialog refused it with "Select 1–5". An unchanged or standalone Event keeps the 1–5 rule.
  • Rule-change gap. The rule, the end date and the slot template of an existing Series have no UI. Edit has no Repeat section (ADR 0002, feat(web): make an Event repeat from the create dialog and mark repeating Events in the list #231: create-only). A follow-up would need:
    • a Repeat section in Edit for an Occurrence, prefilled from GET api/series/{id};
    • the API's split rules surfaced (an end on a split Series can only stay or move earlier; the start of a following Series cannot move before splitFrom);
    • deleted Occurrences warned about before an all edit that drops keys.
  • Docs for the docs card:
    • GLOSSARY: the edit scopes This event only / This and following events / All future events, and the wording above.
    • docs/api-validation.md: the Web reads GET api/series/{id} and sends its ETag as If-Match; the Web's other-day refusal.
    • ADR 0002: which fields a series scope can carry (name, time of day, Unique games only).
  • Refs #100, #204 only. Nerd closes the issues by hand.

Update Event on an Occurrence (an Event with a SeriesId) now asks which
events take the change, in the reusable ScopeDialog over the edit dialog:
"This event only" (the existing PUT api/events/{id}, which marks it
Modified), "This and following events" (PUT api/series/{id}?scope=following
&occurrence={eventId}) or "All future events" (PUT api/series/{id}?scope=all).
None is chosen when it opens, Confirm names the scope, and it is not
destructive. A standalone Event, and an Occurrence with nothing changed,
save as before with no question.

A Series holds the name, the time of day and Unique games only, so only
those changes offer the series scopes. A changed date or changed slots
offer "This event only" with the one-line reason. A series scope reads
the Series (GET api/series/{id}) and sends it back with only those three
replaced, under If-Match = the ETag read. The rule, end, slot count,
Filters, skipped, splitAt and splitFrom go back as read. The new time of
day is read at the Series' own UTC offset. "This and following" starts
on the day of the Occurrence's key at that offset. A time that lands on
another day at that offset is refused in the dialog before any PUT.

The pure parts live in SeriesEdit.cs; the dialog's scope wiring lives in
EventEditDialog.razor.cs, and the save's busy guard (RunAsync) covers
every route, so a double click sends once. Refusals show the API's
words in the dialog's own error line and keep it open. Cancel, Escape
and overlay click drop the question and leave the edit dialog open with
focus back in it.

Refs #100, #204
@mwg-bender

mwg-bender Bot commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

DISPOSITION (t_816d92da, #100 / #204 Web part 2b)

Item Disposition
#204 edit scopes: question before Update on an Occurrence DONE. The ScopeDialog from #234 is reused (not forked), over the Edit dialog. Title "Update repeating event", group "What to update", nothing pre-selected, Confirm disabled until a choice is made, not destructive.
Option wording DONE, as the card gives it: "This event only" / "Only this event changes. Later changes to the series will not touch it."; "This and following events" / "This event and every later one that has not been played or edited by hand take the change. Earlier events stay as they are."; "All future events" / "Every future event of the series that has not been played or edited by hand takes the change."
Three confirm texts DONE: "Update this event", "Update this and following", "Update all future events". Before a choice, Confirm reads "Choose an option" (ScopeDialog's own text from #234).
One-line reason DONE: "A changed date or changed activities apply to this event only." It replaces the message when only "This event only" is offered.
Standalone Event untouched DONE: same dialog, same route, no question (bUnit test, live F1).
No change asks nothing DONE: the existing save runs, and the API still marks the Occurrence Modified.
Routes DONE. This event only is PUT api/events/{id}, unchanged. Following is GET api/series/{id}, then PUT ?scope=following&occurrence={eventId}. All is GET, then PUT ?scope=all. If-Match is the ETag that was read. The ids come from the edited row.
Body sent back DONE. It is the stored Series as read, with only the name, the start's time of day and Unique games only replaced. Rule, end, slot count, Filters, skipped, splitAt, splitFrom and eTag go back as read.
Stored time and offset DONE. The dialog's time is read at the stored start's UTC offset, and the new start keeps that offset (not the browser's). There is a pure test across a DST offset. "All" keeps the stored start's day. "Following" starts on the day of the Occurrence's OccurrenceKey at that offset, at the new time. That matches the API row (the body's start becomes the new Series' start and must be after every earlier key). A time that lands on another day at the Series' offset is refused in the dialog after the GET and before any PUT.
Errors DONE. The dialog stays open with The event was not saved. {API message}. A stale ETag shows the API's 409 text (live F7, scripted race). A failed GET sends no PUT.
Busy guard / double click DONE. One RunAsync guard covers every route. ScopeDialog's own answer guard is also in place (M23 is killed by ScopeDialogTests).
Focus DONE. Cancel, Escape and overlay drop only the question, and focus returns into the open Edit dialog (live F6). Keyboard: radios by arrow keys, Enter on Confirm (live F8).
Unrolled Occurrence (0 slots) with a change DONE, as a decision. It now saves with 0 slots, which the API accepts. Before, it was refused with "Select 1–5". Unchanged and standalone Events keep the 1–5 rule.
Rule / end / slot template of an existing Series DECLINED here, as the card says (create-only per ADR 0002 and #231). There is no UI for it yet. A follow-up would need a Repeat section in Edit, prefilled from GET api/series/{id}, that sends scope=all/following with the new rule. It would also need to show the API's split limits (a split Series' end can only stay or move earlier; a following Series' start cannot move before splitFrom) and to warn that an all edit deletes the future Occurrences whose keys the new rule no longer makes.
Docs OUTSIDE: the docs card. It should add: the three edit-scope names and texts (GLOSSARY); that a series scope carries only the name, the time of day and Unique games only (ADR 0002); that the Web reads GET api/series/{id} and sends its ETag as If-Match, plus the Web's other-day refusal (docs/api-validation.md).
ServiceRouteContractTests (not in the card's list) DONE, required. Its existing completeness test fails without a row for each new public method. I added 2 rows and no new tests.

Observations for Nerd (not fixed)

  1. The E2E suite is order-dependent. After the F1-F8 seed data, 3 flows (DeleteEvent_ConfirmationNamesIt_CancelKeepsIt_ConfirmRemovesIt, RapidSecondClick_OnConfirmedEventDelete_SendsOneRequest, SelectWinner_OnEventWithTwoSelections_SavesAndShowsTheWinner) cannot find their own row. The same 3 fail on plain origin/dev 916eba8 run the same way. On a fresh stack the suite passes 17/17.
  2. API or Shared defects found: none.

@mwg-bender

mwg-bender Bot commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

Review-only follow-ups filed in the 0.6.0 milestone:

These follow-ups do not expand this PR. Its title and body remain unchanged.

A series-scope edit of an Occurrence read the Series (GET api/series/{id})
only when Confirm was pressed, so If-Match covered only the gap between that
read and the PUT. Two admins with Edit open at once who both chose a series
scope each read the newest ETag, and the later save silently overwrote the
earlier one (#204 story 22).

The edit dialog now starts the Series read when it opens on an Occurrence,
before the admin can change anything, and a series scope sends that snapshot
back under that ETag. A Series saved by someone else after the dialog opened
is the API's 409: the dialog stays open with the API's words and no Event PUT
follows. A failed read is not retried at Confirm (that read would take a
newer version); the message says to open the dialog again. This event only
and an unchanged save never wait for the read, so a failed read leaves them
as they were.

A series PUT is never sent without If-Match: a read with no ETag header is
refused in the dialog with its own message, and SeriesService.UpdateAsync
now requires a non-empty ETag (UpdateWithNoETagSendsNoIfMatch, which blessed
the unsafe write, is replaced by UpdateWithNoETag_SendsNothing).

Tests: the stale writer after Edit-open (both series scopes, exact request
list, If-Match is the ETag read at open), a read without an ETag, a failed
read that still saves This event only and an unchanged edit; This and
following starting on the key's day at the Series' UTC-04:00 when its UTC day
is the next one; This and following for an unrolled Occurrence; the exact
Sent() list after a refused Series PUT; and a non-empty shared radio name.

Refs #100, #204
@github-actions

Copy link
Copy Markdown

Summary

Tests 📝 Passed ✅ Failed ❌ Skipped ⏭️ Other ❓ Flaky 🍂 Duration ⏱️
2044 2040 0 0 4 0 52.7s

🎉 No failed tests in this run.

Github Test Reporter by CTRF 💚

@mwg-bender
mwg-bender Bot merged commit 5f33117 into dev Nov 25, 2026
7 checks passed
mwg-bender Bot added a commit that referenced this pull request Nov 26, 2026
…254)

## Summary

Brings the glossary, the README, the API validation doc and ADRs 0001 and 0002 in line with what `dev` does after 0.6.0. Documents only: no code, tests, workflows or `.github/` files change.

## Change

- **`GLOSSARY.md`**
  - Series, Occurrences, zero-Selection Occurrences and the slot template have shipped, so the "Planned for 0.6.0 (#204)" wording is gone.
  - Comment's _Avoid_ line no longer names `ActivityNoteConversion` or its marker, which were removed in #247.
  - Occurrence now describes the edit scope question as it works after #250 (#237):
    - Update Event with nothing changed asks nothing and sends nothing.
    - A Modified, won or past Occurrence shows "Series changes skip played, modified and past events." and saves as This event only, with no question.
    - The first Occurrence of a Series is offered This event only and All future events. Later Occurrences are also offered This and following events.
  - The wording from #236 and #240 that is still true is kept.
- **`README.md`**: the Azurite section names the one remaining Azurite class, `StorageQueryAzuriteTests` (2 tests). It no longer mentions `EM_API_URL`, the conversion test, or the warning that the conversion rewrites the whole store. It also says that the tests skip when the connection string would reach a non-loopback host.
- **`docs/api-validation.md`**: the conversion paragraph now says the conversion was removed in #247 and what stays in storage (the marker row, and the old `Comments` column on rows the API has not rewritten). The Comment-response sentence names that marker the same way.
- **ADR 0001**: a dated amendment records that the conversion was removed. The original decision text stays as written.
- **ADR 0002**: Cancel the Series deletes the Series row and keeps past Occurrences as well as played ones, as the `DELETE /api/series/{id}?scope=all` route does.

## Validation

Base `origin/dev` `9890a1dca978795988f44692d261188ae552732d`. It had not moved when I pushed. Both runs below are cold (`clean-build.sh`, then `build --no-incremental`, then `test --no-build`) and were run by the worker.

| | errors | warnings | Api.Tests | Web.Tests | E2E (no stack) |
|---|---|---|---|---|---|
| base `9890a1d` | 0 | 0 | 901 passed + 2 skipped (903) | 1245 | 5 passed + 13 skipped (18) |
| head `b5bcb79` | 0 | 0 | 901 passed + 2 skipped (903) | 1245 | 5 passed + 13 skipped (18) |

- Each relative link and each backticked test-class name in `README.md`, `GLOSSARY.md`, `AGENTS.md` and `docs/**` was checked against the tree by a script. Every link resolves. The only class names that do not exist are three uses of `CommentApiTests` and one of `RetiredCommentsFieldTests` in `docs/api-validation.md`. Those lines predate this PR and are listed under Observations.
- Every behaviour sentence this PR adds or changes has a `DOC-CHECK` line in the PR comment, citing the file and line that proves it.
- No live flow was run, because the card asks for none for a documents-only change. **UI flows: NOT RUN by the worker.**
- File sizes: `GLOSSARY.md` 196 lines, `README.md` 180, `docs/api-validation.md` 161. All are under 400.

## Notes

`Refs #100, #204, #237, #238`. The issues are left open for Nerd to close by hand.
@MWG-Logan
MWG-Logan deleted the feat/204-edit-scope branch November 27, 2026 17:39
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.

0 participants