Skip to content

feat(categories): add 'Add on top of mine' option to import dialog - #1071

Merged
ErikBjare merged 2 commits into
ActivityWatch:masterfrom
TimeToBuildBob:feat/import-set-layering
Oct 10, 2026
Merged

ErikBjare merged 2 commits into
ActivityWatch:masterfrom
TimeToBuildBob:feat/import-set-layering

Conversation

@TimeToBuildBob

Copy link
Copy Markdown
Contributor

Deferred follow-up from #1027 (category-set layering, merged 2026-10-07).

When importing a named category set ({id, categories}), the dialog now asks
how to apply it:

  • Use instead of mine — existing behaviour: replaces the active set
  • Add on top of mine — stores the imported set in category_sets and adds
    it to active_set_ids behind the primary set via setActiveSets()

The import path for unnamed exports (bare {categories} blobs) is unchanged.

Changes

  • CategorizationSettings.vue: extract named-set import into a two-option
    modal (showImportModal); onImportReplace() carries the existing logic,
    onImportAddOnTop() calls setActiveSets([primaryId, setId])
  • en.ts: four new keys (importSetTitle, importSetPrompt, importReplace,
    importAddOnTop)
  • categories.test.node.ts: 3 store-level tests for the add-on-top path

Testing

npx jest test/unit/store/categories.test.node.ts --no-coverage
# 24 tests, all pass

@greptile-apps

greptile-apps Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 4/5

[High risk] Dependency updates and category import feature across the codebase.

Fix active-set re-imports before merging; they can save stale imported rules into the user’s primary set.

Findings

  1. P1 Imported updates keep old rules ▶

Summary

Adds a choice when importing a named category set:

  • “Use instead of mine” keeps the existing replacement path.
  • “Add on top of mine” keeps the primary set and activates the imported set alongside it.
  • Adds four English strings and three store-level tests.

Re-importing an active set can copy stale rules into the primary set. Fix the import ordering before merging.

The requested three-dot diff includes earlier changes already present at the supplied base SHA. Those were checked but not reported as new defects.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Import named category set] --> B{User chooses}
  B -->|Use instead of mine| C[Replace or store imported set]
  C --> D[Switch to imported set]
  B -->|Add on top of mine| E[Replace or store imported set]
  E --> F[setActiveSets]
  F --> G[Sync old effective categories into primary]
  G --> H[Rebuild effective categories]
  H --> I[Save category sets and active IDs]
Loading

Reviews (1) · Last reviewed commit: "feat(categories): add 'Add on top of min..." · Reviewed by Greptile

Comment thread src/views/settings/CategorizationSettings.vue Outdated
…dialog

When importing a named category set ({id, categories}), show a modal asking
whether to replace the current primary set (existing behaviour) or layer the
imported set on top via setActiveSets. The second path adds the imported set
to category_sets and appends it to active_set_ids without touching the primary.

Follow-up to ActivityWatch#1027 (category-set layering).

- CategorizationSettings: show import-mode modal; onImportReplace / onImportAddOnTop methods
- en.ts: importSetTitle / importSetPrompt / importReplace / importAddOnTop keys
- categories.test.node.ts: 3 tests for the add-on-top store path

Git-Session-Id: cb77
@TimeToBuildBob
TimeToBuildBob force-pushed the feat/import-set-layering branch from 9a51076 to 95fcb8f Compare October 7, 2026 11:09
Git-Session-Id: 9fd4b778-2238-5ab0-abd8-36b5834c14f7
@TimeToBuildBob

Copy link
Copy Markdown
Contributor Author

The active-set import finding is fixed in 2694033 and its review thread is resolved (27 targeted tests passed in the fix session). On that head, lint and CodeQL have passed; the five build/test checks are still queued, with no reported failures. No additional code change or review retrigger made. Bob cannot self-merge this repository (pull-only access); final review and merge remain with a maintainer once CI completes.

@TimeToBuildBob

TimeToBuildBob commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 AI code review

This PR adds an 'Add on top of mine' option to the category-set import dialog. It introduces a modal in CategorizationSettings.vue that asks the user how to apply a named imported set, with onImportReplace() preserving the old replace behavior and onImportAddOnTop() calling a new store action importSetOnTop(). The store action syncs local edits, handles primary-ID collisions by appending '-imported', and appends the imported set to active_set_ids. New tests cover the add-on-top path in both the component and store test files.

Safe to merge — no P0/P1 findings

Confidence 5/5

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

Files changed (5) — the diff as I read it
  • src/i18n/locales/en.ts — Adds four new i18n keys for the import dialog: importSetTitle, importSetPrompt, importReplace, importAddOnTop.
  • src/stores/categories.ts — Adds importSetOnTop() action that syncs primary set, handles ID collisions, appends set to active_set_ids, and recomputes effective classes.
  • src/views/settings/CategorizationSettings.vue — Adds import modal with two buttons, extracts onImportReplace() from old logic, and adds onImportAddOnTop() that calls the store action.
  • test/unit/categoryImport.test.js — New test file for the component's onImportAddOnTop method, covering re-import, primary-ID collision, and preservation of unsaved edits.
  • test/unit/store/categories.test.node.ts — Adds a describe block with three store-level tests for the add-on-top path via setActiveSets.
Previous review passes
commit score findings engine when
269403328c3b 4/5 1 llm 2026-10-07 13:23 UTC

Reviewed 269403328c3b · openrouter/deepseek/deepseek-v4-flash-0731 · llm engine · 22s · about this reviewer

Maintainer commands

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

Comment thread test/unit/store/categories.test.node.ts
@codecov

codecov Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 64.58%. Comparing base (47377e5) to head (2694033).
⚠️ Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1071      +/-   ##
==========================================
- Coverage   64.58%   64.58%   -0.01%     
==========================================
  Files          55       55              
  Lines        3803     3834      +31     
  Branches      907      911       +4     
==========================================
+ Hits         2456     2476      +20     
- Misses       1332     1343      +11     
  Partials       15       15              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ErikBjare
ErikBjare merged commit f76e1e2 into ActivityWatch:master Oct 10, 2026
8 checks passed
Q-Ze added a commit to Q-Ze/aw-webui that referenced this pull request Oct 10, 2026
Upstream highlights:
- feat: custom date range period (ActivityWatch#1005)
- feat: device selection (all / subset) in Activity view (ActivityWatch#1004)
- feat: category rule priority (ActivityWatch#968)
- feat: layered category sets (ActivityWatch#1027, ActivityWatch#1072)
- feat: always show Year period (ActivityWatch#1003)
- feat: AI summary privacy filter (ActivityWatch#948)
- feat: 'Add on top of mine' import option (ActivityWatch#1071)
- fix: multidevice queries use real bucket IDs (ActivityWatch#969, ActivityWatch#1068)
- fix: timeline hourly bar Y-axis >1h (ActivityWatch#1021)
- fix: CSV streaming export (ActivityWatch#993, ActivityWatch#997)
- fix: Android browser data display (ActivityWatch#1069)
- fix: various mobile/dark-mode/layout improvements

Conflict resolution: took upstream for activity.ts (major refactor),
multidevice.ts (Android support), Activity.vue, TimelineBarChart.vue,
summary.ts. Re-applied our fixes on top:
- query_active_history: bucket_sig cache clearing + per-event interval
  union (dead-watcher marathon immunity)
- query_active_history_multidevice: bucket_sig + period-length cap
- Removed useMultidevice references (upstream removed the setting in
  favour of device-selection UI); our code paths now always aggregate
  across all hosts
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.

2 participants