Preserve the previous build output when writing its Cargo receipt fails
维护者通常 1 天内回复
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 56/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- rust
- 领域
- build-system, cli
调研方向
Start at the binary activation and receipt writing sequence in tools/src/build.rs around line 119, then trace the existing package backup restoration work in #1001 and the build identity checks. Reproduce the receipt destination conflict described in the issue and inspect the build-cargo tests for activation and rollback coverage. Done means a failed receipt write preserves both previous outputs or reports a retained recovery location, with successful builds activating a matching pair.
由索引模型根据 Issue 内容生成。
描述
Problem
The build-cargo helper replaces the requested output binary before writing its build.json receipt. If receipt serialization or activation fails, the helper returns an error after the previous output has already been lost. The two outputs can then describe different build generations.
Starting point: binary activation followed by receipt writing.
Reproduction
Audited canonical master e1f8effd195b6339c3979b1e091e63c25f1da983 on Linux amd64 with checkout-built Wave 0.0.1-alpha-dev, matching std, Rust 1.89.0, Cargo jobs=2 and LLVM 21.1.8. The master SHA was rechecked before registration.
Build the two tools from the audited checkout using the pinned toolchain and matching LLVM. The following Linux reproduction invokes real incremental Cargo, uses only disposable output paths, and makes the receipt destination a directory to force a deterministic activation error:
from pathlib import Path
import os
import subprocess
import tempfile
root = Path.cwd()
with tempfile.TemporaryDirectory(prefix="wave-build-receipt-") as temporary:
output = Path(temporary) / "wavec"
output.write_bytes(b"PREVIOUS-COMPILER")
receipt = output.with_suffix(".build.json")
receipt.mkdir()
environment = os.environ.copy()
environment["LLVM_SYS_211_PREFIX"] = "/usr/lib64/llvm21"
result = subprocess.run([
str(root / "target/debug/wave-tools"), "build-cargo",
"--target", "x86_64-unknown-linux-gnu",
"--binary", str(root / "target/debug/wavec"),
"--output", str(output), "--",
"cargo", "+1.89.0", "build", "--locked", "--jobs", "2",
"-p", "wavec", "--bin", "wavec",
], env=environment, capture_output=True, text=True, timeout=300)
print("exit:", result.returncode)
print(result.stderr.strip())
print("old bytes preserved:", output.read_bytes() == b"PREVIOUS-COMPILER")
print("output header:", output.read_bytes()[:4])
Observed:
exit: 1
wave-tools: Is a directory (os error 21)
old bytes preserved: False
output header: b'\x7fELF'
The Cargo compiler build itself succeeded. Despite the helper's failed result, the previous sentinel was replaced by the new compiler. A directory at the receipt path is one reproducible failure injection, not the only possible receipt I/O failure.
Scope
Treat binary and receipt activation as one recoverable build-output operation. Prepare and validate both destinations before replacement; any later failure must preserve or restore the prior output set, retaining a recoverable backup if restoration itself fails. Keep Cargo compilation and Meson orchestration unchanged.
Related: #1001 covered package-set backup restoration, while #1070 delivered Rust tooling. Neither covers this build-cargo binary/receipt activation order.
Completion criteria
- A receipt-write failure leaves the previous binary and receipt usable, or reports a retained recovery location if rollback cannot finish.
- A successful invocation activates a matching binary/receipt pair.
- Regressions cover a conflicting receipt destination and failures around activation and restoration.
- Native platform replacement semantics and existing package/build identity checks remain intact.
- 主要语言
- Rust
- 星标
- 56
- 派生
- 21
- 平均合并
- 23 小时 20 分钟
- 30 天内合并 PR
- 45
环境准备
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
wavefnd/Wave 的其他 Issue
-
Reject unrepresentable POSIX listener descriptors before Unix-domain accept可能已有人在做 @ShahadatTest 于 4 天前认领。 未关闭bug good first issue
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复
-
Preserve expression assembly result types when recording HIR conversions可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭bug help wanted
难度 5/5 一周以上 新手友好度 35/100
维护者通常 1 天内回复
-
bug help wanted
难度 4/5 3-5 天 新手友好度 53/100
维护者通常 1 天内回复
-
Reconcile obsolete staging assets before verifying a new Nightly generation可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭bug ci help wanted
难度 4/5 3-5 天 新手友好度 48/100
维护者通常 1 天内回复
-
Prevent compiler stack overflow on long acyclic forward type-alias chains可能已有人在做 @hiyouwhatsapp 于 5 天前认领。 未关闭bug
难度 4/5 3-5 天 新手友好度 35/100
维护者通常 1 天内回复
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 82/100
RustCrypto/utils#1597 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
max-sixty/worktrunk#4727 · 7 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 86/100
维护者通常 1 天内回复
-
follow-up
难度 2/5 1-3 小时 新手友好度 73/100
carrick-sh/carrick#1859 ·
维护者通常 1 天内回复