Skip to content

[Blueprints] Type Blueprint v2 theme install failures - #3866

Merged
adamziel merged 1 commit into
trunkfrom
type/blueprint-v2-theme-on-error
Jul 2, 2026
Merged

[Blueprints] Type Blueprint v2 theme install failures#3866
adamziel merged 1 commit into
trunkfrom
type/blueprint-v2-theme-on-error

Conversation

@adamziel

@adamziel adamziel commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

What?

Types the Blueprint v2 theme onError policy as skip-theme | throw.

Why?

The v2 schema already has the plugin install failure policy typed. Themes need the same declaration-level coverage so TypeScript consumers can express optional theme installs and reject plugin-only policies like skip-plugin.

Scope

This is type-only. It does not change the Blueprint v2 runner or theme install behavior.

Testing

  • npm run format:uncommitted
  • git diff --check
  • npm exec nx run playground-blueprints:typecheck
  • npm exec nx run playground-blueprints:lint
  • npm exec nx run playground-blueprints:test:vite -- --testFiles=packages/playground/blueprints/src/tests/v2/blueprint-v2-declaration.spec.ts

Part of #2592.

@adamziel
adamziel marked this pull request as ready for review July 2, 2026 15:35
@adamziel
adamziel requested review from a team, Copilot and mho22 July 2, 2026 15:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Updates Blueprint v2 declaration typing to allow theme install failure policies (skip-theme | throw) and adds type-level tests to validate correct/incorrect values.

Changes:

  • Add onError?: 'skip-theme' | 'throw' to the v2 theme schema type.
  • Add a type-level positive test for theme onError: 'skip-theme'.
  • Add a type-level negative test ensuring plugin-only policies (e.g. skip-plugin) are rejected for themes.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
packages/playground/blueprints/src/tests/v2/blueprint-v2-declaration.spec.ts Adds type assertions covering valid/invalid theme onError values.
packages/playground/blueprints/src/lib/v2/wep-1-blueprint-v2-schema/appendix-A-blueprint-v2-schema.ts Extends the theme schema typing with a theme-specific onError policy union.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +702 to +707
/**
* Sometimes it's fine when a theme fails to install.
*
* @default "throw"
*/
onError?: 'skip-theme' | 'throw';
Comment on lines +143 to +155
it('accepts theme install failure handling', () => {
const blueprint = {
version: 2,
themes: [
{
source: 'twentytwentyfour',
onError: 'skip-theme',
},
],
} satisfies BlueprintV2Declaration;

expect(blueprint.version).toBe(2);
});
Comment on lines +702 to +707
/**
* Sometimes it's fine when a theme fails to install.
*
* @default "throw"
*/
onError?: 'skip-theme' | 'throw';
@adamziel adamziel closed this Jul 2, 2026
@adamziel adamziel reopened this Jul 2, 2026
@adamziel
adamziel merged commit d9b1606 into trunk Jul 2, 2026
205 of 207 checks passed
@adamziel
adamziel deleted the type/blueprint-v2-theme-on-error branch July 2, 2026 16:53
adamziel added a commit that referenced this pull request Jul 2, 2026
## What?

Types the Blueprint v2 theme `ifAlreadyInstalled` policy as `overwrite |
skip | error`.

## Why?

Plugin installs already expose the collision policy in the v2
declaration type. Theme installs use the same policy shape, and typing
it lets TypeScript consumers catch invalid values before a Blueprint
reaches a runner.

## Scope

This is type-only. It does not change the Blueprint v2 runner or theme
install behavior.

## Stack

Base: #3866

## Testing

- `npm run format:uncommitted`
- `git diff --check`
- `npm exec nx run playground-blueprints:typecheck`
- `npm exec nx run playground-blueprints:lint`
- `npm exec nx run playground-blueprints:test:vite --
--testFiles=packages/playground/blueprints/src/tests/v2/blueprint-v2-declaration.spec.ts`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment