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

stacklok / toolhive / 24833483611
67%

Build:
DEFAULT BRANCH: main
Ran 23 Apr 2026 11:53AM UTC
Jobs 1
Files 659
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

23 Apr 2026 11:48AM UTC coverage: 66.324% (-0.02%) from 66.339%
24833483611

push

github

web-flow
Introduce MutateAndPatchSpec and adopt across spec-patch sites (#5004)

* Introduce MutateAndPatchSpec and adopt across spec-patch sites

The inline DeepCopy + Patch(MergeFromWithOptimisticLock) pattern from
#4914 landed at five MCPServer spec-write sites, each carrying the same
four-line rationale comment. Extract it into a MutateAndPatchSpec[T]
generic helper in cmd/thv-operator/pkg/controllerutil, siblinged with
the existing MutateAndPatchStatus.

The helper mirrors its sibling exactly -- same reflection-based
nil-guard, same DeepCopy-then-mutate-then-Patch flow -- with two
deliberate differences:

  - Uses MergeFromWithOptions(original, MergeFromWithOptimisticLock{})
    so concurrent writers get 409-and-requeue instead of silent clobber.
    This is the property that defends spec.authzConfig, which the
    forthcoming authorization controller will own, from being zeroed on
    every reconcile.
  - No no-op short-circuit. MergeFromWithOptimisticLock always emits
    metadata.resourceVersion into the body, so the status helper's
    "body == {}" check never fires; and every current spec call site
    carries a real mutation.

All five inline sites (mcpserver_controller.go finalizer add/remove and
restart-annotation stamp; toolconfig_controller.go and
mcpexternalauthconfig_controller.go config-hash stamps) adopt the
helper. Pure refactor at the call sites -- no behavior change.

Tests mirror the status helper's shape: happy-path + optimistic-lock
wire signal, DeepCopy isolation, 409 Conflict propagation, nil-obj
rejection, and disjoint-spec-field preservation (the regression guard
that would fire if the helper were ever swapped back to r.Update).
Existing TestMCPServerSpecPatchesAreOptimisticLock and the
mcpserver_spec_patch_integration_test.go envtest remain green.

The operator-rules section on spec/metadata patching is updated to
reference the helper as the canonical pattern.

* Address MoE review feedback on MutateAndPatchSpec

Three of five rev... (continued)

35 of 39 new or added lines in 4 files covered. (89.74%)

35 existing lines in 4 files now uncovered.

58849 of 88730 relevant lines covered (66.32%)

62.45 hits per line

Uncovered Changes

Lines Coverage ∆ File
2
66.86
-0.13% cmd/thv-operator/controllers/mcpserver_controller.go
1
53.45
-1.07% cmd/thv-operator/controllers/mcpexternalauthconfig_controller.go
1
50.26
-2.04% cmd/thv-operator/controllers/toolconfig_controller.go

Coverage Regressions

Lines Coverage ∆ File
14
74.44
-5.19% pkg/client/config.go
11
69.23
-14.1% pkg/client/discovery.go
8
23.56
0.57% pkg/client/manager.go
2
73.63
-0.64% pkg/runner/config.go
Jobs
ID Job ID Ran Files Coverage
1 24833483611.1 23 Apr 2026 11:53AM UTC 659
66.32
GitHub Action Run
Source Files on build 24833483611
  • Tree
  • List 659
  • Changed 13
  • Source Changed 4
  • Coverage Changed 13
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #24833483611
  • bbe8b853 on github
  • Prev Build on main (#24829472926)
  • Next Build on main (#24835773264)
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