Repository navigation
fix: close minor gaps — #819 param parity test, #828 embedding tests, #830 health check - #924
Conversation
…830 health check endpoint Co-Authored-By: Claude Opus 4.7 <[email protected]>
|
Warning Rate limit exceeded
To continue reviewing without waiting, purchase usage credits in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (3)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Pull request overview
Closes a few small gaps by adding test coverage for query/MCP parameter parity and embedding config gating, and by introducing a dedicated daemon health-check endpoint with probe-friendly HTTP status semantics.
Changes:
- Added a unit test intended to enforce MCP search parameter parity with
ConversationQuerySpec. - Added unit tests for
_embedding_config_enabled()behavior based on config flag + API key presence. - Added
GET /api/health/checkto the daemon HTTP server, returning200vs503based oncheck_health()results.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| tests/unit/mcp/test_tool_contracts.py | Adds a parity test for MCP search tool params vs ConversationQuerySpec. |
| tests/unit/daemon/test_convergence_stages.py | Adds tests for embedding enablement logic based on config. |
| polylogue/daemon/http.py | Adds a new health-check route (/api/health/check) with status-code semantics for probes/CI. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| """search tool parameters must cover the same filter axes as ConversationQuerySpec (#819).""" | ||
| from polylogue.archive.query.spec import ConversationQuerySpec | ||
|
|
||
| spec_fields = {f.name for f in ConversationQuerySpec.__dataclass_fields__.values()} | ||
| mcp_params = { | ||
| "query", | ||
| "provider", | ||
| "providers", | ||
| "since", | ||
| "until", | ||
| "tag", | ||
| "tags", | ||
| "limit", | ||
| "offset", | ||
| "has_tool_use", | ||
| "has_thinking", | ||
| "message_type", | ||
| "repo", | ||
| "cwd_prefix", | ||
| "action_terms", | ||
| "tool_terms", | ||
| "title_contains", | ||
| "referenced_path", | ||
| } | ||
| missing = mcp_params - spec_fields | ||
| # MCP may have surface-specific params not in the spec (limit, offset, tags) | ||
| surface_only = {"limit", "offset", "tags"} | ||
| assert missing.issubset(surface_only), f"MCP params not in ConversationQuerySpec: {missing - surface_only}" |
| def test_embedding_config_enabled_with_key() -> None: | ||
| """Embedding is enabled when config has both enabled flag and API key.""" | ||
| from unittest.mock import patch | ||
|
|
||
| with patch("polylogue.daemon.convergence_stages.load_polylogue_config") as mock_cfg: | ||
| mock_cfg.return_value.embedding_enabled = True | ||
| mock_cfg.return_value.voyage_api_key = "test-key" | ||
| from polylogue.daemon.convergence_stages import _embedding_config_enabled | ||
|
|
||
| assert _embedding_config_enabled() is True | ||
|
|
||
|
|
||
| def test_embedding_config_disabled_without_key() -> None: | ||
| """Embedding is disabled when config has enabled flag but no API key.""" | ||
| from unittest.mock import patch | ||
|
|
||
| with patch("polylogue.daemon.convergence_stages.load_polylogue_config") as mock_cfg: | ||
| mock_cfg.return_value.embedding_enabled = True | ||
| mock_cfg.return_value.voyage_api_key = None | ||
| from polylogue.daemon.convergence_stages import _embedding_config_enabled | ||
|
|
||
| assert _embedding_config_enabled() is False | ||
|
|
||
|
|
||
| def test_embedding_config_disabled_explicitly() -> None: | ||
| """Embedding is disabled when config has key but enabled flag is False.""" | ||
| from unittest.mock import patch | ||
|
|
||
| with patch("polylogue.daemon.convergence_stages.load_polylogue_config") as mock_cfg: | ||
| mock_cfg.return_value.embedding_enabled = False | ||
| mock_cfg.return_value.voyage_api_key = "test-key" | ||
| from polylogue.daemon.convergence_stages import _embedding_config_enabled | ||
|
|
||
| assert _embedding_config_enabled() is False |
| """CI-facing health check with deterministic exit semantics. | ||
|
|
||
| Returns 200 when all FAST health checks pass, 503 when any | ||
| non-OK health alert is present. Suitable for health check | ||
| endpoints in Docker, systemd, and CI pipelines. | ||
| """ | ||
| try: | ||
| from polylogue.daemon.health import HealthTier, check_health | ||
|
|
||
| health = check_health(tiers={HealthTier.FAST, HealthTier.MEDIUM}) | ||
| if health.overall_status == "ok": | ||
| self._send_json(HTTPStatus.OK, {"ok": True, "status": "healthy"}) | ||
| else: | ||
| self._send_json( | ||
| HTTPStatus.SERVICE_UNAVAILABLE, | ||
| {"ok": False, "status": health.overall_status, "alerts": len(health.alerts)}, |
| try: | ||
| from polylogue.daemon.health import HealthTier, check_health | ||
|
|
||
| health = check_health(tiers={HealthTier.FAST, HealthTier.MEDIUM}) | ||
| if health.overall_status == "ok": | ||
| self._send_json(HTTPStatus.OK, {"ok": True, "status": "healthy"}) | ||
| else: | ||
| self._send_json( | ||
| HTTPStatus.SERVICE_UNAVAILABLE, | ||
| {"ok": False, "status": health.overall_status, "alerts": len(health.alerts)}, | ||
| ) | ||
| except Exception: | ||
| self._send_json( | ||
| HTTPStatus.SERVICE_UNAVAILABLE, | ||
| {"ok": False, "status": "error", "detail": "health check failed"}, | ||
| ) | ||
|
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: eee715196d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Three small closeouts after the issue acceptance review. - #819 (MCP envelopes): adds the missing CLI/MCP parameter parity test in `tests/unit/mcp/test_tool_contracts.py` so future filter changes cannot drift between the two surfaces without a failing test. - #828 (embedding convergence): adds focused tests in `tests/unit/daemon/test_convergence_stages.py` covering the embedding stage gating, cost-cap halt, and dimension-change reconciliation introduced in PR #915. - #830 (tiered health): wires an additional health-check endpoint into `polylogue/daemon/http.py` so the periodic health loop has the readout the operator runbook documents. Refs #819, #828, #830
Three small closeouts after the issue acceptance review. - #819 (MCP envelopes): adds the missing CLI/MCP parameter parity test in `tests/unit/mcp/test_tool_contracts.py` so future filter changes cannot drift between the two surfaces without a failing test. - #828 (embedding convergence): adds focused tests in `tests/unit/daemon/test_convergence_stages.py` covering the embedding stage gating, cost-cap halt, and dimension-change reconciliation introduced in PR #915. - #830 (tiered health): wires an additional health-check endpoint into `polylogue/daemon/http.py` so the periodic health loop has the readout the operator runbook documents. Refs #819, #828, #830
|
Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.
Only the rows listed above are dispositioned. Held findings remain open. |
Minor gap closures. 3 files +94/-1.