Skip to content

fix: allocate/approve/reject stubs return 501 instead of faking success (#533) - #700

Merged
chonilius merged 2 commits into
MergeFi:mainfrom
jakespepe:fix/533-stub-routes-501
Oct 15, 2026
Merged

chonilius merged 2 commits into
MergeFi:mainfrom
jakespepe:fix/533-stub-routes-501

Conversation

@jakespepe

@jakespepe jakespepe commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Problem

#253 was closed, but three guarded, Swagger-documented routes are still backed by stubs that read and write nothing and report success:

Route Service method Returned
POST /milestones/:id/allocate MilestonesService.allocateBudget { id, status: 'budget_allocated' }
POST /bounties/:id/approve BountiesService.approve { id, status: 'approved' }
POST /bounties/:id/reject BountiesService.reject { id, status: 'rejected' }

A maintainer (or the frontend) calling these gets a 201 and a success-looking body, but no milestone budget is allocated on-chain, no bounty changes state and nothing is stored. Because the routes are also @Idempotent, that fake success is cached and replayed on retries. Lying about money-adjacent state transitions is worse than failing.

What changed

I took the issue's second option ("return 501 until then"). Building the real flows is a larger change: allocateBudget needs wiring to the milestones contract's allocate, and approve/reject need state-machine transitions. That work should not hide behind routes that already claim to work.

  1. fix(milestones): allocateBudget(id) now rejects with NotImplementedException (HTTP 501, "Milestone budget allocation is not implemented yet"), with a doc comment explaining why.
  2. fix(bounties): approve(id) / reject(id) do the same. This commit also removes a duplicate import { … } from '@nestjs/common' a bad merge left at the top of bounties.service.ts, and applies Prettier to the file (formatting only).

The routes, guards, idempotency keys and Swagger entries are unchanged. Clients now get an honest 501 instead of a fake success. Once the real implementations land, only the service bodies need to change.

Tests

  • milestones.service.spec.ts: allocateBudget (#533) expects a NotImplementedException.
  • bounties.service.spec.ts: BountiesService approve / reject (#533) expects a NotImplementedException from both. It is a standalone describe because the file's shared TestingModule doesn't build on main (IssueRepository is not provided), which makes every other test in that file fail before running.

Verification

  • npx jest src/milestones src/bounties -t "#533": 2 / 2 passed.
  • Whole src/milestones + src/bounties run: 46 failed / 41 passed. main gives the same 46 failures (46 / 39), all from the broken bounties TestingModule and outdated milestones fund / resolveIssue expectations, none touched here.
  • ESLint on the two service files: 10 errors on main → 4 now. The remaining 4 (callerUserId / previousStatus unused, unsafe any in milestones) were already there.

Related: #253
Closes #533
Closes #530
Closes #532
Closes #528
🤖 Generated with Claude Code

…MergeFi#533)

The stub resolved { status: 'budget_allocated' } without touching
storage or the contract, so POST /milestones/:id/allocate reported an
allocation that never happened.
…ergeFi#533)

Same no-op stub problem for POST /bounties/:id/approve and /reject.
Also drops a duplicate @nestjs/common import left by a bad merge and
applies prettier to the file.
@drips-wave

drips-wave Bot commented Oct 15, 2026

Copy link
Copy Markdown

@jakespepe 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

@vercel

vercel Bot commented Oct 15, 2026

Copy link
Copy Markdown

@jakespepe is attempting to deploy a commit to the chonilius' projects Team on Vercel.

A member of the Team first needs to authorize it.

@chonilius
chonilius merged commit efdb4c4 into MergeFi:main Oct 15, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment