Skip to content

feat: add sloctl edit command - #460

Merged
nieomylnieja merged 31 commits into
mainfrom
add-sloctl-edit-command
May 21, 2026
Merged

feat: add sloctl edit command#460
nieomylnieja merged 31 commits into
mainfrom
add-sloctl-edit-command

Conversation

@nieomylnieja

@nieomylnieja nieomylnieja commented Apr 23, 2026

Copy link
Copy Markdown
Collaborator

Motivation

Sometimes you just wanna quickly edit something out in your SLOs, you already know kubectl edit, this brings the exact same functionality to the table.

Summary

In addition to the new command, it centralizes service aliases for get, delete, and edit commands.

Testing

  • Manual checks.
  • End-to-end tests, you might wonder how? We're "impersonating" the SLOCTL_EDITOR and injecting a script in place of an editor command that programatically modifies the file

Release Notes

Added an interactive sloctl edit command for modifying resources in an editor and applying validated changes in one go.

Adds an interactive `edit` command for modifying resources in an editor and applying validated changes. Also centralizes service aliases for get, delete, and edit commands.
@n9-machine-user n9-machine-user added enhancement New feature or request go minor labels Apr 23, 2026
nieomylnieja and others added 9 commits April 23, 2026 16:32
Adds edit command scenarios for unchanged files, successful edits, editor failures, and invalid identity changes.
Documents e2e fixture generation and debugging conventions.
Use SHELL when launching the editor and document editor and shell fallback behavior in the edit command help.

@nobl9-adam-szymanski nobl9-adam-szymanski left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I played with this on macos and works like kubectl edit.

nieomylnieja and others added 14 commits May 7, 2026 16:25
Adds guidance comments to edited files and treats empty or comment-only content as a cancel.
This lets resource-type edits open selected objects and exit cleanly when unchanged.
Preserve validation failures in the edit buffer so users can correct and retry.
Treat reverted edits as canceled and show cleaner API validation messages.
Reject multiple agent names before editing and after object lookup to enforce
the single-Agent constraint and keep the command help text consistent.
Reuse object selection flags and query building across get and edit so edit supports labels, services, and budget adjustment SLO filters.
Handle report and budget adjustment identities without project scoping to avoid edit lookup issues.
Reuse annotation selection parsing for both get and edit so edit annotations can
filter by slo, time range, and category consistently with get behavior.
replace project-scoped type assertions with `v1alpha.GenericObject` access so edit validation works with the parser's generic object model. also add agent and development docs to capture the object-model caveat and repository workflow expectations.
Adapt project scoping checks to the updated `nobl9-go` APIs and use
`v1alpha.GenericObject` only for objects whose kind is project-scoped.
Also make edit selection mismatch errors clearer for project-scoped resources.
Route annotation lookups through `GetCmd` so `get` and `edit` share the same code path.
Build annotation queries explicitly for the `/annotations` endpoint to preserve selection filters.
Convert annotation API responses into typed annotation objects before printing or editing.
Include the project field in annotation selection so filtered edit/get commands target the expected review notes.
@annatrifonova annatrifonova added the passed-testing Added by QA when tests have passed label May 20, 2026
nieomylnieja and others added 3 commits May 20, 2026 16:43
Align `edit_test` with string-based kind values and the new mismatched resource error.
This keeps the test assertions consistent with current edit validation output.
@nieomylnieja
nieomylnieja force-pushed the add-sloctl-edit-command branch from fc7d60d to cfd9210 Compare May 20, 2026 23:14
@nieomylnieja
nieomylnieja merged commit 2bafc99 into main May 21, 2026
7 checks passed
@nieomylnieja
nieomylnieja deleted the add-sloctl-edit-command branch May 21, 2026 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request go minor passed-testing Added by QA when tests have passed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants