Expand conformance suite to per-rule fixture coverage, gated (herb-embedded-ag7) - #48
Merged
Conversation
…bedded-ag7) Adds one hand-written .html.erb fixture per rule the vendored bundle registers (100 rules, verified as the true complete count against node_modules/@herb-tools/linter's src/rules/), under spec/conformance/fixtures/rules/. Each fixture is authored by reading the rule's TypeScript source and validated to trigger the rule via the real reference linter CLI. conformance_spec.rb's existing reference_offenses/bridge_offenses helpers gain optional only:/rules: args (not duplicated) so a per-rule fixture can run --only <rule> / rules: [rule] the same way gu7/ada's Bridge#lint specs already do - this also lets not-enabled-by-default rules get exercised directly. A new test enumerates bridge.rule_names and asserts every one has a fixture, so a newly-added upstream rule with no fixture fails the build instead of going untested silently. Three rules that only enable themselves for partial files (basename starting with _) get underscore-prefixed fixture filenames to trigger correctly. Running the full suite surfaced a real, previously-undetected bridge bug: __herbLint/__herbAutofix construct the vendored Linter without its 4th constructor arg (allAvailableRules), which defaults to just the currently-selected rule subset when omitted. herb-disable-comment-unnecessary reads context.validRuleNames (derived from that arg) to recognize other rules referenced in a herb:disable comment, so under our one-rule-at-a-time execution model it could never recognize any rule but itself. Fixed by passing HerbLinter.rules (the full registry) explicitly at both call sites. CHARTER.md's "conformance punch list isn't closed" open question is updated to reflect that the fixture-coverage dimension is now closed, without overclaiming the separate .herb.yml config-application item it also named.
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
.html.erbfixture per rule the vendored bundle registers (100 rules — verified as the true, complete count against@herb-tools/linter'ssrc/rules/, which has 106 files but 6 are shared utility modules, not rules) underspec/conformance/fixtures/rules/. Each was authored by reading the rule's TypeScript source and validated to trigger the rule via the real reference linter CLI (node_modules/.bin/herb-lint --only <rule>).conformance_spec.rb's existingreference_offenses/bridge_offenseshelpers gain optionalonly:/rules:args (extended, not duplicated) so a per-rule fixture can force-select just that rule the same way gu7/ada's specs already do — this also exercises rules not enabled by default. A new coverage-gate test enumeratesbridge.rule_namesand asserts every one has a fixture, so a future upstream rule with no fixture fails the build instead of going untested silently._) get underscore-prefixed fixture filenames to trigger correctly.__herbLint/__herbAutofixinjs/ruby_backend.jsconstruct the vendoredLinterwithout its 4th constructor arg (allAvailableRules), which silently defaults to just the currently-selected rule subset.herb-disable-comment-unnecessarydepends on that arg (viacontext.validRuleNames) to recognize other rules referenced in aherb:disablecomment — under our one-rule-at-a-time execution model it could never recognize any rule but itself. Fixed by passingHerbLinter.rulesexplicitly at both call sites.CHARTER.md's "conformance punch list isn't closed" open question is updated to reflect the fixture-coverage dimension is now closed, without overclaiming the separate.herb.ymlconfig-application item it also named.Acceptance criteria
.html.erbfixture per built-in rule underspec/conformance/fixtures/rules/, hand-written, each verified to trigger its target rule via the real reference linter.reference_offenses/bridge_offenses.bundle exec rakepasses, including the expanded conformance suite: 206 examples, 0 failures, 0 RuboCop offenses.CHARTER.mdupdated to match, without adding scope beyond what this work actually changes.Test plan
bundle exec rakepasses locally (206 examples, 0 failures).bridge.rule_nameswith no extras and no gaps.herb-disable-comment-unnecessaryfix by re-running the full suite before (1 failure) and after (0 failures) thejs/ruby_backend.jschange.🤖 Generated with Claude Code