Skip to content

Stop ec deploy and ec start writing enabled: true - #271

Merged
gilesknap merged 3 commits into
mainfrom
deploy-drop-enabled
Oct 1, 2026
Merged

gilesknap merged 3 commits into
mainfrom
deploy-drop-enabled

Conversation

@gilesknap

@gilesknap gilesknap commented Oct 1, 2026 •

Copy link
Copy Markdown
Member

The argocd-apps chart defaults a service to enabled and only acts on an explicit enabled: false. ec deploy and ec start --commit remove the service's enabled key instead of writing enabled: true, so a deployment repo's apps/values.yaml stays free of redundant flags. ec stop --commit still writes enabled: false. A service mapping emptied by the removal is written as {} (the schema rejects null).

set_values()/push_values() gain a remove_keys parameter, generalising the existing redundant-targetRevision removal.

Writes to apps/values.yaml:

  • ec deploy/ec start --commit/ec stop --commit on a service with no services.<name> entry raise a clear GitError and commit nothing. set_values distinguishes a missing intermediate path segment (the service itself absent) from an absent leaf key (nothing to remove).
  • Removing a key keeps the comment and blank lines that follow it - section headers such as # DAQ services ... stay where they were. Only the removed line's own end-of-line comment goes with it.
  • An entry emptied by a removal stays valid YAML even when its first body line is a comment (e.g. a commented-out #targetRevision: above the live pin); the comment is kept above {}.
  • YamlFile.dump_file parses the YAML it produces before writing; output that does not parse raises GitError and nothing is written, committed or pushed.

Tested: full suite (121 passed), ruff, pyright, also the YAML tests under ruamel.yaml 0.19.1; real-CLI end-to-end against scratch copies of b01-1-deployment and i19-deployment with a fake argocd (41 scenarios: every written values.yaml parses; ec deploy b01-1-tiled main keeps #targetRevision: enable-tiled; deploying i19-epics-opis main keeps the DAQ section header).

🤖 Generated with Claude Code

https://claude.ai/code/session_015CNJRqN3sP4tk4gXcWP12y

Summary by CodeRabbit

  • Bug Fixes
    • Deployments no longer add explicit enabled: true overrides; existing enabled overrides are removed.
    • Deploying a service that is missing from the deployment configuration now fails without changing the file or Git state.
    • YAML updates that can’t be safely written now stop without modifying the file or creating a commit.
    • Removing values preserves comments and formatting, and missing intermediate configuration paths are reported as errors.
  • New Features
    • Configuration updates can now remove specified values, including alongside other deployment changes.

The argocd-apps chart defaults a service to enabled and only acts on an
explicit enabled: false. ec deploy and ec start --commit now remove the
service's enabled key instead of writing enabled: true, so apps/values.yaml
stays free of redundant flags. ec stop --commit still writes enabled: false.
A service mapping emptied by the removal is written as {}.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_015CNJRqN3sP4tk4gXcWP12y
@coderabbitai

coderabbitai Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 54a7136c-7295-4653-8233-d15d26dc9987

📥 Commits

Reviewing files that changed from the base of the PR and between 961e987 and 16e7d0e.

📒 Files selected for processing (5)
  • src/edge_containers_cli/git.py
  • src/edge_containers_cli/utils.py
  • tests/data/argocd.yaml
  • tests/test_argocd.py
  • tests/test_git.py

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

Values updates can now remove YAML paths and clear matching Argo CD overrides. YAML serialization is validated before writes, and key removal preserves surrounding comments. Deploy and committed start remove the service’s explicit enabled value instead of writing true.

Changes

Service override removal

Layer / File(s) Summary
Validate and remove YAML paths
src/edge_containers_cli/utils.py
YAML utilities distinguish missing intermediate paths from missing leaves. Serialization is validated before writing, and comments are retained when keys are removed.
Remove paths from values
src/edge_containers_cli/git.py, tests/test_git.py
set_values accepts paths to remove, ignores absent leaves, and includes successful removals in commit messages. Tests cover removals, comment preservation, and errors that leave files and Git state unchanged.
Remove enabled overrides
src/edge_containers_cli/cmds/argo_commands.py, tests/test_argocd.py, tests/data/argocd.yaml
push_values forwards removal paths and clears matching overrides. Deploy and committed start remove the service’s enabled key. Tests cover deployments when a service has no values entry.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant ArgoCommands
  participant push_values
  participant set_values
  participant ValuesRepository
  participant ArgoCDOverrides
  ArgoCommands->>push_values: Pass enabled key for removal
  push_values->>set_values: Pass remove_keys
  set_values->>ValuesRepository: Remove YAML paths
  push_values->>ArgoCDOverrides: Unset removed-key overrides and child overrides
Loading

Suggested reviewers: ocopping

Merge Risk: ⚪ Minimal · up to 16e7d

No concrete merge-blocking issue is identified. The described changes remove redundant enabled flags while retaining explicit stop behavior and guarding invalid YAML writes. Merge after normal checks pass.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 16e7d

The change preserves existing deployment authority and adds safeguards against invalid YAML and updates to missing services. No introduced security finding was established. Remaining uncertainty concerns configuration convergence after interruption and compatibility with the deployed chart.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The effective privileged outcomes remain publication to the selected application's values repository and modification of that application's Helm parameter overrides. Service commands use service-scoped paths, while the generic helpers can modify other supplied paths under the caller's existing Git and Argo authority; they are not authorization boundaries.

Trust Boundaries and Controls

  • observed — The existing Argo application metadata determines the repository and values-file location used for mutation. The change does not replace that trust relationship. Its added controls reject missing intermediate paths and unparsable serialized output before publication, rather than granting new credentials or enforcing repository authorization.

Resilience and Maintainability Implications

  • inferred — Repeated removal can resume override cleanup without requiring another values commit because an absent leaf is a no-op and push_values continues into cleanup. Actual repeated-unset behavior and concurrent remote updates remain unverified, so this supports local repeatability rather than a complete recovery guarantee.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 27.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 40 functions across 5 files. (1 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the main change: ec deploy and ec start --commit stop writing enabled: true.
Full details: Docstring Coverage

Explanation

Docstring coverage is 27.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 40 functions across 5 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


Comment @coderabbitai help to get the list of available commands.

gilesknap and others added 2 commits October 1, 2026 15:58
set_values treated a missing intermediate path segment (e.g. an absent
services.<svc> entry) the same as a genuinely-absent leaf key, so
ec deploy/ec start --commit on a service never added to the deployment
repo's values.yaml committed nothing and reported success whenever the
requested version matched the revision line. Add YamlPathNotFoundError
to distinguish the two cases in YamlFile.set_key/remove_key, and raise
GitError from set_values when one is hit - restoring the 5.4.1/5.5.0b1
behaviour of failing clearly instead of silently succeeding.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_015CNJRqN3sP4tk4gXcWP12y
Removing the last key of a service entry whose first body line is a
comment (a commented-out pin above the live one) left ruamel emitting
`{}` at column 0 after the comment - unparseable YAML that ec committed
and pushed. An emptied mapping is now replaced by a fresh one, which
keeps the comment and emits valid YAML.

Removing a key also took the comment and blank lines that follow it
with it, deleting section headers such as i19's "# DAQ services ..."
when the service above them was deployed. Those lines now move to
whatever precedes the removed key; only the removed line's own
end-of-line comment goes with it.

YamlFile.dump_file parses the YAML it produces before writing it and
refuses to write anything that does not parse, so set_value, set_values
and del_key raise GitError and commit nothing.

set_value (ec stop --commit) on a service missing from values.yaml now
raises the same GitError as deploy and start --commit instead of a raw
YamlPathNotFoundError traceback.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_015CNJRqN3sP4tk4gXcWP12y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant