✨ handle choice groups that require at least one element#48
Conversation
|
Warning Rate limit exceeded
To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThe PR updates two XmlSchemaClassGenerator package versions from 99.0.10-local to 99.0.11-local in the central package directory and extends choice group attribute test utilities with validation test cases. ChangesDependency and Test Enhancements
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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. Review rate limit: 0/1 reviews remaining, refill in 19 minutes and 23 seconds.Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
src/siri/Spillgebees.SIRI.Models.Tests/ChoiceGroupAttributeTests.cs (1)
183-194: ⚡ Quick winAssert the full distinct choice-group set.
>= 2only proves there is more than one group; it won’t catch a regression that drops one of the expectedControlActionStructuregroups. If the schema shape is stable, this can be a much stronger regression check.📏 Suggested fix
- choiceGroupIds.Count.Should().BeGreaterThanOrEqualTo(2); + choiceGroupIds.Should().HaveCount(5);🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/siri/Spillgebees.SIRI.Models.Tests/ChoiceGroupAttributeTests.cs` around lines 183 - 194, Replace the weak assertion in Should_have_multiple_distinct_choice_groups_on_control_action_structure with a precise check of the full distinct set: compute choiceGroupIds from typeof(ControlActionStructure).GetProperties() as you already do, then assert that the result equals the expected set (or expected count) of group IDs for ControlActionStructure (e.g., Assert that choiceGroupIds.SequenceEqual(expectedList) or choiceGroupIds.Count == expectedCount), using the existing variable names choiceGroupIds and ControlActionStructure to locate the test and prevent regressions if a group is removed or renamed.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/siri/Spillgebees.SIRI.Models.Tests/ChoiceGroupAttributeTests.cs`:
- Around line 16-19: The helper GetChoiceGroupAttribute<T>(string propertyName)
currently uses FirstOrDefault() which will hide cases where a property has more
than one XmlChoiceGroupAttribute; change it to enforce a single result (e.g.,
use SingleOrDefault() or enumerate
.GetCustomAttributes<XmlChoiceGroupAttribute>() and throw an informative
exception if Count > 1) so duplicate annotations fail fast and surface generator
regressions; keep the method signature and use
typeof(T).GetProperty(propertyName) to locate the property and then validate the
attribute collection before returning the single attribute or null.
- Around line 250-280: The test
Should_keep_outer_and_inner_memberships_for_nested_service_delivery_choice
currently asserts IsRequired for production, estimated and situationExchange but
omits included; update the final assertion to include the included collection so
the requiredness of the outer-member (included) is also verified (e.g., combine
included with production, estimated and situationExchange before the AllSatisfy
check).
---
Nitpick comments:
In `@src/siri/Spillgebees.SIRI.Models.Tests/ChoiceGroupAttributeTests.cs`:
- Around line 183-194: Replace the weak assertion in
Should_have_multiple_distinct_choice_groups_on_control_action_structure with a
precise check of the full distinct set: compute choiceGroupIds from
typeof(ControlActionStructure).GetProperties() as you already do, then assert
that the result equals the expected set (or expected count) of group IDs for
ControlActionStructure (e.g., Assert that
choiceGroupIds.SequenceEqual(expectedList) or choiceGroupIds.Count ==
expectedCount), using the existing variable names choiceGroupIds and
ControlActionStructure to locate the test and prevent regressions if a group is
removed or renamed.
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: bc757461-f58f-49f1-aad6-64ccf1301f50
📒 Files selected for processing (6)
packages/XmlSchemaClassGenerator-beta.99.0.10-local.nupkgpackages/XmlSchemaClassGenerator-beta.99.0.11-local.nupkgpackages/XmlSchemaClassGenerator.Analyzer.99.0.10-local.nupkgpackages/XmlSchemaClassGenerator.Analyzer.99.0.11-local.nupkgsrc/Directory.Packages.propssrc/siri/Spillgebees.SIRI.Models.Tests/ChoiceGroupAttributeTests.cs
Updated our custom xml schema generator to handle choice groups that require at least one value (i.e. are not optional).
Summary by CodeRabbit
Release Notes
Chores
99.0.11-localTests