Skip to content

[#455] Task 3: SolidQueueAdapter success status 'unproven' (wallet action only) #458

@sgbett

Description

@sgbett

Part of #455.

Summary

Replace 'completed' with 'unproven' on the SolidQueueAdapter broadcast success path (wallet action status only). The job-queue row status stays 'completed' — it is a separate domain.

IMPORTANT — two 'completed' strings in solid_queue_adapter.rb

This file contains two distinct 'completed' statuses that must be kept separate:

Location Domain Action
Line ~275 wallet_broadcast_jobs row status (job-queue lifecycle) Stays 'completed' — the job row correctly moves to the completed state when processed.
Line ~292 wallet_actions row status (wallet action semantic) Changes to 'unproven' — the broadcast succeeded, but the tx is not proven until a merkle proof arrives.

Same for the finalize path: the job-queue 'completed' stays; the wallet-action 'completed' becomes 'unproven'.

Scope

  • gem/bsv-wallet-postgres/lib/bsv/wallet_postgres/solid_queue_adapter.rb

Changes

  • promote (line ~289-293): change line ~292 from
    @storage.update_action_status(txid, 'completed')
    to
    @storage.update_action_status(txid, 'unproven')
  • Line ~275 (job row status) stays 'completed'.
  • Any other update_action_status(..., 'completed') call in the broadcast-success path → 'unproven'.
  • Update docstring at line ~280-288 to reflect that a successful broadcast produces 'unproven' action status, pending merkle proof.

Acceptance criteria

  • Worker success path: wallet_actions.status = 'unproven' AND wallet_broadcast_jobs.status = 'completed'.
  • Worker failure path: both rows 'failed' (regression).
  • Stale-job retry success: wallet_actions.status = 'unproven' on second-attempt success; job row 'completed'.
  • Finalize-path success via worker: same — wallet 'unproven', job 'completed'.

Edge cases

  • Finalize path (no outpoints) on SolidQueue success — same logic as inline: wallet action 'unproven'.
  • txid nil — already guarded at line ~292 with if txid.
  • Broadcast attempts that succeed after stale-job retry — same status transition; only the wallet row moves to 'unproven'.

Test scenarios

  • worker success path → action_status is 'unproven' (spec line ~263)
  • worker success path → job status is 'completed' (spec line ~251 — regression)
  • worker finalize path success → action_status is 'unproven' (spec line ~333)
  • worker finalize path success → job status is 'completed' (spec line ~337 — regression)
  • stale-job retry success → job status is 'completed' (spec line ~405 — regression)
  • worker failure path → action_status is 'failed' (regression)

Files modified

  • gem/bsv-wallet-postgres/lib/bsv/wallet_postgres/solid_queue_adapter.rb
  • gem/bsv-wallet-postgres/spec/bsv/wallet_postgres/solid_queue_adapter_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 — SolidQueueAdapter overrides it).

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