stacklok / stacklok/toolhive

Migrate operator handle*Config status writes to MutateAndPatchStatus

Open
#5,568 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
2.2k
Forks
300
Avg merge
1d 15h
Merged PRs (30d)
184

Description

Background

.claude/rules/operator.md ("Status Writes") requires controllerutil.MutateAndPatchStatus rather than r.Status().Update, because a full-replace Update can clobber the entire Status.Conditions array under concurrent reconciles (JSON merge-patch replaces the array wholesale).

The entire handle*Config family in both mcpserver_controller.go and mcpremoteproxy_controller.go (OIDC, telemetry, external-auth, authServerRef, authz, webhook, …) predates the helper and still calls r.Status().Update. The newly added MCPAuthzConfig watch makes concurrent config reconciles a bit more likely, which raised the question.

Raised by @jhrozek in review of #5564 (and noted on #5563). The agreed plan was to migrate the whole family in one focused sweep rather than piecemeal — piecemeal migration risks the very array-clobber the rule warns about.

Scope

  • Migrate all handle*Config status writes in both controllers to controllerutil.MutateAndPatchStatus.
  • Verify each call site holds a freshly-Getted object and is the sole owner of the conditions array (per the rule's checklist).
  • One PR, atomic.

Tracked as a follow-up to #5564.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with .claude/rules/operator.md and inspect mcpserver_controller.go and mcpremoteproxy_controller.go for every handle*Config status write. Verify each call site against the rule's fresh-Get and conditions-ownership checklist, then confirm all such writes use MutateAndPatchStatus and the migration is covered in one atomic PR.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, kubernetes
Domain
infrastructure
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.