feat(version): train-aware update check baked into the binary (FJ-15) #13
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/version-train-aware-check-fj-15"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Builds on FJ-14 to make
fj version --checktrain-aware. The binary now bakes which publish train it came from (releasevs the rollinglatest) plus its git SHA, and the check follows that train: semver against the newest fork release forrelease, git-SHA against a published manifest forlatest. A--train <release|latest>flag redirects the check at the other train for one invocation.Resolves FJ-15.
Why
The
latesttrain is rolling: every build under thelatestpackage tag carries the sameCARGO_PKG_VERSION, so semver cannot distinguish twolatestbuilds. A per-build identity (the git SHA) is required, and the binary did not previously know its train or SHA (BUILD_TYPE/GIT_SHAwere never baked).Changes
crates/fj/build.rs: bakeFJ_TRAIN(fromFJ_TRAIN) andFJ_GIT_SHA(fromGIT_SHA) asrustc-env, skipping empty values so a plaincargo buildreadsNone; addrerun-if-env-changedforFJ_TRAINandGIT_SHA.oci-build/get-tags.nu: add--train, emittingreleasefor an exactv*tag andlatestotherwise.oci-build/DockerfileandDockerfile.windows: addARG FJ_TRAINand exposeFJ_TRAIN+GIT_SHAasENVto the real-sourcecargo build(dummy-prime builds untouched)..forgejo/workflows/build-binary.ymlandbuild-binary-windows.yml: pass--build-arg FJ_TRAIN=<train>and, after uploading the binary to thelatestpackage version, publish a per-arch manifest (version-linux-x86_64.json/version-windows-x86_64.json, separate filenames so the two workflows do not race) withtrain,tag,sha,built_at.crates/fj/src/version.rs(underupdate-check): add--train <release|latest>defaulting to the baked train; print baked train and SHA underversion --verbose; thelatestbranch GETs the per-arch manifest, compares itsshatoFJ_GIT_SHA, and prints up-to-date or a newlatest_behindmessage with the Generic Packages download URL. Thereleasebranch keeps FJ-14 behavior.msg-version-update_check-latest_behindadded to every locale (translated for the compiled en-US / de-DE / zh-Hans bundles, English placeholder for the dormant it/pl/ru/tok files).Testing
cargo fmt --check,cargo clippy --all-targets -- -D warnings(default and--features update-check),cargo test, and feature builds all pass;build.rsvalidates all seven locale files.fj version --verboseprints the baked train and SHA; a build withFJ_TRAIN=latest GIT_SHA=...correctly shows them, andrerun-if-env-changedrebuilds on change.fj version --check --train latesthits.../forgejo-cli/latest/version-linux-x86_64.json(404 until this PR's workflow publishes the manifest);--check(release default) hits the Releases API.Note
The commit uses a bare
#FJ-15reference (noState Donetrailer). Per the repo's Forgejo VCS integration, commit commands are applied at push time, not merge time, so aState Donetrailer would resolve the issue prematurely while this PR is still under review. The issue staysIn Progressand AI Agent is set toCode Review.