Skip to content

Wire live Prism node injection into JSON-parsed AST (herb-embedded-gu7) - #44

Merged
jleo3 merged 1 commit into
mainfrom
herb-embedded-gu7
Aug 18, 2026
Merged

Wire live Prism node injection into JSON-parsed AST (herb-embedded-gu7)#44
jleo3 merged 1 commit into
mainfrom
herb-embedded-gu7

Conversation

@jleo3

@jleo3 jleo3 commented Aug 18, 2026

Copy link
Copy Markdown
Member

Summary

  • ResultEnvelope.parse computes Prism.dump(Herb.extract_ruby(source)).bytes (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 into Herb.parse itself.
  • 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.

Acceptance criteria

  • At least one of the 15 prism-dependent rules produces a real, correct diagnostic through Bridge#lint — new spec in spec/bridge_lint_spec.rb lints <div><%= @foo %></div> against erb-no-instance-variables-in-partials for a partial-named file and asserts a real offense (plus a negative control for a non-partial filename).
  • The mechanism does not reintroduce the JSON::GeneratorError bug — FORWARDABLE_OPTIONS still excludes prism_program/prism_nodes/prism_nodes_deep from ever reaching Herb.parse; the injected bytes are computed separately as a plain Integer array, never a raw ASCII-8BIT string.
  • A note documents which of the 15 prism-dependent rules are covered and which remain out of scope — new sub-bullet in CHARTER.md's Shape decisions, naming all 12 rules that declare a Prism mode via parserOptions and 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.
  • Manually verified erb-no-debug-output and erb-no-instance-variables-in-partials both produce real diagnostics through Bridge#lint against hand-built fixtures.

🤖 Generated with Claude Code

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.
@jleo3
jleo3 merged commit 7ee956a into main Aug 18, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant