Skip to content

Add service descriptions as an Argo Application annotation (edge-containers-cli#255, onto main) - #259

Merged
gilesknap merged 7 commits into
mainfrom
feat/description-annotation
Sep 22, 2026
Merged

gilesknap merged 7 commits into
mainfrom
feat/description-annotation

Conversation

@gilesknap

Copy link
Copy Markdown
Member

This lands edge-containers-cli#255 on main.

edge-containers-cli#255 was stacked on edge-containers-cli#254's branch, and its base was never switched to main after edge-containers-cli#254 merged. Merging it therefore went into fix/deploy-preserves-service-keys, not main. This PR brings the same branch, feat/description-annotation (head 5c0622a), into main. See edge-containers-cli#255 for the change, the review and the evidence.

🤖 Generated with Claude Code

gilesknap and others added 6 commits September 21, 2026 13:24
…nnotation

The argocd-apps helm chart is gaining a per-service `description` value,
a sibling of `labels`, rendered as the annotation
`epics-containers.github.io/description` on the Application's OWN
metadata. Descriptions are an Argo CD feature only - the plain-Kubernetes
backend never supported them properly (it silently dropped --desc), so
it now refuses --desc with a clear error instead.

Built on the previous commit's leaf-key push mechanism: `--desc` now
writes the plain `services.<name>.description` key (never `labels`),
`--desc ""` clears it, and free text is accepted (the kebab-case
validation only existed because it used to be a Kubernetes label).
Every reader (the confirm-prompt display, and the `ps`/monitor listing)
now reads `metadata.annotations["epics-containers.github.io/description"]`
off the Application, not the StatefulSet - a clean switch with no
fallback to the old label, since the feature is barely used and the
owner doesn't want two sources of truth for it.

This is deliberately stacked on, and separable from, the previous
data-loss fix: an older argocd-apps chart schema in use elsewhere
rejects an unknown `description` key under services.<name> (confirmed
by a real helm render), so this commit can only ship once that chart is
adopted, while the data-loss fix ships immediately.

Co-Authored-By: Claude Opus 5 <[email protected]>
The owner wants a way to fix a service's description without knowing or
re-supplying its current version, and without going through `ec deploy`
at all (which would also touch enabled/targetRevision).

`push_values`/`set_values` gain a `require_keys` check: if the
service's parent `services.<name>` entry doesn't already exist in the
values repo, nothing is written, committed or pushed - a GitError is
raised instead. Without this, `ec set-desc` on an unknown/undeployed
service would write a lone `description` key and argocd-apps would
render a phantom Application from the resulting partial entry. This is
checked inside the same clone `set_values` already makes, so it costs
no extra git operation on the success path.

`ArgoCommands.set_description` writes only the `description` leaf key
via `push_values`, and shows old -> new using the existing display-only
`_get_description` annotation reader. The plain-k8s backend implements
it just to raise the same "Argo CD backend only" error as `--desc`
(factored into `k8s_commands.DESC_UNSUPPORTED`), so the command stays
visible there rather than silently disappearing. The demo backend
doesn't implement it, so it's auto-dropped from that backend's CLI like
`deploy` already is.

Co-Authored-By: Claude Opus 5 <[email protected]>
argocd-apps releases before the one carrying ec-helm-charts#122 reject a
`description` key in their schema, which breaks the deployment's root app
and stops every service syncing. `ec deploy --desc` and `ec set-desc` now
read the argocd-apps dependency version from the root app's Chart.yaml in
the same clone and refuse before writing if it is older than 5.10.0.

The check fails closed when the version cannot be determined (missing
dependency, file:// or a version range). Pre-releases of the minimum pass,
so a beta tag can be trialled on one beamline first.

Co-Authored-By: Claude Opus 5 <[email protected]>
Descriptions are now an Argo CD Application annotation only. The
plain-Kubernetes backend never had a way to write one and #255 already
refuses --desc/set-desc there, so its ps label read of
metadata.labels.description is dead weight - and a stale leftover
label from before this PR would otherwise still surface. The shared
`label` column stays, since both backends' ps output share one
schema, but on this backend it's now a fixed "service" placeholder.

Adds a test proving a stale description label is ignored rather than
shown.

Co-Authored-By: Claude Opus 5 <[email protected]>
…ption, require_keys mapping check

- git.py: shlex.quote the commit message at all three call sites that
  build one from caller-supplied text (set_value, set_values, del_key).
  shell.run_command runs via asyncio.create_subprocess_shell, so an
  unquoted message (e.g. a description containing `"` or `$(...)`) could
  break out of the quoting and run arbitrary shell commands. This pattern
  predates this PR (already on origin/main).
- commands.py: mark Commands.set_description as @AbstractMethod, like its
  restart/start/stop siblings, so a new backend must make a deliberate
  choice instead of silently inheriting NotImplementedError.
- demo_commands.py: implement DemoCommands.set_description - validates
  the service and runs the same confirm_callback flow as the other
  backends; there's nothing to persist since the demo schema has no
  description field.
- git.py: set_values' require_keys check now verifies the fetched value
  is a Mapping, not just that get_key() didn't raise - a null or scalar
  services.<name> entry no longer slips past the check meant to stop
  creating a partial entry for an undeployed service.

Adds tests for all three: a malicious description round-trips literally
through the quoted git commit (test_argocd.py, test_git.py), del_key and
set_value are quoted too (test_git.py), require_keys rejects a null/
scalar intermediate (test_git.py), and DemoCommands.set_description no
longer raises NotImplementedError (test_demo.py).

Co-Authored-By: Claude Opus 5 <[email protected]>
require_keys in git.set_values now treats a bare `name:` entry (YAML
null) as an empty mapping and creates it, instead of refusing the write.
This was a regression from 62c5c1f: t11-deployment's apps/values.yaml
has several bare service entries meaning "use defaults", and `ec
set-desc` on one of them failed with "not a mapping (found NoneType)".
Real scalars and lists at that path are still rejected.

Also rename the `ec ps` column `label` to `description` across the
schema, all three backends and the TUI/monitor. The Argo backend now
reads the description only from the
`epics-containers.github.io/description` annotation, with no fallback to
`labels.device` or the literal "service"; the K8s backend's fixed
"service" placeholder is empty too. Both show an empty description when
unset.

Co-Authored-By: Claude Opus 5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Next included review available in 37 minutes.

Check out review usage here.

View limit details

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

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.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 62f2e61c-ada6-4e5c-9d80-bd00eaee6fde

📥 Commits

Reviewing files that changed from the base of the PR and between 3096fee and e4e1413.

📒 Files selected for processing (14)
  • src/edge_containers_cli/cli.py
  • src/edge_containers_cli/cmds/argo_commands.py
  • src/edge_containers_cli/cmds/commands.py
  • src/edge_containers_cli/cmds/demo_commands.py
  • src/edge_containers_cli/cmds/k8s_commands.py
  • src/edge_containers_cli/cmds/monitor.py
  • src/edge_containers_cli/git.py
  • tests/data/argocd.yaml
  • tests/data/bl01t-deployment/apps/Chart.yaml
  • tests/test_argocd.py
  • tests/test_demo.py
  • tests/test_git.py
  • tests/test_k8s.py
  • tests/test_push_rejection.py

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

Brings in #257 (typer[all] -> typer) and #258 (ErrorHandlingTyper.__call__
uses sys.exit(1); adds tests/test_push_rejection.py) alongside this
branch's description-annotation feature, set-desc, chart version gate,
K8s backend changes, git.py shlex quoting, and require_keys null-
intermediate fix.

Conflict: src/edge_containers_cli/cli.py's import block. Kept `import
sys` (needed for #258's sys.exit(1) fix, already auto-merged into
ErrorHandlingTyper). Dropped `import re`: this branch already removed
the `_check_description`/kebab-case validator it guarded when it
replaced the old kebab-case `label` option with the free-text
`description` option, so `re` is unused on this side.

Also extended tests/test_push_rejection.py (from #258) to parametrize
over both `delete` and `set-desc`, since they exercise different
git.py/argo_commands.py write paths (del_key/push_remove_key vs
set_values/push_values) through the same ErrorHandlingTyper error
handling; the original `delete` case is unchanged and still passes.

Co-Authored-By: Claude Opus 5 <[email protected]>
@gilesknap
gilesknap merged commit 8aeefcc into main Sep 22, 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