Skip to content

SDKs: stop recommending reporting for a cancelled Join branch - #1598

Merged
longquanzheng merged 3 commits into
mainfrom
fix/join-cancel-docs
Nov 11, 2026
Merged

longquanzheng merged 3 commits into
mainfrom
fix/join-cancel-docs

Conversation

@longquanzheng

Copy link
Copy Markdown
Contributor

Summary

Corrects the Join helper's doc comments in all five SDKs: they no longer recommend that the RPC that cancels a branch report a result for it.

  • New rule, the same in Go, Python, Java, TypeScript, and Rust: a cancelled branch never reports, and no other code can safely report for it. To avoid stalling an all-branches join, cancel the join Step together with its branches, or wait on AnyOf(<join condition>, Timer) and handle the timeout in Execute. A cancelling join's round is never reset with the remaining-branches condition; the next round forks a new round.
  • ReportBranchResult keeps its legitimate uses (a multi-Step branch reporting from a Step other than its last; an RPC reporting for a round it forked with an explicit key) and says never to report for a cancelled branch.
  • The integration tests that exercised the old pattern are renamed (e.g. TestJoinRPCReportsABranchResult) with a comment explaining why they cannot double-count; their behavior is unchanged.
  • Change logs: ## 1.45 (unreleased) ### Fixed in each SDK reference change log, and the SDKs' CHANGELOG.md. No version marker on the doc comments (a documentation correction, not an API or behavior change).

Why

Review of the Join docs PR (#1594) found the SDK doc comments contradicting skills. The recommendation is unsafe: Dex decides at commit time whether a cancellation takes effect, so the cancelling RPC cannot know whether the branch already reported. If it did, the cancellation does nothing and the RPC's report counts that branch twice, so an all-branches join can fire while another branch has not reported.

doc-map: no change needed: SDK doc comments and reference change logs; skills already state the correct rule

Testing

  • Go make docsCheck, go test ./dex/, gofmt, integ package vet.
  • Python scripts/check_public_docs.py, unit tests (706), ruff on changed files, integ collection.
  • Java ./gradlew javadoc compileTestJava test.
  • TypeScript npm run docs:check, typecheck, npm test (221).
  • Rust make docs-check (doctests), cargo fmt --check, unit tests (141), integ tests compile.
  • cd docs && npm run check.

The Join doc comments in all five SDKs told the RPC that cancels a branch
to report a result for it, to unblock an all-branches join or to make a
cancelling join's round resettable. That is unsafe: Dex decides at commit
time whether the cancellation takes effect, so the branch may already
have reported, and the extra report counts it twice.

State the rule instead: a canceled branch never reports and no other code
can safely report for it. Cancel the join Step with its branches or bound
the wait with a Timer, and never reset a cancelling join's round. Describe
only the legitimate uses of ReportBranchResult. Rename the integration
tests that exercise an RPC report so they no longer present it as a
workaround, and add change log entries.
…reports

The Join integration tests in all five SDKs still exercised an RPC that
cancels a branch and reports a result for it, the pattern the Join docs
now forbid. Replace that scenario with the documented safe workaround: an
RPC cancels the join Step together with every branch and moves to a
fallback Step. The tests assert that the canceled branch's release stays
pending, that nothing consumes the reported result, and that the Flow
completes through the fallback.

The explicit-key RPC fork tests now fork a handoff branch that ends
without reporting, and a later RPC call reports its result, which covers
the legitimate RPC use of ReportBranchResult. The ReportBranchResult doc
comments describe that condition: the result arrives through the RPC and
no Step of that branch reports it.
The Python and TypeScript RPC fork tests hard-coded the value that the
report RPC published. The RPC input now carries the result with the
JoinRound, as in Go, Java, and Rust, and the tests assert that value.
@longquanzheng
longquanzheng enabled auto-merge (squash) November 11, 2026 05:20
@codecov

codecov Bot commented Nov 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@longquanzheng
longquanzheng merged commit 81068d5 into main Nov 11, 2026
43 checks passed
@longquanzheng
longquanzheng deleted the fix/join-cancel-docs branch November 11, 2026 06:12
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