Skip to content

perf(build): skip the base package graph when no manifest changed - #13407

Merged
cv merged 1 commit into
v1from
perf/build-test-fixtures
Oct 18, 2026
Merged

cv merged 1 commit into
v1from
perf/build-test-fixtures

Conversation

@cv

@cv cv commented Oct 18, 2026

Copy link
Copy Markdown
Collaborator

Part of #13310.

Failure

The nemoclaw-build change-selection tests take 1.4 s locally, but on loaded CI runners they reached 11–14 s, past the 8 s budget, and failed unrelated PRs. Tracing one test showed the cause: every decision ran cargo metadata twice, once on HEAD and once on a git archive of the base, and every fixture repository ran cargo generate-lockfile, git init, add and commit. On a busy runner, all those Cargo, rustc and Git processes stretch the test.

Decision

  • nemoclaw-build changes: reuses HEAD's package graph for the base unless a changed path can alter it: a Cargo.toml or Cargo.lock, a toolchain file, or anything under .cargo/. Only then does it extract the base and run cargo metadata again. Decisions are unchanged; the existing tests for dependency, feature and lockfile changes cover the path that still builds both graphs. This also speeds up the real CI step that decides which jobs run.
  • The tests: build the committed fixture workspace once per fixture and toolchain, under Cargo's CARGO_TARGET_TMPDIR, keyed by a hash of its files, and each test copies it. Concurrent tests that both build it race to rename into place, and the loser discards its copy.

The budget is unchanged.

Validation

Measured locally with nextest, at one thread unless noted:

Before After
changes::* (26 tests) 6.2 s 3.65 s
Base extractions with cargo metadata 53 4
git processes in changes::* 515 382
Whole nemoclaw-build suite 11.1 s 8.6 s
Slowest test, parallel 2.35 s 1.49 s

cargo ci passes locally.

Not addressed

bake::* and images::* time out on Windows runners in docker buildx itself (bake --print, version), not in NemoClaw code. #13310 stays open for them.

nemoclaw-build changes reuses HEAD's package graph for the base unless a
changed path can alter it, skipping a git archive and a cargo metadata run
for most decisions. The change-selection tests build their committed fixture
workspace once in CARGO_TARGET_TMPDIR and copy it per test.
@cv
cv enabled auto-merge (squash) October 18, 2026 04:53
@github-actions

Copy link
Copy Markdown
Contributor

@cv
cv merged commit d50beba into v1 Oct 18, 2026
@cv
cv deleted the perf/build-test-fixtures branch October 18, 2026 05:09
cv added a commit that referenced this pull request Oct 18, 2026
## Failure

On #13412, all 27 `nemoclaw-build` `changes::` tests failed in CI with
`git rev-parse HEAD: fatal: not a git repository`.

Since #13407, these tests copy a fixture repository built once under
Cargo's `CARGO_TARGET_TMPDIR`, reusing it whenever its `.git` directory
exists. CI caches `target/`, which includes that directory. The failures
fit a restored cache that kept `.git` but not the files inside it. The
template then passed the check, but its copies weren't Git repositories.
#13407's own CI had no cached template, so it passed.

## Decision

A template is reused only if:

- a completion marker, written inside `.git` after the base commit,
exists; and
- `git rev-parse --verify HEAD` succeeds in it.

Otherwise it's removed and rebuilt. The marker lives inside `.git`, so
copies don't see it as an untracked file. This adds one Git call per
test, while still avoiding a Cargo and Git build of the fixture per
test.

## Validation

- A new test, `an_incomplete_template_is_not_reused`, checks that a
template whose `.git` contains only the marker and an empty `objects`
directory isn't reused.
- All 27 `changes::` tests pass locally.
- `cargo ci` passes locally: 1,554 unit tests and 153 lifecycle tests.
cv added a commit that referenced this pull request Oct 18, 2026
Closes #13310.

## Failure

#13310 tracked `nemoclaw-build` integration tests exceeding the 8 s
per-test budget on loaded CI runners. Two of its three parts are already
fixed:

- **`changes::*` on Linux:** #13407 cut the repeated Cargo and Git work.
- **`bake::*` on Windows:** #13386 plans agent images only on Linux
hosts.

One test was left.
`images::harnesses_missing_from_the_selected_platform_name_the_platforms_that_build_them`
still ran `docker buildx bake --print` wherever buildx exists. On the
latest `v1` Windows run it took 14.0 s, and the run reported it over
budget.

## Decision

Give it the same guard as `bake.rs`: agent images are Linux images, so
the test plans them only on Linux hosts with buildx. On Windows and
macOS it's skipped with the same message as `bake.rs`. Planning them
there adds no coverage, and buildx is slow on Windows runners.
Test-only; the budget is unchanged.

## Validation

- The test still runs and passes on Linux (`images::*`: 4 passed).
- `cargo ci` passes locally: 1,598 unit tests and 149 lifecycle tests.
@wscurran wscurran added area: ci CI workflows, checks, release automation, or GitHub Actions chore Build, CI, dependency, or tooling maintenance v1 NemoClaw v1 branch labels Oct 23, 2026
@cv cv added this to the Roadmap: GTC DC 2026 milestone Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: ci CI workflows, checks, release automation, or GitHub Actions chore Build, CI, dependency, or tooling maintenance v1 NemoClaw v1 branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants