Stamp source builds from the release tag and add an e2e suite on the built binary - #45
Open
guygrigsby wants to merge 3 commits into
Open
guygrigsby wants to merge 3 commits into
guygrigsby wants to merge 3 commits into
Conversation
A make install or go build binary reported a commit height (B29), so a running binary could not be matched to the release it came from. The goreleaser build already stamped the tag, so the height scheme only ever showed on source builds, which is every build a dev runs. git describe gives the tag on a release commit and the tag plus distance past it otherwise, for both the Makefile ldflags and the init() fallback plain go build exercises. Keeping B-numbers would have cost nothing to write and stayed unmatchable against the release list forever.
Every existing test exercises internals in-process; nothing executed the shipped binary, so the flag-before-TUI ordering, the PTY handoff to a launched agent, and the return to the picker after the child exits were all untested at the level users hit them. Four tests against the real build: -version, a bad endpoint failing before the TUI takes the terminal, the Pi happy path against a fake Aperture (httptest /v1/models) with a stub pi on PATH recording argv and capturing the generated provider extension while it exists, and the unreachable-endpoint banner. Runs hermetically: temp HOME/XDG, PATH of the stub dir plus system dirs only so host agent binaries cannot leak into the picker. creack/pty is promoted from the module graph; no new third-party code. TERM=dumb because startup asks the terminal its color profile and a PTY never answers — with xterm each run paid the five-second query timeout. Skipped: bridge flows (need a control plane), install flows (network), Windows PTYs.
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.
Source builds now report the release tag instead of a commit count.
make build,make installand a plaingo buildall stampedB<n>(the commit height), so a running binary could not be matched to the release it came from. Goreleaser already stamps{{.Tag}}, so the height scheme only ever showed on dev builds. That is every build a dev runs.Both the Makefile ldflags and the
init()fallback incmd/aperture/main.gonow usegit describe --tags --always --dirty. A release commit reportsv0.0.12, a commit past it reportsv0.0.12-3-g492405band a modified tree gets-dirty. Nothing parses the version string (-version, the run log and the TUI footer only print it), so the format change is display only.Also adds an
e2epackage that drives the built binary. Every existing test ran internals in-process, so the flag-before-TUI ordering, the PTY handoff to a launched agent and the return to the picker after the child exits were untested where users hit them.TestMainbuilds the binary once and four tests run it for real:-versionprints a release version.httptestserving/v1/models) and a stubpion PATH that records its argv and copies the generated provider extension while it still exists. The test checks the extension routes back to the fake Aperture and thatqquits cleanly after the child exits.Runs are hermetic.
HOMEandXDG_CONFIG_HOMEpoint at a temp dir. PATH is the stub dir plus/usr/binand/binonly, so host agent binaries stay out of the picker.TERM=dumbbecause startup asks the terminal its color profile and a PTY never answers, which cost every run a five second timeout under xterm.creack/ptyis promoted from the module graph, no new third-party code. The package sits under./..., somake checkand CI pick it up with no wiring. AGENTS.md now asks for unit and e2e tests with all new functionality.Risks:
make buildthere stamps a bare short hash andTestVersiononly asserts the value is notB0-dev. Tagged releases are unaffected becauserelease.yamlfetches with depth 0.fetch-depth: 0inci-linux.yamlwould make CI match a dev box./usr/binand/bin. A box withgitorshsomewhere else (Nix, for one) failsTestVersion, because a plaingo buildhas no version source without git and staysB0-dev.