Repository navigation
refactor(web): close the follow-ups of #196 and remove GameService - #210
Merged
Merged
Conversation
The Events page, the Stats page and the Activity details performance panel read the Games through LibraryClient<GameEntity>, so GameService, its registration and its duplicate GET api/games route row are gone. Each reader still sends exactly one GET api/games (GameReadersTests). A Fluent text field copies aria-describedby into its shadow root, where the message id cannot be found, so a screen reader got no description for a field with an error. LibraryFieldMessage now links the field's inner input to its message holder by element (ariaDescribedByElements) through a collocated module; in Chromium the Library forms' fields are described by their messages and the link follows the message as it comes and goes. The Game picker is the combobox itself and its own link already resolves. Also: a null name reads as empty again (no throw when searched); one LibraryField key for a field's rule, message and attributes; one LibraryName for the Name and SetName pair; one LibraryItemButton for the Edit and Delete of rows, icon cards and the Games card; RowAction says AnyBusy (Running stays only for the Events list, owned elsewhere); the page stops watching a closed editor's form; AddLibraryClients has its own file and Program.cs registers everything through AddAppServices, which a test builds. LibraryPageTests is split into LibraryPageTests, LibraryEditorTests, GamesWebsiteTests and LibraryClientTests over one fixture. Refs #196, #205
Summary
🎉 No failed tests in this run. Github Test Reporter by CTRF 💚 |
This was referenced Nov 24, 2026
Merged
mwg-bender Bot
added a commit
that referenced
this pull request
Nov 26, 2026
> *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 #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 #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 - `Refs #196`, not `Closes`. Every item above has a disposition, so Nerd can close #196 by hand. - Not merged. ## 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 #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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes the follow-ups of #196 (shared Library page and its pages) under spec #205, and removes
GameService. The Events page, the Stats page and the Activity details performance panel now read the Games throughLibraryClient<GameEntity>. Library form errors now reach the inner input of a Fluent text field in a real browser. The rest is the review's test and design leftovers. One commit,refactor(web),Refs #196, #205.Change
Events.razor,Stats.razorandActivityPerformancePanel.razorinjectLibraryClient<GameEntity>and call itsGetAllAsync, which throws on failure the same way, so each page keeps its error bar and Retry.GameService.cs, its registration and itsPageHarnessentry are gone, as are the duplicateGET api/gamesroute row and thetypeof(GameService)entry.ApiResultTestskeeps its point (a real service load against a failing server yields the server's message) withEventService. NewGameReadersTests: Events, Stats and the panel each send exactly oneGET api/games.aria-describedbyinto its shadow root, where the message id does not resolve.LibraryFieldMessagenow loads a collocated module (LibraryFieldMessage.razor.js) that setsinput.ariaDescribedByElements = [message holder]on the field's inner input. That is ARIA element reflection, which crosses the shadow boundary. Chromium then gives the field its message as its description, and the description follows the message as it comes and goes. The Game picker (fluent-select) is the combobox itself, so its ownaria-describedbyalready resolves; the module leaves it alone. bUnit checks: the link call per field names the holder that the field'saria-describedbynames, and the Game picker'saria-invalidandaria-describedby. Browser evidence is below. The Events card solves the metrics form separately.LibraryName<T>.Ofreads a null name as empty, so a search never throws on it.Program.csregisters everything throughAppServices.AddAppServices(apiBase). A test builds that and resolves the four Library clients and the app'sHttpClient.LibraryItemButtonfor the Edit and Delete of table rows, the icon card and the Games card (Labelled).Activities.razorgets oneDetailsKey(id)for thedetails-{id}focus key.LibraryName<T>replaces theName+SetNamepair.LibraryFieldis the one typed key forLibraryFieldError.Field,LibraryFieldMessage Field=andFieldAttributes(...), and it ownsMessageId.RowActionsaysAnyBusy.Runningstays only as an alias forShared/Events/EventList.razor, which this card may not edit.AddLibraryClientsmoves toLibraryClients.cs.LibraryPageimplementsIDisposableand unsubscribesOnValidationStateChangedwhen the editor closes or the page goes.LibraryPageTests(823 lines) is split over one abstractLibraryPageFixtureintoLibraryPageTests(list),LibraryEditorTests,GamesWebsiteTestsandLibraryClientTests. Every base test exists exactly once.GetRawConstantValueis replaced by directAreEqualon the constants.LibraryClientTestsandServiceRouteContractTestsshare one disposed provider setup (LibraryServices).ActivitiesPageTestsasserts the editor's own "Game is required." and no longer hard-codes the API text.ThemesHolidaysPageTestsusesusings and puts the title and icon type in theDataRow.LibraryPage.razoris 384 → 379 lines.Validation
Base
origin/devmoved during the run, from 2730911 to 617f4a4 (#207 docs, #208 Series, no file in this card's scope). The branch was rebased before push and everything below was re-run on the rebased head.Count preservation: no test removed. One renamed (
CardView_IsOfferedOnlyToAPageThatGivesACardTemplate→ViewToggle_IsOfferedOnlyToAPageWithACardTemplateOrIcon). Eight added:GameReadersTests.EventsPage_SendsOneGamesReadGameReadersTests.StatsPage_SendsOneGamesReadGameReadersTests.ActivityDetails_PerformancePanel_SendsOneGamesReadLibraryPageTests.Search_AnItemWithNoName_CountsAsEmptyLibraryClientTests.AppServices_RegisterTheFourLibraryClientsLibraryEditorTests.Editor_AClosedEditorsForm_NoLongerRendersThePageLibraryEditorTests.FieldMessage_LinksItsMessagesToTheFieldsInputActivitiesPageTests.GamePicker_SaysItIsInvalid_AndNamesItsMessageA name diff of base against head shows no other change.
Break-it mutations, each applied to a throwaway copy of the production line and restored. All 10 went red:
AddLibraryClientsremoved fromAppServicesFieldAttributesLive runs by the worker, through
with-slot.sh(Azurite + API + Release web build behind SWA, headless Chromium 153, admin cookie), on the branch and on plainorigin/dev617f4a4 as a control:origin/dev617f4a4GET api/games, the Event's Game showsGET api/games, Game named, not Deleted"")""; the Game combobox already PASSES on dev)"")"")""throughout; nothing stored on either)G1 is the same on both sides, so the Game reads did not change. G2 and G3 fail on
devand pass on the branch, which is the #196.2 fix. Accessibility-tree output from the branch, verbatim (Chromium CDPAccessibility.getFullAXTree):The same on
origin/dev:{"role":"textbox","name":"Game Name","description":"","invalid":"true"}and the same empty description for every text field. Before the fix, a probe on the base compared the techniques: a host idref gave"";input.ariaDescribedByElementsgave the message and followed it live;aria-descriptionon the input gave the text but would need re-syncing; on the host it gave"";ariaErrorMessageElementsgave only an errormessage relation, no description. The element link was chosen.Notes
RowAction.Runningis kept as a one-line alias becauseEventList.razor(Events card) still reads it. That card or wave 2 can switch it toAnyBusyand delete the alias.DialogSafetyTests). refactor(web): follow-ups from the review of the shared Library page follow-ups (#192) #196.14 and refactor(web): follow-ups from the review of the shared Library page follow-ups (#192) #196.15 were declined in the card.Refs, notCloses: Nerd closes refactor(web): follow-ups from the review of the shared Library page follow-ups (#192) #196 by hand once every item has a disposition.