Skip to content

STORY: Orchestrate transfer saga with ledger-driven completion #103

Closed
7 of 7 issues completed
Closed

Description

@ramioooz

Type: Story
Epic: Ledger and Financial Posting
Slice: Slice 5 - Internal Transfer
Service: transaction-service
Priority: P0

Implement transfer orchestration so transfer status is driven by account reservation and ledger posting outcomes.

Scope:

  • Create transfer PENDING.
  • Request account reservation.
  • Request ledger posting after reservation succeeds.
  • Consume LedgerPostingCompleted and LedgerPostingFailed events.
  • Mark transfers COMPLETED, FAILED, or REVERSED according to saga outcome.

Definition of Done:

  • Transaction Service does not directly command Account Service to post final debit-credit effects.
  • Compensating actions are explicit for reservation release and posting failure.
  • Transfer status changes are idempotent and event-deduplicated.
  • Tests cover success, reservation failure, ledger posting failure, duplicate events, and retry behavior.

Activity

  1. added theissue type on Aug 2, 2026
  2. self-assigned this
    on Aug 30, 2026
  3. ramioooz commented on Sep 1, 2026

    @ramioooz
    MemberAuthor

    Sprint 3 transfer-saga implementation evidence: Transaction Service PRs #6, #7, #8, #9, #10, #11, and #12 are merged. They implement the transfer lifecycle, process manager, internal HTTP API, authorization, transactional outboxes, reservation transport, and ledger transport. Child task #182 is complete. SIT end-to-end rollout validation remains the next operational checkpoint.

  4. ramioooz commented on Sep 3, 2026

    @ramioooz
    MemberAuthor

    Reopened for accurate delivery tracking. The transfer implementation PRs #6-#12 were merged into stacked feature branches, but the resulting code is not yet on transaction-service main. Integration PR: digital-bank-java/transaction-service#13. The story will return to Done after PR #13 is reviewed and merged, followed by SIT rollout verification.

  5. ramioooz commented on Sep 3, 2026

    @ramioooz
    MemberAuthor

    2026-09-04 verification update

    Transaction Service mainline at commit c97b156 (after PR #13 and PR #14) passes ./mvnw verify:

    • 80 unit-phase tests passed
    • 15 PostgreSQL-backed integration tests passed

    The transfer process manager, durable workflow state, inbox, and Kafka transport are present on main. SIT end-to-end verification remains pending because Transaction Service is not deployed in digital-bank-sit. Remaining rollout dependencies are transaction-service#15 and config-repo#38, followed by deployment and Kafka verification. The auth-service-secrets Secret is now present in SIT.

  6. ramioooz commented on Sep 3, 2026

    @ramioooz
    MemberAuthor

    SIT verification update after merged transaction-service#15 and config-repo#38:

    • Transaction Service image digital-bank-java/transaction-service:0.0.3 deployed successfully from merged main.
    • Helm release transaction-service is deployed in digital-bank-sit.
    • Pod and deployment are 1/1; /actuator/health reports liveness and readiness groups UP.
    • PostgreSQL startup/migrations completed and Kafka consumers initialized for ledger and reservation event topics.
    • Full transfer saga verification remains pending because Account reservation integration and the remaining saga test prerequisites are separate Sprint 3 work.

    This does not close the story yet; it records the Transaction Service runtime prerequisite as complete.

  7. ramioooz commented on Sep 5, 2026

    @ramioooz
    MemberAuthor

    Current Sprint 3 checkpoint: transaction-service#22 is the reviewable consistency fix for exact ledger completion-line validation; all checks are green and it remains open. The manual SIT guide is refreshed in .github#241 for the deployed transfer-bound MFA flow. Keep this story open until controlled successful transfer, duplicate delivery, and malformed-event DLQ evidence is recorded.

  8. 5 remaining items

  9. ramioooz commented on Sep 6, 2026

    @ramioooz
    MemberAuthor

    Summary

    • Keep a transfer in AWAITING_RESERVATION_RELEASE after LedgerPostingFailed.
    • Stop Transaction Service from emitting a duplicate reservation-release command; Account Service owns that compensation from the ledger-failure fact.
    • Align the README and process-manager design documents with the governed event flow.
    • Update the focused process-manager test to protect the no-duplicate-command invariant.

    Verification

    • Focused regression test: passed before and after the production change.
    • ./mvnw --batch-mode --no-transfer-progress test: 96 tests passed.
    • ./mvnw --batch-mode --no-transfer-progress verify -DskipUnitTests=true: 16 integration tests passed with Testcontainers.
    • git diff --check: passed.

    Relates to #103.

  10. ramioooz commented on Sep 6, 2026

    @ramioooz
    MemberAuthor

    Account-owned release correction

    Reviewable PR: transaction-service#26

    The PR removes the duplicate ReleaseAccountReservation command after LedgerPostingFailed. Transaction Service now persists AWAITING_RESERVATION_RELEASE and waits for Account Service's AccountReservationReleased.v1 fact. All existing unit, integration, Helm, and container checks pass.

    The story remains open for the controlled SIT transfer success, rejection, duplicate-delivery, and compensation evidence.

  11. ramioooz commented on Sep 6, 2026

    @ramioooz
    MemberAuthor

    Terminal transfer outcome wave is merged and rolled out to local SIT. transaction-service#27 publishes durable TransferCompleted.v1 and TransferFailed.v1 facts; config-repo#49 enables the publisher in SIT; infra-sit#42 provisions the terminal topics and DLQs. Transaction Service 0.0.6 is healthy, Config Server serves terminal settings, and Kafka lists both terminal topics and DLQs. The Account Service timestamp compatibility fix is merged in account-service#42.

  12. ramioooz commented on Sep 6, 2026

    @ramioooz
    MemberAuthor

    Tracking update: all six native child items are now closed, including #244. The implementation and SIT infrastructure are complete, but the story remains open intentionally for the final controlled acceptance: a positive-balance transfer, duplicate terminal-event delivery proof, and malformed-event DLQ proof.

  13. ramioooz commented on Sep 6, 2026

    @ramioooz
    MemberAuthor

    2026-09-07 SIT update: the merged terminal-event rollout initially exposed a Transaction Service startup defect when multiple KafkaTemplate beans were enabled. Follow-up transaction-service PR #28 explicitly qualifies the transaction event publishers and is open for review. The rebuilt candidate is healthy in SIT and returned X-Correlation-ID logging-fix-20260907 with a matching structured HTTP request-completed record. The story remains open for positive-balance successful transfer, duplicate delivery, and malformed-event DLQ evidence.

  14. ramioooz commented on Sep 7, 2026

    @ramioooz
    MemberAuthor

    Ledger posting-command recovery is implemented for review in ledger-service #23. The Ledger consumer now has bounded retries and publishes malformed/unprocessable records to ledger.posting.requested.v1.dlq while preserving valid business-failure handling through LedgerPostingFailed.v1. The handoff entry is tracked in .github #256. Post-merge SIT verification remains required for a malformed event, DLQ publication, and partition recovery.

  15. ramioooz commented on Sep 7, 2026

    @ramioooz
    MemberAuthor

    Post-merge SIT acceptance completed for the Ledger posting-command DLQ slice.\n\n- Merged implementation: ledger-service #23\n- Merged handoff design: .github #256\n- Reviewable handoff evidence: .github #257\n- Image: \n- Helm revision: 10 in \n- Deployment: ready, zero restarts; profile ; Flyway current through version 9.\n- Kafka consumer group: is Stable with one member assigned to .\n- Controlled malformed record key reached after bounded retries.\n- Source offset committed: current 1, log end 1, lag 0.\n- Read-only PostgreSQL verification: , ; no business inbox or ledger posting was created.\n- No database mutation was used during verification.\n\nThis closes the malformed-event recovery acceptance for the Ledger portion of this story. The remaining story boundary is controlled positive-balance transfer success, duplicate delivery, and end-to-end consistency evidence.

  16. ramioooz commented on Sep 7, 2026

    @ramioooz
    MemberAuthor

    Post-merge SIT acceptance completed for the Ledger posting-command DLQ slice.

    • Merged implementation: ledger-service #23
    • Merged handoff design: .github #256
    • Reviewable handoff evidence: .github #257
    • Image: digital-bank-java/ledger-service:sit-dlq-20260907
    • Helm revision: 10 in digital-bank-sit
    • Deployment: 1/1 ready, zero restarts; profile sit; Flyway current through version 9.
    • Kafka consumer group: ledger-service is Stable with one member assigned to ledger.posting.requested.v1-0.
    • Controlled malformed record key dlq-sit-1788788306489 reached ledger.posting.requested.v1.dlq after bounded retries.
    • Source offset committed: current 1, log end 1, lag 0.
    • Read-only PostgreSQL verification: ledger_posting_command_inbox_rows=0, dlq_test_ids=0; no business inbox or ledger posting was created.
    • No database mutation was used during verification.

    This closes the malformed-event recovery acceptance for the Ledger portion of this story. The remaining story boundary is controlled positive-balance transfer success, duplicate delivery, and end-to-end consistency evidence.

    Correction: the preceding comment was posted with shell-escaped Markdown rendered incorrectly. This file-backed comment is the authoritative evidence record.

  17. ramioooz commented on Sep 7, 2026

    @ramioooz
    MemberAuthor

    Account reservation timestamp rollout

    The controlled SIT data exposed a stale deployment problem in the reservation event path:

    • Account Service consumed two synthetic reservation requests and published two AccountReservationRejected.v1 decisions.
    • Transaction Service rejected both records because the deployed payload did not contain the required occurredAt field; both records were routed to account.reservation.rejected.v1.dlq.
    • The timestamp serialization fix is already merged in account-service #42 and present on Account Service main through commit f787876.
    • Built digital-bank-java/account-service:sit-account-main-20260907 from merged main. The image build passed the existing verification with 65 unit-phase tests and no failures.
    • Rolled out with Helm revision 11 in digital-bank-sit; the Account Service deployment is healthy with one ready replica.

    The two historical DLQ records were not replayed or modified. A fresh authorized synthetic transfer is still required to prove the complete saga path: success, reservation rejection to FAILED, duplicate terminal-event idempotency, and ledger-failure compensation. No credential or secret value was read or recorded.

  18. ramioooz commented on Sep 8, 2026

    @ramioooz
    MemberAuthor

    SIT acceptance attempt - 2026-09-08

    • The documented synthetic Auth fixture was attempted through the API Gateway.
    • Result: HTTP 401 with the configured authentication-failure Problem Details response; no access token was issued.
    • No transfer, reservation, ledger, outbox, inbox, or Kafka business mutation occurred.
    • The protected Sprint 3 scenarios remain pending an approved SIT fixture.
    • No credential, password, token, OTP, or secret value is recorded here.
  19. ramioooz commented on Sep 8, 2026

    @ramioooz
    MemberAuthor

    SIT acceptance checkpoint - 2026-09-08

    Fresh read-only verification confirms the platform is healthy, but the protected transfer acceptance cannot be completed without an approved SIT Auth fixture:

    • Gateway health: HTTP 200.
    • Customer, Account, and Transaction Service health through the Gateway: HTTP 200.
    • Ledger health is intentionally not a public Gateway route.
    • Centralized Swagger and protected customer/account routes correctly require authentication.
    • Direct Transaction Service transfer access also returns HTTP 401 (authentication-required), so bypassing the Gateway does not remove the authorization requirement.
    • The documented alice@example.com fixture attempt returned HTTP 401; no token or business mutation was produced.
    • No Kubernetes Secret value was read, no existing Secret was changed, no temporary Secret was created, and no deployment override was applied.
    • No customer, account, reservation, ledger, outbox, inbox, or Kafka business record was created by this attempt.

    The remaining acceptance boundary is unchanged: positive-balance completion, insufficient-balance rejection to FAILED, duplicate terminal-event idempotency, and account-owned compensation. A valid approved SIT fixture for the configured transfer-orchestrator subject is required to execute those scenarios end to end.

  20. ramioooz commented on Sep 8, 2026

    @ramioooz
    MemberAuthor

    Root-cause update - 2026-09-08

    The acceptance blocker is broader than the missing Auth credential:

    • Aggregate-only Account Service verification found 6 SIT accounts and 0 accounts with a positive available balance.
    • The Account database contains 0 reservation rows and 0 ledger-outcome inbox rows, so there is no reusable synthetic reservation or posting history.
    • Account opening correctly initializes current and available balances to zero.
    • The architecture intentionally exposes no direct balance-update API.
    • Consequently, a successful positive-balance transfer cannot be created in the current SIT environment even after authentication; a governed SIT funding fixture or a later cash-in/deposit capability is required.

    No database row was inserted, updated, deleted, or replayed during this investigation. This is now the authoritative acceptance blocker alongside the missing approved transfer-orchestrator credential.

  21. ramioooz commented on Sep 10, 2026

    @ramioooz
    MemberAuthor

    Transfer saga acceptance completed

    The merged Transaction, Account, Ledger, Gateway, and SIT infrastructure work has been verified in the approved controlled local-SIT fixture. Evidence covers successful reservation and Ledger completion, insufficient-funds rejection, Ledger failure compensation with reservation release, and duplicate Ledger completion without duplicate terminal output.

    MFA step-up assurance remains separately tracked under Sprint 4 #208 and is not part of this story closeout.

    Closes the Sprint 3 ledger-driven transfer orchestration story.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions