Skip to content

[#455] Task 2: InlineQueue success status 'unproven' + remove silent fallback #457

@sgbett

Description

@sgbett

Part of #455.

Summary

Replace 'completed' with 'unproven' on the InlineQueue broadcast success path, and remove the silent-fallback promote_without_broadcast branch that marked actions 'completed' when no broadcaster was configured.

Scope

  • gem/bsv-wallet/lib/bsv/wallet_interface/inline_queue.rb

Changes

  • broadcast_and_promote (lines ~75-110): pass explicit status: 'unproven' to promote at line ~100.
  • promote_without_broadcast (lines ~120-131):
    • Remove the delayed ? 'unproven' : 'completed' branch (line ~127).
    • Raise BSV::Wallet::WalletError if accept_delayed_broadcast is not set (defensive guard — Task 1 validates at create_action/sign_action entry, but this guard catches any future code path that still reaches here without opting into delayed broadcast).
    • Otherwise always set 'unproven'.
  • promote (line ~143): keep the default status: 'completed' signature for backwards compatibility with other call sites, but in practice all internal call sites now pass explicit status.
  • Update docstrings at lines ~112-119 to reflect the new semantics.

Acceptance criteria

  • After successful broadcast via InlineQueue#broadcast_and_promote, the action row in storage has status: 'unproven'.
  • InlineQueue#promote_without_broadcast with accept_delayed_broadcast: true → action status 'unproven'.
  • InlineQueue#promote_without_broadcast with accept_delayed_broadcast: false (or absent) → raises WalletError.
  • Failure path still sets 'failed' (regression — line ~89 unchanged).
  • Finalize-path (nil outpoints) + broadcaster success → 'unproven' (not 'completed').
  • promote signature unchanged (still defaults to 'completed') — no breakage for third-party callers if any exist.

Edge cases

  • Finalize path with nil outpoints: promote(nil, nil, txid, status: 'unproven') — the existing Array(input_outpoints).each handles nil correctly (line ~144-145). Must pass explicit status or the default 'completed' leaks through.
  • txid nil (unlikely but possible): skip update_action_status (already guarded at line ~146 via if txid).
  • Rollback path is unchanged — keeps 'failed'.

Test scenarios

  • success with broadcaster, auto-fund payload → action status is 'unproven'
  • success with broadcaster, finalize payload (nil outpoints) → action status is 'unproven'
  • no broadcaster, accept_delayed_broadcast: true → action status is 'unproven'
  • no broadcaster, accept_delayed_broadcast: false → raises WalletError
  • no broadcaster, accept_delayed_broadcast absent → raises WalletError
  • broadcast failure → action status is 'failed' (regression)

Files modified

  • gem/bsv-wallet/lib/bsv/wallet_interface/inline_queue.rb
  • gem/bsv-wallet/spec/bsv/wallet_interface/inline_queue_spec.rb (Task 5 owns the broader spec migration; direct test additions for this file's new behaviour land here)

Sequencing

Lands after Task 1 (depends on broadcast_enabled? being in place on the BroadcastQueue interface).

Metadata

Metadata

Assignees

No one assigned

    Labels

    gem:walletbsv-wallet companion gemlayer:walletBSV::Wallet moduletaskImplementation task

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions