Wire live Prism node injection into JSON-parsed AST (herb-embedded-gu7) - #44
Merged
Conversation
ResultEnvelope.parse now computes Prism.dump(Herb.extract_ruby(source)).bytes as a JSON-safe Integer array and injects it onto the root parsed value's prism_node key when prism_program is requested, instead of forwarding that flag to Herb.parse (which returns raw ASCII-8BIT bytes and breaks .to_json). This makes the prism_program-backed rules (erb-no-debug-output, erb-no-instance-variables-in-partials) produce real diagnostics through Bridge#lint. prism_nodes/prism_nodes_deep (per-ERBContentNode injection, used by the other 10 prism-dependent rules) remains out of scope, documented in CHARTER.md.
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
ResultEnvelope.parsecomputesPrism.dump(Herb.extract_ruby(source)).bytes(a JSON-safeIntegerarray) and injects it onto the root parsed value'sprism_nodekey whenprism_programis requested, instead of forwarding that flag intoHerb.parseitself.prism_program-backed rules (erb-no-debug-output,erb-no-instance-variables-in-partials) produce real diagnostics throughBridge#lint.prism_nodes/prism_nodes_deep(per-ERBContentNodeinjection, used by the other 10 prism-dependent rules) remains out of scope, documented inCHARTER.md.Acceptance criteria
Bridge#lint— new spec inspec/bridge_lint_spec.rblints<div><%= @foo %></div>againsterb-no-instance-variables-in-partialsfor a partial-named file and asserts a real offense (plus a negative control for a non-partial filename).JSON::GeneratorErrorbug —FORWARDABLE_OPTIONSstill excludesprism_program/prism_nodes/prism_nodes_deepfrom ever reachingHerb.parse; the injected bytes are computed separately as a plainIntegerarray, never a raw ASCII-8BIT string.CHARTER.md's Shape decisions, naming all 12 rules that declare a Prism mode viaparserOptionsand the reason the other 10 (prism_nodes) aren't covered yet.Test plan
bundle exec rake(RuboCop + full RSpec suite) passes locally, including the two new specs.erb-no-debug-outputanderb-no-instance-variables-in-partialsboth produce real diagnostics throughBridge#lintagainst hand-built fixtures.🤖 Generated with Claude Code