builds: backfill queue_time for builds triggered this year#13083
Draft
ericholscher wants to merge 1 commit into
Draft
builds: backfill queue_time for builds triggered this year#13083ericholscher wants to merge 1 commit into
ericholscher wants to merge 1 commit into
Conversation
7f97dab to
850ac09
Compare
7a88279 to
4ecd1ae
Compare
850ac09 to
d1128c5
Compare
Add a batched data migration that backfills `queue_time` from `task_executed_at - date` for builds created since 2026-01-01. Older builds predate `task_executed_at` and cannot be backfilled. Runs after deploy in batches to avoid locking the table.
4ecd1ae to
8e28344
Compare
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.
Stacked on top of #13080 (targets that branch, not
main).Why a separate PR
The backfill is a one-time data migration with different risk and review concerns than the schema/feature change in #13080, so it's split out to be reviewed and reverted independently.
Decisions
Bounded to this year.
task_executed_atonly exists from 2025-09-30 onward, so older builds can't be backfilled at all. We further limit the window to builds since 2026-01-01 to keep the at-deploy DML small rather than rewriting every eligible row.Runs after deploy, in batches, idempotently. It only fills rows where the value is still null and never overwrites, so it's safe to re-run; batching avoids holding a long lock on a large table.
Computed in Python, not SQL. Extracting epoch seconds from a timestamp delta differs between PostgreSQL (production) and SQLite (tests); computing in Python keeps behavior identical across both.
Merge order
Merge after #13080, since it depends on the column that PR adds.
🤖 Generated by the Claude Code AI agent.
Generated by Claude Code