Skip to content

refactor(knowledge): simplify video-digest watch scripts (7 of 8) - #15016

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

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

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #14612

Summary

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

Simplified five of the nine listed video-digest watch scripts without changing behavior. Repeated JSON writes now go through a small file-local writeJson helper. Hand-written JSON reads now use the existing readJsonFile helper. Lookups that ran twice now run once, and a nested check and a session loop are shorter. relayout-references.js, render-key-frames-manifest.js, render-triage-log.js and run-resume.js were already tight: the four checks found no change that would shorten them without moving code between files, which is out of scope, so they are unchanged. Choice and basis: no shared writeJson exists in lib/, and adding one would mean deduping across files, which the issue defers to the restructuring pass, so each file got its own local helper.

Not verified

  • vitest suites for the touched files (relayout-slice, render-quality-audit, repair-synthesis-promotions, run-watch*, sanitize-slice-temp-paths tests): this lane cannot run node, so they are left to the PR's CI
  • tsc type-check of the extraction package (checkJs, strictNullChecks): this lane cannot run node, so it is left to the PR's CI
  • ci-status green: a PR CI check, left to the PR's CI
  • tidy pass 5 ran without its detector: ai-slop's detect.sh is not among the commands this lane may run, so the 7-line fragment was checked by hand only and no findings file was written; tidy also skipped pass 5's semantic-diff verifier, since it made no edit

Fix

  • plugins/knowledge/skills/video-digest/extraction/watch/relayout-slice.js: nested the two target-exists checks under one existsSync; a single stage() helper now makes the staging directory and counts the file for both write() and the copy loop
  • plugins/knowledge/skills/video-digest/extraction/watch/render-quality-audit.js: collects the rejected names once and pushes the summary line with a single conditional; output unchanged
  • plugins/knowledge/skills/video-digest/extraction/watch/repair-synthesis-promotions.js: reuses readJsonFile from lib/watch-frame-index.js for both reads; a local writeJson replaces three inline JSON writes; inlined the one-use sessionSlugFromName and replaced the session loop with find; merged the…
  • plugins/knowledge/skills/video-digest/extraction/watch/run-watch.js: the primary-transcript find runs once (primaryWritten) and feeds both primaryTranscript and the cue fallback; selectedCount, targetMinFrames and highVolume are computed once and reused in frameSelection, the watching phase metrics…
  • plugins/knowledge/skills/video-digest/extraction/watch/sanitize-slice-temp-paths.js: a local writeJson replaces four inline JSON writes; the snapshot-meta lanePath call fits on one line
  • .changes/knowledge/work-resolve-issue-issue-14612-42771277222-1-2f08e95e.md: patch fragment, created with new-changelog-fragment, body '### Changed' and 'Internal simplification, no behavior change.'

Verification

The runner ran each check from the base copy against 4c13b10:

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

The run reports:

  • check-changelog-fragments: all 23 fragments valid (run before and after tidy)
  • check-changed-skills: video-digest PASS, 0 errors, 5 warnings that the SKILL.md already had before this change (run before and after tidy)
  • check-affected: 12 passed, 7 skipped over 6 changed files (run before and after tidy)
  • fresh-context subagent review of the whole diff: no findings; it confirmed the same written bytes, the same JSON key order, the same refusal order and messages, readJsonFile equivalent to JSON.parse(readFileSync), writeWatchingManifest only reads its watching argument, and no type or sibling-test…
  • tidy-diff over 31 hunk rows: pass 1 simplify none further; pass 2 comments none deleted (the stage() doc comment kept because it names the counting side effect; the writeJson param tags carry types checkJs needs); pass 3 residue none; pass 4 write-for-humans no edit, since the issue mandates the…
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/42771277222

Left out: the items under Not verified.

Related

#14612

Merge-Risk: unrated reason=pending

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

Copy link
Copy Markdown
Contributor

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

Security review: PR #15016, head 4c13b10

No security issues found. This was a complete review: I read every hunk of all 6 files in the full diff.

What the change does: it refactors five video-digest watch scripts under plugins/knowledge/skills/video-digest/extraction/watch/ and adds one changelog fragment. None of the changed files is on a trusted path. The diff does not touch a plugin manifest, a workflow, a trust control, a merge hold or any instruction text.

Checks made:

  • repair-synthesis-promotions.js: the new import of readJsonFile from ../lib/watch-frame-index.js is JSON.parse(fs.readFileSync(filePath, "utf8")) (watch-frame-index.js#L19-L21). It reads exactly what the replaced inline calls read. The local writeJson helpers write the same bytes to the same paths as before. The .png prune condition and the session lookup keep their old semantics.
  • relayout-slice.js: the nested existsSync checks keep the same refusals in the same order, so --replace still refuses to replace anything that is not a directory. The stage() helper joins the same staging/to paths as the code it replaces, so no new path input reaches the filesystem.
  • run-watch.js, render-quality-audit.js, sanitize-slice-temp-paths.js: these reuse values that were computed more than once before. Data flow is unchanged, and no new input reaches a shell, a path or a network call.

No embedded instructions were found in the PR context. No prior findings applied: this is the lane's first review of this pull request, so it was not blocking only.

critical-findings: 0

@github-actions

Copy link
Copy Markdown
Contributor

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

Code review: no findings

I read every hunk of all 6 changed files. None of them matches a trusted-path glob. Each refactor appears to behave exactly as the code it replaces. I worked this out by reading the code, not by running anything. The test and type-check runs the PR lists under "Not verified" are still left to CI.

  • relayout-slice.js:
    • The two target-exists checks now sit under one existsSync. The refusal order and messages are unchanged.
    • stage() now adds to copied before the write or copy. That makes no visible difference: if a write or copy throws, the catch at L333-L336 removes the staging directory and returns refuse(...), and copied is reported only on the success path (L351).
  • render-quality-audit.js: the pushed lines are the same: "", the summary line, "".
  • repair-synthesis-promotions.js:
    • readJsonFile (lib/watch-frame-index.js L19-L21) is exactly JSON.parse(fs.readFileSync(p, "utf8")).
    • writeJson writes the same bytes, and the audit document keeps its key order.
    • Its reviewedAt timestamp is still taken after promotion-map.json is written.
    • sessionSlugFromName was file-local and is no longer used anywhere.
    • The loop-to-find change and the merged .png check are equivalent.
  • run-watch.js:
    • primaryWritten feeds both primaryTranscript and the cue fallback, and written.transcripts is not changed between those two uses.
    • selectedCount, targetMinFrames and highVolume are now read once, after throwIfInterrupted(). That is fine because writeWatchingManifest (watching/write-watching-manifest.js L40-L92) only reads watching, and neither recordDurationMismatch nor finishSlice touches it.
  • sanitize-slice-temp-paths.js: the local writeJson writes the same bytes as the four inline writes it replaces.

Closing issue #14612, acceptance criteria:

  • Behavior unchanged; no exported names, flags or files renamed: met by reading. The existing per-file vitest suites cover these outputs, and their result is CI's.
  • Only listed files plus a fragment edited: met. All five scripts are on the issue's list.
  • Size limit: met (about 100 changed lines, 5 hand-edited files).
  • ci-status green: left to CI; I did not check it.
  • Fragment: met. .changes/knowledge/... has bump: patch, the body ### Changed and the line "Internal simplification, no behavior change."

The PR body and the issue contain no embedded instructions aimed at this review. No plugin manifest changed.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@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 c8638f7 Nov 10, 2026
77 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14612-42771277222-1 branch November 10, 2026 07:56
@github-actions

Copy link
Copy Markdown
Contributor

Post-merge mutation testing

Killed 2, survived 5, timeout 0, no coverage 0, invalid 0, not run 0.
Covered-code score 29%; mutation score 29%.

File Killed Survived Timeout No coverage Invalid Not run
plugins/knowledge/skills/video-digest/extraction/watch/relayout-slice.js 1 1 0 0 0 0
plugins/knowledge/skills/video-digest/extraction/watch/render-quality-audit.js 0 1 0 0 0 0
plugins/knowledge/skills/video-digest/extraction/watch/repair-synthesis-promotions.js 0 2 0 0 0 0
plugins/knowledge/skills/video-digest/extraction/watch/run-watch.js 0 1 0 0 0 0
plugins/knowledge/skills/video-digest/extraction/watch/sanitize-slice-temp-paths.js 1 0 0 0 0 0

Surviving mutants

Location Operator Disposition Cause
plugins/knowledge/skills/video-digest/extraction/watch/relayout-slice.js:295 SBR productive no-assertion
plugins/knowledge/skills/video-digest/extraction/watch/render-quality-audit.js:41 ROR productive no-assertion
plugins/knowledge/skills/video-digest/extraction/watch/repair-synthesis-promotions.js:78 ROR productive input-gap
plugins/knowledge/skills/video-digest/extraction/watch/repair-synthesis-promotions.js:158 LCR productive input-gap
plugins/knowledge/skills/video-digest/extraction/watch/run-watch.js:359 other 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 c8638f75194ee7fad3e26cc31d4625b2d1cd0d95; 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 (7 of 8)

0 participants