Skip to content

feat: message ack with atomic cleanup (story 1.8)#8

Closed
vieiralucas wants to merge 0 commit intofeat/1-7-consumer-lease-message-deliveryfrom
feat/1-8-message-acknowledgment
Closed

feat: message ack with atomic cleanup (story 1.8)#8
vieiralucas wants to merge 0 commit intofeat/1-7-consumer-lease-message-deliveryfrom
feat/1-8-message-acknowledgment

Conversation

@vieiralucas
Copy link
Copy Markdown
Member

@vieiralucas vieiralucas commented Feb 11, 2026

Summary

  • Implement handle_ack in scheduler: validates lease exists, parses expiry from lease value, finds message key by scanning messages CF, atomically deletes message + lease + lease_expiry via WriteBatch
  • Implement Ack gRPC RPC with UUID parsing and input validation
  • Add parse_expiry_from_lease_value() to keys module
  • Acking unknown or already-acked message returns NOT_FOUND (idempotent)

Test plan

  • Full lifecycle: enqueue -> lease -> ack -> verify message and lease deleted from storage
  • Ack unknown message returns MessageNotFound
  • Double ack returns MessageNotFound on second call (idempotent)
  • Ack without lease returns error
  • 44 tests pass, clippy clean, cargo fmt clean

Summary by cubic

Implements end-to-end message acknowledgment for Story 1.8. On ack, the scheduler atomically deletes the message, lease, and lease expiry; unknown, double-acked, or missing messages/queues return NOT_FOUND.

  • New Features

    • Scheduler: handle_ack verifies lease, parses expiry, finds the message, and deletes message/lease/lease_expiry in one WriteBatch.
    • gRPC: Ack RPC with input validation and UUID parsing; maps AckError to NOT_FOUND or INTERNAL.
    • Keys: added parse_expiry_from_lease_value helper.
  • Bug Fixes

    • Use StorageError::CorruptData for corrupt lease values.

Written for commit 3d21a80. Summary will update on new commits.

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 5 files

@vieiralucas vieiralucas force-pushed the feat/1-7-consumer-lease-message-delivery branch from c7ceec9 to 3f41912 Compare February 11, 2026 12:10
@vieiralucas vieiralucas force-pushed the feat/1-8-message-acknowledgment branch from f13c613 to 1e1eb19 Compare February 11, 2026 12:13
@vieiralucas vieiralucas force-pushed the feat/1-7-consumer-lease-message-delivery branch from 3f41912 to c56d405 Compare February 11, 2026 13:18
@vieiralucas vieiralucas force-pushed the feat/1-8-message-acknowledgment branch from 1e1eb19 to 73640dd Compare February 11, 2026 13:18
@vieiralucas vieiralucas force-pushed the feat/1-7-consumer-lease-message-delivery branch from c56d405 to 75dd9e7 Compare February 11, 2026 16:10
@vieiralucas vieiralucas force-pushed the feat/1-8-message-acknowledgment branch from 73640dd to 1b962e3 Compare February 11, 2026 16:10
@vieiralucas vieiralucas force-pushed the feat/1-7-consumer-lease-message-delivery branch from 75dd9e7 to df92fa9 Compare February 11, 2026 16:11
@vieiralucas vieiralucas force-pushed the feat/1-8-message-acknowledgment branch from 1b962e3 to 4b74411 Compare February 11, 2026 16:11
@vieiralucas vieiralucas force-pushed the feat/1-7-consumer-lease-message-delivery branch from df92fa9 to 4222fdc Compare February 11, 2026 16:18
@vieiralucas vieiralucas force-pushed the feat/1-8-message-acknowledgment branch 2 times, most recently from 9dd102a to e695dd0 Compare February 11, 2026 16:21
@vieiralucas vieiralucas force-pushed the feat/1-7-consumer-lease-message-delivery branch 2 times, most recently from 5841b6c to 6d915b3 Compare February 11, 2026 16:23
@vieiralucas vieiralucas force-pushed the feat/1-8-message-acknowledgment branch from e695dd0 to 7ccb2f4 Compare February 11, 2026 16:23
@vieiralucas vieiralucas force-pushed the feat/1-7-consumer-lease-message-delivery branch from 6d915b3 to b8e0d37 Compare February 11, 2026 21:00
@vieiralucas vieiralucas force-pushed the feat/1-8-message-acknowledgment branch from 7ccb2f4 to 7537a50 Compare February 11, 2026 21:00
@vieiralucas vieiralucas force-pushed the feat/1-7-consumer-lease-message-delivery branch from b8e0d37 to f66134b Compare February 11, 2026 21:03
@vieiralucas vieiralucas force-pushed the feat/1-8-message-acknowledgment branch from 7537a50 to d794ecd Compare February 11, 2026 21:03
@vieiralucas vieiralucas force-pushed the feat/1-7-consumer-lease-message-delivery branch from f66134b to 0b01ecd Compare February 11, 2026 21:15
@vieiralucas vieiralucas force-pushed the feat/1-8-message-acknowledgment branch from d794ecd to 6918a46 Compare February 11, 2026 21:15
@vieiralucas vieiralucas force-pushed the feat/1-7-consumer-lease-message-delivery branch from 0b01ecd to 03f341c Compare February 11, 2026 21:33
@vieiralucas vieiralucas force-pushed the feat/1-8-message-acknowledgment branch from 6918a46 to ac33d31 Compare February 11, 2026 21:33
@vieiralucas vieiralucas force-pushed the feat/1-7-consumer-lease-message-delivery branch from 03f341c to 942a6e7 Compare February 11, 2026 21:38
@vieiralucas vieiralucas force-pushed the feat/1-8-message-acknowledgment branch 2 times, most recently from 7020540 to 7a90273 Compare February 11, 2026 22:02
@vieiralucas vieiralucas force-pushed the feat/1-7-consumer-lease-message-delivery branch from c17df24 to aa08438 Compare February 12, 2026 01:03
@vieiralucas vieiralucas force-pushed the feat/1-8-message-acknowledgment branch from 7a90273 to 69e45f6 Compare February 12, 2026 01:03
@vieiralucas vieiralucas force-pushed the feat/1-8-message-acknowledgment branch from 69e45f6 to 3d21a80 Compare February 12, 2026 01:18
vieiralucas added a commit that referenced this pull request Mar 18, 2026
- apply_to_broker_storage now returns Result and propagates StorageError
  instead of silently swallowing storage failures (cubic #1)
- add DeleteLeaseExpiry mutation in ack/nack replication paths to clean up
  orphaned lease expiry entries (cubic #3)
- fix no-op leased_msg_keys.retain in recovery — now properly clears
  entries for the recovering queue before rebuild (cubic #4)
- warn when create_group is called without broker_storage set (cubic #5)
- check send_command result in watch_leader_changes — only update leading
  state on success so next poll retries on failure (cubic #6, #7)
- trigger RecoverQueue on first-sight leader state to catch messages
  replicated between startup and first poll (cubic #8)
- replace catch-all _ => {} with explicit variant listing in
  apply_to_broker_storage for compiler-enforced exhaustiveness
vieiralucas added a commit that referenced this pull request Mar 18, 2026
- apply_to_broker_storage now returns Result and propagates StorageError
  instead of silently swallowing storage failures (cubic #1)
- add DeleteLeaseExpiry mutation in ack/nack replication paths to clean up
  orphaned lease expiry entries (cubic #3)
- fix no-op leased_msg_keys.retain in recovery — now properly clears
  entries for the recovering queue before rebuild (cubic #4)
- warn when create_group is called without broker_storage set (cubic #5)
- check send_command result in watch_leader_changes — only update leading
  state on success so next poll retries on failure (cubic #6, #7)
- trigger RecoverQueue on first-sight leader state to catch messages
  replicated between startup and first poll (cubic #8)
- replace catch-all _ => {} with explicit variant listing in
  apply_to_broker_storage for compiler-enforced exhaustiveness
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant