[architect] test: files/ payload reachability gate — tests/unit/test_files_payload_reachability.py - #155
Open
kubestellar-hive[bot] wants to merge 2 commits into
Open
[architect] test: files/ payload reachability gate — tests/unit/test_files_payload_reachability.py#155kubestellar-hive[bot] wants to merge 2 commits into
kubestellar-hive[bot] wants to merge 2 commits into
Conversation
…files_payload_reachability.py
Every path under files/ reaches an image only if some element stages it with a
kind: local source. Nothing cross-checks the two sides, so a payload directory
that no element names is invisible to `just validate` (which runs
`bst show --deps all` on the three oci/ targets only), to the image build, and
to the unit suite, because bats tests run helper scripts out of the checkout
whether or not they ship.
files/bin/system-container is the live instance: docs/skills/system-containers.md
promises it at /usr/bin/system-container in the OS image, it has bats coverage,
and no element stages it.
Add a gate asserting both directions of the contract:
- every kind: local `path:` declared by an element still exists on disk, so
renaming payload cannot silently drop it out of the image;
- every file under files/ is staged, declared host tooling (HOST_TOOLING:
files/bin/bluefin-kubestellar, files/lima), or a recorded waiver.
KNOWN_UNSTAGED holds exactly files/bin/system-container and is shrink-only:
staging a waived path fails the gate until the waiver is removed, so the record
cannot outlive the bug. The gate is structural only — no element, payload, or
documentation is changed, so /usr/bin/system-container is still absent from the
image until a maintainer decides to stage it or to correct the docs.
Refs #154
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: sec-check[bot] <sec-check[bot]@users.noreply.github.com>
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.
Refactor
Adds one file:
tests/unit/test_files_payload_reachability.py. No element,payload, workflow, or document is modified.
Cluster claimed
tests/unit/test_files_payload_reachability.pyelements/**/*.bst(parsed forkind: localpath:sources), the
files/tree listing.elements/bluefin-server/os-stack.bst,elements/oci/k0s-sysext.bst,files/k0s/sysext/k0s-manifests.conf,tests/unit/test_k0s_manifests.py,tests/unit/test_kubestellar_kiosk.py,.github/scripts/docs-checks.py,files/installer/repart.d/**,include/flatcar.yml,elements/flatcar/**,renovate.json,files/bin/**,docs/**.The structural problem
files/is the image-payload tree. A file reaches an image only when someelement stages it with a
kind: localsource:Nothing cross-checks the two sides. A directory under
files/that no elementnames is invisible to
just validate(which only runsbst show --deps allonoci/bluefin-server-ddi.bst,oci/bluefin-server-installer.bst, andoci/k0s-sysext.bst), invisible to the image build, and invisible to the unitsuite, because bats tests execute helper scripts straight out of the checkout
whether or not they ship. The reverse direction is equally unguarded: a
renamed payload directory leaves a stale
path:on the element and quietlyremoves the payload from the image.
files/bin/system-containeris the live instance —docs/skills/system-containers.mdcalls it "
/usr/bin/system-container... shipped in the OS image" (line 18)and "The OS image ships a small helper at
/usr/bin/system-container" (line 38),tests/unit/system-container_test.batscovers it, and no element stages it.Full analysis in #154.
What the gate asserts
test_declared_source_paths_exist— everykind: localpath:declared byany element still exists on disk (parametrized per declared path).
test_every_payload_file_is_staged_or_declared— every file underfiles/is staged by an element, declared host tooling, or a recorded waiver.
test_host_tooling_declarations_are_not_stale—HOST_TOOLING(
files/bin/bluefin-kubestellar,files/lima) still exists and is stillunstaged.
test_known_unstaged_waivers_are_still_unstaged—KNOWN_UNSTAGEDisshrink-only: staging a waived path fails the gate until the waiver is deleted,
so the record cannot outlive the bug it describes.
test_at_least_one_element_stages_payload— guards the gate itself, so aparser regression cannot make it vacuously pass.
KNOWN_UNSTAGEDholds exactly one entry,files/bin/system-container, citing#154. The gate therefore passes today and fails the moment a second orphan
appears.
Deliberately not fixed here
Staging
system-containerinto the image is a behaviour change (it adds abinary to the shipped OS) and correcting the skill is a documentation decision.
Both belong to a maintainer. This PR only makes the invariant checkable, which
is why it references #154 rather than closing it.
Verification
python3 -m pytest tests/unit -q→235 passed, 1 xfailed(was211 passed, 1 xfailed; +24 from this file, all parametrized or new).python3 .github/scripts/docs-checks.py→Docs checks passed.files/os/orphan/thing.conf→ fails withassert not ['files/os/orphan/thing.conf'];files/os/ssh→ fails withelements/bluefin-server/os-sshd-config.bst declares a kind: local source path that does not exist: files/os/ssh;files/bin/system-container→ fails withfiles/bin/system-container is now staged by an element. Remove it from KNOWN_UNSTAGED.Picked up automatically by
just test-unitand.github/workflows/unit-tests.yml;no workflow change needed.
Refs #154 — the gate lands here; deciding whether
system-containerships orthe docs are corrected is left open for maintainers.
Filed by architect agent (ACMM L5 — hold-gated mode). Hold-gated: human review required.
— hive: agent=architect backend=copilot model=claude-opus-5