Show the time of each stage in the table view - #42
Merged
Merged
Conversation
The stage table of the table view has a new Time column, next to the name of each stage. A stage that stopped shows how long it took. The stage that runs now shows a timer that counts its seconds. A stage that the run goes into again, as building after a failed verification, shows the sum of its times. On a phone, the time is on the line of the name of the stage. The classic view does not change. A new stage_history column records when the run goes into each stage: each time that setRunStage() changes the stage, it adds one item with the stage and the time. GET /v1/apps/:runId and GET /ui/apps now also give stageHistory: each stage that the run went into, in order, with the time that it started and the time that it stopped. A stage stops when the next stage starts, and the last stage stops when the run stops. The stage that runs now has no stop time. table.js adds up the times of each stage from the last poll. Between polls, a timer adds the time since the stage that runs now started. The timer runs four times each second, because a timer that runs once each second can skip a second when it runs late. A time of one hour or more now also shows its seconds, in the sites table too. Runs from before this change have no stage times. Only the pre-deploy command of the gateway applies the schema, so a run that starts on the new version of the workflows service before that migration is done fails at its first stage. Submit the prompt again after the deploy. 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.
Summary
The stage table of the table view at
/tableshows how long each stage took, and a timer counts the seconds of the stage that runs now. The classic view at/does not change.API and schema
stage_history(jsonb, default[]): one item for each time that the run goes into a stage, with the stage and the time.setRunStage()adds the item in the sameupdatethat changes the stage.GET /v1/apps/:runIdandGET /ui/appsnow also givestageHistory, withstage,startedAt, andfinishedAtfor each item. A stage stops when the next stage starts, and the last stage stops when the run stops.finishedAtisnullfor the stage that runs now. Postgres writes each time in the JSON with the offset of its session, and the API gives it in UTC, as the other times of a run.scripts/doctor.tschecks the new column.Code
public/table.jsadds up the times of each stage at each poll. Between polls, a timer adds the time since the stage that runs now started. The timer runs four times each second, because a timer that runs once each second can skip a second when it runs late. It writes a cell only when the text of the cell changes.aria-live="off", so a screen reader does not read the timer each second.formatDuration()now always shows the seconds, also for one hour or more (1h 2m 13s). This also changes the "Time to generate" column of the sites table for such runs.AGENTS.md,docs/README.md, anddocs/FAQ.mdtell about the new column and the new field.Deploy note
Only the pre-deploy command of the gateway applies
app/schema.sql, and the workflows service builds faster. So for a short time after the merge, a run can start on the newsetRunStage()before the column exists. Such a run fails at once at its first stage, withcolumn "stage_history" does not exist. Submit the prompt again after the deploy. #40 had the same gap forfinished_at. Runs from before this change have no stage times.Test plan
npm run check: Biome,tsc, and 390 Vitest tests pass. New tests cover the start and stop times in the run response, the stage that runs now, and the Time cell of each row of the stage table.mainand an old row: it runs two times with no error, and the old row gets an empty history.setRunStage(),finishRun(),getRun(), andlistRunsByUser()against that Postgres, with the session time zone set toAmerica/Los_Angeles. Postgres writes-07:00, and the API gives UTC.🤖 Generated with Claude Code