Skip to content

fix: serialize ResponseInfo containers with a non-default port and wrapped members#805

Merged
berezovskyi merged 3 commits into
mainfrom
fix/responseinfo-description-port
Jun 14, 2026
Merged

fix: serialize ResponseInfo containers with a non-default port and wrapped members#805
berezovskyi merged 3 commits into
mainfrom
fix/responseinfo-description-port

Conversation

@berezovskyi

Copy link
Copy Markdown
Member

Summary

Follow-up to #804. Returning a real ResponseInfoArray<T> through OslcRdfOutputFormatter (from a reverse-proxied server on a non-default port) surfaced two more defects in the same ResponseInfo serialization path:

  1. Double port in the container subject URI. The formatter appended Request.Host.Port to HostString, which already carries the port, producing an invalid host:port:port authority (e.g. https://localhost:7000:7000/...) and throwing UriFormatException on every request that used a non-default port. Now built with UriHelper.BuildAbsolute (the same helper that backs GetEncodedUrl), which also picks up PathBase for proxied apps.

  2. EnumerableWrapper.Dispose NRE. It reflected a public Dispose method on the wrapped enumerator, but enumerators that implement IDisposable.Dispose explicitly (an array's does) have no public Dispose, so GetMethod(...) returned null and Dispose threw NullReferenceException — for every wrapped member collection, empty or not. Now disposes through IDisposable.

Together with #804 these make the idiomatic ResponseInfoArray → formatter path actually work for server-side OSLC query responses.

Tests

Adds the OSLC4Net.Server.Providers.Tests project (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. Full OSLC4Net.Core.slnx suite 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

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

coderabbitai Bot commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@berezovskyi, we couldn't start this review because you've reached your PR review rate limit.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: e215ae93-79c8-41f4-8cea-b08de6dff643

📥 Commits

Reviewing files that changed from the base of the PR and between 0274793 and 169a195.

📒 Files selected for processing (6)
  • CHANGELOG.md
  • OSLC4Net_SDK/OSLC4Net.Core.slnx
  • OSLC4Net_SDK/OSLC4Net.Core/Model/EnumerableWrapper.cs
  • OSLC4Net_SDK/OSLC4Net.Server.Providers/OslcRdfOutputFormatter.cs
  • OSLC4Net_SDK/Tests/OSLC4Net.Server.Providers.Tests/OSLC4Net.Server.Providers.Tests.csproj
  • OSLC4Net_SDK/Tests/OSLC4Net.Server.Providers.Tests/OslcRdfOutputFormatterTests.cs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/responseinfo-description-port

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 and usage tips.

@berezovskyi berezovskyi enabled auto-merge June 14, 2026 18:52
@codecov

codecov Bot commented Jun 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 51.67%. Comparing base (0274793) to head (169a195).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

… IDisposable'

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
@github-code-quality

github-code-quality Bot commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Code Coverage Overview

Languages: C#

C# / dotnet/cobertura

The overall coverage in the branch remains at 56%, unchanged from the branch.

Show a code coverage summary of the most impacted files.
File 0274793 169a195 +/-
/home/runner/wo...rableWrapper.cs 76% 75% -1%
/home/runner/wo...putFormatter.cs 0% 0% 0%
/home/runner/wo...ypeFormatter.cs 68% 72% +4%
/home/runner/wo...nseInfoArray.cs 0% 40% +40%
/home/runner/wo...putFormatter.cs 0% 56% +56%
/home/runner/wo...eredResource.cs 0% 100% +100%
/home/runner/wo...ResponseInfo.cs 0% 100% +100%
/home/runner/wo...FormatConfig.cs 0% 100% +100%

Updated June 14, 2026 18:55 UTC
Code Coverage is in Public Preview. Learn more and provide us with your feedback.

@berezovskyi berezovskyi added this pull request to the merge queue Jun 14, 2026
Merged via the queue into main with commit fea4d0c Jun 14, 2026
13 of 14 checks passed
@berezovskyi berezovskyi deleted the fix/responseinfo-description-port branch June 14, 2026 18:59
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.

1 participant