-
Notifications
You must be signed in to change notification settings - Fork 0
fix: parse and validate read_console types #130
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
base: main
Are you sure you want to change the base?
Conversation
|
You have run out of free Bugbot PR reviews for this billing cycle. This will reset on February 7. To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial. |
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. Walkthroughread_console now accepts Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
📜 Recent review detailsConfiguration used: Organization UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🔇 Additional comments (6)
✏️ Tip: You can disable this entire section by setting 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 |
Greptile SummaryThis PR fixes issue CoplayDev#561 by adding JSON string parsing and validation for the Key Changes:
Code Quality:
Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Client as MCP Client
participant RC as read_console
participant PJP as parse_json_payload
participant Unity as Unity Instance
Client->>RC: call with types='["error", "warning"]'
alt types is string
RC->>PJP: parse_json_payload(types)
PJP->>PJP: detect JSON array format
PJP->>PJP: json.loads(value)
PJP-->>RC: return parsed list
end
alt types is not a list after parsing
RC-->>Client: return error (types must be a list)
end
RC->>RC: validate types list
loop for each entry in types
alt entry is not string
RC-->>Client: return error (entries must be strings)
end
RC->>RC: normalize: entry.strip().lower()
alt normalized not in allowed_types
RC-->>Client: return error (invalid types entry)
end
RC->>RC: append to normalized_types
end
RC->>RC: build params_dict with validated types
RC->>Unity: send_with_unity_instance(params_dict)
Unity-->>RC: console data response
RC-->>Client: return response
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 files reviewed, 1 comment
| f"Allowed values: {sorted(allowed_types)}" | ||
| ) | ||
| } | ||
| normalized_types.append(normalized) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: duplicate entries in types list aren't deduplicated (e.g. ["error", "error"] passes through as-is). Consider using list(dict.fromkeys(normalized_types)) to preserve order while deduplicating.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Prompt To Fix With AI
This is a comment left during a code review.
Path: Server/src/services/tools/read_console.py
Line: 85:85
Comment:
**style:** duplicate entries in `types` list aren't deduplicated (e.g. `["error", "error"]` passes through as-is). Consider using `list(dict.fromkeys(normalized_types))` to preserve order while deduplicating.
<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>
How can I resolve this? If you propose a fix, please make it concise.b554546 to
9b3ba61
Compare
|
Update: addressed review feedback
|
Summary\n- Parse ypes when provided as JSON string for
ead_console (fixes CoplayDev#561).\n- Validate entries and normalize to allowed values.\n- Add tests for JSON string and invalid entries.\n\n## Testing\n- uv run pytest tests/integration/test_read_console_truncate.py -v\n\n## Issue\n- Fixes CoplayDev#561
Summary by CodeRabbit
New Features
Tests
✏️ Tip: You can customize this high-level summary in your review settings.