Skip to content

feat: opt-in auto-tag on download, marked as AI (P13c-2)#143

Merged
blokzdev merged 1 commit into
mainfrom
claude/p13c2-auto-tag
Jun 3, 2026
Merged

feat: opt-in auto-tag on download, marked as AI (P13c-2)#143
blokzdev merged 1 commit into
mainfrom
claude/p13c2-auto-tag

Conversation

@blokzdev
Copy link
Copy Markdown
Owner

@blokzdev blokzdev commented Jun 2, 2026

What & why

Follow-up to P13c: optionally apply LLM tags to new downloads in the background, opt-in (default off). Because tags are user-curated (they drive facets), auto-applied tags are marked as AI — provenance + a ✦ marker, deletable — rather than silently mixed in (the apply model you chose). Mirrors the P13a-2/P13b-3 queue pattern + reuses all of P13c's tag logic.

Changes

  • Schema v12→v13: MediaTags.source (default 'user'); addTagToItem(…, {source})insertOrIgnore keeps an existing link's source, so a user tag is never demoted to 'ai'; watchAiTagNamesForItem + aiTagNamesForItemProvider. The v13 migration guards the addColumn with a table-existence check (mirrors the existing v8 guard-add pattern) so partial older migration-test DBs don't break.
  • Settings: autoTagOnDownload (default off) + setter; _AutoTagTile in the generation card.
  • Queue (_persistCompleted, after the auto-OCR block): a pure autoTagDecision (skip/needsModel/tag) gates per item; build source from title + description/transcript/ocrTextbuildTagPromptgenerateparseTagSuggestions(exclude: applied)addTagToItem(source: 'ai'); tagCount/tagNeedsModel → an ai inbox entry ("N tags added") or a "finish setup" nudge.
  • Marking: editor + item-detail tag chips show auto_awesome_outlined on AI-sourced tags; AI tags still appear as normal search facets (the benefit).

Tests

dart format clean · flutter analyze No issues · flutter test 824 passedautoTagDecision, repo provenance (only-AI set; user not demoted), the v12→v13 migration, settings round-trip, and queue cases (applied as 'ai' + an ai entry; default-off no-op).

Honest notes

  • Owed APK spot-check (VERIFICATION → P13c-2): real download → sensible AI-marked tags applied + an inbox entry, offline; they appear as facets; deleting an AI tag works; default-off / no-model behave. Native generation can't be CI-tested.
  • A real regression caught before merge: the new aiTagNamesForItemProvider (a live Drift watch stream) made _TagsRow/_TagsEditor leak a query Timer in widget tests that don't stub it → 15 item-detail/editor tests failed. I added the finite Stream.value({}) override to every affected ProviderScope (the same pattern those tests already use for tagsForItemProvider). Worth flagging because a | tail pipe initially masked the failing exit code — I re-ran without the pipe to confirm.
  • The defensive table-guard in the v13 migration is production-harmless (media_tags always exists) and consistent with the codebase's existing addColumnIfMissing guard for schema drift.
  • Deferred (BACKLOG): a library "hide/filter AI tags" facet and promoting an AI tag to 'user' on manual re-add.

This closes the auto-tag follow-up. Next up: P13d — local GraphRAG "Ask your library" (the flagship).

https://claude.ai/code/session_013JoYmLCosYt5tQ8qwdbL1T


Generated by Claude Code

Follow-up to P13c: optionally apply LLM tags to new downloads in the
background, opt-in (default off). Because tags are user-curated (they drive
facets), auto-applied tags are marked as AI (provenance + a ✦ marker,
deletable) rather than silently mixed in.

- Schema v12→v13: MediaTags.source (default 'user'); addTagToItem(…,
  {source}) — insertOrIgnore keeps an existing link's source, so user tags
  are never demoted; watchAiTagNamesForItem + aiTagNamesForItemProvider. The
  v13 migration guards the addColumn with a table-existence check (mirrors
  the v8 guard-add spirit) so partial older test DBs don't break.
- Settings: autoTagOnDownload (default off) + setter; _AutoTagTile in the
  generation card.
- Pure autoTagDecision (skip/needsModel/tag). Queue _persistCompleted (after
  auto-OCR): build source from title + description/transcript/ocrText →
  buildTagPrompt → generate → parseTagSuggestions (exclude applied) →
  addTagToItem(source:'ai'); tagCount/tagNeedsModel + an `ai` inbox entry or
  a "finish setup" nudge.
- Marking: editor + item-detail tag chips show auto_awesome_outlined on
  AI-sourced tags (via aiTagNamesForItemProvider); AI tags still feed facets.
- Tests: autoTagDecision, repo provenance (only-ai set; user not demoted),
  v12→v13 migration, settings round-trip, queue (applied as 'ai' + entry;
  default-off no-op); add the new stream provider to the item-detail/editor
  test overrides (finite stub).
- Docs: P13-PLAN P13c-2 status, VERIFICATION P13c-2, BACKLOG ("hide AI tags"
  facet). No deps.

https://claude.ai/code/session_013JoYmLCosYt5tQ8qwdbL1T
@blokzdev blokzdev merged commit e1f49d0 into main Jun 3, 2026
1 check passed
@blokzdev blokzdev deleted the claude/p13c2-auto-tag branch June 3, 2026 01:47
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