Skip to content

Fixes 34944: faster unit tests, no cache saves or runners spent on no-ops in CI - #37493

Merged
ayush-shah merged 10 commits into
mainfrom
ayush-shah/ci-speedup
Nov 12, 2026
Merged

ayush-shah merged 10 commits into
mainfrom
ayush-shah/ci-speedup

Conversation

@ayush-shah

@ayush-shah ayush-shah commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

Describe your changes:

Fixes #34944

CI stops spending runner time and PR wait on work nothing uses. Nothing tested today stops being tested; required check names are unchanged.

Change Before → after
Profiler unit tests: the per-metric forced gc.collect() is stubbed only in the high-volume test_metrics.py; a new unpatched test keeps the real collection covered on success, failure and retry. Product code unchanged. On this PR: Run Unit Tests 26.0 / 26.5 min (3.11 / 3.12) vs 38.5–42.8 min on 4 recent full runs — ~13 min per Python version. Locally test_metrics.py 60.5 s → 1.1 s; same 827 tests
Service unit tests: drop the unused JaCoCo agent (report never built or uploaded) and the unused apt/ANTLR step. Two surefire forks were tried and reverted: PR run 42949358510 took 24.8 min vs 30–38 min, but RdfLiveWriterTest failed because another test leaks a null repository into the static Entity registry, which only shows under a different test order. On this PR: 17,261 tests, 0 failures, 3 skipped, 39.0 min — inside the 30–38 min spread of recent runs, so no measurable time gain; it only removes unused work
Pull-request jobs never save caches (restore only); main keeps writing. A guard fails if any PR-reachable job, including local and known third-party composites, can save repo cache sat over its 10 GB cap; PR-ref entries evicted the Playwright fixture cache, rebuilt in 10/10 sampled runs (~14 min each)
java-checkstyle: no disk purge, Maven cache restore 100 s purge for a 67 s check
Integration-test lanes: check Docker storage after checkout, purge only if short of space; drop unused apt/ANTLR per-lane setup 125–380 s → 0–1 s (measured below)
ui-coverage: 4 Jest workers in CI (dev default unchanged); drop a cache step keyed on a package-lock.json the repo doesn't have Run Coverage 16.2 / 16.3 min on this PR vs median 18.3 min over 11 recent 2-worker runs (about 2 min; same 2,280 suites, no OOM)
backport-automerge takes a runner only for backport/ branches (the provenance gate is unchanged) ~5–7k runners/week that exited after ~4 s
data-access-request-e2e no pull_request trigger: its e2e job never ran for PRs a no-op gate job on every PR

Type of change:

  • Improvement

High-level design:

Each change is independent and has its own guard test in .github/scripts/tests/test_ci_speed_*.py, run by validate-jsons-yamls.yml (new step, plus trigger paths). Analysis: 7 days of runs (2026-11-03..09, ~411k runner-min). OSS minutes are free on GitHub-hosted runners, so the targets are PR wall-clock and cache space, not cost.

Rejected after measurement: turning coverage off where not uploaded in py-tests (108 s vs 110 s), Trivy DB caching (no Trivy workflow), the RDF "duplicate" lane (<1 min), dropping push IT runs (an existing decision record relies on them).

Companion Collate PR: https://github.com/open-metadata/openmetadata-collate/pull/8455

Tests:

Use cases covered

  • Each guard test fails on origin/main (30 failed) and passes on this branch (55 passed, 2 skipped — the 2 need a Linux /mnt; checked against a stubbed copy).
  • .github/scripts/tests/ overall: same 6 failures as an untouched origin/main worktree in this local environment, 0 new. check_pr_workflow_security.py: OK. actionlint: no new findings. ruff: clean.
  • Profiler: 827 node IDs before and after, same statuses, plus 5 new tests; xdist -n 4: 830 passed, 2 skipped. Mutations (remove gc.collect, gc.collect(0), collect only on success, stub the whole tree) each fail the new tests.

Backend integration tests

  • Not applicable (no backend API changes). Lanes were dispatched on this branch to prove the setup change:
    • 42864603044 MySQL+ES, 42864610208 PG+OpenSearch, 42864619608 PG+ES+Redis.
    • "Check Docker storage" passed in every lane; both purge steps skipped. Lane setup 125–380 s on main (42862807336, 42862807306) → 0–1 s here; every lane 2–5 min shorter.
    • The rdf, parallel and global-state lanes fail, as they do on main's push runs of the same hour (42862807336, 42862807306, 42862807296) with overlapping classes (MetricMigrationIT, RdfLibraryPackActivationIT, ContextFileIT, FolderIT, DomainMoveApprovalAuthorizationIT…). Failures are assertions in the test step; no disk errors. retry-queue and multi-node pass.

Still needs this PR's own CI

  • Service unit tests: one JVM again; expect the same result as main.

Not in this PR (owners / settings)

  • Two surefire forks would save ~10 min per unit-test run, but first the tests that leave state in Entity's static repository map need cleaning up (one leaves a null entry; Entity.clearRepositoryThreadLocals then throws).
  • The merge queue has been off since 2026-11-03, so the required integration-tests-* and Playwright checks pass as skipped on PRs and run only after merge, where they failed 112 of 140 runs last week.
  • prune-ephemeral-caches.yml runs on merge_group with actions: write; on that event the workflow file and checkout come from the queued PR. The Collate port drops that trigger for this reason.
  • maven-sonar-build.yml still saves ~/.m2 on PRs (allow-listed by exact step in the guard; needs a main writer first).
  • CodeQL default setup: ~22k runner-min/week across 4 languages (repo setting).
  • yarn-coverage.yml on workflow_dispatch: check-changes has no checkout and fails, tests skip, yet the ui-coverage gate reports success.
  • maven-build-collate.yml holds a runner ~50 min per main push waiting for the Collate build.

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR is linked to a GitHub issue via Fixes #34944 above.
  • I have commented on my code, particularly in hard-to-understand areas.
  • I have added tests (unit / guard) and listed them above.
  • Self-review: independent Codex review of the full diff; 2 minor guard gaps + 1 follow-up fixed test-first and re-reviewed, no open findings.
  • Decision check: no new durable decision beyond what the guard tests pin; none added.

@ayush-shah
ayush-shah marked this pull request as ready for review November 11, 2026 02:32
@ayush-shah
ayush-shah requested review from akashverma0786 and a balanced review from Copilot November 11, 2026 02:32
@github-actions

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically.

Maintainers can bypass this check by adding the skip-pr-checks label.

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

Copilot AI balanced review requested due to automatic review settings November 11, 2026 02:50

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

Copilot AI balanced review requested due to automatic review settings November 11, 2026 02:56

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@ayush-shah ayush-shah modified the milestone: Sept 15 - Sept 26 Nov 11, 2026
Copilot AI balanced review requested due to automatic review settings November 11, 2026 03:55

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

Copilot AI balanced review requested due to automatic review settings November 11, 2026 03:58

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

- Profiler unit tests: skip the per-metric forced gc.collect() only in the
  high-volume test_metrics module; a new test keeps the real collection covered
- Service unit tests run in two surefire forks and drop the unused JaCoCo agent
  and apt/ANTLR setup
- Pull-request jobs restore caches but never save them (ref-scoped entries were
  never reused and evicted the Playwright fixture cache); main keeps writing
- java-checkstyle: no disk purge, restore the Maven cache
- Integration-test lanes: check Docker storage after checkout and purge disk only
  when short of space; drop the unused apt/ANTLR install
- ui-coverage: 4 Jest workers in CI; drop a cache step keyed on a missing file
- backport-automerge only takes a runner for backport branches
- data-access-request-e2e no longer runs a no-op gate job on pull requests
- Guard tests for each change run in validate-jsons-yamls.yml
@ayush-shah
ayush-shah force-pushed the ayush-shah/ci-speedup branch from dbacace to 669d3ef Compare November 11, 2026 11:31
Copilot AI balanced review requested due to automatic review settings November 11, 2026 11:31

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@ayush-shah ayush-shah added the skip-pr-checks Bypass PR metadata validation check label Nov 11, 2026
Copilot AI balanced review requested due to automatic review settings November 11, 2026 11:39

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

Copilot AI balanced review requested due to automatic review settings November 12, 2026 07:23

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@gitar-bot

gitar-bot Bot commented Nov 12, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 🟡 Medium risk 1 closed / 1 findings

Changing CI cache writes, workflow triggers, and runner setup could alter cache availability or whether validation jobs execute.

Speeds up CI by cutting unused work: profiler tests no longer force gc.collect() per metric, service unit tests drop the unused JaCoCo agent and apt/ANTLR step, PR jobs restore caches without saving them, and no-op runners are skipped. The previously flagged missing decision record for the PR cache rule has been resolved. No open issues remain.

✅ 1 closed
✅ Quality: New CI-wide rule "PR jobs never save caches" has no decision record

📄 .github/scripts/tests/test_ci_speed_java_and_cache.py:11-18 📄 .github/scripts/tests/test_ci_speed_java_and_cache.py:39-53 📄 .github/actions/cache-ui-dist/action.yml:17-19 📄 .github/workflows/py-tests-shared.yml:157-159 📄 .github/workflows/openmetadata-service-unit-tests.yml
This PR adds a rule that every workflow has to follow: no job a pull_request can reach may save a cache, whether directly, through a local composite or reusable workflow, or through an allow-listed third-party action. Writers stay on push or schedule, and KNOWN_UNOWNED_WRITERS may only shrink. The description states it as "Pull-request jobs restore caches but never save them, while main keeps writing; a guard test fails if any PR-reachable job ... can save." The only places this lives in the tree are a test docstring and a few scattered workflow comments. Nothing in docs/decisions/ records it, and this PR adds no record. Under the repo's decision-record policy, that makes this a cross-workflow rule stated in prose with no record, which is a blocking trigger. The squash-merge drops the description, so the reasoning goes with it: PR-ref entries can only be read by that PR's re-runs, yet they count against the shared 10 GB LRU and evict main-scoped caches. Also lost are the known costs: caches PRs depend on must have a main-scoped writer (spaCy is seeded only by a manual workflow_dispatch, and maven-sonar is deferred). Without that, a later contributor could reasonably undo the rule.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@ayush-shah
ayush-shah merged commit 6ee8867 into main Nov 12, 2026
65 of 66 checks passed
@ayush-shah
ayush-shah deleted the ayush-shah/ci-speedup branch November 12, 2026 10:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-pr-checks Bypass PR metadata validation check

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CI: cut runner time and merge-queue churn without removing test coverage

5 participants