chore(sidekick): remove the dead StandalonePreferences.apply_tokens() - #4474
Conversation
`apply_tokens()` imported `shared.python.theme.sidekick_tokens` for `COLOR_TOKEN_MAP` and `DEFAULT_SIDEKICK_TOKENS`. That module has never existed in Tools under that spelling or the former bare `theme.` one, and neither name is defined anywhere in `src/`, so every call raised `ModuleNotFoundError`. The method had no callers and no tests here, and none in UpstreamDrift or Gasification_Model. The preceding commit canonicalized the import spelling and documented the defect in a `.. warning::` block rather than silently "fixing" it, leaving the disposition to be tracked separately. This is that follow-up. Removed rather than reimplemented, for three reasons: - It is a duplicate, not a capability. The exact algorithm already exists and is importable as `sidekick_tokens_from_theme()` in UpstreamDrift's `src/shared/python/theme/sidekick_tokens.py` — the module `apply_tokens()` was written against, which was never synchronized into Tools despite that file's own "canonical changes must be made in the Tools repository" header. Deleting the broken copy removes a DRY violation. - The obvious reimplementation target does not fit the documented contract. `sidekick.ui.design_tokens.get_token_dict()` returns flat `@color_*` / `@spacing_*` / `@radius_*` QSS placeholders selected by theme *name*; the docstring specifies the `sidekick.color.*` namespace mapped from a caller-supplied `theme_colors` dict. Rebuilding on it would keep the name while changing the meaning, with no consumer to validate against. - Theme-token mapping is not a preferences concern. The method never touched `self`, and `sidekick/ui/design_tokens.py` already owns this. Not a downstream break: a name that cannot be called without raising is not in use. Removal turns `ModuleNotFoundError` into `AttributeError`. UpstreamDrift's tracked shadow copy at `src/shared/python/sidekick/standalone/preferences.py` is unaffected and still resolves the import locally; `vendor/ud-tools` picks this up on the next bump. The `tests/sidekick_api_baseline.json` entry was edited in place instead of regenerated via `--regenerate-api-baseline`. Regeneration is not safe here: `tests/test_sidekick_public_api_stability.py` is already red against this branch's base with 43 unrelated signature drifts across `api/`, `process_calculators/`, `selected_tab_panel.py`, `tab_context_menu.py` and `ui/tools_sidebar/`, which a regeneration would silently bless, and its `json.dump` serializer also reorders every top-level key (~9.3k lines of churn). That staleness is pre-existing and left untouched. Verified: `tests/unit/sidekick/test_standalone_public_api_baseline.py` (10 passed, `standalone/preferences.py` included), `tests/unit/sidekick/test_standalone_runtime.py` (7 passed), `tests/architecture/` (64 passed), and `ruff check` / `ruff format --check` at the CI-pinned 0.14.10. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
💡 Codex ReviewLine 1733 in 0e054cb This deliberately removes a baseline-advertised public method without the deprecation path or downstream coordination required by AGENTS.md reference: AGENTS.md:L122-L127 ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
1d3d7ea
into
fix/architecture-guards-always-on
Stacked on #4469 — base is
fix/architecture-guards-always-on, notmain. That PR canonicalized this method's import spelling and documented the defect in a.. warning::block rather than silently "fixing" it, deferring the disposition. This is that follow-up, and it removes the warning block along with the method it describes.What was wrong
StandalonePreferences.apply_tokens()importedshared.python.theme.sidekick_tokensforCOLOR_TOKEN_MAPandDEFAULT_SIDEKICK_TOKENS. That module has never existed in Tools under that spelling or the former baretheme.one, and neither name is defined anywhere insrc/, so every call raisedModuleNotFoundError. Zero callers, zero tests.Why removed rather than reimplemented
sidekick_tokens_from_theme()in UpstreamDrift'ssrc/shared/python/theme/sidekick_tokens.py— the very module this method was written against. That file carries a "canonical changes must be made in the Tools repository" header, but it was never actually synchronized here; that is the root cause. Deleting the broken copy removes a DRY violation rather than a feature.sidekick.ui.design_tokens.get_token_dict()returns flat@color_*/@spacing_*/@radius_*QSS placeholders selected by theme name. The docstring specifies thesidekick.color.*namespace mapped from a caller-suppliedtheme_colorsdict. Rebuilding on it would keep the name while changing the meaning, with no consumer to validate against — the "silent fix" fix(ci): run tests/architecture/ guards on every PR, and fix the four they were hiding #4469 deliberately avoided.self;sidekick/ui/design_tokens.pyalready owns this.Public-API contract
tests/sidekick_api_baseline.jsonis updated. Per the CLAUDE.md policy on removing a public name:No downstream migration issues filed, deliberately. A name that cannot be called without raising is not in use — removal turns
ModuleNotFoundErrorintoAttributeError. Verified no callers in UpstreamDrift or Gasification_Model. UpstreamDrift's tracked shadow copy atsrc/shared/python/sidekick/standalone/preferences.pyis unaffected and still resolves the import locally;vendor/ud-toolspicks this change up on the next bump.The baseline entry was edited in place, not regenerated. Running the documented
--regenerate-api-baselineflow is not safe on this branch:tests/test_sidekick_public_api_stability.pyis already red against this branch's base, with 43 unrelated signature drifts acrossapi/,process_calculators/,selected_tab_panel.py,tab_context_menu.pyandui/tools_sidebar/. A regeneration would silently bless all of them.json.dumpserializer also reorders every top-level key (__init__.pynow sorts before__main__.py) and drops prettier's formatting, producing ~9.3k lines of churn to delete one 18-line block.The surgical edit yields a 17-line deletion, stays prettier-clean, and the order-independent comparison in the test is unaffected. That baseline staleness is pre-existing and is not addressed here — it deserves its own issue, since it currently makes the documented regeneration workflow a trap.
Verification
tests/unit/sidekick/test_standalone_public_api_baseline.pystandalone/preferences.py)tests/unit/sidekick/test_standalone_runtime.pytests/architecture/ruff check/ruff format --check@ CI-pinned 0.14.10prettier@3.1.0 --checkon SPEC.md + baselineSPEC.md §12 row added (1.5.7, 2026-08-14).
🤖 Generated with Claude Code