Skip to content

cli: wheels generate controller Name a,b silently emits invalid CFML — comma-joined action list becomes one action #3112

Closed

Description

@bpamiri

Repro (released 4.0.3, also expected on develop)

wheels generate controller Authors index,show
#   create  app/controllers/Authors.cfc
#   create  app/views/authors/index,show.cfm     <-- one file, comma in the name
grep -n function app/controllers/Authors.cfc
# 20:    function index,show() {                  <-- invalid CFML, won't compile

The documented form (wheels generate controller Authors index show, space-separated — code-generation.mdx:104,114) works correctly. But the comma form is the natural guess for anyone coming from validatesPresenceOf("a,b")-style comma lists elsewhere in Wheels, and the generator accepts it silently, reports success, and writes a controller that errors at first request plus a view file with a comma in its filename.

Fix options

  1. Split positional action tokens on commas before generating (friendliest), or
  2. Validate each action name against a CFML-identifier pattern and reject with a clear error.

Either way the generator must not write function index,show().

Dedupe: no overlap with #3072–#3090 or in-flight PRs #3100–#3108. Found during the P2 guide-behavioral-audit (p2-2-cliref) while verifying code-generation.mdx.

🤖 Generated with Claude Code

Activity

  1. wheels-bot commented on Jun 12, 2026

    @wheels-bot
    Contributor

    Wheels Bot — Triage

    Classified as bug.

    The report shows wheels generate controller Authors index,show silently emitting function index,show() (invalid CFML that fails to compile) plus a view file index,show.cfm with a comma in its name. There is a clear "what happened" (function index,show() written, reports success) vs. "what I expected" (the space-separated form index show works). Reproducible in isolation.

    Suspected layer

    cli — the code generator. The comma-joined token is passed through as a single action element rather than being split or validated.

    Fix sketch

    The action list arrives as ["index,show"] (one element) in CodeGen.cfc::generateController (cli/lucli/services/CodeGen.cfc:117), which writes function ACTION() per element and a view file per element. The likely fix is at the boundary where positional action tokens are collected — either split each token on commas before generating (so index,show becomes ["index","show"], mirroring validatesPresenceOf("a,b") list semantics), or validate each action against a CFML-identifier pattern and reject with a clear error. Touch points: CodeGen.cfc::generateController and possibly the positional-arg parsing in cli/lucli/Module.cfc. Mechanical, no design trade-offs, no cross-engine concern.

    Confidence: high

    Clear repro with expected-vs-actual, unambiguous single layer (cli generator), and a mechanical one-spot fix; none of the auto-downgrade rules (security/middleware/migration/DI/deploy/cross-engine) apply.

    <!-- wheels-bot:triage:3112 -->
    <!-- wheels-bot:triage-class:bug -->
    <!-- wheels-bot:triage-confidence:high -->

  2. wheels-bot commented on Jun 12, 2026

    @wheels-bot
    Contributor

    Wheels Bot — Fix proposed

    Draft PR: #3131

    Spec: cli/lucli/tests/specs/services/CodeGenSpec.cfc — added failing → passing cases asserting actions = ["index,show"] yields function index() / function show() (never index,show), plus trim/de-dup coverage.
    Implementation: cli/lucli/services/CodeGen.cfc (new normalizeActions() splits comma-joined tokens, returns the normalized list) and cli/lucli/Module.cfc (view loop now uses the normalized actions so view filenames match the controller methods).

    A human review is required before merge. The Reviewer will weigh in shortly. Doc updates (MDX guides, .ai/wheels/, CLAUDE.md) are handled separately by bot-update-docs.yml.

  3. added a commit that references this issue on Jun 12, 2026
    cca91dc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions