Repository navigation
Description
Overview
src/app/milestones/MilestoneActions.tsx defines two sibling "fund something" components back to back, and only one of them lets the user say how much:
export function MilestoneFundButton({ milestoneId }: { milestoneId: string }) {
const router = useRouter();
const { address, connect, connecting } = useWallet();
const [pending, setPending] = useState(false);
const [error, setError] = useState<string | null>(null);
async function handleFund() {
setError(null);
setPending(true);
try {
const walletAddress = address ?? (await connect());
if (!walletAddress) {
setError("Connect a Stellar wallet to fund this milestone.");
return;
}
await apiPost(`/milestones/${milestoneId}/fund`, {
funderAddress: walletAddress,
});
router.refresh();
} catch (err) { ... }
finally { setPending(false); }
}
return (
<div className="mt-4">
<Button size="sm" variant="outline" onClick={handleFund} disabled={pending || connecting}>
{pending || connecting ? "Confirming in wallet..." : "Fund milestone"}
</Button>
{error && <p className="mt-2 text-xs text-rose-600">{error}</p>}
</div>
);
}handleFund posts { funderAddress: walletAddress } — no amount field at all. Compare this to PoolDepositButton, defined a few lines later in the exact same file, for the conceptually near-identical action of depositing into a maintenance pool:
export function PoolDepositButton({ poolId }: { poolId: string }) {
...
const [amount, setAmount] = useState("100");
async function handleDeposit() {
...
await apiPost(`/maintenance-pools/${poolId}/deposit`, {
amount,
funderAddress: walletAddress,
});
...
}
return (
<div className="mt-4 flex items-center gap-2">
<input type="number" min="1" value={amount} onChange={(e) => setAmount(e.target.value)} ... />
<Button ...>{pending || connecting ? "Confirming..." : "Deposit"}</Button>
...PoolDepositButton correctly collects an amount from the user before posting. MilestoneFundButton collects nothing.
This is a real functional gap, not just a stylistic inconsistency, given how MilestonesPage itself describes and visualizes milestone funding: each milestone renders a progress bar showing distributed out of budget, explicitly modeling partial, incremental funding over time — "Sponsors can fund an entire release instead of a single issue. Budget is distributed automatically across the milestone's issues as each one resolves" (README) and "Sponsors deposit monthly so maintainers can reward ongoing upkeep" for the adjacent maintenance-pool section on the very same page. A progress bar that's meaningfully partway filled (e.g. m2's mock data: distributed: 2100 of budget: 6000) only makes sense if multiple funding contributions, of varying amounts, are expected over the milestone's lifetime — yet the one button that triggers a milestone-funding action provides no way to specify how much of that budget gap this particular contribution should cover.
Either the backend endpoint (POST /milestones/:id/fund) silently interprets a missing amount as "fund the entire remaining budget in one shot" (in which case the UI is misleadingly labeled — a button with no amount input reads as "fund this milestone," not "fund the entire remaining budget," and a sponsor clicking it with no amount field visible has no way to know or control that), or the endpoint requires an amount and this call is simply broken/incomplete and would fail or behave unpredictably against a real backend. Either way, this is worth resolving explicitly rather than left as an unexplained asymmetry with its sibling component two components down in the same file.
Requirements
- Add an amount input to
MilestoneFundButton, matching the pattern already established byPoolDepositButtonin the same file (numeric input, validated per the separate amount-validation issue in this batch that also coversPoolDepositButton's current lack of validation — apply the same validation to this new input from the start rather than introducing a second unvalidated amount field). - Confirm with the actual
mergefi-backendcontract (or by testing against a running instance) whatPOST /milestones/:id/fundcurrently expects — if it already requires anamountand this frontend call has simply never sent one, this is a currently-broken/non-functional action end to end, which materially raises the priority of this fix. Document the finding in the PR. - Consider whether the amount should be capped/defaulted sensibly relative to the milestone's remaining budget (
budget - distributed) — e.g. pre-filling or capping the input so a sponsor can't accidentally attempt to overfund past the stated budget, mirroring the divide-by-zero/overspend-display issue elsewhere in this batch forMilestonesPage's own progress-bar math.
Acceptance Criteria
-
MilestoneFundButtonrenders an amount input before its "Fund milestone" action, consistent withPoolDepositButton's existing pattern in the same file. -
handleFundsends the user-entered amount toPOST /milestones/:id/fundalongsidefunderAddress. - The input is validated using the same rules established for
PoolDepositButton's amount field elsewhere in this batch (no empty/zero/negative/non-numeric/over-precision values reaching the backend). - The PR documents what the actual backend contract for this endpoint expects/expected, resolving the "was this ever functional" question raised above.
- No regression to milestones that are being funded for the first time (a milestone with
distributed: 0).
Additional Notes
Precise references:
src/app/milestones/MilestoneActions.tsx:9-43— the fullMilestoneFundButtoncomponent,handleFundat lines 15-33, no amount state or input anywhere in the component.src/app/milestones/MilestoneActions.tsx:45-88—PoolDepositButton, the sibling component in the same file with the correct amount-collection pattern this issue asks to mirror.src/app/milestones/page.tsx:28-58— the milestone card rendering, including the progress bar (m.distributed / m.budget) that establishes incremental/partial funding as the expected mental model for this feature, and:54where<MilestoneFundButton milestoneId={m.id} />is rendered with nobudget/distributedcontext passed in at all (worth passingm.budget - m.distributedthrough as a prop if a remaining-budget cap/default is implemented).src/lib/mock-data.ts:93-114—mockMilestones, showing bothm1andm2withdistributedmeaningfully less thanbudget, reinforcing that partial/incremental funding is the modeled, expected state, not an edge case.
Relationship to other issues: this issue's amount-validation requirement should reuse whatever comes out of the separate PoolDepositButton amount-validation issue in this batch, rather than duplicating that work independently — sequence or land them together given they touch the same file and the same underlying validation concern.
Test/reproduction plan: render MilestoneFundButton, assert an amount input is present and its value flows into the apiPost call's body when "Fund milestone" is clicked; assert the same invalid-input cases (empty, zero, negative, non-numeric) required of PoolDepositButton are also rejected here.
Activity
guptakumarranjeet150 commentedon Sep 10, 2026
Hello! I'd like to work on this issue.
I would love to take this on. My planned approach:
MilestoneFundButton has no amount input, making partial milestone funding impossible from the UIwith clean React/Next.js components, responsive styling, and proper loading/error boundaries.Excited to work on this—please assign to me and I'll submit a clean PR shortly!
eriifeomoniyi-hue commentedon Sep 26, 2026
@eriifeomoniyi-hue has applied to work on this issue as part of the Stellar Wave Program's 9th wave.
ℹ️ Repo Maintainers: To accept this application, review their application or assign @eriifeomoniyi-hue to this issue.
Darkvader-ship-it commentedon Sep 26, 2026
@Darkvader-ship-it has applied to work on this issue as part of the Stellar Wave Program's 9th wave.
ℹ️ Repo Maintainers: To accept this application, review their application or assign @Darkvader-ship-it to this issue.
drips-wave commentedon Sep 26, 2026
Congratulations, @Darkvader-ship-it! 🎉 Your application was accepted by the repo's maintainers, and the issue is due on September 30, 2026.
🧑💻 @Darkvader-ship-it: Please resolve the issue such that the repo's maintainers have enough time to review your contribution before the due date. You'll earn Points for completing the issue on-time, which will make you eligible for a share of the Stellar Wave Program's reward pool.
Warning
When opening a PR, please link it to this issue to ensure it gets tracked accurately. Points are awarded when this issue is marked as completed by the maintainer.
🤠 Repo maintainers: Please keep an eye on the contributor's progress and review their work before the due date. You can manage this issue, including adjusting its complexity and points, here.
🌊 Happy Wave 🌊
grantfox-oss commentedon Sep 27, 2026
🎉 This issue has been marked as completed on GrantFox!
@Darkvader-ship-it's PR #567 was approved and merged by @chonilius.
🏆 @Darkvader-ship-it: You earned 45 FoxPoints for this contribution! Your current tier: Specialist (5,349 total points). Track your full progress on GrantFox.
👏 Great work, @Darkvader-ship-it! Keep contributing to MergeFi.
drips-wave commentedon Sep 27, 2026
This issue has been completed by @Darkvader-ship-it as part of the Stellar Wave Program's 9th Wave 🥳
😎 @Darkvader-ship-it: You earned 200 Points for completing this issue! After the current Wave ends, you'll be eligible for a percentage of the Wave's reward pool based on the percentage of total points you've earned. Learn more here. You can also Leave a review to share your experience working on this issue.
🧑💻 Repo maintainers: How'd the contributor do? Leave a review to share your experience working with them.