Skip to content

core: consumers get core's Rust tools prebuilt, not built from source #6517

Closed

Description

@TrapsterDK

Blocked on: none (order decided: before #6054)

Goal: core stops building Rust tools from source in consumer builds, so a consumer's graph no longer needs rules_rust, crate_universe or a hermetic C/C++ toolchain just to run dx check.

Today quality/real_aspects.bzl:2311 points the aspects at //quality/runner:quality_runner, a rust_binary built from source (quality/runner/BUILD.bazel). Every consumer therefore resolves rules_rust, the @crates hub and a cc toolchain to link it. Only @rules_dx//:dx is prebuilt today (cli/prebuilt/hub.bzl).

Plan (agent): size L, opus (plan first, then split)
Options to weigh: ship the consumer-facing Rust tools as release assets through the existing dx_prebuilt hub, or fold them into the dx binary as subcommands so there is one prebuilt asset. Building from source must keep working when rules_dx is the root module, and when from_source is set.
Unblocks: moving rules_rust, the crate macros and the default C/C++ toolchain out of core (see the cc and rust slices of #6054).
Do before #6054 (does not depend on it)
Part of #6032

Activity

  1. added
    P2
    blocked
    model:opus
    on Nov 4, 2026
  2. TrapsterDK commented on Nov 5, 2026

    @TrapsterDK
    CollaboratorAuthor

    Still blocked: the issue says to do this after #6054, which is open. It is also size L and needs a plan first (prebuilt release assets via dx_prebuilt vs folding the tools into dx subcommands). No code attempted. CI runners do not remove this blocker.

  3. TrapsterDK commented on Nov 5, 2026

    @TrapsterDK
    CollaboratorAuthor

    Plan (agent): size L. Decision: fold the consumer-facing quality tools into dx as subcommands, one prebuilt asset. Not a second asset through the hub.

    Facts:

    • The only Rust binary every consumer builds on dx check is //quality/runner:quality_runner (26k LOC, quality/real_core.bzl:141). quality_markdown (2k) and quality_notebook (1.4k) join it when those targets exist (quality/families/core.bzl:22,29). Everything else (deploy/*, tools/docs/*/extract, tools/coverage/*, env_shard_writer, codegen_shard_writer, js_launcher, exec_launcher, opa_test_launcher) is reached only through one family's rules and moves with that family under modules: move the remaining families to families/<family> #6054.
    • dx already links quality_result. The runner adds zip; markdown adds pulldown-cmark and unicode-properties. dx is 69 MiB today, so the growth is small.
    • A second hub asset touches cli/prebuilt/hub.bzl (ASSET_PLATFORMS, exe at :95), pins.bzl, cli/adopt/src/launcher.rs:11 RELEASE_ASSETS, tools/ci/fill_pins.rs, release.yml:92,106,117,349, release-cells.yml and deploy/release/matrix.bzl, per asset, per cell. The subcommand route touches none of them.
    • dx has no clap tree; a command is added in cli/plan/src/args/command.rs, grammar.rs, parser.rs and cli/cli/src/exec.rs:338.

    Steps:

    1. Hidden commands dx quality-runner, dx quality-markdown, dx quality-notebook that call the crates' lib entry points. The three rust_binary targets stay as thin wrappers for root builds and tests.
    2. quality/real_core.bzl:141 _runner and core.bzl:22,29 default to @rules_dx//:dx (the hub alias) with cfg = "exec"; the argv gains the subcommand. Action keys for a fixed fixture must not change otherwise.
    3. Root module and from_source keep building from source; //quality/... tests do not change.
    4. Measure on a Python-only consumer: dx check fetches no rules_rust crates; lock size before and after (the modules: measure what a Python-only consumer resolves and fetches #6046 number).

    Risk: cfg = "exec" selects the exec platform's prebuilt dx; remote execution with another exec platform needs that asset in the hub, the same rule dx has today.

    Ordering: this does not depend on #6054. Doing it first shrinks the cc and rust slices (#6504, #6516), because consumers then stop needing rules_rust and a cc toolchain for dx check at all. The blocked label stays until the owner confirms the order.

  4. github-actions commented on Nov 5, 2026

    @github-actions
    Contributor

    This issue has the blocked label but no Blocked on: line in its body. Add one naming the blocking issue (#N), a pull request URL, or the owner action. See CONTRIBUTING.md.

  5. TrapsterDK commented on Nov 6, 2026

    @TrapsterDK
    CollaboratorAuthor

    Plan: dx as a multicall binary. Supersedes the subcommand plan above.

    Order: this goes before #6054. It does not depend on it, and landing it first shrinks the cc and rust slices (#6504, #6516).

    • dx checks argv[0]. If its file stem is quality_runner, quality_markdown or quality_notebook, it runs that tool's library entry point (run_cli). No other names.
    • @dx_prebuilt exposes the prebuilt dx under those three names (native_binary per tool per pinned key). Root, from_source, unpinned and unsupported platforms point at today's source binaries, so root builds keep their cache.
    • quality/real_core.bzl and quality/families/core.bzl default to @dx_prebuilt//:quality_runner, :quality_markdown, :quality_notebook. Tool arguments do not change.
    • The release pipeline does not change: one asset per platform.

    Rejected: one release asset per tool (touches hub, pins, launcher, fill_pins, release.yml per asset); hidden dx quality-* subcommands (every argv changes, any dx edit reruns every lint in root builds).

    Risk: aliases follow the exec platform, so remote execution on another platform needs that asset pinned, the same rule as dx today. Pins are empty today, so consumers see no change until #1388.

  6. removed
    blocked
    on Nov 6, 2026
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

    P2model:opus

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions