Validate Rakefile-style snippets in customization guide#1196
Draft
myronmarston wants to merge 1 commit into
Draft
Validate Rakefile-style snippets in customization guide#1196myronmarston wants to merge 1 commit into
myronmarston wants to merge 1 commit into
Conversation
5cdc293 to
22d2749
Compare
The 4 Rakefile snippets (schema_element_name_form, schema_element_name_overrides, derived_type_name_formats, type_name_overrides) from #1191 were extracted as text from `rake_task_examples.rb` but never actually executed—a typo or API rename would go undetected by CI. Fix: move them into a real `Rakefile` in a new `schema_customization_rake_tasks` example project. The site Rakefile now `load`s an example's `Rakefile` if one exists, using it instead of the inline `RakeTasks.new` instantiation. Also adds `RakeTasks.new` to the `music` example's existing Rakefile so it works with this pattern. A separate example project is needed because the Rakefile settings (e.g. `derived_type_name_formats = {FilterInput: "%{base}Filter"}`) change derived type names, which conflicts with the `schema_customization` schema.rb that hardcodes names like `"OrderFilterInput"` in `customize_derived_types`. Also adds context comments to snippets extracted from within blocks so readers know where the code goes (e.g. "Within `ElasticGraph.define_schema { ... }` in your schema definition:"). Finally, adds a Coverage-based guard that ensures every .rb file in an example directory is actually loaded during validation. This prevents future regressions where a snippet file could be added but never executed. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
22d2749 to
f0d0618
Compare
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
schema_element_name_form,schema_element_name_overrides,derived_type_name_formats,type_name_overrides) were never validated—they were extracted as plain text fromrake_task_examples.rbwithout being executed.Rakefilein a newschema_customization_rake_tasksexample project so the setter calls execute at load time, catching syntax errors and API renames.FilterInput→Filter), conflicting with the existingschema_customization/schema.rbwhich hardcodes names like"OrderFilterInput".Test plan
boomand confirmedrake site:examples:schema_customization_rake_tasks:extract_snippetsfailsschema_element_name_form_typo=) producesNoMethodErrorrake site:examples:extract_snippetsand confirmed all examples pass (pre-existing [Bug] Psych::DisallowedClass: Tried to load unspecified class: Symbol #1021 issue withmusicexample is unrelated)🤖 Generated with Claude Code