Skip to content

Let ec delete finish when the service's entry is already gone - #273

Merged
gilesknap merged 1 commit into
mainfrom
delete-absent-key
Oct 2, 2026
Merged

gilesknap merged 1 commit into
mainfrom
delete-absent-key

Conversation

@gilesknap

Copy link
Copy Markdown
Member

Summary

ec delete <svc> on a service whose services.<svc> entry is already gone
from the deployment repo's apps/values.yaml (removed by a direct commit while
the Argo CD Application still exists) crashed with a raw traceback:

YamlFileError: Entry '<svc>' in 'services.<svc>' not found

del_key caught only FileNotFoundError/ShellError, so the error escaped
push_remove_key before its argocd app unset and argocd app get <root> --refresh steps - the refresh is what lets the root app prune the orphaned
child Application.

  • An already-absent key now makes no commit, logs
    WARNING: services.<svc> already absent from apps/values.yaml - no commit made,
    and push_remove_key goes on to the unset and refresh.
  • A missing intermediate segment (no services: at all) raises GitError
    with nothing written, the same as set_value/set_values since Stop ec deploy and ec start writing enabled: true #271.
  • A service Argo CD does not know is still refused by _check_service.

Test plan

  • tox -e pre-commit,type-checking,tests - 149 passed; the 3 new tests
    (test_del_key_already_absent_makes_no_commit,
    test_del_key_missing_parent_raises,
    test_delete_already_absent_still_refreshes) fail without the fix
  • Real CLI with a fake argocd against a bare repo seeded from the
    b01-1-deployment apps/values.yaml: delete of a present entry is
    unchanged; delete of an already-removed entry exits 0, makes no commit,
    and runs app unset + app get <root> --refresh (5.5.0: traceback,
    exit 1, neither ran); delete of a service not in Argo is still refused

🤖 Generated with Claude Code

https://claude.ai/code/session_013HgLeGnwBSg3Xx1VgxEpt8

del_key let the YamlFileError from remove_key escape when the key was
already absent from values.yaml (e.g. removed by a direct commit while
the Argo CD app still existed), so ec delete crashed with a traceback
and never reached the parameter unset and root app refresh that let
Argo CD prune the app.

An absent key now makes no commit and logs a one-line note, and
push_remove_key carries on with the unset and refresh. A missing
intermediate segment raises GitError with nothing written, as in
set_value/set_values. A service Argo CD does not know is still refused
by _check_service.

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

coderabbitai Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

This review ran on the open-source allowance, not this organization's plan, because the pull request author doesn't have an assigned seat. Waiting won't change this — ask an organization admin to assign them a seat, or add seats in Billing if every seat is already assigned, then retry.

Next included review available in 12 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: d82d4a89-2915-47d0-890d-d0064782346c

📥 Commits

Reviewing files that changed from the base of the PR and between 1ef067d and 5e893d3.

📒 Files selected for processing (4)
  • src/edge_containers_cli/git.py
  • tests/data/argocd.yaml
  • tests/test_argocd.py
  • tests/test_git.py
  • 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
gilesknap merged commit 4cda5a6 into main Oct 2, 2026
11 checks passed
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