Skip to content

Delegate recovery middleware to toolhive-core with observability hooks - #6145

Merged
JAORMX merged 1 commit into
mainfrom
chore/recovery-core-shim
Jul 30, 2026
Merged

Delegate recovery middleware to toolhive-core with observability hooks#6145
JAORMX merged 1 commit into
mainfrom
chore/recovery-core-shim

Conversation

@JAORMX

@JAORMX JAORMX commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

Summary

Wave 1 of the toolhive→toolhive-core migration: pkg/recovery becomes a thin shim over toolhive-core/recovery (v0.0.36, stacklok/toolhive-core#203), keeping ToolHive's observability wiring:

  • Core's WithPanicHandler hook is wired to a local panicHandler:
    • RecordError → OTel span RecordError + error status (sanitized message, no panic value in telemetry)
    • ReportPanicsentry.RecoverPanic (raw value, so panics still appear as Sentry Issues)
  • ErrAbortHandler re-panic semantics now live in core; the existing TestRecoveryMiddleware_RePanicsErrAbortHandler exercises them through the shim unchanged.
  • Factory pattern (MiddlewareType, FactoryMiddleware, CreateMiddleware) and the Middleware signature are unchanged — callers (pkg/api/server.go, pkg/runner/*, pkg/vmcp/server) untouched.

Net −28 LOC. Bumps toolhive-core to v0.0.36.

Test plan

  • task build, task lint-fix — clean
  • go test ./pkg/recovery/... ./pkg/runner/... ./pkg/api/... ./pkg/vmcp/server/... — all pass

@github-actions github-actions Bot added the size/S Small PR: 100-299 lines changed label Jul 30, 2026
@codecov

codecov Bot commented Jul 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.56%. Comparing base (3d44435) to head (b33e274).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6145      +/-   ##
==========================================
- Coverage   72.63%   72.56%   -0.08%     
==========================================
  Files         736      736              
  Lines       76355    76340      -15     
==========================================
- Hits        55463    55398      -65     
- Misses      16955    17019      +64     
+ Partials     3937     3923      -14     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@JAORMX
JAORMX merged commit 32f75d9 into main Jul 30, 2026
59 of 60 checks passed
@JAORMX
JAORMX deleted the chore/recovery-core-shim branch July 30, 2026 12:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/S Small PR: 100-299 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants