Skip to content

fix(web): close the shared Library page review follow-ups - #262

Merged
mwg-bender[bot] merged 1 commit into
devfrom
fix/060-196-library-followups
Nov 26, 2026
Merged

mwg-bender[bot] merged 1 commit into
devfrom
fix/060-196-library-followups

Conversation

@mwg-bender

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

Copy link
Copy Markdown
Contributor

This was generated by AI (Nerd Bender's Kanban worker, card t_9dc12a0f).

Summary

The last open item of #196, the follow-ups from the review of the shared Library page (#192). The audit against origin/dev 13e2b31 found 13 of the 15 items already closed on dev, almost all by #210. #196.14 and #196.15 are history, not code. The one item still open in code was the rest of #196.7: DialogSafetyTests still called the Library page's private CloseForm by reflection. This PR replaces that call with an internal seam. The per-item dispositions are in the table below and are repeated as a PR comment.

Change

  • LibraryPage.razor: CloseForm is internal instead of private. A one-line comment says why: no page event can close the dialog while a save runs, and the test needs to do exactly that. The method body is unchanged.
  • MW-GC.EventManager.Web.csproj: <InternalsVisibleTo Include="MW-GC.EventManager.Web.Tests" />. Design call (the smallest seam): the Web project had no InternalsVisibleTo before. The API project already grants the same access to both test projects (MW-GC.EventManager.API/Properties/AssemblyInfo.cs). A public method would have widened the component's API instead.
  • DialogSafetyTests.SaveFinishingAfterCancelAndReopen_DoesNotCloseOrResetTheNewerDialog: the test closes the dialog through EventCallback.Factory.Create(library, library.CloseForm).InvokeAsync() on the renderer. The renderer then re-renders the page as it does after a real event, so the reflected StateHasChanged call is gone too. Every assertion is unchanged. The _edit and CancelForm reflection that refactor(web): follow-ups from the review of the shared Library page follow-ups (#192) #196.7 also named was already gone on dev: the test reads the newer dialog through the page, and CancelButton_IsIgnoredWhileSaveInFlight uses the Cancel button's own handler.
  • The CloseThrough helper stays for EventEditDialog.CloseCustomize, which is outside refactor(web): follow-ups from the review of the shared Library page follow-ups (#192) #196 (see Observations). Its comment now names only that use.

DISPOSITION (#196, items 1 to 15)

item disposition evidence
#196.1 ALREADY DONE #210. GameService.cs is deleted. Events.razor:5, Stats.razor:5 and ActivityPerformancePanel.razor:9 inject LibraryClient<GameEntity>. Only one GET api/games row is left (ServiceRouteContractTests.cs:71). GameReadersTests covers each reader.
#196.2 ALREADY DONE #210. LibraryFieldMessage.razor.js:11 sets ariaDescribedByElements on the inner input. The accessibility tree was checked in a browser in #210's evidence. The Game picker is covered by ActivitiesPageTests.cs:167. This PR did not re-run that browser check.
#196.3 ALREADY DONE #210. LibraryField.cs:33 reads read(item) ?? string.Empty. Test: LibraryPageTests.Search_AnItemWithNoName_CountsAsEmpty (:77).
#196.4 ALREADY DONE #210. Program.cs:12 calls only AddAppServices. Test: LibraryClientTests.AppServices_RegisterTheFourLibraryClients (:68). #210 mutation M3 removed AddLibraryClients, and the test went red.
#196.5 ALREADY DONE #210. LibraryPageTests.cs:99-103 renders Activities with a row and checks that the row shows.
#196.6 ALREADY DONE #210. ActivitiesPageTests.cs:156-165 asserts the form's own "Game is required." and compares refusals with the API's, not its text.
#196.7 DONE This PR, CloseForm: an internal seam, called on the renderer. _edit and CancelForm were already off reflection (#210, #211).
#196.8 ALREADY DONE #210. The test is renamed ViewToggle_IsOfferedOnlyToAPageWithACardTemplateOrIcon. No GetRawConstantValue is left. LibraryServices.cs is the one shared, disposed provider. Message-id uniqueness is documented on LibraryField.MessageId (LibraryField.cs:16-21).
#196.9 ALREADY DONE #210. ThemesHolidaysPageTests.cs:128-130 puts the title and icon type in the DataRow, uses plain using lines, and has no fully-qualified names.
#196.10 ALREADY DONE #210. LibraryPageTests.cs is 227 lines, split into LibraryEditorTests (288), GamesWebsiteTests (171), LibraryClientTests (118) and LibraryPageFixture (150). LibraryPage.razor is 380 lines after this PR (379 before).
#196.11 ALREADY DONE #210. LibraryItemButton.razor holds the one Edit/Delete markup. Activities.razor:272 has DetailsKey.
#196.12 ALREADY DONE #210. LibraryName<T> and the typed LibraryField key are in place.
#196.13 ALREADY DONE #210 and later. RowAction exposes only AnyBusy; the Running alias is gone and EventList.razor:68 uses AnyBusy. LibraryPage.razor:300-309 unsubscribes on close and in Dispose. Test: LibraryEditorTests.Editor_AClosedEditorsForm_NoLongerRendersThePage. AddLibraryClients lives in LibraryClients.cs.
#196.14 DECLINED History (the commit type of #192), not code.
#196.15 DECLINED History (a reason given in the #192 PR text), not code.

Validation

All numbers come from a cold build (clean-build.sh, then build --no-incremental, then test --no-build), run by the worker.

errors warnings Api.Tests Web.Tests E2E (no stack)
base 13e2b31 0 0 901 + 2 skipped (903) 1245 5 + 13 skipped (18)
head f1b262a 0 0 901 + 2 skipped (903) 1245 5 + 13 skipped (18)

Count preservation: no test was added, removed, renamed or split, so 1245 before and after. One existing test changes how it closes the dialog; none of its assertions change.

Break-it mutations on SaveFinishingAfterCancelAndReopen_DoesNotCloseOrResetTheNewerDialog, each applied to LibraryPage.razor and then restored (the restore was checked byte for byte):

  • M1: the save ignores its dialog token (var current = true;). The test goes red at page.DialogTitle(): the late save closed the newer dialog.
  • M2: the internal CloseForm does nothing. The test goes red at Assert.IsFalse(page.HasFormDialog()).

Live run by the worker, through with-slot.sh on slot 0 (Azurite + API + Release web build behind SWA, headless Chromium, admin cookie). The script seeds two Games, one Activity and one Event through the API.

flow branch f1b262a control origin/dev 13e2b31
P1 Games page loads, both Games listed (1 GET api/games) PASS PASS
P2 Games Edit dialog: Cancel closes it, then a rename saves and closes (stored name read back from the API) PASS PASS
P3 Activities page loads, the Activity shows its Game PASS PASS
P4 Game picker: Add Activity, pick the second Game, save; the API stores the picked Game PASS PASS
P5 Events page loads, the Event's details list its Game and Activity PASS PASS
P6 Stats page loads and names the Game, with no load error PASS PASS

There were no console errors on either side, and api_flows.py passed 10 of 10 on both. The first branch run reported P2 as FAIL: the script's open-dialog check used Playwright's visible=true on the fluent-dialog host, whose box lives in its shadow root. That was a bug in the script, not in the app (the same run saved the rename and stored it). The check was fixed to test whether the element is present, and the run above is the re-run. The repo E2E suite was not run against a live slot here, because no E2E file changed. The #196.2 accessibility-tree check was not re-run.

Notes

Observations for Nerd

  • EventEditDialog.CloseCustomize is still called by reflection in DialogSafetyTests.cs:230 and EventsPageWiringTests.cs:227, and EventDetailsDialog.CloseDetails in EventsPageWiringTests.cs:245. These are the same pattern on the Events side, outside refactor(web): follow-ups from the review of the shared Library page follow-ups (#192) #196. Now that the Web project grants InternalsVisibleTo, the same one-line seam would retire CloseThrough and its System.Reflection import in both files.
  • UnrenderedEventsPage.cs, FeedbackPageTests.cs and EventMetricsFormTests.cs also use reflection. Those are other issues; I did not check them against the new seam.

#196.7: DialogSafetyTests no longer reaches the shared Library page's private
CloseForm by reflection. CloseForm is internal, the Web project grants
InternalsVisibleTo the Web test project, and the late-save test closes the
dialog through EventCallback.Factory.Create on the page, so the renderer
re-renders as it does after a real event (no reflected StateHasChanged).
The reflection on _edit and CancelForm was already gone (#210); this was
the last of it on the Library page. What the test asserts is unchanged.

The other #196 items were already closed on dev, mostly by #210; the PR
records a disposition and evidence for each.

Refs #196
@mwg-bender

mwg-bender Bot commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

This was generated by AI (Nerd Bender's Kanban worker, card t_9dc12a0f).

DISPOSITION (#196, items 1 to 15)

item disposition evidence
#196.1 ALREADY DONE #210. GameService.cs is deleted. Events.razor:5, Stats.razor:5 and ActivityPerformancePanel.razor:9 inject LibraryClient<GameEntity>. Only one GET api/games row is left (ServiceRouteContractTests.cs:71). GameReadersTests covers each reader.
#196.2 ALREADY DONE #210. LibraryFieldMessage.razor.js:11 sets ariaDescribedByElements on the inner input. The accessibility tree was checked in a browser in #210's evidence. The Game picker is covered by ActivitiesPageTests.cs:167. This PR did not re-run that browser check.
#196.3 ALREADY DONE #210. LibraryField.cs:33 reads read(item) ?? string.Empty. Test: LibraryPageTests.Search_AnItemWithNoName_CountsAsEmpty (:77).
#196.4 ALREADY DONE #210. Program.cs:12 calls only AddAppServices. Test: LibraryClientTests.AppServices_RegisterTheFourLibraryClients (:68). #210 mutation M3 removed AddLibraryClients, and the test went red.
#196.5 ALREADY DONE #210. LibraryPageTests.cs:99-103 renders Activities with a row and checks that the row shows.
#196.6 ALREADY DONE #210. ActivitiesPageTests.cs:156-165 asserts the form's own "Game is required." and compares refusals with the API's, not its text.
#196.7 DONE This PR, CloseForm: an internal seam, called on the renderer. _edit and CancelForm were already off reflection (#210, #211).
#196.8 ALREADY DONE #210. The test is renamed ViewToggle_IsOfferedOnlyToAPageWithACardTemplateOrIcon. No GetRawConstantValue is left. LibraryServices.cs is the one shared, disposed provider. Message-id uniqueness is documented on LibraryField.MessageId (LibraryField.cs:16-21).
#196.9 ALREADY DONE #210. ThemesHolidaysPageTests.cs:128-130 puts the title and icon type in the DataRow, uses plain using lines, and has no fully-qualified names.
#196.10 ALREADY DONE #210. LibraryPageTests.cs is 227 lines, split into LibraryEditorTests (288), GamesWebsiteTests (171), LibraryClientTests (118) and LibraryPageFixture (150). LibraryPage.razor is 380 lines after this PR (379 before).
#196.11 ALREADY DONE #210. LibraryItemButton.razor holds the one Edit/Delete markup. Activities.razor:272 has DetailsKey.
#196.12 ALREADY DONE #210. LibraryName<T> and the typed LibraryField key are in place.
#196.13 ALREADY DONE #210 and later. RowAction exposes only AnyBusy; the Running alias is gone and EventList.razor:68 uses AnyBusy. LibraryPage.razor:300-309 unsubscribes on close and in Dispose. Test: LibraryEditorTests.Editor_AClosedEditorsForm_NoLongerRendersThePage. AddLibraryClients lives in LibraryClients.cs.
#196.14 DECLINED History (the commit type of #192), not code.
#196.15 DECLINED History (a reason given in the #192 PR text), not code.

Counts (cold, worker): base and head both 0 errors, 0 warnings; Api 901 + 2 skipped; Web 1245; E2E 5 + 13 skipped. Mutations M1 (dialog token ignored) and M2 (CloseForm no-op): both red, restored. Live flows P1-P6: 6/6 on branch and on control.

Observations for Nerd

  • EventEditDialog.CloseCustomize is still called by reflection in DialogSafetyTests.cs:230 and EventsPageWiringTests.cs:227, and EventDetailsDialog.CloseDetails in EventsPageWiringTests.cs:245. These are the same pattern on the Events side, outside refactor(web): follow-ups from the review of the shared Library page follow-ups (#192) #196. Now that the Web project grants InternalsVisibleTo, the same one-line seam would retire CloseThrough and its System.Reflection import in both files.
  • UnrenderedEventsPage.cs, FeedbackPageTests.cs and EventMetricsFormTests.cs also use reflection. Those are other issues; I did not check them against the new seam.

@github-actions

Copy link
Copy Markdown

Summary

Tests 📝 Passed ✅ Failed ❌ Skipped ⏭️ Other ❓ Flaky 🍂 Duration ⏱️
2148 2146 0 0 2 0 53.8s

🎉 No failed tests in this run.

Github Test Reporter by CTRF 💚

@mwg-bender

mwg-bender Bot commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

Nerd review of f1b262a

DISPOSITION: matches card w25. The audit found 12 of 15 items already done by #210/#211 (evidence per item in the worker comment; I spot-checked #196.1, #196.3, #196.4 and #196.10 against dev); #196.7 DONE here; #196.14 and #196.15 DECLINED (history, not code).

Diff: 3 files, 13 insertions, 7 deletions. LibraryPage.CloseForm becomes internal, the Web project grants InternalsVisibleTo to the Web.Tests project, and the one reflective call in DialogSafetyTests becomes a direct call through an EventCallback on the renderer. No behaviour change in the page.

Cold build (own worktree at f1b262a): 0 errors, 0 warnings; Api 901 passed + 2 skipped (903), Web 1245 passed, E2E 5 passed + 13 skipped (18). Counts unchanged from dev 13e2b31.

Mutation (own re-run): making CloseForm a no-op turned 2 tests red (SaveFinishingAfterCancelAndReopen_DoesNotCloseOrResetTheNewerDialog, CancelButton_IsIgnoredWhileSaveInFlight); file restored, head 15/15 green.

Live run: skipped by me. The page behaviour is unchanged (visibility modifier only) and the worker's flows P1-P6 passed 6/6 on branch and control.

Follow-up: the same reflection pattern remains on the Events side (CloseCustomize, CloseDetails); I will file it as a small separate issue rather than widen this PR. No blockers; merging once CI is green.

@mwg-bender
mwg-bender Bot merged commit c098abe into dev Nov 26, 2026
7 checks passed
mwg-bender Bot added a commit that referenced this pull request Nov 26, 2026
…ard and DST behaviour (#264)

> *AI-generated by Nerd Bender (kanban t_4005af78); maintainer review required.*

## Summary

This PR adds tests for the review follow-ups in #233 on the recurring Event create UI, plus one sentence in ADR 0002 and one in the glossary. It changes no production code. Every item was audited against `origin/dev` at `c098abe` first. None of items 1 to 3 was already covered: no test pinned the anchor rule on both sides, and no browser check or DST test existed for this section.

## Change

- **#233.1, the first-Occurrence rule** (`Api.Tests/Series/FirstOccurrenceTests.cs`, 7 tests). A Series' start is its anchor, not always an Occurrence. Weekly, every-other-week and same-date rules make the anchor itself. An nth-weekday rule whose date the anchor is not never makes the anchor, and starts at the next rule date (the same month, or the next one when that month's date has passed). The same goes for a holiday rule on a date that is not that holiday. The generator is unchanged.
- **ADR 0002 and GLOSSARY.md**: "the instant of its first Occurrence" now says the start is an anchor, and the first Occurrence is the first rule date at or after it. That one sentence in each file is the only doc edit.
- **#233.2, keyboard** (`E2ETests/RepeatKeyboardFlows.cs`, 1 browser flow). Tab from Event Time reaches the Repeat switch. Space turns it on, and Tab then goes Repeats, then Ends on (optional). Two ArrowDown presses on the closed Repeats select move Weekly to Every other week to Monthly on the nth weekday, and Tab then goes Repeats, Week of the month, Weekday, Ends on (optional). Enter, End and Enter pick Yearly on a holiday, and Tab then goes Repeats, Holiday preset, Ends on (optional). Space turns the switch off and the rule select goes.
- **#233.3, DST** (`Web.Tests/RepeatSectionDstTests.cs`, 2 bUnit tests). These save a weekly Series from the create dialog with the browser zone pinned to America/Chicago:
  - Spring: start 4 March 2027 at -06:00, end date 18 March, which is summer time.
  - Autumn: start 22 October 2026 at -05:00, end date 5 November, which is winter time.

  Both check the end sent on the wire (the end date at the start's time and the start's own offset). They also run the sent schedule through `OccurrenceGenerator`, so the Occurrence on the end date is still made.

## Validation

All builds below are cold (`clean-build.sh`) at `origin/dev` `c098abe` (the merge of #262). The base did not move before the push.

| | Errors | Warnings | Api.Tests | Web.Tests | E2E without a stack |
|---|---|---|---|---|---|
| Baseline | 0 | 0 | 901 passed + 2 skipped = 903 | 1245 | 5 passed + 13 skipped = 18 |
| After | 0 | 0 | 908 passed + 2 skipped = 910 (+7) | 1247 (+2) | 5 passed + 14 skipped = 19 (+1) |

No test was removed, renamed or changed. The additions are:
- Api: `Weekly_and_every_other_week_make_the_picked_instant_itself` ×2, `A_same_date_rule_makes_the_picked_instant_itself` ×2, `An_nth_weekday_already_past_in_the_picked_month_starts_the_next_month`, `An_nth_weekday_off_the_picked_date_never_makes_the_picked_instant`, `A_holiday_rule_off_the_picked_date_starts_at_the_next_holiday`.
- Web: `AnEndDateAfterTheSpringChange_…`, `AnEndDateAfterTheAutumnChange_…`.
- E2E: `Tab_ReachesTheRepeatSwitch_ThenEachRuleSelectAndTheEndDate_AndTheKeyboardWorksThem`.

**Mutations.** Each was a throwaway change, restored before the commit.

| Mutation | Result |
|---|---|
| M1a: the generator also yields the anchor for monthly, yearly and holiday rules | 3 red: the nth-weekday-past, nth-weekday-off and holiday tests (for example, got `[2026-12-10…, 2027-01-01…]`) |
| M1b: the generator skips the anchor | 4 red: weekly, every other week, monthly same date, yearly same date. Both DST tests also went red. |
| M3: `RepeatChoice.EndFor` reads the end date at the viewer's offset | both DST tests red (the end string is not at the start's offset), plus the existing `TheSchedule_KeepsTheStartsOffset_AndPutsTheEndAtItsTimeAndOffset` |
| M2a: `tabindex="-1"` on the Weekday FluentSelect | **stayed green**. A browser probe showed the web component renders `tabindex=0` anyway, and Tab from Week of the month still lands on Weekday. This mutation does not remove the control from the tab order (see Observations). |
| M2b: `Disabled="true"` on the Weekday FluentSelect | **red**: Tab from Week of the month skipped to Ends on (optional). `ToBeFocusedAsync` on Weekday timed out with "unexpected value inactive" at `RepeatKeyboardFlows.cs:53`. |

**Browser runs (by the worker, on a with-slot stack, headless Chromium).**
- Branch, before commit: the full E2E suite with `EM_E2E_REQUIRED=1` passed 19 of 19, the new flow included (6 s).
- Committed head `4559062`, on a fresh slot with a clean worktree: the full E2E suite with `EM_E2E_REQUIRED=1` passed 19 of 19, `Tab_ReachesTheRepeatSwitch_…` included (7 s).
- Control: the new flow does not exist on plain `origin/dev`, so a control run would only show the other 18. The same suite gave 18 of 18 there in Nerd's baseline. The tab-order probe (`probe233.mjs`) ran against this branch, whose Web project is identical to `dev`. It printed this focus order: Event Name, Event Date, Event Time (4 stops: the input's own fields), Repeat. With the switch on, after Repeat: Repeats, Ends on (optional), Themed Activities Only. With Monthly on the nth weekday: Repeats, Week of the month, Weekday, Ends on (optional). With Yearly on a holiday: Repeats, Holiday preset, Ends on (optional).
- The DST checks are bUnit only, not run in a browser. The date picker's popup does not open in headless Chromium, and #233.3 needs no browser.

## Notes

`Refs #233`; nothing is closed automatically. Nerd closes the issue by hand once every item has a disposition (see the comment).
@mwg-bender

mwg-bender Bot commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

The Events-side reflection follow-up from this review is tracked separately in #263. PR #262 remains limited to the Library-page #196.7 seam.

@MWG-Logan
MWG-Logan deleted the fix/060-196-library-followups 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