Second codex stop-gate on `set_color_hex` themed-write routing.
The previous fix (042a62c8) made the write follow resolve's subset
match, but its fallback path still mutated the `theme: None`
default entry when no themed subset matched. That's wrong under a
non-empty active theme: the default is the resolve fallback for
EVERY axis the user hasn't explicitly authored, so mutating it
during a dark-mode edit silently rewrites light + sepia + every
unmapped axis too.
New write rules:
Subset match: → write through that entry.
No subset match + active EMPTY: → write through default
(creating it if absent).
No subset match + active SET: → push a new entry keyed to
active_theme at index 0, so
resolve's first-match walk
picks the new entry under the
active axes. The default and
other-axis entries stay
untouched.
Inserting at the front (not pushing at the end) matters because
resolve uses subset matching: a pre-existing entry whose theme is
a superset of the new one's axes would otherwise win the resolve
walk for active = (its theme + extra axes). Front-insert pins the
new entry's precedence under the active theme it was created
for.
Tests rewired (2 swapped — 288 → 289 shell-core total):
- `set_color_hex_under_active_theme_does_not_clobber_default`
replaces the previous "writes the default" test. Setup:
light entry + None default + active=dark; write under dark
must scope to dark only. Asserts three theme states:
active=dark → reads NEW value
active=sepia → reads ORIGINAL default (untouched)
active=light → reads ORIGINAL light entry (untouched)
Pre-fix this test would have failed on the sepia assertion
because the default would carry the new dark value.
- `set_color_hex_empty_active_theme_targets_default_entry`
confirms the inverse: with active_theme empty, the write
still routes through the default (resolve's fallback in that
state). This is the explicit "edit the universal value" path.
Existing themed-axis test passes unchanged because that case
already had a subset match and never reached the fallback path.
|
||
|---|---|---|
| .. | ||
| anthropic-agent-sdk | ||
| copilot-sdk | ||
| openpencil-app | ||
| openpencil-desktop | ||
| openpencil-shell-core | ||
| openpencil-shell-native | ||
| openpencil-shell-web | ||
| pen-codegen | ||
| pen-core | ||
| pen-engine | ||
| pen-figma | ||
| pen-types | ||
| wasm-libc-shim | ||
| CLAUDE.md | ||