Validate Rakefile-style snippets in customization guide#1196
Open
myronmarston wants to merge 1 commit into
Open
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
22d2749 to
f0d0618
Compare
jwils
approved these changes
May 20, 2026
Base automatically changed from
myron/schema-customization-guide-followups
to
main
May 20, 2026 17:48
acd2f76 to
f746501
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. Fixes: - Move snippets into a real `Rakefile` in a new `schema_customization_rake_tasks` example project, loaded by the site Rakefile. - Add `RakeTasks.new` to the `music` example's existing Rakefile. - Add context comments to snippets showing where the code belongs. - Add Coverage-based line-level validation: uses Ruby's Coverage module to verify every executable snippet line ran during the build. The Coverage guard: - Starts `Coverage.start(lines: true)` before loading example Rakefiles - In `extract_snippets`, checks all `.rb` files were loaded AND all executable lines within `:snippet-start:`/`:snippet-end:` fences (or all lines for whole-file snippets) were executed - Supports `# :nocov:` markers for justified coverage gaps - Loads `validate.rb` in-process (via `load`) instead of as a subprocess so Coverage can track lines exercised by validation scripts A separate example project is needed because the Rakefile settings (e.g. `derived_type_name_formats = {FilterInput: "%{base}Filter"}`) change derived type names, conflicting with the `schema_customization` schema.rb that hardcodes names like `"OrderFilterInput"` in `customize_derived_types`. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
f746501 to
1e1b172
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