Skip to content

[repo-assist] test: add async IO.Stream and non-200 2xx response return-type tests (+3 tests, 465→468)#453

Merged
sergey-tihon merged 3 commits into
masterfrom
repo-assist/improve-async-stream-tests-20260526-c18aac75af7cc1e6
May 27, 2026
Merged

[repo-assist] test: add async IO.Stream and non-200 2xx response return-type tests (+3 tests, 465→468)#453
sergey-tihon merged 3 commits into
masterfrom
repo-assist/improve-async-stream-tests-20260526-c18aac75af7cc1e6

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

🤖 This PR was created by Repo Assist, an automated AI assistant.

Summary

Three new unit tests covering previously untested code paths in OperationCompiler:

Scenario Code path exercised
asAsync=true + application/octet-stream response → Async<IO.Stream> OperationCompiler.fs async IO.Stream branch
201-only JSON response (no 200 defined) → Task<string> okResponse 2xx-fallback selection
201-only JSON response in async mode → Async<string> async + 2xx-fallback combined

Why these matter

Async<IO.Stream>: The asAsync=true branch for octet-stream responses (| Some t when t = typeof<IO.Stream> -> <@ %(awaitTask responseStream) @>.Raw) had no unit-test coverage at all. Any regression there would be invisible.

Non-200 2xx fallback: OperationCompiler selects the successful response by checking "200" first, then any 2xx code, then "default". The 2xx-fallback path had no unit test for the case where the response has a schema (only the no-body 201/204 cases were covered).

Test Status

Total: 468, Errors: 0, Failed: 0, Skipped: 1, Time: 0.977s

All 468 tests pass (465 before → 468 after). Format check passes (dotnet fantomas --check).

Generated by 🌈 Repo Assist, see workflow run. Learn more.

Generated by 🌈 Repo Assist, see workflow run. Learn more.

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@dcdf09723d42ef9b6c75335e4612fd145d4ccdaa

…(+3 tests, 465→468)

Three new unit tests covering previously untested code paths in OperationCompiler:

1. asAsync=true + application/octet-stream response → Async<IO.Stream>
   Exercises the async branch of the IO.Stream response path
   (OperationCompiler.fs line ~488: awaitTask responseStream).

2. 201-only JSON response (no 200 defined) → Task<string>
   Exercises the 2xx fallback in the okResponse selection logic
   (the Seq.tryFind for codes in [200,300) branch).

3. 201-only JSON response in async mode → Async<string>
   Combines the two above — async mode + non-200 2xx fallback.

Total unit tests: 465 → 468.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor Author

🤖 Repo Assist here — following up on the CI failures.

The integration test failures here are pre-existing on master and are not caused by this PR's changes. The master branch itself is currently failing the same tests (CI run 26531462015):

System.InvalidProgramException : Common Language Runtime detected an invalid program.
   at Swagger.PetStore.Tests.PetStoreNullable.Tag.set_Name(String value)

This appears to be a regression introduced by the paket update in commit e048624 (May 25), which bumped ProvidedTypes.fs from a54d92b to ceeb6bc in the TypeProviders SDK. The generated property setter IL is now invalid for some schemas.

This PR's unit tests (Total: 468) all pass — the integration test failures are infrastructure-level and unrelated to the changes here.

Generated by 🌈 Repo Assist, see workflow run. Learn more.

Add this agentic workflows to your repo

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@298f992955146a6731d380a9de808e17861708e5

@sergey-tihon sergey-tihon marked this pull request as ready for review May 27, 2026 20:55
Copilot AI review requested due to automatic review settings May 27, 2026 20:55
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds targeted unit tests to increase coverage of OperationCompiler return-type selection, specifically for async octet-stream responses and non-200 2xx success responses that include a JSON schema.

Changes:

  • Add a test asserting asAsync=true + application/octet-stream (string/binary) produces Async<IO.Stream>.
  • Add tests asserting a schema with only a 201 JSON response (no 200) produces Task<string> and Async<string> depending on mode.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@sergey-tihon sergey-tihon merged commit 682c5c5 into master May 27, 2026
4 checks passed
@sergey-tihon sergey-tihon deleted the repo-assist/improve-async-stream-tests-20260526-c18aac75af7cc1e6 branch May 27, 2026 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants