Repository navigation
Description
Problem
devops k8s deploy-stack and teardown-stack refuse an environment tree that lacks a path of their own tables (#7290). They do not check a Helm values file that an Application names. A dry run on a tree that lacks such a file succeeds and lists the missing file.
Done when
- A dry run and a real run stop with a
ConfigurationErrorthat names the missing values file, for each values file that resolves into the environment tree. A test fails on the base.
Alternatives check of 2026-11-26: none.
Tool: none found.
Reason: No searched tool validates the Helm values paths that Argo CD Applications name against an environment tree; Helm and Argo CD only report a missing file when they render or sync, so the deploy-stack check stays in the CLI.
Lacks:
- No check of Application values files against the tree
- No ConfigurationError that names the missing file
- No dry-run check of teardown-stack values files
Proposed design
Problem statement
The deploy-stack and teardown-stack commands refuse an environment tree that lacks a path of their own tables, but they do not check a Helm values file that an Argo CD Application names. A dry run on a tree that lacks such a file succeeds and lists the missing file. Both commands must stop with a ConfigurationError that names each missing values file, in a dry run and in a real run.
Acceptance criteria
Requirement: deploy-stack dry run names a missing values file
The devops k8s deploy-stack command SHALL stop with a ConfigurationError that names each values file of an Application chart source that resolves under the environment tree and is absent.
Scenario: Dry run on a tree with one absent values file
- WHEN a test builds a temporary environment tree whose Application chart source names an absent values file under the tree and runs
devops k8s deploy-stack --dry-runon it - THEN the command raises
ConfigurationErrorand its message contains the path of the absent values file
Requirement: deploy-stack real run stops before a cluster request
The deploy-stack command MUST run the values-file check before it sends any request to the cluster or runs Helm.
Scenario: Real run on a tree with one absent values file
- WHEN a test runs
devops k8s deploy-stackin real mode on the tree through the process seam that records each call - THEN the command raises
ConfigurationErrorthat names the file, and the seam records no kubectl or helm call
Requirement: teardown-stack dry run names a missing values file
The devops k8s teardown-stack command SHALL stop with a ConfigurationError that names each absent values file of an Application chart source that resolves under the environment tree.
Scenario: Dry run of teardown-stack on a tree with one absent values file
- WHEN a test runs
devops k8s teardown-stack --dry-runon the tree - THEN the command raises
ConfigurationErrorand its message contains the path of the absent values file
Requirement: teardown-stack real run stops before a cluster request
The teardown-stack command MUST run the values-file check before it sends any request to the cluster or runs Helm.
Scenario: Real run of teardown-stack on a tree with one absent values file
- WHEN a test runs
devops k8s teardown-stackin real mode on the tree through the process seam that records each call - THEN the command raises
ConfigurationErrorthat names the file, and the seam records no kubectl or helm call
Requirement: Each absent values file is named
The ConfigurationError MUST name every absent values file, not only the first one.
Scenario: Two Applications with two absent values files
- WHEN a test builds a tree whose two Applications name two different absent values files and runs
devops k8s deploy-stack --dry-run - THEN the message of the
ConfigurationErrorcontains both paths
Requirement: A values file outside the environment tree is not checked
The check MUST skip a values file whose resolved path is not under the environment tree root.
Scenario: Application names an absent path outside the tree
- WHEN a test builds a tree whose Application names an absent values file outside the tree and runs
devops k8s deploy-stack --dry-run - THEN the command raises no
ConfigurationErrorfor that path
Requirement: A present values file passes the check
The check SHALL pass an environment tree when each values file that resolves under the tree exists.
Scenario: Tree with a present values file
- WHEN a test builds a tree whose Application names a values file that exists under the tree and runs
devops k8s deploy-stack --dry-run - THEN the command raises no
ConfigurationErrorfor the values file
Existing Tool Considered
No open, maintained tool covers the need. helm/helm and argoproj/argo-cd, the tools that read the values files that an Application names, report a missing file only when they render or sync: Helm fails in helm template or helm install, and Argo CD's repo-server fails at render or sync. Neither validates the helm.valueFiles paths against the environment tree before deploy-stack or teardown-stack touches the cluster, and the alternatives check of 2026-11-26 found no tool. The check stays in the CLI. Cost: about 40,000 tokens and about 3 hours to build the check and its tests; about 10,000 tokens a year to keep and fix it.
Key questions
- Which exception must the check raise?:
ConfigurationError, the configuration error defined atsrc/devops_cli/exceptions/config.py:10and listed in the error table ofdocs/ERRORS.md:50. [sources: src/devops_cli/exceptions/config.py:10, docs/ERRORS.md:50] - Where does the check run so that both commands and both modes stop?: In one method on
EnvironmentTree,require_value_files(trees), next torequireandrequire_applications.deploy_stackandteardown_stackcall it right after_stack_roots, before_collect_deploy_targetsor_collect_teardown_targetsand before any cluster request. One check covers both commands and both modes. (best practice) [sources: src/devops_cli/k8s/environment.py:107, src/devops_cli/k8s/environment.py:123, src/devops_cli/commands/k8s/stack_lifecycle.py:1730, src/devops_cli/commands/k8s/stack_lifecycle.py:1967]- Chosen: One method on the shared
EnvironmentTree. One check covers both commands and both modes, next to the existing tree checks, with no second copy. - Rejected: In each command before its first request. Two copies drift, and the teardown path already differs from the deploy path.
- Chosen: One method on the shared
- Which values files of an Application does the check read?: The
helm.valueFilesof the Application's chart source thatchart_sourcesgives (a source with achartand atargetRevision), in their order. Each path is resolved as deploy-stack resolves it: a$<ref>/<path>names<path>in the source whoserefis<ref>, and any other path is relative to the checkout of the environment tree. The check reads no other path of the Application. [sources: openspec/specs/k8s-helm-deploy/spec.md:145, src/devops_cli/k8s/app_sources.py:165, src/devops_cli/k8s/app_sources.py:127, k8s/README.md:22] - Does the check cover a values file whose path leaves the environment tree?: No. The check resolves the path and checks it only when it is under the root of the environment tree (
EnvironmentTree.root); a$refsource of another repository and a path outside the tree are skipped, as the issue scopes it. (best practice) [sources: CONTEXT.md:300, src/devops_cli/k8s/environment.py:50, src/devops_cli/k8s/app_sources.py:127]- Chosen: Check only paths under the environment tree root. The issue scopes the check to the tree, and a shared file outside it is not part of the tree.
- Rejected: Check each resolved path, inside or outside the tree. A file outside the tree is not part of it, and the check would stop a tree that works.
- Does the check fetch a
$refsource of another repository?: No. A$refsource whose repository is not the origin resolves outside the environment tree, so the check skips it without a fetch. Only a plain path or a$refto the origin is resolved and checked. This keeps the check offline and avoids a fetch of an unrelated repository. (best practice) [sources: src/devops_cli/k8s/app_sources.py:99, src/devops_cli/k8s/app_sources.py:127, CONTEXT.md:300]- Chosen: Skip a
$refof another repository without a fetch. Its file is outside the tree, and a dry run must fetch nothing. - Rejected: Resolve every
$refthroughSourceTrees.value_file. It fetches an unrelated repository for a file that the check would skip, and a private repository can fail the command.
- Chosen: Skip a
- Does the check read every Application of the tree or only the selected stacks?: Every Application under
EnvironmentTree.application_dirs, because the issue checks each values file that resolves into the tree, and a tree with a missing values file is invalid for any command. Limiting the check to the selected stacks would leave the gap for teardown and for a later stack. (best practice) [sources: src/devops_cli/k8s/environment.py:58, src/devops_cli/k8s/environment.py:123, src/devops_cli/k8s/app_sources.py:165]- Chosen: Every Application of the tree. The check validates the tree, as
require_applicationsdoes, and covers teardown and every later stack. - Rejected: Only the Applications of the selected stacks. A missing file in another Application stays hidden, and teardown reads no release table to select from.
- Chosen: Every Application of the tree. The check validates the tree, as
- How does the change show that the new test fails on the base?: Write the test first and run it at the base commit; the pull request records the failure before the fix, as rule 4 of
AGENTS.mdrequires. [sources: AGENTS.md:10]
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 26, 2026
Both concern values files in deploy-stack, but #6680 changes the source to Applications while the candidate adds a stop-on-missing-file error.devops-cli-service commentedon Nov 26, 2026
The result in the alternatives block of the issue body changed. Before this check: no check. A person decides what the new result means for the item.
Searches (10)
Tools considered:
Searches run:
Sources:
devops-cli-service commentedon Nov 28, 2026
Next step: the stage job writes the plan of the item. See the section Proposed design of the body.