Skip to content

fix(research): emit colors on the study category preset - #1441

Merged
ErikBjare merged 1 commit into
ActivityWatch:masterfrom
TimeToBuildBob:fix/research-preset-colors
Sep 9, 2026
Merged

fix(research): emit colors on the study category preset#1441
ErikBjare merged 1 commit into
ActivityWatch:masterfrom
TimeToBuildBob:fix/research-preset-colors

Conversation

@TimeToBuildBob

Copy link
Copy Markdown
Contributor

Problem

The Research Edition web UI ships a research-study category set via
scripts/emit_research_category_preset.pyAW_PRESET_CATEGORY_SETS. The
emitted taxonomy had no data.color, so the Activity view rendered study
categories unstyled (grey) next to the colored built-in default set.

Tracked in #1439 (the companion aw-webui change
stops default from silently winning; this PR is the color half).

What this does

  • Assigns a stable hex color to every study category in CATEGORY_COLORS.
  • build_preset() fails the build if the color table drifts from
    CATEGORY_MAP ∪ APP_CATEGORY_MAP (missing or extra keys).
  • Leaves rule shape unchanged (type / regex / ignore_case only) so the
    oldest pinned web UI parser still accepts the payload.

Tests

python3 -m pytest scripts/tests/test_emit_research_category_preset.py -q — 13 passed.

  • every category has a distinct #RRGGBB color
  • color table matches the study taxonomy exactly
  • existing exact-match / portable-escape / GITHUB_ENV tests still pass

Notes

Does not close #1439 on its own. The Activity view still needs the shipped
preset to be the active set (aw-webui follow-up) and a research recut to
pick both up.

The research-study taxonomy shipped without data.color, so the Activity
view rendered it unstyled. Map every study category to a stable hex
color and fail the build if the table drifts from the watcher map.

ActivityWatch#1439.

Git-Session-Id: d16d
@greptile-apps

greptile-apps Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge, with no concrete correctness, security, or repository-rule issues identified.

Summary

  • Adds a distinct hexadecimal color for all 18 study categories.
  • Emits each color through the category-level data.color field without changing rule metadata.
  • Validates missing and obsolete color entries during preset generation.
  • Adds coverage for color presence, uniqueness, format, and taxonomy alignment.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
    A[CATEGORY_MAP] --> C[Derive taxonomy]
    B[APP_CATEGORY_MAP] --> C
    D[CATEGORY_COLORS] --> E[Validate exact key coverage]
    C --> E
    E --> F[Build research-study preset]
    F --> G[Emit compact JSON]
    G --> H[AW_PRESET_CATEGORY_SETS]
    H --> I[Research Edition web UI]
Loading

@TimeToBuildBob

TimeToBuildBob commented Sep 9, 2026

Copy link
Copy Markdown
Contributor Author

🤖 AI code review

Safe to merge — no P0/P1 findings

Confidence 5/5

No findings. The diff looks correct to me on this pass.

Reviewed d65561452284 · openrouter/deepseek/deepseek-v4-flash-0731 · llm (in-band) engine · 76s · about this reviewer

Maintainer commands

@TimeToBuildBob review (own line) — fresh review · @TimeToBuildBob fix — a worker acts on the findings. Once per comment; 👀 = received.

@ErikBjare
ErikBjare merged commit 25145ce into ActivityWatch:master Sep 9, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Research Edition: category preset conflicts with default set (no selection UI, missing colors)

2 participants