Skip to content

refactor(cli): one selector for bun cells, one output mode for the matrix - #247

Merged
intech merged 1 commit into
mainfrom
refactor/scaffold-check-selector
Aug 5, 2026
Merged

refactor(cli): one selector for bun cells, one output mode for the matrix#247
intech merged 1 commit into
mainfrom
refactor/scaffold-check-selector

Conversation

@intech

@intech intech commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Summary

Quality pass over #246, which merged while this was being prepared. Four independent reviews (reuse / simplification / efficiency / altitude) converged on the same defect: the by-name selection of bun cells survived in the script that owns the combination table. The diff removes more than it adds — 30 insertions, 64 deletions.

Type of change

  • Bug fix (non-breaking)
  • New feature (non-breaking)
  • Breaking change (documented in migration guide)
  • Documentation / chore / internal

Test plan

  • pnpm build && pnpm typecheck && pnpm test pass locally
  • pnpm lint passes locally
  • Relevant examples in examples/ exercised (if applicable) — N/A, no example touched; instead both bun cells were run locally via node scripts/scaffold-check.mjs --combo bun,bun-pm (bun 19.6s ok, bun-pm 7.8s ok), which is the path this PR changes.
  • Negative-tested the replacement assertion: deleting "bun" from PACKAGE_MANAGERS makes the new test fail (137 tests, 1 failure); restoring it passes. The test it replaces stayed green through that deletion.
  • node scripts/scaffold-check.mjs --list output inspected — descriptors {name, needsBun} for all 10 combinations.
  • Workflow YAML parsed; job names verified byte-identical (init bun-pm, …) so required checks in branch protection are unaffected.

Parity coverage

  • Parity coverage added
  • Parity N/A — this PR touches only build/CI tooling (scripts/scaffold-check.mjs, the scaffold-matrix workflow), one code comment, and unit tests. No server, transport, interceptor or protocol code is changed, so no observable RPC behaviour differs on either transport.

Related issues / changes


Detail

The by-name selection survived in the file that owns the table

#246 removed matrix.combo == 'bun' from the workflow but left COMBOS.filter(c => c.name === "bun") in the script. So scaffold-check --runtime bun ran one of the two bun cells while CI ran both; bun-pm was reachable locally only by naming it explicitly.

That breaks the guarantee the file's own header makes — that a green local run means a green CI run by construction. Both consumers now select on needsBun through a single derived BUN_COMBOS, and the singular wording in the help and error text is corrected.

--list emits descriptors instead of names

This removes more code than it adds: the --list-needs-bun mode, its flag, its help line, the second job output, the second echo, and the contains(fromJSON(...)) expression all disappear. The condition becomes a plain if: matrix.combo.needsBun.

It also closes a latent trap: had the fromJSON ever been dropped in an edit, contains would have degraded to a substring match, where bun also matches bun-pm.

Measured, so nobody re-optimises it later: the two Node spawns this replaces cost 0.089s combined — 0.4% of the discover job. This is a simplification, not a speed-up.

The new test guarded the wrong invariant

The README test passed a literal to transformBase, which never calls resolveConfig — so it pinned the type union while --package-manager bun actually depends on the runtime array.

Also

  • Added the concurrency group every other workflow in this repo has — this one let superseded runs finish, ~370 job-seconds each.
  • Trimmed the buf-packaging archaeology from the pnpm-workspace.yaml comment (11 lines → 6). That detail goes stale exactly like the wrong comment feat(cli): accept --package-manager bun #246 replaced.
  • Dropped the separate changeset: connectum init is unreleased and its own changeset already enumerates bun.

Deliberately not done

Deriving PackageManager from a const tuple. It closes a real gap — a union member forgotten in the validation array is accepted silently — but the same gap exists in all five option lists, and the current shape is the established pattern. Changing one of five trades a small hole for an inconsistency. Worth its own change.

Two further recommendations were declined with reasons: folding bun-pm into the neighbouring cell (would reintroduce by-name selection to save 21 job-seconds) and turning if (packageManager === "pnpm") into a capability table (the altitude review itself concluded the current depth is right).

…trix

Quality pass over the previous two commits. Four independent reviews converged on
the same defect, which is the substantive fix here.

**The by-name selection survived in the file that owns the table.** The earlier
commit removed `matrix.combo == 'bun'` from the workflow but left
`COMBOS.filter(c => c.name === "bun")` in the script, so `scaffold-check
--runtime bun` ran one of the two bun cells while CI ran both -- `bun-pm` was
reachable locally only by naming it explicitly. That breaks the guarantee the
file's own header makes, that a green local run means a green CI run by
construction. Both consumers now select on `needsBun` through a single derived
`BUN_COMBOS`, and the singular wording in the help and error text is fixed.

**`--list` emits descriptors instead of names**, which removes more code than it
adds: the `--list-needs-bun` mode, its flag, its help line, the second job output,
the second echo, and the `contains(fromJSON(...))` expression all go away, and the
condition becomes a plain `if: matrix.combo.needsBun`. It also removes a latent
trap -- had the `fromJSON` ever been dropped, `contains` would have degraded to a
substring match where `bun` also matches `bun-pm`. Job names are unchanged, so
branch protection is unaffected.

**The new README test guarded the wrong invariant.** It passed a literal to
`transformBase`, which never calls `resolveConfig`, so it pinned the *type union*
while `--package-manager bun` actually depends on the *runtime array*. Removing
"bun" from `PACKAGE_MANAGERS` would have left it green. Replaced with an assertion
next to the existing enum-rejection test, and verified by deleting the value: the
new assertion fails, the old test would not have.

Also: added the `concurrency` group every other workflow in the repo has (this one
let superseded runs finish, ~370 job-seconds each); trimmed the buf-packaging
archaeology out of the `pnpm-workspace.yaml` comment, since that detail goes stale
exactly like the wrong comment it replaced; and dropped the separate changeset --
`connectum init` is unreleased and its own changeset already enumerates bun, so a
second entry would read as if bun were added to a shipped feature.

Deliberately not done: deriving `PackageManager` from a const tuple. It closes a
real gap, but the same gap exists in all five option lists and the current shape is
the established pattern -- changing one of five would trade a small hole for an
inconsistency. Worth its own change.
@github-actions github-actions Bot added type:chore Maintenance: refactoring, dependencies, CI/CD pkg:cli @connectum/cli (Layer 3) labels Aug 5, 2026
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The scaffold checker now reports Bun requirements with each combination. The GitHub Actions matrix consumes this metadata for conditional setup and validation. Scaffold tests accept Bun, and pnpm build approval documentation is updated.

Changes

Scaffold matrix Bun selection

Layer / File(s) Summary
Combination descriptors and Bun selection
scripts/scaffold-check.mjs
--list now emits name and needsBun descriptors. Bun runtime selection includes all Bun-required combinations.
Workflow matrix integration
.github/workflows/cli-scaffold-matrix.yml
The workflow uses descriptor fields for job names, Bun setup, and scaffold validation. Superseded runs are cancelled.
Package-manager validation and pnpm notes
packages/cli/src/scaffold/transform.ts, packages/cli/tests/unit/scaffold-transform.test.ts
Tests accept Bun as a package manager. Bun README command assertions are removed. pnpm approval notes are updated.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Discovery as scaffold-check.mjs
  participant Matrix as GitHub Actions matrix
  participant Bun as Bun setup
  participant Checker as scaffold checker

  Discovery->>Matrix: Emit combination name and needsBun
  Matrix->>Bun: Set up Bun when needsBun is true
  Matrix->>Checker: Pass matrix.combo.name for validation
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the main refactor: shared Bun-cell selection and a single matrix output mode.
Description check ✅ Passed The description completes all template sections and provides detailed scope, verification steps, parity justification, and related changes.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/scaffold-check-selector

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@pkg-pr-new

pkg-pr-new Bot commented Aug 5, 2026

Copy link
Copy Markdown

Open in StackBlitz

@connectum/auth

npm i https://pkg.pr.new/@connectum/auth@247

@connectum/cli

npm i https://pkg.pr.new/@connectum/cli@247

@connectum/core

npm i https://pkg.pr.new/@connectum/core@247

@connectum/events

npm i https://pkg.pr.new/@connectum/events@247

@connectum/events-amqp

npm i https://pkg.pr.new/@connectum/events-amqp@247

@connectum/events-kafka

npm i https://pkg.pr.new/@connectum/events-kafka@247

@connectum/events-nats

npm i https://pkg.pr.new/@connectum/events-nats@247

@connectum/events-redis

npm i https://pkg.pr.new/@connectum/events-redis@247

@connectum/healthcheck

npm i https://pkg.pr.new/@connectum/healthcheck@247

@connectum/interceptors

npm i https://pkg.pr.new/@connectum/interceptors@247

@connectum/otel

npm i https://pkg.pr.new/@connectum/otel@247

@connectum/protoc-gen-catalog

npm i https://pkg.pr.new/@connectum/protoc-gen-catalog@247

@connectum/reflection

npm i https://pkg.pr.new/@connectum/reflection@247

@connectum/test-fixtures

npm i https://pkg.pr.new/@connectum/test-fixtures@247

@connectum/testing

npm i https://pkg.pr.new/@connectum/testing@247

commit: 3f9c434

@intech intech self-assigned this Aug 5, 2026
@intech
intech merged commit 53e98c0 into main Aug 5, 2026
34 checks passed
@intech
intech deleted the refactor/scaffold-check-selector branch August 5, 2026 05:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg:cli @connectum/cli (Layer 3) type:chore Maintenance: refactoring, dependencies, CI/CD

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant