Fix Prism comment JSON deserialization (comment_type / embdoc)#97
Fix Prism comment JSON deserialization (comment_type / embdoc)#97sorafujitani wants to merge 2 commits intomainfrom
Conversation
Align PrismComment with PrismBridge keys; map embdoc/inline safely. Add RSpec for embdoc sources and Rust tests.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit b1c7292. Configure here.
| bundle exec rake compile | ||
| bundle exec rspec | ||
| bundle exec rspec spec/conditional_formatting_spec.rb | ||
| ``` |
There was a problem hiding this comment.
Plan files committed despite gitignore exclusion intent
Low Severity
Ten .claude/plans/*.md files containing internal development notes for unrelated issues (#71, #73, #85, #86, #87, etc.) are committed. The project's .gitignore uses .claude/*.md to exclude personal memos, but this glob doesn't match subdirectory files like .claude/plans/*.md. The .claude/README.md explicitly labels .md files as "個人メモ" to be excluded, and plans/ is not in the whitelisted directories (agents/, commands/, skills/). The gitignore pattern likely needs .claude/**/*.md to catch these.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit b1c7292. Configure here.


Description
Ruby
PrismBridgeが返すトップレベルコメント JSON を、Rust のPrismCommentで正しく解釈するよう修正しました。comment_typeキーとembdoc/inlineなどの値を扱い、旧形式のtypeキーも読み取ります。Motivation
PrismCommentが#[serde(rename = "type")]のため、実際のペイロードcomment_typeと不一致で種別が常にデフォルト化されていました。またembdocやinlineは列挙子に存在せず、該当コメントを含むソースで JSON 全体のデシリアライズが失敗し得ました。Fixes #
Related to #
Changes
ext/rfmt/src/parser/prism_adapter.rs:comment_typeを主キーに、typeをエイリアス化。柔軟なdeserialize_prism_comment_typeとユニットテストを追加。spec/rfmt_spec.rb:=begin/=end付きソースの回帰テストを追加。.claude/plans/*.md: プロジェクト内の計画メモを追加。.direnv/flake-profile系: 追跡されていたシンボリックリンクを削除。Type of Change
Testing
bundle exec rspec)cd ext/rfmt && cargo test)nix develop+bash --noprofile --norc上でbundle exec rake compile/bundle exec rspecRfmt.format→Prism.parseが成功することを確認Checklist
cargo clippy)Screenshots / Examples
Before
After
Additional Notes
bundleがシステム Ruby に取られる場合は、nix develop後にbash --noprofile --norc -c 'bundle exec …'で実行すると安定します。Note
Medium Risk
Medium risk because it changes AST/comment deserialization, which can impact how comments are classified and therefore emitted during formatting; mitigated by defaulting unknown values and adding targeted tests.
Overview
Ensures top-level Prism comments from Ruby
PrismBridgedeserialize correctly by switchingPrismCommentto readcomment_type(withtypeas an alias) and adding a custom deserializer that maps values likeembdocandinlineto internal comment kinds without failing on unknown values.Adds Rust unit coverage for both the new and legacy comment payloads, and adds an RSpec regression test that formatting Ruby with
=begin/=endcomments completes successfully and remains parseable. Also adds multiple.claude/plans/*.mdplanning notes and removes committed.direnv/flake-profile*link artifacts.Reviewed by Cursor Bugbot for commit b1c7292. Bugbot is set up for automated code reviews on this repo. Configure here.