Skip to content

Delete dead Pro residue: sync:* log listeners and the Recovered Items seed script - #3373

Merged
mstomar125 merged 2 commits into
mainfrom
issue-3328-pro-residue-cleanup
Sep 30, 2026
Merged

mstomar125 merged 2 commits into
mainfrom
issue-3328-pro-residue-cleanup

Conversation

@mstomar125

Copy link
Copy Markdown
Contributor

Closes #3328

Summary

  • Delete the log-only sync:error and sync:status listeners (and their comments) from initializeTauriSyncListeners() in tauri-sync-listener.ts.
    • Nothing emits sync:error.
    • sync:status is emitted only by the Pro command layer with {state, detail, user_email, database_id}. The listener read payload.status / payload.reason, so it always logged Sync status: undefined.
    • The Pro sync store keeps its own sync:status listener, so the Pro app loses nothing.
  • Update tauri-sync-listener.test.ts: drop the two sync:* registration assertions and the two log-only tests (should handle sync:error events, should handle sync:status events). The registration test is not turned into an absence assertion, so no quoted sync:* name comes back.
  • git rm scripts/seed-recovered-item.ts, a dev script for a Recovered Items UI core no longer has. Nothing references it (rg seed-recovered-item finds nothing outside .claude).

Ratchet (#3299)

scripts/check-pro-boundary.ts is not on origin/main yet, so BASELINES cannot be lowered in this PR. I ran #3299's committed script (branch worktree-issue-3299-pro-boundary-ratchet @ 99caa1d) against this tree as a temporary, uncommitted copy. Its counts against that branch's baselines:

marker baseline after this PR delta
proEvents 87 81 -6
proWording 314 312 -2
cloudWording 89 88 -1

All other markers are unchanged. These match the issue's expected numbers exactly.

Whichever of this PR and #3299 lands second must lower BASELINES to these values (the check fails when a count drops below its baseline).

Leftover search

rg "'sync:(error|status)'" packages/desktop-app/src still finds only files other issues own: stores/pro-sync.svelte.ts and tests/stores/pro-sync*.test.ts (#3332), add-synced-database-dialog.svelte and its test (#3326).

Testing

  • bun run --cwd packages/desktop-app test src/tests/services/tauri-sync-listener.test.ts: 50 passed.
  • bun run test:changed: frontend, scripts and browser tiers passed (rust and skill tiers skipped, nothing reaches them).
  • bun run quality:scripts:check and bun run --cwd packages/desktop-app quality:fix: clean (0 errors, 0 warnings).
  • No new tests: this PR only deletes code and tests, so there is nothing to mutation-check.

🤖 Generated with Claude Code

@mstomar125

Copy link
Copy Markdown
Contributor Author

Automated pragmatic-code-review (initial review, medium)

PR #3373, closes #3328. Diff: 3 files, 201 deletions, 0 additions.

Acceptance criteria (#3328)

  • tauri-sync-listener.ts registers no sync:error / sync:status listener. The only listen( calls left are node:created/updated/deleted and relationship:created/updated/deleted. log.info('Real-time sync listeners initialized successfully') and the burst coalescing are untouched.
  • Registration test (Environment Detection) no longer lists sync:*, and it was not turned into an absence assertion. The two log-only tests are gone.
  • scripts/seed-recovered-item.ts is deleted. rg -n seed-recovered-item . -g '!node_modules' -g '!target' -g '!.claude' -g '!.git' finds nothing. No package.json, workflow or doc references it, and scripts/tsconfig.json globs **/*.ts, so nothing pinned the file by name.
  • Step 4 leftover search: rg "'sync:(error|status)'" packages/desktop-app/src finds only stores/pro-sync.svelte.ts:482 (Delete the Pro sync store, consent and relogin modals, and the Pro variant machine #3332), add-synced-database-dialog.svelte:168 (Delete the Add synced database dialog and tenant badge from Database settings #3326), tests/components/add-synced-database-dialog.test.ts:183 (Delete the Add synced database dialog and tenant badge from Database settings #3326) and tests/stores/pro-sync*.test.ts (Delete the Pro sync store, consent and relogin modals, and the Pro variant machine #3332). All owned by other issues, as expected. sync:error appears nowhere in the repo now, which matches "nothing emits it".
  • BASELINES lowered in scripts/check-pro-boundary.ts: not done, and it can't be. The file does not exist on origin/main (checked). See below.
  • Tests: I re-ran bun run --cwd packages/desktop-app test src/tests/services/tauri-sync-listener.test.ts and got 50 passed. The PR body reports the test:changed, quality:scripts:check and quality:fix results as clean.

On the BASELINES deviation

Reasonable, and I would not block on it. It is forced: #3299's ratchet is not on main, so there is nothing to edit. The PR body documents the exact deltas (proEvents -6, proWording -2, cloudWording -1), and they match the issue's expected numbers. It also states the hand-off rule (whichever PR lands second lowers BASELINES). The ratchet fails when a count drops below its baseline, so a wrong ordering is caught by CI instead of drifting silently. The one thing to make sure of is that this hand-off is tracked on #3299, so that PR's author (or the merge gate) applies it. That is a process point, not a code change here.

Dependency check (nothing else relied on the deleted code)

  • Rust / dev-proxy: nothing emits sync:error. sync:status is emitted only from src-tauri/src/commands/pro_sync.rs (lines 202 and 249), and the Pro store and settings dialog have their own listeners. No dev-proxy code references either event.
  • Teardown path: initializeTauriSyncListeners() discards the listen() return values. There is no unlisten list or counter to go stale, and resetNodeFetchCoalescer / resetRelationshipCoalescer are unrelated to the removed listeners.
  • Test helpers: the only listener-count assertion is mockEventListeners.size toBe(0) (test line 186, non-Tauri branch), which is unaffected. No other suite asserts a listen call count against this module. import-service.test.ts toHaveBeenCalledTimes(1) is a different module. free-user-guardrail.test.ts and other importers only call initializeTauriSyncListeners.
  • Unused imports / variables: none introduced. The removed handlers used only log and listen, both still used elsewhere in the file. The test file's emitTauriEvent helper is still used throughout, so there are no orphaned helpers.
  • Types: no SyncError/SyncStatus payload types existed in event-types.ts to orphan.

Scope and tidiness

  • Only the three intended files changed. The one-blank-line cleanup left }); / blank / log.info(...) intact, with no double blank lines. The diff adds no lines.
  • CLAUDE.md standards: no lint suppression added, no issue numbers in comments, nothing new using console.*. The deleted script was a one-off and its deletion follows the "delete one-off scripts" rule.
  • describe('Error Handling') still makes sense: what remains are the two graceful-degradation tests (failed getNode fetch, getNode returns null), and its beforeEach init is still needed by both.

Findings

  • [Nit] packages/desktop-app/src/lib/services/tauri-sync-listener.ts:367: the JSDoc for initializeTauriSyncListeners says "Sets up listeners for logging/debugging sync events." That was already loose (the node and relationship handlers mutate stores), and with the last log-only listeners gone it is now plainly wrong. Optional one-line rewording (for example "Sets up listeners that apply backend node and relationship domain events to the frontend stores."). Non-blocking, and reasonably outside the issue's literal "leave the rest untouched" scope, so fine to defer or fold in.

No Critical/Blocker or Improvement findings.

Recommendation: APPROVE

Clean, minimal, pure deletion. Every acceptance criterion is met except the BASELINES edit, which is impossible until #3299 lands and is documented with exact numbers and a hand-off rule.

@mstomar125 mstomar125 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated pragmatic-code-review: APPROVE (posted as a comment - GitHub blocks self-approval). Full findings in the review comment above.

@mstomar125

Copy link
Copy Markdown
Contributor Author

Address-review summary (PR #3373)

Review verdict: APPROVE, 0 Critical, 0 Improvement, 1 Nit.

  • Addressed (1): the JSDoc on initializeTauriSyncListeners() still called the handlers "logging/debugging sync events" listeners. With the log-only sync:* listeners gone, every remaining handler mutates stores, so it now reads "Registers listeners for backend node and relationship events and applies them to the frontend stores." Comment-only, no logic change.
  • Skipped (0).
  • Not addressable here: the review's BASELINES note. scripts/check-pro-boundary.ts is still not on origin/main (re-checked before the final push), so the baseline edit stays a hand-off. Whichever of this PR and Add the Pro-boundary ratchet check and the CLAUDE.md Pro/sync placement rule #3299 lands second lowers proEvents 87 to 81, proWording 314 to 312 and cloudWording 89 to 88.

Checks after the fix: quality:fix clean (0 errors, 0 warnings), tauri-sync-listener.test.ts 50 passed.

Re-Review Decision

Decision: NO RE-REVIEW NEEDED

Rationale: The only change since the review is a one-line comment reword. No logic, tests or scripts changed.

mstomar125 and others added 2 commits September 30, 2026 11:55
… seed script (closes #3328)

Remove the log-only sync:error and sync:status listeners from
initializeTauriSyncListeners(), with the registration assertions and the two
log-only tests that covered them. Nothing emits sync:error, and the sync:status
listener read fields the Pro emitter never sends, so it logged "undefined".

Delete scripts/seed-recovered-item.ts, a dev script for a Recovered Items UI
that core no longer has.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
The doc called these "logging/debugging sync events" listeners. With the
log-only sync:* listeners gone, every remaining handler mutates stores, so
say what they actually do.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
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.

Delete dead Pro residue: sync:* log listeners and the Recovered Items seed script

1 participant