fix(github): resolve the apply an operator meant when a control command names none - #974
Draft
aparajon wants to merge 3 commits into
Draft
fix(github): resolve the apply an operator meant when a control command names none#974aparajon wants to merge 3 commits into
aparajon wants to merge 3 commits into
Conversation
…nd names none `schemabot apply` takes no apply ID, so operators reach for `schemabot cancel -e <env>` the same way. Today every apply-scoped control command answers with a usage line, sending them to `schemabot status` to copy back an identifier SchemaBot already has. A control command that names no apply is now resolved from the PR: acted on when exactly one schema change in that environment could be meant, and answered with the candidates themselves when several could. Nothing is guessed — an ambiguous command still cancels nothing. Stopped applies count as candidates. Stopping leaves a schema change half-applied and cancel is how an operator finishes it, so the state cancel is most often issued against stays reachable. Inference is scoped to what one deployment stores, so an unscoped command on an aggregate repo keeps the usage reply: each participant holds its own slice of the PR's applies, and "exactly one here" is not "exactly one on this PR". Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Improves the operator experience for apply-scoped control commands (e.g., schemabot cancel) when issued without an explicit apply ID by resolving the intended apply from the PR when unambiguous, and replying with a candidate list when ambiguous.
Changes:
- Added control-command apply inference (and ambiguous-candidate replies) for apply-scoped control commands missing an apply ID.
- Added a new “Control Command Ambiguous Apply ID” PR comment template and CLI preview output for it.
- Added integration tests covering cancel-without-apply-id behavior for both unambiguous and ambiguous PRs.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| TEMPLATES.md | Documents the new ambiguous-apply-ID control-command template output. |
| pkg/webhook/templates/issue_comment.go | Adds rendering for the ambiguous apply-ID reply (candidate list + usage). |
| pkg/webhook/control.go | Implements apply inference for missing apply IDs and threads the resolved apply ID downstream. |
| pkg/webhook/control_integration_test.go | Adds E2E-style integration tests for cancel-without-apply-id behavior. |
| pkg/cmd/internal/templates/preview_comment.go | Adds preview entry for the new ambiguous apply-ID control-command comment. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Two ways an unresolved apply id reached the operator with more than it should. A storage lookup failure rendered the raw error into a public PR comment, and on an aggregate repo the candidate table was built from this deployment's own applies, presenting a partial view of the PR as the whole of it. The lookup failure now posts a fixed line and keeps the cause in the server log, and an unscoped fan-out falls back to the usage reply the leader posts once. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why this matters
schemabot applytakes no apply ID, so operators reach forschemabot cancel -e <env>the same way. Every apply-scoped control command answers that with a usage line, sending them toschemabot statusto copy back an identifier SchemaBot already has — on a PR whose only schema change in that environment is the one they obviously meant.What it does
Applies to every apply-scoped control command, since they share one lifecycle and the ask is the same on each.
🤖 Generated with Claude Code