Skip to content

feat(api): Define TriageRun CRD - #304

Open
amwarrier wants to merge 6 commits into
mainfrom
codex/triage-run-api
Open

feat(api): Define TriageRun CRD#304
amwarrier wants to merge 6 commits into
mainfrom
codex/triage-run-api

Conversation

@amwarrier

@amwarrier amwarrier commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Summary

Define the namespaced apps.wandb.com/v2 TriageRun API for immutable, on-demand diagnostic executions. A run references one Application and selects one or more actions by object reference:

spec:
  applicationRef:
    name: weave-trace
  actions:
    - name: default

spec.actions uses Kubernetes map-list semantics keyed by name, so selections are structured and duplicate action names are rejected. Descriptions and execution details remain on the referenced Application; the immutable run stores only the selected names.

Status contains aggregate run state plus map-style per-action status, including the owned Job reference, resolved execution snapshot, timestamps, summary, and structured check results.

This PR contains the API, generated CRD/deep-copy artifacts, sample manifest, RBAC scaffolding, and embedded installer CRD. Reconciliation is added by the next PR in the stack.

Validation

  • go test ./api/v2 ./internal/crdinstaller/...
  • Generated CRDs use x-kubernetes-list-type: map with name as the list-map key.
  • golang.org/x/text is upgraded to v0.39.0 to clear CVE-2026-56852 from the image scan.

Stack

Summary by CodeRabbit

  • New Features

    • Added the namespaced TriageRun v2 resource for configuring and tracking triage actions.
    • Supports application and action references, execution progress, lifecycle phases, severity summaries, diagnostics, conditions, and per-action results.
    • Added administrative, editor, and read-only access controls.
    • Included deployment configuration and a sample TriageRun manifest.
  • Developer Experience

    • Added support for installing, viewing, and removing the new resource through standard Kubernetes tooling.

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 939d27fc-7a38-40b8-840f-af56b3ef2d44

📥 Commits

Reviewing files that changed from the base of the PR and between e81e9c2 and c22cc8f.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (6)
  • api/v2/triagerun_types.go
  • api/v2/zz_generated.deepcopy.go
  • config/crd/bases/apps.wandb.com_triageruns.yaml
  • config/samples/apps_v2_triagerun.yaml
  • go.mod
  • internal/crdinstaller/crds/operator/apps.wandb.com_triageruns.yaml
🚧 Files skipped from review as they are similar to previous changes (5)
  • config/samples/apps_v2_triagerun.yaml
  • config/crd/bases/apps.wandb.com_triageruns.yaml
  • internal/crdinstaller/crds/operator/apps.wandb.com_triageruns.yaml
  • api/v2/zz_generated.deepcopy.go
  • api/v2/triagerun_types.go

📝 Walkthrough

Walkthrough

Added the namespaced TriageRun v2 API, generated Kubernetes deep-copy methods, CRDs, RBAC roles, Kustomize wiring, a sample manifest, dependency updates, and CRD composition test updates.

Changes

TriageRun v2 resource

Layer / File(s) Summary
TriageRun API contract
api/v2/triagerun_types.go, api/v2/zz_generated.deepcopy.go
Defines TriageRun specifications, phases, severities, execution snapshots, results, action statuses, aggregate status, Kubernetes resources, scheme registration, and deep-copy methods.
CRD schema and installation
config/crd/bases/apps.wandb.com_triageruns.yaml, internal/crdinstaller/crds/operator/apps.wandb.com_triageruns.yaml, PROJECT, config/crd/bases/kustomization.yaml, config/dev-common/*, go.mod
Adds the served and stored apps.wandb.com/v2 CRDs, registers the resource with Kubebuilder, wires Kustomize resources, adds the development deletion patch, and updates Go dependencies.
Access, samples, and composition validation
config/rbac/*, config/samples/*, internal/crdinstaller/compose_test.go
Adds admin, editor, and viewer roles; adds a sample TriageRun; wires the sample; and updates CRD composition assertions for three operator CRDs.

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

Suggested reviewers: danielpanzella, j7m4, theishshah

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. 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 primary change: defining the TriageRun API and CRD.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/triage-run-api

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@amwarrier
amwarrier marked this pull request as ready for review July 31, 2026 19:40
@amwarrier
amwarrier requested a review from a team as a code owner July 31, 2026 19:40

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
internal/crdinstaller/compose_test.go (1)

72-97: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚖️ Poor tradeoff

Use the configured Ginkgo/Gomega test suite.

The added TriageRun coverage remains in a testing.T test. Move this coverage to the Ginkgo/Gomega suite configured through suite_test.go. Before completion, run make lint and make test.

As per coding guidelines, “Use Ginkgo/Gomega for tests; test suites are configured through suite_test.go files and envtest,” and “Run both make lint and make test before considering a task complete.”

Also applies to: 107-108

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/crdinstaller/compose_test.go` around lines 72 - 97, Move the CRD
composition coverage around the existing test function into the configured
Ginkgo/Gomega suite from suite_test.go, replacing testing.T assertions with the
suite’s established Ginkgo/Gomega style while preserving all CRD, annotation,
webhook service, and expected-name checks. Apply the same conversion to the
related coverage at the referenced additional location, then run make lint and
make test.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@config/crd/bases/apps.wandb.com_triageruns.yaml`:
- Around line 43-62: The root TriageRun schema does not require spec, allowing
validation rules to be bypassed. Update the Spec field markers in
api/v2/triagerun_types.go to make spec required, then regenerate both
config/crd/bases/apps.wandb.com_triageruns.yaml (anchor, lines 43-62) and
internal/crdinstaller/crds/operator/apps.wandb.com_triageruns.yaml (sibling,
lines 43-62) using make manifests generate sync-crd-embed; do not edit either
CRD manifest manually.

---

Nitpick comments:
In `@internal/crdinstaller/compose_test.go`:
- Around line 72-97: Move the CRD composition coverage around the existing test
function into the configured Ginkgo/Gomega suite from suite_test.go, replacing
testing.T assertions with the suite’s established Ginkgo/Gomega style while
preserving all CRD, annotation, webhook service, and expected-name checks. Apply
the same conversion to the related coverage at the referenced additional
location, then run make lint and make test.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 3f5f6913-b1b4-4c89-991b-547a7a12b5ad

📥 Commits

Reviewing files that changed from the base of the PR and between 00700c9 and a79a269.

📒 Files selected for processing (15)
  • PROJECT
  • api/v2/triagerun_types.go
  • api/v2/zz_generated.deepcopy.go
  • config/crd/bases/apps.wandb.com_triageruns.yaml
  • config/crd/bases/kustomization.yaml
  • config/dev-common/delete-triageruns-crd.yaml
  • config/dev-common/kustomization.yaml
  • config/rbac/kustomization.yaml
  • config/rbac/triagerun_admin_role.yaml
  • config/rbac/triagerun_editor_role.yaml
  • config/rbac/triagerun_viewer_role.yaml
  • config/samples/apps_v2_triagerun.yaml
  • config/samples/kustomization.yaml
  • internal/crdinstaller/compose_test.go
  • internal/crdinstaller/crds/operator/apps.wandb.com_triageruns.yaml

Comment thread config/crd/bases/apps.wandb.com_triageruns.yaml
@amwarrier amwarrier changed the title feat(api): define TriageRun CRD feat(api): Define TriageRun CRD Aug 3, 2026
@amwarrier
amwarrier force-pushed the codex/triage-run-api branch from a79a269 to a093d55 Compare August 3, 2026 16:37
@amwarrier
amwarrier force-pushed the codex/triage-run-api branch from a093d55 to 373408f Compare August 3, 2026 16:40

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
config/rbac/triagerun_admin_role.yaml (1)

14-19: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

Use an explicit verb allowlist for this admin role.

triagerun-admin-role grants verbs: ['*'] to external cluster admins on apps.wandb.com/triageruns, so every current and future verb is available there. Replace the wildcard with the required verbs, such as get, list, watch, create, update, patch, delete, and deletecollection, while leaving triageruns/status read-only.

Proposed change
-  - '*'
+  - get
+  - list
+  - watch
+  - create
+  - update
+  - patch
+  - delete
+  - deletecollection
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@config/rbac/triagerun_admin_role.yaml` around lines 14 - 19, Update the
triagerun-admin-role rule for apps.wandb.com/triageruns to replace the wildcard
verb with an explicit allowlist of get, list, watch, create, update, patch,
delete, and deletecollection; preserve the separate triageruns/status rule as
read-only.

Source: Linters/SAST tools

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/design/triage-runs.md`:
- Around line 363-366: Update the implementation-slice table entry for
operator#304 to remove or correctly label Application.spec.triage according to
the PR’s actual delivered scope, and revise the related availability statement
around the triage behavior section so it does not claim that
Application.spec.triage declarations or reconciliation are already provided by
this change.
- Around line 84-86: Update the sequence diagram so the Job-to-API interaction
represents only the Job completion event/status, removing the implication that
JSONL stdout is sent as a Job payload. Preserve the existing C->>API: Read pod
logs step as the path through which JSONL results are retrieved.

---

Nitpick comments:
In `@config/rbac/triagerun_admin_role.yaml`:
- Around line 14-19: Update the triagerun-admin-role rule for
apps.wandb.com/triageruns to replace the wildcard verb with an explicit
allowlist of get, list, watch, create, update, patch, delete, and
deletecollection; preserve the separate triageruns/status rule as read-only.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 91b0606a-8414-4a43-afcb-f684eb969278

📥 Commits

Reviewing files that changed from the base of the PR and between a79a269 and a093d55.

📒 Files selected for processing (16)
  • PROJECT
  • api/v2/triagerun_types.go
  • api/v2/zz_generated.deepcopy.go
  • config/crd/bases/apps.wandb.com_triageruns.yaml
  • config/crd/bases/kustomization.yaml
  • config/dev-common/delete-triageruns-crd.yaml
  • config/dev-common/kustomization.yaml
  • config/rbac/kustomization.yaml
  • config/rbac/triagerun_admin_role.yaml
  • config/rbac/triagerun_editor_role.yaml
  • config/rbac/triagerun_viewer_role.yaml
  • config/samples/apps_v2_triagerun.yaml
  • config/samples/kustomization.yaml
  • docs/design/triage-runs.md
  • internal/crdinstaller/compose_test.go
  • internal/crdinstaller/crds/operator/apps.wandb.com_triageruns.yaml
🚧 Files skipped from review as they are similar to previous changes (14)
  • PROJECT
  • config/samples/kustomization.yaml
  • config/samples/apps_v2_triagerun.yaml
  • config/dev-common/kustomization.yaml
  • config/dev-common/delete-triageruns-crd.yaml
  • config/rbac/triagerun_editor_role.yaml
  • config/rbac/kustomization.yaml
  • internal/crdinstaller/compose_test.go
  • config/crd/bases/kustomization.yaml
  • config/crd/bases/apps.wandb.com_triageruns.yaml
  • config/rbac/triagerun_viewer_role.yaml
  • api/v2/triagerun_types.go
  • internal/crdinstaller/crds/operator/apps.wandb.com_triageruns.yaml
  • api/v2/zz_generated.deepcopy.go

Comment thread docs/design/triage-runs.md Outdated
Comment on lines +84 to +86
Job-->>API: JSONL results on stdout and exit status
API-->>C: Job completion event
C->>API: Read pod logs

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Show the Pod log path in the sequence diagram.

Job does not send container stdout as a Job payload to the Kubernetes API. The diagnostic container writes JSONL to stdout. Kubernetes exposes that output through Pod logs. The controller reads those logs after the Job completion event.

Update the diagram so this step shows Job completion only. Keep the later C->>API: Read pod logs step as the JSONL transfer path.

Proposed change
-    Job-->>API: JSONL results on stdout and exit status
+    Job-->>API: Job completion status
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Job-->>API: JSONL results on stdout and exit status
API-->>C: Job completion event
C->>API: Read pod logs
Job-->>API: Job completion status
API-->>C: Job completion event
C->>API: Read pod logs
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/design/triage-runs.md` around lines 84 - 86, Update the sequence diagram
so the Job-to-API interaction represents only the Job completion event/status,
removing the implication that JSONL stdout is sent as a Job payload. Preserve
the existing C->>API: Read pod logs step as the path through which JSONL results
are retrieved.

Comment thread docs/design/triage-runs.md Outdated
Comment on lines +363 to +366
| Repository and PR | Responsibility |
| --- | --- |
| [operator#304](https://github.com/wandb/operator/pull/304) | `TriageRun` API, `Application.spec.triage`, CRD, generated API roles, and embedded CRD packaging |
| [operator#305](https://github.com/wandb/operator/pull/305) | `TriageRun` reconciler, Job construction, log parsing, status, and controller RBAC |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Align the implementation-slice table with the PR scope.

The PR objective states that this change does not add Application.spec.triage declarations or reconciliation. Line 365 assigns Application.spec.triage to operator#304, and Lines 121-124 present that behavior as already available.

Update the row to describe only delivered work, or mark Application.spec.triage as follow-up work with the correct PR. Otherwise, the document overstates the API contract delivered by this change.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/design/triage-runs.md` around lines 363 - 366, Update the
implementation-slice table entry for operator#304 to remove or correctly label
Application.spec.triage according to the PR’s actual delivered scope, and revise
the related availability statement around the triage behavior section so it does
not claim that Application.spec.triage declarations or reconciliation are
already provided by this change.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@api/v2/triagerun_types.go`:
- Around line 52-54: Update the ApplicationRef.Name validation markers in the
triage run API type to enforce a Kubernetes DNS subdomain: add the DNS subdomain
regex and a maximum length of 253 while retaining the minimum length
requirement. Then regenerate the related deepcopy code, CRD YAML, and embedded
CRDs using the repository’s standard generation workflow.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 5faa0531-138f-435d-b7b3-f9ab5fabe3e6

📥 Commits

Reviewing files that changed from the base of the PR and between a093d55 and e81e9c2.

📒 Files selected for processing (15)
  • PROJECT
  • api/v2/triagerun_types.go
  • api/v2/zz_generated.deepcopy.go
  • config/crd/bases/apps.wandb.com_triageruns.yaml
  • config/crd/bases/kustomization.yaml
  • config/dev-common/delete-triageruns-crd.yaml
  • config/dev-common/kustomization.yaml
  • config/rbac/kustomization.yaml
  • config/rbac/triagerun_admin_role.yaml
  • config/rbac/triagerun_editor_role.yaml
  • config/rbac/triagerun_viewer_role.yaml
  • config/samples/apps_v2_triagerun.yaml
  • config/samples/kustomization.yaml
  • internal/crdinstaller/compose_test.go
  • internal/crdinstaller/crds/operator/apps.wandb.com_triageruns.yaml
🚧 Files skipped from review as they are similar to previous changes (12)
  • config/rbac/triagerun_editor_role.yaml
  • PROJECT
  • config/rbac/triagerun_viewer_role.yaml
  • config/dev-common/delete-triageruns-crd.yaml
  • config/samples/apps_v2_triagerun.yaml
  • config/crd/bases/kustomization.yaml
  • config/samples/kustomization.yaml
  • config/crd/bases/apps.wandb.com_triageruns.yaml
  • config/dev-common/kustomization.yaml
  • config/rbac/kustomization.yaml
  • internal/crdinstaller/compose_test.go
  • api/v2/zz_generated.deepcopy.go

Comment thread api/v2/triagerun_types.go
@socket-security

socket-security Bot commented Aug 4, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatedgolang.org/​x/​text@​v0.38.0 ⏵ v0.39.077 +1100100100100

View full report

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