Conversation
Signed-off-by: Valery Piashchynski <piashchynski.valery@gmail.com>
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughAdds a nil-guard to the Jobs HTTP handler to avoid panics, updates API imports/types to v6 status packages, replaces a toPtr helper with new(bool), introduces extensive tests for status handlers (including /jobs without plugin), and adjusts CI coverage artifact handling and docs. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related issues
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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
Fixes a nil-pointer panic in the /jobs status endpoint when the jobs plugin is not registered (issue #2310), and adds coverage around that behavior.
Changes:
- Add missing
returnafter writing an error response in the/jobshandler to prevent dereferencing a nil registry. - Add an integration test that asserts
/jobsreturns 503 with “jobs plugin not found” when the jobs plugin is absent. - Update CI plumbing for coverage artifact download/filtering and adjust PHP test dependencies.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
jobs.go |
Prevents NPE by returning immediately after the nil-registry error response. |
tests/plugin_test.go |
Adds an integration test covering /jobs when jobs plugin is not registered. |
plugin.go |
Refactors shutdown flag pointer initialization (currently introduces a compile error). |
tests/php_test_files/composer.json |
Updates PHP deps for tests (moves to Guzzle 7 + adapter). |
.github/workflows/linux.yml |
Adjusts codecov job to download coverage artifact into a directory and filter paths. |
doc.go |
Adds package-level documentation for the status plugin. |
tests/doc.go |
Adds package documentation for the integration tests package. |
go.work.sum |
Updates workspace sums due to dependency changes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #112 +/- ##
===========================================
+ Coverage 0 53.97% +53.97%
===========================================
Files 0 6 +6
Lines 0 365 +365
===========================================
+ Hits 0 197 +197
- Misses 0 138 +138
- Partials 0 30 +30 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
.github/workflows/linux.yml (1)
98-105: Awk filter silently drops coverage lines that don't match the expected prefix.The awk script only prints lines matching the
github.com/roadrunner-server/status/v5/prefix pattern. Any coverage lines from other packages or with different paths will be silently discarded. If the coverage file contains only lines from this package, this is fine, but it could cause unexpected data loss otherwise.Consider printing all non-header lines while still stripping the prefix from matching ones:
♻️ Suggested improvement to preserve all coverage lines
awk ' NR == 1 { print; next } - /^github\.com\/roadrunner-server\/status\/v5\// { - sub(/^github\.com\/roadrunner-server\/status\/v5\//, "", $0) - print - } + { + sub(/^github\.com\/roadrunner-server\/status\/v5\//, "", $0) + print + } ' summary.txt > summary.filtered.txt🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/linux.yml around lines 98 - 105, The current awk block that processes summary.txt only emits lines matching the prefix and drops other non-header lines; update the awk script (the multi-line awk in the workflow that reads summary.txt and writes summary.filtered.txt) so that it still prints the header (NR==1) and then for every subsequent line: if it matches the prefix "github.com/roadrunner-server/status/v5/" strip that prefix and print, otherwise print the line unchanged — this preserves all coverage lines while still removing the unwanted prefix when present.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@plugin.go`:
- Line 84: Replace the invalid uses of new(false)/new(true) when storing into
the atomic pointer shutdownInitiated: change the false case to use new(bool) to
obtain a *bool for c.shutdownInitiated.Store, and for the true case introduce
package-level bool variables (e.g. _true and _false) and use their addresses
(&_true / &_false) in the calls to c.shutdownInitiated.Store so the method
receives a proper *bool; update the two locations that call
c.shutdownInitiated.Store accordingly (the line initializing shutdown to false
and the line setting it to true).
- Line 130: The code uses new(true)/new(false) which is invalid in Go; change
calls to c.shutdownInitiated.Store(...) to pass a *bool by creating a local bool
variable and taking its address (e.g., b := true;
c.shutdownInitiated.Store(&b)), and apply the same pattern where
shutdownInitiated is initialized with false (e.g., b := false;
c.shutdownInitiated.Store(&b)) so Store receives a *bool; update both the
initialization site and the shutdown trigger (the uses of new(false) and
new(true)) accordingly.
---
Nitpick comments:
In @.github/workflows/linux.yml:
- Around line 98-105: The current awk block that processes summary.txt only
emits lines matching the prefix and drops other non-header lines; update the awk
script (the multi-line awk in the workflow that reads summary.txt and writes
summary.filtered.txt) so that it still prints the header (NR==1) and then for
every subsequent line: if it matches the prefix
"github.com/roadrunner-server/status/v5/" strip that prefix and print, otherwise
print the line unchanged — this preserves all coverage lines while still
removing the unwanted prefix when present.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 04c04503-aef9-421f-b26c-f85e6f7bffec
⛔ Files ignored due to path filters (1)
go.work.sumis excluded by!**/*.sum
📒 Files selected for processing (7)
.github/workflows/linux.ymldoc.gojobs.goplugin.gotests/doc.gotests/php_test_files/composer.jsontests/plugin_test.go
Signed-off-by: Valery Piashchynski <piashchynski.valery@gmail.com>
Reason for This PR
Description of Changes
License Acceptance
By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.
PR Checklist
[Author TODO: Meet these criteria.][Reviewer TODO: Verify that these criteria are met. Request changes if not]git commit -s).CHANGELOG.md.Summary by CodeRabbit
Bug Fixes
Documentation
Chores
Tests