Rename mount label to "FixtureKit Insert" and harden coder subscriber#53
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
execute_batchlabel from"FixtureKit Load"→"FixtureKit Insert"to match Rails' fixture insert naming convention.ActiveRecordCoder'ssql.active_recordsubscriber: usesafe_constantizeand require the result to be aClass < ActiveRecord::Basebefore capturing it.Why both in one PR
The label rename causes a feedback loop:
"FixtureKit Insert"matches the coder's ownNAME_PATTERN(which recognizesInsertas a write verb). Under fixture inheritance, the parent's mount notification then feeds into the child'sgeneratesubscriber, which callsconstantize("FixtureKit")— the module, not a class — and crashes inbase_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
🤖 Generated with Claude Code