Skip to content

refactor(ai-briefing): simplify the generate build scripts and source bookmarks - #14534

Merged
melodic-automation-lanes[bot] merged 1 commit into
mainfrom
work-resolve-issue/issue-14387-42595339403-1
Nov 9, 2026
Merged

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

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #14387

Summary

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

Removed repeated code in five of the nine listed files without changing what they output. build-pptx.js gets addLogo and addHeading helpers in place of four copied logo blocks and five copied slide headings. build-sections.js gets one labelFor lookup in place of four inline SECTION_LABELS\[k\] || k lookups, and its sub-chip list is built in one chain. source-bookmarks.sh shares one write_failed exit. assemble-html.js builds the logo data URI in one expression. build-pdf.js opens its page with browser.newPage({viewport}), which Playwright documents as a page in a new context that takes newContext's options. Four files were left as they are: build-css.js and build-client-js.js are template text copied byte for byte into the generated HTML, so any edit would change the output; brand.js is only data; build-html.js is a two-line entry point. The PR has 6 files and about 140 changed lines.

Not verified

  • Node test suite (output/build/test/build-sinks.test.js, which runs build-pptx.js end to end) and lib/source-bookmarks.test.sh were not run: this lane cannot start an interpreter, so the PR's CI runs them
  • No local build or byte-for-byte comparison of the generated HTML/PPTX/PDF before and after: no interpreter in this lane. Output equivalence rests on reading the code and the fresh-context review
  • shellcheck and a JS linter were not run on the touched files: the lane runs only its named wrappers, so they are left to CI
  • tidy: the ai-slop:audit pass ran without its deterministic detector (detect.sh is not a lane-allowed command); a manual rubric read of the one-line fragment found nothing
  • ci-status green is a PR CI check, left to the PR's CI

Fix

  • plugins/ai-briefing/skills/generate/lib/source-bookmarks.sh: added a write_failed helper that the two bookmark-write failure branches now call; the stderr text and exit 1 are unchanged
  • plugins/ai-briefing/skills/generate/output/build/assemble-html.js: loadEmbeddedAssets builds logoWhiteData in one conditional expression instead of a let plus an if
  • plugins/ai-briefing/skills/generate/output/build/build-pdf.js: replaced browser.newContext({viewport}) + context.newPage() with browser.newPage({viewport})
  • plugins/ai-briefing/skills/generate/output/build/build-pptx.js: added addLogo(slide, x, y, w, h) and addHeading(slide, text, fontSize = 44), which now handle the 4 logo images and 5 slide headings; inlined buildCondensed's one-use eyebrow variable
  • plugins/ai-briefing/skills/generate/output/build/build-sections.js: added a module-private labelFor helper, inlined the one-use newsSubKeys array into the subChips chain, and changed .map((n) => escape(n)) to .map(escape)
  • .changes/ai-briefing/work-resolve-issue-issue-14387-42595339403-1-89631c9f.md: new patch fragment whose body is ### Changed and "Internal simplification, no behavior change."

Verification

The runner ran each check from the base copy against d9f0609:

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

The run reports:

  • check-changelog-fragments: all 4 fragments valid (ran before and after tidy)
  • check-changed-skills: CHECK-SKILL generate PASS, 0 errors, 3 warnings, all of them about existing SKILL.md content this change does not touch
  • check-affected: 13 passed, 6 skipped over 6 changed files (ran before and after tidy)
  • read https: //playwright.dev/docs/api/class-browser#browser-new-page: browser.newPage 'Creates a new page in a new browser context. Closing this page will close the context as well.' It takes the same options as browser.newContext, viewport included
  • fresh-context review subagent over the whole diff: no behavior change found; it confirmed function-declaration hoisting for addLogo/addHeading, that escape takes one argument so .map(escape) is safe, that $source_id is set and validated before write_failed runs, and that newPage is equivalent here
  • code-tidying:tidy-diff over the 22 changed hunks: no edits (no comments or generated-code residue in the listed lines; the fragment line is mandated verbatim)
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/42595339403

Left out: the items under Not verified.

Related

#14387

Merge-Risk: max=MEDIUM demote=false head=d9f0609dc5472bc09e3a369ad9fadc6c5419a40d rubric=8.1.4 rater=claude-opus-5-5 checker=claude-opus-5-5

Lane-Activity: work-resolve-issue/resolve-issue
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Unattended merge: native auto-merge leaves this pull request unarmed at head d9f0609dc5472bc09e3a369ad9fadc6c5419a40d. The lanes clear this reason on their own; the next scheduled run judges it again.

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

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

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

Security review: no findings

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

The change is a pure refactor of the ai-briefing generate build scripts. I checked each part:

  • HTML output escaping is unchanged (build-sections.js). .map(escape) is safe because escape takes one parameter (build-sections.js:6, export const escape = (s) =>), so the index and array that map also passes are ignored. The rebuilt sub-chip list still escapes g.key in both href and data-key, and escapes the label from labelFor. Nothing that was escaped before is now unescaped.
  • The bookmark write guard is unchanged (source-bookmarks.sh). The symlink refusal, the write through a fresh mktemp file, and the rm -f "$tmp" cleanup all stay as they were. The new write_failed helper only gathers the same stderr message and exit 1. $source_id is read from the existing global, and the message prints it inside a double-quoted string, so nothing new reaches a shell.
  • The PDF network block still covers the page (build-pdf.js). The page now comes from browser.newPage({viewport}) rather than newContext + newPage. The external-request block (page.route(/^https?:\/\//, …)) is still registered on that page.
  • No new file reads (assemble-html.js, build-pptx.js). The logo data URI is built from the same path.resolve(buildDir, meta.logoWhite) read as before. The addLogo and addHeading helpers only pass values on to pptxgenjs.
  • The changelog fragment is text only.

The PR context contains no instructions directed at this lane. This was a full review, not blocking only (prior findings: 0 earlier heads).

critical-findings: 0

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

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

Code review: PR #14534 (ai-briefing generate simplification)

I read every hunk of all 6 changed files and found nothing to flag. Each change keeps the old behavior, as closing issue #14387 requires.

What I checked against the head files:

  • lib/source-bookmarks.sh: write_failed is defined before the argument parsing. It expands $source_id only when it runs, and by then the --source check at line 48 has set and validated the value. The stderr text and exit code 1 are the same as before, and the rm -f "$tmp" on the second branch still runs before the exit.
  • assemble-html.js: the one-expression logoWhiteData gives the same data URI, or "" when meta.logoWhite is falsy.
  • build-pdf.js: nothing else in the file used the removed context variable. browser.newPage({viewport}) creates its own context, and browser.close() at line 43 still closes everything.
  • build-pptx.js: addLogo and addHeading are function declarations that read the module-level logoWhiteData (line 15), FONT_HEAD and theme. They are only called after those values are set, so there is no temporal-dead-zone risk. All 4 logo calls keep their coordinates, and their sizing still equals w/h. All 5 heading calls keep x:0.5, y:0.7, w:12, h:1, bold, theme.text. The agenda heading keeps its 48pt size; the rest use the 44pt default.
  • build-sections.js: escape takes one parameter (line 6), so the index and array that .map(escape) passes are ignored. labelFor is declared after SECTION_LABELS. The inlined sub-chip chain gives the same keys, in the same order, with the same markup.
  • Changelog fragment: bump: patch, with the body ### Changed and "Internal simplification, no behavior change.", as the issue asks.

Closing issue #14387 acceptance criteria:

  • Behavior unchanged: met, from reading the code. The author's byte-for-byte output comparison and test runs are author-claimed and unverified; I ran nothing. output/build/test/build-sinks.test.js (runs build-pptx.js end to end) and lib/source-bookmarks.test.sh cover these files.
  • Only listed files plus fragments edited: met.
  • Within 400 lines and 15 files: met (6 files, about 140 lines).
  • ci-status green: left to CI.
  • Fragment from new-changelog-fragment.sh with the required body: the content is met.

No plugin manifest changed, so there are no manifest lines. The path-scoped rules that match plugins/*/skills/** (skill-bodies-state-current-rules.md, cost-claims.md) cover skill prose and cost claims; this change touches neither. No changed file matches a trusted-path glob. I found no embedded instructions in the PR context. There were no prior findings, and this was a full review, not blocking-only.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for d9f0609

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-14534-d9f0609dc5472bc09e3a369ad9fadc6c5419a40d, 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 8e92b4a Nov 9, 2026
63 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14387-42595339403-1 branch November 9, 2026 10:59
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Post-merge mutation testing

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

File Killed Survived Timeout No coverage Invalid Not run
plugins/ai-briefing/skills/generate/lib/source-bookmarks.sh 1 0 0 0 0 0
plugins/ai-briefing/skills/generate/output/build/assemble-html.js 0 1 0 0 0 0
plugins/ai-briefing/skills/generate/output/build/build-pptx.js 0 0 0 0 0 2
plugins/ai-briefing/skills/generate/output/build/build-sections.js 0 0 0 0 0 3

Surviving mutants

Location Operator Disposition Cause
plugins/ai-briefing/skills/generate/output/build/assemble-html.js:17 UOI 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 8e92b4ad31a36f86c71825b2c347c842d768fc65; 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 generate ai-briefing plugin code (1 of 3)

0 participants