Skip to content

refactor(knowledge): simplify course-digest extraction scripts (2 of 3) - #14777

Merged
melodic-automation-lanes[bot] merged 2 commits into
mainfrom
work-resolve-issue/issue-14598-42645202352-1
Nov 9, 2026
Merged

melodic-automation-lanes[bot] merged 2 commits into
mainfrom
work-resolve-issue/issue-14598-42645202352-1

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #14598

Summary

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

I ran the /simplify checks over the 13 listed course-digest extraction files and changed four of them, keeping their behavior the same: repeated JSON writes and path joins now share one helper and one path, four if-lines and their output-directory twins became loops, and the transcript and frame-classification loops are now matchAll, reduce and map calls. The other nine files (auth-store, the auth flows, test-helpers, browser, config, meta-tags, player-presence) are already minimal, so I left them unchanged. A fresh-context review pass found that rewriting the redirect handler in download-resources.js as resolve(download(...)) would have stopped a late socket timeout from rejecting, so I reverted that line.

Not verified

  • The knowledge extraction node test suite (cli-entry.test.js and others), Biome lint and the checkJs typecheck were not run: this lane cannot run node or an interpreter. They are left to the PR's CI.
  • tidy-diff markdown passes 4 and 5 (write-for-humans, ai-slop fix) were skipped on the changelog fragment, because its only body line is text the issue requires word for word

Fix

  • plugins/knowledge/skills/course-digest/extraction/download-resources.js: reads the bucket arrays directly, and loops over one outputDirs list both to create the directories and to print the output paths (same order, same text)
  • plugins/knowledge/skills/course-digest/extraction/extract-course-run.js: saveLessonResources builds resources.json from a key list with Object.fromEntries (same keys, same order)
  • plugins/knowledge/skills/course-digest/extraction/extract-course.js: a local writeJson helper replaces four identical writeFileSync(JSON.stringify(..., null, 2)) calls, and runReportPath is computed once in place of three joins
  • plugins/knowledge/skills/course-digest/extraction/generate-manifests.js: parseTranscript uses matchAll; nearestSegment uses reduce (the earliest segment still wins a tie); classifyLesson maps frames with slide/keep defaults and drops the duplicated branches, and its ClassifiedFrame typing is kept
  • .changes/knowledge/work-resolve-issue-issue-14598-42645202352-1-b67733d7.md: patch fragment, '### Changed' / 'Internal simplification, no behavior change.'

Verification

The runner ran each check from the base copy against 7a14d72:

  • 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 (ran before and after tidy and the review fixes)
  • check-changed-skills: course-digest PASS, 0 errors, 4 warnings that predate this change
  • check-affected: 12 passed, 7 skipped, over 5 changed files
  • fresh-context review subagent: checked every hunk for equal behavior; it flagged a redirect-timeout difference (reverted) and lost per-object JSDoc typing (restored with an arrow returns); it found every other hunk equivalent
  • code-tidying:tidy-diff over the 22 changed hunks: no further edits; the one new comment (nearestSegment tie rule) is kept because it states behavior the code does not make obvious
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/42645202352

Left out: the items under Not verified.

Related

#14598

Merge-Risk: max=LOW demote=false head=615b8a81b2b4eb230976ec148cca2c054846995f rubric=8.2.0 rater=claude-opus-5-5 checker=claude-opus-5-5

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

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review needs no new review of 615b8a81b2b4eb230976ec148cca2c054846995f: no file of this pull request changed since the review of 7a14d72.

Security review: PR #14777 (head 7a14d72)

I read every hunk of all 5 changed files. I found no security issues.

This pull request only refactors local course-extraction scripts in plugins/knowledge/skills/course-digest/extraction/ and adds a changelog fragment. The behavior stays the same:

  • download-resources.js: reads the buckets directly, and one outputDirs list now drives both mkdirSync and the log lines. The paths are the same as before, and the redirect, download and network code is unchanged.
  • extract-course-run.js: resourceData is now built with Object.fromEntries over a fixed list of four keys. Keys come only from that list and none come from input, so there is no prototype-pollution path.
  • extract-course.js: a local writeJson helper writes to the same paths as before, and runReportPath is computed once. The write targets are unchanged.
  • generate-manifests.js: matchAll, reduce and map replace loops over local transcript and frame data. The regex is unchanged, so there is no new ReDoS (catastrophic regex backtracking) surface. reduce without a seed is guarded by the existing empty-array check.
  • .changes/knowledge/...md: a patch changelog fragment, prose only.

None of the changed files match a trusted-path glob. The diff touches no trust control, token request, merge hold, workflow, plugin manifest or standing instruction.

The PR context has no embedded directives aimed at the lane.

critical-findings: 0

@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

claude-review needs no new review of 615b8a81b2b4eb230976ec148cca2c054846995f: no file of this pull request changed since the review of 7a14d72.

Code review: no findings

I read every hunk of all 5 changed files. None matches a trusted path. I compared each rewrite with the base code by reading it; I did not run anything. The behavior-unchanged criterion from #14598 holds for every hunk:

  • download-resources.js
    • The buckets are now read directly, which is the same as the old destructuring.
    • outputDirs keeps the old mkdirSync order.
    • The output-path log loop prints the same four lines in the same order.
    • The loop variable path doesn't shadow anything: the file imports named exports from node:path, not a path binding.
  • extract-course-run.js: Object.fromEntries over the fixed key list gives the same keys, in the same order, under the same ?.length > 0 guard.
  • extract-course.js
    • writeJson writes the same thing as the four writeFileSync(JSON.stringify(x, null, 2), "utf-8") calls it replaces.
    • runReportPath is set before the saveProgress closure that uses it. courseDir is already in scope at that point.
  • generate-manifests.js
    • matchAll works because the pattern keeps its g flag. The pattern can't match empty, so it finds the same matches as the old exec loop.
    • In the reduce with no initial value, < is strict, so the earliest segment still wins a tie.
    • classifyLesson keeps the old branch order: scene, then talking-head, then duplicate, then the slide default. A duplicate frame is kept only when it's the last of its run, as before. The ClassifiedFrame.type field is typed string, so the widened let type = "slide" still type-checks.

Closing issue #14598

  • The diff edits only listed files plus one changelog fragment, well under 400 lines.
  • The fragment has bump: patch, a ### Changed heading and the required line, word for word.
  • Whether ci-status is green is for CI to report. The author says they did not run the node tests, Biome or the checkJs typecheck; that is author-claimed and I have not checked it.

No .claude-plugin manifest changed, so the manifest checks don't apply. There were no settled threads or prior findings to account for.

@melodic-automation-lanes melodic-automation-lanes Bot added the needs-session A pr-unblock stop a session builder takes: a change the lane cannot make. Not an owner stop. label Nov 9, 2026
@melodic-automation-lanes

melodic-automation-lanes Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor Author

The pr-unblock lane stopped fix-ci on this pull request: the lane could fix a failing check only by weakening a required check, and the head has no fresh fixer round left (it ran one, or an earlier lane stop already spent its same-head retry), so a session builder takes it. The lane labels it needs-session for a session builder, who makes the change this lane cannot, and the run ends in a failing pr-unblock/fix-ci status on the head the lane gated.

When a retry on this head can change the outcome, the lane runs one on its own, up to its per-head cap, and edits this comment if it stops again; a run that does not stop clears the status. When no retry can (a review thread the lane does not take or settle, or a failing check after the retries are spent), a person resolves the threads or gets the checks green, then dispatches the workflow below: that run finds the cause gone and clears the status. On a pull request the lanes App opened, the dispatchers start that run once per stop; on any other, a person does. A new commit to the branch starts clean.

To run it again on this head now, dispatch the pr-unblock workflow:

gh workflow run pr-unblock.yml -R melodic-software/claude-code-plugins -f pr-number=14777 -f activity=fix-ci

@melodic-automation-lanes melodic-automation-lanes Bot removed the needs-session A pr-unblock stop a session builder takes: a change the lane cannot make. Not an owner stop. label Nov 9, 2026
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for 615b8a8

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-14777-615b8a81b2b4eb230976ec148cca2c054846995f, expires on 2026-12-09.

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 9, 2026
Merged via the queue into main with commit 846d336 Nov 9, 2026
91 of 92 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14598-42645202352-1 branch November 9, 2026 19:27
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The post-merge check verified merge commit 846d3369c707ded975e03cbe2be4e7faf1b9f69f; 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 course-digest knowledge plugin code (2 of 3)

1 participant