Skip to content

feat(tui): surface off-tag build identity in version badge - #1390

Merged
TheGreatAxios merged 1 commit into
mainfrom
cl-10469-surface-off-tag-build-identity-in-tui-version-badge
Oct 13, 2026
Merged

TheGreatAxios merged 1 commit into
mainfrom
cl-10469-surface-off-tag-build-identity-in-tui-version-badge

Conversation

@bwachman

@bwachman bwachman commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Bakes git-derived build identity into the TUI version badge at build time via 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.
  • Introduces scripts/build-info.ts (gathers git describe/count/hash/dirty metadata once) and src/version.ts (DISPLAY_VERSION), consumed by both the badge (LANDING_VERSION) and --version (CLI_VERSION_TEXT), with a plain v<pkg.version> fallback for unbuilt dev/test runs so existing output stays byte-identical.
  • Badge formats: v0.3.36 on a clean tag, -dirty on a dirty tree, v0.3.36-N-g<hash> past a tag, +g<hash> when no tags exist, plain v0.3.36 outside a git repo. Short hash pinned to a stable --short=7 so the same commit renders the same identity regardless of clone.
  • Scope is local builds only (build and build:bin); the tagged release pipeline (release.sh, distribution binaries) is intentionally unstamped, and release.sh only 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, and bun run test pass
  • bun test ./src → 8231 pass / 0 fail across 514 files
  • bun scripts/build-info.ts emits a valid 7-char-hash define from the repo
  • Whole-branch review green (single squashed commit, no follow-up-repair commits)

Fixes CL-10469

@linear-code

linear-code Bot commented Oct 10, 2026

Copy link
Copy Markdown

CL-10469

@bwachman
bwachman force-pushed the cl-10469-surface-off-tag-build-identity-in-tui-version-badge branch from 83b4c57 to e97bd8b Compare October 11, 2026 20:18
@bwachman
bwachman force-pushed the cl-10469-surface-off-tag-build-identity-in-tui-version-badge branch from e97bd8b to 30e4eca Compare October 11, 2026 20:50
@bwachman
bwachman changed the base branch from main to cl-10206-document-and-pin-the-bounded-stall-policy-for-parked October 11, 2026 20:50
Comment thread scripts/build-info.test.ts Resolved
Comment thread scripts/build-info.ts Resolved

@TheGreatAxios TheGreatAxios left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@bwachman
bwachman force-pushed the cl-10469-surface-off-tag-build-identity-in-tui-version-badge branch from 30e4eca to fb9b903 Compare October 13, 2026 00:50
@bwachman
bwachman force-pushed the cl-10206-document-and-pin-the-bounded-stall-policy-for-parked branch from 7e1e070 to 8890609 Compare October 13, 2026 00:50
@bwachman
bwachman force-pushed the cl-10469-surface-off-tag-build-identity-in-tui-version-badge branch from fb9b903 to b406132 Compare October 13, 2026 00:52
@bwachman

Copy link
Copy Markdown
Contributor Author

Addressing the three items from the review body:

  • release.sh comment: the sync comment now documents the deliberate exception: release builds omit build:bin's --define "$(bun scripts/build-info.ts)" because they compile before the release tag exists, so the binary shows the plain package version (src/version.ts falls back to v<package version> when CORBITS_BUILD_INFO is absent). See release.sh#L141-L145 and the fallback at version.ts#L3-L8.
  • IMPLEMENTATION.md: the bun run build line in Build and Validation now notes the version badge stamp via --define "$(bun scripts/build-info.ts)" (docs/IMPLEMENTATION.md#L555-L556).
  • Single commit: the style commit is squashed in, so the branch is now exactly one commit (b406132) and the body's claim holds.

Also, after rebasing onto main (package.json is now 0.3.37) the "outside a git repo" CLI test failed because it hardcoded v0.3.36. It now reads the version from package.json, so it will not break on the next bump (build-info.test.ts#L225-L236).

@TheGreatAxios
TheGreatAxios force-pushed the cl-10206-document-and-pin-the-bounded-stall-policy-for-parked branch from 8890609 to ede3f14 Compare October 13, 2026 02:32
@corbits-triage

corbits-triage Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

@bwachman, please address the following:

  • required checks are failing: typecheck, test (src), build-and-test, prettier, eslint, test (4/4), test (2/4), build, test (1/4), test (3/4), static-analysis

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.
@TheGreatAxios
TheGreatAxios force-pushed the cl-10469-surface-off-tag-build-identity-in-tui-version-badge branch from b406132 to 169e718 Compare October 13, 2026 02:49
@TheGreatAxios
TheGreatAxios changed the base branch from cl-10206-document-and-pin-the-bounded-stall-policy-for-parked to main October 13, 2026 02:49
@TheGreatAxios
TheGreatAxios merged commit 700a2a8 into main Oct 13, 2026
15 of 26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants