Skip to content

feat(proposals): atomic proposal acceptance and contract creation - #269

Merged
SudiptaPaul-31 merged 2 commits into
Lumina-eX:mainfrom
smithd2423-beep:feat/217-proposal-acceptance
Nov 21, 2026
Merged

SudiptaPaul-31 merged 2 commits into
Lumina-eX:mainfrom
smithd2423-beep:feat/217-proposal-acceptance

Conversation

@smithd2423-beep

Copy link
Copy Markdown
Contributor

Closes #217

What changed

  • Accepting a proposal now runs as ONE SQL statement (data-modifying CTEs): proposal -> accepted, contract (status pending_funding, escrow unfunded), milestones from the proposal breakdown, and audit rows. Any failure rolls back everything.
  • Migration 012: contracts.proposal_id (UNIQUE) for traceability; partial unique index so only one proposal per project can be accepted; proposal_acceptance_audit_logs (proposal_accepted, contract_created, escrow_initialized, with actor and timestamp).
  • Existing PATCH /api/proposals/[id] already restricts status changes to the project's client; a concurrent double-accept returns 409.

Why

Issue #217 acceptance criteria: atomicity, one accepted proposal per project, proposal->contract link, status updates, rollback, audit trail.

Technical considerations

  • The Neon HTTP driver cannot hold a transaction across calls, so a single CTE statement is used for atomicity.
  • escrow_status has no pending_funding value; 'unfunded' is used as the Pending Funding state, and contract_status is pending_funding. No escrow logic changed.
  • Tests: tests/api/proposal-acceptance.test.ts

@drips-wave

drips-wave Bot commented Nov 19, 2026

Copy link
Copy Markdown

@smithd2423-beep Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@smithd2423-beep
smithd2423-beep marked this pull request as ready for review November 19, 2026 05:28
@SudiptaPaul-31
SudiptaPaul-31 merged commit 2a9420e into Lumina-eX:main Nov 21, 2026
2 checks passed
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.

[Feature]: Proposal Acceptance & Contract Creation Service

2 participants