Skip to content

fix: strip parenthetical comments from depends-on parser - #642

Merged
namastex888 merged 1 commit into
devfrom
fix-parser
Mar 17, 2026
Merged

namastex888 merged 1 commit into
devfrom
fix-parser

Conversation

@namastex888

Copy link
Copy Markdown
Contributor

Summary

  • Fixes parseWishGroups() in dispatch.ts to strip parenthetical comments like (must be done first) from depends-on values
  • depends-on: 1 (comment) now correctly parses as dependency on "1" instead of "1 (comment)"
  • depends-on: none (comment) now correctly parses as no dependencies

Wish

fix-depends-parser

Test plan

  • Added test covering parenthetical comments on numbered deps, none deps, and Group-prefixed deps
  • All 752 tests pass
  • Typecheck passes
  • Lint passes (pre-existing warning only)

…Groups

`depends-on: 1 (must be done first)` was parsed as dependency on
"1 (must be done first)" which doesn't match any group. Now strips
`(...)` suffixes from both the none-check and individual dep values.
@coderabbitai

coderabbitai Bot commented Mar 17, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 49dca522-a890-45d4-af7b-31a87783d3ce

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-parser
📝 Coding Plan
  • Generate coding plan for human review comments

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 and usage tips.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refines the dependency parsing logic within the dispatch.ts module. It addresses an issue where parenthetical comments in depends-on declarations were incorrectly included in the parsed dependency values. The changes ensure that these comments are stripped, leading to more accurate and robust dependency resolution for wish groups.

Highlights

  • Dependency Parsing: The parseWishGroups() function in dispatch.ts has been fixed to correctly strip parenthetical comments from depends-on values.
  • Improved depends-on Format Handling: Values like depends-on: 1 (comment) now correctly parse as "1", and depends-on: none (comment) now correctly registers as having no dependencies.
  • Enhanced Test Coverage: New test cases were added to cover parenthetical comments on numbered, 'none', and Group-prefixed dependencies.
Changelog
  • src/term-commands/dispatch.test.ts
    • Added a new test case to validate the stripping of parenthetical comments from depends-on values.
  • src/term-commands/dispatch.ts
    • Modified the parseWishGroups function to include a regular expression that removes parenthetical comments from the depends-on string before processing.
    • Updated the mapping logic for dependsOn to also strip parenthetical comments from individual dependency items.
Activity
  • Added a test case specifically for parenthetical comments on various dependency types.
  • Confirmed that all 752 existing tests continue to pass.
  • Verified that the typecheck process completes without errors.
  • Ensured that linting passes, noting a pre-existing warning.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request fixes the depends-on parser to correctly handle parenthetical comments. The changes in dispatch.ts introduce logic to strip these comments, and a new test case in dispatch.test.ts validates this behavior. The implementation in dispatch.ts is functionally correct but could be simplified to improve readability and remove redundancy. I've provided a suggestion to refactor the comment stripping logic.

Comment on lines +165 to 177
const depsNormalized = depsStr.replace(/\s*\([^)]*\)/g, '').trim();
if (depsNormalized.toLowerCase() !== 'none') {
dependsOn = depsStr
.split(',')
.map((d) => d.trim().replace(/^group\s*/i, ''))
.map((d) =>
d
.trim()
.replace(/^group\s*/i, '')
.replace(/\s*\(.*\)\s*$/, '')
.trim(),
)
.filter(Boolean);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The logic for stripping parenthetical comments is a bit convoluted. It first creates depsNormalized by stripping comments from depsStr just for the 'none' check. Then, it processes the original depsStr and strips comments again inside the .map() call using a different regex.

This is redundant and can be simplified by cleaning the dependency string once and using that cleaned string for all subsequent logic. This would make the code easier to read and maintain.

      const cleanedDepsStr = depsStr.replace(/\s*\([^)]*\)/g, '');
      if (cleanedDepsStr.trim().toLowerCase() !== 'none') {
        dependsOn = cleanedDepsStr
          .split(',')
          .map((d) =>
            d
              .trim()
              .replace(/^group\s*/i, '')
              .trim(),
          )
          .filter(Boolean);
      }

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c195523d4a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 167 to 168
dependsOn = depsStr
.split(',')

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Strip comments before splitting dependency list

When a depends-on comment contains a comma (for example Group 1 (setup, required), Group 2), this code splits on commas before removing parenthetical comments, so it produces invalid dependencies like "1 (setup" and "required)" instead of "1". That breaks dependency resolution in startGroup because those malformed IDs can never be satisfied. Removing parenthetical segments before .split(',') (or splitting only on commas outside parentheses) avoids corrupting the parsed dependency list.

Useful? React with 👍 / 👎.

@namastex888
namastex888 merged commit bd1f04c into dev Mar 17, 2026
6 checks passed
@namastex888
namastex888 deleted the fix-parser branch March 29, 2026 22:10
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