- name
- add-user-default-style
- description
- Remember each user's stylesheet with their account instead of the browser
- spec
- style-topics
- status
- proposed
- date
- 2026-09-24
- tags
- ai, spec, openspec, change
Proposal
Why
The chosen stylesheet lives in a browser cookie, so a user who picks Style:yahoo on the iPad still sees the default on the laptop. Once real login exists, the choice belongs with the user.
What Changes
- The chosen stylesheet is stored as a user preference when the user is logged in.
- The cookie stays for visitors who aren't logged in.
- A broken stylesheet in the user's preference falls back to the default, like one in the cookie.
Impact
- Affected specs: style-topics.
- Depends on real login (not built yet).
Tasks
1. Build
- 1.1 Store the choice as a user preference on "Use this stylesheet"
- 1.2 Read the preference before the cookie
- 1.3 Move an existing cookie choice into the preference on first login
2. Test
- 2.1 Pick on one device, see it on another
- 2.2 A broken preferred stylesheet falls back to the default
Spec delta
ADDED Requirements
Requirement: Stylesheet follows the user
The system SHALL keep a logged-in user's chosen stylesheet with their account and apply it on every device they use.
Scenario: Two devices
- WHEN a logged-in user picks
Style:yahooon one device - AND opens d2 on another device, logged in as the same user
- THEN pages there use
Style:yahoo
MODIFIED Requirements
Requirement: Broken stylesheets are harmless
The system MUST NOT apply a Style topic that has errors; it SHALL list it with its errors instead, and pages SHALL fall back to the default stylesheet.
Scenario: Unknown token
- WHEN a Style topic sets a token that doesn't exist
- THEN the save reply lists the error
- AND the Styles page shows the topic as "Has errors" with no button to use it
Scenario: A broken stylesheet in the cookie
- WHEN the browser's cookie names a Style topic that has errors
- THEN pages use the default stylesheet
Scenario: A broken stylesheet as the user's preference
- WHEN the stylesheet a user chose later gets an error
- THEN pages use the default stylesheet
- AND the user's choice is kept, so fixing the topic brings it back