Skip to content

test(create): fail when template bundle vars drift from the CLI - #1788

Draft
marcossevilla wants to merge 2 commits into
refactor/template-var-resolversfrom
test/template-vars-check
Draft

marcossevilla wants to merge 2 commits into
refactor/template-var-resolversfrom
test/template-vars-check

Conversation

@marcossevilla

@marcossevilla marcossevilla commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

Status

READY

Description

Part 2/3 of stack #1790. Green on its own; can merge before #1789.

Template bundles are regenerated by automated bump PRs (bump_templates.yaml), so new bundle vars can land without the CLI passing them. This adds a unit test (run by the existing CI) that checks, for every very_good create subcommand and template:

  • Unhandled: bundle vars not passed via templateVarResolvers and not listed in Template.defaultedVars → fail.
  • Stale: vars the CLI passes that the bundle does not declare → fail.
  • Stale allowlist: defaultedVars entries the bundle does not declare → fail.

Failure messages name the subcommand, template, bundle, vars, and how to fix them.

Also:

  • Adds Template.defaultedVars (empty by default): bundle vars the CLI intentionally does not pass. Mason does not apply brick defaults, so each listed var must be derived by the brick's pre_gen hook or be safe to render empty.
  • flame_game lists application_id, which its pre_gen hook derives from org_name and project_name.
  • flutter_plugin lists dart_fix_output. It only gates the brick's post_gen hook, which very_good create never runs; onGenerateComplete already applies the fixes.
  • app_ui_package, dart_cli, dart_package and flutter_package list org_name for now, which documents today's behavior (an empty copyright holder in LICENSE). feat(create): add --org-name to package and cli subcommands #1789 passes it and removes these entries.

No behavior change.

Type of Change

  • ✨ New feature (non-breaking change which adds functionality)
  • 🛠️ Bug fix (non-breaking change which fixes an issue)
  • ❌ Breaking change (fix or feature that would cause existing functionality to change)
  • 🧹 Code refactor
  • ✅ Build configuration change
  • 📝 Documentation
  • 🗑️ Chore

@marcossevilla
marcossevilla added this pull request to stack #1790 October 29, 2026 12:26
@marcossevilla
marcossevilla force-pushed the test/template-vars-check branch 3 times, most recently from 1d19191 to 98c773e Compare November 2, 2026 15:58
marcossevilla and others added 2 commits November 3, 2026 11:18
Template bundles are regenerated by automated bump PRs, so new bundle vars
could land without the CLI passing them. Add a unit test that checks every
create subcommand's templateVarResolvers against its templates' bundle vars
in both directions, plus Template.defaultedVars as the explicit allowlist
for vars intentionally left to the template default.

flame_game's application_id is allowlisted since the template derives it
from org_name and project_name. flutter_plugin now passes
dart_fix_output: true; the var is only read by the post_gen hook, which
the CLI never runs, so generated output is unchanged.

This check fails on purpose for the org_name var of app_ui_package,
dart_cli, dart_package and flutter_package until the follow-up that adds
--org-name to those subcommands.
List org_name as defaulted for the package and CLI templates until they
pass it, and move dart_fix_output to FlutterPluginTemplate.defaultedVars
since very_good create never runs the brick's post_gen hook.

Addresses FINDING-01, FINDING-07, FINDING-08 from review.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@marcossevilla
marcossevilla force-pushed the test/template-vars-check branch from 98c773e to 138fbe5 Compare November 3, 2026 10:18

This branch has not been deployed

No deployments
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