Skip to content

docs(upgrade): cover V2 constructor kwargs and stimulus_identifier_from_path removal#26

Closed
stevegeek wants to merge 1 commit into
mainfrom
docs/upgrade-guide-v2-gaps
Closed

docs(upgrade): cover V2 constructor kwargs and stimulus_identifier_from_path removal#26
stevegeek wants to merge 1 commit into
mainfrom
docs/upgrade-guide-v2-gaps

Conversation

@stevegeek

Copy link
Copy Markdown
Owner

Summary

Two migration blockers that weren't documented in UPGRADING.md, surfaced porting a real app from Vident 1.0.2 → 2.0.0.

1. Constructor signatures changed from positional to kwargs

After the §1 class rename (Vident::StimulusActionVident::Stimulus::Action), the next error a migrator hits at render time is:

ArgumentError: wrong number of arguments (given 2, expected 0; required keywords: controller, name)

V1 StimulusAction.new(:click, "ctrl/path", :method) mapped positional args to props. V2's Literal::Data-backed classes require kwargs. I added a "Related: V2 constructors take kwargs, not positional args." paragraph inside §1 covering three idiomatic fixes:

  • Array form at prop boundaries (shortest diff, most sites land here)
  • .parse(positional, ..., implied:) when you need a typed object
  • Direct kwarg construction for Vident-internal code

Also notes that implied_controller: kwarg is gone and what replaces it.

2. stimulus_identifier_from_path is removed

Mentioned in api-reference.md at line 590 but not in UPGRADING.md where a migrator looks first. Added a new §10 with the one-line fix: Vident::Stimulus::Naming.stimulize_path(path).

Why these warranted docs updates

Both are first-order consequences of V2 changes that already have sections in UPGRADING.md — they're the second error message a migrator sees after following §1 / existing guidance. Without these notes, the path from "I renamed everything" to "renders cleanly" includes grepping the gem's lib/ and skills/ to figure out what moved where.

Related: issue #25 (and a follow-up issue for the no_stimulus_controller inheritance case) cover the remaining V2 migration gaps that don't fit as doc additions.

🤖 Generated with Claude Code

…rom_path` removal

Two real migration blockers surfaced in a confinus app port that weren't
documented in UPGRADING.md:

1. After the §1 class rename (`Vident::StimulusAction` → `Vident::Stimulus::Action`),
   the next error at render time is `ArgumentError: wrong number of arguments`
   because V1 accepted positional args to `.new` and V2's `Literal::Data`
   classes require kwargs. Three fix paths are idiomatic — Array form at prop
   boundaries, `.parse(positional, ..., implied:)` for typed objects, or
   direct kwarg construction for internals. Also notes that
   `implied_controller:` is gone and what replaces it.

2. `stimulus_identifier_from_path` is removed; `Vident::Stimulus::Naming.stimulize_path`
   is the V2 replacement. It was mentioned in api-reference.md but nowhere
   that a migrator would look.

Adds a "Related" paragraph to §1 for the constructor change (it belongs
next to the rename it follows from) and a new §10 for the identifier helper.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@stevegeek

Copy link
Copy Markdown
Owner Author

Applied manually on main in commit HEAD (branch had conflicts from recent UPGRADING.md reshuffling). Content is preserved with updated section numbering (§10 is now the stimulus_identifier_from_path section). Thanks!

@stevegeek stevegeek closed this in 2f2c0b0 Apr 24, 2026
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