Skip to content

fix(streaming): preserve receive credit after call completion - #824

Merged
SunSi12138 merged 5 commits into
devfrom
fix/terminal-stream-credit-standalone
Oct 11, 2026
Merged

SunSi12138 merged 5 commits into
devfrom
fix/terminal-stream-credit-standalone

Conversation

@SunSi12138

@SunSi12138 SunSi12138 commented Oct 11, 2026 •

Copy link
Copy Markdown
Owner

Summary

Extracts the reproduced Terminal Stream Credit correctness fix from #754 onto current dev 6f19cd0cfd1bde4a4911bf59c413205d4ce93cd4 (#810 and #814–#816 included).

A queued OneWay failure can leave its completed call state mapped while an exception mapper runs. The receive loop previously skipped later stream frames before accounting them, permanently losing sender credit. The deterministic regression holds the mapper, publishes a 64-byte window and fences the same connection before checking that credit is restored.

Scope and invariants

  • Terminal frames reach only an existing already-discarding transport route. No unknown route is created, no live typed child is abandoned, and business-code entry remains prohibited.
  • Receive bytes are debited/refunded once. Raw compressed frames validate original length without invoking a decoder; post-decode terminal transitions return decoded ownership in a finally block.
  • Stream completion removes only the exact captured entry, never a replacement sharing its IDs.
  • Stale pooled call-state captures retry current generation/absence with a fixed bound.
  • OneWay success and failure establish discard before publishing completion or entering the exception mapper.

This is a 14-file standalone change: seven production files, four focused regression files, two documentation files and removal of one obsolete maintainability exception. Public API snapshots, IRpcStub/descriptor contracts, generated ABI identity/version, generator code, outbound snapshot tracking and wire format are unchanged. #754 remains a separate reference; its MethodShape optimization is not included.

Validation

Current production head: e4fa38555677b5693a77a4a3b94722f7c4361f04, tree 80952edab6704b312fe0fe9bf67a93fc34f85320, based on actual dev 6f19cd0cfd1bde4a4911bf59c413205d4ce93cd4.

Independent source review approved the extraction and subsequent clean merge, preserving all #810/#815/#816 cleanup deletions. Public API, generated contracts, identity and outbound method snapshots have zero delta against dev.

Final standalone exact-source validation passed on e4fa3855, against actual dev 6f19cd0c:

  • 2,051 unit, 271 generator, 77 load-harness and 454 integration tests.
  • Baseline: 5/5 precise expected-credit-64/actual-credit-0 reproductions.
  • Fixed candidate: 5/5 deterministic passes and 5/5 unchanged original two-second regression passes.
  • Formatting, maintainability, unchanged public API/version checks, full/partial source/package trimming and NativeAOT consumers.

The maintainability gate initially detected two extra lines in an existing oversized file. Its unchanged OneWay completion helper was moved into a focused partial, bringing the original file below the normal threshold; the now-obsolete exception was removed rather than increased. The baseline-proof parser was adapted to TUnit's actual error-element format while retaining exact assertion, test identity and stack provenance requirements.

Fast, package smoke and CodeQL also passed on the final head. Both exact-source canonical PR Extended and formal PR Extended passed. The formal tested merge-ref tree is identical to the candidate tree. Extended includes the Debug rollback test, all 454 integration tests, source NativeAOT, packaged consumers, demo/load validation and six-platform desktop codec compatibility (2,088 compatible results); eight browser jobs retain their canonical conditional skips. Prior #754 results are not used as acceptance evidence for this extraction.

Regression coverage includes original-byte totals, buffered credit, absent/live routes, malformed compressed lengths, terminal transitions during decode/failure, duplicate frames, exact route replacement and stale pooled generations.

No performance claim or snapshot redesign is included. Merge is conditional on the final integration and latest-dev checks passing.

@SunSi12138
SunSi12138 marked this pull request as ready for review October 11, 2026 09:24
@SunSi12138
SunSi12138 merged commit d500888 into dev Oct 11, 2026
32 checks passed
@SunSi12138
SunSi12138 deleted the fix/terminal-stream-credit-standalone branch October 11, 2026 09:34
SunSi12138 added a commit that referenced this pull request Oct 11, 2026
#801)

Replay PR #818 on dev after #824 while preserving terminal stream credit handling.
SunSi12138 added a commit that referenced this pull request Oct 11, 2026
#801) (#818)

Replay PR #818 on dev after #824 while preserving terminal stream credit handling.
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