Skip to content

perf(buck2): reuse validated CAS files within publication batches - #1831

Draft
schickling-assistant wants to merge 1 commit into
mainfrom
schickling-assistant/2026-10-13-speed-up-ci
Draft

schickling-assistant wants to merge 1 commit into
mainfrom
schickling-assistant/2026-10-13-speed-up-ci

Conversation

@schickling-assistant

@schickling-assistant schickling-assistant commented Oct 13, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

The last ten completed merge-group runs had test-lane execution medians of 694 s Linux and 929 s macOS, above the 600 s target. In run 8834, buck2:editor:publish:test took 418 s Linux / 361 s macOS, with approximately 358 s / 339 s remaining after whole-workspace authority and the Buck build. Existing package timings do not distinguish mutable-root hashing, private copy/materialization, snapshot proof and CAS candidate rehash.

Goal

Measure the bottleneck, then avoid repeated cold copying and CAS candidate hashing by reusing validated CAS-file hints within one locked publication batch. Preserve all source-root and payload integrity proofs. No measured optimized speed-up or satisfaction of the 600 s lane contract is claimed.

Decisions

  • Count payload bytes in the existing native fingerprint streaming loop. --metrics is opt-in; default native stdout and hash framing remain unchanged.
  • Report batch source/snapshot hash reads, cold copy files/bytes/work, CAS candidate hash files/bytes/work, total sharing work and reused-file counts.
  • Emit per-package phase durations and absolute timestamps, including a distinct content-sharing phase. Work sums overlap across root fingerprints and the four publication workers; they are not lane wall time.
  • Keep every mutable-root hash walk and every existing copy-stability/snapshot proof. No root-digest memoization, cache-policy change, concurrency increase, platform reclassification or suite removal.
  • Keep at most 65,536 transient source-file hints per locked state root, scoped by content store. Seed only after successful payload proof and content sharing. Require the source stat key, strict ctime and mode to match; recheck source identity during the existing link-inventory walk.
  • Admit only an existing immutable CAS inode under the existing content-store lock. A stale, collected or replaced CAS entry follows normal copying. Never link a Buck source inode; standalone and non-admitted sources do not use batch hints. Persistent manifest formats remain unchanged.
  • No duplicate Cachix producer: the existing protected compiled-products workflow already owns both platform shell closures.

Verification

Added cold/warm batch counter assertions and five-view reuse, before/after-admission mutation, and non-admitted-source regressions to the editor-view integration fixtures. Added native fingerprint byte-count/framing regressions. No focused test suite or separate validation build was run; integration-owner verification remains required.

  • gate-slot --class heavy -- devenv --no-tui tasks run genie:run: exit 0; generated files unchanged. Its prerequisite bootstrap successfully exercised the new native metrics and TypeScript parser (431 source walks, 857,769,053 source bytes; 46,838 cold copies/candidate hashes). This was a loaded local Linux bootstrap, not a CI workload or speed benchmark.
  • gate-slot --class gate -- devenv --no-tui shell -- env DEVENV_TASK_PASSTHROUGH=1 oxfmt <four changed TypeScript/Markdown files>: exit 0; 473 ms formatter time. The initial direct oxfmt invocation was refused by the task wrapper; the wrapper's documented passthrough selects the pinned executable for scoped formatting.
  • gate-slot --class gate -- devenv --no-tui shell -- env DEVENV_TASK_PASSTHROUGH=1 cargo fmt --manifest-path rust/buck2-tools/core/Cargo.toml --package buck2-tool-core: exit 0.
  • PR CI run 8905 intentionally skipped both required test lanes. Existing heavyCiIf admits merge-group/fallback-main execution, not PRs or dispatch; the heavy-proofs label does not override this.
  • Approved existing empirical measurement dispatch 38465519193 completed the publication probes at instrumentation head 9b843b753ee4e1167f64aea09c663625338b0f16 before a later check:quick failed on two instrumentation lint violations. Those explicit-Boolean/named-argument violations are corrected in this slice; the check was not rerun. Retained artifact contains the cold publication and five warm samples.
  • Cold full-workspace publication covered 53 views (51 newly created): its view envelope was 1,218.844 s. Overlapping per-view stage work was 4,256.548 s content sharing (88.3% of stage work), versus 210.728 s source fingerprint/verification and 189.680 s materialization. It copied and candidate-hashed 1,072,318 files / 19,200,732,703 bytes with zero reuse. This selects validated CAS-file reuse rather than root-digest memoization.
  • Five warm outer-task samples had a 77.619 s median; they exercised existing whole-view reuse, not this new cache. The broader Linux-only probe is neither an optimized before/after comparison nor a required test-lane execution or 600 s proof.
  • Local generation/formatting evidence above predates the conflict-free rebase onto current main; no exact-head validation gate is claimed. Future main integration uses ordinary merges only.

All current Linux and Darwin bounded suites, source complements, module fixtures, native-product smoke checks and final collection census remain unchanged. The macOS lane stays required.

Complexity

No new dependency or persistent cache schema. A numeric work accumulator and optional callbacks expose existing observations; a bounded, batch-owned Map retains validated file hints. Existing store locks, immutable CAS checks and full integrity proofs remain authoritative.

Concerns

The native fingerprint output capability and TypeScript consumer must deploy together. Counter sums include overlapping worker time, while the content-hash counters cover candidate hashing rather than every CAS maintenance read. Unsuccessful publications may expose only completed native walk work. Current policy provides no PR/dispatch admission for the required Linux/macOS test lanes; pre-merge attribution uses the existing empirical publication probe, while final lane execution evidence must come from merge-group runs after merge. This PR remains draft and is not enrolled or armed.

Friction & bottlenecks

Required local generation used normal heavy admission: 11,491 s queued, 919 s held; an earlier 60 s admission budget expired with 20 jobs ahead. No priority slot was used. Pinned formatting subsequently queued for 127 s and held for 4 s. These are shared local capacity costs, not GitHub lane execution measurements. No private runner or store state is used as CI evidence.

Follow-ups

The integration owner must run the added regressions and compare optimized publication on the unchanged Linux/Darwin test censuses, then retain post-merge required-lane execution evidence. Root-digest reuse remains out of scope: it requires an immutable ownership receipt that current readRoots paths do not provide. Neither the empirical publication probe nor a green PR quality check substitutes for the final required-lane execution evidence.

References

  • Representative baseline CI run 8834
  • packages/@overeng/buck2-tools/README.md: publication integrity and work-counter contract
  • genie/ci-workflow/test-platforms.json: unchanged platform coverage

Authored by schickling-assistant (coding agent: openai-codex/gpt-6.1-sol).

Posted on behalf of @schickling
field value
agent_identity agent/effect-utils/buck2-migration-dev3
session 01a03413
agent_persona generalist
agent_supervisor unavailable
agent_tool OMP
agent_tool_version 18.6.0
agent_runtime OMP 18.6.0
agent_model anthropic/claude-opus-5-5
worktree effect-utils/2026-10-13-speed-up-ci

agent-identity: agent/effect-utils/buck2-migration-dev3
agent-persona: generalist
agent-supervisor: unavailable
agent-tool: OMP
agent-tool-version: 18.6.0
agent-runtime: OMP 18.6.0
agent-model: anthropic/claude-opus-5-5
@schickling-assistant schickling-assistant added origin:agent Filed or primarily produced by an AI agent · Set: AI agent or manual area:ci CI workflows, runners, and pipeline configuration · Set: manual system:buck2-tools @overeng/buck2-tools package · Set: manual labels Oct 13, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Pipeline traces

20 jobs; 4 successful, 1 failed, 0 cancelled, 15 skipped

Pipeline jobs and steps waterfall

Job Status Wall time Delta vs main p50 Trace
tested-tree success 0m 02s no main baseline not instrumented
default-ref-policy success 0m 56s +39.0s (229.4%; n=7) not instrumented
pr-reviews-resolved success 0m 48s no main baseline not instrumented
source-shape success 0m 12s +7.0s (140.0%; n=7) not instrumented
quality failure 8m 20s no main baseline not instrumented
All other jobs (15)
Job Status Wall time Delta vs main p50 Trace
trusted-buck2-remote-cache-proof skipped unavailable duration unavailable unavailable
deploy-storybooks skipped unavailable duration unavailable unavailable
publish-products skipped unavailable duration unavailable unavailable
test-live-deploy-ci-tools skipped unavailable duration unavailable unavailable
test-integration-notion skipped unavailable duration unavailable unavailable
test[runner=namespace-profile-macos-arm64] skipped unavailable duration unavailable unavailable
test-integration-restate skipped unavailable duration unavailable unavailable
test-playwright-tui-react skipped unavailable duration unavailable unavailable
build-products skipped unavailable duration unavailable unavailable
test-playwright-utils skipped unavailable duration unavailable unavailable
weaver skipped unavailable duration unavailable unavailable
pr-a-inert-buck skipped unavailable duration unavailable unavailable
cargo skipped unavailable duration unavailable unavailable
test[runner=namespace-profile-linux-x86-64] skipped unavailable duration unavailable unavailable
notify-alignment skipped unavailable duration unavailable unavailable

Main baseline samples (by job): tested-tree n=0, default-ref-policy n=7, pr-reviews-resolved n=0, source-shape n=7, quality n=0, trusted-buck2-remote-cache-proof n=0, deploy-storybooks n=7, publish-products n=0, test-live-deploy-ci-tools n=7, test-integration-notion n=7, test[runner=namespace-profile-macos-arm64] n=7, test-integration-restate n=7, test-playwright-tui-react n=0, build-products n=0, test-playwright-utils n=0, weaver n=7, pr-a-inert-buck n=0, cargo n=7, test[runner=namespace-profile-linux-x86-64] n=7, notify-alignment n=7.
Selected main run IDs: 34454944180, 34335805533, 34163313977, 34103707826, 34019970322, 34019141812, 33967414987, 33783986891, 33774494494, 33769043017, 33729818693, 33725431515, 33659778853, 33638676661, 33621119349, 33609995117, 33505277170.
Skipped main run IDs (Jobs API unavailable): 33431779835.
Baseline incomplete: collection deadline exceeded.
Task-level durations are not included. Trace links may be empty while export, indexing, or retention is pending.

15 job(s) without a start time are omitted from the timeline, not measured as zero.

@schickling-assistant schickling-assistant changed the title feat(buck2): measure editor publication work before caching perf(buck2): reuse validated CAS files within publication batches Oct 13, 2026
@schickling-assistant

Copy link
Copy Markdown
Collaborator Author

Parked: superseded by the current mg600 levers (revert #2280, A2a, prefetch #2290, macOS rebalance). Branch kept.

Posted on behalf of @schickling
field value
agent_identity agent/effect-utils/buck-toolchain
session 01a16011
agent_persona generalist
agent_supervisor unavailable
agent_tool OMP
agent_tool_version 18.10.2
agent_runtime OMP 18.10.2
agent_model anthropic/claude-opus-5-5
worktree unknown

@schickling-assistant

Copy link
Copy Markdown
Collaborator Author

Parked: superseded by the current mg600 levers (#2280 revert, A2a, #2290 prefetch, macOS rebalance).

Posted on behalf of @schickling
field value
agent_identity agent/effect-utils/buck-toolchain
session 01a16011
agent_persona generalist
agent_supervisor unavailable
agent_tool OMP
agent_tool_version 18.10.2
agent_runtime OMP 18.10.2
agent_model anthropic/claude-opus-5-5
worktree unknown

This branch has not been deployed

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

Labels

area:ci CI workflows, runners, and pipeline configuration · Set: manual origin:agent Filed or primarily produced by an AI agent · Set: AI agent or manual system:buck2-tools @overeng/buck2-tools package · Set: manual

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant