Skip to content

Report the OSATE and language-server build in osate-cli help - #6

Merged
lwrage merged 1 commit into
mainfrom
cli-report-osate-provenance
Sep 2, 2026
Merged

Report the OSATE and language-server build in osate-cli help#6
lwrage merged 1 commit into
mainfrom
cli-report-osate-provenance

Conversation

@lwrage

@lwrage lwrage commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Closes #5.

$ osate-cli help
osate-cli 0.1.0
  language server 0.1.0.v20260902-1320 (7fbfec9)
  OSATE           2.19.0.vfinal (4256148)

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.aadl2 is 6.1.1, not 2.19.0 — and no bundle manifest records a commit. scripts/build-test-release is the only place that knows both 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, not 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 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 fails

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 beats refusing. Both the suffix and the commit are captured 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.

abbreviate() shortens only the leading hex run, so <sha>-dirty displays as 7fbfec9-dirty rather than dropping the marker that says the value cannot be trusted, and unknown is 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.sh refuses to package a distribution reporting unknown — 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 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 tests packaging/README.md documents.

Verified

  • --version unchanged; help shows all three lines.
  • Guards exercised all three ways: accepts a correct dist (with the dirty warning), rejects an unknown-provenance jar, rejects a gitlink mismatch.
  • VersionTest covers 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.
  • Documented in OSATE-CLI.md, with four cases added to the CLI manual test plan.

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.

🤖 Generated with Claude Code

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.
@lwrage
lwrage merged commit 5a27dee into main Sep 2, 2026
3 checks passed
@lwrage
lwrage deleted the cli-report-osate-provenance branch September 2, 2026 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

osate-cli should report the OSATE and language-server versions it was built from

2 participants