Fix dialogue extraction and reconstruction for menu titles#186
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughFixes menu boundary detection and adds nesting-aware reconstruction in the Ren'Py parser to prevent dialogue duplication inside menus; adds unit tests verifying menu title extraction, parsed label dialogue, and idempotent reconstruction of menu titles and jump statements. ChangesMenu parsing and reconstruction fixes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 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 |
There was a problem hiding this comment.
Pull request overview
This PR adjusts Ren’Py (.rpy) parsing/reconstruction to treat menu titles as editable dialogue while preventing duplicated dialogue insertion when reconstructing files (especially around menu: blocks).
Changes:
- Adjusted menu block boundary handling in
extractChoices()to treat lines at the same indent asmenu:as outside the menu. - Updated
reconstructRPYFile()to track menu nesting so menu titles are replaced in-place and remaining-dialogue insertion doesn’t trigger inside menu choice bodies. - Added unit tests covering menu-title extraction and preventing reconstruction duplication.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| apps/backend/src/services/rpy-parser.service.ts | Updates menu boundary logic and adds menu-nesting tracking during reconstruction to avoid duplicate insertions. |
| apps/backend/src/services/tests/rpy-parser.service.unit.test.ts | Adds regression tests for extracting menu titles and preventing duplication during reconstruction. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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.
Inline comments:
In `@apps/backend/src/services/rpy-parser.service.ts`:
- Around line 457-463: In extractChoices, a dedent can exit multiple nested menu
blocks but the code only pops one level; replace the single pop with a loop that
unwinds menuStack fully while menuStack.length > 0 and trimmed is truthy and
lineIndent <= menuStack[menuStack.length - 1], so all deeper menu levels are
popped (use menuStack and the existing trimmed/lineIndent checks to drive the
while-loop).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: c6cfa3ee-e700-456b-a16a-42a280d50c8f
📒 Files selected for processing (2)
apps/backend/src/services/__tests__/rpy-parser.service.unit.test.tsapps/backend/src/services/rpy-parser.service.ts
Summary by CodeRabbit
Bug Fixes
Tests