Skip to content

ci: Capture actual task durations under turbo 2.x summary schema#30908

Open
shortstacked wants to merge 2 commits into
masterfrom
devp-173-fix-send-build-statsmjs-to-capture-actual-task-durations
Open

ci: Capture actual task durations under turbo 2.x summary schema#30908
shortstacked wants to merge 2 commits into
masterfrom
devp-173-fix-send-build-statsmjs-to-capture-actual-task-durations

Conversation

@shortstacked
Copy link
Copy Markdown
Collaborator

@shortstacked shortstacked commented May 21, 2026

Summary

  • .github/scripts/send-build-stats.mjs was reading task.execution.durationMs and summary.durationMs — neither exist in turbo 2.x summaries
  • Every row written to qa_performance_metrics therefore had value = 0, silently breaking all duration-based queries against the table
  • Fix derives durations from execution.startTime / endTime for misses, and uses cache.timeSaved for hits (the duration of the run that was avoided — more useful than the ~ms cache-restore window)

Linear: https://linear.app/n8n/issue/DEVP-173

Root cause

Turbo 2.x summary schema (confirmed against an actual .turbo/runs/*.json from 2.9.4):

"execution": {
  "startTime": 1779132055452,
  "endTime": 1779132058010,
  "exitCode": 0
}

No durationMs field. The ?? 0 fallback in the script null-coalesced every row to 0. Counts (hit/miss) survived because they come from task.cache.status, but no timing data ever reached BigQuery under this turbo version.

Bonus capture: cache.timeSaved

Cache hits include cache.timeSaved — the duration of the task whose execution turbo skipped. Far more useful for analytics than the cache-restore time (typically <5 ms). Now captured as the hit-side duration.

Smoke test

Patched logic verified locally against a real summary file (build run, 59 tasks):

  • 32/32 cache hits → non-zero duration (avg 2.77 s, from cache.timeSaved)
  • 27/27 cache misses → non-zero duration (avg 4.38 s, from endTime − startTime)
  • Total run duration: 63.66 s (was 0 before)

Impact

  • Going-forward qa_performance_metrics rows have correct durations
  • Unblocks timing columns in CI cache dashboard (avg_miss_s, p95_miss_s, avg_hit_s, total_miss_hours)
  • Required for measuring DEVP-171 (affected-only filter) impact — without this fix, hit/miss rate changes would be visible but the cost-saved signal wouldn't be
  • Historical 0-value rows stay 0 (no backfill — turbo summaries aren't archived)

Expect MAX(value) > 0 for both hit and miss rows.

Test plan

  • I have seen this code, I have run this code, and I take responsibility for this code.
  • Merge and watch a CI run land
  • Run the verification query 1 hour after merge — confirm non-zero values
  • Open qa-ci-cache-hit-dashboard.md queries in Hex against the fresh data — timing columns should populate

🤖 Generated with Claude Code

…changelog)

`send-build-stats.mjs` was reading `task.execution.durationMs` and
`summary.durationMs`, neither of which exist in turbo 2.x summaries.
Every row written to `qa_performance_metrics` therefore had value=0,
silently breaking all duration-based queries against the table.

Fix: derive durations from `execution.startTime`/`endTime`. For cache
hits, use `cache.timeSaved` (the duration of the run that was avoided)
because the execution window only covers cache restore overhead (~ms).

Smoke-tested locally against a real `.turbo/runs/*.json` from turbo
2.9.4: 32/32 cache hits and 27/27 misses now report non-zero durations.

No backfill possible — historical 0-value rows stay 0. Going forward,
duration data starts flowing on the next CI run.

Linear: https://linear.app/n8n/issue/DEVP-173

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@n8n-assistant
Copy link
Copy Markdown
Contributor

n8n-assistant Bot commented May 21, 2026

Recommended reviewers

Based on ownership of the 1 changed file in this PR:

Team Files owned Share
@n8n-io/qa-dx 1 100%

@shortstacked shortstacked marked this pull request as ready for review May 21, 2026 13:58
@shortstacked shortstacked requested a review from a team as a code owner May 21, 2026 13:58
@shortstacked shortstacked requested a review from Matsuuu May 21, 2026 13:58
@n8n-assistant n8n-assistant Bot added the n8n team Authored by the n8n team label May 21, 2026
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

Re-trigger cubic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed n8n team Authored by the n8n team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant