• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

stacklok / toolhive / 24777693100
67%

Build:
DEFAULT BRANCH: main
Ran 22 Apr 2026 12:21PM UTC
Jobs 1
Files 657
Run time 2min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

22 Apr 2026 12:15PM UTC coverage: 66.284% (+0.06%) from 66.222%
24777693100

push

github

web-flow
Patch MCPServer spec instead of Update (#4914)

Fixes #4767.

The controller writes finalizers, finalizer removal, and the
restart-processed annotation via r.Update. Update is a full PUT, so
any spec field the operator does not track — most importantly
spec.authzConfig, which a separate authorization controller will soon
own — is zeroed on every reconcile.

Replace the three Update call sites with an optimistic-lock merge
patch. The merge-patch body carries only fields the caller changed,
so untouched fields never hit the wire and cannot be clobbered.
MergeFromWithOptimisticLock sends resourceVersion as a precondition,
giving 409-on-collision semantics for concurrent writers and
defending metadata.finalizers (which has no array-merge semantics
under merge-patch) against wholesale replacement when another
controller is mid-flight adding its own entry.

Tests:

- Envtest suite writes spec.authzConfig out-of-band and asserts it
  survives both the finalizer-add reconcile and the
  restart-annotation reconcile.
- Unit suite uses a patch-recording client to assert each migrated
  call site emits a body carrying the resourceVersion precondition
  — a deterministic wire-level signal that
  MergeFromWithOptimisticLock is in effect. A regression to plain
  MergeFrom would drop the precondition and fail the assertion
  independent of the higher-level survival test.

Also:

- .claude/rules/operator.md: new "Spec / metadata patching" section
  documenting the pattern for future CR writes. Status patching is
  a separate follow-up (#4633).
- Rename the mock-client flag failOnMCPServerUpdate →
  failOnMCPServerWrite; it now intercepts both Update and Patch on
  MCPServer, so the name matches reality.

31 of 33 new or added lines in 3 files covered. (93.94%)

16 existing lines in 6 files now uncovered.

58675 of 88521 relevant lines covered (66.28%)

62.79 hits per line

Uncovered Changes

Lines Coverage ∆ File
1
54.52
0.78% cmd/thv-operator/controllers/mcpexternalauthconfig_controller.go
1
52.31
1.51% cmd/thv-operator/controllers/toolconfig_controller.go

Coverage Regressions

Lines Coverage ∆ File
6
51.22
-0.56% pkg/workloads/manager.go
3
79.38
-0.77% pkg/transport/proxy/httpsse/http_proxy.go
2
93.94
-6.06% pkg/foreach/foreach.go
2
73.63
-0.64% pkg/runner/config.go
2
82.29
-0.21% pkg/vmcp/composer/workflow_engine.go
1
52.31
1.51% cmd/thv-operator/controllers/toolconfig_controller.go
Jobs
ID Job ID Ran Files Coverage
1 24777693100.1 22 Apr 2026 12:21PM UTC 657
66.28
GitHub Action Run
Source Files on build 24777693100
  • Tree
  • List 657
  • Changed 13
  • Source Changed 3
  • Coverage Changed 13
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #24777693100
  • 74a11845 on github
  • Prev Build on main (#24776659796)
  • Next Build on main (#24783420830)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc