Repository navigation
Add the admin's administration area and plugin halves (A6) - #3632
Merged
Merged
Conversation
… the instance and the stubs of five halves (#3438) Closes #3429 A6 adds the pages of administration and five plugin halves, and the admin had no place for them: the first download had 34 KB left of its budget, `IAdminAccess.Allows` could not gate an instance-only page, the sidebar had no core entry, and five issues would each have created a project. This adds `FluentCMS.Admin.Administration`, a part of the shell that the app loads lazily on the first visit of one of its routes; the areas of administration declared once in the shell, each with its sidebar entry and the gate of its route, for the instance where the area is instance-only; `IAdminAccess.AllowsForInstance` and `InstanceOnly` on a half's page; the read of the roles with a role select and the frame of a list of records, which several pages share; and the stubs of the webhooks, MCP, AI assist, multi-site and search halves. Each page shows its heading until its issue writes it. The specification gains A-51 and A-52 in 10.7, the decisions of #3431 in section 11 (AQ19 to AQ27), and what was built in 2.6, 2.8, 3, 3.2, 3.3, 4.1, 4.15 and 7. ## Dependencies None: no new NuGet package, npm package or GitHub Action, and no change of the data model. The public additions are in `PublicAPI.Unshipped.txt` of `FluentCMS.Admin.Abstractions`: `IAdminAccess.AllowsForInstance`, `AdminPageAttribute.InstanceOnly`, and `InstanceOnly` of `AdminManifestPage` and `AdminManifestMenuItem`. ## Acceptance - [x] The first download does not hold the administration assembly; the network shows it fetched on the first visit of one of its routes, and once - [x] The first download stays within 3,600,000 B, and the specification records the measurement before and after - [x] A caller who holds `users.manage` through a site role only sees no Users entry, and the route answers the no-access state; a Super Admin sees both - [x] A core route the caller may not open answers the no-access state, typed or reloaded - [x] Each of the five halves builds, is lazy and passes its manifest test, and none is fetched in a run that opens none of its contributions - [x] Component tests cover the gate and the menu; an end-to-end case covers the lazy fetch; `ShellTests` of the API tests reads the real entries in place of its own list - [ ] The item of `IAdminAccess` in #3178 is ticked for instance-only pages The last row is left for the merge: the item of #3178 also names grants limited to a resource and access per content type, which this does not change, so it is ticked there for instance-only pages only once this is merged, with the administration part of #3354. ## First download Measured as `eng/check-admin-size.cs` does, on one machine, from a trimmed publish of `feature/a6` at b8c246d and one of this branch: | | First download | Under the budget of 3,600,000 B | | --- | --- | --- | | Before | 3,565,361 B | 34,639 B | | After | 3,570,334 B | 29,666 B | The 4,973 B are 2.9 KB of the shell (the areas with their entries and labels, the gate, the breadcrumbs and `PageCrumb`), 1.4 KB of the manifests of the five halves, 0.3 KB of the boot configuration, 0.3 KB of the scoped styles of the record list and 0.1 KB of the contract. The administration assembly is 24,146 B and each stub about 2.7 KB, all left out as lazy. Measured last from an empty folder after the second review. Two builds of the same code differ by up to about 150 B per assembly (`FluentCMS.Admin.Abstractions`, unchanged between the last two measurements, moved by 142 B), which is why the first review's figure was 309 B below the first one although the shell had grown. The `Pack` job measured `main` at b8c246d at 3,566,225 B, 864 B more than this machine. ## What a following issue does - **Its files.** Everything of an area stays in its folder of `admin/src/FluentCMS.Admin.Administration/`, and its tests in `admin/tests/FluentCMS.Admin.Tests/Administration/{Area}/`, on `AdministrationTestContext`. No area's issue changes `AdministrationAreas`, `AdminResources.resx`, the breadcrumbs, the solution, a project file, the architecture tests or a test file of another area. - **Its localization check.** `{Area}LocalizationTests` exists in each area's test folder. The issue adds each of its routes there with `LoadLocalized(culture, route, ready)`, after giving the fake Management API the answers its page reads (`Management.Answer` or `Management.Respond`), so that the page is checked with its data and not in its error state. The `h1` of an area's first page stays `{Area}.Page.Heading` of its resources, which the end-to-end tests know the page by (`Repository.AdministrationHeading`). - **Its filters.** A list with filters of its own, as the members' and the jobs', names their query parameters (any but `q` and `page`) in `Filters` of `RecordList`, draws their controls itself, sets one with `SetFilter(name, value)`, which returns to the first page, and reads them from the `RecordQuery` of its `Read`. - **Its breadcrumb.** A page below its area's route, as a user's, places `<PageCrumb Text="..." />` with what it read, and the breadcrumbs name it by that in place of its segment. - **A select of roles.** `RoleSelect` names a role of a site with its site, since a name is unique in one site only. ## Changed after the third review 1. A navigation the router cancelled does nothing once its locale's wait ends: no gate recorded and no fetch. A test overtakes one navigation with another and ends their reads in reverse order. 2. The comments, the spec and the test say what stays across a site switch: the header, the site switcher and the focus on it; the sidebar is drawn again. 3. Spec 2.6 says that the page before stays while the locale's access is read, with no busy state yet (#3446). ## Changed after the fourth review 1. An administration page is gated by its own page type: its area is that of the first of its route templates that is in an area, kept per type, so the gate depends on the page and the access alone. The router renders the address's page when a navigation it cancelled ends, before the address's `OnNavigateAsync` has run, so the gate on `Settled`, the route of the last navigation that ended, let a page the caller may not open render. `Settled` and the check of the address's path are gone. A page of a half keeps its gate by the manifest's pages of its class. A page of the admin's own, as the start page, is not gated by the address any more either: it has no area, and the address only made it show the no-access state for a moment during the same races. 2. While the access the shell holds is not that of its content locale, or while a site is read, the gate's decision is held: the page drawn before stays, or the no-access state when there is none. 3. Tests on the real router record the page type every frame draws, and assert that none draws a page the caller may not open: a navigation waiting for its locale's access overtaken by `users`, `members`, `jobs` or `system/diagnostics` held through a site role (a theory of four); one waiting for a half's first load overtaken by `users`; a locale whose access never answers, where the page before stays although the caller holds both areas for the instance in the locale before; and, as regression tests, two quick navigations and one cancelled during the assembly's first load. The first six fail on 6483540 with the forbidden page type in each frame during the hold; the last two pass there too. 4. The third review's description said a test held that the users page "sends nothing": the stub pages read nothing, so a count of requests proved nothing. The tests now assert on the page types drawn. ## Changed after the fifth review 1. A page of a half, and a page of the administration assembly, are gated by the route data the router hands the view, never by the address. The router leaves `RouteData.Template` unset (checked on the real router: empty for every page, `ReviewPage` at both of its routes included), so the routes the route data agrees with are read from its route values: the router gives each parameter of the page's routes a value, null for one the matched route has not (`PageRoutes`). A half's page is gated by the manifest's pages of those routes, and route data that two of them agree with requires what each requires. An administration page is gated by the one area all its routes are in. 2. While the access the shell holds is not that of the locale the address names, the page drawn before stays: a navigation that a cancelled one's end renders before its own `OnNavigateAsync` has read its locale no longer draws a page with the locale before's access. While the shell is not ready, the view records the no-access state, so after a failed read of a locale's access, Try again no longer creates the page that locale denies. 3. A page across two areas, or partly outside every area, has no area and is not shown. 4. The comment on the wait for the locale, and spec 2.6, say what holds now. New tests, each failing on 8c26953: an address that names another locale rendered by a cancelled navigation's end (users held for the instance, with fr's access answering at once or held, and roles held through a site role), where the locale-denied page was created and drawn; a half page redrawn with a review's route data while the address is `/reviews/new`, where it was drawn with the review's id; Try again after a failed read of fr's access, where the roles page was created; and the area of a page across two areas or partly outside every area. The tests of `PageRoutes` are new with it. ## Outside `admin/` and `docs/` - `src/FluentCMS.Host/Dockerfile`: one `COPY` line for `FluentCMS.Admin.Administration.csproj`, which the restore of the image build needs. The five halves need none: the line for `admin/src/plugins/*/` takes them. - `FluentCMS.slnx`: the eleven new projects. - `tests/FluentCMS.Architecture.Tests/AdminRulesTests.cs`: the administration assembly as the seventh package of `admin/src/`, the five halves in the lists of halves, and a rule that the app lists the administration assembly, the rich text editor and each half as lazy and that the shell does not reach the administration assembly. ## Changed after the review 1. A load of the assembly that outlives the navigation that started it is given to the router by the next navigation to an area's route; before, every such route stayed not found until a reload. 2. A load that fails at once is not kept as the load in progress, so the retry loads again. 3. An instance-only page without a permission is open to no one, and the manifest check names it. 4. Each area has the localization check of its own pages in its own folder, and the shared theory is gone. `RecordList` shows the server's title only for a problem with a code. 5. The end-to-end tests read the heading of an area's first page through one helper, and the specification states the convention. 6. `RoleSelect` names a role of a site with its site. 7. `RecordList` drops an overtaken read that fails late, stays loading while a page past the end gives way to the last, and takes a page's own filters from the query string. 8. `PageCrumb` lets a page name the last item of its breadcrumbs. Also: the gate of the page that is shown is asked again when the shell's context changes without a navigation, as with a content locale whose access lacks the permission; before, the page stayed. This holds for a page of a half too. ## Changed after the second review 1. A change of the gate no longer replaces the layout: the page and the no-access state are one `RouteView`, and the gate is not asked again while the shell reads a site. A site switch on an area's or a half's route keeps the layout and the site switcher, which tests hold with the new site's reads held. 2. A route of an area or a half that names another content locale waits in the router for that locale's access, so its page is not shown or read with the locale before's. 3. `RecordList` reads afresh when its page renders it at another path, as `/users/{Id}` from one id to another. 4. A list without filters says that nothing matches the search; one with filters names the filters too. 5. `Filters` refuses `q` and `page`, which are the list's own. ## Checks Run once each, on Windows: `dotnet build -c Release -warnaserror`; `FluentCMS.Admin.Tests` in full (1,702 after the fifth review), `FluentCMS.Architecture.Tests` (43) and `FluentCMS.Plugins.Media.Admin.Tests` (113) in full; the five manifest tests; `ShellTests`, `OpenApiContractTests` and `CommonContractTests` of the API tests; the two end-to-end cases, their class alone in slow mode (`FLUENTCMS_E2E_SLOW=1`); the trimmed publish with `eng/check-admin-size.cs`; `markdownlint-cli2`. By hand: the build of the app stops with the message of the new target when the lazy line of the administration assembly is taken out. Not run here: the rest of the API tests and of the end-to-end suite, the image build with the new `COPY` line, and the `Pack` and `Templates` jobs, which full CI on `feature/a6` runs. The design points settled on the way, and where the files of A-31, A-33 and A-34 go, are in a [comment on the issue](#3429 (comment)).
Brings `main` into `feature/a6` with a real merge, so that the issues of A6 that start now build on the backend changes they waited for: #3378 and #3391 (A-31), #3379 (A-34), #3397 (A-37), #3417 (A-52) and #3418 (A-38), with #3372, the preview follow-ups of #3403 (#3437), the template for PostgreSQL test databases (#3466) and the tested image digest of the release (#3471). The merge had no conflict. `dotnet build -c Release -warnaserror` passes on the merge commit. Dependencies: none beyond what `main` already has. --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Closes #3419 Fills the users area of the administration assembly: `/users` lists the users in pages with a search by name and address, each with its roles and state (active or deactivated, locked out until, two-factor on, must change the password), and holds the invitations, sent with roles, listed while pending and revoked; `/users/{id}` shows a user with deactivate and reactivate, the forced password change, the two-factor reset, its roles added and removed, its sessions ended and its external logins removed. Each refusal is named by what it means: `FCMS3103` on a change of the user, on a role and on an invitation, `FCMS3052` for the last active Super Admin, `FCMS3064` with the way to sign in again with a second factor, `FCMS3049` for a user without a password, `FCMS3090` for a last way to sign in. Everything is in `Users/` of `FluentCMS.Admin.Administration` and its own test folders; the design points are recorded on the issue. What changed from the issue's text, now that #3378 and #3391 are merged: - **The password.** The issue offered the forced change "with a note that it needs one, until #3378 settles it". #3378 (in #3444) has the server refuse `mustChangePassword: true` for a user without a password, with `FCMS3049` on `mustChangePassword`; the answer still does not say whether a user has one. So the page keeps the note and names that refusal ("the user has no password, since it signs in through a provider only"). - **A sender who no longer stands.** The issue said the pending list may hold such an invitation "until #3391". #3391 (in #3479) leaves it out of `GET /invitations`, so the page shows the list as the server answers it, with no note. The end-to-end host now runs a mail server of the run's own (`SmtpSink.cs`, and the four `FluentCms:Email:Smtp` settings in `EndToEndHost.cs`): in Production the host sends nothing without a sender, and an invitation it cannot send is revoked at once. ## Dependencies None: no new package and no new action. No change of the data model or of the backend. ## Acceptance - [x] An administrator finds a user by search, adds and removes a role, deactivates and reactivates it, ends one of its sessions, removes an external login and resets its two-factor - [x] An invitation is sent with roles, shows as pending and is revoked - [x] A caller below the target's roles sees the refusal named, and the last Super Admin cannot be deactivated or lose its role, with the reason shown - [x] A caller who holds `users.manage` through a site role only sees no entry and no page - [x] The pages are usable by keyboard alone, and no text is hard-coded - [x] Component tests cover the list, the detail and the refusals; the API tests check each record against the OpenAPI document; an end-to-end case invites a user and changes the roles of another After review: deactivate, reactivate, the two-factor reset and the removal of an external login give the user a new security stamp, which ends its sessions on the server, so the sessions card reads them again after each. A send of an invitation reads the pending list again whatever the answer, since the server ends the pending invitation to the address before the mail goes. The mail sink answers each connection on its own, within 30 s, so one that breaks off or stalls leaves the next answered (`SmtpSinkTests`). Verified locally: `dotnet build -c Release -warnaserror`; `FluentCMS.Admin.Tests` filtered to `Administration.Users` (28) and, before the review, to `AdministrationGateTests` and `AdministrationNavigationTests` (89); `FluentCMS.Admin.ApiTests` filtered to `UsersContractTests`; `UsersTests` alone in slow mode (`FLUENTCMS_E2E_SLOW=1`); `SmtpSinkTests` alone. Not run: the full suites, the other end-to-end classes with the new mail settings, and a screen reader.
Closes #3422 The admin now draws the settings of every area from the Management API: `/settings` lists the areas of `GET /settings` the caller may manage, under core or their plugin, and `/settings/{area}` and `/settings/{area}/defaults` show a form generated from the JSON schema of the read with the field editors of 4.6. The page shows the source of the area as a whole, a switch between the site's values and the instance defaults for a caller who may manage both, secrets as set, inherited or not set, save and reset over the version read with `If-Match`, and the conflict dialog of the content form on a 412. A secret is a password input that is never filled; only the secrets the user typed are sent, and they are forgotten once saved. A `[SettingsPage(area)]` of the half of the plugin that registers the area replaces the generated page while `AdminPlugins.Shows` allows it, loaded with `AdminPlugins.ComponentAsync` and checked before it renders. An area is named by the area's resources: core's `branding` and `preview`, and `media`, `ai` and `mcp` of the first-party plugins; any other by its name made readable. Every read and write of the form names the site the form first read in, as the content form's do. The design points are on the issue, and section 4.16 of the specification has them as built. ## Dependencies None: no new NuGet package, npm package or GitHub Action, and no change of the data model or of the public contract. Every file is in `Settings/` of the administration assembly and in the area's own test folders, but for one paragraph of section 4.16 of the specification. ## What the API lacks - `GET /settings` does not say which areas are read from the instance defaults only. Until it does, the admin knows `branding` and `mcp` by name, offers their defaults alone and leaves them out for a caller who may manage them in the site only. - After #3379 (#3433) the API still gives no third state for a secret the key ring cannot read: it is in neither `secretsSet` nor `secretsInherited`. Beside a secret that is not set the page says such a value shows so too, and that the startup report lists it (`settings-secrets-unreadable`). ## Acceptance - [x] An administrator changes a setting of the site, sees it marked as the site's own, resets it and sees the default again - [x] The defaults of the instance are changed by a caller who may, and the switch is absent for one who may not - [x] A secret is set, shows as set, and a save of another field leaves it as it was; an inherited secret shows as inherited - [x] A save over a change made elsewhere shows the conflict - [x] The sample half's settings page shows in place of the generated one, and not in a site where its plugin is disabled - [x] Component tests cover the menu, each kind of schema property, secrets and the conflict; the API tests check the records against the OpenAPI document; an end-to-end case changes and resets a setting The rows are covered by `SettingsPageTests` and `SettingsLocalizationTests` (component), `SettingsContractTests` (API) and `SettingsTests` (end-to-end, run in slow mode and alone). The secret tests also check that a typed secret reaches no log, no session storage and no script call, and that a request never names a secret the user did not type.
Closes #3505 The race was in the test, not in `AdminPlugins`. In both CI failures, `loader.Loads.ShouldBe(1)` on line 303 passed, and line 304 failed: `ReviewsAdminPlugin.Configured` rose by 2. That counter is static, so it counts `Configure` for every admin in the test process. Since #3438, the administration gate and navigation tests also load the sample half in admins of their own, and xUnit runs those classes alongside `AdminPluginLoadingTests`. When one of them configured the half during the test's window, the count went up by 2. The test's own admin loaded the half once. The sample half now counts `Configure` per admin, keyed by the filter registry its builder gets (one per admin's services), and the test reads its own admin's count. `AdminPlugins.LoadAsync` was read for a second load. A call either finds the half loaded, finds the load in progress in `_loads`, or starts the one load. A load that completes synchronously has set `_loaded` before it returns. The admin runs on one thread, so no other call can run between those steps. Reproduced on a loaded machine with the `Plugins` and `Administration*` namespaces together: 8 failures in 20 runs before the change, 0 in 20 after. Run alone 20 times, the test never failed. Dependencies: none. - [x] The cause is named, as a race of the code or of the test - [ ] Two first uses at once load a half once and run its `configure` once, whatever the order of the continuations (the test covers its own order; the code was read for the others, not tested) - [x] The test passes 20 runs in a row on a loaded machine
…logue (#3503) Closes #3420 Fills the `Roles/` area of the administration assembly: `/roles` lists the roles the caller manages (every role with `roles.manage` for the instance, the site's roles with it in the site), and `/roles/new` and `/roles/{id}` edit a role's name, description, site, `requireTwoFactor` and grants. A grant is picked from `GET /permissions` by its source, with the plugin behind a plugin's permission from `GET /plugins` and a mark on what the caller's `GET /me/access` does not show it holds. The server checks each grant on its own, so a field limit marks a grant of create or update only, when the type's `creatableFields` or `updatableFields` leave out a field `GET /schema` shows; without the schema (no `schema.read` in the site, or a 403) every grant of create or update is marked, since a type the caller may not read is missing from the access too and is marked already. A field limit on read, delete, publish or unpublish, and a limit of create or update to exactly the readable fields, cannot be seen by the client, since `/schema` and `/me/access` are both narrowed to the readable fields, and are not marked. A mark never stops a save; the server decides. A save replaces every grant, so each grant's `constraints` object is kept whole as read and sent back unchanged; constraints show read-only on their grant, in `GrantConstraints`, which A-52 replaces with its editor. A concurrent change (FCMS3045) reads the role again and puts the user's changes back on it; FCMS3103, FCMS3043, FCMS3044, FCMS3052 and a refused grant (FCMS3042) are shown on the role by their code. The site's Public role, and the seeded one, are edited under a notice. A site switch drops the editor while the new site loads and builds it again, so the role is read again in the new site and unsaved edits are dropped without a question; asking first, as the content form does, is left for all administration editors together. A change of the content locale keeps the page and the edits and changes the marks only. The design points settled are in a comment on the issue, and the spec's 4.15 has the area's as-built paragraph. Nothing else outside the area and its tests changes; `Common/` is used as it is. Dependencies: none. - [x] An administrator makes a role with grants of core, of a content type and of a plugin, changes it and deletes it - [x] A role with constrained grants is saved with its name changed and keeps every constraint, `resources` included - [x] A grant the caller does not hold is marked, and the server's refusal is shown on the role - [x] The Public role of the site is edited under its notice, and what it grants is read without signing in - [x] A caller who holds `roles.manage` in one site sees and changes that site's roles only - [x] Component tests cover the catalogue, the round trip of constraints and the refusals; the API tests check the records against the OpenAPI document; an end-to-end case makes a role and gives it to a user
Closes #3504 A sign-in that returned straight onto a route of an administration area completed twice. Once the callback has signed the tab in, `AdminLayout` hides its page while the shell starts and draws it again once the shell is ready. The router is still waiting in `OnNavigateAsync` for the lazy administration assembly at that point, so the page it draws again is the callback page, as a new instance at the new address (`/users`), with no code or state in the query. Its `OnInitializedAsync` called `CompleteSignInAsync` a second time. That logged `UnknownState` and showed "The sign-in did not complete" until the area page was drawn. Home and the content and media routes do not wait there, so the router had swapped the page before the layout drew it again. Now `LoginCallbackPage` completes a sign-in and shows something only at its own address. Drawn at any other address, it does nothing and renders nothing. A callback at its own address with an unknown or missing state still shows the error and "Sign in again". Dependencies: none. - [x] A sign-in straight onto `/settings`, `/users` and `/roles` logs no warning and never shows "The sign-in did not complete" (verified for `/users` and `/roles`; `/settings` is not on `feature/a6` yet) - [x] A callback with an unknown or missing state at its own address still shows the error and the way to start again - [x] An end-to-end case signs in onto an area route and asserts both; a component test covers the callback page drawn at another address
Closes #3428 Fills the members area of the administration assembly. `/members` lists the members in pages with a search by name and address and the filters group, verified and active, kept in the address, and adds a member, who is mailed a link to choose its password; `/members/{id}` shows a member with its display name changed, deactivate and reactivate, delete after a question that names it, its groups (each taken out, one put in), its sessions ended and its external logins removed; `/members/groups` lists the groups with their role and the number of their members, which links to the list filtered by the group, and makes, changes (name, description, role) and deletes a group after a question that names it. `FCMS3103` is named on a group's membership and on making, changing or deleting a group, and the page keeps what stands. Deactivate and a removed login end the member's sessions on the server, so the sessions card reads them again after each; reactivate gives a member no new security stamp and ends none. A change of a group fills its form from `GET /member-groups/{id}`, since a save replaces the group and carries no version, and a group that Change or Delete finds gone leaves the form. The display name's input keeps a name typed and not saved when another change answers, and an untouched one takes the name the server answers, so a save sends no stale name back. A delete goes back, in place of the member's entry of the history, to the list with the search and filters the member was opened from by Enter on its row; a member opened by its link with the mouse, or by a typed address, goes back to the plain list, since the link stays a plain link that Ctrl, Cmd and Shift open in a new tab or window. Everything is in `Members/` of `FluentCMS.Admin.Administration` and its own test folders; `Common/` is used as it is. The design points are recorded on the issue. `MembersTests` (one case) ran once in slow mode (`FLUENTCMS_E2E_SLOW=1`) and once alone at normal speed before the fixes of the first review, and once alone in slow mode after those of the second. ## Dependencies None: no new package and no new action. No change of the data model or of the backend. ## Acceptance - [x] An administrator finds a member by search and by group, ends one of its sessions, deactivates it and deletes it - [x] A group is made, bound to a role, given a member and loses it again - [x] A caller below the group's role sees the refusal named - [x] A caller who holds `members.manage` through a site role only sees no entry and no page - [x] The pages are usable by keyboard alone - [x] Component tests cover the list, the detail and the groups; the API tests check the records against the OpenAPI document; an end-to-end case makes a group and puts a member into it
Closes #3488 The router's not-found page and the gate's no-access state are one `NotFoundPage` instance that the `RouteView` keeps from one route to the next. It took no parameters, so Blazor did not render it again, and it kept the heading of the route it was made for: a link from `users` (no access) to an unknown route still said "No access", the other way still said "Page not found", and a half's first download overtaken by `reviews?locale=fr`, which fr denies, ended on "Page not found". `PluginRouteView` now hands the page two parameters on every answer of the router: the gate's answer from the route data when the gate put it in place of a page, which a page drawn again before its navigation ends keeps, else the address the router answered. The page also draws itself again when the shell's context changes, as when a new locale's access is read. The layout is not made again (no `@key` on the `RouteView`). `AdminPluginManifestCheck` now names two `[AdminPage]` routes of one class that route values can fit both and that need different permissions, or one for the instance and the other not. The README of the administration assembly says a page with any route outside every area is not shown. Spec 2.6 gets an as-built paragraph. Dependencies: none. - [x] After a link from a no-access route to an unknown route, and the other way, the heading says what the new route is; the layout is not made again - [x] The manifest check names a class whose two routes of the same parameters need different permissions - [x] The README says a page partly outside every area is not shown - [x] Component tests for each The component tests run on the real `Router` (`AdministrationNavigationTests`): from a no-access route to an unknown route and back, before and after the administration assembly is loaded, and a half's first download overtaken by its route in a locale that denies it. Each checks that the `AdminLayout` instance stays the same. The careless test half has a class with two such routes. Each new test fails on the unfixed code. Locally: `dotnet build -c Release -warnaserror`, and the Plugins, Shell and Administration folders of `FluentCMS.Admin.Tests` (376 passed). markdownlint was not run locally.
…st download (#3519) Closes #3354 The first download of the admin goes from 3,578,469 B to 3,561,801 B (Brotli, as `eng/check-admin-size.cs` measures it from the trimmed publish of `feature/a6` at `9d9e28f7` and of this branch; a second build of the branch measured 3,561,250 B), 16,668 B less. Two moves, neither of which changes what a page shows or does: - The JSON contexts of `FluentCMS.Admin` and the one of the halves' manifests generate metadata only, without the fast path that only serializes: 8,894 B. - The component gallery at `/system/components` moves, with its texts, to `Gallery/` of `FluentCMS.Admin.Administration` and loads on its first visit, once, as an area's pages do since #3438; any signed-in user opens it, and a failed load shows the retry: 8,325 B. The administration assembly grows by 9,418 B, fetched on the first visit of the gallery or of an area. Section 7 of the admin specification now has the table of the first download by part (runtime, .NET, Blazor, Fluent UI, each admin assembly, styles, scripts and the rest), before, after, and after with A-38 (#3509) merged in, which measured 3,581,210 B. The budget stays 3,600,000 B: 38,199 B of room after this pull request and 18,790 B with A-38, for A6's remaining issues and A7's first wave; the next candidate, the account page, is named with an estimate. Changes in shared places: `AdministrationAreas` gets `OpenRoutes` and `IsOpen`, `AdminPlugins` loads the administration assembly for an open route without a gate and draws its page as the shell's own (`Gate`, `LoadFailed`, `NavigateAsync`), `AdminApp` no longer keeps the gallery, the `Pack` job's comment records the budget as kept, and `HomePageTests` and `AdminPluginLoadingTests` use `/system/plugins` as the page that loads nothing, since the gallery now loads an assembly. Dependencies: none. - [x] A table of the first download by part is in the spec - [x] The budget is set from that table, with what was moved out of the first download
…3515) Closes #3423 Adds core's sites page (`/sites` in `Sites/` of the administration assembly) and fills the multi-site half. The sites page shows the site the shell shows, for a caller who holds `sites.manage` in the site: its name and default locale, and its locales with position, enabled flag and fallbacks, which are added, changed, moved and removed, with the server's refusals named by their code. The multi-site half has `/multi-site/sites`, where a site is created and deleted after a question that names it, and `/multi-site/sites/{id}/hosts`, where host names are added, made primary and removed; both need `sites.manage` for the instance. After a change of a site or its locales the shell reads `GET /me/sites` again through a new member, `IAdminContext.ReadSitesAsync(Guid? gone = null)`, so that the site switcher and the locale switchers follow without a reload; when the site the shell shows was deleted, the shell moves to the default site, which the question says beforehand. When the caller names the site shown as gone (one it deleted, or a `FCMS2301` on `X-Cms-Site`) and the read fails, the shell leaves that site out of the switcher and shows its failed state, whose Try again starts the shell afresh and takes the default site. A new default locale reads the site's schema again. The design points settled are in a comment on the issue, and sections 4.16 and 5.6 of the specification have the as-built text. Shared files touched: `admin/src/FluentCMS.Admin.Abstractions/IAdminContext.cs` and its `PublicAPI.Unshipped.txt` (the new member, abstract while unshipped), `admin/src/FluentCMS.Admin/Shell/AdminContext.cs` (`ReadSitesAsync`), `admin/src/FluentCMS.Admin/Api/SiteMetadata.cs` (`ForgetSchema`), `admin/tests/FluentCMS.Plugins.Media.Admin.Tests/MediaTesting.cs` (its fake context implements the member), `admin/src/FluentCMS.Admin/Shell/ShellLog.cs` (event 24, a read of the sites that failed), `admin/tests/FluentCMS.Admin.ApiTests/FluentCMS.Admin.ApiTests.csproj` (one `ProjectReference` to the multi-site half), the new `admin/tests/FluentCMS.Admin.Tests/Shell/ReadSitesTests.cs`, and `docs/planning/admin-technical-spec.md` (4.16 and 5.6). #3509 adds a `FakeAdminContext : IAdminContext` to the AI assist half's tests too: whichever of the two pull requests merges second must add `ReadSitesAsync` to it. Dependencies: none. - [x] An administrator adds a locale with a fallback to a site, disables it and removes it, and the locale switcher of a content form follows each step - [x] The default locale of a site is changed, and what the server refuses is shown with its reason - [x] With the multi-site plugin a site is created, gets a second host name that is made primary, and is deleted after the confirmation; the site switcher follows - [x] A caller who holds `sites.manage` in one site sees that site's locales and none of the multi-site pages - [x] In a site where the multi-site plugin is disabled its pages and menu item are absent, and the half is not fetched - [x] Component tests cover both parts; the API tests check the records against the OpenAPI document; an end-to-end case adds a locale and creates a site
Closes #3421 This adds the API keys pages to the administration assembly: the list at `/api-keys`, the form at `/api-keys/new`, and a key's page at `/api-keys/{id}`. A key's page has rotate with an overlap, the allowed addresses, expire and revoke. Each refusal is named by what it means: a 403 on a key change is the role ceiling of #3391, and a 404 is a key that is not there or out of reach. The secret of a create or a rotation is shown by `CmsSecretDialog`, a new component of the wrapped set that the webhooks and MCP halves can use. The secret is hidden until the user presses Show, and Copy puts it on the clipboard on request. Done closes the dialog and clears the page's one bound field, and so does Leave from the question asked before a route change. The dialog writes the secret to no storage, log or address. `SecretChanged` is required: the dialog throws `InvalidOperationException` on render without it, so it cannot be bound one way. Each new secret starts hidden. While the dialog is open, leaving the page asks first. A reload, a close or another site gets the browser's prompt. A route change, Back included, gets the dialog's own Stay or Leave question, with texts in `CmsStrings`. Focus moves to Stay, Done is disabled until the user answers, Escape or a click outside answers Stay, and Leave clears the binding before the route changes. `OnClosed` is raised after Done alone, not after Leave or when the page clears the secret itself. The form opens the new key's page on it, and the key's page returns focus to Rotate, or to its heading when the page no longer shows Rotate, as after a failed read. The secret sits in a `role="group"` named by the label, not in a named `code` element. The clipboard type `CmsClipboard` is on the script allow-list of 3.1 and 3.3. It sits in `FluentCMS.Admin.Components` because the halves cannot reach `FluentCMS.Admin`, and it uses the browser's `navigator.clipboard.writeText` with no module. The architecture test maps each listed interop type to its one assembly. The end-to-end harness now records the `secret` of a Management POST answer as a value to mask, and a test can register one with `Mask`. `AdminBrowser` gains `GrantClipboardAsync`. `EndToEndHost.cs` is unchanged. Design points are recorded on the issue. The first download, measured once from an empty folder with the trimmed Release publish and `eng/check-admin-size.cs`, is 3,577,551 B of 3,600,000 B. ## Dependencies None. No NuGet package, npm package or GitHub Action is added, and no script file: the clipboard type calls the browser's own function. ## Acceptance - [x] An administrator makes a key for one site and one role, copies its secret, and the secret cannot be read again after the dialog closes (component test and end-to-end case) - [x] The key is rotated with an overlap, expired and revoked, each shown in the list (component tests on the key's page and the list, and an API test against the host) - [x] A caller below the key's role sees the refusal named (component tests for rotate, expire, revoke and addresses; API test that the host answers 403) - [x] A caller who holds `apikeys.manage` in one site sees that site's keys only (API test against the host: the list holds only the site's key, and a key bound to no site answers 404) - [x] The secret is in no log, no draft and no browser storage, and a kept trace of the end-to-end run holds no screenshot of it. Component test: no log, session storage write, address, script call other than the clipboard, or component field holds it after Done. End-to-end: the secret is never on the page, so no screenshot can show it; it is in no storage, address or console message; the harness knows it from the answer, and the kept trace is checked for it. - [x] Component tests cover the create form, the secret and the refusals; the API tests check the records against the OpenAPI document; an end-to-end case makes a key and reads content with it (and is refused once it is revoked)
Closes #3426 The form now draws the field actions of the admin halves, and the AI assist half fills them. A field whose type an enabled half's field action names gets an "Actions" button, for a caller who holds the action's permission and may change the field. The new `FieldActionAttribute.FieldsFrom` (manifest `fieldsFrom`) names a read and a member of its answer, such as `ai/fields#fields`, which the form reads without waiting once it shows (for a caller who may save, kept per site and locale for the session), so that a field not opted in, a site with AI assist off and a caller without `ai.use` see no action and the half is not fetched; the half loads when the button first opens, and a result that fits the field's type goes into the draft as an unsaved change. The new `IManagementEvents` reads `text/event-stream` through the admin's one pipeline and sends a refused request once, a 429 included. The half declares rewrite, shorten, expand, fix grammar, title, summary, SEO and alt text on opted-in text and long text fields, and the alt text of an image on a media field, saved on the asset when accepted; the suggestion streams into a panel and is taken only on Accept. `/ai/usage` lists, filters, pages and totals the usage of the site. The design points settled are in a comment on #3426. What changed from the issue: #3418 is merged, so the alt text of an asset alone is offered on media fields (`ai/fields#assets`, saved with `PATCH /media/{id}`), and the usage names each principal by `principalName`; the totals by principal carry no name, so a total shows a name its rows gave it, else the kind and id. Rich text fields get no action: the server answers Markdown for them, and nothing turns it into the field's document. The settings of `ai` are A-34's generated page. Translate is left out of this pull request: its suggestion is the text of another locale, which belongs in that locale's draft and not in the field of the locale it was asked from; a follow-up writes it into the target locale's draft. First download: 3,596,678 B, 3,322 B under the budget of 3,600,000 B, measured on the tree merged with `feature/a6` (after #3498 and #3510) with `eng/check-admin-size.cs` from a trimmed publish into an empty folder. The field actions are the part in the first download (the menu, the read of `fieldsFrom`, the event stream, the contract's additions and the half's manifest entries); the half itself is lazy. Shared files touched beyond the half and the form: `admin/tests/FluentCMS.Admin.ApiTests/FluentCMS.Admin.ApiTests.csproj` (the half's project reference, approved by the coordinator) and `AdminHost.cs` (`AdminClient.Events`); `admin/tests/FluentCMS.Admin.EndToEnd/EndToEndHost.cs` (a stand-in AI provider on loopback, allowed as an endpoint); `AdminResources.resx` (the form's own texts only); the sample half (`FaultyFieldActions.cs`, undeclared) and the careless half (a malformed `FieldsFrom`) of the tests. Dependencies: none. - [x] On an opted-in field an editor runs an action, sees the suggestion arrive in parts, accepts it and finds it in the draft as an unsaved change; declined, the draft is unchanged - [x] A field that is not opted in, a site with AI assist off and a caller without `ai.use` show no action, and the half is not fetched - [x] A refusal before the stream, an error within it and the daily budget each show their reason and leave the draft as it was - [x] Alt text is suggested for an image of the entry on an opted-in text field - [x] The usage page lists and filters the usage of the site - [x] The sample half's field action shows in the form through the same seam - [x] Component tests cover the menu, the panel and the stream against a fake; the API tests check the records against the OpenAPI document and run an action against a stand-in of the provider; an end-to-end case accepts a suggestion Checked locally on the merged tree: `dotnet build -c Release -warnaserror`; `FieldActionTests`, `ManagementEventsTests` and `AdminPluginManifestTests`; the half's test project; `AiAssistTests` of the API tests; the end-to-end `AiAssistTests` once in slow mode with its class alone. Not checked: the full suites, the end-to-end case shuffled among the others, and a screen reader.
…3516) Closes #3514 While the router waits in `OnNavigateAsync` for a lazy assembly, the page drawn before gets the next address's query and sees the shell's context change. The content list and the entry page then followed a locale the next address does not name (`/users` became `/users?locale=fr`, and the pending navigation started again), and the list read again with its query cleared. The media library took the next address's folder and filters and read the root folder. The roles list, which reloads on a change of the access, read with the next address's query when that address named another locale. A page now reacts to its query only while the path of the address is its own route: `ContentRoutes.IsList` and `IsEntry` check it for the content pages from their own route values, `MediaPage` checks `/media` itself, and `RecordList` keeps a reload until the address is the list's own path again. The decision, and why the shell holds no pending flag, are in a comment on #3514; the A-51 note of the spec states the rule. Dependencies: none. - [x] From a content list or entry with `?locale=fr`, a first visit of an administration route or a half's route lands on that route's address with no locale added, and no list is read again - [x] A change of the query on the page's own route still reads again and follows the locale - [x] A component test with the real router and a held navigation, for the content list and the entry page
Closes #3430 Each grant in the role editor now has an editor for its constraints below the read-only list, in a disclosure that works by keyboard: - **Sites** are offered only for a role of every site. The choices are the sites in `GET /me/sites` where the caller manages roles. A role of a site grants only in that site, so it gets no site choices. - **Locales** come from the role's site, or from the offered sites for a role of every site. - **Fields** are offered for a grant that names one content type (`content.{type}.{operation}` or `content.{type}.*`). They come from that type in `GET /schema`, which leaves out the fields the caller cannot read, and the editor says so. - **A row rule** is offered for a content grant. The choices are the rules in `GET /permissions/row-rules` (#3417) registered for every type, plus those registered for the grant's type. A stored value that is not offered is shown, marked as such, and can be removed. A list with nothing checked does not narrow the grant, so it is left out of the request. Constraints with no members left are sent as none. Only the member the user changes is written; `resources` and any member the editor does not know go back as read. Resources are shown and kept but not edited: a media grant's resources show by their folder names from `GET /media/folders` when the caller can read them (decision record 0004), and any other resources show as ids. From the review of #3503: - A grant's identity no longer depends on how its constraints are written. It is built from the known members in a fixed order, with each list normalized the way the server stores it (sites as ids, locales in any case, distinct), and an object with no members counts as the server's null. The merge after `FCMS3045` and the duplicate check both use it. - A refusal keeps its path below the grant. So `FCMS3042` on `grants[i].constraints.rowRule`, `FCMS2311` on `.locales` and `FCMS2108` on `.constraints` mark the field they name, and the disclosure opens. The spec's 4.15 gets an as-built paragraph for these changes. Dependencies: none. - [x] An administrator limits a grant of a content type to one site, two locales and three fields, saves, and reads the same back - [x] A row rule is set on a grant and refused by name when it is not registered, with the refusal on its field - [x] A grant limited to resources keeps them through an edit of its other constraints - [x] A user of a role limited to one locale may change an entry in that locale only, checked through the admin - [x] Component tests cover each constraint and the request they make; an end-to-end case limits a role to a locale and signs in as its user
…cale's access (#3539) Closes #3446 A navigation that waits for a lazy assembly or for the access of a new content locale now shows the shell with a loading state, a `role="status"` line at the top of the content ("Loading the page…"), announced as the other loading states are. - **First load.** The router draws nothing before its first navigation ends, so `ShellBeforeFirstPage` draws the layout on its own from the first wait until the router's first page replaces it: a reload of `/users` or `/media` shows the header, the sidebar and the loading state. - **Inside the app.** The waits of the router's `OnNavigateAsync` (the shell's first reads, the access of the locale the address names, the assembly of an area, a half or the component gallery) are counted by `NavigationProgress`, and the layout shows the line while one has not ended. A wait that has already ended shows nothing. The page before stays below the line and the layout is not made again; there is still no `Navigating` content. - **Content locale.** The route view shows the loading state while it holds a page's gate for the access of a new locale. The reads of a new locale, named by the address or taken when the site no longer has the one shown enabled, are given 75 s together (two reads in a row, each of which may wait up to 30 s after a 429, plus 15 s), so a read that hangs ends in the shell's failed state with Try again, before the client's 100 s per attempt. A `/schema` or `/plugins` read the limit gives up on is dropped, so Try again sends a new one. The tests that assert that the page drawn before stays while the router waits (`ContentNavigationTests`, `AdministrationNavigationTests`, `RolesPageTests`, `UsersPageTests`) keep their assertions: that page stays, under the loading state, and each now also asserts the loading state meanwhile. `ContentListBulkTests` runs every timer at once, so its clock now leaves the new locale limit alone. Spec 2.6 and 4.1 are updated. ## Tests - bUnit: `NavigationProgressTests` covers the first load and a navigation for an area, a half and the gallery. It also checks that a loaded assembly shows no loading state, that a locale change on an area's or a half's route shows the loading state, and that a hung read fails the shell, both after a navigation and after the site's locales change. The assertions above complete it. The whole `FluentCMS.Admin.Tests` project passes. - End to end (`NavigationProgressTests`), passing in slow mode: a reload of `/users` and of `/media`, a navigation to `/users` and then `/media`, a change of the locale on each, and a hung read of the new locale's access. `AdministrationTests`, `PluginLoadingTests`, `SignInTests` and `ShellTests` also pass in slow mode. ## First download Measured with `eng/check-admin-size.cs` on one machine, from Release publishes into empty folders: 3,586,461 B on `feature/a6` at `fdc94ca5` and 3,588,136 B on this branch, so 1,675 B more, nearly all of it in `FluentCMS.Admin.wasm`. That leaves 11,864 B under the 3,600,000 B budget.
… the admin (#3541) Closes #3427 The plugins, jobs and diagnostics pages of the administration assembly, and the search half's rebuild page (A-39, spec 4.15 and 5.7). ## What changes - **`/plugins`**: every plugin of `GET /plugins` with its version, SDK range, dependencies and contributions, links to the pages of its admin half while it is enabled in the site, a switch per site where the caller holds `plugins.manage`, and a link to `/system/plugins`. A switch in the shell's site reads the shell's plugins again (`AdminContext.ReadPluginsAsync`, internal), so the half's menu items, widgets and pages follow without a reload. - **`/jobs`**: the jobs in pages, filtered by status, type and queue in the address; while a row shown is a running job, the page shown is read again every five seconds with one read for all its rows (2.7); a failed read skips the tick. Below the list: the dead-lettered jobs with retry, and the failed event deliveries with retry, remove and purge by the handlers of the rows read, each asked first. Neither dead-letter list has a total, so both read on with More, from the page the first row not shown is on after rows were taken out, and read on at once when the last row shown goes. A row that the 30-day retention removed meanwhile (404) is taken out and the page says so. - **`/jobs/{id}`**: a job's state and attempts, an attempt abandoned past its timeout (`FCMS2508`) said in the admin's words, cancel of a pending job after a question, retry of a dead-lettered one, and the job followed while it runs or is due. - **`/system/diagnostics`**: the startup report (providers, plugins, pending migrations, schema drift, insecure defaults) and the detailed health, run again on request. - **Search half `/search`**: a rebuild of every searchable type or one; a caller with `jobs.manage` for the instance gets a link to the job, any other the notice that it started. ## Tests - Component tests for each page, and the areas' localization checks with their data (`FluentCMS.Admin.Tests/Administration/{Plugins,Jobs,Diagnostics}`, `FluentCMS.Plugins.Search.Admin.Tests`). - API tests holding the records to the OpenAPI document, dead-lettering, retrying and cancelling jobs on the test host, switching a plugin, reading the report with the test host's insecure defaults, and the 403 of a caller who holds `jobs.manage` or `system.read` through a role of a site. - End-to-end `OperationsTests`: a plugin switched off and on with its menu item following without a reload, a pending job cancelled and retried from the dead letters, and the diagnostics read. The first download, measured as the size check does, is 3,586,752 B, 13,248 B under the budget; the pages and the half are lazy.
Brings feature/a6 up to date with main (27 commits). The merge had no conflicts; the solution builds in Release with warnings as errors, and the architecture, core and admin component tests pass. --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
## Problem `TwoFirstUsesAtOnceLoadTheHalfAndRunConfigureOnce` failed on three branches on 21 Nov. All three ran on commits from before #3510, where line 304 read `(ReviewsAdminPlugin.Configured - configured).ShouldBe(1)`. That counter counted `Configure` for every admin in the test process, so an administration test running beside it raised the count to 2. `Loads` was 1 each time. #3510 now counts per admin, but the issue stayed open because that pull request went into `feature/a6`. `AdminPlugins` loads a half once: every caller runs on the renderer's dispatcher, and a call either finds the half loaded, joins the load in `_loads`, or starts the one load. #3510 left the "whatever the order" item of the issue untested. ## Change A theory runs every order of three first uses (a service, a field editor and the navigation to the half's page), with the held load ending after the first, second or third use: 18 cases. It asserts one load after each use, and one load and one `Configure` at the end. It uses the loader's gate and awaited tasks only, with no timers. If `LoadAsync` stops keeping the load in progress, the 12 orders where two uses overlap the load fail. No production code changes. ## Tests - `AdminPluginLoadingTests`: 20 runs in a row with a build beside each, 46/46 every run - The `Plugins` and `Administration*` namespaces together: 10 runs with a build beside, 551/551 every run - `dotnet build -c Release -warnaserror` of the admin test project Closes #3505
Brings feature/a6 up to date with main (66 commits, up to c13af58). The merge had one conflict, in `docs/planning/admin-technical-spec.md` (5.5, AI assist): main removed the sentence "Waits for #3101 and #3103 …" and feature/a6 had added the "As built (A-38)" paragraph right after it. The sentence is gone and the paragraph is kept. `admin/tests/FluentCMS.Admin.ApiTests/OpenApiContractTests.cs` merged by itself and carries exactly main's change. The solution builds in Release with warnings as errors, and the architecture tests (43) and the admin component tests (2144) pass. --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Closes #3424 Fills the webhooks half of the admin (spec 5.3), for a caller who holds `webhooks.manage` in the site. `/webhooks` lists the webhooks of the site with their address, events and state, and enables, disables and deletes them; one form below the list makes a new webhook or, after Edit, changes the chosen one: name, https address, the events from the half's own list in three groups, the content types of the schema, up to 20 headers, enabled, and a new secret. `/webhooks/{id}` shows the webhook and its delivery log, 20 attempts a page, each with its state, status and duration, and on Details its body, the start of the answer and the error; an attempt is sent again and the webhook is pinged, and the page follows the log until the new delivery has its result and says it. Decisions that matter to a reader (all in the comment on #3424): - **Secret.** A create sends no secret, so the server makes it and answers it once. "Make a new secret" on an edit makes `whsec_` and 64 hexadecimal digits in the browser and sends it; the server keeps the old secret signing for its overlap, and the list and the webhook's page show until when. Either secret is shown once by A-33's `CmsSecretDialog` and held in one field of the page until Done. - **Stored header values.** A stored header shows its name read-only and no value; an empty value sends `***`, which keeps the stored one. Once the address has another scheme, host or port than when the form was loaded, the form says that each header needs its value again and marks it required, without stopping the save, so the server's `FCMS1560` on `headers.{name}` shows under that header. Enable and disable send the webhook back whole with the headers redacted. - **End-to-end case.** The end-to-end host now lets webhooks reach private networks (`FluentCms:Webhooks:AllowPrivateNetworks`), and the case's receiver on the loopback address counts each connection and closes it: the host runs in Production, where a webhook takes https, and trusts no certificate of the run, so every attempt fails. The case makes the webhook in the page, copies the secret, which the page then holds nowhere, publishes an entry, reads the failed delivery with its body and error, sends it again and pings, each reaching the receiver; a second case checks that in a site where the plugin is disabled the half has no menu item, its page is not found and it is not fetched. - **Only the component tests show** a delivery that was answered, with its status and answer, and the result of a successful redelivery; the API tests use addresses under `.invalid`, which never resolve. - `WebhookRecord` and `WebhookSaved` are public, since the form, a Razor component, takes them; the half adds no stylesheet. Size check: the first download is 3,593,587 B, 6,413 B under the budget of 3,600,000 B, measured on this branch with `eng/check-admin-size.cs` from a publish into an empty folder; the half's assembly is left out as lazy, and the first download grows by the second page of its manifest. Shared files touched beyond the half and its tests: `admin/tests/FluentCMS.Admin.ApiTests/FluentCMS.Admin.ApiTests.csproj` (the half's project reference), `admin/tests/FluentCMS.Admin.EndToEnd/EndToEndHost.cs` (the setting above) and `docs/planning/admin-technical-spec.md` (the As built paragraph of 5.3). Dependencies: none. - [x] An administrator makes a webhook for a publish event, copies the secret made for it, and the secret cannot be read again - [x] A publish shows as a delivery with its status, body and answer, and a failed one is sent again - [x] A change of the address asks for each header's value again, and a save without them shows the refusal on the header - [x] A ping shows its result - [x] In a site where the plugin is disabled the pages and the menu item are absent, and the half is not fetched - [x] Component tests cover the form, the headers and the log; the API tests check the records against the OpenAPI document; an end-to-end case makes a webhook against a receiver of the test and reads its delivery Checked locally: `dotnet build -c Release -warnaserror`; the half's component tests (17); `WebhooksTests` of the API tests (4); the architecture tests; the end-to-end `WebhooksTests` (2) once in slow mode with its class alone; `markdownlint-cli2` on the changed markdown. Only CI shows: the full suites, the end-to-end cases shuffled among the others, PostgreSQL and SQL Server, and Windows. Not checked: a screen reader.
Closes #3425 ## What the half does `FluentCMS.Plugins.Mcp.Admin` replaces the A-51 stub with four pages, in a site where the MCP plugin is enabled: - **`/mcp/clients`**, for `mcp.manage` for the instance only. It lists the clients with their client id, status, role, registration time and last activity. From this page an administrator can: - approve a pending client with a role, or reject it - give an approved client another role, or revoke it - remove a rejected client - register a client, which is approved at once with its role Reject, revoke and remove ask first. A change of role starts from the client's current role and stays off until another role is chosen. - **`/mcp/instructions`**, for `mcp.manage` in the site. It holds the guidelines of the site and the instructions of each content type. Each text is written, changed and removed (after a question) on its own. A type that is no longer in the schema is marked. - **`/mcp/prompts`**, for `mcp.manage` in the site. It lists the stored prompts and has one form to create or change a prompt (name, title, description, arguments, template). A refusal goes on the field it is about. A delete asks first. - **`/mcp/activity`**, the agent writes. The `mcp` settings stay on the generated page of A-34. The clients page links to `/settings/mcp/defaults` for a caller who may manage them for the instance. ## Decisions - **Bulk removal (#3397) is left out.** Section 5.4 of the spec does not list `POST /mcp/clients/remove` among the half's pages and actions, and the acceptance does not ask for it. The caller's own consents (`/mcp/consents`, #3594) are not part of this half either. - **Shown once for a public client.** A client registered here is public and has no secret, so the answer holds nothing secret. `CmsSecretDialog` of A-33 shows the client id the agent is set up with, once, with its copy button. The list shows the client id too, since it is not a secret. - **Roles offered.** The roles of every site from `GET /roles`, sent by id, since a client belongs to the instance. A caller who may read no role is told that the roles could not be read. They can still reject, revoke and remove, but not approve, change a role or register. - **A client that is gone or changed.** `FCMS1603` says the client no longer exists and names the server's cleanup. `FCMS1604`, `FCMS1607` and `FCMS1609` say it changed meanwhile. Both close the dialog and read the list again. - **Agent writes.** A page of its own, `/mcp/activity`, for `activity.read` in the site. It has no menu item; the other pages of the half link to it where the caller may open it. It reads `GET /activity?origin=mcp` in pages of 50, newest first. A client's own registration through `/connect/register` is recorded with that origin, so it shows there too. The full list of decisions is in the comment on #3425, and the spec has an "As built (A-37)" paragraph in 5.4. ## Size With the webhooks half merged, the first download is 3,594,429 B in Brotli (90 files), 5,571 B under the 3,600,000 B budget. The half's assembly loads lazily, so only its manifest entry is in the first download. ## What was run On the tree merged with `feature/a6` at 185736d: | Check | Result | | --- | --- | | `dotnet build -c Release -warnaserror` | Succeeded | | Component tests of the half | 26/26 passed | | `McpTests` of the API tests (records and request bodies against the OpenAPI document, approve, change role, revoke, register, instructions, prompts, the site-only caller) | 4/4 passed | | End-to-end case in slow mode (approve a client that registered itself, write the guidelines of the site) | Passed | | Architecture tests (before the merge) | 43/43 passed | | markdownlint on the changed markdown | No issues | On the merged tree, one API test first failed. It expected no agent writes, but a self-registration is recorded with origin `mcp`, and its row may be written in time for the read. The test now allows that row and still checks that none of the administrator's actions is listed. Only CI shows the PostgreSQL and SQL Server runs and the full suites.
Closes #3630 `AiUsagePageTests.TheUsageIsListedWithTheNamesOfItsPrincipalsAndTheTotalsOfTheFilter` expected the time of a call with a plain space before `AM`. The page writes it with `ToString("g", CultureInfo.CurrentCulture)`, and for `en` the runtime on Linux puts a narrow no-break space (U+202F) there, so the test failed in `Tests (admin)` of the manual CI on `feature/a6` (run 45322028174) and passed on Windows. The test now builds the expected text with the same format, so it holds on either platform. The page is unchanged. Checked locally on Windows: the test project builds in Release with warnings as errors and its 16 tests pass. The fast checks of this pull request do not run the halves' component tests; the next manual CI on `feature/a6` shows the test on Linux.
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.
Milestone A6 of the admin: nothing a Must row needs takes the CLI or a direct API call. An administrator manages users, roles, keys, members, settings, locales, sites and host names, webhooks, MCP clients, plugins and jobs, and reads the startup report, from the admin alone; an editor runs AI actions on the opted-in fields.
Closes #3419
Closes #3420
Closes #3421
Closes #3422
Closes #3423
Closes #3424
Closes #3425
Closes #3426
Closes #3427
Closes #3428
Closes #3429
Closes #3430
Closes #3431
Closes #3354
Closes #3446
Closes #3488
Closes #3504
Closes #3514
Closes #3630
What is in it
Fixed on the way:
Decisions
The decisions of the milestone are in #3431 and in section 11 of
docs/planning/admin-technical-spec.md; each issue has its own in a comment. The ones a reader meets first:Dependencies
None: no NuGet package, npm package or GitHub Action, no migration and no backend model change. Outside
admin/the milestone changesFluentCMS.slnx(the new projects), oneCOPYline of the host'sDockerfile,tests/FluentCMS.Architecture.Tests/AdminRulesTests.cs, a comment inci.ymland the admin specification.Size
First download 3,594,429 B with every half, 5,571 B under the budget of 3,600,000 B.
Verification
mainis merged in at c13af58 (Merge main into feature/a6 #3627). The one conflict, a paragraph of section 5.5 of the admin specification, kept the as-built text of A-38.feature/a6at 7dd0d7c, the tree of this pull request, passed: the quick run 45324672156 and the full run 45390713433.Publish, and both passed.