Skip to content

[BUG]: RequestSpendView in multisig blocks forever — WithTimeout() exists but is never applied to the channel wait #1671#1890

Open
adecaro wants to merge 1 commit into
mainfrom
1671-bug-requestspendview-in-multisig-blocks-forever-withtimeout-exists-but-is-never-applied-to-the-channel-wait
Open

[BUG]: RequestSpendView in multisig blocks forever — WithTimeout() exists but is never applied to the channel wait #1671#1890
adecaro wants to merge 1 commit into
mainfrom
1671-bug-requestspendview-in-multisig-blocks-forever-withtimeout-exists-but-is-never-applied-to-the-channel-wait

Conversation

@adecaro

@adecaro adecaro commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Fixes #1671: RequestSpendView.Call() in the multisig and boolpolicy identity services could block forever waiting for a co-signer's answer, since the timeout field/WithTimeout() setter
on multisig.RequestSpendView were dead code (never applied to the wait loop), and boolpolicy.RequestSpendView had no timeout knob at all.

  • Extracted the duplicated fan-out/collect pattern into a new generic utils.AnswersCollector[K, T] (token/services/utils/collector.go), which bounds the wait with a per-call timeout
    (defaulting to 30s if unset) and honors context cancellation, returning a descriptive wrapped error either way.
  • Rewired multisig/spend.go to actually apply its timeout/WithTimeout() via the new collector, and added the same timeout field + WithTimeout() setter to boolpolicy/spend.go, which
    previously had none.
  • Added regression tests for both packages proving Call now returns promptly (instead of hanging) when a co-signer/co-owner never responds, plus a happy-path test, and unit tests for
    the collector itself (all-answers, worker error, timeout, context cancellation, late-send-after-return).

Additional changes

  • Enforced a new coding rule: never use fmt.Errorf/fmt to construct or wrap errors — always use github.com/hyperledger-labs/fabric-smart-client/pkg/utils/errors (New, Errorf, Wrap,
    Wrapf, WithMessage, WithMessagef, Join, etc.). Documented this in AGENTS.md and fixed the one violation found in docs/upgradability.md, plus rewrote collector.go's two error sites to
    use errors.Join/errors.Wrapf instead of fmt.Errorf.
  • Added a "Documentation Updates" workflow rule to AGENTS.md requiring docs/ to be updated (when affected) before any task is reported as complete.

@adecaro adecaro added this to the Q3/26 milestone Jul 10, 2026
@adecaro adecaro self-assigned this Jul 10, 2026
@adecaro adecaro added the bug Something isn't working label Jul 10, 2026
@adecaro adecaro force-pushed the 1671-bug-requestspendview-in-multisig-blocks-forever-withtimeout-exists-but-is-never-applied-to-the-channel-wait branch from 3021578 to bbba1b4 Compare July 10, 2026 14:39
Signed-off-by: Angelo De Caro <adc@zurich.ibm.com>

# Conflicts:
#	AGENTS.md
@adecaro adecaro force-pushed the 1671-bug-requestspendview-in-multisig-blocks-forever-withtimeout-exists-but-is-never-applied-to-the-channel-wait branch from bbba1b4 to 8f8b4b8 Compare July 11, 2026 05:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: RequestSpendView in multisig blocks forever — WithTimeout() exists but is never applied to the channel wait

1 participant