Report the OSATE and language-server build in osate-cli help - #6
Merged
Conversation
Closes #5. `osate-cli help` now reports what the CLI was built from: osate-cli 0.1.0 language server 0.1.0.v20260902-1320 (7fbfec9) OSATE 2.19.0.vfinal (4256148) None of this is discoverable at runtime, which is what shaped the design. OSATE bundles carry independent versions — org.osate.aadl2 is 6.1.1, not 2.19.0 — and no bundle manifest records a commit, so both OSATE values have to be baked in. scripts/build-test-release is the only place that knows the osate2 gitlink and the built language-server bundle version, so it supplies all four values and Maven filters them into version.properties beside the existing version. osate.commit is the gitlink rather than the submodule's HEAD: it is the reviewed pin, and the build already refuses to proceed when the two disagree. --version is deliberately untouched. Its output is compared for exact equality by CliEndToEndIT and parsed by the packaging scripts' --expect-version check, so versionLine() stays one line and a new versionDetail() carries the provenance into help() only. A test now pins that, because the temptation to append to the version line is obvious and the breakage would be remote. ls.commit gains a -dirty suffix when the tree had uncommitted changes. Without it the commit would appear to identify code that is not what was compiled; the superproject is allowed to be dirty during development, unlike the submodule, so marking is better than refusing. Both the suffix and the commit it decorates are recorded before any build runs, so they describe the sources that went in. build-provenance.properties gets the same treatment for tooling.commit, which had the identical problem. Two release guards, since the values only appear when the build goes through the script: - build-release-artifacts.sh refuses to package a distribution reporting 'unknown', so a hand-built CLI cannot be released claiming a provenance it does not have. - It also refuses one whose recorded osate.commit disagrees with the current gitlink, extending an invariant the source build already enforces to the artifact. A dirty tree only warns there. The -dirty suffix is already visible in the jar and in help, so the artifact is not misleading, and failing would block the local packaging smoke tests that packaging/README.md documents. abbreviate() shortens only the leading hex run, so <sha>-dirty displays as 7fbfec9-dirty rather than losing the marker that says the value cannot be trusted, and a placeholder like 'unknown' is returned untouched instead of being truncated into something that reads like a commit. Incidentally removes a Maven invocation: osate.version is now read from the pinned submodule's pom, which the --skip-osate precondition check was already doing separately. Verified: --version unchanged; help shows all three lines; the guards accept a correct dist, reject an unknown-provenance one, and reject a gitlink mismatch; VersionTest covers both the supplied and unsupplied provenance paths (it skips one or the other depending on how the build ran, and both were exercised). Documented in OSATE-CLI.md with four new manual-test cases.
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.
Closes #5.
Why it is baked in rather than discovered
None of this is available at runtime, which is what shaped the design. OSATE bundles carry independent versions —
org.osate.aadl2is 6.1.1, not 2.19.0 — and no bundle manifest records a commit.scripts/build-test-releaseis the only place that knows both theosate2gitlink and the built language-server bundle version, so it supplies all four values and Maven filters them intoversion.propertiesbeside the existing version.osate.commitis the gitlink, not the submodule's HEAD: it is the reviewed pin, and the build already refuses to proceed when the two disagree.--versionis deliberately untouchedIts output is compared for exact equality by
CliEndToEndITand parsed by the packaging scripts'--expect-versioncheck. SoversionLine()stays one line and a newversionDetail()carries the provenance intohelp()only. A test pins that, because appending to the version line is an obvious temptation and the breakage would show up somewhere unrelated.-dirty, and why it warns rather than failsls.commitgains a-dirtysuffix when the tree had uncommitted changes — without it the commit would appear to identify code that is not what was compiled. The superproject is allowed to be dirty during development, unlike the submodule, so marking beats refusing. Both the suffix and the commit are captured before any build runs, so they describe the sources that went in.build-provenance.propertiesgets the same treatment fortooling.commit, which had the identical problem.abbreviate()shortens only the leading hex run, so<sha>-dirtydisplays as7fbfec9-dirtyrather than dropping the marker that says the value cannot be trusted, andunknownis returned untouched instead of truncated into something that reads like a commit.Release guards
The values only appear when the build goes through the script, so:
build-release-artifacts.shrefuses to package a distribution reportingunknown— a hand-built CLI cannot be released claiming a provenance it does not have.osate.commitdisagrees with the current gitlink, extending to the artifact an invariant the source build already enforces.A dirty tree only warns there: the suffix is already visible in the jar and in
help, so the artifact is not misleading, and failing would block the local packaging smoke testspackaging/README.mddocuments.Verified
--versionunchanged;helpshows all three lines.unknown-provenance jar, rejects a gitlink mismatch.VersionTestcovers both provenance paths — it skips the "reports unknown" case when the build supplied values and runs it when it did not, and both were exercised across a scripted and a standalone build.OSATE-CLI.md, with four cases added to the CLI manual test plan.Incidentally removes a Maven invocation:
osate.versionis now read from the pinned submodule's pom, which the--skip-osateprecondition check was already doing separately.🤖 Generated with Claude Code