Skip to content

refactor(knowledge): simplify video-digest adapter and harvesting code without behavior change - #15223

Merged
melodic-automation-lanes[bot] merged 1 commit into
mainfrom
work-resolve-issue/issue-14605-42935557547-1
Nov 11, 2026
Merged

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

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #14605

Summary

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

Simplified two of the six listed video-digest files without changing behavior. In x.js, acquireXMedia's inspectAndGate now re-lists the work directory itself, which removes the listFiles call each caller repeated before it. Tagged-VTT detection keeps each file's content, so the backup no longer reads the file a second time, and the blocked-delegation loop in harvestLinks is shorter. In fetch-deck-attachments.js, the IPv4 and IPv6 non-public checks lose redundant indexing and a ternary that could only be 0. youtube.js, analyze-harvested-repos.js, harvest-links.js and models.js were reviewed and left unchanged: they had no simplification the issue's scope allows, since moving or deduplicating code across files is out of scope.

Not verified

  • Vitest suites (x.test.js and the harvesting tests) were not run: this lane has no wrapper for a test runner. Left to the PR's CI.
  • ci-status green is a PR CI check, left to the PR's CI.
  • tidy-diff pass 4 (docs-hygiene:write-for-humans) was skipped for the changelog fragment: its only line is text the issue requires verbatim. In pass 5, ai-slop's detect.sh and its fix-flow scripts could not run, since this lane's Bash runs only the named wrappers, so the fragment got the rubric read…
  • Untracked runner files at the checkout root (.bashrc, .bash_profile, .gitconfig, .idea, .mcp.json, .profile, .ripgreprc, .vscode, .zprofile, .zshrc) are not part of this change and were left out of the tidy measurement.

Fix

  • plugins/knowledge/skills/video-digest/extraction/adapters/x.js: inspectAndGate re-lists files itself (removes three duplicated listFiles calls), tagged-VTT content cached in a Map instead of read twice, harvestLinks blocked-delegation loop collapsed, !match || !match.groups -> !match?.groups
  • plugins/knowledge/skills/video-digest/extraction/harvesting/fetch-deck-attachments.js: IPv4 check destructures the third octet and merges the two 192.0.x tests, IPv6 padding uses Array(missing) (missing is already 0 when there is no ::), first group destructured once, stray blank line between a…
  • .changes/knowledge/work-resolve-issue-issue-14605-42935557547-1-d8e4242d.md: patch fragment, ### Changed with "Internal simplification, no behavior change."

Verification

The runner ran each check from the base copy against 723617a:

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

The run reports:

  • check-changelog-fragments: all 11 fragments valid (run before and after tidy)
  • check-changed-skills: video-digest PASS, 0 errors, 5 warnings that predate this change (SKILL.md size and procedure notes, nothing in the edited code)
  • check-affected: 12 passed, 7 skipped, over 3 changed files (run before and after tidy)
  • fresh-context review subagent over the whole diff: no behavior change found; listFiles call points and count unchanged, backup write/remove order unchanged, harvestLinks equivalent for every JSON value, IPv6 Array(missing) equivalent because a non-:: address with missing != 0 already returned null
  • tidy-diff over the 16 changed hunks: pass 1 and pass 3 found nothing further, pass 2 found no zero-information comment, pass 5 rubric read of the fragment found no AI-writing tell
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/42935557547

Left out: the items under Not verified.

Related

#14605

Merge-Risk: max=MEDIUM demote=false head=723617af5984819069db1dabbd20750678c59da9 rubric=8.4.0 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 723617af5984819069db1dabbd20750678c59da9: read 3 of 3 changed file(s); 0 finding(s), 0 as inline comments.

Security review: PR #15223 (head 723617a)

No security issues found. I read every hunk of all 3 changed files, plus the surrounding code in each of the two JS files.

None of the changed files match a trusted-path glob. The PR changes no trust control, merge hold, instruction surface or plugin manifest.

What I checked

fetch-deck-attachments.js (the SSRF guard for attachment fetches). I checked whether the refactor changes what the non-public-address checks accept.

  • isNonPublicIPv4: the [a, b, c] destructuring and the merged 192.0.0.x / 192.0.2.x test cover the same ranges as before: 192.0.0/24, 192.0.2/24, 198.51.100/24 and 203.0.113/24. Malformed input still returns true (non-public).
  • ipv6Groups: Array(missing) can never be given a negative or non-zero length where the old ternary gave 0. With no ::, line 120 returns null unless missing === 0. With one ::, a negative missing is rejected. More than one :: is rejected at line 116. Padding is unchanged.
  • isNonPublicIPv6: const [first] = g is the same value as g[0], so the 6to4 check and the unique-local, link-local, site-local and multicast masks behave exactly as before.

adapters/x.js

  • inspectAndGate now calls listFiles itself. The listing happens at the same three points as before: the first gate (L803), after caption cleanup (L881) and after the media pass (L904). No code reads files before that first listing. So the provenance gate (foreign-extractor refusal, parse errors) still checks the current directory contents every time.
  • Cached tagged-VTT content: the content backed up is the content that matched the tag, and the order of backup write, then remove, then remove-backup-after-success is unchanged.
  • Blocked-delegation harvest: delegation?.url returns undefined for primitives and null, as the old object-type check did. The parseHttpUrl gate still keeps javascript:, file: and malformed URLs out of harvested links.
  • !match?.groups behaves the same as !match || !match.groups.

Changelog fragment. Prose only. Nothing in it is a security concern.

The PR context holds no embedded instructions aimed at this lane.

critical-findings: 0

@github-actions

Copy link
Copy Markdown
Contributor

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

Code review: no findings

I read every hunk of all 3 changed files and checked each simplification against the behavior on the base branch. I found nothing to block or flag.

plugins/knowledge/skills/video-digest/extraction/adapters/x.js

  • inspectAndGate re-lists the directory itself. The base code called listFiles before each of the three inspectAndGate calls (the initial gate, after caption cleanup, after the media pass). The head code makes the same calls in the same order. The first one moved from line 720 to inside the first call at line 803, but nothing between those points does I/O or reads files; only closures are defined there. The separate listFiles at line 848 (before the .srt filter) is kept. files keeps the same contents at every later read, including matchEntryArtifacts(files, …).
  • Tagged-VTT content is cached. The backup now writes the content captured during detection instead of reading the file a second time. Nothing writes the file between the two points, so the bytes are the same. The write and remove order and the taggedVtts order (Map insertion order) are unchanged.
  • harvestLinks blocked-delegation loop. delegation?.url gives undefined for null and primitive entries, which the typeof !== "string" check drops, as before. An empty string, which the base code dropped through !delegationUrl, is now dropped by parseHttpUrl(""): new URL("") throws and the function returns null.
  • !match?.groups is equivalent to !match || !match.groups.

plugins/knowledge/skills/video-digest/extraction/harvesting/fetch-deck-attachments.js

  • IPv4 checks. Destructuring c and merging the two 192.0.{0,2} tests is a straight rewrite.
  • IPv6 padding. Array(missing) is equivalent: without :: the function has already returned null unless missing === 0.
  • const [first] = g / the 6to4 check. Equivalent.
  • Removed blank line. Taking out the blank line between the JSDoc and slugFromUrl re-attaches the doc comment to the function. That affects type annotations only, not runtime behavior.

Closing issue #14605 acceptance criteria

  • Behavior unchanged: met by reading the code, as above. The existing x.test.js and harvesting suites cover these paths. The author says they did not run them; I did not run them either, since this lane has no shell.
  • Edits only listed files and fragments: met.
  • Within 400 lines and 15 files: met.
  • ci-status green: left to CI. I did not verify it.
  • Fragment: met. bump: patch, a ### Changed heading and the exact line "Internal simplification, no behavior change."

The verification commands in the PR body were reported by the author; I did not run them. No plugin manifests changed. There are no prior findings from this lane on this PR, and the PR context contains no embedded instructions.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Unattended merge: native auto-merge leaves this pull request unarmed at head 723617af5984819069db1dabbd20750678c59da9. No person needs to act: a lane clears this reason, and the next scheduled run judges it again.

pr-merge's gate refuses its verifier verdict (verify:missing)

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for 723617a

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-15223-723617af5984819069db1dabbd20750678c59da9, expires on 2026-12-11.

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 11, 2026
Merged via the queue into main with commit fc15599 Nov 11, 2026
63 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14605-42935557547-1 branch November 11, 2026 01:31
@github-actions

Copy link
Copy Markdown
Contributor

Post-merge mutation testing

Killed 6, survived 1, timeout 0, no coverage 0, invalid 0, not run 0.
Covered-code score 86%; mutation score 86%.

File Killed Survived Timeout No coverage Invalid Not run
plugins/knowledge/skills/video-digest/extraction/adapters/x.js 4 0 0 0 0 0
plugins/knowledge/skills/video-digest/extraction/harvesting/fetch-deck-attachments.js 2 1 0 0 0 0

Surviving mutants

Location Operator Disposition Cause
plugins/knowledge/skills/video-digest/extraction/harvesting/fetch-deck-attachments.js:93 LCR productive input-gap

The run's summary has the full report.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The post-merge check verified merge commit fc1559921dd1acee335a25020377a01d9b290b75; 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 video-digest knowledge plugin code (3 of 8)

0 participants