fix(test): compare the baked build ID against the build-time git observation - #38
Merged
Conversation
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.
The
version_build_id_reports_the_repository_dirty_stategate compared the-dirtysuffix baked into the binary at compile time against agit statusthe test ran at test time. Those are two observations of the working tree at two different moments, so an untracked file appearing in between - a probe script, a scratch log - made a correctly behaving binary report clean while the test's own git call reported dirty. The assertion failed with no bug to find. It failed exactly that way during the line-box investigation.What changed
build.rsnow publishes what it observed rather than letting it survive only as a suffix:DEVUP_MCP_GIT_DIRTY-true/false/unknownwhen git could not be askedDEVUP_MCP_BUILD_ID_SOURCE-git/env/unknown, so an injectedDEVUP_MCP_BUILD_IDis not mistaken for a git observationThe test asserts against those build-time facts. An injected identity carries whatever suffix its caller chose, and an unknown observation says nothing about this plumbing, so neither is asserted. The run-time comparison stays as a note on stderr: a tree that moved between building and running is information about the run, not a fault in the binary.
What remains under test is the chain that can actually break - the git observation, the suffix
git_identityderives from it, and--versionprinting the baked value faithfully.Verification
The failing sequence, reproduced on a clean tree and now passing:
devup-mcp 0.4.5 (aadffa5ab4ff), no suffixrerun-if-changeddoes not cover a new root-level file) ->19 passed; 0 failedUnder the previous assertion step 3 evaluated
false == trueand failed.Gates:
fmt0,clippy --locked --workspace --all-targets --all-features -D warnings0,cargo test --workspace1049 passed / 0 failed / 2 ignored,insta --checkno drift,stdio_smoke2 passed.