Skip to content

refactor(tooling): fold the lint-fix leftovers in the scaffolder and release tools - #28

Merged
DPHonys merged 2 commits into
mainfrom
cleanup/tooling
Sep 8, 2026
Merged

DPHonys merged 2 commits into
mainfrom
cleanup/tooling

Conversation

@DPHonys

@DPHonys DPHonys commented Sep 7, 2026 •

Copy link
Copy Markdown
Owner

Part of the post-anti-slop cleanup series. Stacked on the validation/typed-handler PR.

Publishing contract:

  • move each rule's diagnostic onto its zod schema so the parallel
    diagnostic() switch disappears; messages are byte-identical
  • drop the erased z.ZodType annotations; nonEmptyString takes the message
  • readWorkspace applies the packages/ path rule itself and returns prefixed
    violations, retiring the Workspace union and validatePublishingContract
  • zod becomes a devDependency like the other private tools

Scaffolder:

  • one internal/errors.ts owns isNodeError/isNotFound/isAlreadyExists
    and asError; render.ts reuses asError instead of an inline ternary
  • prompt option and adapter signal fields accept undefined, so the clack
    adapter is the only place that strips an absent signal; withSignal and
    the conditional option objects in scaffolder.ts go away
  • JsonValue is spelled through z.json() like the test-utils copy
  • description, scaffoldNameInitialValue and request accept undefined
    so their builders collapse to one object literal

Tests:

  • strictly-increasing check in first-release-bootstrap is linear again
  • packOutputSchema normalises the tuple form so packManifest reads
    filename directly
  • the publish workflow schema only shapes the fields the suite reads
  • FixtureManifest spells the concrete manifest shapes instead of records

Verification: publishing-contract, typecheck, format, lint (same pre-existing finding only), knip, scaffolder (incl. acceptance), publishing-contract and release-preparation tests pass; pnpm scaffold --help boots. 17 files.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Improvements

    • Improved scaffolding error handling and normalization for clearer, more consistent failures.
    • Improved handling of missing paths and existing files during scaffolding.
    • Scaffolding requests now consistently preserve optional descriptions and cancellation signals.
  • Refactor

    • Simplified publishing-contract validation and workflow data handling.
    • Streamlined scaffolder option and interaction handling.
    • Standardized JSON and package output parsing.
  • Tests

    • Updated validation fixtures and publishing-order checks.
    • Broadened workflow test coverage for flexible configuration values.

@coderabbitai

coderabbitai Bot commented Sep 7, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: c278f6ee-68f3-455a-9aab-e493a225ab00

📥 Commits

Reviewing files that changed from the base of the PR and between 9b4dc4a and a7c2689.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (16)
  • release/publishing-contract/cli.ts
  • release/publishing-contract/package.json
  • release/publishing-contract/tests/first-release-bootstrap.test.ts
  • release/publishing-contract/tests/publish-workflow.test.ts
  • release/publishing-contract/tests/publishing-contract.test.ts
  • release/release-preparation/tests/release-preparation.test.ts
  • scaffolder/cli.ts
  • scaffolder/index.ts
  • scaffolder/internal/errors.ts
  • scaffolder/internal/interaction.ts
  • scaffolder/internal/non-interactive.ts
  • scaffolder/internal/production.ts
  • scaffolder/internal/registry.ts
  • scaffolder/internal/render.ts
  • scaffolder/internal/scaffolder.ts
  • scaffolder/internal/types.ts

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The publishing-contract checker now performs single-pass validation and schema-based normalization. The scaffolder now uses shared error helpers, explicit undefined types, consistent signal propagation, and normalized request construction.

Changes

Publishing contract and release validation

Layer / File(s) Summary
Direct publishing-contract validation
release/publishing-contract/cli.ts, release/publishing-contract/package.json
Workspace validation returns violation messages directly. Zod schemas contain diagnostic messages. zod is declared as a development dependency.
Contract fixture and workflow shapes
release/publishing-contract/tests/*
Fixture manifest types are narrowed. Workflow schemas accept less-specific fields. Publication-order validation compares adjacent indexes.
Pack output normalization
release/release-preparation/tests/release-preparation.test.ts
The pack-output schema transforms tuple output into a packed-file object before packManifest reads it.

Scaffolder type and error consistency

Layer / File(s) Summary
Shared scaffolder contracts and errors
scaffolder/index.ts, scaffolder/internal/types.ts, scaffolder/internal/production.ts, scaffolder/internal/errors.ts
Optional fields explicitly include undefined. Shared helpers classify filesystem errors and normalize unknown errors.
Interaction and request construction
scaffolder/internal/interaction.ts, scaffolder/internal/non-interactive.ts
Interactive and non-interactive requests always include description. Prompt adapters pass signals directly and omit absent signals for Clack.
Scaffolder execution and rendering
scaffolder/cli.ts, scaffolder/internal/scaffolder.ts, scaffolder/internal/registry.ts, scaffolder/internal/render.ts
Request and signal fields are passed consistently. Rendering uses shared error normalization and Zod-derived JSON types.

Priority: ⬇️ Low — Defer the tooling refactor because it is limited to scaffolder and release-tool validation, typing, error handling, and tests without a stated customer or incident impact.

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

Merge Risk: ⚪ Minimal · up to a7c26

The refactor preserves the scaffolder request and cancellation paths and the publishing-contract validation behavior covered by the supplied checks. No material merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 28 functions across 15 files. (1 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: refactoring lint-fix leftovers across the scaffolder and release tooling. It is concise and specific.
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.
Full details: Docstring Coverage

Explanation

Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 28 functions across 15 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cleanup/tooling

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

A rabbit checks each schema line,
And trims the empty fields away.
Signals hop through prompts just fine,
While shared errors guide the way.
Pack files settle into shape,
And scaffolds bloom without escape.

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

@DPHonys
DPHonys force-pushed the cleanup/tooling branch 2 times, most recently from 5de6035 to d3d7659 Compare September 8, 2026 07:19
Base automatically changed from cleanup/validation-typed-handler to main September 8, 2026 12:01
DPHonys and others added 2 commits September 8, 2026 14:01
…release tools

Publishing contract:
- move each rule's diagnostic onto its zod schema so the parallel
  `diagnostic()` switch disappears; messages are byte-identical
- drop the erased `z.ZodType` annotations; `nonEmptyString` takes the message
- `readWorkspace` applies the packages/ path rule itself and returns prefixed
  violations, retiring the `Workspace` union and `validatePublishingContract`
- zod becomes a devDependency like the other private tools

Scaffolder:
- one `internal/errors.ts` owns `isNodeError`/`isNotFound`/`isAlreadyExists`
  and `asError`; render.ts reuses `asError` instead of an inline ternary
- prompt option and adapter `signal` fields accept `undefined`, so the clack
  adapter is the only place that strips an absent signal; `withSignal` and
  the conditional option objects in scaffolder.ts go away
- `JsonValue` is spelled through `z.json()` like the test-utils copy
- `description`, `scaffoldNameInitialValue` and `request` accept `undefined`
  so their builders collapse to one object literal

Tests:
- strictly-increasing check in first-release-bootstrap is linear again
- `packOutputSchema` normalises the tuple form so `packManifest` reads
  `filename` directly
- the publish workflow schema only shapes the fields the suite reads
- `FixtureManifest` spells the concrete manifest shapes instead of records

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Oxlint failed first on the branch below, so eslint never ran here.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@DPHonys

DPHonys commented Sep 8, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Sep 8, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@DPHonys
DPHonys merged commit 33ba34e into main Sep 8, 2026
4 checks passed
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