skillhub/openspec/changes/configure-site-presentation/specs/site-presentation/spec.md
XiaoSeS 4cd38c35e2
feat(settings): configure existing homepage regions and site branding (#1079)
* feat(settings): persist site branding and homepage presentation

Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>

* feat(frontend): manage and apply instance presentation settings

Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>

* fix(frontend): apply presentation to the actual homepage route

Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>

* fix(settings): retain CSRF headers when saving presentation

Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>

* feat(home): compose a complete configurable catalog homepage

Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>

* feat(settings): configure regions of the existing homepage

Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>

* fix(settings): validate encoded link paths before prefixing

Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>

* fix(home): retain the fixed demo notice with custom copy

Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>

* fix(web): fill homepage capability grid after configuration

Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>

* refactor(settings): simplify homepage presentation controls

Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>

---------

Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>
2026-11-10 17:54:07 +08:00

5.2 KiB

ADDED Requirements

Requirement: Persist instance presentation without source patches

The system SHALL store presentation overrides in the existing settings database and preserve them across restarts and upgrades. Absent overrides SHALL keep the existing appearance.

Scenario: Default installation

  • WHEN no administrator customized presentation
  • THEN existing SkillHub name, brand image, landing layout, sections and footer remain available.

Scenario: Upgrade a customized installation

  • GIVEN a saved custom name, region settings and image references
  • WHEN the application is restarted or upgraded with persistent database and storage
  • THEN the same settings and assets remain effective without modifying source.

Requirement: Restrict management and public disclosure

Only SUPER_ADMIN SHALL modify presentation or upload brand assets. Public reads SHALL return only explicit presentation fields. Edits SHALL check the expected version and record an audit event.

Scenario: Stale save

  • GIVEN two administrators loaded the same version
  • WHEN one saves and the other submits the old version
  • THEN the second save is rejected and the committed settings are not overwritten.

Scenario: Unauthorized write

  • WHEN an anonymous or ordinary member submits settings or an image
  • THEN the write is denied and the stored presentation remains unchanged.

Requirement: Apply safe brand and homepage options

The UI SHALL apply instance display name, safe logo/favicon references, the existing default homepage, localized plain text and element/region visibility for its eight existing regions, and fixed safe navigation-link overrides. Catalog data SHALL use existing visibility checks.

  • WHEN sections.popular.enabled is false
  • THEN the popular section is absent and its query does not execute.

Scenario: Invalid image or unsafe URL

  • WHEN an upload is invalid, exceeds limits, or a submitted reference points outside controlled brand storage
  • THEN validation rejects it and existing presentation remains unchanged.

Requirement: Provide a recoverable editing flow

The UI SHALL expose only site information, homepage introduction and eight region visibility switches. It SHALL warn about unsaved changes, retain drafts after failed saves and allow the editable page settings to be reset before saving. Supported stored fields not exposed by the page SHALL be preserved.

Scenario: Edit without publishing

  • WHEN an administrator changes the draft
  • THEN visitors continue seeing the last saved configuration until Save succeeds.
  • AND the page offers a homepage link after a successful save rather than a simulated preview.

Scenario: Save failure

  • WHEN the save request fails
  • THEN draft values remain editable and the UI offers an explicit retry/recovery action.

Scenario: Preserve the default homepage

  • GIVEN no presentation overrides are configured
  • WHEN a visitor opens the root route
  • THEN the original landing-page layout, section order, styling and default content remain unchanged, without a homepage mode selector.

Scenario: Configure homepage introduction and section visibility

  • GIVEN an administrator edits the hero title or description and region visibility
  • WHEN settings are saved and the visitor refreshes
  • THEN the homepage introduction renders the saved plain text and selected regions are hidden, while other content keeps its current values.
  • AND disabled popular/latest regions do not issue skill requests; the independent marketplace is unaffected.

Scenario: Safe site-specific destinations

  • WHEN a configured fixed link slot contains a valid HTTP/HTTPS URL or a single-slash root-relative path
  • THEN the existing link label and position use that destination, respecting deployment base paths.
  • AND unsafe schemes, protocol-relative URLs, credentials, encoded control characters and unknown slots are rejected.

Scenario: Preserve legacy saved customizations

  • GIVEN persisted draft-era hero text or visibility flags and no sections key
  • WHEN the configuration is read
  • THEN equivalent text and visibility are returned in the new region structure without a database write or version increment.
  • AND old catalog mode never selects an alternative homepage.

Scenario: Clear a region override

  • GIVEN new region settings explicitly contain empty text maps
  • WHEN the configuration is read or saved
  • THEN original product text is used, without reviving legacy fields.

Scenario: Keep technical behavior authoritative

  • WHEN an administrator changes site display name or explanatory copy
  • THEN CLI package names, executable commands, API endpoints and internal business destinations remain generated by existing logic.
  • AND demo content remains identified as demonstration and can be hidden through supported element switches.

Scenario: Preserve unexposed settings during editing

  • GIVEN stored card text, item switches or other supported link overrides
  • WHEN an administrator saves changes or resets this page's editable fields
  • THEN those unexposed values remain unchanged.
  • AND resetting this page restores only brand fields, both hero text slots across supported languages, eight region visibility flags and documentation/repository links.