Repository navigation
feat(tui): surface off-tag build identity in version badge - #1390
TheGreatAxios merged 1 commit into
Conversation
83b4c57 to
e97bd8b
Compare
e97bd8b to
30e4eca
Compare
TheGreatAxios
left a comment
There was a problem hiding this comment.
Feature verified end-to-end — all six version formats, define injection, byte-identical fallback, and release-pipeline isolation confirmed by running the real script and builds. Five items: the body's single-squashed-commit claim (branch has 2), the now-misleading release.sh sync comment, the stale IMPLEMENTATION.md build command, and two untested edge paths (real git describe exit-128, tag-present-count-null degrade).
scripts/release.sh:132 — The "match package.json build:bin" / "Keep this block in sync" comment is now misleading: build:bin gained the build-info --define (package.json:33) while compile_bin intentionally omits it — release binaries build before the new tag exists. Update the comment to document the intentional divergence.
Plain: the comment says the release build must stay identical to the dev build, but they now deliberately differ — the release binary shouldn't show a dev commit hash. Say why.
docs/IMPLEMENTATION.md:555 — Still documents bun run build without the build-info define step now in package.json:32. Update the doc.
Plain: the docs still describe the old build command. Update them.
PR BODY — Body says "single squashed commit, no follow-up-repair commits" but the branch has two: a9a6d94 (feat) + 30e4eca (style/oxfmt). Update the body or squash.
Plain: the description says one clean commit, but there are two (one is just formatting). Fix the description or squash.
30e4eca to
fb9b903
Compare
7e1e070 to
8890609
Compare
fb9b903 to
b406132
Compare
|
Addressing the three items from the review body:
Also, after rebasing onto main (package.json is now 0.3.37) the "outside a git repo" CLI test failed because it hardcoded |
8890609 to
ede3f14
Compare
|
@bwachman, please address the following:
|
Bake git-derived build identity at build time via bun --define into both build and build:bin, exposing a single DISPLAY_VERSION source. LANDING_VERSION and CLI_VERSION_TEXT both consume it with a dev/test fallback to plain v<pkg.version>, so unbuilt runs stay byte-identical. The badge shows describe-style tag-N-g<hash> when past a tag, -dirty on a dirty tracked tree, +g<hash> when no tags exist, and plain v<version> on a clean tag or outside a git repo. The git short hash is pinned to a stable --short=7 so the same commit renders the same identity regardless of clone. LANDING_VERSION is a live re-export of DISPLAY_VERSION so tests mock it in-process without a child-process harness.
b406132 to
169e718
Compare
Summary
bun --define, so an off-tag build (dev checkout, PR branch, fork) shows which commit it was built from instead of only the release version.scripts/build-info.ts(gathers git describe/count/hash/dirty metadata once) andsrc/version.ts(DISPLAY_VERSION), consumed by both the badge (LANDING_VERSION) and--version(CLI_VERSION_TEXT), with a plainv<pkg.version>fallback for unbuilt dev/test runs so existing output stays byte-identical.v0.3.36on a clean tag,-dirtyon a dirty tree,v0.3.36-N-g<hash>past a tag,+g<hash>when no tags exist, plainv0.3.36outside a git repo. Short hash pinned to a stable--short=7so the same commit renders the same identity regardless of clone.buildandbuild:bin); the tagged release pipeline (release.sh, distribution binaries) is intentionally unstamped, andrelease.shonly gains a comment documenting that divergence.Verification
After the rebase onto main and the review fixes, CI passes on b406132; the results below are from the original verification.
bun run typecheck,bun run build, andbun run testpassbun test ./src→ 8231 pass / 0 fail across 514 filesbun scripts/build-info.tsemits a valid 7-char-hash define from the repoFixes CL-10469