Files
brain-of-reese/alembic/versions/0016_ui_settings_semantic.py
ducoterra 9188be259b
Build and Push Containers / build-and-push-app (push) Successful in 1m56s
Build and Push Containers / build-and-push-db (push) Successful in 11s
phase: 93_theme_semantic_completion
All verification is complete. Final report:

**Phase 93 — Theme semantic completion: FINAL VERIFICATION PASS — ALL GREEN**

- Verified full implementation in tree: migration `0016` (8 nullable semantic columns, applied at head), 17-var `BUILTIN_COLORS`/`COLOR_FIELDS`/`effective_settings`, API validation, `#view-theme` State-colors fieldset (17 pickers), `theme.js` FIELDS/PAIRS (5→8), `.page-head` surface panel (6 shell views + doc-edit + shared.html; login card / document sticky header audited as already-surfaced), mock_llm `content: None` fix
- Fixed 2 pre-existing defects (both fail identically on baseline `d4f38ad`, proven via worktree A/B): `test_nav_rename_sources` — expected nav tail missing the phase-91 "Theme" link; `test_stale_ui_copy` — now truncates `saved_chats` before/after (house `test_suggestion_chips` pattern) so the seed-chip contract is deterministic on the shared dev DB (owner's 22 saved chats triggered phase-80 last-3-questions)
- Tests: `uv run pytest --cov=app --cov-report=term-missing` → **1868 passed, app/ 99%** (>90% ✓); `uv run ruff check .` → clean; `uv run pyright` → **0 errors**
- E2E: dedicated `uv run pytest tests/e2e/test_theme_semantic_completion.py -v --no-cov` → **8/8 in isolation** (all-gray 17-color theme: zero residual color on saved-result/Stale/Revoked/Local/tool-call elements, text labels intact, gray heads non-transparent, pre-paint tag, Reset → byte-identical no-tag); 15 theme/header/nav/responsive suites green in isolation; full 85-file combined run: only the 2 fixed pre-existing failures + 1 combined-run artifact (`test_sync_upload_progress`, green in isolation)
- Completion criteria: (1) monochrome E2E ✓ (2) default byte-identical, no `#bor-theme` tag ✓ (3) all page heads on solid surface ✓ (4) suite/coverage/lint/E2E green ✓ (5) phases 01–92 no behavior change ✓ (6) commit left to harness per protocol
- Notable: cleaned stray uvicorn leftovers from prior implementation pass (owner's `--reload` dev server untouched); no deviations from the phase design
- Next pending phase: `94_ls_tree_drilldown`
2026-09-10 16:43:08 -04:00

63 lines
2.2 KiB
Python

"""ui_settings: the 8 semantic state colors (phase 93, task 01)
Revision ID: 0016
Revises: 0015
Create Date: 2026-09-10
Phase 93 (theme completion — the owner's black/white/gray theme still
leaked color: the green "Theme saved." text, the red Stale/Revoked
pills, the green LOCAL badge, the amber tool-call lines): the three
semantic state families (``--ok-*``, ``--err-*``, ``--accent-*``) join
the storable palette as 8 more tab-controlled variables (17 total —
B3 revised, owner permission 2026-09-10, TODO.md L3; PLAN.md is being
redone by the owner, the decision is recorded in the phase overview).
They flow through the resolver, the pre-paint tag, the CSP hash, and
the admin API exactly like the 9 identity colors (all of those are
``COLOR_FIELDS``-driven — zero logic changes):
* ``ui_settings.ok_bg`` / ``ok_ink`` — VARCHAR(7) NULL ``#rrggbb``
(NULL = the built-ins ``#10241b`` / ``#6ee7a8`` — exact);
* ``ui_settings.err_bg`` / ``err_ink`` / ``err_line`` — VARCHAR(7)
NULL (NULL = ``#2d0a0a`` / ``#fca5a5`` / ``#ef4444`` — exact);
* ``ui_settings.accent_bg`` / ``accent_ink`` / ``accent_line`` —
VARCHAR(7) NULL (NULL = ``#2b2110`` / ``#fbbf24`` / ``#f59e0b`` —
exact).
EIGHT additive, fully reversible columns on the single-row table (A13);
no server defaults (the row is created only by the PUT upsert, house
rule).
"""
from __future__ import annotations
import sqlalchemy as sa
from alembic import op
revision = "0016"
down_revision = "0015"
branch_labels = None
depends_on = None
#: The 8 semantic columns (name, built-in the NULL means) — upgrade
#: adds them in this order, downgrade drops them in reverse.
_SEMANTIC_COLUMNS: tuple[str, ...] = (
"ok_bg", "ok_ink",
"err_bg", "err_ink", "err_line",
"accent_bg", "accent_ink", "accent_line",
)
def upgrade() -> None:
for name in _SEMANTIC_COLUMNS:
op.add_column(
"ui_settings", sa.Column(name, sa.String(length=7), nullable=True)
)
def downgrade() -> None:
# Safe order: the 8 columns are the only 0016 artefacts — dropping
# them (reverse order, for symmetry) leaves 0015's schema
# byte-identical (A13, fully reversible).
for name in reversed(_SEMANTIC_COLUMNS):
op.drop_column("ui_settings", name)