Skip to content

LEGLINK-907: Fix validation bug in tenant create/update - #1790

Merged
johnbritton merged 4 commits into
devfrom
users/jbritton/LEGLINK-907
Aug 6, 2026
Merged

LEGLINK-907: Fix validation bug in tenant create/update#1790
johnbritton merged 4 commits into
devfrom
users/jbritton/LEGLINK-907

Conversation

@johnbritton

@johnbritton johnbritton commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

🛠️ Description of Changes

Bug fix where tenant model validation was requiring the old vendor field.

🧪 Testing Performed

Tested the tenant create/update endpoints with Postman.

🧑‍🔬 Unit Testing

  • I have written or updated unit tests to cover my changes
  • Coverage: 0.0%

📓 Documentation Updated

Please update any relevant sections in the project documentation that were impacted by the changes in the PR.

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

Auto incremental reviews are disabled on this repository.

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: CHILL

Plan: Pro Plus

Run ID: 499d33dd-0990-4d5e-9b9c-fd0498c7fdd7

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
📝 Walkthrough

Walkthrough

Facility creation and update validation now require VendorVersionId. Both paths return “Vendor version must be provided.” when the value is absent.

Changes

Facility validation

Layer / File(s) Summary
Require vendor version on facility writes
DotNet/Tenant/Controllers/FacilityController.cs
StoreFacility and PutFacility now validate VendorVersionId instead of Vendor. Both paths use the updated error message.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly identifies the tenant create/update validation bug and the related fix.
Description check ✅ Passed The description covers the changes, testing, unit-test status, and documentation section.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch users/jbritton/LEGLINK-907

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.

@coderabbitai coderabbitai 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.

🧹 Nitpick comments (1)
DotNet/Tenant/Controllers/FacilityController.cs (1)

222-224: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

Cover the new request contract with focused XUnit tests.

Add tests for both StoreFacility and PutFacility that verify:

  • Missing VendorVersionId returns 400 with the exact message.
  • The manager is not called when validation fails.
  • A valid VendorVersionId reaches the success path.
  • Vendor = null with a valid VendorVersionId succeeds.

The success test in DotNet/ServiceTests/IntegrationTests/Tenant/FacilityControllerTests.cs Lines [144]-[171] still supplies both fields. It does not prove that the old Vendor field is optional. Use Moq for dependencies. Do not use network activity in unit tests.

As per path instructions, add focused XUnit tests for each modified conditional branch and use mocks instead of network activity.

Also applies to: 327-329

🤖 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 `@DotNet/Tenant/Controllers/FacilityController.cs` around lines 222 - 224, Add
focused XUnit tests for StoreFacility and PutFacility covering missing
VendorVersionId with the exact 400 message and verifying the manager is not
called, plus valid VendorVersionId success cases including Vendor = null. Use
Moq for controller dependencies, avoid network activity, and update existing
success coverage so it proves Vendor is optional.

Source: Path instructions

🤖 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.

Nitpick comments:
In `@DotNet/Tenant/Controllers/FacilityController.cs`:
- Around line 222-224: Add focused XUnit tests for StoreFacility and PutFacility
covering missing VendorVersionId with the exact 400 message and verifying the
manager is not called, plus valid VendorVersionId success cases including Vendor
= null. Use Moq for controller dependencies, avoid network activity, and update
existing success coverage so it proves Vendor is optional.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 83ed1c9f-f07d-4516-bd87-cf62bdb3b3c9

📥 Commits

Reviewing files that changed from the base of the PR and between edbc3e7 and c1c88bd.

📒 Files selected for processing (1)
  • DotNet/Tenant/Controllers/FacilityController.cs

johnbritton and others added 3 commits August 5, 2026 15:45
Remove 'no vendor' negative test cases and their step name constants. Deleted Create400NoVendor and Update400NoVendor from DotNet/Automation.UI/Services/ApiHealth/TestSuites/ApiEndPointLibrary.cs and removed the corresponding test steps from DotNet/Automation.UI/Services/ApiHealth/TestSuites/TenantServiceTestSuite.cs. Cleans up unused step names and obsolete negative test cases; no other behavior changes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@johnbritton
johnbritton merged commit e80df17 into dev Aug 6, 2026
18 checks passed
@johnbritton
johnbritton deleted the users/jbritton/LEGLINK-907 branch August 6, 2026 13:56
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.

3 participants