fix: serialize ResponseInfo containers with a non-default port and wrapped members#805
Conversation
fix: serialize ResponseInfo containers without a next page or members
OslcRdfOutputFormatter coerced a missing ResponseInfo next page to an empty
string and passed it to CreateDotNetRdfGraph, which then called new Uri(""),
throwing for every non-paged OSLC query response. Keep a missing next page as
null so no oslc:nextPage triple is emitted.
CreateDotNetRdfGraph also threw when building a ResponseInfo container for a
query that matched no members: EnsureNamespacePrefix relied on
INamespaceMapper.GetPrefix as a presence check, but it throws RdfException for
an unmapped URI, so the oslc prefix was never registered for an empty result.
Detect an already-mapped namespace without the throwing call.
Adds regression tests covering empty, null and present next page as well as
the empty-member container.
Signed-off-by: Andrew Berezovskyi <andrew@berezovskyi.me>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
|
Warning Review limit reached
More reviews will be available in 26 minutes and 28 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, 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 include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
✨ Finishing Touches🧪 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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #805 +/- ##
==========================================
- Coverage 51.93% 51.67% -0.26%
==========================================
Files 174 177 +3
Lines 10344 10570 +226
Branches 1069 1108 +39
==========================================
+ Hits 5372 5462 +90
- Misses 4717 4836 +119
- Partials 255 272 +17 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
… IDisposable' Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
Code Coverage OverviewLanguages: C# C# / dotnet/coberturaThe overall coverage in the branch remains at 56%, unchanged from the branch. Show a code coverage summary of the most impacted files.
Updated |
Summary
Follow-up to #804. Returning a real
ResponseInfoArray<T>throughOslcRdfOutputFormatter(from a reverse-proxied server on a non-default port) surfaced two more defects in the same ResponseInfo serialization path:Double port in the container subject URI. The formatter appended
Request.Host.PorttoHostString, which already carries the port, producing an invalidhost:port:portauthority (e.g.https://localhost:7000:7000/...) and throwingUriFormatExceptionon every request that used a non-default port. Now built withUriHelper.BuildAbsolute(the same helper that backsGetEncodedUrl), which also picks upPathBasefor proxied apps.EnumerableWrapper.DisposeNRE. It reflected a publicDisposemethod on the wrapped enumerator, but enumerators that implementIDisposable.Disposeexplicitly (an array's does) have no publicDispose, soGetMethod(...)returnednullandDisposethrewNullReferenceException— for every wrapped member collection, empty or not. Now disposes throughIDisposable.Together with #804 these make the idiomatic
ResponseInfoArray→ formatter path actually work for server-side OSLC query responses.Tests
Adds the
OSLC4Net.Server.Providers.Testsproject (the formatter had no test coverage) with tests that serialize a container on a non-default port and an empty container through the real formatter. FullOSLC4Net.Core.slnxsuite green (84 passed, 1 skipped).Context
Found while wiring server-side query support in oslc-rm-strictdoc-dotnet#191. These fixes (plus #804) need to ship in a release before that PR's workaround can be removed.
🤖 Generated with Claude Code