Skip to content

fix(bootstrap): drop the redundant bun build target (unbreaks BunExportConditions) - #733

Merged
sroussey merged 3 commits into
claude/libs-issues-triage-prs-mh6x2o-574from
claude/optimistic-goldberg-9x9lby-bootstrap-bun-target
Aug 9, 2026
Merged

fix(bootstrap): drop the redundant bun build target (unbreaks BunExportConditions)#733
sroussey merged 3 commits into
claude/libs-issues-triage-prs-mh6x2o-574from
claude/optimistic-goldberg-9x9lby-bootstrap-bun-target

Conversation

@sroussey

@sroussey sroussey commented Aug 9, 2026

Copy link
Copy Markdown
Collaborator

Follow-up to #672, targeting its head branch.

What was broken

1. @workglow/bootstrap declared a third bun build target — deterministic red CI.

packages/bootstrap/src/bun.ts was byte-identical to src/node.ts (export * from "./common";), so the "bun" export condition bought a second bundle and a second .d.ts to keep in sync for zero behavior change — exactly what the repo's "No bun entry unless it differs" rule exists to prevent.

That rule is enforced by a fixture, and the fixture is red on the branch as it stands:

FAIL src/test/util/BunExportConditions.test.ts > bun export conditions
     > exist only where the Bun implementation genuinely differs

+   "@workglow/bootstrap .",
    "@workglow/sqlite ./storage",
    "@workglow/util .",
    "@workglow/util ./worker",

This is not flaky and not environment-dependent — it reads package.json files off disk, so it fails on every run, for everyone, the moment this branch merges. EXPECTED_BUN_CONDITIONS, .claude/CLAUDE.md, and docs/technical/19-build-system.md all already state the correct three-entry set; the package manifest was the thing that was wrong, so the fixture and the prose are untouched.

2. "test": "bun test" in a package with no test files.

bun --cwd packages/bootstrap test exits 1 with error: 0 test files matching. It is the only bun test script in the repo: the 8 workspaces that declare test all use vitest run --config ../../vitest.config.ts --project <name>, and the 31 that have no tests omit the key entirely.

3. BootstrapReadme.test.ts claimed to pin documents it never read.

Its header said "Both halves are pinned below", but the file only reproduced the shapes in TypeScript. Nothing read packages/bootstrap/README.md or the createOrchestrationContext JSDoc, so either could rot back to await task.run({ context: ctx }) — the bug the test was written for — with the suite still green.

What changed

  • packages/bootstrap/package.json — dropped watch-bun / build-bun, removed bun from the watch-js / build-package / build-js fan-outs, and deleted the "bun" branch from exports["."]. The scripts block and the exports map now match packages/knowledge-base (the two-target reference sibling) exactly. Also removed the test script.
  • packages/bootstrap/src/bun.ts — deleted. Bun now resolves the default "import" condition to dist/node.js, which is the same code it was already running.
  • packages/bootstrap/tsconfig.json — dropped ./src/bun.ts from files.
  • packages/test/src/test/util/BootstrapReadme.test.ts — kept both runtime cases, added a second describe that reads the README and the JSDoc: the README shows the registry in the run config, no README fence passes the context as an input override, and the JSDoc example matches. Fenced blocks are selected by content (createOrchestrationContext() rather than by the heading above them, so renaming ### Isolated context cannot make the cases pass vacuously.

No CHANGELOG entry: 0.3.38 is this package's unreleased initial release in the same PR, so the removed bun target never shipped.

How it was verified

Run in an isolated worktree off this PR's head, with bun install + bun run use-source.

  • bun scripts/test.ts util vitest55 files / 765 passed, 10 skipped. Covers BunExportConditions, BootstrapReadme, and BootstrapPackageExports.
  • The fixture failure was reproduced first. Restoring only the base branch's packages/bootstrap/package.json and re-running BunExportConditions.test.ts fails with the diff quoted above; restoring the fix makes it pass. collectBunConditions() now returns exactly the three expected entries.
  • The new document cases were proven to bite. Temporarily reverting the README snippet to await task.run({ context: ctx }) fails cases 1 and 2; doing the same to the createOrchestrationContext JSDoc fails case 3. Both were restored.
  • bun run build-clean && bun run build-package in packages/bootstrap — browser, node and types all exit 0; dist/ contains browser.*, node.*, common.d.ts and no bun.*.
  • bunx turbo run test --filter=@workglow/bootstrap — exits 0; the dry plan shows @workglow/bootstrap#test resolving to <NONEXISTENT> (no task), confirming the removed script breaks nothing.
  • bun scripts/test.ts --check-sections — "Every test file is discovered and reachable by section+kind selection."
  • eslint and prettier --check clean on the changed files. (The first draft of REGISTRY_IN_RUN_CONFIG tripped regexp/no-super-linear-backtracking on an ambiguous \s*,?\s*; it is now [\s,]*.)

Known trade-off

The "no README code block passes the context as an input override" case scans every fence, so an author adding a deliberate counter-example snippet would trip it. That is intentional and noted in the file's header comment — the README's existing counter-example is prose, which stays legal.

Not verified here

bun run test:vitest:unit (the full CI job) was launched but had not finished at the time this description was written; the util section it contains — the one holding every changed and affected fixture — passed in full. Nothing outside packages/bootstrap and that one test file is touched.


Generated by Claude Code

claude added 3 commits August 9, 2026 08:56
The bootstrap package shipped a third `bun` entry whose source was
byte-identical to `src/node.ts`, so Bun loaded the same code through a
separate bundle and a separate declaration file. Removing it makes Bun
resolve the default `import` condition to `dist/node.js` and restores the
two-target build every other non-vendor package uses.

This also unbreaks the BunExportConditions fixture, which pins the set of
packages whose Bun implementation genuinely differs.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013oVdDSRMJeALBPLDQf3DgH
The package holds no test files, so `bun test` exits non-zero with
"0 test files matching". Every workspace that does declare `test` uses the
shared vitest project form, and a package with no tests omits the key
entirely — turbo then produces no task for it, and the dependent
`@workglow/test` project still covers the package on a changed-files run.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013oVdDSRMJeALBPLDQf3DgH
…havior

The file claimed both halves of the isolated-context example were pinned,
but it only reproduced the shapes in TypeScript — nothing read the README or
the `createOrchestrationContext` JSDoc, so either could rot back to
`task.run({ context: ctx })` with the suite still green.

Adds three cases that read the two documents: the README shows the registry
in the run config, no README fence passes the context as an input override,
and the JSDoc example matches. Blocks are selected by content rather than by
the heading above them, so a heading rename cannot make them pass vacuously.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013oVdDSRMJeALBPLDQf3DgH
@sroussey
sroussey merged commit afe6a4e into claude/libs-issues-triage-prs-mh6x2o-574 Aug 9, 2026
10 of 11 checks passed
@sroussey
sroussey deleted the claude/optimistic-goldberg-9x9lby-bootstrap-bun-target branch August 9, 2026 19:04
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.

2 participants