Repository navigation
fix(cli): show source for generic webhook taskspawners - #1106
Conversation
Greptile SummaryThis PR adds the missing
Confidence Score: 5/5Safe to merge — the change is a straightforward two-branch addition with no risk of affecting existing source-type handling. The implementation slots cleanly into the existing if-else chain, the new branches are inert to all other source types, and the tests cover both the table and detail output paths. No files require special attention.
|
| Filename | Overview |
|---|---|
| internal/cli/printer.go | Adds GenericWebhook branches to both printTaskSpawnerTable and printTaskSpawnerDetail, consistent with all other source types. |
| internal/cli/printer_test.go | Adds two new test functions covering the table and detail views for GenericWebhook; the detail test uses the combined "Webhook Source: sentry" string to avoid vacuous matches. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[TaskSpawner.Spec.When] --> B{Source type?}
B --> C[GitHubIssues]
B --> D[GitHubPullRequests]
B --> E[Jira]
B --> F[Cron]
B --> G[GitHubWebhook]
B --> H[LinearWebhook]
B --> I[GenericWebhook NEW]
C --> T[Table: workspace/GitHub Issues]
D --> T2[Table: workspace/GitHub Pull Requests]
E --> T3[Table: Jira project]
F --> T4[Table: cron: schedule]
G --> T5[Table: GitHub Webhook repo]
H --> T6[Table: Linear Webhook]
I --> T7[Table: Generic Webhook source]
T7 --> DV[Detail: Source: Generic Webhook + Webhook Source: source]
Reviews (3): Last reviewed commit: "fix(cli): show source for generic webhoo..." | Re-trigger Greptile
|
/kelos pick-up |
|
🤖 Kelos Task Status Task |
|
/kelos squash-commits |
|
🤖 Kelos Task Status Task |
Distills three additional conventions from review feedback on recent PRs (#1101, #1106, #1096): - CLI error messages must name the failing resource (PR #1101 P2) - Tests must cover the happy path, not only early-return guards (PR #1096 P3, flagged by both kelos-bot and greptile-apps) - Avoid vacuous substring assertions in printer/formatter tests (PR #1106 P2) Applied to AGENTS.md (and via symlink CLAUDE.md), agentconfig.yaml, kelos-workers.yaml, and the reviewer prompt's Tests / Code quality checklists.
084782d to
8a1ff95
Compare
|
Squash complete. 🤖 Kelos Agent @gjkim42 Rebased on
|
Distills thirteen recurring conventions from recent PR review feedback and propagates them across AGENTS.md, the shared and worker AgentConfigs, and the reviewer prompts. All changes are backed by specific PR review findings. 1. Never use os.Getenv() for secrets as Go flag defaults — PR #971 P1 (cmd/kelos-webhook-server, cmd/ghproxy leaked GITHUB_TOKEN via --help). 2. Fail fast on invalid configuration — PR #971 multiple P1/P2 (silent degradation when GitHub App credentials or token resolvers failed). 3. Keep API surfaces minimal — PR #902 (maintainer asked repeatedly to defer speculative fields and ship the minimum viable API). 4. API changes must preserve backward compatibility — PR #1058 (BodyContains scalar->array would break in-cluster manifests; resolved by deprecating the old field rather than tightening validation). 5. Docs must match implementation, not aspiration — PRs #1035, #1056, #1082 (docs claimed enforcement that the code never performed). 6. TaskSpawner conventions — PRs #965, #974 (webhook over poll, empty .Branch for issue events, dual issue/PR context, no manual checkout). 7. Don't use Gomega's global Expect() inside Eventually polling blocks — PR #1084 (transient API errors short-circuited the poller). 8. /kind cleanup for self-development/-only PRs — PR #1100 P2 (agent classified by problem nature; rule is to classify by file location). 9. CLI error messages must name the resource — PR #1101 P2 (errors.New ("task failed") loses the name when batched). 10. Test the happy path, not only early-return guards — PR #1096 (both new tests covered only the no-op branches because production code lacked a posting seam; rule now requires adding the seam). 11. Avoid vacuous substring assertions in printer tests — PR #1106 P2 (a "sentry" check passed because the fixture's Name was "sentry-fixer"). 12. Keep CRD enum docstrings consistent with the Enum marker — PR #1081 P2 (commentOn godoc said "empty matches both" but the marker rejected ""). 13. Qualify cross-CRD field references with the owning kind in docs — PR #1077 P2 (Workspace section cited bare podOverrides.env without noting the field lives on Task.spec). Also: kelos-reviewer branch field uses the safe with-index fallback form, kelos-squash-commits gates the issue_comment trigger to PullRequest comments (preventing /kelos squash-commits typed on a plain issue from running git push --force-with-lease against an empty branch fallback), and the README's .Branch description matches runtime behavior.
Distills thirteen recurring conventions from recent PR review feedback and propagates them across AGENTS.md, the shared and worker AgentConfigs, and the reviewer prompts. All changes are backed by specific PR review findings. 1. Never use os.Getenv() for secrets as Go flag defaults — PR #971 P1 (cmd/kelos-webhook-server, cmd/ghproxy leaked GITHUB_TOKEN via --help). 2. Fail fast on invalid configuration — PR #971 multiple P1/P2 (silent degradation when GitHub App credentials or token resolvers failed). 3. Keep API surfaces minimal — PR #902 (maintainer asked repeatedly to defer speculative fields and ship the minimum viable API). 4. API changes must preserve backward compatibility — PR #1058 (BodyContains scalar->array would break in-cluster manifests; resolved by deprecating the old field rather than tightening validation). 5. Docs must match implementation, not aspiration — PRs #1035, #1056, #1082 (docs claimed enforcement that the code never performed). 6. TaskSpawner conventions — PRs #965, #974 (webhook over poll, empty .Branch for issue events, dual issue/PR context, no manual checkout). 7. Don't use Gomega's global Expect() inside Eventually polling blocks — PR #1084 (transient API errors short-circuited the poller). 8. /kind cleanup for self-development/-only PRs — PR #1100 P2 (agent classified by problem nature; rule is to classify by file location). 9. CLI error messages must name the resource — PR #1101 P2 (errors.New ("task failed") loses the name when batched). 10. Test the happy path, not only early-return guards — PR #1096 (both new tests covered only the no-op branches because production code lacked a posting seam; rule now requires adding the seam). 11. Avoid vacuous substring assertions in printer tests — PR #1106 P2 (a "sentry" check passed because the fixture's Name was "sentry-fixer"). 12. Keep CRD enum docstrings consistent with the Enum marker — PR #1081 P2 (commentOn godoc said "empty matches both" but the marker rejected ""). 13. Qualify cross-CRD field references with the owning kind in docs — PR #1077 P2 (Workspace section cited bare podOverrides.env without noting the field lives on Task.spec). Also: kelos-reviewer branch field uses the safe with-index fallback form, kelos-squash-commits gates the issue_comment trigger to PullRequest comments (preventing /kelos squash-commits typed on a plain issue from running git push --force-with-lease against an empty branch fallback), the kelos-squash-commits branch field uses the same with-index fallback form for defensive consistency with the documented convention, and the README's .Branch description matches runtime behavior (PR head branch or pushed branch; empty for issue events). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Propagates eleven recurring conventions, distilled from prior PR review feedback, across AGENTS.md, the shared and worker AgentConfigs, and the reviewer prompts. Also fixes two existing self-development spawner configurations that were flagged in adjacent reviews. Conventions added to AGENTS.md, agentconfig.yaml, and kelos-workers.yaml: 1. Never use os.Getenv() for secrets as Go flag defaults — PR #971 P1 (cmd/kelos-webhook-server, cmd/ghproxy leaked GITHUB_TOKEN via --help). 2. Fail fast on invalid configuration — PR #971 multiple P1/P2 (silent degradation when GitHub App credentials or token resolvers failed). 3. Keep API surfaces minimal — PR #902 (maintainer asked repeatedly to defer speculative fields and ship the minimum viable API). 4. API changes must preserve backward compatibility — PR #1058 (BodyContains scalar->array would break in-cluster manifests; resolved by deprecating the old field rather than tightening validation). 5. Docs must match implementation, not aspiration — PRs #1035, #1056, #1082 (docs claimed enforcement that the code never performed). 6. Don't use Gomega's global Expect() inside Eventually polling blocks — PR #1084 (transient API errors short-circuited the poller). 7. CLI error messages must name the resource — PR #1101 P2 (errors.New("task failed") loses the name when batched). 8. Test the happy path, not only early-return guards — PR #1096 (tests covered only the no-op branches because production code lacked a posting seam; rule now requires adding the seam). 9. Avoid vacuous substring assertions in printer tests — PR #1106 P2 (a "sentry" check passed because the fixture's Name was "sentry-fixer"). 10. Keep CRD enum docstrings consistent with the Enum marker — PR #1081 P2 (commentOn godoc said "empty matches both" but the marker rejected ""). 11. Qualify cross-CRD field references with the owning kind in docs — PR #1077 P2 (Workspace section cited bare podOverrides.env without noting the field lives on Task.spec). Reviewer/api-reviewer checklists gain matching items so kelos-reviewer and kelos-api-reviewer flag these patterns on future PRs. Other fixes in the same sweep: - kelos-reviewer.spec.taskTemplate.branch uses the safe '{{with index . "Branch"}}{{.}}{{else}}main{{end}}' fallback form so a /kelos review typed on a plain issue lands on main rather than an empty branch. - kelos-squash-commits gates the issue_comment trigger to commentOn: PullRequest and uses the same with-index fallback for the branch field — /kelos squash-commits typed on a plain issue would otherwise fire the spawner with empty {{.Branch}} and the prompt then runs git push --force-with-lease. - self-development/README.md template-variable table corrected from "Usually PR head branch" to "PR head branch or pushed branch; empty for issue events" to match runtime behavior, and the bodyContains example was updated to bodyPattern to match the spawner configs. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
What type of PR is this?
/kind bug
What this PR does / why we need it:
kelos get taskspawnerspreviously displayed an emptySOURCEcolumn forTaskSpawners configured withspec.when.webhook(generic webhook), andkelos get taskspawners <name> -ddid not print any source information at all. Every other source type (GitHub Issues, GitHub PRs, Jira, Cron, GitHub Webhook, Linear Webhook) had a branch ininternal/cli/printer.go, but the generic webhook case was missed.This PR adds the missing branches in both
printTaskSpawnerTableandprintTaskSpawnerDetail:Generic Webhook (<source>)(e.g.Generic Webhook (sentry)).Source: Generic Webhookplus aWebhook Source: <source>line.Unit tests cover both new branches.
Which issue(s) this PR is related to:
Fixes #1103
Special notes for your reviewer:
N/A
Does this PR introduce a user-facing change?
Summary by cubic
Fixes CLI output so generic webhook
TaskSpawners show their source in table and detail views. Addresses Linear task 1103.Written for commit 8a1ff95. Summary will update on new commits.