Skip to content

ci: collect coverage on a nightly schedule only (off PR/merge_group) - #2402

Merged
lilyshen0722 merged 1 commit into
mainfrom
sre-ci-coverage-nightly
Oct 22, 2026
Merged

lilyshen0722 merged 1 commit into
mainfrom
sre-ci-coverage-nightly

Conversation

@lilyshen0722

Copy link
Copy Markdown
Contributor

What

Coverage now runs on a nightly schedule only.

  • tests.yml gains a schedule trigger (0 8 * * *, ~01:00 PT).
  • Backend + frontend jest run --coverage only when github.event_name == 'schedule'; otherwise they run without it.
  • The Upload coverage report step is gated to the scheduled event.

The required check keeps its exact name, Test & Coverage, so branch protection is untouched. This is the small, standalone coverage move from WS3 — independent of the larger tests.yml split (path filters, shards, aggregator) that ci-doctor takes Sat.

Why

CI speed-up (sprint WS3). --coverage instrumentation ran on every pull_request and merge_group commit for a report nobody reads on the PR.

Done when

  • PR / merge_group runs show no --coverage.
  • A scheduled run uploads coverage-report.

No deploy impact — CI config only. Gate: Rhea. Cleared to merge Thu per WS3.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Nju36GWpimrACHLKahbB4L

Drop --coverage from the backend and frontend jest runs on
pull_request / merge_group / push, and gate the coverage-report upload to
the scheduled event. A new nightly schedule (08:00 UTC ~ 01:00 PT) runs the
full job with --coverage and uploads the report. The required check keeps
its exact name, "Test & Coverage", so branch protection is untouched.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Nju36GWpimrACHLKahbB4L

@lilyshen0722 lilyshen0722 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Unasked review — unreviewed, and it changes the job whose green tick I cite as evidence in every gate verdict, so I checked it rather than assume. No GATE: line; no gate was requested.

I checked the thing that would have made this dangerous, and it is clean. Dropping --coverage on pull_request/merge_group would silently retire a gate if a coverage floor existed. There is no coverageThreshold in backend/jest.config.js, frontend/jest.config.js, either package.json, or anywhere under backend//frontend/ outside node_modules. So coverage was informational, and this removes no enforcement from any PR.

And nothing downstream consumed the report. The only coverage reference across .github/workflows/*.yml is this workflow's own upload step, which the diff gates to schedule. No other job or workflow reads the artifact.

The nightly is real rather than a no-op. There is no job-level if: anywhere in the file, so a schedule event runs the test job through the same steps with --coverage and reaches the now-conditional upload. (Worth having checked: a coverage move that collects coverage nowhere would look exactly like this diff.)

One consequence worth deciding deliberately, because the obvious remedy is worse than the status quo.

The job is name: Test & Coverage (:53). After this, on every PR and merge-queue run, that job runs no coverage — so the check name asserts something it no longer does. That matters a little more than cosmetics here: it is the string every reviewer (me included) quotes as evidence that a head is tested, and the AX audit exists for names that teach a reader a false model.

The trap is in the fix: that string is also the required-check context branch protection matches. Renaming the job alone would stop the required context from ever reporting, and every PR would sit at BLOCKED on a check that no longer exists under that name. So the options are to leave the name as a historical label, or rename and update branch protection in the same change — not rename alone.

Related and not a defect, just worth stating so nobody later assumes otherwise: a nightly coverage regression blocks nothing and notifies, at most, whoever last edited the cron. That is consistent with there being no threshold — coverage here is a report, not a gate — but it does mean "coverage is collected" stops implying "coverage is watched".

No defect in the change itself.

@lilyshen0722 lilyshen0722 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

#2402 CLEARED at 1233b28.

The full one-file merge-base diff preserves all prior triggers, job conditions, test steps, permissions and concurrency settings; the sole added trigger is schedule 0 8 * * *. The required job name remains exactly Test & Coverage. Backend and frontend Jest keep their complete discovery with no path filters: only schedule adds --coverage. PR, merge_group, push and workflow_dispatch omit it. Frontend node --test checks, MCP, CLI, hosted-runtime and real-DB service testing remain unchanged. The existing backend coverage artifact upload is schedule-only.

Independent verification: parsed workflow structure against merge base 6b828f9 and executed the actual changed shell blocks for all five event values with command-recording npx/node stubs: 10/10 branches produce the exact prior commands, minus coverage on the four non-schedule events. Other jobs and steps compare equal to the merge base. This verifies command routing, not a live scheduled Actions run or a rerun of application tests. Initial harness comparison against current main caught an unrelated later chart-check addition; corrected to the merge base. One invocation from the archive directory lacked git context and was corrected before the clean probe.

Full diff read; diff check clean. Current main inspected at be32f10; this head remains exact. No blocking defect found.

Written by Rhea — https://commonly.me/pods/6a8f6dc7a1dccf2e02f31015

Written by Rhea, a Commonly agent — https://commonly.me/v2/pods/6a8f6dc7a1dccf2e02f31015

GATE: PASS

@lilyshen0722
lilyshen0722 marked this pull request as ready for review October 22, 2026 12:12
@lilyshen0722
lilyshen0722 added this pull request to the merge queue Oct 22, 2026
Merged via the queue into main with commit 1b9ee47 Oct 22, 2026
24 checks passed
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