feat(core): expose watcher health endpoint#29
Merged
Conversation
Squashed PR #31 after passed CI and paired Moxy/Gate staging validation.
* fix(connect): isolate libp2p runtime from server netty * Authorize all configured libp2p edge peers * feat(connect): bootstrap libp2p from watch service * fix libp2p runtime isolation
ec607b0 to
032526a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
Recover the existing minekube/connect-java PR #29 (Expose Connect watcher health) on its same codex/watch-health branch, rebased onto current origin/main, without creating a duplicate PR. Preserve WatchHealthServer intent and public API behavior while retaining current-main libp2p watchless/fallback behavior; health becomes true only for a live accepted watcher open, false during reconnect/stop/error/completion, and remains healthy across the intentionally ignored terminal event when switching to watchless mode. Keep current main's watch-specific OkHttp liveness configuration and metadata behavior. Do not absorb hub#170, broaden unrelated Connect behavior, merge, or release. Validate focused and full Gradle tests/build/checks, then update the same PR #29 using verified force-with-lease semantics against expected remote head ec607b0, and stop when the exact pushed head is conflict-free with green checks.
What Changed
CONNECT_WATCH_HEALTH_ADDRHTTP server whose/healthzendpoint reports watcher and watchless readiness with200or503responses.Risk Assessment
✅ Low: The prior watcher-health race and Velocity shutdown leak are addressed with bounded synchronization, lifecycle cleanup, and focused regression coverage without materially changing watchless/fallback behavior.
Testing
Verified the public
/healthzendpoint across connecting, accepted-open, completion, restart, stop, and watchless-terminal states; focused core/Velocity tests and a fresh full multi-module build/check passed, reviewer-visible API evidence was captured, and generated build outputs were cleaned.Evidence: End-to-end watcher-health lifecycle
before-start GET /healthz -> 503 unhealthy connecting GET /healthz -> 503 unhealthy watch-open GET /healthz -> 200 ok watch-completed GET /healthz -> 503 unhealthy restarted-open GET /healthz -> 200 ok stopped GET /healthz -> 503 unhealthy watchless-negotiated GET /healthz -> 200 ok watchless-terminal-ignored GET /healthz -> 200 okPipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
🔧 **Rebase** - 2 issues found → auto-fixed ✅
core/src/main/java/com/minekube/connect/module/CommonModule.java- merge conflict rebasing onto origin/codex/watch-healthcore/src/test/java/com/minekube/connect/module/CommonModuleTest.java- merge conflict rebasing onto origin/codex/watch-health🔧 Fix applied.
✅ Re-checked - no issues remain.
🔧 **Review** - 2 issues found → auto-fixed ✅
core/src/main/java/com/minekube/connect/register/WatchHealthServer.java:66- The HTTP server is never stopped on Velocity because that plugin has no ProxyShutdownEvent handler calling ConnectPlatform.disable(). HttpServer creates its own non-daemon dispatcher thread, so the daemon request executor does not prevent the health endpoint from keeping a normally stopped Velocity JVM alive. Add Velocity shutdown handling that invokes platform.disable().core/src/main/java/com/minekube/connect/register/WatcherRegister.java:284- The terminal-event guard and health update are not atomic. A terminal callback can pass shouldIgnoreTerminalEvent(), then enterWatchlessMode() can mark it ignored, and afterward this callback sets health false permanently while watchless mode remains active. Synchronize watcher transitions/callback state or condition the update on this watcher still being current so ignored terminal events cannot overwrite watchless health.🔧 Fix: Fix watcher health races and Velocity shutdown lifecycle
✅ Re-checked - no issues remain.
✅ **Test** - passed
✅ No issues found.
Inspectedgit diff 26c66a57a39d01e8cea318c0d3a9f9216370b928..386b0fb56d0ff5c36d0adf12f464eb516251ceb5and the existing watcher/watchless tests./gradlew :core:test --tests com.minekube.connect.register.WatchHealthServerTest --info./gradlew :core:test :velocity:test./gradlew build --rerun-tasksExtracted the observed/healthzresponses withrg "GET /healthz" .../watch-health-end-to-end-gradle.logRemoved generated build outputs with./gradlew cleanand./gradlew -p build-logic clean✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.