Skip to content

Tags

Tags

latest

Toggle latest's commit message
Remove the event forwarding key

Summary:
Since the previous diff, D134049950, the event forwarding key starts no helper, so this removes it: the `--event-forwarding-key` flag, the `BUCK2_EVENT_FORWARDING_KEY` variable (the client's read and its `buck2 help-env` row), and `ClientContext.event_forwarding_keys`, whose field number 32 is now reserved. The key landed with D127671203, and nothing depends on it: no `.bucksettings.toml` turns event forwarding on.

Mixed versions stay harmless: a daemon from this diff skips the field that an older client sends, and an older daemon reads a newer client's command as one without keys.

Reviewed By: scottcao

Differential Revision: D134300444

fbshipit-source-id: dca4583dbdd66804fb2eea036983e9b4c25f0591

allocative-v0.3.7

Toggle allocative-v0.3.7's commit message
allocative 0.3.7

2026-11-15

Toggle 2026-11-15's commit message
A member-only ABI edit in a reduced-classpath dep no longer reruns so…

…urce_only compiles

Summary:
[Target: performance]

**Impact**
- Puffling, 105 libraries, scratch tree `4d2c7df9e1c9` (master `45d93597` + all Puffling Kosabi flips, never submitted), 2026-11-12, n=3 measured edits per arm, medians (https://artifacts.internalmeta.com/a/1123913910237622):

| ABI edit (one new member) | master + flips | with this diff |
|---|---|---|
| `object RecipeTokens` in `wire` | 9 compiles; compile CPU 80.8 s; wall 43.6 s | 2 compiles (`wire`, `logic`); compile CPU 49.3 s; wall 47.1 s |
| `object ElementFormDrafts` in `logic` | 4 compiles, incl. `ui:ui`; compile CPU 114.6 s; wall 83.6 s | 2 compiles (`logic`, `ui:ui_elements`); compile CPU 53.1 s; wall 40.4 s |

  The 7 compiles dropped from the `wire` edit ran in parallel with `logic`, off the critical path, so that edit's wall time does not improve (+3.5 s: the availability action, below). The `logic` edit drops `ui:ui`, Puffling's largest compile, and halves wall time.
- Exposure (an upper bound, not a measured fleet effect): every kotlincd full compile of a `source_only` library reruns on any ABI change in a jar of its reduced classpath; javacd has no applicability classpath. At fbsource head `c38db4393b59` (2026-11-12 21:33 UTC, CodeHub grep), 20,208 BUCK/TARGETS files set `abi_generation_mode = "source_only"` (Kotlin and Java libraries; files, not targets), 3,702 set `source_only_abi_deps`, and 2,146 set `required_for_source_only_abi = True` (commands in the test plan).

**Costs**
- One extra action per `source_only` library: `kosabi_availability_jars`, 1.8-3.4 s in the measured edits above, at most 3.8 s over 150 actions in the first build with this tool. It is cached like any action; when the compile itself must rerun, it runs first.
- Analysis of the Instagram app graph, daemon killed before each run (the `.bzl` files are unchanged since this run): wall 59.5 (the first run after a checkout switch) / 27.0 / 26.4 s against 27.0 / 26.0 / 26.0 s on master; peak memory 19 GiB on both.
- The tool is Kotlin, built like the applicability plugin with the prelude's bootstrap Kotlin toolchain (`buck_kotlin_library`, which adds `kotlin-stdlib` and `kotlin-annotations`), and runs as a `buck_java_binary` on the bootstrap Java toolchain's JDK with prelude ASM. Its fat jar bundles the Kotlin stdlib: 2,185,563 bytes and 1,245 entries, against 284,577 bytes and 127 entries for the Java version of the same tool; one run over 311 jars took 0.9 s (the Java version, run first: 1.5 s). The scanner runs in kotlincd with the ASM shaded into the Kotlin compiler. A class that only one of the two ASM builds can parse would be indexed differently; the tool keeps each class's version, so a version check gives the same answer on both.
- Rollout: on by default wherever the Kosabi plugins are (`kotlin.enable_source_only_abi=true`). Rollback: `-c kotlin.kosabi_availability_jars=false` or a revert; either changes the command of every `source_only` Kotlin compile, so each recompiles once.

**Why**
- `kotlincd_jar_creator.bzl:159` passes the `source_only_abi_jars` projection (deps in `source_only_abi_deps`, or marked `required_for_source_only_abi`) as `applicabilityClasspath` (`:444`). Unlike the compile classpath, which `cd_jar_creator_util.bzl:316` tags for dep files, these jars are plain inputs, so any byte change in one of them reruns the compile.
- Dep files cannot fix this soundly: verdicts depend on what is absent, and both readers read the jars whole.
  - `SourceOnlyAbiClasspathScanner.scan` (`SourceOnlyAbiClasspath.kt:45`) reads every class entry name without `$`, and the top-level members in the `kotlin.Metadata` of file facades and multi-file parts. An unknown or undecodable kind marks the package unindexed; an unreadable entry becomes an issue with its entry index.
  - `ReducedClasspathSourceOnlyAbiRuleInfoFactory` (`:58-65`) reads the `.class` entry names outside `META-INF/`, or the class files of a directory.
  - Neither reads members, member signatures or code.

**What changes**
- `AvailabilityJars`, a new Kotlin tool (`.../kosabi/applicability/availability:availability_jars`; Kotlin, like the applicability plugin around it, at siaojiecai's review request), writes one availability jar per reduced-classpath jar, in the same order, with exactly what the readers read:
  - every `.class` entry name; a class without `$` keeps its version and name, plus its `kotlin.Metadata` when the scanner reads members or an unindexed package from it (kind not 1, 3 or 4, the last `k` winning); a `$` class keeps only its name;
  - an input that is not a readable jar, or that repeats a `.class` entry name, is copied unchanged; a class ASM cannot parse keeps its bytes and is named on stderr; a corrupt or truncated entry (`ZipException`, `EOFException`) becomes empty; so both readers fail or index exactly as on the original; any other error fails the action.
  - deterministic output: sorted STORED entries with a fixed time; resources are dropped.
- `kotlincd_jar_creator.bzl` runs it in one action per `source_only` library and passes the availability jars as `applicabilityClasspath`, when `KotlinToolchainInfo.kosabi_availability_jars` is set. The fbsource Kotlin toolchain sets it with the other Kosabi plugins; `-c kotlin.kosabi_availability_jars=false` turns it off. The i-th jar is `<dir>/<i>/<cell>.<package>.<target>/<jar name>`, so the compile command shows which dependency each one stands for. `get_source_only_abi_jars` (`cd_jar_creator_util.bzl`) lists the reduced jars in projection order.
- A member-only ABI change now reruns only that action; its output is byte-identical, so the compile does not rerun and its per-class dep files decide, as on master. A class added or removed, or a top-level declaration changed (facade metadata carries signatures), changes the availability jars and reruns the compile.

**What does not change**
- Applicability verdicts: on 101 `source_only` targets the scanner reads an equal index from the original and the availability jars (none of them has an issue), and the Java class names are equal per entry; the unit tests cover issues (unreadable jars, broken and corrupt classes). A dependency listed twice, or both listed and `required_for_source_only_abi`, still gives one reduced jar (test plan), so paths stay unique, as the plugin expects.
- The compile classpath and its dep files, the source-only ABI action, and non-`source_only` targets.

**Prior art and open duplicates**
- Semantic conflict, needs an owner decision before either lands: siaojiecai's unpublished D130494996 makes the scanner record the real paths of the reduced-classpath jars and proves a constant's provider by matching its jar's real path against them. After this diff those paths are availability jars, so the match never succeeds and that check fails closed. `checks read the same index from availability jars` would catch it (the index would differ). Whichever lands second maps availability jars back to the original jars, either by passing the original jar identities to the plugin without making their content a compile input, or by keying the roots on the `<cell>.<package>.<target>/<jar name>` that the availability paths carry. Not done here: D130494996 is not on master.
- Complementary, incremental kotlinc (siaojiecai): D131481907 fingerprints the same scanner inputs to force a full incremental round. It reads `applicabilityClasspath`, so after this diff it reads the availability jars; their directory has a content-based path, so its per-jar digest shortcut misses whenever any availability jar changes, and the fingerprint then reads the (smaller) jars. D131481908, D131481905, D131481910 and D131569955 edit `kotlincd_jar_creator.bzl` next to line 159 or add toolchain fields next to `kosabi_availability_jars`: mechanical conflicts. D124447650 (scanner prefilter) skips facade metadata by the same kind rule.
- Textual overlap only (open diffs updated in the last 3 weeks; titles checked, none is a duplicate; older inactive drafts on these files are not listed): D131307608, D130930324, D130541301 in the toolchain files; D131110281, D130369730, D129991446, D130563308, D130808467 (the owner's) in `kotlincd_jar_creator.bzl` or `cd_jar_creator_util.bzl`; D130435965 in `test_jvm.rs` (D131259603 landed as `27ffc3fd602f`, which this rebase picked up); D131420752 and D131399360 (the owner's) in `InlineCheckerTest.kt` and the test `BUCK`.
- Re-checked 2026-11-13 10:12 UTC: siaojiecai's D131206607 and D130495005 also edit the test `BUCK` (mechanical). His other 25 open applicability drafts updated since 2026-11-11 (including D131639894, D131628945, D131570927 and D131488766) edit checkers and their tests in the same directories; their raw diffs edit neither the scanner, the `ReducedClasspath*` readers nor the `.bzl` files. D131488766 also edits `ApplicabilityCommandLineProcessor.kt` and `KotlincStep.java`, and his D131571202 and D131571248 edit `KotlincStep.java`, for incremental-round state; none of them changes the classpath option or its parsing.

Stack 10/10: availability jars, kill switch `kotlin.kosabi_availability_jars`; is stacked on D131761774. Review guide: https://artifacts.internalmeta.com/a/1409175177639708

Reviewed By: siaojiecai

Differential Revision: D131579831

fbshipit-source-id: a263a556bc62f174f5e0845c4c62a1abc9a32cbb

2026-11-01

Toggle 2026-11-01's commit message
invalidation: Drop the derived ordering on Version

Summary:
Only the invalidation path merge compared versions, and it did so with the
derived lexicographic order, which happens to be right for two versions of
one chain: branch ids are minted in creation order and a branch is younger
than the one it was forked from. No behavior change here; the comparison is
the same, under a name that says when it is meaningful, and the guarantee it
rests on is written down on `BranchId`, which `CoreState::branches` already
relied on for its parents-before-children order.

___

landed-with-radar-review

Differential Revision: D128864614

fbshipit-source-id: 95026364db3b164add47b5644d682a1cd6f24550

2026-10-15

Toggle 2026-10-15's commit message
Document exec marker preservation

Summary:
Transition authors can return a replacement `PlatformInfo`, but the effective exec configuration also retains the marker owned by Buck2. The existing guides did not explain this exception, leaving it unclear what happens when a transition omits the marker or sets it to `false`.

Document the contract in `ExecutionPlatformRegistrationInfo.exec_marker_constraint` and the execution platform and transition guides: constructors and single/split transitions restore a missing marker, while explicitly returning a different value is an error. Transition authors can omit the marker and let Buck2 preserve it. Manually supplying the same constraint on an ordinary target does not enable restoration or conflict rejection. Clarify the registration's fallback scope and the marker's presence during idempotence validation. Link the conceptual transition guide to this behavior, including its effect on otherwise empty outputs.

Reviewed By: NavidQar

Differential Revision: D124812251

fbshipit-source-id: 778d5905f00f813e64ddc71af9b7844455a5cc7d

2026-10-01

Toggle 2026-10-01's commit message
Export generated sources only for full library builds

Summary: Source ABI and source-only ABI CD actions return generated-source trees that have no consumers, causing unnecessary RE directory-metadata downloads on cache hits. Make the annotation output paths optional in the protocol and keep omitted paths inside BUCK_SCRATCH_PATH. The rules declare generated-source directory outputs only for full library compilation, preserving their existing providers and subtargets.

Reviewed By: siaojiecai

Differential Revision: D122335997

fbshipit-source-id: 3625e69c0fc6e4e5d7ad47fece1843d1c3fa5722

2026-09-15

Toggle 2026-09-15's commit message
Update flate2 from 1.1.9 to 1.1.10 (second attempt)

Summary: The WhatsApp crash that caused the revert in {D120009380} is resolved by {D120014105}.

Reviewed By: capickett

Differential Revision: D120031636

fbshipit-source-id: 60fe614f9b5661e3efbb189380692c841d0bd61a

2026-09-01

Toggle 2026-09-01's commit message
Exclude the LLVM lit macros from buck2's prelude ci_hints

Summary:
Three `ci_hint` glob lists hint on all of `tools/build_defs/**`, which
covers `tools/build_defs/llvm` -- the LLVM build macros. None of the
hinted tests use them, so editing an LLVM macro pulls in every Apple rule
test, every non-isolated buck2 e2e test, and the sample build jobs.
Exclude to avoid unnecessary broad CI jobs and improve the chances of
relevant ones getting run.

Reviewed By: bcardosolopes

Differential Revision: D117884846

fbshipit-source-id: 267bbe2d041bf93dedd578a3eaf467852e640a33

2026-08-22

Toggle 2026-08-22's commit message
No-op generic typetag registration on wasm

Summary:
The starlark-rust OSS CI wasm job (`ci_oss_wasmtime.sh`, mirrored internally by `fbcode//buck2/scripts/oss:starlark-rust-oss`) builds `starlark` for `wasm32-wasip1`. Since the generic typetag auto-registration landed (`matchers.rs` / `function.rs` monomorphization constructors, 2026-08-13), that build dies in `__pagable_emit_generic_typetag_registration!`'s catch-all arm:

```
error: generic pagable typetag registration supports only 64-bit Linux/macOS and x86_64/aarch64 Windows
  --> starlark/src/values/typing/type_compiled/matchers.rs:91:1
```

Wasm cannot use the constructor-record approach: `core::arch::asm!` is unsupported on wasm targets, and a wasm image has no loader-run constructor section for a per-monomorphization record anyway. Add a wasm arm that emits no registration — deserializing a generic typetag on wasm then fails with the registry's existing "Unknown type tag" error instead of failing the whole build at compile time. Concrete (`inventory`-based) registrations are unaffected.

Reviewed By: jtbraun

Differential Revision: D116564107

fbshipit-source-id: 826aec636b17a96f18afcf9101f9667c2ddec662

2026-08-01

Toggle 2026-08-01's commit message
Layer `.bucksettings.local.toml` in home dir over repo root settings

Summary:
Parses `.bucksettings.local.toml` from home dir. Home-local settings are recursively merged over the repo-root `.bucksettings.toml`. The pipeline is now discover settings files -> parse into tables -> merge into one table -> deserialize into `BuckSettingsData`.

Adds unit coverage for layered parsing and an e2e test verifying that a home-local value overrides the repo value.

Reviewed By: Nero5023

Differential Revision: D113876491

fbshipit-source-id: d04ffa478d03070b0e4a6619140b7fc9e5dc67a5