Skip to content

chore(sdk): trim local build/link overhead, add CI sccache (spectrum-design-data-tdb) - #1326

Merged
GarthDB merged 3 commits into
mainfrom
garthdb/tdb-rust-build-perf
Aug 1, 2026
Merged

chore(sdk): trim local build/link overhead, add CI sccache (spectrum-design-data-tdb)#1326
GarthDB merged 3 commits into
mainfrom
garthdb/tdb-rust-build-perf

Conversation

@GarthDB

@GarthDB GarthDB commented Aug 1, 2026

Copy link
Copy Markdown
Member

Description

Investigated the reported 4+ minute cargo test/build times in sdk/ and a
23m+ "hanging" test (override_remaps) seen during PR #1321 review. Neither
turns out to be what it looked like:

  • The test isn't hanging: override_remaps_name_absent_override_stays_1to1
    (sdk/core/src/figma/mapping.rs:934) does microseconds of work, and its only
    recursion path is depth-capped at 10 (mapping.rs:353).
  • It's also not primarily a compile/link problem: raw cargo test -p design-data-core --no-run measured 15-35s once warm — swapping to
    ld64.lld even 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's com.apple.syspolicy.exec
subsystem, 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}.rs merged into
    sdk/core/tests/integration.rs (two mod blocks) — fewer compiled test
    binaries means fewer first-exec Gatekeeper/XProtect scans per cargo test
    run on affected machines.
  • sdk/scripts/bench-build.sh: reusable incremental-build benchmark used
    throughout this investigation.
  • sdk/moon.yml: the sources fileGroup was missing core/tests/,
    cli/tests/, tui/tests/ globs, and its literal Cargo.toml/
    rust-toolchain.toml entries never registered with moon's changed-file
    matching (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 --stdin runs
    against each previously-blind-spot file.

Linker swap, a proposed core-crate split, and sccache CI wiring were all
investigated 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-cache
already 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/build in sdk/ was slow enough to disrupt interactive
PR 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 pass
    after 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

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

…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>
@changeset-bot

changeset-bot Bot commented Aug 1, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 7265ae4

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions

github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

🎨 Token Changes Report

Tokens Changed (0)

Original Branch: main


This comment was automatically generated by the token diff tool. 🤖

@github-actions

github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

🧩 Component Schema Changes Report

No 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>
@github-actions

github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Run report for 7265ae4d

Total time: 2m 14s | Comparison time: 2m 32s | Estimated savings: 18.4s (12.0% faster)

Action Time Status Info
⬛️ SetupProto(0.57.4) 0.1ms Skipped
🟩 SyncWorkspace 9.6ms Passed
🟩 SyncProject(sdk) 0.5ms Passed
⬛️ SetupToolchain(node:20.17.0) 539.9ms Skipped
⬛️ SetupToolchain(rust:1.88.0) 618.5ms Skipped
🟩 SetupEnvironment(rust, sdk) 113.6ms Passed
⬛️ InstallDependencies(rust, sdk) 5.8ms Skipped
⬛️ SetupToolchain(pnpm:10.17.1) 403.9ms Skipped
⬛️ SetupToolchain(javascript) 0ms Skipped
⬛️ SetupEnvironment(javascript, sdk) 0.5ms Skipped
🟩 RunTask(sdk:fmt-check) 607.3ms Passed
🟩 InstallDependencies(javascript, sdk) 7.2s Passed
🟩 RunTask(sdk:codegen-check) 190ms Passed
🟩 RunTask(sdk:lint) 42.5s Passed
🟩 RunTask(sdk:test) 2m 5s Passed SLOW
Changed files
sdk/Cargo.toml
sdk/core/tests/integration.rs
sdk/core/tests/prop_naming.rs
sdk/core/tests/suggest_calibration.rs
sdk/moon.yml
sdk/scripts/bench-build.sh

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>
@GarthDB
GarthDB merged commit 89cab5d into main Aug 1, 2026
8 checks passed
@GarthDB
GarthDB deleted the garthdb/tdb-rust-build-perf branch August 1, 2026 01:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant