Skip to content

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

Draft
marcossevilla wants to merge 1 commit into
refactor/template-var-resolversfrom
test/template-vars-check
Draft

marcossevilla wants to merge 1 commit 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. CI on this PR is red on purpose until #1789 lands on top; merge the stack as a unit.

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) as the explicit allowlist. flame_game lists application_id, which the template derives from org_name and project_name when omitted.
  • flutter_plugin now passes dart_fix_output: true. The var is only read by the bundle's post_gen hook, which the CLI never runs (onGenerateComplete already runs dart fix), so output is unchanged.

Fails today on org_name for app_ui_package, dart_cli, dart_package and flutter_package (fixed in #1789).

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

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.
@marcossevilla
marcossevilla force-pushed the test/template-vars-check branch from ef3ed33 to 1d19191 Compare October 29, 2026 12:50

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