Skip to content

Write video-digest watch JSON through one helper beside readJsonFile #15626

Description

@kyle-sexton

Agent Brief

Type: Task
Summary: Move the pretty-printed JSON file write that five video-digest watch scripts repeat into one writeJsonFile, exported beside readJsonFile from plugins/knowledge/skills/video-digest/extraction/lib/watch-frame-index.js (part of restructuring pass #14622).

Current behavior:
Five scripts under plugins/knowledge/skills/video-digest/extraction/watch/ write JSON as fs.writeFileSync(<file>, ${JSON.stringify(, null, 2)}\n, "utf8"):

  • repair-synthesis-promotions.js:30-36 and sanitize-slice-temp-paths.js:30-36 each define an identical local writeJson(file, value), called at repair-synthesis-promotions.js:185,186,263 and sanitize-slice-temp-paths.js:50,72,95,104.
  • export-sheet-frame-index.js:57, merge-triage-json.js:74 and vision-gated-promote.js:164 write the same expression inline.

All five import readJsonFile from ../lib/watch-frame-index.js (repair-synthesis-promotions.js:24, sanitize-slice-temp-paths.js:16, export-sheet-frame-index.js:16, merge-triage-json.js:15, vision-gated-promote.js:21), which defines it at lib/watch-frame-index.js:13-21.

Desired behavior:

  • lib/watch-frame-index.js exports writeJsonFile(filePath, value), with JSDoc types, next to readJsonFile, writing the same bytes; its header "Shared slice-artifact JSON reads" (:2) says "reads and writes".
  • The two local writeJson helpers go, and their 7 calls call writeJsonFile; the 3 inline writes call it too. Each script adds writeJsonFile to its existing watch-frame-index.js import.
  • Each fs import stays, since every script uses fs for other calls (repair-synthesis-promotions.js:53, sanitize-slice-temp-paths.js:46, export-sheet-frame-index.js:30, merge-triage-json.js:30, vision-gated-promote.js:47), and the fs.mkdirSync calls before the inline writes stay (export-sheet-frame-index.js:56, merge-triage-json.js:72).
  • No test file is added. No repository check pairs a file under extraction/ with a test: scripts/affected-tests-no-suite.txt:122-128 records the whole tree as covered by the test-node lane, which runs plugins/knowledge/skills/video-digest/scripts/run-tests.sh install, build (typecheck) and test when a file under the package changes (scripts/node-subprojects.txt:10, scripts/plan-test-lanes.sh:54-55); extraction/vitest.config.ts:5 sets no coverage gate; lib/watch-frame-index.js has no suite today (git ls-files); and no scripts/check-*.sh names video-digest (git grep).

Dependencies: this item shares no file with the change that adds extraction/lib/run-main.js for the seven CLI tails (run-harvest.js, run-transcript.js, caption-recheck.js, recover-watch-bootstrap.js, run-resume.js, run-watch.js, run-watching-pipeline.js); each adds its own fragment. If both come to touch one file, rebase on whichever lands first.

Files:

  • plugins/knowledge/skills/video-digest/extraction/lib/watch-frame-index.js
  • plugins/knowledge/skills/video-digest/extraction/watch/repair-synthesis-promotions.js
  • plugins/knowledge/skills/video-digest/extraction/watch/sanitize-slice-temp-paths.js
  • plugins/knowledge/skills/video-digest/extraction/watch/export-sheet-frame-index.js
  • plugins/knowledge/skills/video-digest/extraction/watch/merge-triage-json.js
  • plugins/knowledge/skills/video-digest/extraction/watch/vision-gated-promote.js
  • a new patch fragment in .changes/knowledge/: ### Changed, "Internal restructuring, no behavior change."

Key interfaces:

  • Each script's exported functions, written files, stdout, stderr and exit codes: unchanged.
  • Three writes stay as they are: watch/queue-claim.js:103-104 writes to an openSync(..., "wx") descriptor, watching/write-watching-manifest.js:36-38 is async, and plugins/knowledge/skills/course-digest/extraction/extract-course.js:53-55 writes no trailing newline.
  • No test names writeJson, which is file-local today, and no eval or fixture names the helpers.

Acceptance criteria:

  • The pretty-printed JSON file write exists once, in writeJsonFile in lib/watch-frame-index.js, and the five scripts call it.
  • Behavior is unchanged: the same outputs, exit codes and printed results for the same inputs.
  • The diff edits only the listed files and the lines of a test that assert on them when the change breaks that assertion.
  • The pull request stays within 400 changed lines and 15 hand-edited files.
  • plugins/knowledge/skills/video-digest/scripts/run-tests.sh all passes, including repair-synthesis-promotions.test.js, sanitize-slice-temp-paths.test.js, export-sheet-frame-index.test.js and vision-gated-cli.test.js, which imports merge-triage-json.js and vision-gated-promote.js (:10,16).
  • ci-status is green.

Out of scope:

  • queue-claim.js, write-watching-manifest.js, course-digest, a new test file, other duplication, eval cases, fixtures, and skill and agent text.

Activity

  1. added theissue type on Nov 12, 2026
  2. added
    status: ready
    on Nov 12, 2026
  3. removed
    status: ready
    on Nov 12, 2026
  4. melodic-automation-lanes commented on Nov 12, 2026

    @melodic-automation-lanes
    Contributor

    {"v":1,"actor_id":337595936,"title_sha256":"ce6bba83fba19048271eecfeb92a9290cec7044e57e807c284d1cc6a849de55f","body_sha256":"90107f4ad8e755a7800c6c4abd83030814c570a7efa74b242a9f6ed9f9cddcd0"}

  5. github-actions commented on Nov 12, 2026

    @github-actions
    Contributor
    No description provided.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Fields

    Work status

    needs-triage

    Priority

    low

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions