jira: Fix global_read support in availability check and tool handler#20
Conversation
In which I actually try using JIRA through this for the first time... The JIRA availability check required explicit project entries even when global_read was true, making the service report as unavailable. The tool handler also read struct fields directly instead of using accessor methods that fall back to environment variables (JIRA_HOST, JIRA_USERNAME, JIRA_API_TOKEN), so tokens provided via _FILE env vars were ignored. The project list guard had the same issue, requiring non-empty projects instead of checking has_any_read_access(). Assisted-by: OpenCode (Claude Opus 4) Signed-off-by: Colin Walters <walters@verbum.org>
📝 WalkthroughWalkthroughRefactored Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ 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.
🧹 Nitpick comments (1)
src/mcp.rs (1)
3000-3001: Consider clarifying the missing configuration message.When
has_read_accessis false, the message says "project configuration" is missing. However, users could also enable access viaglobal_read: true. Consider changing to "read access configuration" or adding a hint about global_read.💡 Suggested improvement
if !has_read_access { - missing.push("project configuration"); + missing.push("read access (global_read or project entries)"); }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/mcp.rs` around lines 3000 - 3001, The current branch that pushes "project configuration" into the missing vector when has_read_access is false is ambiguous; update the message pushed into missing (where has_read_access is checked) to something like "read access configuration (or enable global_read)" or otherwise append a hint about global_read so users know they can enable global_read: true as an alternative. Locate the check around has_read_access and replace the literal "project configuration" with a clearer string such as "read access configuration (or enable global_read)" or programmatically add an extra hint entry when global_read is available.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/mcp.rs`:
- Around line 3000-3001: The current branch that pushes "project configuration"
into the missing vector when has_read_access is false is ambiguous; update the
message pushed into missing (where has_read_access is checked) to something like
"read access configuration (or enable global_read)" or otherwise append a hint
about global_read so users know they can enable global_read: true as an
alternative. Locate the check around has_read_access and replace the literal
"project configuration" with a clearer string such as "read access configuration
(or enable global_read)" or programmatically add an extra hint entry when
global_read is available.
In which I actually try using JIRA through this for the first time...
The JIRA availability check required explicit project entries even when global_read was true, making the service report as unavailable. The tool handler also read struct fields directly instead of using accessor methods that fall back to environment variables (JIRA_HOST, JIRA_USERNAME, JIRA_API_TOKEN), so tokens provided via _FILE env vars were ignored.
The project list guard had the same issue, requiring non-empty projects instead of checking has_any_read_access().
Assisted-by: OpenCode (Claude Opus 4)
Summary by CodeRabbit
Bug Fixes
Refactor