refactor(design): retire /design — a surface that could only inspect itself
CI & Build / Python lint (push) Successful in 3s
CI & Build / Plugin hooks (push) Successful in 9s
CI & Build / integration (push) Successful in 29s
CI & Build / TypeScript typecheck (push) Successful in 33s
CI & Build / Python tests (push) Successful in 59s
CI & Build / Build & push image (push) Successful in 40s
CI & Build / Python lint (push) Successful in 3s
CI & Build / Plugin hooks (push) Successful in 9s
CI & Build / integration (push) Successful in 29s
CI & Build / TypeScript typecheck (push) Successful in 33s
CI & Build / Python tests (push) Successful in 59s
CI & Build / Build & push image (push) Successful in 40s
The design surface is for the projects an install tracks. /design read the running app's own stylesheet — names out of a bundled theme.css, values out of getComputedStyle(document.documentElement) — so it could only ever describe the instance serving the page. Scribe is one project among the projects Scribe tracks; it gets no view hardcoded into every install. The mechanism that makes this a tool rather than a mirror already existed and already covers Scribe: scripts/check_design_tokens.py runs in CI against a sheet path it knows nothing about, using check_code_against_tokens — the same engine behind check_snippets_against_system. /design was redundant even here. Removed: DesignView, DesignTabs (nothing left to tab between), api/design.ts, routes/design.py and its blueprint, the /design route, ui_design_system() and its setting, and the Settings picker that designated "this app's UI". utils/designTokens.ts and utils/designDrift.ts go with it — between them they were the browser-reading half. What survives is utils/designValues.ts, which works on a record rather than a document: valueForMode, modesPresent, and resolveDeclared. resolveDeclared gained real isolation in the move. Custom properties inherit and `all: initial` does not reset them, so a probe sitting in this page would resolve any reference a record leaves undeclared against the SURROUNDING app's tokens — previewing another project's system would quietly borrow this one's palette wherever that system was incomplete, and a token already reported under unknown_refs would render as though it were fine. Undeclared references are now blanked on the probe first, so they resolve to nothing, which is what the record says they are. Migration 0075 absorbs ui_design_system_id alongside design_rulebook_id rather than an 0076 undoing it: 0075 has not run anywhere, since dev is unmerged and deploys come from main. Both keys named a design source for the running install, and a project already carries its own pointer. This retires the agreement panel shipped yesterday. It asked whether the sheet was actually loaded and applied — the one question a record cannot answer about itself — but only ever about the app you are already inside. Nothing replaces it; recorded in #2430 rather than quietly dropped. Step 1 of milestone #274. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UaYUaouG9jjhATyuxCKrQs
This commit is contained in:
@@ -1,55 +0,0 @@
|
||||
"""The /api/design blueprint — this install's UI, not the design-system record.
|
||||
|
||||
Modelled on tests/test_routes_design_systems.py. The URL enumeration is
|
||||
deliberate rather than a pattern match: this blueprint was repointed from
|
||||
`/expectations` to `/ui-system` (#2419), and the failure worth catching is the
|
||||
old rule surviving the change — a route nothing serves any more, answering with
|
||||
whatever the last handler registered on it did.
|
||||
"""
|
||||
import inspect
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
def test_design_blueprint_registered():
|
||||
from scribe.routes.design import design_bp
|
||||
assert design_bp.name == "design"
|
||||
assert design_bp.url_prefix == "/api/design"
|
||||
|
||||
|
||||
def test_design_blueprint_registered_in_app():
|
||||
from scribe.app import create_app
|
||||
app = create_app()
|
||||
assert "design" in app.blueprints
|
||||
|
||||
|
||||
def test_the_blueprint_serves_exactly_one_rule():
|
||||
from scribe.app import create_app
|
||||
app = create_app()
|
||||
rules = {
|
||||
str(r.rule) for r in app.url_map.iter_rules()
|
||||
if r.endpoint.startswith("design.")
|
||||
}
|
||||
assert rules == {"/api/design/ui-system"}
|
||||
|
||||
|
||||
def test_the_designation_reader_takes_user_id():
|
||||
"""The setting is per-user, so the read must be too (rule #78). A
|
||||
module-level or admin-scoped read would hand one user another's designation."""
|
||||
from scribe.services import design_systems as svc
|
||||
assert "user_id" in inspect.signature(svc.ui_design_system).parameters
|
||||
|
||||
|
||||
def test_the_setting_key_is_the_new_one():
|
||||
"""Named explicitly because the panel silently reading a retired key is the
|
||||
exact shape of the bug this replaced: a feature that renders, and reports
|
||||
nothing, forever."""
|
||||
from scribe.services.design_systems import UI_DESIGN_SYSTEM_SETTING
|
||||
assert UI_DESIGN_SYSTEM_SETTING == "ui_design_system_id"
|
||||
|
||||
|
||||
def test_the_rulebook_expectation_extractor_is_gone():
|
||||
"""It was retired with the rulebook it parsed (#2288, #2419). Left importable
|
||||
it would keep looking like a live path to the next reader."""
|
||||
with pytest.raises(ModuleNotFoundError):
|
||||
import scribe.services.design_rulebook_import # noqa: F401
|
||||
Reference in New Issue
Block a user