feat(sync): apply the lab rejection reason map on a schedule - #122
Merged
amitdugar merged 1 commit intoAug 18, 2026
Merged
Conversation
The labs' half of this is already automatic: lab-metadata-sender.php runs inside sync-sts every five minutes, so a lab that upgrades starts sending its reason tables within minutes and the receiver records what each of its ids means. Only the last step -- putting those answers onto samples already stored -- needed running by hand, and nobody should have to remember it. Scheduled on STS instances only. The map exists nowhere else, and a lab's own ids are correct on the lab: rewriting them there would break its own reports. Not a run-once. RunOnceUtility logs a script as executed on any successful completion, so one firing at upgrade would find an empty map -- no lab has synced yet at that moment -- log itself done, and never run again while the answers arrive over the following weeks. Two things the nightly run needed: - --quiet, so it speaks only when it actually rewrote something. A job that reports "nothing to do" every night teaches everyone to ignore its output. - an explicit check that the map table exists. Without it, an STS mid-upgrade threw and the global handler exited 0: a scheduled job failing invisibly, which is the failure mode this whole line of work has been about. Verified against a copy of a country's database: a seeded mapping reported "vl lab 86: reason 27 -> 12 (644 rows)" and --dry-run left all 644 untouched.
amitdugar
deleted the
featsync-apply-the-lab-rejection-reason-map-on-a-schedule
branch
August 18, 2026 23:46
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.
The labs' half of this is already automatic: lab-metadata-sender.php runs
inside sync-sts every five minutes, so a lab that upgrades starts sending its
reason tables within minutes and the receiver records what each of its ids
means. Only the last step -- putting those answers onto samples already stored
-- needed running by hand, and nobody should have to remember it.
Scheduled on STS instances only. The map exists nowhere else, and a lab's own
ids are correct on the lab: rewriting them there would break its own reports.
Not a run-once. RunOnceUtility logs a script as executed on any successful
completion, so one firing at upgrade would find an empty map -- no lab has
synced yet at that moment -- log itself done, and never run again while the
answers arrive over the following weeks.
Two things the nightly run needed:
reports "nothing to do" every night teaches everyone to ignore its output.
threw and the global handler exited 0: a scheduled job failing invisibly,
which is the failure mode this whole line of work has been about.
Verified against a copy of a country's database: a seeded mapping reported
"vl lab 86: reason 27 -> 12 (644 rows)" and --dry-run left all 644 untouched.