Add StreamSession passive subscribe tests and docs#31
Merged
ajit-zer07 merged 1 commit intomainfrom Apr 21, 2026
Merged
Conversation
Pin macp-proto to 0.1.2 (published crate) so CI resolves the subscribe_session_id + after_sequence fields without needing the spec repo co-cloned. Add 8 unit tests in src/server.rs covering process_subscribe_frame authz (initiator / participant / observer / outsider), history replay, after_sequence filtering, and the envelope-vs-subscribe mutual-exclusion rule. Add a Tier 1 integration suite (integration_tests/tests/tier1_protocol/test_passive_subscribe.rs, 6 tests) that drives the real gRPC bidi stream: replay from zero, replay with offset, unknown-session termination, non-participant inline FORBIDDEN, late-joiner replay-then-live, and invalid mixed frames. Document the feature in docs/API.md, docs/sdk-guide.md, docs/testing.md, and README.md.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
macp-prototo0.1.2from crates.io so CI can build the passive-subscribe code landed earlier on this branch (previously a local path dep that CI cannot resolve).StreamSessionpassive subscribe flow introduced insrc/{server,runtime,log_store}.rs.docs/API.md,docs/sdk-guide.md,docs/testing.md, andREADME.mdto describe the subscribe-only frame contract, authorization rules, andafter_sequencesemantics.
What changed
Dependency
Cargo.toml/Cargo.lock—macp-proto = "0.1.2"(was a path dep to the spec repo).Unit tests (
src/server.rs, +8)subscribe_replays_session_history_from_zerosubscribe_after_sequence_filters_historysubscribe_unknown_session_returns_not_foundsubscribe_non_participant_is_forbiddensubscribe_observer_identity_allowedsubscribe_initiator_allowed_even_when_not_listedstream_request_with_envelope_and_subscribe_is_rejectedsubscribe_to_different_session_on_bound_stream_is_rejectedIntegration tests (
integration_tests/tests/tier1_protocol/test_passive_subscribe.rs, +6)NotFoundFORBIDDENerror frame; stream stays openEvaluationenvelopeandsubscribe_session_idrejected withInvalidArgumenttokio-stream = "0.1"(forReceiverStreamon the request side)Docs
docs/API.md— extendedStreamSessionsection with subscribe-only frame semantics and authzdocs/sdk-guide.md— added passive subscribe to the StreamSession lifecycle stepsdocs/testing.md— references the newtest_passive_subscribe.rsin the Tier 1 descriptionREADME.md— new bullet under theStreamSession enabledblockFormatting
cargo fmt --allinintegration_teststouched two pre-existing files (tier1_jwt.rs,test_validation_gaps.rs). Whitespace only; these drifted because the main CIcargo fmtjob does not traverse theintegration_testscrate.Test plan
cargo fmt --all -- --check— clean in both cratescargo clippy --all-targets -- -D warnings— clean in both cratesMACP_MEMORY_ONLY=1 cargo test --all-targets— all runtime unit + integration tests passMACP_TEST_BINARY=../target/debug/macp-runtime cargo test --test tier1 -- --test-threads=1— 67/67 pass (was 61)cargo build --release— succeedscargo audit— exit 0ci.yml,integration-tests.yml)