Skip to content

refactor(ai-briefing): simplify generate's validate.js - #14541

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

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

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #14389

Summary

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

Simplified plugins/ai-briefing/skills/generate/output/build/validate.js without changing what it does. The two copies of the deck-loading sequence (block external requests, load, wait for main#deck, optional zoom, settle) are now one openDeck helper used by gate 2 and gate 7. The stale-screenshot purge drops its try/catch for readdir(...).catch(() => []), and the headline, broken-link and PDF missing-URL loops become flatMap/filter/map expressions. plugins/ai-briefing/skills/generate/scripts/run-tests.sh is left as it is: it is already a minimal three-branch case dispatch, and the /simplify checks found nothing to remove. The allUrls collection also stays as it was, because flatMap would accept a non-array string urls that the original forEach rejects with a crash.

Not verified

  • The build, the npm test suite and a validate.js run against a real deck were not run here: this lane's Bash allows only the named wrappers, not node/npm/playwright. Left to the PR's CI.
  • Only on input the schema or library contract rules out, two crash messages are worded differently: a non-array bullets/items value now fails in .map instead of .forEach, and a non-array linkinator result.links value fails in .filter instead of for-of. linkinator always returns an array, and the…
  • Tidy pass 5 (ai-slop:audit fix on the changelog fragment) did not run its detector or digest-guard scripts, because the lane's Bash policy refuses them. A manual rubric read of the fragment's one line, which the issue sets word for word, found no tells. Passes 1 to 4 ran and made no edits; the…
  • ci-status green is left to the PR's CI.
  • Untracked dotfiles in the checkout root (.bashrc, .bash_profile, .gitconfig, .idea, .mcp.json, .profile, .ripgreprc, .vscode, .zprofile, .zshrc) were there before this run and were not created by it; they are not part of this change.

Fix

  • plugins/ai-briefing/skills/generate/output/build/validate.js: added an openDeck(page, { zoom, onExternalRequest }) helper used by the gate 2 page and the gate 7 matrix pages; replaced the stale-screenshot purge's try/catch with readdir(...).catch(() => []); expectedHeadlines is now built with…
  • .changes/ai-briefing/work-resolve-issue-issue-14389-42595362771-1-92e9e685.md: new patch fragment from new-changelog-fragment, body '### Changed' plus 'Internal simplification, no behavior change.'

Verification

The runner ran each check from the base copy against 011c193:

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

The run reports:

  • check-changelog-fragments: All 4 changelog fragment(s) under .changes/ are valid (after the final edit).
  • check-changed-skills: CHECK-SKILL generate PASS, 0 errors, 3 warnings, all in the existing SKILL.md, which this change does not touch (after the final edit).
  • check-affected: 12 passed, 7 skipped over 2 changed files (after the final edit).
  • Fresh-context review subagent over the full diff: found no behavior difference for schema-valid input. It flagged that allUrls built with flatMap behaves differently when urls is a non-array string; I reverted that hunk to the original forEach code.
  • grep over plugins/ai-briefing for validate.js and run-tests.sh: no test asserts on either file's content, so no test lines needed updating.
  • git-read diff --numstat HEAD: validate.js +29/-36; with the 7-line fragment that is 2 files and 72 changed lines, inside the 400-line/15-file limit.
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/42595362771

Left out: the items under Not verified.

Related

#14389

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

Security review: PR #14541, refactor(ai-briefing): simplify generate's validate.js

No security issues found.

Scope: I read every hunk of both changed files in the full diff:

  • .changes/ai-briefing/work-resolve-issue-issue-14389-42595362771-1-92e9e685.md: a new changelog fragment (bump: patch) with one line of text and nothing that runs.
  • plugins/ai-briefing/skills/generate/output/build/validate.js: a refactor of the deck validation build script.

Neither file matches a trusted-path glob. The PR changes no plugin manifest, trust control, merge hold or standing instruction.

What I checked in validate.js:

  • External-request blocking (the one security-relevant behaviour here). Before this PR, both gate 2 and gate 7 set up page.route(/^https?:\/\//, … route.abort("blockedbyclient")) before page.goto(HTML_URL). The new openDeck helper keeps that order: route, then goto, then waitForSelector("main#deck"), then optional zoom, then settleRender. Gate 2 still records blocked URLs in externalRenderRequests through the onExternalRequest callback. Gate 7 passes no callback, so it still just aborts, as before. The regex, the abort reason and the step order are unchanged, so blocking is not weakened.
  • Zoom handling. zoom is passed as an argument to page.evaluate, not built into a script string, so there is no injection path. Gate 2 passes no zoom, so the zoom step is skipped, which matches the old behaviour.
  • Stale-screenshot purge. readdir(...).catch(() => []) replaces the old try/catch. It still only unlinks *.png/*.json entries inside the fixed SHOTS_DIR, so the set of files it can delete is unchanged and no path traversal is introduced.
  • Headline, broken-link and missing-URL rewrites. These turn loops into flatMap/filter/map expressions. They are pure data transforms with no change to trust boundaries.

PR context: It reads as a normal description. I found no embedded text aimed at the review lane.

Prior findings: This lane has not reviewed an earlier head of this PR, so this was a full review, not a blocking-only one.

critical-findings: 0

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

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

Code review: refactor(ai-briefing): simplify generate's validate.js (#14541)

No findings. I read every hunk of both changed files and the head file plugins/ai-briefing/skills/generate/output/build/validate.js in full.

Behavior equivalence (checked by reading the code, not by running it)

  • Stale-screenshot purge (validate.js:41-45): readdir(...).catch(() => []) matches the old try/catch. A missing directory reads as empty. Each unlink still swallows its own errors, and path.join and RegExp.test can't throw, so the old wider try covered nothing extra.
  • openDeck helper (validate.js:71-82):
    • Gate 2: the order is the same as before: route, goto, wait for main#deck, then settle. No zoom is applied because zoom is undefined. External URLs are still pushed to externalRenderRequests before the abort.
    • Gate 7: every responsiveMatrix entry defines zoom, so zoom is applied to every matrix page as before. The optional-chained onExternalRequest is a no-op there.
  • expectedHeadlines (validate.js:143-146): flatMap with spread keeps the same per-slide order as before (bullets first, then flair/patterns items). It produces the same values, undefined titles included.
  • linkResults.broken / pdfResult.missingUrls (validate.js:188-190, 216):
    • The arrays are now assigned instead of pushed to, and nothing else holds a reference to the old arrays.
    • formatUrlDisplay (lib/url-display.js:7-24) catches its own errors, so a filter that fails partway through can't leave a partially filled array that would differ from the old one in audit.json.
    • On a malformed result.links, only the error text changes. The PR body discloses this, and linkinator's contract rules that input out.
  • allUrls is left as it was, which avoids the string-urls difference the PR body describes.

Closing issue #14389 acceptance criteria

  • Behavior unchanged: met, judging by reading the code (above). No test in the PR or the repository asserts on this file's behavior. The issue scopes new tests out, so I'm not counting that as a finding.
  • Only listed files plus fragments edited: met. The diff touches validate.js and one changelog fragment. Leaving run-tests.sh unchanged is allowed.
  • Within 400 lines / 15 files: met. The change is about 72 lines across 2 files.
  • ci-status green: not checked by this lane. The author says it was left to CI, which is unverified here.
  • Fragment: met. .changes/ai-briefing/…-92e9e685.md has bump: patch, a ### Changed heading, and the exact required line.

Other checks

  • Path-scoped rules: two rules match plugins/*/skills/**: .claude/rules/skill-bodies-state-current-rules.md and .claude/rules/cost-claims.md. Both govern skill and agent prose (restated upstream specifics, cost figures), and the JS change hits neither.
  • Plugin manifests: none changed.
  • Paved paths: not assessed.
  • Embedded text: no directives found in the PR context.
  • Verification claims: the author's verification results (changelog/skill checks, check-affected, the subagent review) are author-claimed and unverified. I ran nothing.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for 011c193

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-14541-011c193e81a32e8af09fedb08f34c09fa36c7bcc, 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 f32cfa3 Nov 9, 2026
63 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14389-42595362771-1 branch November 9, 2026 11:08
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The post-merge check verified merge commit f32cfa30dc5787587bbbd42b3d66b77dcafcaf22; 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 (3 of 3)

0 participants