Skip to content

feat(sync): apply the lab rejection reason map on a schedule - #122

Merged
amitdugar merged 1 commit into
masterfrom
featsync-apply-the-lab-rejection-reason-map-on-a-schedule
Aug 18, 2026
Merged

feat(sync): apply the lab rejection reason map on a schedule#122
amitdugar merged 1 commit into
masterfrom
featsync-apply-the-lab-rejection-reason-map-on-a-schedule

Conversation

@amitdugar

Copy link
Copy Markdown
Member

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.

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
amitdugar merged commit abbcbf6 into master Aug 18, 2026
6 of 7 checks passed
@amitdugar
amitdugar deleted the featsync-apply-the-lab-rejection-reason-map-on-a-schedule branch August 18, 2026 23:46
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.

1 participant