Skip to content

refactor(work-items): simplify the github adapter scripts - #15053

Merged
melodic-automation-lanes[bot] merged 1 commit into
mainfrom
work-resolve-issue/issue-15049-42793716093-1
Nov 10, 2026
Merged

melodic-automation-lanes[bot] merged 1 commit into
mainfrom
work-resolve-issue/issue-15049-42793716093-1

Conversation

@melodic-automation-lanes

@melodic-automation-lanes melodic-automation-lanes Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Closes #15049

Summary

Opened by the work-resolve-issue lane. The run's own summary:

Simplified four of the fifteen listed GitHub adapter scripts without changing behavior: common.sh shares one binding read between its two config loaders and one assignee-edit helper behind wit_add_assignee/wit_remove_assignee; claim.sh writes its lease-supersede PATCH once instead of twice; create-item.sh drops a duplicated label split and a second --parent validation; label-provenance.sh captures its two bare gh reads through one helper and lets entry append its own row. The other eleven files were reviewed and left as they are, since they are already minimal or any further change would need moving code between files, which the issue puts out of scope. Public names, flags, outputs, stderr text and exit codes are unchanged.

Not verified

  • The work-item-tracker test suite (plugins/work-items/tools/work-item-tracker/work-item-tracker.test.sh) was not run here because the lane allows no test runner; left to the PR's CI.
  • ci-status green is a PR check; left to the PR's CI.
  • tidy pass 5 (ai-slop) did not run the deterministic detector, because the lane's Bash allows only the named wrappers; the one-line fragment got the rubric read only.
  • Eleven listed files (add-recurrence, add-sub-item, capabilities, change-link, get-field-options, get-item, get-statuses, link-blocks, list-items, list-sub-items, reclaim) were reviewed but not changed: no in-file simplification that would keep behavior byte-identical and still be clearer. Their…

Fix

  • plugins/work-items/tools/work-item-tracker/adapters/github/common.sh: added _wit_edit_assignee (wit_add_assignee and wit_remove_assignee now forward to it) and _wit_gh_read_binding (shared by wit_gh_load_wont_do_labels and wit_gh_load_status_trust); same messages and exit codes.
  • plugins/work-items/tools/work-item-tracker/adapters/github/claim.sh: supersede_our_lease replaces the two copies of the lease-supersede PATCH (lease-only EXIT trap and the lost-race back-off).
  • plugins/work-items/tools/work-item-tracker/adapters/github/create-item.sh: labels are split where each create path reads them, which removes the rebuild after degrade_type; the parent URL is computed once in the sibling-dedupe block and reused for --parent.
  • plugins/work-items/tools/work-item-tracker/adapters/github/label-provenance.sh: read_gh wraps the two stderr-capturing gh reads; entry appends to rows itself.
  • .changes/work-items/work-resolve-issue-issue-15049-42793716093-1-33d6512e.md: patch fragment, '### Changed' / 'Internal simplification, no behavior change.'

Verification

The runner ran each check from the base copy against 0d7ac6c:

  • scripts/check-changelog-fragments.sh --check: passed
  • scripts/check-changed-skills.sh --merge-base: passed

The run reports:

  • check-changelog-fragments: all 4 fragments valid (run before and after tidy).
  • check-changed-skills: no changed skills, nothing to gate (run before and after tidy).
  • check-affected: first run failed shellcheck SC2154 (a replace-all had renamed WIT_GH_OUT to WIT_READ_OUT in label-provenance.sh:39); fixed, and the re-run passed: 13 passed, 6 skipped, 0 failed over 5 changed files.
  • Fresh-context review subagent over the full diff against HEAD: found no behavior difference (checked EXIT-trap paths in claim.sh, the assignee and binding helpers and their callers, label splitting under set -u on bash 3.2, the parent_url reuse, and the read_gh capture order).
  • tidy-diff over the change's 28 hunks: no further edits; no comment deletions; no residue found; fragment text fixed by the issue.
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/42793716093

Left out: the items under Not verified.

Related

#15049

Merge-Risk: max=HIGH demote=true head=0d7ac6cc9295c45ca8ee462a7958c2accb9fefe7 rubric=8.3.3 rater=claude-opus-5-5 checker=claude-opus-5-5

Lane-Activity: work-resolve-issue/resolve-issue
@github-actions

Copy link
Copy Markdown
Contributor

claude-security-review reviewed 0d7ac6cc9295c45ca8ee462a7958c2accb9fefe7: read 5 of 5 changed file(s); 0 finding(s), 0 as inline comments.

Security review: PR #15053, a refactor of the work-items GitHub adapter scripts

No security issues found.

None of the five changed files matches a trusted-path glob. The diff touches no manifest, workflow, trust control, merge hold or instruction surface. I read every hunk of all five files, and read claim.sh and label-provenance.sh in full at head to check what the refactor feeds into.

What I checked:

  • label-provenance.sh decides whether a label is trusted (admin or write permission), using the labeler's permission and the body edit time.
    • The new read_gh helper captures stdout, the exit code and the first line of stderr in the same order as the inline code it replaces.
    • A failed permission read still produces an untrusted entry, and so does an empty or below-write permission (L85-L96).
    • A failed edit-time read still sets after_admission: null, so admitted stays false (L105-L114).
    • entry now appends to the global rows, which is initialized before the loop. Login validation runs before the API path exactly as before.
    • The trust decision is unchanged.
  • claim.sh:
    • The parser only ever sets lease_only to true or false (L18, L44-L46). So [[ "$lease_only" == false ]] || trap supersede_our_lease EXIT arms the trap in exactly the cases the old if did.
    • The assignment-rollback trap for non-lease-only claims is untouched.
    • The supersede PATCH still goes through gh_write, with the same body and the same best-effort || true.
  • common.sh:
    • _wit_edit_assignee keeps wit_write_pause and the read/write writer routing the same.
    • _wit_gh_read_binding still exits with EX_CONFIG on an invalid binding.
    • The status_trust loader still checks that its paths are relative and contain no ...
    • The file mode change from 100644 to 100755 on this sourced library opens no exploit path.
  • create-item.sh:
    • --parent is still checked by wit_require_github_id before its URL is used. The native branch reuses parent_url from the sibling-dedupe block, which runs under the same native && parent condition.
    • Labels are still passed as quoted per-element arguments, so no shell injection surface is added.
  • Changelog fragment: plain text, no executable content.

The pull request context contains no embedded instructions aimed at the review lane.

critical-findings: 0

@github-actions

Copy link
Copy Markdown
Contributor

claude-review reviewed 0d7ac6cc9295c45ca8ee462a7958c2accb9fefe7: read 5 of 5 changed file(s); 1 finding(s), 0 as inline comments.

Code review: refactor(work-items): simplify the github adapter scripts

I read every hunk of all 5 changed files, plus the full head versions of claim.sh, create-item.sh and label-provenance.sh. I found no behavior regressions in the refactor. I ran no tests myself; the PR body's check results are the author's claim and I have not verified them.

What I checked

  • claim.sh: supersede_our_lease is defined after our_comment_id is set, and before both places that use it: the lease-only EXIT trap and the lost-race back-off. The PATCH body and the || true best-effort behavior are the same as before. The non-lease-only path still keeps the earlier _wit_claim_rollback trap. superseded is now a local variable, and nothing else read it.
  • common.sh: _wit_edit_assignee POST|DELETE "$@" maps writer/owner/repo/number/login to $2..$6 correctly, and nothing in the adapter or lib/ reads FUNCNAME. _wit_gh_read_binding keeps the old outcomes: no binding returns 0 from the caller, and an invalid binding prints the same message and exits with EX_CONFIG.
  • create-item.sh:
    • IFS=',' read -ra label_list <<<"" gives an empty array, and the ${label_list[@]+…} guard keeps that safe under set -u. The REST path splits labels after any degrade_type, so dropping the rebuild is safe.
    • parent_url is always set when the native create block runs with --parent. native only ever goes from 1 to 0, so that block runs only after the sibling-dedupe block has run.
  • label-provenance.sh: read_gh captures stdout, the exit code and the first stderr line in the same order as before. entry appending to the global rows gives the same rows.
  • Tests: claim.test.sh, create-item.test.sh, lease-coordination.test.sh and label-provenance.test.sh exist and run these paths. So the "behavior unchanged" criterion has tests that could fail if it broke.

Findings

  • Advisory, whole PR (no line to anchor on): the diff changes the file mode of plugins/work-items/tools/work-item-tracker/adapters/github/common.sh from 100644 to 100755.
    • The file is a library that other scripts source. It starts with # shellcheck shell=bash and has no shebang, and the dispatcher runs adapter scripts through bash, so the executable bit does nothing there.
    • The PR body lists every edit to common.sh but not this mode change.
    • It is a stray metadata change in a PR that is meant to change nothing but code structure. Nothing seems to break, but run directly, the library would execute its setup and then quit.
    • Fix: run git update-index --chmod=-x on that file (or chmod 644 it) to restore mode 100644.

Closing issue #15049 acceptance criteria

  • Behavior unchanged: met, as far as I could check by reading. Tests exist for each touched script.
  • Diff edits only listed files and fragments: met. All four scripts are on the issue's list, plus one fragment.
  • Within 400 lines and 15 files: met.
  • ci-status green: CI's job, not checked here.
  • Fragment bump: patch with ### Changed and "Internal simplification, no behavior change.": met.

Plugin manifests: none changed.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The unattended merge path armed native auto-merge at head 0d7ac6cc9295c45ca8ee462a7958c2accb9fefe7, the head its arming checks judged.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for 0d7ac6c

The verifier passed this head. The capture artifact holds the capture summary, which says whether the capture ran, and any screenshot or video that passed the mask check; this comment uploads no file.

Capture artifact: pr-capture-15053-0d7ac6cc9295c45ca8ee462a7958c2accb9fefe7, expires on 2026-12-10.

One comment per pull request, updated in place for each new head.

@melodic-automation-lanes
melodic-automation-lanes Bot added this pull request to the merge queue Nov 10, 2026
Merged via the queue into main with commit 5874ad7 Nov 10, 2026
64 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-15049-42793716093-1 branch November 10, 2026 11:54
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The post-merge check verified merge commit 5874ad7ba9cb80c4f2f4e861a6a14e0311b6afb9; later checks count it verified from this comment.

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.

Simplify the github work-items plugin code

0 participants