Skip to content

feat(worker): check alleles' first_published_at weekly - #1005

Draft
bencap wants to merge 4 commits into
feature/bencap/809/rls-policiesfrom
feature/bencap/809/first-published-check
Draft

bencap wants to merge 4 commits into
feature/bencap/809/rls-policiesfrom
feature/bencap/809/first-published-check

Conversation

@bencap

@bencap bencap commented Nov 17, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds a weekly worker job that checks alleles.first_published_at against the links it caches, and alerts when they disagree. Stacked on #1004, which adds the column, its triggers and first_published_at_drift().

The triggers keep the column in step, but anything that skips them can break it: a data-only restore with triggers disabled, session_replication_role = replica, or a hand-written UPDATE. Set too early, the alleles RLS policy shows everyone an allele that only private score sets produced.

  • Job: check_allele_first_published_at runs first_published_at_drift(). Drift fails the job as a data error, which sends the Slack alert. It reports at most 20 allele ids, so a bad restore can't flood the alert.
  • Schedule: Sundays at 21:00, an hour after the view refresh, so the two full scans don't overlap.

#1003 later folds this into one job that runs every allele-table invariant check (TODO#1003 in the code).

Refs #809

Tests

  • tests/worker/jobs/data_management/test_integrity.py: consistent alleles succeed; a drifted allele fails with a data error and its id; many drifted alleles report a bounded id list; the job runs through ARQ and records a cron_job run.
  • bin/check and the data-management worker tests.

Checklist

  • Targets the open patch branch if this is a small, non-breaking change, or the cycle's release-<year>.<n>.0 branch otherwise; never main (stacked on feat(db): add RLS policies for every guarded table #1004)
  • API schema change? A matching mavedb-ui PR regenerates src/schema/openapi.d.ts (no API schema change)
  • Docs and instruction files touched by this change are updated

@bencap bencap added the app: backend Task implementation touches the backend label Nov 17, 2026
@coveralls

coveralls commented Nov 17, 2026 •

Copy link
Copy Markdown

Coverage Report for CI Build 46492358207

Warning

No base build found for commit 1fd4b43 on feature/bencap/809/rls-policies.
Coverage changes can't be calculated without a base build.
If a base build is processing, this comment will update automatically when it completes.

Coverage: 91.411%

Details

  • Patch coverage: 24 of 24 lines across 2 files are fully covered (100%).

Uncovered Changes

No uncovered changes found.

Coverage Regressions

Requires a base build to compare against. How to fix this →


Coverage Stats

Coverage Status
Relevant Lines: 20316
Covered Lines: 18571
Line Coverage: 91.41%
Coverage Strength: 0.91 hits per line

💛 - Coveralls

Triggers keep first_published_at in step, but anything that skips them
can break it: a data-only restore with triggers disabled,
session_replication_role = replica, or a hand-written UPDATE. Set too
early, the alleles RLS policy (#809) shows everyone an allele only
private score sets produced, so the check runs on a schedule rather
than when someone remembers to.

check_allele_first_published_at runs first_published_at_drift every
Sunday, an hour after the view refresh so the two full scans don't
overlap. Drift fails the job as a data error, which alerts Slack, and
reports at most 20 allele ids so a bad restore can't flood the alert.
@bencap
bencap force-pushed the feature/bencap/809/first-published-check branch from 434e769 to 6656626 Compare November 17, 2026 21:20
@bencap
bencap force-pushed the feature/bencap/809/rls-policies branch from a3bfeb8 to 7e474ee Compare November 17, 2026 21:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: backend Task implementation touches the backend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants