Skip to content

fix(testing): time scaling checks by thread CPU time so a contended runner cannot skew the ratio - #10375

Merged
waleedlatif1 merged 1 commit into
stagingfrom
fix/linear-growth-flake
Nov 24, 2026
Merged

waleedlatif1 merged 1 commit into
stagingfrom
fix/linear-growth-flake

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • expectLinearGrowth (@sim/testing scaling helper) times a step at n and 8n and bounds the ratio at 20 (linear ≈ 8x, quadratic 64x). It measured wall clock. On a contended runner the long large-input call spans many scheduler slices and absorbs the whole slowdown, while a short small-input call often fits in one. That skews the ratio upward, and keeping the best of five runs can't remove a one-sided error. workflow-code's "finds the cycles of a block wired to many targets in linear time" failed this way in CI (21.45 vs 20), with the runner 5–11x slower than idle
  • The helper now times the CPU time of the test's own thread (process.threadCpuUsage, Node 22.19+, which CI runs), read through globalThis because the helper also compiles in packages without Node types (@sim/table-cells). Where a runtime doesn't report it, the clock stays wall time. One sample is also capped at 1s of wall clock, so a starved runner takes fewer calls instead of timing out
  • The bound (20), the 8x step and the run count are unchanged

Type of Change

  • Bug fix (test infrastructure)

Testing

  • Probe of the failing case under 42 busy loops on 14 cores: wall-clock ratios 12.3–25.0 (one over the bound), thread-CPU ratios 9.7–12.1; idle, both 10–11
  • A deliberately quadratic stronglyConnected (includes over the index keys) still fails: 75.6 vs 20. Reverted
  • Every file using the helper passes (14 files across apps/sim, sim-cli, table-cells, workflow-code, workflow-sdk, workspace-code). table-cells and testing type-check. biome, check:comment-hygiene

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing (new tests pass the test-audit authoring gate)
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Nov 24, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Nov 24, 2026 7:28pm UTC

Request Review

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

Copy link
Copy Markdown
Contributor

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

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Turn on auto-fix | Re-trigger cubic

@greptile-apps

greptile-apps Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] This PR appears safe to merge.

Summary

expectLinearGrowth now measures the test thread's CPU time when available.

  • Scaling checks use thread time and stop samples when their wall-time limit is reached.

No actionable issues were found. This review checked source and configuration; it did not run tests.

Reviews (1) · Last reviewed commit: "fix(testing): time scaling checks by thr..." · Reviewed by Greptile

@waleedlatif1
waleedlatif1 merged commit d07082a into staging Nov 24, 2026
83 checks passed

This branch was previously deployed

1 inactive deployment
Preview — 585281e6 Deployed Nov 24, 2026 by vercel[bot]
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