Repository navigation
Conversation
Konrad wants short links on peanut.me/go/ that he can add by editing one file. A mapped path answers a 307 before the creator username engine runs; every destination must be a same-origin path outside /go/, checked by a test and again at request time, so a bad line can never send visitors off peanut.me or into a loop. Seeded with app -> /app, which no username can hold. TASK-25176
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
/chip review |
Code-analysis diffPainscore total: 11169.33 → 11174.16 (+4.83) 🆕 New findings (4)
✅ Resolved (3)
📈 Painscore deltas (top movers)
|
There was a problem hiding this comment.
Chip review — no blocking findings — this is not an approval
No findings in the pinned redirect-map change.
Checked clean
- Exact head and base merge-base verified; PR description and four-file diff reviewed.
- Mapped /go/app redirects to the existing /app smart-store route; unmapped paths retain creator lookup and handoff.
- Destination validation rejects cross-origin, decoded protocol-relative, and /go loop paths; own-property lookup avoids inherited keys.
- No visual design-system change. Typecheck, lint, format, and ds-lint passed at this SHA; unit, SEO contract, and native-export checks were still in progress when reviewed. Local dependencies were absent, so tests were not rerun.
Security review: did not run — this change has no security, privacy or money surface, so it was not asked. This review is one reviewer short.
Third opinion by claude-opus: 0 finding(s), marked with the model name. It answers only product truth, missing tests and the cross-repo contract, so treat its findings as advice.
Copy check by claude-haiku-5-5: 0 finding(s), titled "Copy now wrong". Every quoted passage was checked against the file.
Exact head: c7f762c13a4e · Context: repo, design, api · Took 2m (queued 1m)
🧪 UI test report — ✅ all greenSuites
📊 Coverage (unit)
⏱ 10 slowest test cases
|
…order In production next.config.js runs redirects.json before the /go/ page, and its /:locale/<x> rules match /go/team, /go/blog and four deposit/withdraw paths with a 308. A map key with one of those names would never redirect, so go-map.test.ts now fails on it and the header names the taken keys. Also: the entry test names the bad key, a test covers inherited keys, and routes tests pin that the lookup runs before the username check (dashed keys) and that metadata skips the creator lookup for multi-segment keys. The header example now points to a page that exists and links the spec.
The entry check called goRedirectDestination directly and the routes mock dropped any map the page passed, so CI stayed green if the default map or the page stopped using GO_REDIRECTS. Resolve every live key through resolveGoRedirect and let the mock forward a passed map.
|
/chip review |
There was a problem hiding this comment.
Chip review — no blocking findings — this is not an approval
No findings in the pinned redirect-map change.
Checked clean
- Verified the new head and exact dev merge-base; reviewed the two follow-up commits and the full four-file PR diff.
- Live-map lookup, own-property guard, same-origin destination validation, and legacy creator fallback remain consistent with the PR's explicitly limited v1 behavior.
- The new tests cover actual map entries, redirect-rule precedence, a dashed key, metadata lookup bypass, and an inherited key.
- Read the newer mono tracked-links redirect-map spec: it describes a broader future replacement, while this PR explicitly retains the legacy fallback and same-origin v1 scope.
- At review time, this SHA had a successful preview deployment and backdoor scan; the unit/typecheck checks had not yet appeared in its check-run list.
Security review: did not run — this change has no security, privacy or money surface, so it was not asked. This review is one reviewer short.
Third opinion: did not run — it reads only the first review of a pull request; the first reviewer checks later rounds. This review is one reviewer short.
Copy check by claude-haiku-5-5: 0 finding(s), titled "Copy now wrong". Every quoted passage was checked against the file.
Exact head: 76ed7e58ff77 · Context: repo, engineering, design · Took 2m
|
Review preview: e06be1a → 76ed7e5. Incomplete capture; unavailable states are listed in the report. Other locales were not captured; add the Screen Library coverage: review — UI review needs a complete, unique comparison for every required locale. Screen Library copy: review — 3 baseline entries are now shown or deleted; remove from scripts/screens/copy-coverage-baseline.json: card.yourCard.redZone, paymentLoading.sayingHola, profile.unlockPayments.chips.attention. Add a capture state that shows the copy, or add the keys to the baseline with “Screen Library copy exception: ” on its own line in the PR description. Copy coverage: 1318/4069 keys shown. |
Summary
Konrad wants short links on
peanut.me/go/that he can read and add by editing one file. This addsGO_REDIRECTSinsrc/features/tracked-links/go-map.ts: a hardcoded map from the path after/go/to a path on peanut.me. The/go/[slug]/[[...rest]]page checks the map first and answers a 307 on a hit. On a miss, the creator username engine runs unchanged./go/, lowercased, trailing slash ignored, segments ofa-z 0-9 - _. Exact match only:/go/app/xis a miss./and is not/goor below it. A jest test checks every line, and the resolver checks again at request time. A bad line is a miss, so it falls through to the username engine.constructoror__proto__never match.utm_*tags included. The creator redirect differs: it forwards the cleanedutm_*tags. To tag a short link, put the tags in its destination.generateMetadataskips the creator API lookup on a mapped path.app→/app(the smart store link). No account can holdapp: it is in the API's reserved routes. No entries forkonrad/1–3: the Palermo posters stay on the username engine until Konrad decides.engineering/ui/tracked-links.md§ Redirect map, linked from thego-map.tsheader.Task
TASK-25176: https://www.notion.so/41e83811757981988850f65f7d2dc056
How to add a redirect
Add one line to
GO_REDIRECTSinsrc/features/tracked-links/go-map.ts, for example'lisbon/flyer': '/en/send-money-to/brazil?utm_source=flyer',.go-map.test.tsfails CI on a full URL, another host, a/go/destination, an upper-case or invalid key, or a key thatredirects.jsontakes first.Risks
promo/flyerkey leaves/go/promoand/go/promo/igon the creator engine. A one-segment key such askonradwould take over that creator's bare link, so check a key against live usernames before you add it.next.config.jsrunsredirects.jsonbefore this page. Its/:locale/<x>rules answer/go/team,/go/blog,/go/deposit/via-avalanche,/go/withdraw/avalanche,/go/deposit/from-faster-paymentsand/go/deposit/from-speiwith a cacheable 308. Creator usernames already had this.go-map.test.tsfails on such a key.next devdoes not load those rules. Constraining:localein those rules is a separate change.redirects.jsonrules:/events,/pints,/foodie,/seedlings,/packet,/create-packet,/batch/*,/raffle/*. A map line pointing at one of them passes both checks, and the visitor ends on luma.com, GitHub or Notion. The hosts are fixed, so this is not an open redirect.generateMetadata. A miss runs the old code path.QA
Preview for this head:
P=https://peanut-wallet-oas5l05f5-squirrellabs.vercel.app. Production answers 404 for every mapped path until release. Each command is a GET that does not follow redirects:c() { curl -s -o /dev/null -D - "$P$1" | grep -iE '^(HTTP|location)'; }.c /go/app→307,location: /appc /go/APP/andc '/go/app?utm_source=x&foo=bar'→307,location: /app(case and trailing slash ignored, query dropped)c /go/app/x→404(exact match only)c /go/konrad/1→307,location: /home?app_entry=1&tl=konrad&acq_invite=konrad&tl_s=1, the same as production today (also/2,/3,/ig)c '/go/konrad?utm_source=instagram&utm_campaign=x&foo=bar'→307,location: /home?app_entry=1&tl=konrad&acq_invite=konrad&utm_source=instagram&utm_campaign=x, the same as productionc /go/nonexistentuserzz9,c /go/constructor,c /go/__proto__→404c /go/team→308,location: /go/press(the redirects.json rule above; the same on production)Use a real username without a creator page, such as
konrad. A creator with a creator page (juanacervio) answers 404 on the preview because the preview API does not have that user; the dev preview without this PR shows the same 404.Design notes / accepted trade-offs
sanitizeRedirectURLfromsrc/utils/cookie-url.utils.ts. That module imports@/utils/sentry-lazy, which importsposthog-jsat the top level. The local check keeps the browser analytics SDK out of the/go/page's import graph. It is not identical: it parses againstTRACKED_LINK_ORIGIN, requires the same origin and no credentials, and refuses a decoded path that starts with//or/\or that is/goor below. It does not repeatsanitizeRedirectURL's final re-parse, so a hand-written destination such as/%09/evil.compasses. Destinations come only from the hardcoded map, never from the request, and the emittedLocationstays on peanut.me, so this is accepted for v1 and listed as a follow-up.resolveGoRedirecttakes an optional map (defaultGO_REDIRECTS) so the bad-destination cases run against fixtures. Tests also run every live entry through that lookup.Verification
76ed7e58f, source hashes matched the worktree):tsc --noEmitexit 0;jest src/features/tracked-links10/10 suites, 235/235 tests; eslint on the changed files exit 0; prettier unchanged. Full build not run locally (sandbox disk full); CI built the preview./go/, upper-case or%2F%2Fentry; ateamkey; removing the own-property guard; moving the lookup below the username check;generateMetadatachecking[slug]only; an empty default map; the page passing an empty map. Each made at least one test fail.db3c2c292and76ed7e58f(tests, header comment, PR body). A final pass found the re-parse gap above (kept as a design note) and two wording nits, fixed in this body.76ed7e58fand on production; all unmapped paths matched production exceptjuanacervio(explained above). Open-redirect inputs (/go/%2F%2Fevil.com,/go/%5C%5Cevil.com, query-carried URLs) stayed same-origin.ci-success(the only required check) green on76ed7e58f, with all 12 jobs it needs. Unit: 22,792 tests, 0 failed. Non-requiredi18n-overflowwas still running; it runs about 45 minutes on other branches today too.76ed7e58f: no blocking findings, 0 findings. 0 review threads.e2e/flows/go-links.spec.ts(CI skips it) was not run, so the creator-page arm has jest coverage only. Production robots headers on a mapped 307 are not checked.Screenshots: N/A (no visible change)