fix: add stream_count view fn and fix resume_stream status#964
fix: add stream_count view fn and fix resume_stream status#964Anthony-19 wants to merge 1 commit into
Conversation
… guard Closes LabsCrypt#421 — stream_count() -> u64 - Add stream_count() read-only function that returns the global StreamCounter value (monotonically increasing, equals the highest stream ID ever issued, never decrements on cancel/complete). - Returns 0 on a freshly-deployed contract with no streams. - Add TypeScript binding fetchStreamCount() in frontend/src/lib/soroban.ts that simulates the view call without wallet auth. - Unit tests: stream_count_returns_zero_on_fresh_contract, stream_count_increments_by_one_per_create, stream_count_is_not_decremented_by_cancel, stream_count_matches_last_stream_id. Closes LabsCrypt#787 — resume_stream status guard - resume_stream now checks stream.status == Paused (not just stream.paused), so a stream cancelled while paused (status=Cancelled, paused=true) correctly returns StreamInactive instead of being resurrected to Active. - cancel_stream now explicitly clears stream.paused = false and stream.paused_at = None when settling a cancellation, ensuring no stale pause state survives into the Cancelled record. - Unit tests: resume_after_cancel_while_paused_returns_stream_inactive, cancel_while_paused_clears_pause_fields, cancel_normal_stream_also_clears_pause_fields.
|
heads up: main's ci was broken (the Backend CI and Backend Docker Image CI jobs) until the fixes in #969 and #974 just landed, so the red backend/docker checks on this pr are almost certainly stale, they ran against the broken main. please rebase to re-test against the now-green main: |
|
the stream_count() + the resume_stream pause-state guard look fine, the red is in untouched files (worker Prisma export, deprecated.test.ts), stale base. rebase: |
Closes #421
Closes #787