unbridled-41 opened a new pull request, #5432:
URL: https://github.com/apache/rocketmq-dashboard/pull/5432

   ## Problem / Evidence
   
   `rmqctl/scripts/build-windows.ps1` injects its own version default, and it 
had drifted from the rest of the build:
   
   | Entry point | Version |
   |---|---|
   | `rmqctl/Makefile:18` | `VERSION ?= 3.0.0` |
   | `rmqctl/cmd/app.go:32` | `CLIVersion = "3.0.0"` |
   | `rmqctl/scripts/build-windows.ps1:46` (pre-fix) | `[string]$Version = 
"1.0.0"` |
   
   The script's own header states it builds the "counterpart to the 
cross-compilation done by `make build-all`" and the ldflags block is commented 
"Version metadata, mirroring the Makefile LDFLAGS" (`:69`), so a Windows build 
done with the documented command reports a version no other build produces:
   
   ```
   .\scripts\build-windows.ps1
   .\bin\rmqctl.exe version      # rmqctl: 1.0.0
   ```
   
   That is the version users quote in bug reports and that any telemetry 
carries, and it sends them looking for a release that does not exist.
   
   ## Root cause / Fix
   
   A third copy of the version literal was missed when the CLI moved to 3.0.0. 
Align the default, and add `rmqctl/cmd/version_metadata_test.go`, which reads 
the Makefile and the script and asserts both agree with `cmd.CLIVersion` — so 
the next release bump has to touch all three entry points.
   
   ## Priority & scoring
   
   PRIORITY 50 = 影响 14 (a shipped binary reports a wrong version, on the only 
documented Windows build path) + 波及 6 (rmqctl Windows builds) + 可复现 20 
(deterministic: the literal is wrong) + 维护价值 10 (a test now pins the three 
entry points together).
   
   FIX_CONFIDENCE 90: one literal, plus a test that fails on the pre-fix value 
and passes after; no build behaviour otherwise changes.
   
   ## Tests
   
   ```
   cd rmqctl && go test ./cmd/ -run 
TestVersionMetadataAgreesAcrossBuildEntryPoints -v
   ```
   
   - Red before the fix: `version_metadata_test.go:43: build-windows.ps1 
default = "1.0.0" but cmd.CLIVersion = "3.0.0"`.
   - Green after: `--- PASS: TestVersionMetadataAgreesAcrossBuildEntryPoints`.
   - `go vet ./cmd/` clean and the full `go test ./...` suite passes (including 
the scripts package).
   
   ## Risk
   
   Low. The version string is already overridable with `-Version`; only the 
default changes, and the new test fails loudly if the three sources diverge 
again.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to