fix: convert handler docs raw HTML to Markdown tables for v1.x (#312)#315
Merged
fix: convert handler docs raw HTML to Markdown tables for v1.x (#312)#315
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…proach Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add scripts/common/handler_js.py: parse_handler_dict, parse_handler_queue, render_handler_table — shared by create and verify sides - Update rst_ast_visitor.py: visit_raw 3-block state machine (Handler.js, inline <script>, handler_structure.html) + visit_definition_list blank-line fix - Add tests/ut/test_handler_js.py (20 tests) and test_rst_ast_visitor.py (6 tests) - Add .work/00312/prototype-*.md: v1.4 output for top-3 complex handlers (MessageResendHandler, RetryHandler, RequestThreadLoopHandler) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…fixes - Design: add クラス名/入力型/結果型 columns (package + Api type resolution) - Design: add parse_api_dict function spec - Design: fix Block 3 detection — node.source returns RST path not :file: path - Tasks: record Bug 1 (invisible images) and Bug 2 (Block 3 detection) with root causes Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…pdated Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…pe columns
Bug 1: visit_image now suppresses images with height=0 or width=0 (string or int).
These are spacer images injected via link.rst and have no visual content.
Bug 2: visit_raw now checks Block 3 (handler_structure.html source path) before
Block 2 (HandlerQueue text). The real handler_structure.html embeds a <script> with
HandlerQueue, causing it to match the Block 2 branch first. Reordering fixes this.
Block 3 state guard changed from js_text to script_text (Block 2 already processed).
Extension: parse_api_dict() added to handler_js.py. parse_handler_dict() now accepts
api_dict= and extracts package and type.{argument,returns} fields, resolving Api.*
references. render_handler_table() now emits クラス名/入力型/結果型 columns.
Also fixed </br/> (invalid HTML in Handler.js callback values) by widening _BR_RE
to match both <br/> and </br/>. Removed duplicate **ハンドラ処理概要** preamble
from render_handler_table (RST source already provides this heading).
Horizontal check: all fixes are in scripts/common/, shared by all 5 versions.
v5/v6 have no Handler.js (confirmed by design doc §9 scope). v1.2/v1.3/v1.4 all
use the same Handler.js pattern — fixes apply to all three via shared code.
Tests: 423 passed (was 411, +12 new tests).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
When `title` is empty, `docs.py` was emitting `["", ""]` as the start
of `lines`, causing the generated MD to begin with two blank lines.
This became visible after Bug 1 (invisible image suppression) removed
the image markdown that previously masked the blank lines in handler
docs for v1.x.
Fixed in all four render functions: `_render_no_knowledge`,
`_render_full`, `_render_xlsx_p1`, `_render_xlsx_p2`.
Horizontal check: searched for the `f"# {title}" if title else ""`
pattern — all four instances fixed in this commit, no others found.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Re-ran `python -m scripts.run create 1.4` to apply all three bug fixes: - Bug 1: invisible images suppressed - Bug 2: Block 3 (handler table) detection fixed - Bug 3: leading blank line suppressed when title is empty Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…-tasks (3a-3f) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…oot cause identified Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
link.rst injects handler_structure_bg.png / handler_bg.png with height=0 and width=0 as invisible spacers. RBKC already suppresses these in visit_image; verify was missing the same skip, causing 132 false-positive QL1 FAILs for all handler docs in v1.4/v1.3/v1.2. Added TDD tests (2 new), updated rbkc-verify-quality-design.md §346 with exclusion note. All 278 verify unit tests pass. Horizontal check: the height/width=0 invisible spacer pattern is specific to link.rst in v1.x handler docs — no other instance of the same root cause found in verify.py. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…fy fix All 5 versions verify OK (0 FAILs). Handler docs now show correct table content; invisible spacer images suppressed; leading blank lines removed. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
All 5 versions: 0 FAILs. Horizontal check confirmed :file: + raw::html pattern is v1.x-only (49/50/55 files); v5/v6 have zero such files. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Moved the height/width=0 exclusion condition from an invalid 6th table column (malformed markdown) to a proper paragraph below the QL1 table. Table structure is now consistently 5 columns. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
verify's logic must be derivable from source format spec alone (rbkc.md). The original comment/docstring/design-doc cited RBKC visit_image behaviour as the rationale — violating the independence principle. Replaced with spec-derived rationale: images with height=0 or width=0 carry no visible content and are not knowledge content per RST source format spec, so QL1 must not require them in JSON. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
QA review found 2 Findings: - TestParseHandlerQueue missing empty queue, no HandlerQueue, no Context edge cases - TestVisitImageInvisibleSuppression missing string "0" width-only test Also save expert review results. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
kiyotis
commented
Apr 28, 2026
Section 8 "Files Changed" incorrectly stated no changes to verify.py or create/ converters. Actual implementation also changed docs.py (Bug 3 leading blank line fix) and verify.py (QL1 invisible image false positive fix). Added explanatory note for why these changes arose during implementation. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Records how the full-diff check was performed and what was verified: all 771 changed files fall into 7 expected categories (handler docs, processing-pattern docs, other docs, their JSON counterparts, and tool/work files). Script can be re-run to reproduce the result. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Explains that all 771 changed files are accounted for by the PR scope, and that content completeness is fully verified by verify (QC1/QO2, 0 FAILs across all 5 versions). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Closes #312
Approach
Handler documentation in v1.x RST uses
.. raw:: html :file:directives referencingHandler.jsandhandler_structure.htmlto render an interactive handler placement diagram. The old RBKC emitted the raw HTML/JS verbatim into the browsable MD, resulting in 50+ lines of<script>text and orphaned background images with no explanation.The chosen approach was to parse
Handler.jsat RBKC build time and convert its structured data (handler names, behaviors, inbound/outbound sequences) into GFM Markdown tables. This preserves the actual content (handler queue membership, context, sequence) in a text-searchable, readable form — the closest faithful representation achievable without the original JS rendering engine.Alternatives considered:
handler_structure.html: HTML is a static scaffold with no data; all data is inHandler.js.The 3-block state machine in
rst_ast_visitor.pywas chosen over a pre-pass because the existing visitor already processes RST nodes in document order — adding state to the visitor avoids a separate scan and keeps the flow coherent with the existing architecture.Key changes:
handler_js.py(new): Parser for Handler.js JS files → Markdown handler queue tablesrst_ast_visitor.py: 3-block state machine invisit_raw, invisible image suppression invisit_image, definition list join fixdocs.py: Fix leading blank line when title is emptyverify.py: False positive fix — skip invisible images (height=0/width=0) in QL1 checktest_handler_js.py(513 lines),test_rst_ast_visitor.py(200 lines), additions totest_docs.pyandtest_verify.pyAll 5 versions verified: 0 FAILs before and after change.
Tasks
See tasks.md.
Expert Review
AI-driven expert reviews conducted before PR creation (see
.claude/rules/expert-review.md):Success Criteria Check
<script>text appears in v1.4 / v1.3 / v1.2 handler docs MDrst_ast_visitor.pydetects Block 2 (<script>) and replaces it with a Markdown table fromhandler_js.py; knowledge files regenerated confirm no<script>in outputvisit_imagesuppresses invisible images (height=0/width=0); the main background image is suppressed by the Block 1 state; 173 regenerated files verifiedrst_ast_visitor.pypreserves paragraph separation;docs.pyempty-title blank-line suppression eliminates spurious leading blank<script>residue;verify.pyfalse-positive fix for invisible images (spec §352) ensures height=0/width=0 images do not falsely FAILtest_handler_js.py(513 lines) andtest_rst_ast_visitor.py(200 lines) encode all root-cause scenarios including Bug 2 regression test.. raw:: html+:file:across all 5 versions.. raw:: html :file:directives); v1.x fix applied to all 3 versions in single commit<script>residue; all 5 versions run at 0 FAILs before and after change.work/xxxxx/postmortem-handler-raw-html.md.work/00312/postmortem-handler-raw-html.md🤖 Generated with Claude Code