Skip to content

Add -m/--message to record a note on the commits ec makes - #267

Merged
gilesknap merged 2 commits into
mainfrom
add-commit-message-option
Oct 2, 2026
Merged

gilesknap merged 2 commits into
mainfrom
add-commit-message-option

Conversation

@gilesknap

@gilesknap gilesknap commented Sep 24, 2026 •

Copy link
Copy Markdown
Member

Adds -m/--message so an operator can record why a change was made, on the commit ec writes.

Today those commits carry only a generated summary — Set services.foo.enabled=false in values.yaml — which says what changed but never why.

Shape

The note becomes the commit subject, because that is what shows up in a log listing, and the generated summary is kept as the body so the machine-readable Set .../Remove ... line stays greppable:

$ ec stop myioc --commit -m "PSU fault, see EC-123"

PSU fault, see EC-123

Set services.myioc.enabled=false in values.yaml

Offered on the five commands that mutate state: delete, deploy, set-desc, start, stop.

Backends that never commit

--message only means anything where ec commits, which is the Argo CD backend. On K8S and DEMO the option is dropped from the CLI via params_opt_out — the same mechanism K8sCommands already uses to drop --commit from start/stop — rather than accepted and ignored. A note the operator believes was recorded but was not is worse than no option at all.

DEMO opts out only of set-desc/start/stop: it does not implement delete or deploy, so drop_methods has already removed those commands.

--message requires --commit on start/stop

Without --commit, start/stop patch the live Argo CD application and write nothing to git, so there is no commit for the note to land on. ec refuses with a message saying so instead of discarding it.

Two defects fixed along the way

Both in drop_options, and both surfaced by this change rather than invented by it:

  • It popped from the list it was enumerating, so the indices shifted and the second of two dropped params for one command survived. Nothing hit this before because no backend dropped more than one param from a single command — K8sCommands now drops both commit and message from start/stop, which does. Verified against the old implementation: given [service_name, commit, message] it left message in place.
  • It raised KeyError for a command drop_methods had already removed, i.e. every command the backend does not implement.

Also renamed the local message in the nested confirm_callbacks of deploy and set-desc to prompt, since it now shadows the new parameter.

Testing

104 passed (uv run pytest), ruff clean. 14 new tests in tests/test_git.py and tests/test_message_option.py covering: the note's placement in the commit, shell-quoting of a hostile note (reusing the existing MALICIOUS fixture — a note is free text straight from the command line), the per-backend opt-outs, both drop_options regressions, and the --commit guard.

Docs updated in docs/reference/cli.md.

Closes #217

🤖 Generated with Claude Code

https://claude.ai/code/session_014GsvY8MPA1WdKubZ76YVcd

Summary by CodeRabbit

  • New Features
    • Added an optional -m/--message option to supported CLI commands. On Argo CD, the note becomes the commit subject, with the generated summary retained in the commit body.
    • For start and stop, providing a message requires --commit.
    • The message option is unavailable with Kubernetes and demo backends.

@coderabbitai

coderabbitai Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

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

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 17 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: 0aeee994-5970-47c1-8fe1-52a23197fb0e

📥 Commits

Reviewing files that changed from the base of the PR and between 23580cc and 0cbff92.

📒 Files selected for processing (9)
  • docs/reference/cli.md
  • 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/git.py
  • tests/test_git.py
  • tests/test_message_option.py

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 5609512d-2957-4ff3-b4c3-d8edd682493e

📥 Commits

Reviewing files that changed from the base of the PR and between 33d7fa3 and 23580cc.

📒 Files selected for processing (9)
  • docs/reference/cli.md
  • 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/git.py
  • tests/test_git.py
  • tests/test_message_option.py

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


📝 Walkthrough

Walkthrough

The CLI adds an optional -m/--message option to supported commands. Argo CD passes the value as the Git commit subject and keeps the generated summary as the commit body. K8s and demo backends omit the option. On Argo CD, start and stop require --commit when a message is provided.

Changes

Commit message option

Layer / File(s) Summary
Git commit message format
src/edge_containers_cli/git.py, tests/test_git.py
Git write helpers accept an optional message. When supplied, Git uses it as the commit subject and the generated summary as the body. Tests cover argument order and shell quoting.
Backend message propagation
src/edge_containers_cli/cmds/commands.py, src/edge_containers_cli/cmds/argo_commands.py, src/edge_containers_cli/cmds/k8s_commands.py, src/edge_containers_cli/cmds/demo_commands.py
Command interfaces and Argo CD operations pass the message to Git. Argo CD rejects a message on start or stop without --commit. K8s and demo accept the parameter in their method signatures but omit the CLI option.
CLI option wiring and backend filtering
src/edge_containers_cli/cli.py, docs/reference/cli.md, tests/test_message_option.py
Supported CLI commands expose and forward the option. drop_options rebuilds parameter lists and skips absent commands. Documentation and tests cover the option and backend filtering.

Priority: ⬇️ Low

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

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant CLI
  participant ArgoCommands
  participant Git
  CLI->>ArgoCommands: invoke deploy with message
  ArgoCommands->>Git: pass message to set_values
  Git->>Git: create commit with message and generated summary
Loading

Suggested reviewers: ocopping

Merge Risk: ⚪ Minimal · up to 23580

The commit-message option appears ready to merge after normal checks. No concrete issue requiring a pre-merge fix remains.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 21.54% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 65 functions across 8 files. (1 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding -m/--message to record notes on commits created by ec.
Linked Issues check ✅ Passed Issue #217 requests a comment argument for changes made by ec. The PR adds -m/--message to delete, deploy, set-desc, start, and stop. Argo commit helpers place the note in the commit s…
Out of Scope Changes check ✅ Passed The changes stay within Issue #217. CLI documentation and K8S/DEMO option removal support the new message option. The drop_options fix supports removing the new option and commit together. Callbac…
Full details: Docstring Coverage

Explanation

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

✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR

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

gilesknap and others added 2 commits October 2, 2026 07:28
ec's git commits carry only a generated summary ("Set
services.foo.enabled=false in values.yaml"), which says what changed but
never why. -m/--message lets the operator record the reason at the point
of change.

The note becomes the commit subject, since that is what a log listing
shows, and the generated summary is kept as the body so the
machine-readable Set/Remove line stays greppable.

The option is only meaningful where ec commits, which is the Argo CD
backend, so:

- K8sCommands and DemoCommands opt out of it via params_opt_out, the
  same mechanism K8sCommands already uses to drop --commit from
  start/stop. The option is absent from the CLI on those backends rather
  than accepted and ignored.
- On start/stop, --message requires --commit. Without it the change is
  patched onto the live Argo CD application and never reaches git, so
  there is no commit to annotate and ec refuses instead of silently
  discarding the note.

Fixes two defects found while wiring this up:

- drop_options popped from the list it was enumerating, so the indices
  shifted and the second of two dropped params for one command survived.
  Nothing hit this before because no backend dropped more than one param
  from a single command; K8sCommands now drops both commit and message
  from start/stop, which does.
- drop_options raised KeyError for a command drop_methods had already
  removed, which is every command the backend does not implement.

The nested confirm_callback in deploy and set-desc used a local named
`message` for the prompt string, which now shadows the new parameter;
renamed to `prompt`.

Closes #217

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014GsvY8MPA1WdKubZ76YVcd
K8sCommands.delete kept an unused `commit` parameter in the position the
base class now gives to `message`, an incompatible override. The tests
built a click.Context where drop_options takes a typer.Context, and
_params' return type left out that a click param name may be None.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013HgLeGnwBSg3Xx1VgxEpt8
@gilesknap
gilesknap force-pushed the add-commit-message-option branch from 23580cc to 0cbff92 Compare October 2, 2026 07:29
@gilesknap
gilesknap merged commit 1ef067d 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.

Add ability to add additional comment when making changes via ec

1 participant