Skip to content

refactor(knowledge): simplify video-digest extraction code (4 of 8) - #14845

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

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

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #14609

Summary

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

Applied behavior-preserving simplifications to 5 of the 15 listed video-digest extraction files. CELL_IDS is now generated from the 4x4 grid instead of a 16-line literal. Loops became filter/find, an if/return pair became one return, a duplicated path.basename call was hoisted, a null-guard became optional chaining, and asr-transcribe uses import.meta.dirname instead of fileURLToPath. The other 10 files (env-compat, run-args, slice-lanes, synthesis-filename, temp-session-paths, watch-frame-index, watch-slice-sessions, work-root, run.mjs, setup-deps.mjs) were reviewed and left unchanged: none had a simplification that kept behavior exactly the same within the out-of-scope limits (no cross-file dedupe, no moving code). Design choice: readJsonFile in watch-frame-index.js could replace five JSON.parse(fs.readFileSync(...)) calls in watch-vision-validation.js, but that is deduping across the listed files, which the issue leaves to the restructuring pass.

Not verified

  • Node unit suites (vitest) for the touched modules, e.g. asr-transcribe.test.js, vision-gated-cli.test.js, preflight.test.js, were not executed directly in this lane; left to the PR's CI.
  • ci-status green is a PR CI check; left to the PR's CI.
  • tidy: pass 5 (ai-slop:audit fix) could not run its detector because the lane runs only the named wrappers; the rubric was read by hand on the one-line fragment and found nothing. The fragment text is fixed by the issue. tidy recorded as skipped.
  • Untracked runner dotfiles (.bash_profile, .bashrc, .gitconfig, .idea, .mcp.json, .profile, .ripgreprc, .vscode, .zprofile, .zshrc) show in git status; this run did not create them and they are not part of the change.

Fix

  • plugins/knowledge/skills/video-digest/extraction/harvesting/run-harvest.js: rawInfo null-guard as optional chaining; the JSON output object literal on one line (same keys, same order).
  • plugins/knowledge/skills/video-digest/extraction/lib/portable-target.js: compute path.basename(resolved) once instead of twice.
  • plugins/knowledge/skills/video-digest/extraction/lib/watch-vision-validation.js: CELL_IDS generated row-major from a [1..4] grid (same 16 values, same order); parseWatchChecklistBlockingTicks uses filter; validateWatchChecklistForCompleteSlice returns one object built from a ternary.
  • plugins/knowledge/skills/video-digest/extraction/preflight.mjs: dropped an intermediate dataDir destructure; the faster-whisper probe loop is now filter(Boolean).find(...) with the same probe order and short-circuit.
  • plugins/knowledge/skills/video-digest/extraction/transcript/asr-transcribe.js: ASR_SCRIPT_PATH from import.meta.dirname (already used by sibling runtime modules; plugin Node floor is 22); removed the node:url import.
  • .changes/knowledge/work-resolve-issue-issue-14609-42682152016-1-6b32b012.md: patch fragment, ### Changed, "Internal simplification, no behavior change."

Verification

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

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

The run reports:

  • check-changelog-fragments: all 10 fragments valid (run after the final edit)
  • check-changed-skills: video-digest PASS, 0 errors, 5 pre-existing warnings about SKILL.md size and prose, not touched by this change (run after the final edit)
  • check-affected: 12 passed, 7 skipped, over 6 changed files (run after the final edit)
  • fresh-context review subagent: every edit EQUIVALENT except validatePromotionDecisions' flatMap, which skips holes in a sparse array; that edit was reverted to the original index loop, then all three checks were run again and passed
  • tidy (code-tidying:tidy-diff) over the 11 changed hunks: no further edits; no comments in the listed lines; no generated-code residue found
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/42682152016

Left out: the items under Not verified.

Related

#14609

Merge-Risk: max=MEDIUM demote=false head=013826aadf997060f54a370efbe17895784a3081 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 reviewed 013826aadf997060f54a370efbe17895784a3081: read 6 of 6 changed file(s); 0 finding(s), 0 as inline comments.

Security review: PR #14845 (head 013826a)

I found no security issues. This was a full review, not blocking only: no earlier head was reviewed and there are no prior findings.

I read every hunk of all 6 changed files. None of them matches a trusted path, and none touches a plugin manifest, workflow, trust control, merge hold or standing instruction.

  • .changes/knowledge/...md adds a patch changelog fragment and nothing that runs.
  • run-harvest.js: the rawInfo && null guard became rawInfo?.webpage_url. The typeof === "string" check is still there. The output JSON keeps the same keys in the same order. Behavior is unchanged.
  • portable-target.js: path.basename(resolved) is now computed once and reused. Behavior is unchanged.
  • watch-vision-validation.js: CELL_IDS is now generated from the 4x4 grid, giving the same 16 IDs in row-major order. CELL_ID_RE validation is unchanged. The checklist tick check became a filter using the same regex, with id still taken from a fixed literal list, so no outside input reaches the RegExp. The validator still returns valid: false with the same error when ticks are missing. The validation is not weakened.
  • preflight.mjs: the faster-whisper probe loop is now filter(Boolean).find(...). The candidate order, the short-circuit and the filter that drops a literal ${user_config...} value are all unchanged. The configured Python path still comes from the same argv/env sources as before, so the command surface is the same.
  • asr-transcribe.js: ASR_SCRIPT_PATH now comes from import.meta.dirname instead of fileURLToPath(import.meta.url). It resolves to the same module-relative path, and no outside input reaches it.

The PR context file contains no embedded instructions aimed at the lane.

critical-findings: 0

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

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

Code review: PR #14845, simplify video-digest extraction code (4 of 8)

No findings. I read every hunk of all 6 changed files and checked each edit for equivalence by reading the code. I ran no tests, so the vitest suites and green CI are still claims from the author that I have not checked.

Equivalence checks

  • run-harvest.js: typeof rawInfo?.webpage_url === "string" gives the same result as the old rawInfo && typeof ... guard for null, undefined, falsy primitives and truthy primitives. Every one of those falls back to null. The one-line JSON.stringify object has the same keys in the same order and the same indent of 2.
  • portable-target.js: computing path.basename(resolved) once instead of twice is equivalent.
  • watch-vision-validation.js:
    • The generated CELL_IDS is row-major R1C1…R4C4: the same 16 values in the same order. The old array was not frozen either.
    • The filter version of parseWatchChecklistBlockingTicks keeps the same regex and the same order of missing.
    • The ternary return gives {valid, errors, skipped:false} the same values in both branches.
  • preflight.mjs:
    • dataDir was scoped to the try block and is not used anywhere else, so inlining it is safe.
    • In the whisper probe, configuredPython is only ever undefined or a non-empty trimmed string, so filter(Boolean) keeps the same candidates. .find stops at the first hit, like the old loop, and returns undefined when nothing matches, as the old let whisper did. whisper is never reassigned later.
  • asr-transcribe.js: import.meta.dirname is already used in runtime modules next to this one (watch/detect-recoverable-bootstrap.js:116, run.mjs:37, setup-deps.mjs:11). That means this file gets no new runtime or bundler requirement. The fileURLToPath import is no longer used anywhere in the file, so removing it is safe.

Closing issue #14609 acceptance criteria

  • Behavior unchanged: met, by the checks above. Exported names, flags and output are unchanged.
  • Only listed files plus fragments: met. All 5 code files are on the issue's list, plus one fragment.
  • Within 400 lines and 15 files: met. The diff is small and touches 5 code files.
  • ci-status green: left to CI. The lane cannot see it.
  • Fragment: met. bump: patch, ### Changed, "Internal simplification, no behavior change."

No plugin manifest changed, and no embedded instructions were found in the PR context.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for 013826a

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-14845-013826aadf997060f54a370efbe17895784a3081, 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 94bb528 Nov 10, 2026
63 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14609-42682152016-1 branch November 10, 2026 00:04
@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/knowledge/skills/video-digest/extraction/harvesting/run-harvest.js 0 2 0 0 0 0
plugins/knowledge/skills/video-digest/extraction/lib/portable-target.js 0 1 0 0 0 0
plugins/knowledge/skills/video-digest/extraction/lib/watch-vision-validation.js 2 1 0 0 0 0
plugins/knowledge/skills/video-digest/extraction/preflight.mjs 1 0 0 0 0 0

Surviving mutants

Location Operator Disposition Cause
plugins/knowledge/skills/video-digest/extraction/lib/watch-vision-validation.js:28 other productive input-gap
plugins/knowledge/skills/video-digest/extraction/harvesting/run-harvest.js:53 ROR productive input-gap
plugins/knowledge/skills/video-digest/extraction/harvesting/run-harvest.js:77 AOR productive input-gap
plugins/knowledge/skills/video-digest/extraction/lib/portable-target.js:76 SBR 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 94bb528d22b428b04757b0a78fed8db3ab9fc151; 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 (4 of 8)

0 participants