Skip to content

fix(jira): auto-quote JQL reserved words in project key values#967

Merged
sooperset merged 1 commit into
mainfrom
fix/jql-reserved-words-quoting
Feb 23, 2026
Merged

fix(jira): auto-quote JQL reserved words in project key values#967
sooperset merged 1 commit into
mainfrom
fix/jql-reserved-words-quoting

Conversation

@sooperset
Copy link
Copy Markdown
Owner

Summary

  • Project keys matching JQL reserved words (e.g., IF, AND, OR) cause Jira API errors like "'IF' is a reserved JQL word" when used in raw JQL queries
  • Add RESERVED_JQL_WORDS constant (from official Atlassian docs) and sanitize_jql_reserved_words() utility to auto-quote these values in project = VALUE and project IN (...) patterns
  • Apply sanitization in search_issues() and get_board_issues(), and refactor projects_filter path to use smart quoting via quote_jql_identifier_if_needed() (only quotes when needed, not unconditionally)

Test plan

  • 31 parametrized tests for quote_jql_identifier_if_needed() and sanitize_jql_reserved_words() in test_jql_utils.py
  • Integration tests verifying sanitization in search_issues() (Cloud + Server) and get_board_issues()
  • Existing projects_filter tests updated to match smart quoting behavior
  • Full unit test suite passes (1846 tests)
  • Pre-commit clean (ruff-format, ruff, mypy)

Closes #966

When a project key matches a JQL reserved word (e.g., IF, AND, OR),
Jira API returns "'IF' is a reserved JQL word" error. Add automatic
quoting of reserved words in project = VALUE and project IN (...)
patterns, mirroring the existing Confluence CQL pattern.

- Add RESERVED_JQL_WORDS constant from official Atlassian docs
- Add quote_jql_identifier_if_needed() and sanitize_jql_reserved_words()
- Apply sanitization in search_issues() and get_board_issues()
- Refactor projects_filter to use smart quoting (only when needed)

Github-Issue:#966
@sooperset sooperset force-pushed the fix/jql-reserved-words-quoting branch from b24ca5d to d1bcfd0 Compare February 23, 2026 04:13
Copy link
Copy Markdown
Owner Author

@sooperset sooperset left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Single-quote handling for both string literals and IN-clause values was missing in the initial version — now fixed. Implementation correctly mirrors the Confluence CQL pattern with proper JQL-specific adaptations. Reserved words list verified against official Atlassian docs. 1848 tests pass, lint/mypy clean.

@sooperset sooperset merged commit 3122913 into main Feb 23, 2026
7 checks passed
@sooperset sooperset deleted the fix/jql-reserved-words-quoting branch February 23, 2026 04:14
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.

[Bug]: JQL reserved words in project keys not automatically quoted

1 participant