Skip to content

Fix show-queue targets to display all queued issues - #698

Merged
majamassarini merged 2 commits into
packit:mainfrom
majamassarini:fix-show-queue-jq
Jul 21, 2026
Merged

Fix show-queue targets to display all queued issues#698
majamassarini merged 2 commits into
packit:mainfrom
majamassarini:fix-show-queue-jq

Conversation

@majamassarini

Copy link
Copy Markdown
Member

The jq filter used .metadata.issue but downstream agents (rebase, backport, rebuild) populate .metadata.jira_issue instead. Tasks from triage used .issue, making the filter silently drop every post-triage queue entry.

Check both fields so all items are visible regardless of which agent enqueued them.

Assisted-by: Claude Opus 4.6 (1M context) noreply@anthropic.com

The jq filter used `.metadata.issue` but downstream agents (rebase,
backport, rebuild) populate `.metadata.jira_issue` instead. Tasks
from triage used `.issue`, making the filter silently drop every
post-triage queue entry.

Check both fields so all items are visible regardless of which agent
enqueued them.

Assisted-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@qodo-for-packit

Copy link
Copy Markdown

PR Summary by Qodo

Fix show-queue to show items enqueued with jira_issue metadata

🐞 Bug fix 🕐 Less than 10 minutes

Grey Divider

AI Description

• Update show-queue jq filter to read .metadata.jira_issue with fallback to .metadata.issue.
• Ensure post-triage queue entries from downstream agents are no longer silently omitted.
Diagram

graph TD
  A["openshift/Makefile: show_queue"] --> B["oc exec: valkey-cli LRANGE"] --> C[("Valkey queues")] --> D["jq: jira_issue || issue"] --> E["tac (oldest-first)"] --> F["terminal output"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Normalize queue schema at enqueue time
  • ➕ Single canonical field for issue ID (no dual-lookup needed)
  • ➕ Prevents future tooling from depending on ambiguous metadata
  • ➖ Requires changes across multiple agents (triage/rebase/backport/rebuild)
  • ➖ Higher coordination and rollout risk than a local display fix
2. Add a defensive jq formatter (show both when present)
  • ➕ Improves debugging by revealing schema differences explicitly
  • ➕ Can help catch inconsistent producers early
  • ➖ Noisier output for routine usage
  • ➖ Doesn’t directly solve the immediate “missing items” problem as cleanly as a fallback

Recommendation: The chosen approach (fallback lookup in the show-queue jq filter) is the best short-term fix: it restores visibility immediately with minimal risk and no cross-agent coordination. Consider a follow-up to standardize the queue payload schema across agents to prevent further drift.

Files changed (1) +3 / -3

Bug fix (1) +3 / -3
MakefileFix show-queue jq filter to include jira_issue-backed tasks +3/-3

Fix show-queue jq filter to include jira_issue-backed tasks

• Updates the jq extraction used by show-queue helpers to check '.metadata.jira_issue' first, then fall back to '.metadata.issue'. This prevents queue dumps from dropping tasks enqueued by downstream agents that populate the newer jira_issue field.

openshift/Makefile

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request updates the openshift/Makefile to prioritize the .metadata.jira_issue field over .metadata.issue when querying and displaying Valkey queues. There are no review comments, so we have no additional feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@qodo-for-packit

qodo-for-packit Bot commented Jul 21, 2026

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📜 Skill insights (0)

Context used
✅ Compliance rules (platform): 7 rules

Grey Divider


Remediation recommended

1. Object issue prints JSON ✓ Resolved 🐞 Bug ⚙ Maintainability
Description
The show_queue/show_single_queue jq filter prints .metadata.jira_issue/.metadata.issue
directly; if the selected value is a Jira object (e.g., {"key": "RHEL-123"}), jq -r will emit
the whole JSON object and also prevent fallback to the string field. This makes make show-*-queue
output hard to scan and may hide the actual issue key in the listing.
Code

openshift/Makefile[R15-24]

+@oc exec deployment/valkey -- valkey-cli --raw LRANGE $(1)_todo 0 -1 | jq -r '.metadata.jira_issue // .metadata.issue // empty' | $(TAC)
@echo
@echo "=== $(1) (normal) ==="
-@oc exec deployment/valkey -- valkey-cli --raw LRANGE $(1) 0 -1 | jq -r '.metadata.issue // empty' | $(TAC)
+@oc exec deployment/valkey -- valkey-cli --raw LRANGE $(1) 0 -1 | jq -r '.metadata.jira_issue // .metadata.issue // empty' | $(TAC)
endef

# Dump a single input queue (one with no priority twin), oldest-first.
define show_single_queue
@echo "=== $(1) ==="
-@oc exec deployment/valkey -- valkey-cli --raw LRANGE $(1) 0 -1 | jq -r '.metadata.issue // empty' | $(TAC)
+@oc exec deployment/valkey -- valkey-cli --raw LRANGE $(1) 0 -1 | jq -r '.metadata.jira_issue // .metadata.issue // empty' | $(TAC)
Relevance

⭐⭐⭐ High

PR #584 accepted handling dict Jira issue objects; likely accept jq key extraction to keep queue
output readable.

PR-#584

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
error_list.py explicitly coerces metadata.issue when it is a dict containing key, showing that
real payloads can nest the issue key as an object; the Makefile jq filter does not perform this
coercion and would therefore print the whole object.

openshift/scripts/error_list.py[177-193]
PR-#584

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`jq -r '.metadata.jira_issue // .metadata.issue // empty'` prints objects as JSON when the selected issue field is a dict, producing noisy output and potentially masking a usable string value in the fallback field.

### Issue Context
Repo tooling already accounts for issue fields sometimes being dicts (e.g. Jira issue objects with a `key` field).

### Fix Focus Areas
- openshift/Makefile[15-24]

### Suggested fix
Normalize the selected value before printing, extracting `.key` when the value is an object. For example:
```make
jq -r '(.metadata.jira_issue // .metadata.issue // empty)
      | if type=="object" then (.key // empty) else . end'
```
(Apply to all three queue-dump pipelines.)

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Qodo Logo

Comment thread openshift/Makefile Outdated
When the selected issue field is an object (e.g. a Jira issue dict),
extract .key instead of printing raw JSON.

Assisted-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

@nforro nforro left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@majamassarini
majamassarini merged commit 422a76f into packit:main Jul 21, 2026
11 checks passed
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.

3 participants