Skip to content

Create payment intents and order rows atomically #76

Closed

Description

@ctfbruce

Problem

LockPrice inserts orders one at a time before the transaction intent is created. A later invalid order, SQL failure, price overflow or backend intent failure can leave partial order rows. LockPrice errors are passed directly to JSON serialization, which can produce an unhelpful empty object.

Proposed change

Validate the full request before effects and create its local transaction/order set atomically, returning a stable error on failure with no orphaned partial intent.

Acceptance criteria

  • Validate nonempty/duplicate orders and the complete batch before writes, then commit the transaction and orders as one local operation.
  • Inject a failure at each order and intent write and reopen real SQLite to prove no partial rows remain.
  • Define backend intent creation versus local persistence ownership and preserve uncertainty if an external side effect occurred; do not retry silently.
  • Return a meaningful bounded HTTP error category/message rather than serializing a Go error object; preserve wallet-free preflight before every chain-related write.

Current evidence

confirmed partial-write and diagnostic defects; source inspection only, no new runtime reproduction. Backlog classification is based on source inspection; this issue does not claim a new runtime reproduction.

Related work

These are integration points, not prerequisites for starting this issue.

  • #77 — Define exact pricing units and reject overflow before persistence
  • #3 — Return a consistent typed HTTP error envelope

Priority context

Improves both TEST bookkeeping and future payment correctness; it does not authorize monetary use.

Validation must use owned local fixtures on supported Linux environments. Record the implementing merge request and relevant test results before closing this issue.


Imported from GitLab issue 75. Originally opened 2026-09-10. Historical GitLab links may require access to the original project.

Activity

  1. added this to the Optional payments milestone on Sep 24, 2026
  2. added
    bugSomething isn't working
    Optional paymentsOptional credits and monetary settlement, outside the supported wallet-free alpha.
    P2Follow-on improvement or optional expansion after core requirements.
    Source reviewedCurrent source evidence checked; no new runtime reproduction claimed by backlog creation.
    on Sep 24, 2026
  3. vincent10400094 commented on Sep 25, 2026

    @vincent10400094
    Member

    Progress: #180, merged into dev via #228 (e4a621f), validates and prices the whole batch before any write, refuses empty and duplicate batches, and returns typed errors. Still open: the orders and the intent are still written separately, with no failure injection at each write on real SQLite and no decision on who owns the backend intent.

  4. added
    ReviewImplementation is ready for review and required validation.
    In progressImplementation is active.
    on Sep 28, 2026
  5. ctfbruce commented on Oct 5, 2026

    @ctfbruce
    CollaboratorAuthor

    Implemented in #373. Payment intents validate the complete batch before persistence and store the intent, orders and owner atomically. SQLite failure tests cover transaction, order and owner writes, including reopened-file rollback checks. Errors use bounded HTTP responses, and USDC intent creation performs no chain call. CI passed all 16 checks.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    In progressImplementation is active.Optional paymentsOptional credits and monetary settlement, outside the supported wallet-free alpha.P2Follow-on improvement or optional expansion after core requirements.ReviewImplementation is ready for review and required validation.Source reviewedCurrent source evidence checked; no new runtime reproduction claimed by backlog creation.bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions