Skip to content

chore - SDK provider preparation rebuilds all ten components on any compiler edit #1495

Description

@dannymeijer

Area

Tooling (CLI/formatter/test runner)

Summary

Preparing the SDK provider cache takes about 17 minutes, and any change to the compiler checkout triggers the whole thing. Two independent causes, both structural.

The cache key hashes the entire compiler source tree. sdk_provider_store_identity hashes the whole checkout when one is present, excluding only .git, target, and .github. Editing any file invalidates all ten components — including files that cannot affect how a stdlib component compiles, such as src/oven/, src/lsp/, and tests/.

The current design is a deliberate correction of an earlier one, and its own comment says why: "hashing development executable bytes would make identical source checkouts miss after unrelated test builds." Moving from executable bytes to a source hash removed spurious misses from non-reproducible binaries. It over-corrected: now every edit anywhere is a certain miss.

Preparation is all-or-nothing. There is one identity for the whole store and one staging directory. Components have no identity of their own, so a change anywhere rebuilds all ten regardless of what it touched.

The shape that is being thrown away

The components already declare a one-directional dependency graph in sdk-components.toml, and publication_order() already topologically sorts it:

core → {interop, system, async, testing} → {codecs, compression, data} → {observability, web}

Ten components, four levels. That graph is currently used only to order a strictly serial for loop, then discarded.

Giving each component an identity over its own source plus its dependencies' identities makes invalidation follow the graph:

  • change stdlib-web source → rebuild web alone, since nothing depends on it
  • change stdlib-core → rebuild everything, which is correct, because everything depends on it
  • change src/oven/rustc/inspection.rs → rebuild nothing, because no component's inputs changed

This is the same content-addressed reasoning the compiler is adopting for compilation units, applied one level up to component preparation: prove whether an input changed rather than assume it did.

Suggested order

  1. Narrow the compiler-source hash to what can affect a component build — the frontend, IR, emission, and provider paths plus the stdlib source. Exclude tests/ explicitly; test code cannot change a component's output, and excluding it directly serves the original motivation quoted above. Cheapest change and it removes most invalidation in practice.
  2. Give each component its own identity over its source and its dependencies' identities, and reuse per component rather than per store.
  3. Build each dependency level concurrently. The order is already computed; only the loop is serial. Bounded by the critical path core → system → data → web rather than by the component count.

Verification

The failure mode for 1 and 2 is a stale component producing a wrong build, so both need a miss/hit test: edit an excluded file and confirm a hit, edit an included one and confirm a miss, and confirm that changing a leaf component does not rebuild its dependencies while changing core rebuilds everything downstream.

Environment

  • Compiler built from 0.6.0-dev.4 at 0a8395835
  • Measured while iterating on compiler fixes for the Incan-authored Oven control plane (feature - RFC 119 native Rust facets and direct-rustc planning #1037). The loop was: edit compiler, build (~2 min), 17 min SDK re-preparation, test. Every compiler edit paid it, including edits to src/oven/ that cannot reach stdlib compilation.
  • stdlib-web is the heaviest component by a wide margin: its dependency closure is 53 packages against 20 for the default async,json,ordinal set, and it is last on the critical path.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    choreA chore: small / contained unit of worktoolingSuggestions, features, or bugs related to the Tooling (CLI/formatter/test runner)

    Type

    Projects

    • Status
      Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions