Skip to content

fix(legacy-json): verify list type #322

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 27, 2025
Merged

fix(legacy-json): verify list type #322

merged 2 commits into from
Jun 27, 2025

Conversation

avivkeller
Copy link
Member

Fixes #321 by verifying the list meets the following structure before parsing it as a list of options:

  1. Must start with a code
  2. Followed by a space
  3. Followed by a link whose first character is <

@Copilot Copilot AI review requested due to automatic review settings June 25, 2025 22:32
@avivkeller avivkeller requested a review from a team as a code owner June 25, 2025 22:32
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR addresses issue #321 by ensuring that list nodes conform to an expected structure before parsing them as options. The changes include introducing the isTypedList helper function to validate that a list starts with an inline code block, followed by a space and a link whose first character is '<', and updating parseListItem to use this check for recursive option parsing.

Comments suppressed due to low confidence (1)

src/generators/legacy-json/utils/parseList.mjs:51

  • The condition verifies for whitespace by trimming the value. Given the PR description requires a single space, consider using an exact comparison (e.g., children?.[1]?.value === ' ') to enforce the expected structure.
    children?.[1]?.value.trim() === '' &&

Copy link

codecov bot commented Jun 25, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 66.76%. Comparing base (e44f080) to head (b1f44a2).
Report is 2 commits behind head on main.

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #322      +/-   ##
==========================================
+ Coverage   66.57%   66.76%   +0.19%     
==========================================
  Files          81       81              
  Lines        6956     6981      +25     
  Branches      339      343       +4     
==========================================
+ Hits         4631     4661      +30     
+ Misses       2322     2317       -5     
  Partials        3        3              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@avivkeller avivkeller added the fast track This PR can land before the typical review time, with a :+1: from collaborators label Jun 26, 2025
@avivkeller
Copy link
Member Author

FYI Requesting fast track since this functionality is need for building the tables in the web generator

@avivkeller avivkeller marked this pull request as draft June 26, 2025 02:39
@avivkeller
Copy link
Member Author

Feel free to approve, I just need to add tests, and fix one thing, which I’ll do tomorrow.

@avivkeller avivkeller marked this pull request as ready for review June 26, 2025 15:34
@avivkeller avivkeller merged commit 580bc4d into main Jun 27, 2025
10 checks passed
@avivkeller avivkeller deleted the fix/321 branch June 27, 2025 13:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fast track This PR can land before the typical review time, with a :+1: from collaborators
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Non-option lists are misread as options in parseList
3 participants