Repository navigation
release: pin the rubash source revision, fail hard on drift (rubash#827) - #424
Merged
Merged
Conversation
Conclusion B of the rubash#827 forensics: the niubash release pipeline never pinned rubash at all. Every job cloned rubash master at build time into ../rubash, where the committed [patch] path override deterministically wins over the git dependency -- so the released engine was "whatever rubash master HEAD was when the pipeline ran". v1.4.0 (run 38506862578) compiled e785c3c8f610 while the release era declared rubash v1.4.0 (f69e7900) and faithfully shipped the pre-#819 stale-HOME behavior of rubash#754. The "Pin rubash revision" steps only recorded and dirty-checked the clone; nothing compared it to an expectation, and no pin file existed -- a double standard next to winuxcmd-pin.json (niubash#312/#327), which hard-verifies the bundled WinuxCmd zip bytes. - scripts/release/rubash-pin.json: the source twin of winuxcmd-pin.json. rubash_rev (full 40-char sha; abbreviated forms cannot be fetched) + rubash_version (the Cargo.toml version AT that rev) + the bump flow. Initial pin: 992d5c5e6fa6 (v1.4.0), the master HEAD niubash CI is green against. - release.yml: every rubash clone (8 jobs) is now "Checkout pinned rubash revision" -- init, fetch --depth 1 the pinned sha, checkout, submodules, then rev-parse HEAD must equal the pin or the job dies. The build jobs' "Pin rubash revision" steps additionally cross-check the clone step's output. The windows job preserves/restores the pin file like the other #312 pins (a dispatch of an old tag runs today's pin). The release body discloses the pin. ci.yml's dev line stays floating on rubash master on purpose: development should keep testing tomorrow's engine. - build.rs: a dirty worktree now stamps `-dirty-<8 hex>`, a sha256 digest over `git diff HEAD --binary` (#488/#827 recommendation 3 -- a bare HEAD hash does not guarantee content, and two different dirty trees must not print the same banner). Clean trees are unchanged: the `-dirty` rule and the untracked-files exemption keep their exact semantics, so the release smoke greps (`Niubash <version> `, `rubash git <rev>`) and the banner tests are untouched -- verified by tests/rubash_revision_banner.rs. - tests/build_rs_dirty.rs: build.rs included via #[path]; fixture repos cover clean/dirty/staged/untracked/restore, digest stability, and digest sensitivity to content. - scripts/release/verify-rubash-pin.py: the standalone auditor (used by the release captain and pin-freshness). --fetch dry-runs the exact fetch recipe into a temp dir; --self-test proves a tampered rev / wrong version / dirty tree / missing checkout all fail; --fetch-self-test does both against the real remote (wired into pin-freshness.yml, plus the self-test on every PR in ci.yml). Choice note (rubash#827 recommendation 2): the pinned clone feeds the existing [patch] path dependency (option i) instead of CI-injecting a patch into Cargo.toml (option ii) -- the patch already applies on release CI (the committed Cargo.lock is in path form; --locked would fail otherwise), so pinning the tree it resolves to is the minimal, no-manifest-churn fix and keeps `cargo build --locked` semantics identical on every job. The current pin names rubash 992d5c5e6fa6 (v1.4.0). Bumping it is one commit to scripts/release/rubash-pin.json; see its notes.
caomengxuan666
force-pushed
the
fix/release-rubash-pin
branch
from
October 19, 2026 01:04
ab8d8c6 to
b3ef4fb
Compare
Member
Author
代码评审(独立):fix/release-rubash-pin(rubash#827 结论 B 落地)结论:APPROVE-WITH-NITS — 无 BLOCKER;3 条非阻塞备注见末尾。不合并。 评审基于 head 逐项验证(全部实做)
非阻塞备注
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Conclusion B of the rubash#827 forensics: the niubash release pipeline never pinned rubash at all. Every release job cloned rubash master at build time into
../rubash, where the committed[patch]path override deterministically wins over the git dependency — so the released engine was "whatever rubash master HEAD was when the pipeline ran." That is how v1.4.0 (run 38506862578) compilede785c3c8f610while the release era declared rubash v1.4.0 (f69e7900), and faithfully shipped the pre-#819 stale-HOME behavior of rubash#754.The existing "Pin rubash revision" steps only recorded the clone (plus a shallow-clone dirty check that can never fire on CI); nothing compared it to an expectation, and no pin file existed — a double standard right next to
winuxcmd-pin.json(niubash#312/#327), which hard-verifies the bundled WinuxCmd zip bytes. This PR extends that same pin discipline to the engine source.What lands
a. Pin file —
scripts/release/rubash-pin.json(same home and style aswinuxcmd-pin.json; the ticket'sinstaller/path was an example, this is the repo's actual pin directory):rubash_rev: full 40-char commit sha (abbreviated forms cannot be fetched — git resolves the fetch argument server-side as a ref name; same lesson as perfbudget's Fetch-Pinned pins).rubash_version: the Cargo.toml version AT that rev, so rev and self-declared version cannot drift silently.python scripts/release/verify-rubash-pin.py --fetch冒烟 → niubash CI 对新 pin 绿 → 落 tag。992d5c5e6fa679cc5c7fa2bf4297173240e56fd5(v1.4.0), the rubash master HEAD niubash master CI (117147a) is green against.b. Kill the float — release.yml, all 8 rubash-consuming jobs (build-windows/linux/macos/android/openharmony, journey, perfbudget, publish-crates): the clone is now
Checkout pinned rubash revision—git init+fetch --depth 1 origin <pinned sha>+ checkout + submodules (only where today's clone fetched submodules), thenrev-parse HEADmust equal the pin or the job dies. The build jobs' "Pin rubash revision" steps additionally re-derive the revision and cross-check it against the clone step's output (belt and suspenders). The windows job preserves/restores the pin file like the other #312 pins, so a dispatch of an old tag runs today's pin while a tag push reads the pin committed at the tag. The release body discloses the pin.Choice note (recommendation ②, option (i)): the pinned clone feeds the existing
[patch]path dependency instead of CI-injecting a patch into Cargo.toml (option (ii)). Rationale: the patch already applies on release CI — the committedCargo.lockis in path form (nosourceline for rubash), socargo build --lockedwould fail if the git dependency were resolved instead — meaning the tree the patch resolves to is the real, existing float. Pinning that tree's content is the minimal fix: zero manifest churn, identical--lockedsemantics on every job, and build.rs's checkout fallback (which the banner already prefers under the patch) now describes a named revision. Option (ii) would add a CI-side manifest mutation that must stay in sync with the lockfile across tag-push vs dispatch — more moving surface for the same guarantee. LocalCargo.tomlstays untouched: a developer's sibling worktree keeps its local-override purpose.c. build.rs — dirty worktree content digest (recommendation ③, the #488 blind spot): a dirty rubash tree now stamps
<rev>-dirty-<8 hex>, where the digest is sha256 overgit diff HEAD --binary. A bare-dirtyis honest but not verifiable (two different dirty trees would print identical banners); the digest makes the stamp name WHICH uncommitted state was compiled. Clean trees are byte-for-byte unchanged: the-dirtyrule and the untracked-files exemption keep their exact semantics, so the release smoke greps (Niubash <version>,rubash git <rev>) and thehead -1version-gate shapes are untouched — confirmed by runningtests/rubash_revision_banner.rs(2 passed) and the musl/ci grep shapes.d. Tests/gates:
tests/build_rs_dirty.rs: build.rs included via#[path]; fixture repos cover clean / dirty / staged-but-uncommitted / untracked-exempt / restored trees, digest stability, and digest sensitivity to content. 5 passed.scripts/release/verify-rubash-pin.py: the standalone auditor.--fetchdry-runs the exact release fetch recipe into a temp dir and verifies (rev + version + clean);--self-testproves a tampered rev, wrong version, dirty tree, and missing checkout all fail;--fetch-self-testdoes both against the real remote — pass + tamper-rejection both demonstrated live.ci.ymlruns the self-test on every PR;pin-freshness.ymlruns the weekly fetch dry-run so a rotted pin (e.g. upstream rewrite) surfaces as a report, not a red release.ci.yml's dev-line rubash clones deliberately stay floating on master: development should keep testing tomorrow's engine; only the release pipeline pins.Verification
cargo check --lockedgreen;cargo test --locked(build_rs_dirty + rubash_revision_banner) 7/7;niu --versionprints exactlyrubash git 992d5c5e6fa6— the release smoke grep's expected substring.verify-rubash-pin.py --fetch-self-testlive: pinned rev fetched, verified, tampered rev rejected; Windows temp cleanup hardened (git's read-only objects no longer strand fixture dirs).actionlinton this box — CI is the arbiter.Cargo.lockis unchanged (sha2 already in the root deps list; the build-dependency adds no new resolution).Refs rubash#827 (recommendations ② and ③). Follow-ups it deliberately does not attempt: release-body warning for the shipped v1.4.0 assets, v1.4.1 re-cut, and the tag-discipline proposal (filed separately).