Skip to content

fix: publish stream close verdict before reader EOF - #91

Merged
senamakel merged 15 commits into
tinyhumansai:epic/8056-modules-wiringfrom
senamakel:sdk-stream-close-publication
Oct 18, 2026
Merged

senamakel merged 15 commits into
tinyhumansai:epic/8056-modules-wiringfrom
senamakel:sdk-stream-close-publication

Conversation

@senamakel

@senamakel senamakel commented Oct 18, 2026 •

Copy link
Copy Markdown
Member

A stream reader could receive every byte and still report connection closed mid-stream: Close dropped the channel sender before recording its completion verdict. A reader awakened between those operations observed a closed channel with no verdict. Truncated streams could similarly lose their specific abort reason.

Publish the completion or truncation outcome before sealing the channel. Two deterministic regression tests pause the real registry Close path at the former race window, drain the payload, and inspect terminal state before releasing and joining Close. Both failed with the false connection-closed result before the fix and pass afterward. The hook is per registry and compiled only for tests.

Prepares SDK 0.3.3 with matching workspace, lockfile, example, and pinned-version fixture updates. The coverage script also discovers macOS dylibs for all eight native fixtures; a regression executes the real script with isolated fake-Cargo fixtures for Linux and macOS, checks the unchanged coverage rules, and confines that Unix harness to POSIX feature lanes. Existing Windows feature commands remain intact.

Validation completed locally: Rust 1.99 locked check, all-target/all-feature Clippy, formatting, all 41 stream tests, and excluded examples check; native module gate including ten isolated terminal scenarios; unchanged 90% per-file coverage gate (54 files, minimum 90.06%, total 94.68%); and all three script regressions. Independent source and script reviews passed. The scoped slim tests, exact workspace/no-default/macros feature command, rustdoc with warnings denied, actual Rust 1.85.0 workspace/all-target/all-feature check, and current/relocated locked example metadata also pass. Publication waits for hosted CI and review.

Part of tinyhumansai/openhuman#8056. TinyStorageDrivers #61 exposed the race; its assertions and timeouts are preserved.

Add a test-only hook that runs after a stream is sealed during Close, letting
tests pause the close path and observe what a reader sees at that moment. New
tests use it to assert that a complete close publishes a clean EOF and a
truncated close publishes an abort before the reader observes end of stream.

Auto-committed-on: macbook
Adjust the assertion in the close verdict test to compare against an explicit byte slice, keeping the comparison types consistent.

Auto-committed-on: macbook
Move the completion or abort outcome ahead of sealing so the stream is
finalised before it becomes visible as sealed, and reuse the truncation
check for the error path.

Auto-committed-on: macbook
Release 0.3.3 fixes a race where a reader that had drained a stream's
payload could observe the wrong end state, because the reader channel was
closed before the completion or truncation verdict was published. The
verdict is now published first so drained readers see the correct end.

Auto-committed-on: macbook
Update the module identity versions used by the pinned client tests to
0.3.3 so the fixtures match the current release.

Auto-committed-on: macbook
Update the locked versions of tinybus, tinybus-macros, and tinybus-module from 0.3.2 to 0.3.3.

Auto-committed-on: macbook
Update the example lockfile to pick up tinybus and tinybus-macros 0.3.3, keeping the examples in sync with the released version.

Auto-committed-on: macbook
@coderabbitai

coderabbitai Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

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: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 6e9231db-5ec3-4ec6-a0b4-0356fa8e18ea

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
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-18T15:54:10.322011Z 1bc047d New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Adds the compiled Python bytecode for the coverage check test module, generated by the interpreter when the test was run.

Auto-committed-on: macbook
Delete the cached .pyc file for the coverage test script so it is no longer tracked in version control.

Auto-committed-on: macbook
The coverage script only looked for .so example modules, so it failed to locate them on macOS where they are built as .dylib. The remaining lookups now also accept the .dylib extension.

Auto-committed-on: macbook
Add a test that parses scripts/test-features.sh and checks the fake-Cargo
coverage invocation only runs in the POSIX branch of the runner-OS case
statement, never on Windows. It also pins the exact set of cargo commands
so the harness cannot silently drift.

Auto-committed-on: macbook
The feature test runner now skips the coverage script on Windows while still running it on Linux and macOS, and the accompanying platform tests were adjusted to match the new case structure and verify the Windows branch is empty.

Auto-committed-on: macbook
The test now checks the lines between the Windows branch and the closing esac instead of the range before the branch, so the assertion actually inspects the Windows case body.

Auto-committed-on: macbook
@senamakel
senamakel merged commit 207a9a7 into tinyhumansai:epic/8056-modules-wiring Oct 18, 2026
14 checks passed
@tinysweeper

tinysweeper Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Tiny Sweeper review

Tiny Sweeper reviewed this change across 5 lane(s) and found 0 active actionable finding(s). Detailed lane evidence and any incomplete work are listed below.

State: Incomplete
Priority: none
Reviewed head: 1bc047d2a0e2
Updated: 2026-10-18T16:44:37Z

Review snapshot

Change surface Files Review signal Count
Production 2 Active findings 0
Tests 4 Noted findings 0
Documentation 1 Resolved findings 0
Configuration 1 Pending checks/questions 17

Completeness: Incomplete
Test assessment: No supported feature-to-test mapping was available; this does not mean tests are absent or passed.

Features

None identified with supported citations.

Tests

No supported feature-to-test mapping was produced. Test execution is not inferred.

  • Unreviewed: tinysweeper/tests

Findings

No active actionable findings.

Could not review: CHANGELOG.md, Cargo.toml, crates/tinybus/src/module/client_pinned_tests.rs, crates/tinybus/src/stream/mod.rs, crates/tinybus/src/stream/stream_tests.rs, scripts/check-coverage.sh, scripts/test-features.sh, scripts/test_check_coverage.py, tinysweeper/description, tinysweeper/tests

Before merge

  • Complete the critique review for CHANGELOG.md, Cargo.toml, crates/tinybus/src/module/client_pinned_tests.rs, crates/tinybus/src/stream/mod.rs, crates/tinybus/src/stream/stream_tests.rs, scripts/check-coverage.sh, scripts/test-features.sh, scripts/test_check_coverage.py.
  • Complete the security review for Cargo.toml, scripts/test_check_coverage.py, crates/tinybus/src/module/client_pinned_tests.rs, crates/tinybus/src/stream/mod.rs, crates/tinybus/src/stream/stream_tests.rs, scripts/check-coverage.sh, scripts/test-features.sh.
  • Complete the tests review for tinysweeper/tests.
  • Complete the description review for tinysweeper/description.

How this fits together

flowchart LR
  n0["...lared_length_is_an_error_not_a_short_read<br/>changed"]:::changed
  n1["payload<br/>changed"]:::changed
  n2["bus"]:::impacted
  n3["new"]:::impacted
  n4["open_stream"]:::impacted
  n5["stream_ref"]:::impacted
  n6["with_len"]:::impacted
  n0 -->|calls| n1
  n0 -->|tests| n1
  n0 -->|calls| n2
  n0 -->|tests| n2
  n0 -->|calls| n3
  n0 -->|tests| n3
  n0 -->|calls| n4
  n0 -->|tests| n4
  n0 -->|calls| n5
  n0 -->|tests| n5
  n0 -->|calls| n6
  n0 -->|tests| n6
  n2 -->|calls| n3
  classDef changed fill:#0d4429,stroke:#238636,color:#e6edf3
  classDef impacted fill:#161b22,stroke:#6e7681,color:#c9d1d9
  classDef flagged fill:#5a1e02,stroke:#d93f0b,color:#ffffff
  classDef blocking fill:#67060c,stroke:#f85149,color:#ffffff
Loading
Agent review details

critique

  • Conclusion: Neutral
  • Scope reviewed: incomplete; unanswered: CHANGELOG.md, Cargo.toml, crates/tinybus/src/module/client_pinned_tests.rs, crates/tinybus/src/stream/mod.rs, crates/tinybus/src/stream/stream_tests.rs, scripts/check-coverage.sh, scripts/test-features.sh, scripts/test_check_coverage.py
  • Lane summary: Reviewed 0 files; 0 findings. 8 files could not be reviewed: CHANGELOG.md, Cargo.toml, crates/tinybus/src/module/client_pinned_tests.rs, crates/tinybus/src/stream/mod.rs, crates/tinybus/src/stream/stream_tests.rs, scripts/check-coverage.sh, scripts/test-features.sh, scripts/test_check_coverage.py.

security

  • Conclusion: Neutral
  • Scope reviewed: incomplete; unanswered: Cargo.toml, scripts/test_check_coverage.py, crates/tinybus/src/module/client_pinned_tests.rs, crates/tinybus/src/stream/mod.rs, crates/tinybus/src/stream/stream_tests.rs, scripts/check-coverage.sh, scripts/test-features.sh
  • Lane summary: Reviewed 0 files; 0 findings. 7 files could not be reviewed: Cargo.toml, scripts/test_check_coverage.py, crates/tinybus/src/module/client_pinned_tests.rs, crates/tinybus/src/stream/mod.rs, crates/tinybus/src/stream/stream_tests.rs, scripts/check-coverage.sh, scripts/test-features.sh. 1 file was not security-reviewed: CHANGELOG.md (prose or tabular data).

tests

  • Conclusion: Neutral
  • Scope reviewed: incomplete; unanswered: tinysweeper/tests
  • Lane summary: No reviewer produced a usable response.

commits

  • Conclusion: Neutral
  • Scope reviewed: all assigned evidence
  • Lane summary: Nothing sensitive found in what this pull request commits.

description

  • Conclusion: Neutral
  • Scope reviewed: incomplete; unanswered: tinysweeper/description
  • Lane summary: No reviewer produced a usable response.
Evidence and run details
  • Models: ladder/vectors-oai3
  • Spend: $0.000093
  • Tokens: 0 input · 0 output · 0 cached · 716 embedding
Head State Pass summary
1bc047d2a0e2 incomplete 0 active finding(s), 0 resolved finding(s) (at 2026-10-18T16:40:19Z)
1bc047d2a0e2 incomplete 0 active finding(s), 0 resolved finding(s) (at 2026-10-18T16:42:06Z)
1bc047d2a0e2 incomplete 0 active finding(s), 0 resolved finding(s) (at 2026-10-18T16:42:37Z)
1bc047d2a0e2 incomplete 0 active finding(s), 0 resolved finding(s) (at 2026-10-18T16:44:37Z)

tinysweeper 0.1.2

@tinysweeper tinysweeper Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

tinysweeper found nothing blocking, but could not review everything, so this is not an approval: Cargo.toml, crates/tinybus/src/module/client_pinned_tests.rs, crates/tinybus/src/stream/mod.rs, crates/tinybus/src/stream/stream_tests.rs, scripts/check-coverage.sh, scripts/test-features.sh, scripts/test_check_coverage.py, tinysweeper/description and 1 more.

          $0.0490 · 348,180 in / 74,846 out · 52,062 cached (15%) · ladder/vectors-oai3, deepseek-v4.1-flash,  · 716 embedded
critique: $0.0489 · 348,180 in / 74,846 out · 52,062 cached (15%) · deepseek-v4.1-flash,

@tinysweeper tinysweeper Bot added the priority: p3 Whenever. Cosmetic, a nicety, or a cleanup with no user visible effect. label Oct 18, 2026

@tinysweeper tinysweeper Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

tinysweeper found nothing blocking, but could not review everything, so this is not an approval: CHANGELOG.md, Cargo.toml, crates/tinybus/src/module/client_pinned_tests.rs, crates/tinybus/src/stream/mod.rs, crates/tinybus/src/stream/stream_tests.rs, scripts/check-coverage.sh, scripts/test-features.sh, scripts/test_check_coverage.py and 2 more.

$0.0001 · 0 in / 0 out · 716 embedded · ladder/vectors-oai3

@tinysweeper tinysweeper Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

tinysweeper found nothing blocking, but could not review everything, so this is not an approval: CHANGELOG.md, Cargo.toml, crates/tinybus/src/module/client_pinned_tests.rs, crates/tinybus/src/stream/mod.rs, crates/tinybus/src/stream/stream_tests.rs, scripts/check-coverage.sh, scripts/test-features.sh, scripts/test_check_coverage.py and 2 more.

$0.0001 · 0 in / 0 out · 716 embedded · ladder/vectors-oai3

@tinysweeper tinysweeper Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

tinysweeper found nothing blocking, but could not review everything, so this is not an approval: CHANGELOG.md, Cargo.toml, crates/tinybus/src/module/client_pinned_tests.rs, crates/tinybus/src/stream/mod.rs, crates/tinybus/src/stream/stream_tests.rs, scripts/check-coverage.sh, scripts/test-features.sh, scripts/test_check_coverage.py and 2 more.

$0.0001 · 0 in / 0 out · 716 embedded · ladder/vectors-oai3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority: p3 Whenever. Cosmetic, a nicety, or a cleanup with no user visible effect.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant