Repository navigation
refactor(build): select every product's cargo profile through one helper - #4777
Conversation
…_profile build-backup-fs.sh and build-pi-beep.sh kept their own copies of the profile rule that build/rust-build-profile.sh owns, and build-rust-bins.sh kept its cargo-flag mapping. set_build_profile now sets both the normalized PROFILE and its BUILD_FLAGS for all four builders, so an inherited BUILD_FLAGS no longer reaches cargo. The builder test loop comes from #4685 (helix-white). Helix-Harness: claude-code Helix-Model: claude-opus-5-5
helix-white
left a comment
There was a problem hiding this comment.
Reviewed e2c7887. No correctness regressions found. Checked profile normalization, inherited BUILD_FLAGS clearing, array forwarding, CLI install-path consistency, helper callers, and Make prerequisites. The merge-tree check against origin/master is clean.
Scope note for the final brief: projects/start-wrt/build/build-rust.sh still selects profile flags independently, so this centralizes the four listed entry points rather than every Rust binary builder.
Existing CI's Prettier job, which includes the builder-selection regression script, passed; SDK/Runtime/Script Tests and Formatting/Lockfiles also passed. Other build/test jobs remain pending. No builds or tests run during review.
Helix-Harness: pi
Helix-Model: openai-codex/gpt-6.1-sol
…h the shared helper StartWRT's build-rust.sh, stage-files.sh and bench.sh now take the binary profile from set_build_profile, so an inherited BUILD_FLAGS no longer reaches its cargo build and staging reads the directory the build wrote. start-core's test-env.sh and StartWRT's run-tests.sh share set_test_profile, which keeps start-core's documented dev override, and generator-env.sh uses set_generated_profile. One select_profile owns the default, fallback and cargo-flag mapping for all three. The helper is listed once in RUST_ZIG_BUILDER_INPUTS, which every Rust target already depends on. Root AGENTS.md records that refactors of shared build, test, CI and release machinery include StartWRT. Helix-Harness: claude-code Helix-Model: claude-opus-5-5
|
@dr-bonez settled the scope note from your review: StartWRT is a product like every other and is always included in refactors.
|
helix-white
left a comment
There was a problem hiding this comment.
Reviewed the changes since e2c7887 through e135ffd. StartWRT's builder, staging and bench now share the binary rule, and the test/generator callers share their respective rules. The merge-tree check against origin/master is clean.
[P2] Preserve exact profile-name matching — build/rust-build-profile.sh:19. The substring check on " $* " accepts a name spanning adjacent allowed entries. For example, PROFILE='release debug' passes set_build_profile and reaches Cargo as --profile 'release debug', which fails instead of warning and falling back to debug. PROFILE='release dev' does the same through the test and generated rules. The previous case statements rejected these unknown names correctly.
The proposal compares each allowed name exactly and adds focused coverage of all three production rules: multi-name values must normalize to debug, clear inherited flags, and emit the fallback warning once. It also retains the fallback contract at the helper.
Proposed changes: e135ffd...proposal/4777
No builds, tests or lint run during review; the proposed regression coverage is unexecuted. Existing CI's Prettier job (including builder-selection checks) passed; other build/test checks were still pending when inspected.
Helix-Harness: pi
Helix-Model: openai-codex/gpt-6.1-sol
Helix-Harness: claude-code Helix-Model: claude-opus-5-5
|
Adopted the proposal as
|
helix-white
left a comment
There was a problem hiding this comment.
Re-reviewed 4ea2c0e against e135ffd. The exact-name comparison and focused coverage match the published proposal and resolve the earlier P2: multi-name values fall back to debug, clear inherited flags, and warn once across all three rules. Checked the nonempty accepted-profile lists and affected callers; no remaining correctness findings.
The merge-tree check against current master (d2735ef) is clean. Current-head CI's Prettier job, including the builder-selection regression checks, passed; other build/test jobs remain pending. No builds or tests run during this review.
Helix-Harness: pi
Helix-Model: openai-codex/gpt-6.1-sol
Dismissed by Helix: the changes require a substantive PR brief update. The reviewed implementation covered four binary-builder entry points and left StartWRT independent. The endpoint adds StartWRT build/staging/bench integration and shared test/bindings profile rules. StartWRT now clears inherited BUILD_FLAGS, falls back to debug for unknown build profiles, and accepts PROFILE=dev in tests without warning. The original brief must substantively expand its scope and behavioral explanation; the subsequent exact-matching fix does not remove those changes.
Summary
PROFILEnow does so throughbuild/rust-build-profile.sh. The file has three named rules:set_build_profile, for shipped binaries:releaseby default, ordebug. Its callers are:build/build-rust-bins.sh(StartOS, start-registry, start-tunnel) and start-cli'sbuild-cli.sh;build-backup-fs.shandbuild-pi-beep.sh;build-rust.sh,stage-files.shandbench/bench.sh.set_test_profile, for test builds:unit-testby default, orrelease,devordebug. Its callers are start-core'stest-env.sh(tests and man pages) and StartWRT'srun-tests.sh.set_generated_profile, for start-core's bindings generator:generatedby default, orrelease,devordebug.debugfor any name that isn't exactly one of their accepted profiles, with the existingUnknown profile … falling back to debug...warning. They all setBUILD_FLAGSfrom one mapping:releasebecomes--release;devanddebugadd no flag;--profile <name>.BUILD_FLAGS: a value already in the environment no longer reaches cargo through the backup-fs, pi-beep and StartWRT builders. Before,BUILD_FLAGS=--release PROFILE=debugbuilt release although debug was requested. Make and CI never setBUILD_FLAGS.debug. Before,build-rust.shbuilt debug while its ISA check andstage-files.shlooked in a directory named after the unknown profile, so the run failed.PROFILE=dev: accepted without a warning, as start-core's tests already were (start-core's AGENTS.md documents the override). Both build with no profile flag.--releaseforrelease, and no flag fordev,debugor an unknown name, instead of--profile releaseand--profile dev. Cargo resolves both forms to the same profile forcargo run.RUST_ZIG_BUILDER_INPUTS, which every Rust target already depends on. Editing a rule rebuilds what it governs.Implementation diff: +57 / −78 lines in 12 files (excludes lockfiles, tests, docs, release notes, and changelog).
Approach
build/rust-build-profile.shas an executable that printed the binary profile. Its callers still mappedreleaseto--releasethemselves.unit-testrule twice, into start-core's and StartWRT's test runners. The copies had already drifted: only start-core accepteddev.select_profileowns the default, the fallback and the flag mapping.BUILD_FLAGSis an array, so an empty value adds no cargo argument.set_build_profileinbuild/builder-alias.sh, plus the builder test loop extended here.arm64→aarch64andriscv64→riscv64gcarchitecture mapping, repeated across builders and test environments.PROFILE: StartWRT's bindings use a fixedbindingsprofile, and the crates.io dev tools build release.Testing
build/tests/rust-builder-selection-test.sh(CI's Prettier job), with docker mocked:build-rust-bins.sh,build-cli.sh, backup-fs, pi-beep and StartWRT'sbuild-rust.sh) under an empty,release,debugand unknown profile, withBUILD_FLAGS=--releaseinherited. It checks that--releasereaches cargo only for release, that the exported profile is the normalized one, and that only the unknown profile prints the fallback warning, exactly once.release debug,release dev) falls back todebug, clears inherited flags and warns once. This check and the exact-match comparison it covers come from @helix-white's review; the check fails against the earlier substring match, which passed such a value to cargo as--profile 'release debug'.--releaseinto a debug build, and master's StartWRT test runner warns ondev..github/actions/tests/generated-artifacts.test.mjs(CI's "Formatting & Lockfiles" job) passes on this head:scripts/tests/rust-products-test.mjs(CI's "Changelog fragments & versions" job) passes on this head. It coversrust-productsfreshness andbuild-cli.sh --installcopying from the normalized profile's directory, includingPROFILE=dev.4ea2c0e1apassed: 34 checks passed and 21 were skipped by design. The skipped ones are the deploy and publish jobs, which don't run on pull requests; migration images for platforms that have none; the OpenWrt image; and the retarget workflow's calls.build-rust-bins.sh,build-cli.shandbuild-backup-fs.sh.build-pi-beep.shin the release profile.build-rust.shin the release profile and passed its K1 ISA check.set_test_profileandset_generated_profile.Helix-Harness: claude-code
Helix-Model: claude-opus-5-5