Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughOption-name handling for syntax-declared locals is made case-insensitive: option names are lowercased during extraction, pattern matching, and call-site validation in the analyzer; tests were updated to expect deduplicated lowercase runtime option names. ChangesOption Name Normalization to Lowercase
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
|
@CodeRabbit review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
src/analyzer/index.ts (1)
2089-2099:⚠️ Potential issue | 🟠 Major | ⚡ Quick winNormalize builtin matched option names before set membership checks.
option_nameis lowercased at lookup, but builtin-matched names are inserted intolocal_option_names/global_option_namesusing raw casing. This can skip macro creation when option casing differs.💡 Suggested fix
if (builtin_cmd) { for (const option of node.options) { for (const opt of builtin_cmd.local_options) { if (matches_option(option.name, opt)) { - local_option_names.add(option.name); + local_option_names.add(option.name.toLowerCase()); } } for (const opt of builtin_cmd.global_options) { if (matches_option(option.name, opt)) { - global_option_names.add(option.name); + global_option_names.add(option.name.toLowerCase()); } } } } else if (program_options) { for (const option_name of program_options.local_options) { - local_option_names.add(option_name); + local_option_names.add(option_name.toLowerCase()); } for (const option_name of program_options.global_options) { - global_option_names.add(option_name); + global_option_names.add(option_name.toLowerCase()); } }Also applies to: 2119-2125
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/analyzer/index.ts` around lines 2089 - 2099, The code adds builtin-matched option names into local_option_names/global_option_names using raw casing which mismatches the lowercased lookup; update the insertion to normalize the name the same way as lookup (e.g., use option.name.toLowerCase() or the same normalization function used by matches_option) before calling local_option_names.add(...) and global_option_names.add(...), and apply the same change in the other occurrence around the 2119–2125 block so set membership and macro creation use consistent casing.tests/property/program-macro-creation-correctness.prop.test.ts (1)
79-95:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winLowercase the negative membership assertions to avoid vacuous passes.
Detected options are now normalized to lowercase, but several negative checks still use
.includes(option_name). With mixed-case generators, regressions can slip through unnoticed.💡 Suggested fix pattern
- expect(invalid_program!.macro_creating_local_options?.includes(option_name) || false).toBe(false); + expect( + invalid_program!.macro_creating_local_options?.includes(option_name.toLowerCase()) || false + ).toBe(false); - expect(program!.macro_creating_local_options?.includes(option_name) || false).toBe(false); + expect(program!.macro_creating_local_options?.includes(option_name.toLowerCase()) || false).toBe(false); - expect(program!.macro_creating_global_options?.includes(option_name) || false).toBe(false); + expect(program!.macro_creating_global_options?.includes(option_name.toLowerCase()) || false).toBe(false);Also applies to: 146-150, 359-366, 431-433
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/property/program-macro-creation-correctness.prop.test.ts` around lines 79 - 95, The negative membership assertions use .includes(option_name) but macro_creating_local_options are normalized to lowercase, causing vacuous passes for mixed-case names; update all negative checks (e.g., in this test block and other occurrences at the noted ranges) to compare using the lowercase form (e.g., .includes(option_name.toLowerCase()) or normalize the RHS via .map/.some) when checking macro_creating_local_options, so replace .includes(option_name) with .includes(option_name.toLowerCase()) (reference symbols: macro_creating_local_options, option_name, parse_and_analyze).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@src/analyzer/index.ts`:
- Around line 2089-2099: The code adds builtin-matched option names into
local_option_names/global_option_names using raw casing which mismatches the
lowercased lookup; update the insertion to normalize the name the same way as
lookup (e.g., use option.name.toLowerCase() or the same normalization function
used by matches_option) before calling local_option_names.add(...) and
global_option_names.add(...), and apply the same change in the other occurrence
around the 2119–2125 block so set membership and macro creation use consistent
casing.
In `@tests/property/program-macro-creation-correctness.prop.test.ts`:
- Around line 79-95: The negative membership assertions use
.includes(option_name) but macro_creating_local_options are normalized to
lowercase, causing vacuous passes for mixed-case names; update all negative
checks (e.g., in this test block and other occurrences at the noted ranges) to
compare using the lowercase form (e.g., .includes(option_name.toLowerCase()) or
normalize the RHS via .map/.some) when checking macro_creating_local_options, so
replace .includes(option_name) with .includes(option_name.toLowerCase())
(reference symbols: macro_creating_local_options, option_name,
parse_and_analyze).
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: f5ce2eda-788e-4af6-9a30-b51cab5e88e4
📒 Files selected for processing (4)
src/analyzer/index.tstests/property/program-macro-creation-correctness.prop.test.tstests/property/program-pattern-detection-macro-creation.prop.test.tstests/unit/analyzer.test.ts
Insert option names into local_option_names/global_option_names using\nlowercase form to match the lowercased lookup, ensuring consistent set\nmembership for both builtin and user-defined program paths.\n\nAlso fix vacuous negative-membership assertions in property tests:\nmacro_creating_local_options/global_options are stored lowercase, so\n.includes(option_name) for mixed-case identifiers always passed\nregardless of correctness. Compare against option_name.toLowerCase().
|
@CodeRabbit review |
✅ Actions performedReview triggered.
|
Summary
Validation
Fixes #167
Conversation: https://app.warp.dev/conversation/0d604b25-de4f-4001-b616-d8cfa0adb550
Summary by CodeRabbit
Bug Fixes
Tests