Skip to content

fix: honest first-sync preview count; drop Advanced testing UI#92

Merged
vreshch merged 2 commits into
masterfrom
fix/first-sync-preview-and-drop-advanced
Jul 8, 2026
Merged

fix: honest first-sync preview count; drop Advanced testing UI#92
vreshch merged 2 commits into
masterfrom
fix/first-sync-preview-and-drop-advanced

Conversation

@vreshch

@vreshch vreshch commented Jul 8, 2026

Copy link
Copy Markdown
Member

Two dogfooding UX fixes to the couch-only plugin, one PR.

Fix 1 - honest first-sync preview count (the real bug)

Repro: Sign in, pick a FRESH memory (cloud empty) while the local vault already has notes. The sync-preview popup shows ↑ 0 local change(s) to send, then the first sync pushes everything. The count was a lie.

Root cause: previewSync() returned couchChannel.pendingCount(), which is the failed-push retry queue - always 0 on a fresh pick because no controller is active yet.

Fix: previewSync() now returns the honest outgoing count = local markdown files whose current content-rev is absent-from / differs-from the chosen memory's persisted push-rev cache, plus cached paths deleted locally. On a fresh memory (empty cache) that is every md file.

  • New CouchSync.countOutgoing(vault, state) computes it with no controller and no network (loads the persisted couch-state for the chosen memory, lists vault md files, hashes each once).
  • It reuses contentRevOf(body) - the exact rev pushFile caches (pushFile now derives its skip rev from the same helper) - so the preview count cannot drift from what pushAll actually sends.
  • The firstSync (not-signed-in / no-memory) branch is kept; the modal wording stays "N local change(s) to send" and is now truthful.
Before After
Fresh memory, N local files 0 to send (then pushes N) N to send
After a full sync, nothing changed 0 0
One file edited since last push (retry-queue, ~0) 1
A synced file deleted locally (retry-queue, ~0) 1 (the delete)

Fix 2 - drop the Advanced testing UI (keep the capability)

Removed the "Advanced" toggle + the "Site host" dev-override field from the shipped settings page (plus the now-dead showAdvanced model field, renderHostState, notifyRestartDebounced, pendingSiteFqdn, and hostState).

siteFqdn is kept in the settings model and in host resolution (resolveSiteFqdn / activeSiteFqdn), so a value written directly in data.json still overrides the host on restart - this is the dev/testing lever and it keeps working. Only the on-page editor is gone. (README/CLAUDE.md never documented the field, so no doc change was needed; check:docs/check:hosts stay green.)

Tests

  • Unit: CouchSync.countOutgoing - fresh memory counts every file, 0 after a full sync, counts only changed files, counts a local delete.
  • Integration (headless bootPlugin + fake-couch): fresh memory with 3 local files -> preview reports 3 (not 0) before the first push, 0 after a full sync; firstSync=true when no memory is chosen.

Verify

npm run verify fully green: type-check + lint (0 errors) + format + 116 tests + build + check:hosts/docs/bundle. No version bump.

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown

🎉 PR Validation ✅ PASSED

Commit: 4876590ef31585ddcfd98b4d3f531345a8d4d45f
Branch: fix/first-sync-preview-and-drop-advanced

Checks:

  • ✅ Dependencies installed
  • ✅ Type check passed
  • ✅ Linting passed
  • ✅ Format check passed
  • ✅ Tests + coverage passed
  • ✅ Build successful
  • ✅ Store-compliance checks passed
  • ✅ Bundle is mobile-safe

Ready to merge!


🔗 View workflow run

vreshch added 2 commits July 9, 2026 01:35
Fix 1: previewSync reported pendingCount() (the failed-push retry queue),
which is 0 on a fresh memory pick - so the popup said "0 local change(s)
to send" then first-synced everything. It now reports the honest outgoing
count = local md files whose content-rev differs from the chosen memory's
push-rev cache (every file on a fresh memory), plus locally-deleted cached
paths. Computed offline (no controller, no network) via a shared
CouchSync.countOutgoing that reuses contentRevOf - the exact rev pushFile
caches - so the preview can never drift from what pushAll sends.

Fix 2: remove the Advanced toggle + Site host dev-override field from the
settings page. siteFqdn stays in the model and host resolution, so a value
written directly in data.json still overrides the host on restart (the
dev/testing lever); only the on-page editor is gone.
@vreshch
vreshch force-pushed the fix/first-sync-preview-and-drop-advanced branch from 578aad6 to 4876590 Compare July 8, 2026 23:36
@vreshch
vreshch marked this pull request as ready for review July 8, 2026 23:36
@vreshch
vreshch merged commit 8265716 into master Jul 8, 2026
1 check passed
vreshch added a commit that referenced this pull request Jul 17, 2026
…96)

Reverts #89 (couch-only). Git = default channel for every memory; a memory
the resolution advertises on couch routes to the couch controller (server
decides per memory, future /api/me capabilities gate the paid couch tier).

- src/git/* + sync-controller restored; couch impl stays at master (resilient
  syncNow, missing-leaf abort, pendingCount)
- previewSync routes per channel: git = both-way controller preview, couch =
  honest outgoing count (#92 semantics kept); SyncPreview.incoming optional
- fake router advertises git_endpoint; lifecycle 10 rewritten for dual-channel
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.

1 participant