Skip to content

fix: surface inert team-split validation, milestone funding amount, p… - #567

Merged
chonilius merged 2 commits into
MergeFi:mainfrom
Darkvader-ship-it:fix/a11y-seo-team-splits-milestone-amount
Sep 27, 2026
Merged

chonilius merged 2 commits into
MergeFi:mainfrom
Darkvader-ship-it:fix/a11y-seo-team-splits-milestone-amount

Conversation

@Darkvader-ship-it

Copy link
Copy Markdown
Contributor

What this PR does

Closes

Closes #

What changed

How to test

Checklist

  • npm run lint passes locally
  • npm test passes locally
  • npm run build passes locally
  • This change is actually reachable/used in the running app
  • I have tested this change in the browser (if UI-related)

…rofile indexability, and chart accessibility

Four independent audit findings, plus the pre-existing breakage that made a
green build/test baseline impossible to reach.

teamSplitsValid: computed, then thrown away (#419)
- adaptBounty declared `Bounty & { teamSplitsValid?: ... }`, so consumers
  typed as the plain Bounty (fetchBounties returns Bounty[]) had no access to
  the field at the type level. The field already lived on Bounty, so the
  intersection was pure noise; the signature is now just `Bounty`.
- IssueDetailPage rendered invalid splits with full visual confidence and
  read nothing. It now checks teamSplitsValid and renders a role="alert"
  warning reusing validateTeamSplits' own message.
- Empty-but-present splits arrays rendered a bare "Team payout split" header
  (an array is truthy); now guarded with an explicit length check. Such an
  array validates as {valid: true, sum: 0}, so it raises no spurious warning.
- IssueActions gating is explicitly scoped OUT, with the rationale recorded
  in the file: claiming is server-authoritative, and disabling the button for
  a split the contributor doesn't control would be a dead end. Not silently
  dropped, as before.

MilestoneFundButton had no amount field (#421)
- handleFund posted { funderAddress } with no amount, unlike PoolDepositButton
  in the same file, while the milestone card models incremental funding with
  a distributed/budget progress bar.
- Adds an amount input defaulting to the remaining budget, capped at it, and
  validated through the existing parseMoneyInput (never a second, looser set
  of rules) with the value posted as a normalized string, matching the
  backend's own @IsMoneyAmount() string convention.
- BACKEND CONTRACT, as far as it can be established: the available
  mergefi-backend snapshot contains no milestones module at all, so
  POST /milestones/:id/fund cannot be executed. The only fund endpoint
  present, POST /bounties/:id/fund, takes no amount and derives it
  server-side (`amount: bounty.amount`), so the input is forward-compatible
  and harmless under a default NestJS whitelist DTO — but if the milestone
  endpoint mirrors bounties, the entered amount is advisory until the backend
  contract accepts one. Flagged rather than assumed either way.

Contributor profiles were indexable by default (privacy)
- /reputation/[handle] server-renders real handles, avatars, orgs and lifetime
  earnings, and robots.ts plus sitemap.ts together published a crawlable
  directory of who earns what.
- Policy, documented in src/lib/seo-policy.ts and the README: public by
  direct link, OPT-IN for search-engine indexing. Search indexing is
  effectively irreversible, so an opt-out default makes the harm permanent
  while an opt-in default only costs recoverable SEO surface. Lifetime
  earnings stay server-rendered for opted-in profiles — the opt-in is the
  protection, not the rendering strategy.
- Implemented consistently: fetchIndexableReputationHandles filters on the
  backend's isProfilePublic (absent today, so nothing is indexed — the safe
  side, and the field is read defensively so no further frontend change is
  needed when it ships); per-page noindex metadata covers direct-URL indexing,
  which sitemap omission alone does not; robots.txt deliberately does NOT
  disallow /reputation/, because blocking the path stops crawlers reading the
  noindex tag and strands already-indexed URLs.
- Scale: the single file that could exceed search engines' 50,000-URL cap is
  now chunked into /sitemaps/<id>.xml with a permanent redirect from
  /sitemap.xml, CDN-cacheable Cache-Control, and hourly in-process
  memoization. Verified against 120k profiles: no file over the limit, and
  robots.txt advertises every file.
- Implemented as a Route Handler, not Next's sitemap/[id] metadata route:
  Next 16.3.5's own generated type validator rejects that convention
  (TS2559), because the metadata route exports neither a method the
  RouteHandlerConfig knows nor anything else it can match.

BarChart and Sparkline were inaccessible (#420)
- BarChart values lived only in a `title` attribute — unreachable by keyboard,
  unreliably announced. Visual bars are now aria-hidden with a visually-hidden
  data table as the accessible equivalent; each bar is focusable with a
  visible focus ring and reveals the same tooltip on focus as on hover.
- Sparkline was aria-hidden with no equivalent at all, sitting next to a
  financial figure. It is now role="img" with a name summarising point count,
  direction, first, last and range; StatCard forwards its label so it reads as
  "Earnings: 8 data points, trending up from 12 to 31".
- Colour is no longer the only sign: negative bars carry a diagonal stripe and
  keep their sign in both tooltip and table.
- Contrast measured, not eyeballed. Bar labels were 2.56:1 (light) and 3.75:1
  (dark), both failing AA; now 4.76:1 and 6.96:1. Negative bars were 2.97:1,
  below the 3:1 a graphical object needs; now 3.75:1. Team-split percentages
  in emerald-600 (3.77:1) likewise moved to emerald-700 (5.48:1).
- Audited with jest-axe in npm test (so in CI), asserting zero violations,
  including over the composition the dashboards render. The VoiceOver/NVDA
  pass over announcement order and wording is a manual step and is documented
  as such rather than claimed here.

Pre-existing breakage repaired to reach a green baseline
These blocked `npm run build` and 3 test suites on main; they are unrelated to
the four issues above and are called out separately for review.
- src/app/dashboard/loading.tsx closed a <Card> with </div> (TS17002, build).
- social-image.tsx: a div with three children and no explicit `display`, which
  satori rejects, failing the /opengraph-image prerender outright.
- Navbar.tsx: two elements with duplicate `className` attributes (TS17001).
- AuthContext typed `refresh` as Promise<void> while returning AuthUser|null.
  CallbackClient awaits login() and redirects on the resolved user, so the
  wrong type also made every role assertion degrade to the contributor
  fallback. Three previously-never-run tests were asserting exactly that.
- Two test files were mangled by a bad merge: CallbackClient.test.tsx had four
  unclosed/duplicated `it` blocks and MilestoneActions.test.tsx had duplicated
  imports plus stray statements. Both failed to parse, so their suites never
  ran at all.
- IssueDetailPage rendered each stat-card icon twice (four pairs).

Deviation worth review: mock-data.ts marks the five mock profiles
`indexable: true` so local dev exercises the post-backend code path.
@drips-wave

drips-wave Bot commented Sep 27, 2026

Copy link
Copy Markdown

@Darkvader-ship-it 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 Sep 27, 2026

Copy link
Copy Markdown

@Darkvader-ship-it 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 3085762 into MergeFi:main Sep 27, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants