Fix/x link input - #54
Conversation
SWAP_SITES is now partial: a chain without an entry shows no outside swap link. Base and Arc keep Open in Uniswap. The unused uniswapSwapUrl helper goes with it.
A pasted https://x.com/foo was cut to 15 characters and rejected with a cryptic error, and only after Launch was clicked. One shared parser now backs both validators: it takes foo, @foo, or an x.com / twitter.com link (www/mobile hosts, query strings, deep paths), rejects other hosts and non-profile paths, and stores the bare handle as before, so pages still build the x.com link themselves. Overlong handles are an error instead of a silent cut. The launch form shows the error inline and both forms show @handle on blur.
A typed handle is taken as given, so every handle the old validators accepted still passes and a saved token's edit sheet never opens with an error. The token page skips the links row when a Robinhood token has no website and no X handle. Adds host-smuggling test cases.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Essentials Run ID: 📒 Files selected for processing (13)
Included review availability: 4 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour. 📝 WalkthroughWalkthroughThe PR adds shared X handle parsing for launch and edit flows. It updates metadata validation and tests for normalized handles. It also makes swap links chain-specific and optional, removing the Robinhood external swap link. ChangesLaunchpad integrations
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Feature Sequence Diagram(s)sequenceDiagram
participant LaunchForm
participant parseXHandle
participant MetadataValidation
LaunchForm->>parseXHandle: Parse submitted X value
parseXHandle-->>LaunchForm: Return normalized handle or error
LaunchForm->>MetadataValidation: Submit normalized handle
MetadataValidation-->>LaunchForm: Accept value or reject validation
Merge Risk: ⚪ Minimal · up to The updated handle and chain-specific swap-link behavior has no identified merge-blocking risk. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Comment |
Summary
@handleor an x.com / twitter.com profile link.Why
A pasted
https://x.com/foowas cut to 15 characters (https://x.com/f), failed the handle check, and came back asx: letters, digits, _. On the launch form this only happened after clicking Launch, during the metadata save. The launch and edit validators had also drifted apart.X field
lib/launchpad/xHandle.ts, now backs bothvalidateMetaandvalidateEdit.foo,@foo, and links onx.com/twitter.com. Links can usewww.ormobile.hosts, carry query strings (?s=21) or fragments, and point at deep paths such as/foo/status/123.x.com.evil.com,x.com@evil.com,x.com\@evil.com), non-web schemes, and links to non-profile pages (/home,/i/…,/intent/…,/search, …).https://x.com/<handle>itself, so a pasted URL never becomes a link target.X: enter a handle or an x.com link.inline before Launch. Both forms use the placeholder@handle or x.com linkand show@handleon blur.llms.txtnotes thatx_handletakes a handle or a profile link.Behavior change for API clients: a handle longer than 15 characters is now a 400. The launch endpoint used to silently cut it to 15, which could point at someone else's account.
pools.trade
SWAP_SITESis now partial; a chain without an entry shows no outside swap link. The Robinhood entry is gone.uniswapSwapUrlhelper.Tests
xHandle.test.ts: accepted and rejected forms, host-smuggling cases, legacy handles still pass, no silent truncation, oversized input, form wiring.metaShared.test.ts: link normalizes to the handle; other hosts rejected; a retry with the link or the bare handle matches the saved row.creator.test.ts: a link and a handle produce the same signed edit message.editServer.test.ts: a link is accepted and written; a link to another site is a 400 and leaves the nonce unused.swap-sites.test.ts: Base and Arc link to Uniswap, Robinhood has none, the token page renders the link conditionally.Summary by CodeRabbit