feat: opt-in auto-tag on download, marked as AI (P13c-2)#143
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
MediaTags.source(default'user');addTagToItem(…, {source})—insertOrIgnorekeeps an existing link's source, so a user tag is never demoted to'ai';watchAiTagNamesForItem+aiTagNamesForItemProvider. The v13 migration guards theaddColumnwith a table-existence check (mirrors the existing v8 guard-add pattern) so partial older migration-test DBs don't break.autoTagOnDownload(default off) + setter;_AutoTagTilein the generation card._persistCompleted, after the auto-OCR block): a pureautoTagDecision(skip/needsModel/tag) gates per item; build source from title + description/transcript/ocrText→buildTagPrompt→generate→parseTagSuggestions(exclude: applied)→addTagToItem(source: 'ai');tagCount/tagNeedsModel→ anaiinbox entry ("N tags added") or a "finish setup" nudge.auto_awesome_outlinedon AI-sourced tags; AI tags still appear as normal search facets (the benefit).Tests
dart formatclean ·flutter analyzeNo issues ·flutter test824 passed —autoTagDecision, repo provenance (only-AI set; user not demoted), the v12→v13 migration, settings round-trip, and queue cases (applied as'ai'+ anaientry; default-off no-op).Honest notes
aiTagNamesForItemProvider(a live Driftwatchstream) made_TagsRow/_TagsEditorleak a query Timer in widget tests that don't stub it → 15 item-detail/editor tests failed. I added the finiteStream.value({})override to every affectedProviderScope(the same pattern those tests already use fortagsForItemProvider). Worth flagging because a| tailpipe initially masked the failing exit code — I re-ran without the pipe to confirm.media_tagsalways exists) and consistent with the codebase's existingaddColumnIfMissingguard for schema drift.'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