Skip to content

Make the bloom-automation scripts safe to ask for help (BL-16799) - #8290

Merged
hatton merged 2 commits into
masterfrom
BL-16799-automation-scripts
Sep 3, 2026
Merged

Make the bloom-automation scripts safe to ask for help (BL-16799)#8290
hatton merged 2 commits into
masterfrom
BL-16799-automation-scripts

Conversation

@hatton

@hatton hatton commented Sep 3, 2026

Copy link
Copy Markdown
Member

node killBloomProcess.mjs --help killed the running Bloom. Unknown flags were
ignored, so the destructive default ran, which made "read the usage first" the
dangerous move. The sibling scripts shared the shape.

Every script in .github/skills/bloom-automation now recognizes --help and -h,
prints its usage, and exits without killing anything. An unknown option is
rejected with the usage rather than ignored, and a --pid or --watch-pid that is
not a positive integer is rejected instead of being passed to the kill code,
where a NaN would have meant "every Bloom this worktree owns".

Retires the AUTOMATION-DEBT.md entry "Automation helper scripts run destructive
defaults on unknown flags". Folding these helpers into the launch fixture, the
other half of that entry's fix direction, is not part of this.

This is one of eleven stacked pull requests (BL-16799)

Each one pays down one entry of src/BloomE2E/AUTOMATION-DEBT.md, and each branches off the one before it. Base: master. Review only this pull request's own commit; the ones below it are reviewed in their own pull requests. The first six change test and tooling code only; the last five also change product code.

  1. BL-16799-automation-scripts — Make the bloom-automation scripts safe to ask for help
  2. BL-16799-vr-collect-failures — Report every failed image comparison in a visual-regression case, not the first
  3. BL-16799-component-tests-in-ci — Run the component-tester Playwright suites nightly
  4. BL-16799-vite-port — Let an e2e run test the working tree's front end
  5. BL-16799-type-in-one-call — Type into a text box in one call, not one key press per character
  6. BL-16799-page-screenshot — Capture a whole book page from a test
  7. BL-16799-toolbox-registration — Register the toolbox tools from one list both callers share
  8. BL-16799-shell-document — Stop a test attaching to a shell document Bloom does not drive
  9. BL-16799-tab-test-ids — Click a workspace tab by a test id, not by its localized label
  10. BL-16799-page-change — Refuse a page change the Edit tab cannot do, and wait before asking
  11. BL-16799-collection-languages — Set a collection's languages through an e2e hook, not by writing XML

Replaces #8276, which did all of this in one pull request.

Verification of the whole stack, at its tip: the C# suite passes (3338 passed, 13 skipped), the front-end vitest suite passes (781 passed, 5 skipped), and the src/BloomE2E suite passes against a Vite dev server on the working tree (36 passed, 0 skipped, 8.2 minutes). Each pull request also has its own type check and lint.

🤖 Generated with Claude Code

Devin review


This change is Reviewable

Comment thread .github/skills/bloom-automation/killBloomProcess.mjs
Comment thread src/BloomE2E/AUTOMATION-DEBT.md
`node killBloomProcess.mjs --help` killed the running Bloom. Unknown flags were
ignored, so the destructive default ran, which made "read the usage first" the
dangerous move. The sibling scripts shared the shape.

Every script in .github/skills/bloom-automation now recognizes --help and -h,
prints its usage, and exits without killing anything. An unknown option is
rejected with the usage rather than ignored, and a --pid or --watch-pid that is
not a positive integer is rejected instead of being passed to the kill code,
where a NaN would have meant "every Bloom this worktree owns".

A help request is answered wherever it sits on the command line, which took two
more changes. `requireOptionValue` rejects any value starting with "-", because
`killBloomProcess.mjs --repo-root -h` otherwise stored "-h" as the repository
path, named no target, and reached that destructive default; every value these
scripts take is a path, a TCP port or a process id, so nothing legitimate is
lost. And `asksForHelp(args)` runs before each parse loop can consume the
request as some option's value. `switchWorkspaceTab.mjs`,
`dismissProblemDialog.mjs`, `webview2Targets.mjs` and `driveAiImageEditor.mjs`
needed the help and the unknown-option check as well: two had no help at all,
and two took `--help` only. So the claim above holds for all eight scripts.

Retires the AUTOMATION-DEBT.md entry "Automation helper scripts run destructive
defaults on unknown flags". Folding these helpers into the launch fixture, the
other half of that entry's fix direction, is not part of this.

Verified by running each script with `--nonsense`, with `-h`, and with `-h` in
the second position, and by checking that a real option still parses.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@hatton
hatton force-pushed the BL-16799-automation-scripts branch from 5f725ba to 7cf9a58 Compare September 3, 2026 19:40
Master reworked the head of src/BloomE2E/AUTOMATION-DEBT.md while this branch
was open: the table of the BL-16799 stack now gives each pull request number,
it lists two branches that are not open yet, and the visual-regression
baseline entry is gone. This branch, meanwhile, deletes its own row from that
table and deletes the entry it pays off. The merge takes master's text and
applies both of those deletions to it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BaWw4EHWrbFF2fNJvMJVC8
@hatton
hatton merged commit bf2b0c5 into master Sep 3, 2026
1 check passed
// answer it before anything reaches that Bloom.
if (args.some((arg) => arg === "--help" || arg === "-h")) {
console.log(usage);
process.exit(0);

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Devin] Bug: Help requires installed Playwright

Without Playwright installed, --help fails during module loading before the new help check runs. No usage text is printed.

(.github/skills/bloom-automation/driveAiImageEditor.mjs:58)

continue;
if (valueFlags.has(args[i])) {
i++; // skip its value
continue;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Devin] Bug: Malformed options still commit edits

dummy-edit --shot --typo skips --typo as a value, while dummy-edit -x treats -x as positional. Both runs still commit the edit.

(.github/skills/bloom-automation/driveAiImageEditor.mjs:72)

const normalized = value === undefined ? "" : String(value).trim();
const processId = /^\d+$/.test(normalized)
? toPositiveInteger(normalized)
: undefined;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Devin] Investigate: Process IDs allow numeric rounding

Values above Number.MAX_SAFE_INTEGER pass validation but round before reaching taskkill. Bound process IDs to the platform range or safe integers.

(.github/skills/bloom-automation/bloomProcessCommon.mjs:57)

@hatton

hatton commented Sep 3, 2026

Copy link
Copy Markdown
Member Author

[Devin] Investigate: PR targets the disallowed branch

The PR targets master, while current repository guidance requires Version6.5. Resolve the target mismatch before merging.

(AGENTS.md:null)

@hatton

hatton commented Sep 3, 2026

Copy link
Copy Markdown
Member Author

[Claude Opus 5 from Hatton's machine during devin-review]

Consulted Devin on 2026-09-03 22:45 UTC up to commit 0cc32c0eaac8ed588eab973a2eb2475b2875f9a1.

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.

1 participant