refactor: delete dead sync worker + entrypoints (keep live sync/dispatch.py)#474
Merged
Conversation
…tch.py) Remove sync/worker.py (LISTEN-loop/SyncWorker/cron process), sync/main.py and sync/__main__.py (python -m sync entrypoint), and their test coverage (tests/sync/test_worker.py). This process's own docstring confirmed it's absent from prod supervisord config since Phase F moved Google Calendar push notifications to inline FastAPI BackgroundTasks. sync/dispatch.py is intentionally KEPT: it's live-imported by api/routes/integrations.py (dispatch_sync, called on manual-sync trigger and initial_sync_and_register) and has real test coverage in tests/api/test_integrations.py. Deleting it would break the API process. Migration d2e3f4a5b6c7 (DB artifact) is untouched per brief.
Code review on PR #474 caught three real gaps in the initial deletion: - docker-compose.yml still had a `sync:` service running `python -m sync` (no profiles guard, restart:unless-stopped) — would crash-loop on any `docker compose up` now that the entrypoint is gone. Removed the service. - systemd/tether-sync.service still pointed at the deleted `python -m sync` entrypoint. Confirmed dormant (not among the three deployed services — tether-bot/tether-api/tether-mcp — and no active CI references it). Deleted. - The deleted tests/sync/test_worker.py contained the only direct tests of sync/dispatch.py (test_dispatch_sync_issues_pg_notify, test_dispatch_sync_webhook_type) — the module we deliberately kept live. Every dispatch_sync reference in tests/api/test_integrations.py monkeypatches it away, so dispatch.py's real body had zero coverage after the first commit. Relocated both tests to tests/sync/test_dispatch.py. Also fixed stale sync/__init__.py docstring (still described the removed LISTEN worker).
Owner
Author
|
Addressed code review findings in commit c6f6974:
Also fixed a stale Full suite re-verified: same 12 pre-existing baseline failures (unrelated to this change), 823 passed (821 + 2 relocated dispatch tests), zero new failures. |
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.
Summary
Scoped-down version of brief 0d. The original brief's pre-check ("git grep clean outside sync/") was wrong:
sync/dispatch.pyis actively imported and called byapi/routes/integrations.py(dispatch_sync, manual-sync trigger +initial_sync_and_register) and has live test coverage intests/api/test_integrations.py. Deleting it would have been a real behavior regression, not a cleanup — confirmed with team lead, scoping to the actually-dead pieces.Deleted (the vestigial LISTEN-loop worker, confirmed absent from prod per its own docstring — "Fly.io/production deployments no longer require this process...
[program:sync]section intentionally absent from production config", superseded by inline FastAPI BackgroundTasks since Phase F):sync/worker.py(219 lines — SyncWorker, PG LISTEN loop, APScheduler cron jobs)sync/main.py+sync/__main__.py(thepython -m syncentrypoint)tests/sync/test_worker.py+tests/sync/__init__.py(now-empty test package)Kept untouched:
sync/dispatch.py— live dispatch mechanism (PG NOTIFY), imported byapi/routes/integrations.pyapi/routes/integrations.py— out of scope for this cleanup, not touchedd2e3f4a5b6c7_sync_worker_integration_lookup.py(DB artifact, per brief)No doc/config references to the deleted worker were found (grepped
.md, supervisord/fly config) — nothing to update.Flagged for follow-up (not investigated, out of scope here): since the LISTEN worker isn't running in prod,
dispatch_sync's PG NOTIFY may have no consumer there — the manual-sync/initial-sync paths may be effective no-ops in prod, with real sync handled by the inline BackgroundTasks path since Phase F. Worth a dedicated investigation, not a cleanup-scope fix.Test plan
claude_agent_sdkmodule + in-flight SDK-migration test failures unrelated to this change) — zero new failures.grepconfirms no remaining references tosync.worker/sync.main/SyncWorkeranywhere in the codebase.