docs: design plan for removing vault sync (#203) - #204
Merged
Conversation
Design for issue #203. Deletes the Mac-side HTTP bridge (src/sync, settingsActions, bridge settings screen and fields) while keeping src/interop and src/export intact for the future Excel backup work. Key decisions: - sync_status is undeclared at schema v4, not physically dropped: WatermelonDB 0.28 has no column-removal step and its docs recommend leaving unused columns in place. unsafeExecuteSql rejected (undocumented transaction semantics, ignored by the LokiJS web adapter). - The 'bridge_settings' storage key is NOT renamed; it also holds the AI keys and onboarding state. - Four phases, each leaving main green. Phase 1 is hand-audited because onCompleteSession reaches sync through a dynamic import tsc cannot see. - AI Coach becomes the sole routine-authoring path; accepted explicitly. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
drothschild
marked this pull request as ready for review
August 7, 2026 16:18
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.
Design plan for #203. No code changes — this PR is the design document only.
What this designs
Removal of the Mac-side HTTP bridge:
src/sync/,src/helpers/settingsActions.ts, the bridge settings screen, thebaseUrl/tokensettings fields, and thesync_statuscolumn.src/interop(markdown contract) andsrc/export(on-device export, currently wired to no UI) are deliberately kept so the planned Excel backup work has a serializer to build on.Decisions worth reviewing
Schema —
sync_statusis undeclared, not dropped. WatermelonDB 0.28 ships no column-removal step; the official docs call deleting columns "not yet implemented" (destroyColumnmerged in Nozbe/WatermelonDB#1799 but has not shipped). Guidance is to leave the physical column and omit it fromappSchema. The plan bumps to v4 with{ toVersion: 4, steps: [] }— verified against the installedschemaMigrationssource that an empty steps array validates.unsafeExecuteSql('ALTER TABLE ... DROP COLUMN')was considered and rejected: transaction guarantees for raw SQL in migrations are undocumented (Nozbe/WatermelonDB#1835 is unanswered by maintainers), and the LokiJS adapter behindadapter.web.tsignores SQL steps, so the platforms would diverge. The gain would be cosmetic.The
'bridge_settings'storage key must not be renamed. That blob also holdsanthropicKey,openaiKey, andonboardingState. Renaming it orphans every existing API key. The TypeScript type may be renamed; the on-disk key may not.Phase 1 is hand-audited, not compiler-driven.
onCompleteSessionreaches sync through a dynamicawait import('@/sync/syncService'), whichtsccannot see. Deleting the module without editingactiveSession.tsfirst fails at session completion, not at build. That is why de-wiring is its own phase ahead of deletion.Three responsibilities become solitary. AGENTS.md documents the zero-total
targetSetsdefaulting and thenull → undefinednormalization as redundant two-layer defenses. DeletingsyncService.tsremoves layer 1 of each — including the tests that prove the rule. Phase 2 confirmsupsertRoutine's own coverage before removing its twin, and Phase 4 rewrites the AGENTS.md passages that still claim redundancy.Accepted consequences
Structure
4 phases, each independently mergeable with
npm testandtsc --noEmitgreen. 30 acceptance criteria across 6 groups, each mapped to the phase that covers it.Closes nothing on its own — implementation follows in a separate PR.
🤖 Generated with Claude Code