Skip to content

Commit 2b02240

Browse files
committed
fix: Ensure we broadcast test results on github
1 parent 21e66a7 commit 2b02240

2 files changed

Lines changed: 24 additions & 1 deletion

File tree

docs/testing/testing.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,4 +257,5 @@ For CI, set `ROBLOSECURITY` as a repository or Codespace secret. The `.github/wo
257257
- **Workflows should be thin.** All logic lives in `nevermore-cli` commands — GitHub Actions workflows just call them. This keeps CI debuggable locally.
258258
- **Rate limiting** is shared across concurrent workers via the `OpenCloudClient` instance. The `RateLimiter` serializes all Open Cloud API requests (one in-flight at a time) and reads `x-ratelimit-remaining` / `x-ratelimit-reset` headers.
259259
- **Post results via CLI**: `nevermore tools post-test-results <file>` posts or updates a PR comment with test results and writes to the GitHub Actions job summary. Requires `GITHUB_TOKEN` for PR comments; job summaries are written automatically when `GITHUB_STEP_SUMMARY` is set.
260-
- **Job summaries**: Results are automatically written to the [GitHub Actions job summary](https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-commands#adding-a-job-summary) when running in CI. This makes results visible on the workflow run summary page, complementing the PR comment.
260+
- **Live comment updates during the run**: When `nevermore batch test` detects a CI environment, it also updates the PR comment as packages transition between phases (throttled to ~10s). The `post-test-results` step still writes the final snapshot, but reviewers see progress without waiting for the full run to finish. In `--aggregated` mode every package shares one execution, so they move through `uploading``scheduling``executing` in lock-step — that's expected, not a bug.
261+
- **Job summaries**: Results are automatically written to the [GitHub Actions job summary](https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-commands#adding-a-job-summary) when running in CI. This makes results visible on the workflow run summary page, complementing the PR comment. The job summary is only written by `post-test-results` (not by the live batch run) to avoid duplicate entries on the workflow summary page.

tools/nevermore-cli/src/commands/batch-command/batch-test-command.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,12 @@ import {
2626
type BatchTestResult,
2727
type BatchTestSummary,
2828
CompositeReporter,
29+
GithubCommentTableReporter,
2930
GroupedReporter,
3031
JsonFileReporter,
3132
SpinnerReporter,
3233
SummaryTableReporter,
34+
createTestCommentConfig,
3335
} from '../../utils/testing/reporting/index.js';
3436
import {
3537
runSingleTestAsync,
@@ -174,6 +176,15 @@ async function _runAsync(args: BatchTestArgs): Promise<void> {
174176
if (args.output) {
175177
reporters.push(new JsonFileReporter(state, args.output));
176178
}
179+
if (isCI()) {
180+
reporters.push(
181+
new GithubCommentTableReporter(
182+
state,
183+
createTestCommentConfig(),
184+
concurrency
185+
)
186+
);
187+
}
177188
return reporters;
178189
}
179190
);
@@ -273,17 +284,28 @@ function _createBroadcastReporter(
273284
target: Reporter,
274285
packageNames: string[]
275286
): Reporter {
287+
// Phases from the inner context apply to the whole batch in aggregated mode.
288+
// The cloud poll loop re-fires 'executing' on every poll tick, and we don't
289+
// want that to keep flushing identical updates downstream — dedupe on the
290+
// last broadcast phase so each transition is reported exactly once.
291+
let lastBroadcastPhase: JobPhase | undefined;
276292
return {
277293
startAsync: async () => {},
278294
stopAsync: async () => {},
279295
onPackageStart: () => {},
280296
onPackageResult: () => {},
281297
onPackagePhaseChange: (_name: string, phase: JobPhase) => {
298+
if (lastBroadcastPhase === phase) return;
299+
lastBroadcastPhase = phase;
282300
for (const name of packageNames) {
283301
target.onPackagePhaseChange(name, phase);
284302
}
285303
},
286304
onPackageProgressUpdate: (_name: string, progress: ProgressSummary) => {
305+
// Upload progress (byte transfer) is genuinely informative when fanned
306+
// out. Poll progress during 'executing' is just an incrementing counter
307+
// duplicated across every row, so skip it once we're in lock-step.
308+
if (lastBroadcastPhase === 'executing') return;
287309
for (const name of packageNames) {
288310
target.onPackageProgressUpdate(name, progress);
289311
}

0 commit comments

Comments
 (0)