All verification is complete — this pass needed no code changes. Final report: **Phase 91 — Admin Theme tab: final verification pass (all 6 tasks already in `complete/`)** - Verified pre-paint theming end-to-end: `ui_settings` store + resolver, admin `GET/PUT /api/ui-settings`, `CachingMiddleware` inline-`<style id="bor-theme">` injection before `</head>` (incl. `/shared/<token>` prefix branch, unit-pinned), CSP sha256 exemption for the inline tag, Theme tab shell + `theme.js` editor, CSS-file theming fully retired. - No defects found; zero changes made — working tree left exactly as the task executors left it. - Tests: `uv run pytest --cov=app` → 1841 passed, 0 failed (TOTAL coverage **99%**; theming/ui_settings/caching all 100%); `uv run pytest tests/e2e/test_admin_theme_tab.py -v --no-cov` → **5 passed** in isolation. - Lint/types: `uv run ruff check .` → All checks passed; `uv run pyright` → 0 errors, 0 warnings. - Criteria: (1) unset deployment byte-identical, no `#bor-theme` anywhere — ✓ (unit no-op test + E2E reset byte-compare); `rg "BOR_THEME|themes/"` → single hit is the permitted doc-history comment in `frontend/index.html`. (2) admin-only gate + 403s for anonymous and token users — ✓ (E2E test 3). (3) saved theme inline before `</head>` on every page incl. `/shared/<token>`, computed `--brand` on first paint for admin + anonymous — ✓ (E2E test 2 + unit). (4) reset → byte-identical; 5 contrast pairs warn <4.5:1, non-blocking — ✓ (E2E tests 4–5). (5) suite green, >90% coverage, lint clean — ✓. (6) commit deferred to harness per rules. - Notable: `.agents/PLAN.md` is absent from the repo — the phase overview's Design section was used as the binding spec; no deviation resulted. - Next pending phase: **none** — 91 is the last phase in `todo/`.
57 lines
2.2 KiB
Python
57 lines
2.2 KiB
Python
"""ui_settings: single-row UI settings (phase 91)
|
|
|
|
Revision ID: 0014
|
|
Revises: 0013
|
|
Create Date: 2026-09-09
|
|
|
|
Phase 91 (admin Theme tab: the owner sets the app name, input
|
|
placeholder, footer text and the 8 identity colors with text fields
|
|
and color pickers — one additive, fully reversible table, A13):
|
|
|
|
* ``ui_settings`` — ONE row (PK ``id``, the row is always id 1): the
|
|
phase-91 admin Theme tab persists its values here. The 3 strings
|
|
(``app_name`` / ``input_placeholder`` / ``footer_text``, VARCHAR(300))
|
|
and the 8 identity colors (``bg`` / ``surface`` / ``ink`` /
|
|
``ink_soft`` / ``line`` / ``brand`` / ``brand_soft`` / ``brand_ink``,
|
|
VARCHAR(7) ``#rrggbb``) are ALL nullable — NULL = default (the env
|
|
value for the strings, the built-in palette for the colors, B1).
|
|
The row is created only by the PUT upsert (no seed, no server
|
|
default — a missing row means "defaults", the byte-identical
|
|
contract).
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
import sqlalchemy as sa
|
|
|
|
from alembic import op
|
|
|
|
revision = "0014"
|
|
down_revision = "0013"
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
op.create_table(
|
|
"ui_settings",
|
|
sa.Column("id", sa.Integer(), nullable=False),
|
|
sa.Column("app_name", sa.String(length=300), nullable=True),
|
|
sa.Column("input_placeholder", sa.String(length=300), nullable=True),
|
|
sa.Column("footer_text", sa.String(length=300), nullable=True),
|
|
sa.Column("bg", sa.String(length=7), nullable=True),
|
|
sa.Column("surface", sa.String(length=7), nullable=True),
|
|
sa.Column("ink", sa.String(length=7), nullable=True),
|
|
sa.Column("ink_soft", sa.String(length=7), nullable=True),
|
|
sa.Column("line", sa.String(length=7), nullable=True),
|
|
sa.Column("brand", sa.String(length=7), nullable=True),
|
|
sa.Column("brand_soft", sa.String(length=7), nullable=True),
|
|
sa.Column("brand_ink", sa.String(length=7), nullable=True),
|
|
sa.PrimaryKeyConstraint("id"),
|
|
)
|
|
|
|
|
|
def downgrade() -> None:
|
|
# Safe order: the table is the only 0014 artefact — dropping it
|
|
# leaves 0013's schema byte-identical (A13, fully reversible).
|
|
op.drop_table("ui_settings")
|