Skip to content

fix(api): fix inverted check in ready endpoint - #2296

Open
WitteShadovv wants to merge 1 commit into
safing:developmentfrom
WitteShadovv:fix/api-ready-endpoint
Open

WitteShadovv wants to merge 1 commit into
safing:developmentfrom
WitteShadovv:fix/api-ready-endpoint

Conversation

@WitteShadovv

@WitteShadovv WitteShadovv commented Oct 16, 2026 •

Copy link
Copy Markdown

GET /api/v1/ready returned "portmaster is not ready" (425) when Portmaster was ready, and "Portmaster is ready." while it was still starting. The check in ready() was inverted.

Nothing in the UI calls it at the moment (DebugAPI.ready() is unused), so this only affects external tools that wait for Portmaster to finish starting.

Testing: added TestReadyEndpoint, which fails without the fix; go test ./base/api/ and go vet pass.

Summary by CodeRabbit

  • Bug Fixes
    • The readiness check now returns HTTP 425 (“Too Early”) with a not-ready response when the instance is not ready. When the instance is ready, it reports that it is ready instead of returning a not-ready error. This makes the readiness response consistent with the instance’s current status.

@coderabbitai

coderabbitai Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5247fd60-df4f-432d-8943-94db682bdda3
📥 Commits

Reviewing files that changed from the base of the PR and between 53e7faf and 3e02475.

📒 Files selected for processing: 1
  • base/api/endpoints_debug_test.go

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

📝 Walkthrough

The ready endpoint now takes the not-ready error path when the instance is not ready. A test checks that ready(nil) returns "Portmaster is ready." without an error.

Changes: Ready endpoint

Layer / File(s) Summary
Readiness check and test
base/api/endpoints_debug.go, base/api/endpoints_debug_test.go
The endpoint now takes the error path when module.instance.Ready() is false. The test checks that ready(nil) returns the expected ready response without an error.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~5 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 3e024

The readiness endpoint now reports the ready state correctly, and its regression test detects the previous inversion. No actionable risk remains before merge.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: correcting the inverted readiness check in the API endpoint.
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@CLAassistant

CLAassistant commented Oct 16, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

GET /api/v1/ready returned "portmaster is not ready" (425) when
Portmaster was ready, and "Portmaster is ready." while it was still
starting.

Nothing in the UI calls it at the moment (DebugAPI.ready() is unused),
so this only affects external tools that wait for Portmaster to finish
starting.
@WitteShadovv
WitteShadovv force-pushed the fix/api-ready-endpoint branch from 53e7faf to 3e02475 Compare October 16, 2026 12:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants