Skip to content

Rename mount label to "FixtureKit Insert" and harden coder subscriber#53

Merged
ngan merged 1 commit into
mainfrom
np-fixturekit-insert-label
May 6, 2026
Merged

Rename mount label to "FixtureKit Insert" and harden coder subscriber#53
ngan merged 1 commit into
mainfrom
np-fixturekit-insert-label

Conversation

@ngan
Copy link
Copy Markdown
Collaborator

@ngan ngan commented May 6, 2026

Summary

  • Rename the execute_batch label from "FixtureKit Load""FixtureKit Insert" to match Rails' fixture insert naming convention.
  • Harden ActiveRecordCoder's sql.active_record subscriber: use safe_constantize and require the result to be a Class < ActiveRecord::Base before capturing it.

Why both in one PR

The label rename causes a feedback loop: "FixtureKit Insert" matches the coder's own NAME_PATTERN (which recognizes Insert as a write verb). Under fixture inheritance, the parent's mount notification then feeds into the child's generate subscriber, which calls constantize("FixtureKit") — the module, not a class — and crashes in base_table_model.

The subscriber hardening is the right fix regardless (any non-AR class name in a SQL log would have the same issue), but it's a strict prerequisite for the rename, so they go together.

Test plan

  • Existing unit tests pass with the renamed label
  • CI green across all matrix entries

🤖 Generated with Claude Code

The execute_batch label for fixture mount changes from "FixtureKit Load"
to "FixtureKit Insert" to align with Rails' own fixture insert naming.

The label rename causes fixture_kit's own mount notifications to match
the coder's NAME_PATTERN (which recognizes "Insert" as a write verb).
Without a guard, nested fixture inheritance would feed the parent's
mount notification back into the child's generate subscriber and
constantize "FixtureKit" — the module, not a class — and crash inside
base_table_model.

Switch the subscriber to safe_constantize and require the result to be
a Class < ActiveRecord::Base before capturing it. Non-AR matches are
silently skipped instead of raising.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@ngan ngan marked this pull request as ready for review May 6, 2026 20:10
@ngan ngan merged commit ca877ed into main May 6, 2026
8 checks passed
@ngan ngan deleted the np-fixturekit-insert-label branch May 6, 2026 20:10
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