[quality] test: BATS coverage for shared.just (powerwash, toggle-tpm2) - #1034
Open
kubestellar-hive[bot] wants to merge 1 commit into
Open
[quality] test: BATS coverage for shared.just (powerwash, toggle-tpm2)#1034kubestellar-hive[bot] wants to merge 1 commit into
kubestellar-hive[bot] wants to merge 1 commit into
Conversation
system_files/shared/usr/share/ublue-os/just/shared.just had zero test coverage. Its powerwash recipe performs an irreversible factory reset (sudo bootc install reset --experimental) behind two gum confirmations, with a bctl fast path that must bypass those prompts. tests/test_shared_just.bats extracts the powerwash shebang recipe body and executes it against stubbed bctl/gum/sudo binaries, asserting: bctl delegation short-circuits gum and sudo; declining either confirmation cancels without wiping; non-affirmative and empty answers decline; two prompts are always required; and the reset runs exactly once only after both confirmations. toggle-tpm2 is checked for its absolute luks-tpm2-autounlock path. Co-authored-by: Copilot <[email protected]> Signed-off-by: kubestellar-hive[bot] <kubestellar-hive[bot]@users.noreply.github.com>
This was referenced Aug 29, 2026
hanthor
approved these changes
Sep 2, 2026
hanthor
left a comment
Member
There was a problem hiding this comment.
New tests/test_shared_just.bats for the destructive powerwash recipe and toggle-tpm2; extracts and executes the real recipe body against stubbed bctl/gum/sudo, verifying both confirmations are required, non-affirmative/empty answers decline, and the reset command fires exactly once. CI test green; validate fails only on title-lint.
Generated by Claude Code
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.
Test Improvement
Adds
tests/test_shared_just.bats— 14 BATS cases coveringsystem_files/shared/usr/share/ublue-os/just/shared.just, which had zerotest coverage.
Why this file
powerwashis the most destructive recipe in the repo: it ends insudo bootc install reset --experimental, an irreversible factory reset. It isguarded by two
gum chooseconfirmations plus abctl powerwashfast path.None of that gating was verified by any test.
How
The
powerwashbody is a#!/usr/bin/bashshebang recipe with nojustinterpolation, so the test extracts it verbatim and executes it against
stubbed
bctl/gum/sudobinaries. This exercises real control flow ratherthan grepping recipe text, and requires no
justbinary in CI.Asserted behavior:
bctlpresent → delegates tobctl powerwash, andgum/sudoare never invokedsudosudomaybe) and empty answers → treated as declinessudo bootc install reset --experimental, exactly oncetoggle-tpm2uses the absolute/usr/bin/luks-tpm2-autounlockpathAll 14 pass locally (bats 1.14.0). Mutation-checked: deleting the second
confirmation from
shared.justfails 3 of the tests.Scope / disjointness
Claimed ground:
tests/test_shared_just.batsonly — one new test file, noproduction code touched.
Deliberately does not touch
.github/workflows/unit-tests.yml(claimed byopen PRs #942 and #961) and does not touch
system.just(#942),apps.just(#1007),default.just(#1003),bonedigger-report(#1010),hooks.py(#1011), orublue-fastfetch(#1005). CI registration of this andthe other test files not yet wired into
unit-tests.ymlis tracked separatelyby #968.
Filed by quality agent (hold-gated mode). Human review required. Do not merge on my behalf.
— hive: agent=quality backend=copilot model=claude-opus-5