fix: flakemetry --version reported 0.0.0 whatever was installed - #287
Merged
Conversation
Found while looking for tasks small enough to hand a first-time contributor. This one is too misleading to leave lying around: CLI_VERSION was a hardcoded '0.0.0' while the package published 0.2.1, so the first thing anyone is asked for in a bug report identified nothing at all. Baked in at build time rather than read at runtime, because the published package has no package.json beside the bundle to resolve from. The test runs the built binary rather than reading the source constant — the constant cannot tell whether the define actually reached the bundle, which is the only thing that matters here. Removing the define makes it fail with 0.0.0-dev, which is also a better fallback than a version that looks real.
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.
Found while looking for tasks small enough to hand a first-time contributor for #78. This one is too misleading to leave lying around as bait.
CLI_VERSIONwas a hardcoded'0.0.0'. The version is the first thing anyone is asked for in a bug report, and this one identified nothing — including for the config bug fixed in #279, where0.2.0and0.2.1behave very differently.Baked in at build time rather than read at runtime: the published package has no
package.jsonbeside the bundle to resolve from.The test runs the binary
It executes the built
dist/cli.jsrather than importing the constant, because the constant cannot tell whether thedefinereached the bundle — which is the only thing that matters. Proved by removing the define:The fallback is
0.0.0-devrather than0.0.0, so an unbuilt or misbuilt binary says so instead of impersonating a release.62/62 turbo tasks.