Repository navigation
Scope theme-contract requirements: pixels binds the fleet, runtime hooks bind Spark - #71
Conversation
…n copy Every requirement in theme-contract.json now carries a required `scope`. `fleet` binds every Spark-derived store theme; `spark` binds Spark's own working copy only. check-theme-contract.py validates the field, enforces only fleet rules by default for a live theme (--store/--theme-id) and all rules by default for a working copy (--root), and takes --scope to override either. The gate's output names the scope and how many requirements ran, and a scope that selects nothing refuses rather than passing. `pixels` is the only fleet rule. The four runtime hooks #66 added (cart-badge, mobile-nav-toggle, mobile-nav, cart-drawer) are scoped to Spark: the first fleet sweep reported nine of thirteen live themes failing mobile-nav on the file rule while four of them served #mobile-nav from another file. Derived themes are forks; a file-location rule against the fleet reports forks, not faults. Tests cover both defaults, both overrides, the load errors, the empty selection, the block-override rule at fleet scope, and the exact invocation the next-mind fleet sweep makes, against a stub admin API that rejects the wrong path or key.
theme-contract.md lists all five rules with their scope, explains why the runtime hooks bind Spark only, states the rule for promoting one to fleet, and shows the command for a fork's working copy, a derived live theme, and Spark's own copy on a dev store. The Makefile contract target's comment says the same.
Unreleased entry for the scope field. TODOs for the three findings the pre-landing adversarial pass surfaced and this change does not take on: HTML-comment masking in the needle search, live-check transport hardening, and the fleet sweep passing --scope fleet explicitly. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Reviewed all 7 changed files against the PR's stated scope (split Walked every changed file and the test file (10 new tests cover scope load errors, both defaults, both overrides, empty-selection refusal, block-override at fleet scope, the exact next-mind fleet-sweep invocation, and stderr shape) and confirmed:
The three concerns the author flagged and deferred in Files Reviewed (7 files)
Reviewed by minimax-m3 · Input: 0 · Output: 0 · Cached: 0 |
Summary
Scopes the theme contract so
pixelsis the only rule that binds Spark-derived themes, and the four runtime hooks #66 added bind Spark's own copy only.Contract scope
theme-contract.jsonrequirement now carries a requiredscope:fleet(every Spark-derived store theme) orspark(Spark's own working copy). A missing, empty, or unknown scope is a load error, never a default.scripts/check-theme-contract.pyenforces it: a live check (--store+--theme-id) defaults to fleet rules, a working-copy check (--root, CI,make contract) defaults to all rules, and--scope fleet|sparkoverrides either. The output names the scope and how many requirements ran (fleet scope, 1 of 5 requirement(s)), and a scope that selects nothing refuses rather than passing.Docs
docs/theme-contract.mdlists all five rules with their scope, explains the two scopes and the rule for promoting one tofleet, and shows the command for a fork's working copy (--scope fleet), a derived live theme (default), and Spark's own copy on a dev store (--scope spark). The Makefilecontractcomment says the same.Bookkeeping
CHANGELOG.mdUnreleased entry (no version bump: Spark moves its version only in release PRs).TODOS.md: mask HTML comments in the checker's needle search (P1), so a commented-out{% pixels %}cannot pass.Tests
tests/test_theme_contract.py23 → 33 tests: scope load errors (missing / empty / unknown / wrong case), both defaults, both overrides, empty-selection refusal, fleet-scope checks local and remote, spark-only files absent on a live theme, and report lines carrying scope and count. The remote tests use a stub admin API that rejects the wrong path or key, so a URL or header regression fails instead of passing.Test plan
python3 -m unittest discover -s tests: 128 tests OKmake verify-theme: css-check + tests + contract gate passed (spark scope, 5 of 5 requirement(s))python3 scripts/check-templates.py/check-settings-parity.py: both CI gates pass🤖 Generated with Claude Code