feat(sdk): expose outbox rows (attempts + next attempt time) behind a queued chat message #58
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/sdk-outbox-rows"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Card
t_d6cabc4b— the SDK half of the unmet sub-item int_f46a9863("queued (with age or attempt count)"): the TUI can renderqueued (try n/8, retry 45s)fromOutboxEntry::attempts/next_attempt_at(src/store.rs:149), butcrates/onionwire-sdkexposed neither field, so an Android chat row could only invent a countdown. Additive accessor only — no new state model,OutboxStatusstays the only source of truth.outbox()mapsNode::outbox_pending(src/node.rs:557) row-for-row.outbox_max_attempts()exists because a Kotlin consumer cannot readonionwire::outbox::DEFAULT_MAX_ATTEMPTS; without it the Android row would hardcode8and silently drift from the core's retry budget. It is a free function, not aWiremethod: it is a core constant, not per-node state.statusnever reads"sent"from this accessor — a delivered outbox row is deleted before it can be read (Store::mark_outbox_sent).next_attempt_atis only meaningful whilestatus == "queued": a terminal"failed"row keeps the last time it was scheduled for, so a client must not render it as a countdown (documented on the field).Base is
wt/t_9a29fd3c, notmain(on purpose)main'scrates/onionwire-sdk/src/lib.rsdoes not compile againstmain's outbox API: itssend()still returnsWResult<()>whileNode::sendreturnsResult<OutboxStatus, String>. PR #51 (wt/t_9a29fd3c) is the fix and is still open, so this branch is cut from its head. Retarget this PR tomainonce #51 is merged — until then the base keeps the diff to my own commit instead of swallowing #51's. The change is independent of #51's content: it touches only the newOutboxRow/outbox()/outbox_max_attempts()surface and the test module, so a textual conflict, if any, is one hunk incrates/onionwire-sdk/src/lib.rs.Evidence
cargo test --lockedincrates/onionwire-sdk— 6 lib tests, 2 integration tests, 0 failures:tests::outbox_row_carries_the_join_key_the_attempt_count_and_the_next_attempt_timetests::outbox_row_keeps_the_stores_own_status_encodingtests::a_failed_outbox_row_carries_the_cores_reason_verbatimtests::outbox_max_attempts_is_the_denominator_a_client_renders_againstsent_is_sent_everything_else_is_queued,delivery_is_reported_for_outgoing_rows_only)cargo clippy --locked --all-targets -- -D warnings— exit 0.uniffi-bindgen --library libonionwire_sdk.so --language kotlin):Wire::send() -> SendStateandChatMessage.deliveryare untouched, so #51/#52/#56 keep working.Not in this PR
android/**consumption (the row textqueued (try n/8, retry 45s)and theN queuedfooter wording) — that is a separate card, as the board requires.The TUI can say why a queued row is still queued ('queued (try n/8, retry 45s)') because it reads OutboxEntry::attempts and next_attempt_at directly. The SDK exposed neither: ChatMessage.delivery is a flat 'queued'/'sending'/'failed: <reason>' string and Wire had no outbox accessor, so an Android chat row could only invent a countdown. Adds OutboxRow { message_id, status, attempts, next_attempt_at, last_error } and Wire::outbox(pubkey_hex) over Node::outbox_pending, plus outbox_max_attempts() so the client renders 'try n/8' against the core's own budget instead of a hardcoded 8. Additive: Wire::send() and ChatMessage.delivery are untouched.queued (try 3/8, retry 45s)from the SDK outbox rows #59queued (try 3/8, retry 45s)from the SDK outbox rows #59c6a586c2da6437f9ee906437f9ee90f304f78628f304f7862837742a5e0937742a5e091d52df852937742a5)5962c6a229cce0721ba9queued (try 3/8, retry 45s)from the SDK's outbox rows 0999601e6aqueued (try 3/8, retry 45s)from the SDK outbox rows' (#59) from wt/t_f8658427 into feat/sdk-outbox-rows563388d18dfc2b2197c7