Repository navigation
fix(sync): D1 holds only status='ok' rows - #145
Merged
Merged
Conversation
The mirror serves only what upstream lists, so storing anything else only creates leaks like the pending-campus one. The sync (and the health check's refetch) now treats any status other than 'ok' as a removal: an existing row is deleted, a new one is never inserted. A pending row that is approved later comes back via ?since= as 'ok'. Migration 013 deletes the non-ok rows earlier syncs stored (22 pending campuses). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
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.



Follow-up to #144. That commit was pushed after #144 merged, so it comes in its own PR.
The API never serves a non-
okrow, so there's no reason to store one. Storing them only created leaks like the 22 pending campuses that #144 found.Changes
sync/rows.jsisListed(row): a row belongs in D1 only if its status isok. A missingstatusfield still counts as listed, as before.deleted,pending, …) is a removal: an existing row is deleted, and a new row is never inserted. A pending row approved later comes back through?since=asok.013_only_ok_rows.sql:DELETE … WHERE status != 'ok'on every table. Today that clears the 22 pending campuses; every other table holds onlyokrows already.#144's
status = 'ok'predicates in expansion and search stay as a cheap backstop.Testing
pendingis deleted; a newpendingrow is never inserted;row_countstays exact (5 + 1 new − 1 removed).pendingrow is removed and theokrow kept.🤖 Generated with Claude Code