chore(sdk): trim local build/link overhead, add CI sccache (spectrum-design-data-tdb) - #1326
Merged
Conversation
…um-design-data-tdb)
Investigated the reported 4+ minute cargo test/build times and a 23m+
"hanging" test. The test itself is not hanging (depth-capped recursion,
microseconds of work) and the root cause is not compile or link time either
— both are fast (15-35s) once warm. The actual bottleneck is macOS
Gatekeeper/XProtect on-exec scanning of freshly-built test binaries, an
MDM-enforced OS policy outside this repo's control (full writeup in the
bead notes).
- sdk/Cargo.toml: line-tables-only debuginfo + unpacked split-debuginfo for
dev/test profiles — a low-risk trim, though not the dominant cost.
- sdk/core/tests/{prop_naming,suggest_calibration}.rs merged into
sdk/core/tests/integration.rs — fewer compiled test binaries means fewer
first-exec Gatekeeper/XProtect scans per `cargo test` run.
- sdk/scripts/bench-build.sh: reusable incremental-build benchmark used to
measure this investigation.
- .github/workflows/ci.yml: sccache wired into the rust job's cold
~455-crate compile, layered with the existing rust-cache.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Contributor
🎨 Token Changes ReportTokens Changed (0)Original Branch: This comment was automatically generated by the token diff tool. 🤖 |
Contributor
🧩 Component Schema Changes ReportNo component schema changes detected.This comment was automatically generated by the component schema diff tool. 🤖 |
…toml changes PR #1326's own CI showed green but resolved zero Rust tasks against its diff (moon.yml's sources fileGroup didn't cover tests/ dirs, and literal filenames like "Cargo.toml" never register with moon's changed-file matching — only real glob patterns do). Verified locally via isolated `moon ci --stdin sdk:test` runs against Cargo.toml, rust-toolchain.toml, and core/tests/integration.rs. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Contributor
Run report for 7265ae4dTotal time: 2m 14s | Comparison time: 2m 32s | Estimated savings: 18.4s (12.0% faster)
Changed files |
CI now correctly runs sdk:test/lint/fmt-check (moon.yml fix confirmed working), which surfaced that sccache-action fails every build here: its GHA cache client hits the legacy Actions cache API GitHub sunset in April 2025, so every rustc/clippy invocation errors out immediately (reproduced identically on two separate job runs, not transient). Swatinem/rust-cache already gets a full cache hit on the same run via the newer cache API, so it already covers what sccache was meant to add. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Investigated the reported 4+ minute
cargo test/buildtimes insdk/and a23m+ "hanging" test (
override_remaps) seen during PR #1321 review. Neitherturns out to be what it looked like:
override_remaps_name_absent_override_stays_1to1(
sdk/core/src/figma/mapping.rs:934) does microseconds of work, and its onlyrecursion path is depth-capped at 10 (
mapping.rs:353).cargo test -p design-data-core --no-runmeasured 15-35s once warm — swapping told64.lldeven measured worse (28-35s) than the default Apple linker.The actual bottleneck, confirmed via direct macOS unified-log correlation, is
Gatekeeper/XProtect on-exec scanning (
syspolicyd'scom.apple.syspolicy.execsubsystem, MDM-enforced) of every freshly-built test binary before its first
execution — an OS/MDM policy issue outside this repo's control. Full
before/after numbers and log evidence are in the bead notes
(
spectrum-design-data-tdb).This PR lands the mitigations that are still worth having on their own merits:
sdk/Cargo.toml:debug = "line-tables-only"+split-debuginfo = "unpacked"for dev/test profiles — low-risk trim (not the dominant cost,but free).
sdk/core/tests/{prop_naming,suggest_calibration}.rsmerged intosdk/core/tests/integration.rs(twomodblocks) — fewer compiled testbinaries means fewer first-exec Gatekeeper/XProtect scans per
cargo testrun on affected machines.
sdk/scripts/bench-build.sh: reusable incremental-build benchmark usedthroughout this investigation.
sdk/moon.yml: thesourcesfileGroup was missingcore/tests/,cli/tests/,tui/tests/globs, and its literalCargo.toml/rust-toolchain.tomlentries never registered with moon's changed-filematching (only real glob patterns do) — so this PR's own first CI run
showed all-green while actually resolving zero Rust tasks against the
diff. Fixed and confirmed locally via isolated
moon ci --stdinrunsagainst each previously-blind-spot file.
Linker swap, a proposed
core-crate split, and sccache CI wiring were allinvestigated and dropped — see the bead notes for why. (sccache was briefly
added, then reverted: it fails here because its GHA cache client uses the
legacy Actions cache API GitHub sunset in April 2025;
Swatinem/rust-cachealready gets a full cache hit on the same job via the newer API, covering
what sccache was meant to add.)
Related Issue
Closes bead
spectrum-design-data-tdb.Motivation and Context
Local
cargo test/buildinsdk/was slow enough to disrupt interactivePR review. This determines the actual root cause (not build/link, an OS-level
security scan) and lands the mitigations that help regardless.
How Has This Been Tested?
cargo test -p design-data-core --test integration— all 10 tests passafter the file merge.
moon run sdk:test(full workspace) — green.moon run sdk:lint(clippy,-D warnings) — green.Screenshots (if appropriate):
N/A
Types of changes
Checklist: