Skip to content

refactor(parser): make markdown golden meta-driven, drop generator script - #18100

Closed
xugangqiang wants to merge 2 commits into
mainfrom
fix/markdown-golden-meta
Closed

xugangqiang wants to merge 2 commits into
mainfrom
fix/markdown-golden-meta

Conversation

@xugangqiang

Copy link
Copy Markdown
Contributor

Summary

Move the markdown golden baseline to the {meta, items} format and drive
accepted divergences from meta.accepted_divergences instead of hardcoded
lists. No production parser code changes.

  • markdown.python.golden.json is now {meta, items}; meta records how it
    was produced so it is reproducible without a committed script.
  • TestMarkdownParser_AlignmentGolden uses LoadGoldenDoc /
    AcceptedDivergences / FilterOutDocTypes (from the foundation helpers PR).
  • Deletes testdata/gen_markdown_golden.py.

Dependency

Stacks on #18014 (framework in main) and the foundation helpers PR
(fix/parser-align-foundation).

@dosubot dosubot Bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Aug 11, 2026
@coderabbitai

coderabbitai Bot commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 171e6d16-6d2f-4a29-a9e3-a8e3015b09b1

📥 Commits

Reviewing files that changed from the base of the PR and between 4a8bb1b and 95cab76.

📒 Files selected for processing (7)
  • internal/parser/parser/markdown_parser_test.go
  • internal/parser/parser/testdata/gen_markdown_golden.py
  • internal/parser/parser/testdata/markdown.python.en.golden.json
  • internal/parser/parser/testdata/markdown.python.golden.json
  • internal/parser/parser/testdata/markdown.python.zh.golden.json
  • internal/parser/parser/testdata/markdown.sample.en.md
  • internal/parser/parser/testdata/markdown.sample.zh.md
💤 Files with no reviewable changes (2)
  • internal/parser/parser/testdata/markdown.python.golden.json
  • internal/parser/parser/testdata/gen_markdown_golden.py

📝 Walkthrough

Walkthrough

The Markdown alignment test now covers separate English and Chinese samples. It loads metadata-defined golden fixtures, applies accepted divergences, and compares normalized parser output. The standalone golden-generation script was removed.

Changes

Markdown alignment validation

Layer / File(s) Summary
English and Chinese golden fixtures
internal/parser/parser/testdata/markdown.sample.en.md, internal/parser/parser/testdata/markdown.sample.zh.md, internal/parser/parser/testdata/markdown.python.en.golden.json, internal/parser/parser/testdata/markdown.python.zh.golden.json, internal/parser/parser/testdata/markdown.python.golden.json
Added English and Chinese Markdown samples and corresponding parser golden fixtures. The previous Chinese golden fixture was replaced, and the English sample includes tables, lists, YAML, and an embedded image.
Metadata-driven alignment comparison
internal/parser/parser/markdown_parser_test.go, internal/parser/parser/testdata/gen_markdown_golden.py
Changed the regression test to use table-driven English and Chinese cases with metadata-defined divergence filtering. Removed the standalone golden-generation script.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested labels: ci

Suggested reviewers: yuzhichang, jinhai-cn, yingfeng

Poem

I hop through Markdown, neat and bright,
Two tongues now test the parser’s flight.
Golden pages line the way,
Divergences know what to say.
The old script rests beneath the hay.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the meta-driven Markdown golden refactor and removal of the generator script.
Description check ✅ Passed The description explains the refactor, testing changes, removed script, dependencies, and absence of production parser changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@xugangqiang
xugangqiang force-pushed the fix/markdown-golden-meta branch from e8d73a7 to efeaf34 Compare August 11, 2026 08:47
@xugangqiang
xugangqiang force-pushed the fix/parser-align-foundation branch from f2e724d to 1e39d24 Compare August 11, 2026 09:17
@xugangqiang
xugangqiang force-pushed the fix/markdown-golden-meta branch 2 times, most recently from c84236a to dc3680e Compare August 11, 2026 09:53
…ript

Move the markdown golden baseline to the {meta, items} format and drive
accepted divergences from meta.accepted_divergences instead of hardcoded lists.
No production parser code changes.

- markdown.python.golden.json is now {meta, items}; meta records how it was
  produced so it is reproducible without a committed script.
- TestMarkdownParser_AlignmentGolden uses LoadGoldenDoc / AcceptedDivergences /
  FilterOutDocTypes (from the foundation helpers PR).
- Deletes testdata/gen_markdown_golden.py.

Depends on #18014 and the foundation helpers PR (align_test.go).

Files:
  internal/parser/parser/markdown_parser_test.go
  internal/parser/parser/testdata/markdown.python.golden.json
  internal/parser/parser/testdata/markdown.sample.md
  internal/parser/parser/testdata/gen_markdown_golden.py (deleted)
- Rename the English sample/golden to *_en.* and add a Chinese
  counterpart (*_zh.*) so markdown parsing is exercised in both Latin
  and CJK contexts; the Chinese sample also covers the full-width
  delimiters in the default delimiter set (\n!?;。;!?).
- Both baselines keep the {meta, items} form with accepted_divergences
  declared in meta; the test is now table-driven over en/zh.
- The generator script is not committed; regeneration is described in
  each golden's meta block.

Stacks on the markdown golden meta-driven refactor (c84236a).
@xugangqiang
xugangqiang changed the base branch from fix/parser-align-foundation to main August 11, 2026 10:53
@xugangqiang
xugangqiang force-pushed the fix/markdown-golden-meta branch from dc3680e to 95cab76 Compare August 11, 2026 10:53
@xugangqiang

Copy link
Copy Markdown
Contributor Author

Reopening from fork (xugangqiang:fix/markdown-golden-meta) per repo workflow: feature branches live on the fork, not upstream.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant