POLLER_UPGRADE_PLAN.md 1.3 KB

Poller Upgrade Plan

Goal

Remove the poller's direct dependency on SQLiteClusterStore._conn() and replace it with a public store method so tests and future store implementations do not need to model a private connection helper.

Current Problem

  • news_mcp/jobs/poller.py clears legacy feed_state rows with with store._conn() as conn:.
  • That couples the refresh loop to a private SQLite implementation detail.
  • Test doubles now need to expose _conn(), which is a sign the contract is too low-level.

Proposed Refactor

  1. Add a public method to SQLiteClusterStore for the legacy cleanup step.
  2. Move the DELETE FROM feed_state WHERE feed_key LIKE 'newsfeeds:%' logic into that method.
  3. Update news_mcp/jobs/poller.py to call the public method instead of _conn().
  4. Adjust tests to mock the public method, not a private connection handle.

Verification

  • Re-run the poller-focused tests.
  • Run the repo test script if the change stays small enough to keep coverage cheap.
  • Confirm no other code paths still depend on store._conn() outside the store implementation itself.

Notes

  • Keep the change narrow.
  • Do not alter the feed-hash or clustering behavior in the same patch.
  • Preserve the current legacy-row cleanup behavior exactly; only the access path should change.