Skip to content

Settings: offer to copy existing captures when the capture library moves#1360

Open
r3dbars wants to merge 1 commit into
mainfrom
claude/agent-fix-7-relocation-migration-pbwyng
Open

Settings: offer to copy existing captures when the capture library moves#1360
r3dbars wants to merge 1 commit into
mainfrom
claude/agent-fix-7-relocation-migration-pbwyng

Conversation

@r3dbars

@r3dbars r3dbars commented Jul 2, 2026

Copy link
Copy Markdown
Owner

Why

Changing the capture library in Settings only rewrites the preference and mcp-directories.json — existing meetings and dictations silently stay in the old folder, where the app, the MCP helper, and any connected agent no longer look. Users believe they moved their library; their history effectively disappears from every agent surface. Found in the agent-surface audit.

Product Impact

  • Affects: meetings / dictation / agent artifacts
  • Lane: agent workflow
  • Why this matters: "my AI can search every conversation I've ever had" breaks the first time someone points the library at their Obsidian vault and their history stays behind.

What changed

  • New Sources/Support/CaptureLibraryMigrationPlanner.swift: pure, FileManager-injected planner — libraryHasCaptures(at:), makePlan(from:to:), copy(_:onProgress:). Enumerates meetings/*.md (incl. .summary.md sidecars), meetings/audio/*_audio/ dirs, and dictations/*.md. Copies never overwrite (skip-with-count on collisions, re-checked at copy time) and never delete originals.
  • TranscriptedSettingsView.swift: when the chosen folder differs and the old library still has captures, a three-way alert — Copy to New Folder (default), Just Switch (states plainly that captures stay in the old folder and agents will only see the new one), Cancel. Destination validated up front so a bad folder fails before a multi-GB copy. The copy runs off the main actor with an inline progress row; on error the pref is not switched and the status names the old path. Successful switches (copy, just-switch, reset-to-default) now signal CaptureLibraryChangeBroadcaster so Home re-resolves.
  • Tests: Tests/CaptureLibraryMigrationPlannerTests.swift (7 suites: detection, plan enumeration, same-folder no-op, collisions at plan and copy time, originals preserved, progress counts, vanished-source error), registered in Tests/FastTests.manifest; planner added to run-tests.sh APP_SOURCES.
  • Sources/Support/CLAUDE.md file list updated.

Deliberately not touched: docs/storage-paths.md wording (owned by #1356; needs a one-line follow-up to mention the copy offer after both merge).

How I checked it

  • scripts/dev/agent-preflight.sh (plus python3 scripts/dev/check-build-source-lists.py, bash -n on both test-runner scripts, manifest/Tests-dir sync check)
  • Selected checks from .agents/test-matrix.ymlSources/** rule
  • bash build.sh --no-open (incl. launch smoke + bundle gate) and bash run-tests.sh (incl. the new planner tests) — run by Swift CI on macOS at this exact head (9b3d282), green: https://github.com/r3dbars/transcripted/actions/runs/28621486036
  • Manual UI pass on a real Mac — the one remaining gap: exercise all three dialog buttons with captures present, confirm Home re-resolves after copy+switch, and capture sanitized dialog/progress screenshots for .agent-review/visuals/. CI proves compile + unit behavior but cannot produce dialog evidence.

Authoring context: written in a Linux session with no local Swift toolchain; build/test verification is the green macOS Swift CI run above.

Risk Review

  • Privacy / local-first behavior reviewed — file copies stay on-disk; analytics event unchanged (no paths sent)
  • Storage path or migration impact reviewed — this PR is that review; originals are never deleted in any path, copies never overwrite
  • Public-facing copy stays concrete and matches current product scope
  • Release/update impact reviewed — none
  • Agent PRs link the issue/workpad and stay draft until human review
  • UI changes include sanitized .agent-review/visuals/ evidence — pending the manual Mac pass above
  • No private transcripts, audio, tokens, personal paths, or customer data are included

Notes

Part of the agent-surface audit series (#1356#1359). Known edge: if the copy succeeds but setCaptureLibraryURL then fails (racing FS change), the user gets the existing folder-error alert with copies already made — harmless (copy-only) but noted. "Just Switch" and reset-to-default now also broadcast a library-wide change so Home refreshes; small intentional behavior addition.

Agent handoff

COORD_DONE: BRIEF | (this PR) | relocation now offers capture copy + honest just-switch | none | none | Swift CI green at head 9b3d282 (build + fast tests) | manual dialog pass + screenshots on a Mac, then mark ready

🤖 Generated with Claude Code

https://claude.ai/code/session_01GuGZaFRmNrqfGPpqf7WH4n

Picking a new capture library folder used to just flip the pref and
rewrite mcp-directories.json, silently stranding every saved meeting
and dictation in the old folder where the app, MCP helper, and agents
no longer look.

Now, when the current library still holds captures, Settings asks
before switching: copy them to the new folder (default, copy-only,
skip-on-collision, originals never deleted), just switch with an
honest note that captures stay behind, or cancel. The copy runs off
the main actor with inline progress/completion status in the Storage
section; on any copy error the pref is not switched and the status
names the old path. Successful switches broadcast a library-wide
change so Home re-resolves.

Decision and copy-plan logic lives in the new
CaptureLibraryMigrationPlanner (Sources/Support/) with fast tests
registered in Tests/FastTests.manifest and the runner's APP_SOURCES.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GuGZaFRmNrqfGPpqf7WH4n
@r3dbars

r3dbars commented Jul 2, 2026

Copy link
Copy Markdown
Owner Author

Merge-room hold: draft plus storage/UI migration proof is incomplete. Live state checked 2026-07-02: head 9b3d2825dba82550bd8d02dd65c7340e5e2c137b, base main, mergeStateStatus=CLEAN, repo-hygiene/build-and-test green, hardware-smokes skipped. This touches Settings and capture-library copy behavior; PR body says Mac build/tests and dialog/progress screenshots/manual pass were not run. Smallest next action: run bash build.sh --no-open + targeted/fast tests on a Mac and add sanitized UI proof.

@r3dbars r3dbars marked this pull request as ready for review July 3, 2026 01:34
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