Skip to content

refactor(planning): split the GitHub lookup out of offer-source's cache logic - #15074

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

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

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #14671

Summary

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

In plugins/planning/offers/offer-source.mjs, the two GitHub requests (catalog, then newest commit on the source path) move out of lookup() into a new private async function ask(), which returns the record or throws. lookup() now reads as cache-check, claim the slot, ask, save: the 19-line try/let/else block becomes one await ask(...).catch(...) line. Records, error strings, cache file contents, fetchJson call order and every export are unchanged. A second edit (looping over entries with continue instead of filter) was reverted after review showed it differs on contrived inputs (an installed set mutated mid-loop, sparse arrays), since the issue requires strictly unchanged behavior.

Not verified

  • plugins/planning/tests/offer-source.test.sh (node --test) not run: this lane runs no interpreter; left to the PR's CI
  • tidy: ai-slop pass ran the rubric read only; detect.sh, the findings file and the semantic-diff guard did not run because the lane allows no detect.sh call (the one-line fragment had no tells)
  • cant-fail-scan verify wrapper timed out after 2 minutes when run with no arguments; it is not among the required checks and CI runs it against the base
  • ci-status green: a PR check, left to the PR's CI
  • githubJson's JSON.parse(await res.text()) kept as is rather than res.json(), to avoid any change to error text cached on a malformed reply
  • untracked dotfiles in the checkout root (.bashrc, .bash_profile, .gitconfig, .idea, .mcp.json, .profile, .ripgreprc, .vscode, .zprofile, .zshrc) were not created by this run and are not part of the change

Fix

  • plugins/planning/offers/offer-source.mjs: extracted the catalog/commit lookup into a private async ask(entry, fetchJson); lookup() calls it with a .catch that builds the same { error } record as the old try/catch
  • .changes/planning/work-resolve-issue-issue-14671-42795330954-1-89004619.md: new patch fragment, ### Changed / - Internal simplification, no behavior change.

Verification

The runner ran each check from the base copy against cf52f0b:

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

The run reports:

  • check-changelog-fragments: all 1 fragment valid (run after the edit, after tidy, and after the revert)
  • check-changed-skills: no changed skills, nothing to gate
  • check-affected: 12 passed, 7 skipped (shellcheck/ruff not applicable, typos not installed, validate-plugins steps that run checked-tree code skipped by the check), over 2 changed files
  • fresh-context review subagent over the diff: ask() extraction equivalent for sync throws from a non-async fetchJson, non-Error throws, reject(undefined), call order and cache contents; flagged the filter-to-continue loop change as a low-severity edge-case difference, which was reverted
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/42795330954

Left out: the items under Not verified.

Related

#14671

Merge-Risk: max=LOW demote=false head=cf52f0be0fe870345f3d9ccd9a78e5624436cd7a 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 cf52f0be0fe870345f3d9ccd9a78e5624436cd7a: read 2 of 2 changed file(s); 0 finding(s), 0 as inline comments.

Security review: PR #15074 (head cf52f0b)

I found no security issues. I read both changed files in full; neither matches a trusted-path glob.

  • plugins/planning/offers/offer-source.mjs: The catalog fetch and the newest-commit fetch move out of lookup() into a new private async ask(entry, fetchJson). lookup() now catches its errors with .catch(e => ({ error: String(e?.message ?? e) })). Behaviour is the same as before:

    • The request URLs are unchanged: repos/${entry.repo}/contents/${CATALOG}, and repos/${src.repo}/commits?... with path still passed through encodeURIComponent.
    • sourceOf() is unchanged.
    • The cache file path and the record shapes are unchanged.
    • Errors are handled as before. ask is async, so a synchronous throw from fetchJson becomes a rejection, and the .catch turns it into the same { error } record the old try/catch built.

    No new input reaches a network, filesystem or shell sink. No token or credential handling changed.

  • .changes/planning/...md: A new changelog fragment. It is prose only and runs nothing.

The diff touches no trust controls, merge holds, workflows, instruction surfaces or plugin manifests. The PR context holds no embedded directives. There are no prior findings, and the review was not blocking only.

critical-findings: 0

@github-actions

Copy link
Copy Markdown
Contributor

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

Code review: no findings.

I read both changed files in full: plugins/planning/offers/offer-source.mjs and the new planning changelog fragment.

Equivalence check. I compared the new ask() with the try/catch block it replaces in lookup(), line by line:

  • The sequence is the same: the catalog fetch, the plugins array check, the find by name, sourceOf and the commits query. fetchJson is called in the same order.
  • Every return value and every error string is unchanged.
  • ask() is async, so a synchronous throw from a non-async fetchJson, or from sourceOf, becomes a rejection. The .catch(e => ({ error: String(e?.message ?? e) })) turns it into the same { error } record the old catch built. That holds for non-Error throws and for undefined too.
  • rec is still saved and returned in the same shape. No export changed.

Closing issue #14671 acceptance criteria:

  • Behavior unchanged: met, based on reading the code. I did not run anything; the author says offer-source.test.sh was not run either, so CI will settle it.
  • Diff edits only the listed file and a changelog fragment: met.
  • Within 400 changed lines and 15 files: met (+15/−19 lines, 2 files).
  • ci-status green: not something I can check from here.
  • A planning fragment with bump: patch, a ### Changed heading and the required line: met.

The fragment is correct for a refactor with no behavior change. No plugin manifest changed. No security concern applies to this change.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for cf52f0b

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-15074-cf52f0be0fe870345f3d9ccd9a78e5624436cd7a, 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
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 10, 2026
@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 c0592d3 Nov 10, 2026
63 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14671-42795330954-1 branch November 10, 2026 12:33
@github-actions

Copy link
Copy Markdown
Contributor

Post-merge mutation testing

Killed 3, survived 4, timeout 0, no coverage 0, invalid 0, not run 0.
Covered-code score 43%; mutation score 43%.

File Killed Survived Timeout No coverage Invalid Not run
plugins/planning/offers/offer-source.mjs 3 4 0 0 0 0

Surviving mutants

Location Operator Disposition Cause
plugins/planning/offers/offer-source.mjs:61 SBR productive no-assertion
plugins/planning/offers/offer-source.mjs:63 SBR productive no-assertion
plugins/planning/offers/offer-source.mjs:65 SBR productive no-assertion
plugins/planning/offers/offer-source.mjs:69 LCR productive no-assertion

The run's summary has the full report.

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 offer-source.mjs planning plugin code

0 participants