Skip to content

test(version): coverage for publish-gating version derivation — scripts/review-appliance-version.sh, scripts/contribute-version.sh - #575

Open
kubestellar-hive[bot] wants to merge 1 commit into
mainfrom
quality/test-version-derivation
Open

kubestellar-hive[bot] wants to merge 1 commit into
mainfrom
quality/test-version-derivation

Conversation

@kubestellar-hive

Copy link
Copy Markdown
Contributor

Test Improvement

Adds tests/version-derivation.sh, black-box coverage for the two publish-gating version scripts. No production code changes.

Files/functions claimed by this PR:

  • new: tests/version-derivation.sh
  • modified: tests/appliance-contract.sh (one added block, immediately after its existing version="$(bash scripts/review-appliance-version.sh)" check)
  • under test (unmodified): scripts/review-appliance-version.sh, scripts/contribute-version.sh, image/appliance/REVISION, image/contribute/REVISION

Why

Those two scripts decide the tag publish-appliance.yml and publish-contribute.yml push. Nothing executed them except the happy path on the committed tree — validate.yml:111 and tests/appliance-contract.sh:122 each just capture their output. Every other branch was unverified, so a regression was observable only as a bad publish.

Covered

Each case runs the real script against a synthetic repo root, so each script's own $(dirname "$BASH_SOURCE")/.. resolution is exercised rather than mocked.

  • zero-padding of the tool revision, including 0
  • 10#$revision octal protection for REVISION 08 and 09
  • digest stripping, digestless tags, patched base tags, registry-with-port refs
  • rejection of a missing ARG FSDK_BASE_IMAGE, an empty or unparseable base tag, and a missing, empty or non-integer REVISION — each with a diagnostic on stderr and nothing on stdout
  • first ARG default winning over a later restatement in a second build stage
  • the committed tree yielding a well-formed version for both images
  • appliance and contribute agreeing on the FSDK series, which their two Containerfiles pin independently

Mutation-checked: changing printf '%02d' to printf '%d' in review-appliance-version.sh fails the suite.

One characterization, not a contract

REVISION is read through tr -d '[:space:]', which deletes interior whitespace rather than rejecting it, so 3 4 publishes revision 34 — while both scripts' diagnostics say the file "must contain a single integer". The test records the current behaviour with a comment pointing at #574. Fixing it is a production change and is deliberately out of scope here.

Registration

tests/test-registry.sh requires every test to be reachable from validate.yml within one hop. This PR reaches it through tests/appliance-contract.sh rather than adding a validate.yml step, matching the existing precedent in that file for tests/appliance_sbom_contract.py ("Its own contract runs here rather than as a separate validate.yml step"). No workflow file is touched.

Verified locally

tests/version-derivation.sh, tests/test-registry.sh (16 files, all reachable), tests/appliance-contract.sh, tests/contribute-contract.sh, tests/check-commit-message.sh, shellcheck v0.11.0 with the repo's --exclude set, and shfmt -i 2 -d — all clean.

Related Issue

Closes #574

Overlap check

No open PR in the snapshot touches this cluster. review#571 is the extension module reachability gate over image/extension/**; review#566 is the PR reader extension; review#570 is a dependency digest bump. None touch scripts/*version*.sh, tests/appliance-contract.sh, or tests/version-derivation.sh.


Filed by quality agent (hold-gated mode). Human review required.

— hive: agent=quality backend=copilot model=claude-opus-5

scripts/review-appliance-version.sh and scripts/contribute-version.sh
decide the tag publish-appliance.yml and publish-contribute.yml push, but
nothing executed them except the happy path on the committed tree
(validate.yml and tests/appliance-contract.sh both just capture their
output). Every other branch was unverified, so a regression in them was
observable only as a bad publish.

tests/version-derivation.sh runs both scripts against synthetic repo
roots, so each script's own "$(dirname "$BASH_SOURCE")/.." resolution is
exercised rather than mocked. It covers:

  - zero-padding of the tool revision, including 0
  - 10#$revision octal protection for REVISION 08 and 09
  - digest stripping, digestless tags, patched base tags, registry ports
  - rejection of a missing ARG FSDK_BASE_IMAGE, an empty or unparseable
    base tag, and a missing, empty or non-integer REVISION, each with a
    diagnostic on stderr and nothing on stdout
  - first ARG default winning over a later restatement
  - the committed tree yielding a well-formed version for both images
  - appliance and contribute agreeing on the FSDK series, which their
    Containerfiles pin independently

One case is a characterization rather than a contract: REVISION is read
through 'tr -d [:space:]', which deletes interior whitespace instead of
rejecting it, so '3 4' publishes revision 34. Recorded with a comment
pointing at the issue; changing it is a production fix, not a test.

Reached from validate.yml through tests/appliance-contract.sh, which
already hosts the appliance SBOM contract for the same reason, so
tests/test-registry.sh stays green without a workflow edit.

Closes #574

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: sec-check[bot] <sec-check[bot]@users.noreply.github.com>
@kubestellar-hive kubestellar-hive Bot added hold Work is intentionally paused. quality Code quality or test-coverage work. testing Test authoring or test infrastructure. agent/quality Filed or owned by the quality agent. hive/hosted-projectbluefin-knuckle-gjvq Routed by the hosted Project Bluefin Hive deployment. labels Sep 15, 2026
@kubestellar-hive kubestellar-hive Bot changed the title [quality] test: coverage for publish-gating version derivation — scripts/review-appliance-version.sh, scripts/contribute-version.sh test(version): coverage for publish-gating version derivation — scripts/review-appliance-version.sh, scripts/contribute-version.sh Sep 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent/quality Filed or owned by the quality agent. hive/hosted-projectbluefin-knuckle-gjvq Routed by the hosted Project Bluefin Hive deployment. hold Work is intentionally paused. quality Code quality or test-coverage work. testing Test authoring or test infrastructure.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[quality] coverage-gap: publish-gating version derivation is untested — scripts/review-appliance-version.sh and scripts/contribute-version.sh

0 participants