You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat: add an admin-configurable site banner - #2257
hmm, I do not like the idea that we start adding a SettingsAPI right now. Just wrap that into the existing version endpoint as an optional field.
also its not clear to me how the banner-dismiss-id is generated. I tested it out by updating the text but it kept the same. My expectation would be that the id is derived from the text, we might even add a field in the settings to add a custom prefix / suffix to the id.
The exclusive severity group has no accessible name, so assistive technology exposes an unlabeled group containing generic “Info” and “Warning” buttons. Add an aria-label such as “Banner severity” (or associate a visible label) with the group.
Fold the max-extension-size setting into the per-setting bean design
as MaxExtensionSizeSetting. WritableSetting#writesUnchanged lets it
keep writing a value equal to the configured default, so an admin can
still pin it.
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Fall back to info for a stored severity the banner has no variant for,
poll the site settings every minute to match the endpoint's cache, fix
the changelog issue link, and cover SettingsUpdateChannel.
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
SettingsJson, served by both the admin and the public settings
endpoints, now uses camelCase like every other DTO. The stored
setting keys stay kebab-case and are translated in SettingsJson.
The public endpoint returns SettingsJson instead of a raw map.
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
SettingsService takes PublishingConfig directly instead of going
through MaxExtensionSizeSetting#getCeiling, as it did on main.
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
SiteSettingsJson carries only the banner properties, so an admin-only
setting cannot reach /api/-/settings by being added to SettingsJson,
and the public schema no longer lists fields it never populates.
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Write every row an update carries, since the snapshot it is compared
against can be stale on this node. Keep the guaranteed admin settings
fields required in the TypeScript types. Seed the public settings
from the update response instead of refetching an endpoint a browser
or CDN may still hold a cached copy of.
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
SettingsService validates every registered setting on every save, but this implementation rejects even when the max-size value is unchanged. If the configured override ceiling is lowered below an already stored default, admins can no longer change the banner or read-only flag until they also change the size; the previous implementation validated only when maxExtensionSize was present. Follow WritableSetting.validate’s contract and skip these checks when value equals current.
Mount RegistryBanner in the admin dashboard layout
webui/src/layout/app-layout.tsx:110
RegistryBanner is only mounted inside AppLayout, but Main renders /admin/** through the separate AdminDashboard route (webui/src/main.tsx:123-133). Consequently the configured “every page” banner is absent throughout the admin dashboard—including the Settings page whose mutation now seeds this query cache. Mount the banner at a layout level shared by both route trees (while preserving the page-settings override), or add equivalent handling to the admin layout.
A multi-row save was committed row by row, so a reader could see a
mixed state, and a failure part way left the update half applied.
SettingsCache#setAll upserts every row at once; the cache is cleared
and the other nodes told only after it returns. The write-order
handling in BannerSetting existed for the per-row commits and goes.
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Unchanged invalid size settings can block unrelated saves, while stale snapshots and cache normalization can violate banner dismissal and public API semantics.
validate runs for every registered setting, including settings omitted from this request. Because this implementation always checks the resolved value, lowering max-override-size below an already-stored default makes every unrelated banner/read-only save fail until the size is edited. Preserve partial-update behavior by skipping validation when this setting did not change, as required by WritableSetting.validate and already done by BannerSetting.
Avoid stale snapshots when generating banner dismiss tokens
Using the minute-cached snapshot here can defeat the server-side “new banner gets a fresh dismiss token” guarantee. For example, after node A clears a message, an admin can read that state from A and submit a new message to node B whose snapshot still contains the old message; dismissIdFor then keeps the old token, so everyone who dismissed the old banner also misses the replacement. Merge token-generating updates against an uncached/current database snapshot in the write transaction (or otherwise make the rotation independent of this stale snapshot).
Preserve absent defaults in admin and public settings responses
The admin response contains resolved defaults, whereas the public endpoint intentionally publishes only rows actually stored. Thus, enabling a banner whose severity was never written seeds bannerSeverity: 'info' here, but the next /api/-/settings poll removes that property. This violates SiteSettings' documented absence semantics and makes the exported useSiteSettings result change shape without a settings change. Seed from the previous public value plus the submitted patch, or make the endpoint consistently return resolved defaults.
A default stored above a ceiling lowered since stays in force until
edited, and no longer blocks saving an unrelated setting. The banner
card now says it is not shown in the admin dashboard.
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
A save merged against the node-local snapshot, which another node may
already have invalidated, so a new banner could keep the old dismiss
token. It now reads the rows from the store. A published banner also
carries all four properties with defaults filled in, matching what the
admin page seeds after a save.
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Follow-up on the four findings Copilot listed as previously missed:
Unchanged max-size validation (28db574): MaxExtensionSizeSetting#validate now returns early when the value equals the current one, so lowering ovsx.publishing.max-override-size below a stored default no longer blocks saving the banner or read-only mode. A changed size is still checked against the ceiling.
Banner in the admin dashboard (28db574): not changing this, the banner is intentionally not shown there. The banner card now says "on every page except the admin dashboard".
Stale snapshot for dismiss tokens (6fe6311): updateFromJson merges against SettingsCache#load(), which reads the store directly, instead of the node-local cached snapshot. A banner that is new no longer keeps the old dismiss token because this node had not yet seen another node's clear. Two admins saving at the same instant can still race; that would need a lock and is out of scope here.
Seeded vs polled shape (6fe6311): a published banner now always carries all four properties, with defaults filled in (severity info, empty dismiss id). The public endpoint therefore matches what the admin page seeds after a save, and SiteSettings is either complete or empty.
Tests were added or updated for each; the stale-snapshot and unchanged-validation tests fail without their fix.
This pattern rejects valid Markdown autolinks such as <https://status.example.org> and <[email protected]> because it treats the first letter after < as an HTML tag opener, even though the UI and API advertise Markdown support. Distinguish actual HTML tokens from Markdown autolinks (for example via parser token inspection) before rejecting the message.
Require bannerEnabled before displaying the banner
webui/src/components/registry-banner.tsx:39
bannerEnabled is never consulted, so a response containing { bannerEnabled: false, bannerMessage: "..." } still opens the banner. This also contradicts the defensive handling described above for responses from unknown registries. Require the enabled flag as well as a non-empty message.
Follow-up on the two findings Copilot listed as previously missed in its latest review (1d16e4e):
Markdown autolinks: the HTML check treated any < followed by a letter as a tag, so <https://status.example.org> and <[email protected]> were refused. Autolinks are now let through; real tags (<a href=...>, <img ...>, <script>, </b>) are still rejected. Because an autolink no longer trips the HTML check, the executable-link rule now also covers <javascript:...>, <vbscript:...> and <data:...>, case-insensitively.
bannerEnabled in RegistryBanner: the banner now requires bannerEnabled === true as well as a non-empty message, so a response carrying a message with the switch off no longer opens it. The new spec fails without the check.
When we introduced the per-setting beans in #2257 the idea was to have the settings open for extension and closed for modification, so adding a setting never touches `SettingsService`. We deprecated `isReadOnly()` on the service back then, but the max extension size that came in with #2287 ended up doing exactly the opposite and added `getMaxExtensionSize()` to the service, so we had one getter deprecated and another one alive, and both settings reading the cache from the same bean that encodes and validates them.
This settles that. A setting bean only knows how to encode and decode its rows, and a setting the server needs at runtime gets its own reader (`ReadOnlyMode`, `ExtensionSizeLimitService`) that asks the service for the current value through a package-private `current(setting)`. Everything else injects the reader, the setting beans, their keys and the cache are package-private now, and the getters on the service are gone.
We're also taking the json mapping out of the service. It returns `SettingRows` now and `SettingsJsonMapper`, next to the beans since it's the only place that can see the keys, does the mapping for `AdminAPI` and `SettingsAPI`, so the DTOs don't name any setting codec anymore.
Assisted-By: anthropic:claude-fable-5
When we introduced the per-setting beans in #2257 the idea was to have the settings open for extension and closed for modification, so adding a setting never touches `SettingsService`. We deprecated `isReadOnly()` on the service back then, but the max extension size that came in with #2287 ended up doing exactly the opposite and added `getMaxExtensionSize()` to the service, so we had one getter deprecated and another one alive, and both settings reading the cache from the same bean that encodes and validates them.
This settles that. A setting bean only knows how to encode and decode its rows, and a setting the server needs at runtime gets its own reader (`ReadOnlyMode`, `ExtensionSizeLimitService`) that asks the service for the current value through a package-private `current(setting)`. Everything else injects the reader, the setting beans, their keys and the cache are package-private now, and the getters on the service are gone.
We're also taking the json mapping out of the service. It returns `SettingRows` now and `SettingsJsonMapper`, next to the beans since it's the only place that can see the keys, does the mapping for `AdminAPI` and `SettingsAPI`, so the DTOs don't name any setting codec anymore.
Assisted-By: anthropic:claude-fable-5
* chore: read site settings through per-setting reader beans
When we introduced the per-setting beans in #2257 the idea was to have the settings open for extension and closed for modification, so adding a setting never touches `SettingsService`. We deprecated `isReadOnly()` on the service back then, but the max extension size that came in with #2287 ended up doing exactly the opposite and added `getMaxExtensionSize()` to the service, so we had one getter deprecated and another one alive, and both settings reading the cache from the same bean that encodes and validates them.
This settles that. A setting bean only knows how to encode and decode its rows, and a setting the server needs at runtime gets its own reader (`ReadOnlyMode`, `ExtensionSizeLimitService`) that asks the service for the current value through a package-private `current(setting)`. Everything else injects the reader, the setting beans, their keys and the cache are package-private now, and the getters on the service are gone.
We're also taking the json mapping out of the service. It returns `SettingRows` now and `SettingsJsonMapper`, next to the beans since it's the only place that can see the keys, does the mapping for `AdminAPI` and `SettingsAPI`, so the DTOs don't name any setting codec anymore.
Assisted-By: anthropic:claude-fable-5
* chore: rename ReadOnlyMode to ReadOnlyModeService
* chore: update ReadOnlyMode references to ReadOnlyModeService
* chore: let a setting read its own value from the settings store
A setting the server consults exposes its own accessor over the cached
snapshot, so the reader beans go, SettingsCache becomes the public
SettingsStore, and each consulted setting moves into a package of its own.
* chore: read settings through their own accessors
The previous commit captured only the file moves. This is the change
itself: ReadOnlySetting.isEnabled() and MaxExtensionSizeSetting.getValue()
over the public SettingsStore, the reader beans and SettingsService.current
removed, callers injecting the setting, and the tests using the key
constants.
* chore: keep the settings in one package and guard every *API mutation
Move the settings out of the readonly and extensionsize subpackages back
into settings, which shrinks the change and lets SettingsStore stay
package-private.
ReadOnlyEndpointAspect only matched RegistryAPI, UserAPI and the admin
package, so the TrustedPublishingAPI mutations ran in read-only mode.
Match every class named *API instead, and add a test that every
@MutatingOperation is guarded.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
* docs: add a changelog entry for the read-only trusted publishing fix
Co-Authored-By: Claude Opus 5.5 <[email protected]>
---------
Co-authored-by: Thomas Neidhart <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
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
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.
This is an start to have the banner as part of the runtime settings.
Resolves #2256