Repository navigation
feat: warn on dev version and loop detection - #664
Conversation
Log a warning on startup if the service info reports the placeholder version 0.0.0.dev0, and if a gateway has neither server.public_url nor plugins.gateway_id, so that it can't detect routing loops. Until now, only the docs said the latter. Closes #624 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Reviewer's GuideAdds two non-blocking startup warnings: one for the Sequence diagram for startup configuration warningssequenceDiagram
participant App as Application startup
participant Runtime as Runtime configuration
participant ServiceInfo as Service info
participant Gateway as Gateway
participant Logger as Startup logger
App->>ServiceInfo: check_service_info(app)
ServiceInfo->>Logger: warning when version is 0.0.0.dev0
App->>Runtime: create_host()
Runtime-->>Gateway: resolved host.gateway_id
alt gateway_id is absent
Gateway->>Logger: warning that routing loops are not detected
end
App-->>App: continue startup
Flow diagram for gateway loop-detection identityflowchart TD
Start[Gateway startup] --> Host["create_host()"]
Host --> Identity{host.gateway_id exists?}
Identity -->|Yes| Detection[Enable Via-header loop detection]
Identity -->|No| Warning[Log startup warning]
Warning --> Inactive[Loop detection remains inactive]
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #664 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 56 56
Lines 7223 7228 +5
=========================================
+ Hits 7223 7228 +5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="tests/api/test_service_info.py" line_range="333" />
<code_context>
+def test_check_service_info_released_version(log: pytest.LogCaptureFixture) -> None:
+ """Other versions are not warned about."""
+ check_service_info(_app({"service": {**DEPLOYED, "version": "1.2.3.dev0"}}))
+ assert PLACEHOLDER_VERSION not in log.text
</code_context>
<issue_to_address>
**Other versions still trigger warnings**
When `check_service_info` emits a warning for `1.2.3.dev0` without the phrase `placeholder version`, `test_check_service_info_released_version` checks only whether the log contains `placeholder version`; a warning for `1.2.3.dev0` with different wording therefore passes, despite the test claiming other versions are not warned about.
Assert that the captured log has no records at `logging.WARNING` level.
</issue_to_address>Linked issues
#624 feat: warn on dev version and loop detection · 3 of 3 met
| # | Requirement | Status | Notes |
|---|---|---|---|
| 1 | Warn when service info reports the placeholder version 0.0.0.dev0. |
✅ Met | The startup service-info check logs a warning when the version matches 0.0.0.dev0. |
| 2 | Warn when a gateway has neither server.public_url nor plugins.gateway_id, leaving loop detection inactive. |
✅ Met | Startup checks the created host’s gateway_id, so it also warns when a public URL cannot produce a valid gateway name. |
| 3 | Test each warning and cases where no warning should occur, with 100% coverage. | ✅ Met | Tests cover both warnings and non-warning cases; the project requires 100% coverage, and the PR verification reports 100%. |
Sourcery assessment
Approval pending. 1 finding to address first.
Blocking findings: tests/api/test_service_info.py:333
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Summary
Two startup warnings:
0.0.0.dev0.server.public_urlnorplugins.gateway_id, so loop detection is inactive. The check uses the name the host ends up with, so a public URL from which no valid name can be derived warns too.Docs: service info configuration, deployment guide (list of startup warnings), plugins page.
Closes #624
Light lane: only trivial startup warnings, with tests.
Verification
ruff check,ruff format --check,mypy,ast-grep scan,mkdocs build --strict: pass.coverage run -m pytestwith MongoDB 7.0: 3380 passed, 1 skipped, 100% coverage.🤖 Generated with Claude Code
Summary by Sourcery
Warn operators about unreleased service versions and disabled gateway loop detection during startup.
Enhancements:
Tests: