Skip to content

perf: extract item selection into bin/pick-item#154

Merged
gringolito merged 4 commits into
masterfrom
perf/pick-item
Jun 17, 2026
Merged

perf: extract item selection into bin/pick-item#154
gringolito merged 4 commits into
masterfrom
perf/pick-item

Conversation

@gringolito

Copy link
Copy Markdown
Owner

Summary

  • Extracts Steps 1–2.6 of execute-item (milestone resolution, in-progress resume check, candidate selection, block-skipping, sub-issue check) into a new deterministic bash script bin/pick-item
  • execute-item now delegates to bin/pick-item and consumes its JSON output; AI reasoning resumes at Step 3 (INVEST validation)
  • Adds a bats test suite (tests/pick-item.bats, 13 tests) covering all 9 acceptance criteria, wired into CI as a parallel test job

Closes #141

🤖 Generated with Claude Code

@gringolito gringolito self-assigned this Jun 16, 2026
Comment thread bin/pick-item Outdated
Comment thread bin/pick-item Outdated
Comment thread bin/pick-item Outdated
Comment thread bin/pick-item Outdated
Comment on lines +250 to +253
winner_view=$(gh issue view "$winner_num" \
--json number,title,body,labels,milestone,url 2>&1) || {
echo "Failed to fetch details for issue #${winner_num}: $winner_view" >&2; exit 1
}

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Don't you have this information from the previous calls? I'm under the impression that we are doing unnecessary API calls

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Correct — number, title, labels, milestone, and url are all already available from the project item-list data. Now saves the winning item in winner_item during the candidate walk, then fetches only body via gh issue view --json body. The gh issue view call is down from 6 JSON fields to 1.

Comment thread skills/execute-item/SKILL.md
Comment thread tests/pick-item.bats Outdated
#!/usr/bin/env bats

setup() {
REPO_ROOT="$(cd "$(dirname "$BATS_TEST_FILENAME")/.." && pwd)"

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Suggested change
REPO_ROOT="$(cd "$(dirname "$BATS_TEST_FILENAME")/.." && pwd)"
REPO_ROOT="$(dirname "$(dirname "$BATS_TEST_FILENAME")")"

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Applied.

@gringolito gringolito changed the title perf: extract item selection into bin/pick-item (#141) perf: extract item selection into bin/pick-item Jun 16, 2026
gringolito added a commit that referenced this pull request Jun 16, 2026
- Move assignee:@me and -label:type:external-blocker filtering
  server-side; remove redundant jq post-filters
- Drop gh api user fetch — no longer needed after server-side
  assignee filtering
- Fetch only body from gh issue view; reuse project item-list data
  for number/title/labels/milestone/url (saves 5 redundant fields)
- Save winner_item during candidate walk so section 7 can build
  candidate_out without re-fetching already-available fields
- Fix step numbering in execute-item SKILL.md: 2.5→2, 2.6→3,
  3→4 … 11→12; update all cross-references
- Simplify REPO_ROOT to nested dirname calls (no subshell cd)
- Update test mock to simulate server-side external-blocker
  filtering; simplify AC7b fixture to reflect assignee:@me scope

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Filipe Utzig <filipe@gringolito.com>
Comment thread bin/pick-item Outdated
gringolito added a commit that referenced this pull request Jun 16, 2026
- Move assignee:@me and -label:type:external-blocker filtering
  server-side; remove redundant jq post-filters
- Drop gh api user fetch — no longer needed after server-side
  assignee filtering
- Fetch only body from gh issue view; reuse project item-list data
  for number/title/labels/milestone/url (saves 5 redundant fields)
- Save winner_item during candidate walk so section 7 can build
  candidate_out without re-fetching already-available fields
- Fix step numbering in execute-item SKILL.md: 2.5→2, 2.6→3,
  3→4 … 11→12; update all cross-references
- Simplify REPO_ROOT to nested dirname calls (no subshell cd)
- Update test mock to simulate server-side external-blocker
  filtering; simplify AC7b fixture to reflect assignee:@me scope

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Filipe Utzig <filipe@gringolito.com>
gringolito and others added 2 commits June 16, 2026 14:22
Steps 1–2.6 of execute-item (milestone resolution, in-progress check,
candidate selection, block-skipping, sub-issue check) are now
deterministic bash rather than inline AI prose. execute-item delegates
to bin/pick-item and consumes the JSON output; AI reasoning resumes
at Step 3 (INVEST validation). Includes bats test suite (13 tests)
covering all 9 acceptance criteria, wired into CI as a test stage
that gates the validate-plugin job.

Refs #141

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Filipe Utzig <filipe@gringolito.com>
- Move assignee:@me and -label:type:external-blocker filtering
  server-side; remove redundant jq post-filters
- Drop gh api user fetch — no longer needed after server-side
  assignee filtering
- Fetch only body from gh issue view; reuse project item-list data
  for number/title/labels/milestone/url (saves 5 redundant fields)
- Save winner_item during candidate walk so section 7 can build
  candidate_out without re-fetching already-available fields
- Fix step numbering in execute-item SKILL.md: 2.5→2, 2.6→3,
  3→4 … 11→12; update all cross-references
- Simplify REPO_ROOT to nested dirname calls (no subshell cd)
- Update test mock to simulate server-side external-blocker
  filtering; simplify AC7b fixture to reflect assignee:@me scope

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Filipe Utzig <filipe@gringolito.com>
gringolito and others added 2 commits June 16, 2026 15:37
gh project item-list already returns .content.body — no need for a
separate gh issue view call. Remove the fetch, use .content.body from
winner_item directly, and add body to all test fixtures.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Filipe Utzig <filipe@gringolito.com>
The live GitHub Projects API returns labels, milestone, linked pull
requests, and assignees at the item top level — not under .content.
Also, labels are string arrays and linked PRs are URL strings.

Fix field paths in in_progress and candidate_out construction, update
all test fixtures to match, and fix the mock's label filter accordingly.

Also remove select(.type == "ISSUE") — the live API returns type:null;
the is:issue query filter already guarantees issue-only results.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Filipe Utzig <filipe@gringolito.com>
@gringolito gringolito merged commit bba759a into master Jun 17, 2026
2 checks passed
@gringolito gringolito deleted the perf/pick-item branch June 17, 2026 02:57
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.

Extract item selection logic from execute-item into bin/pick-item

1 participant