diff --git a/.github/workflows/zed-cargo-product.yml b/.github/workflows/zed-cargo-product.yml index 110fc2a..4c87943 100644 --- a/.github/workflows/zed-cargo-product.yml +++ b/.github/workflows/zed-cargo-product.yml @@ -10,12 +10,12 @@ on: type: string default: "" base_sha: - description: Seed commit. Defaults to benchmark-source.env. + description: Seed commit. Defaults to cargo-layer-source.env. required: false type: string default: "" head_sha: - description: Adjacent commit built by every warm lane. Defaults to benchmark-source.env. + description: Adjacent commit built by every warm lane. Defaults to cargo-layer-source.env. required: false type: string default: "" @@ -55,7 +55,7 @@ jobs: INPUT_HEAD_SHA: ${{ inputs.head_sha }} run: | set -euo pipefail - source benchmark-source.env + source cargo-layer-source.env echo "base_sha=${INPUT_BASE_SHA:-$ZED_BASE_SHA}" >> "$GITHUB_OUTPUT" echo "head_sha=${INPUT_HEAD_SHA:-$ZED_HEAD_SHA}" >> "$GITHUB_OUTPUT" @@ -165,7 +165,6 @@ jobs: mode: cargo trust-policy: restore working-directory: upstream - fail-on-cache-miss: true fail-on-cache-error: true diagnostics: summary metadata-hints: phase=matrix-target-only-primary @@ -317,7 +316,6 @@ jobs: mode: cargo trust-policy: restore working-directory: upstream - fail-on-cache-miss: true fail-on-cache-error: true diagnostics: summary metadata-hints: phase=matrix-combined-primary diff --git a/README.md b/README.md index 0fe4b8e..49ad361 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,11 @@ lane/phase selector. The GitHub workflow selects those plans and leaves cache identity, target selection, and compiler-cache selection to the BoringCache CLI. +[`cargo-layer-source.env`](cargo-layer-source.env) pins the reviewed adjacent +source pair for that matrix independently of the continuously advancing rolling +source. Every matrix plan tag carries the pinned head identity, so a later +rolling sync cannot silently turn the cold seed into an older-cohort restore. + The root [`.boringcache.toml`](.boringcache.toml) owns the persistent rolling chain. [`.github/workflows/zed-cargo-product.yml`](.github/workflows/zed-cargo-product.yml) owns the independent release matrix. diff --git a/cargo-layer-source.env b/cargo-layer-source.env new file mode 100644 index 0000000..2d219d3 --- /dev/null +++ b/cargo-layer-source.env @@ -0,0 +1,3 @@ +ZED_SOURCE_REPOSITORY=zed-industries/zed +ZED_BASE_SHA=4e8057d74db3570b3bd419ff296eb84c35b3a5a3 +ZED_HEAD_SHA=d4010e91ccc9635853698af160f15bb479a484d0 diff --git a/plans/cold/primary/.boringcache.toml b/plans/cold/primary/.boringcache.toml index 22a9552..ca656ca 100644 --- a/plans/cold/primary/.boringcache.toml +++ b/plans/cold/primary/.boringcache.toml @@ -1,21 +1,21 @@ workspace = "boringcache/benchmark-zed" [entries.cargo-registry] -tag = "zed-cargo-layers-1181-d4010e9-registry" +tag = "zed-cargo-layers-1181-d4010e9-r4-registry" [entries.cargo-git] -tag = "zed-cargo-layers-1181-d4010e9-git" +tag = "zed-cargo-layers-1181-d4010e9-r4-git" [entries.zed-target] kind = "cargo-target" -tag = "zed-cargo-layers-1181-d4010e9-target" +tag = "zed-cargo-layers-1181-d4010e9-r4-target" path = "target" [profiles.cargo-product] entries = ["cargo-registry", "cargo-git", "zed-target"] [adapters.sccache] -tag = "zed-cargo-layers-1181-d4010e9-sccache" +tag = "zed-cargo-layers-1181-d4010e9-r4-sccache" no-git = true metadata-hints = ["benchmark=zed-cargo-layers", "layer=compiler"] diff --git a/plans/cold/remote-server/.boringcache.toml b/plans/cold/remote-server/.boringcache.toml index 718b7db..ec2261b 100644 --- a/plans/cold/remote-server/.boringcache.toml +++ b/plans/cold/remote-server/.boringcache.toml @@ -1,21 +1,21 @@ workspace = "boringcache/benchmark-zed" [entries.cargo-registry] -tag = "zed-cargo-layers-1181-d4010e9-registry" +tag = "zed-cargo-layers-1181-d4010e9-r4-registry" [entries.cargo-git] -tag = "zed-cargo-layers-1181-d4010e9-git" +tag = "zed-cargo-layers-1181-d4010e9-r4-git" [entries.zed-target] kind = "cargo-target" -tag = "zed-cargo-layers-1181-d4010e9-target" +tag = "zed-cargo-layers-1181-d4010e9-r4-target" path = "target" [profiles.cargo-product] entries = ["cargo-registry", "cargo-git", "zed-target"] [adapters.sccache] -tag = "zed-cargo-layers-1181-d4010e9-sccache" +tag = "zed-cargo-layers-1181-d4010e9-r4-sccache" no-git = true metadata-hints = ["benchmark=zed-cargo-layers", "layer=compiler"] diff --git a/plans/combined/primary/.boringcache.toml b/plans/combined/primary/.boringcache.toml index be6de5e..9342624 100644 --- a/plans/combined/primary/.boringcache.toml +++ b/plans/combined/primary/.boringcache.toml @@ -1,21 +1,21 @@ workspace = "boringcache/benchmark-zed" [entries.cargo-registry] -tag = "zed-cargo-layers-1181-d4010e9-registry" +tag = "zed-cargo-layers-1181-d4010e9-r4-registry" [entries.cargo-git] -tag = "zed-cargo-layers-1181-d4010e9-git" +tag = "zed-cargo-layers-1181-d4010e9-r4-git" [entries.zed-target] kind = "cargo-target" -tag = "zed-cargo-layers-1181-d4010e9-target" +tag = "zed-cargo-layers-1181-d4010e9-r4-target" path = "target" [profiles.cargo-product] entries = ["cargo-registry", "cargo-git", "zed-target"] [adapters.sccache] -tag = "zed-cargo-layers-1181-d4010e9-sccache" +tag = "zed-cargo-layers-1181-d4010e9-r4-sccache" no-git = true metadata-hints = ["benchmark=zed-cargo-layers", "layer=compiler"] diff --git a/plans/combined/remote-server/.boringcache.toml b/plans/combined/remote-server/.boringcache.toml index 866d63c..c555af0 100644 --- a/plans/combined/remote-server/.boringcache.toml +++ b/plans/combined/remote-server/.boringcache.toml @@ -1,21 +1,21 @@ workspace = "boringcache/benchmark-zed" [entries.cargo-registry] -tag = "zed-cargo-layers-1181-d4010e9-registry" +tag = "zed-cargo-layers-1181-d4010e9-r4-registry" [entries.cargo-git] -tag = "zed-cargo-layers-1181-d4010e9-git" +tag = "zed-cargo-layers-1181-d4010e9-r4-git" [entries.zed-target] kind = "cargo-target" -tag = "zed-cargo-layers-1181-d4010e9-target" +tag = "zed-cargo-layers-1181-d4010e9-r4-target" path = "target" [profiles.cargo-product] entries = ["cargo-registry", "cargo-git", "zed-target"] [adapters.sccache] -tag = "zed-cargo-layers-1181-d4010e9-sccache" +tag = "zed-cargo-layers-1181-d4010e9-r4-sccache" no-git = true metadata-hints = ["benchmark=zed-cargo-layers", "layer=compiler"] diff --git a/plans/sccache-only/primary/.boringcache.toml b/plans/sccache-only/primary/.boringcache.toml index ca5b652..4af7c97 100644 --- a/plans/sccache-only/primary/.boringcache.toml +++ b/plans/sccache-only/primary/.boringcache.toml @@ -1,21 +1,21 @@ workspace = "boringcache/benchmark-zed" [entries.cargo-registry] -tag = "zed-cargo-layers-1181-d4010e9-registry" +tag = "zed-cargo-layers-1181-d4010e9-r4-registry" [entries.cargo-git] -tag = "zed-cargo-layers-1181-d4010e9-git" +tag = "zed-cargo-layers-1181-d4010e9-r4-git" [entries.zed-target] kind = "cargo-target" -tag = "zed-cargo-layers-1181-d4010e9-target" +tag = "zed-cargo-layers-1181-d4010e9-r4-target" path = "target" [profiles.cargo-product] entries = ["cargo-registry", "cargo-git"] [adapters.sccache] -tag = "zed-cargo-layers-1181-d4010e9-sccache" +tag = "zed-cargo-layers-1181-d4010e9-r4-sccache" no-git = true metadata-hints = ["benchmark=zed-cargo-layers", "layer=compiler"] diff --git a/plans/sccache-only/remote-server/.boringcache.toml b/plans/sccache-only/remote-server/.boringcache.toml index da11c6f..6c047a8 100644 --- a/plans/sccache-only/remote-server/.boringcache.toml +++ b/plans/sccache-only/remote-server/.boringcache.toml @@ -1,21 +1,21 @@ workspace = "boringcache/benchmark-zed" [entries.cargo-registry] -tag = "zed-cargo-layers-1181-d4010e9-registry" +tag = "zed-cargo-layers-1181-d4010e9-r4-registry" [entries.cargo-git] -tag = "zed-cargo-layers-1181-d4010e9-git" +tag = "zed-cargo-layers-1181-d4010e9-r4-git" [entries.zed-target] kind = "cargo-target" -tag = "zed-cargo-layers-1181-d4010e9-target" +tag = "zed-cargo-layers-1181-d4010e9-r4-target" path = "target" [profiles.cargo-product] entries = ["cargo-registry", "cargo-git"] [adapters.sccache] -tag = "zed-cargo-layers-1181-d4010e9-sccache" +tag = "zed-cargo-layers-1181-d4010e9-r4-sccache" no-git = true metadata-hints = ["benchmark=zed-cargo-layers", "layer=compiler"] diff --git a/plans/target-only/primary/.boringcache.toml b/plans/target-only/primary/.boringcache.toml index 7bd2105..37c28ab 100644 --- a/plans/target-only/primary/.boringcache.toml +++ b/plans/target-only/primary/.boringcache.toml @@ -1,14 +1,14 @@ workspace = "boringcache/benchmark-zed" [entries.cargo-registry] -tag = "zed-cargo-layers-1181-d4010e9-registry" +tag = "zed-cargo-layers-1181-d4010e9-r4-registry" [entries.cargo-git] -tag = "zed-cargo-layers-1181-d4010e9-git" +tag = "zed-cargo-layers-1181-d4010e9-r4-git" [entries.zed-target] kind = "cargo-target" -tag = "zed-cargo-layers-1181-d4010e9-target" +tag = "zed-cargo-layers-1181-d4010e9-r4-target" path = "target" [profiles.cargo-product] diff --git a/plans/target-only/remote-server/.boringcache.toml b/plans/target-only/remote-server/.boringcache.toml index 5fddb69..4cc841f 100644 --- a/plans/target-only/remote-server/.boringcache.toml +++ b/plans/target-only/remote-server/.boringcache.toml @@ -1,14 +1,14 @@ workspace = "boringcache/benchmark-zed" [entries.cargo-registry] -tag = "zed-cargo-layers-1181-d4010e9-registry" +tag = "zed-cargo-layers-1181-d4010e9-r4-registry" [entries.cargo-git] -tag = "zed-cargo-layers-1181-d4010e9-git" +tag = "zed-cargo-layers-1181-d4010e9-r4-git" [entries.zed-target] kind = "cargo-target" -tag = "zed-cargo-layers-1181-d4010e9-target" +tag = "zed-cargo-layers-1181-d4010e9-r4-target" path = "target" [profiles.cargo-product] diff --git a/scripts/summarize-cargo-evidence.py b/scripts/summarize-cargo-evidence.py index c4ce92a..38c9e29 100755 --- a/scripts/summarize-cargo-evidence.py +++ b/scripts/summarize-cargo-evidence.py @@ -19,7 +19,8 @@ def summarize(label: str, evidence_path: Path) -> str: evidence = json.loads(evidence_path.read_text()) phase = evidence.get("phases", {}).get("restore", {}) mode = phase.get("mode_evidence", {}) - native = mode.get("native_tool", {}) + native = mode.get("native_tool") or {} + compiler_cache = mode.get("cargo_cache", {}).get("compiler_cache") requests = native.get("compile_requests") executed = native.get("compile_requests_executed") @@ -35,6 +36,8 @@ def summarize(label: str, evidence_path: Path) -> str: lines.append(f" - elapsed: {elapsed:.0f}s") if target_hit is not None: lines.append(f" - target snapshot restored: `{target_hit}`") + if compiler_cache == "none": + lines.append(" - compiler cache: disabled") if requests is not None: lines.append( f" - Cargo units compiled: {executed if executed is not None else requests}" diff --git a/scripts/verify-zed-release-recipe.py b/scripts/verify-zed-release-recipe.py index 4cad310..7e9c02f 100755 --- a/scripts/verify-zed-release-recipe.py +++ b/scripts/verify-zed-release-recipe.py @@ -115,6 +115,8 @@ def verify_upstream(upstream: Path, contract: dict[str, str]) -> None: def verify_plans() -> None: + source = read_settings(ROOT / "cargo-layer-source.env") + cohort = source["ZED_HEAD_SHA"][:7] target_tags: set[str] = set() compiler_tags: set[str] = set() dependency_tag_pairs: set[tuple[str, str]] = set() @@ -142,6 +144,11 @@ def verify_plans() -> None: require(cargo["no-git"] is True, f"{path} must use stable reviewed tags") config_entries = plan["entries"] + for entry in config_entries.values(): + require( + cohort in entry["tag"], + f"{path} does not carry the pinned layer-source identity", + ) target_tags.add(config_entries["zed-target"]["tag"]) dependency_tag_pairs.add( ( @@ -155,6 +162,10 @@ def verify_plans() -> None: f"{path} must give sccache an independent identity", ) compiler_tags.add(plan["adapters"]["sccache"]["tag"]) + require( + cohort in plan["adapters"]["sccache"]["tag"], + f"{path} compiler tag does not carry the pinned layer-source identity", + ) else: require( "sccache" not in plan["adapters"], @@ -178,6 +189,10 @@ def verify_workflows() -> None: require("scope-boringcache-run" not in all_workflows, "Workflows must not rewrite tags") require("mode: sccache" not in all_workflows, "Cargo owns the composed lifecycle") + require( + "source cargo-layer-source.env" in matrix, + "The layer matrix must not follow the moving rolling source", + ) require( "boringcache/one@ab52a39d3d7358c22b359a6ffbf86cf74be9bf56" in matrix, "The matrix must use released One 1.18.1", @@ -210,7 +225,7 @@ def verify_workflows() -> None: def verify(upstream: Path) -> str: contract = read_settings(ROOT / "scripts/zed-release-recipe.env") - source = read_settings(ROOT / "benchmark-source.env") + source = read_settings(ROOT / "cargo-layer-source.env") verify_upstream(upstream, contract) verify_plans() verify_workflows() diff --git a/test/test_cargo_product.py b/test/test_cargo_product.py index 534281c..b38cda2 100644 --- a/test/test_cargo_product.py +++ b/test/test_cargo_product.py @@ -91,6 +91,7 @@ def test_action_selects_plans_but_does_not_plan_layers(self): self.assertNotIn("scope-boringcache-run", workflow_text) self.assertNotIn("mode: sccache", workflow_text) self.assertNotIn("sed -i", workflow_text) + self.assertNotIn("fail-on-cache-miss", matrix) self.assertNotIn("cache_scope:", rolling) self.assertEqual(matrix.count("mode: cargo"), 8) self.assertIn("inputs.cli_version", matrix) @@ -129,6 +130,25 @@ def test_source_pair_matches_the_pinned_submodule(self): self.assertEqual(source["ZED_HEAD_SHA"], head) + def test_layer_matrix_owns_a_fixed_source_cohort(self): + source = dict( + line.split("=", 1) + for line in (ROOT / "cargo-layer-source.env").read_text().splitlines() + ) + cohort = source["ZED_HEAD_SHA"][:7] + matrix = (WORKFLOWS / "zed-cargo-product.yml").read_text() + + self.assertNotEqual(source["ZED_BASE_SHA"], source["ZED_HEAD_SHA"]) + self.assertIn("source cargo-layer-source.env", matrix) + self.assertNotIn("source benchmark-source.env", matrix) + for path in sorted((ROOT / "plans").glob("*/*/.boringcache.toml")): + plan = tomllib.loads(path.read_text()) + for entry in plan["entries"].values(): + self.assertIn(cohort, entry["tag"]) + sccache = plan["adapters"].get("sccache") + if sccache: + self.assertIn(cohort, sccache["tag"]) + def test_release_recipe_and_layer_contract(self): subprocess.run( [sys.executable, str(ROOT / "scripts/verify-zed-release-recipe.py"), "upstream"], @@ -172,6 +192,37 @@ def test_native_hit_rate_is_already_a_percentage(self): self.assertIn("96.0% hit rate", result.stdout) self.assertNotIn("9600", result.stdout) + def test_report_handles_a_disabled_compiler_cache(self): + evidence = { + "phases": { + "restore": { + "mode_evidence": { + "elapsed_seconds": 12.4, + "target_cache_hit": True, + "native_tool": None, + "cargo_cache": {"compiler_cache": "none"}, + } + } + } + } + with tempfile.TemporaryDirectory() as directory: + path = Path(directory) / "evidence.json" + path.write_text(json.dumps(evidence)) + result = subprocess.run( + [ + sys.executable, + str(ROOT / "scripts/summarize-cargo-evidence.py"), + "target-only", + str(path), + ], + check=True, + text=True, + capture_output=True, + ) + + self.assertIn("target snapshot restored: `True`", result.stdout) + self.assertIn("compiler cache: disabled", result.stdout) + if __name__ == "__main__": unittest.main()