Repository navigation
test: cement Next public API contracts - #1569
Conversation
Signed-off-by: Sebastian Εaskawiec <sebastian.laskawiec@defenseunicorns.com>
|
@codex review |
|
@greptileai review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
βΉοΈ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with π while any review is running, comments if it has suggestions, and reacts with π once all reviews finish with no findings. |
|
|
Codex Review: Didn't find any major issues. π Reviewed commit: βΉοΈ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with π. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
7c151c9 to
056f559
Compare
|
@codex review |
|
@greptileai review |
There was a problem hiding this comment.
π‘ Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 056f55914d
βΉοΈ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with π.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
056f559 to
fb8848a
Compare
|
@codex review |
|
@greptileai review |
There was a problem hiding this comment.
π‘ Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fb8848a5ed
βΉοΈ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with π.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
fb8848a to
da8dd5f
Compare
|
@codex review |
|
@greptileai review |
There was a problem hiding this comment.
π‘ Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: da8dd5fe10
βΉοΈ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with π.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
da8dd5f to
d5c4510
Compare
|
@codex review |
|
@greptileai review |
There was a problem hiding this comment.
π‘ Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d5c45103f0
βΉοΈ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with π.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
5acd73b to
59f4aa7
Compare
|
@codex review |
|
@greptileai review |
There was a problem hiding this comment.
π‘ Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 59f4aa73b1
βΉοΈ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with π.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Signed-off-by: Sebastian Εaskawiec <sebastian.laskawiec@defenseunicorns.com>
59f4aa7 to
6eae82b
Compare
There was a problem hiding this comment.
Copilot review overview
π‘ Changes recommended
Root error-handling was updated to rely on RunE/returned errors, but internal Zarf command wiring still uses util.CheckErr (os.Stderr + os.Exit), which breaks the new contract and can terminate in-process executions unexpectedly.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Open (1)
What changed in this PR
This PR cements Next-mode public Go API contracts (primarily pkg/bundle, pkg/bundle/spec, pkg/iostreams) and restructures the Next test suite into a unit / library / CLI pyramid, with CI and contributor docs updated to match.
Changes:
- Adds/expands
tests/librarycontract coverage for public types, errors, signing/verification, deploy source lifecycle, configuration propagation, and extension points. - Refactors Next CLI command wiring to consistently return errors via
RunE, adds a test helper for in-process Cobra execution, and limits true process-level checks to a minimal binary entrypoint suite. - Updates CI workflows, local tasks, and contributor documentation to run the new test divisions and (when needed) provision Zarf-ready clusters outside the suites.
| File | Description |
|---|---|
| tests/βtestutil/βpath.go | Removes wrappers that executed the built CLI binary; keeps Cobra-based helpers. |
| tests/βtestutil/βcluster.go | Switches CLI test helpers from execβing a binary to in-process Cobra execution via ExecuteCLI. |
| tests/βtestutil/βcli.go | Adds serialized in-process CLI execution helper (ExecuteCLI) that restores global process state. |
| tests/βtestutil/βcli_test.go | Verifies executeCLI restores cwd, slog default, and Helm managed-fields manager after errors. |
| tests/βlibrary/βstreams_contract_test.go | Establishes public iostreams behavior contracts and logger propagation. |
| tests/βlibrary/βspec_contract_test.go | Establishes public bundle spec validation + typed error identity contracts. |
| tests/βlibrary/βsource_lifecycle_test.go | Contracts for PrepareDeploySource path resolution, tmpdir behavior, and cleanup ownership. |
| tests/βlibrary/βsigning_contract_test.go | Contracts for public sign/verify flows for local artifacts and OCI references. |
| tests/βlibrary/βremove_artifact_test.go | Refactors removal artifact tests to use library fixtures and public entrypoints. |
| tests/βlibrary/βreconfigure_contract_test.go | Adds public reconfigure contract coverage (local + OCI) including signature behavior. |
| tests/βlibrary/βpolicy_contract_test.go | Validates exported signing/policy options and their Validate() error identities. |
| tests/βlibrary/βkeyless_contract_test.go | Adds CI-only keyless signing contracts and keyless package verification coverage. |
| tests/βlibrary/βfixtures_test.go | Introduces reusable public-library fixtures (bundle, packages, registry) with public-only deps. |
| tests/βlibrary/βextension_contract_test.go | Contracts for custom loader/staging behavior and hook visibility. |
| tests/βlibrary/βdeploy_subset_test.go | Strengthens dependency-violation assertions via typed error extraction. |
| tests/βlibrary/βconfiguration_contract_test.go | Contracts for config propagation to hooks, defaults merge immutability, and template vars. |
| tests/βlibrary/βcluster/βlifecycle_test.go | Public API cluster lifecycle smoke (owned cluster) via library deploy. |
| tests/βlibrary/βcluster/βfixtures_test.go | Cluster fixture generation for public API cluster tests (non-owned). |
| tests/βlibrary/βcluster/βenvironment_test.go | In-cluster vs owned-cluster environment contracts and k3d lifecycle helpers. |
| tests/βintegration/βcmd/βzarf/βzarf_integration_test.go | Removed legacy Next βintegrationβ tier test file (migrated to tests/cli). |
| tests/βintegration/βcmd/βbundle/βremove_integration_test.go | Removed legacy Next βintegrationβ tier remove suite (migrated to tests/cli). |
| tests/βintegration/βcmd/βbundle/βdeploy_integration_test.go | Removed legacy Next βintegrationβ tier deploy suite (migrated to tests/cli). |
| tests/βintegration/βcmd/βbundle/βcreate_integration_test.go | Removed legacy Next βintegrationβ tier create tests (migrated/layered elsewhere). |
| tests/βintegration/βcmd/βbundle/βbundle_assertions_test.go | Removed duplicated archive assertion utilities (replaced by fixtures/artifact helper). |
| tests/βfixtures/βartifact/βarchive.go | Adds neutral artifact inspection utilities for OCI archive assertions without large blobs. |
| tests/βcluster/βoperator_monitor_test.go | Switches to in-process CLI invocation and uses Zarf APIs for deploy/remove of monitor package. |
| tests/βcluster/βlifecycle/βlifecycle_test.go | Adds CLI lifecycle contract test for owned-cluster creation/cleanup through Cobra execution. |
| tests/βcluster/βbundle_remove_test.go | Migrates cluster remove test to in-process CLI execution; removes redundant tarball/OCI variants. |
| tests/βcluster/βbundle_deploy_test.go | Consolidates deploy+remove flows for artifact/OCI using in-process CLI and structured results. |
| tests/βcluster/βbootstrap_test.go | Removes redundant bootstrap assertion test (covered via new lifecycle coverage). |
| tests/βcli/βcmd/βzarf/βzarf_integration_test.go | Adds minimal process-level entrypoint coverage for Zarf passthrough and exit behavior. |
| tests/βcli/βcmd/βversion/βversion_integration_test.go | Retags integration test to cli layer. |
| tests/βcli/βcmd/βbundle/βsigning_integration_test.go | Retags and refactors signing CLI coverage; removes duplicated tamper/pull tests moved to library. |
| tests/βcli/βcmd/βbundle/βremove_integration_test.go | Adds CLI-layer remove suite using in-process Cobra execution helper. |
| tests/βcli/βcmd/βbundle/βreconfigure_integration_test.go | Retags to cli and leans on new shared fixture helpers. |
| tests/βcli/βcmd/βbundle/βhelpers_test.go | Refactors helpers to use new artifact fixture reader and in-process ExecuteCLI. |
| tests/βcli/βcmd/βbundle/βdeploy_integration_test.go | Adds CLI-layer deploy suite using in-process Cobra execution helper. |
| tests/βcli/βcmd/βbundle/βcreate_integration_test.go | Adds CLI-layer defaults/create contracts and programmatic artifact creation fixture. |
| tests/βcli/βcmd/βbundle/βbundle_integration_test.go | Retags to cli and refactors to use new fixture helpers and reduced duplicate coverage. |
| tasks/βtests.yaml | Replaces next-integration tasks with explicit next-unit, next-library-*, next-cli-* tasks. |
| pkg/βbundle/βdeploy.go | Ensures PrepareDeploySource returns absolute paths and resolves tmpdir defaults safely. |
| internal/βcli/βversion/βversion.go | Converts version command to RunE error returns instead of util.CheckErr. |
| internal/βcli/βcore/βoperator_monitor.go | Converts operator monitor to RunE error returns instead of util.CheckErr. |
| internal/βcli/βcmd.go | Silences Cobraβs default error/usage printing and routes logging to provided IOStreams. |
| internal/βcli/βbundle/βverify.go | Converts verify command to RunE error returns instead of util.CheckErr. |
| internal/βcli/βbundle/βsign.go | Converts sign command to RunE error returns instead of util.CheckErr. |
| internal/βcli/βbundle/βremove.go | Converts remove command to RunE error returns instead of util.CheckErr. |
| internal/βcli/βbundle/βreconfigure.go | Converts reconfigure command to RunE error returns instead of util.CheckErr. |
| internal/βcli/βbundle/βpush.go | Converts push command to RunE error returns instead of util.CheckErr. |
| internal/βcli/βbundle/βpull.go | Converts pull command to RunE error returns instead of util.CheckErr. |
| internal/βcli/βbundle/βinspect.go | Converts inspect command to RunE error returns instead of util.CheckErr. |
| internal/βcli/βbundle/βdev_remove.go | Converts dev remove command to RunE error returns instead of util.CheckErr. |
| internal/βcli/βbundle/βdev_deploy.go | Converts dev deploy command to RunE error returns instead of util.CheckErr. |
| internal/βcli/βbundle/βdeploy.go | Converts deploy command to RunE error returns instead of util.CheckErr. |
| internal/βcli/βbundle/βcreate.go | Converts create command to RunE error returns instead of util.CheckErr. |
| hack/βtest-cluster.sh | Adds external cluster provision/cleanup helper for supplied-cluster CI runs. |
| docs/βadr/β0027-public-api-test-pyramid.md | Introduces ADR defining the test pyramid and its constraints for Next. |
| CONTRIBUTING.md | Updates contributor guidance to new Next test tiers and tasks. |
| AGENTS.md | Updates agent guidance for Next test pyramid, error handling, and task mapping. |
| .github/βworkflows/βtest.yaml | Splits Next CI into unit/library/cli divisions and adds supplied-cluster provisioning for in-cluster suites. |
| .github/βworkflows/βtest-shim.yaml | Updates shim workflow to mirror the new Next pyramid job names. |
| .agents/βskills/βtesting/βSKILL.md | Updates testing skill to reference ADR-0027 and new Next test structure. |
| .agents/βskills/βtesting/βreferences/βTESTING.md | Updates testing strategy docs to the new pyramid and cluster execution model. |
| .agents/βskills/βgo-development/βreferences/βGO_CODE_STANDARDS.md | Updates Go standards doc to reflect RunE error return and new test locations. |
π‘ Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
bradclawsie
left a comment
There was a problem hiding this comment.
An incredible amount of work and if your time-savings claims are true, a big win. With so much code here I think it will take some iterations to let everyone get a crack at it. I liked to see the move from Run to RunE. My points so far are minor, looking forward to what others have to say.
chance-coleman
left a comment
There was a problem hiding this comment.
some initial review comments
Signed-off-by: Sebastian Εaskawiec <sebastian.laskawiec@defenseunicorns.com>
β¦i-302 Signed-off-by: Sebastian Εaskawiec <sebastian.laskawiec@defenseunicorns.com> # Conflicts: # tests/cluster/bundle_deploy_test.go # tests/integration/cmd/bundle/create_integration_test.go # tests/integration/cmd/bundle/deploy_integration_test.go
bradclawsie
left a comment
There was a problem hiding this comment.
I've read this over twice. Overall its too much for someone to comprehend. Read yes, comprehend, no. Maybe in the future make these stacked PRs. Given that the code is test-focused I am not too concerned about blast radius; if this were production code I might demur from review. Approved since I didn't see anything that jumps out at me and the code appears to be good quality. Will be interested to see what others say about the sheer volume.

Description
Cements Next public Go API contracts and divides the Next test suite into unit, library, and CLI layers. Library tests use only public UDS packages; CLI tests use Cobra, with one minimal process check.
Related Issue
Relates to CLI-302
Coverage
CI timing
Measured required Next CI critical path: 9m00 -> 7m11 (-1m49, -20.2%). Each run includes checkout, tool setup, tests, and cleanup. Optional smoke tests are excluded.
The complete repository workflow also runs unchanged Legacy jobs. It is not compared here because the pre-change reference was a snapshot workflow with optional smoke work enabled.
Type of change
Checklist before merging