Repository navigation
Conversation
[Beta] Generated file diffTime updated: Thu, 26 Nov 2026 12:32:52 GMT Apple
File has changed Integration
File has changed Windows
File has changed |
Build Branch
Static preview entry points
QR codes (mobile preview)
Integration commandsnpm (Android / Extension): Swift Package Manager (Apple): .package(url: "https://github.com/duckduckgo/content-scope-scripts.git", branch: "pr-releases/spapaseit/onboarding-picker-poc")git submodule (Windows): git -C submodules/content-scope-scripts fetch origin pr-releases/spapaseit/onboarding-picker-poc
git -C submodules/content-scope-scripts checkout origin/pr-releases/spapaseit/onboarding-picker-pocPin to exact commitnpm (Android / Extension): Swift Package Manager (Apple): .package(url: "https://github.com/duckduckgo/content-scope-scripts.git", revision: "fade465d98ec6d1208c6a5c16f22b8379bf3555c")git submodule (Windows): git -C submodules/content-scope-scripts fetch origin pr-releases/spapaseit/onboarding-picker-poc
git -C submodules/content-scope-scripts checkout fade465d98ec6d1208c6a5c16f22b8379bf3555c |
65343f8 to
8b994f0
Compare
8b994f0 to
4532b1d
Compare
… useId for aria ids
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.
Tip: disable this comment in your organization's Code Review settings.
|
/cc @kamte for visibility |
|
@claude review |
There was a problem hiding this comment.
Findings marked 🟡 are optional suggestions and need no follow-up push.
Additional findings (outside the current diff — GitHub can't attach inline comments there):
-
🟡
special-pages/pages/onboarding/app/v4/data/existing-favorites.js— Users with any bbc.com favorite, such as the homepage or bbc.com/sport, see BBC News already ticked and locked, so they cannot add it.existingSiteIdscompares hostnames only. That is enough for sites that live at a host root. It is not enough forbbcNews, whose URL ishttps://www.bbc.com/news(data.js). Fix: when the suggested site's URL has a path beyond/, also require the favorite's path to start with that path, keeping the hostname-only rule for root URLs such as YouTube and Gmail.Why this was flagged
Native answers
shouldShowTopSitesPickerwithshow: trueandexistingFavorites: ["https://www.bbc.com"], for example after the user imported the BBC homepage.applyPickerAnswer(global.js:200) copies the list into the picker step.existingSiteIds(existing-favorites.js:25-31) turns both URLs intohostKey'bbc.com', so thebbcNewssite matches. PickerContent.js:568-585 then renders BBC News witharia-checkedtrue anddisabled. It also leaves BBC News out ofpicks, so the user can never send it inaddFavorites, although they do not have BBC News as a favorite. The base branch has no picker, so this is new. Nothing guards against it: the unit tests cover only root-URL sites, and the docs in onboarding.md and picker-step.json describe the hostname-only rule without mentioning sites that carry a path.Verification: nit.
hostKey(existing-favorites.js:12-18) reduces a URL tonew URL(url).hostname.replace(/^www\./, '')and drops the path. data.js:338 defines{ id: 'bbcNews', url: 'https://www.bbc.com/news', ... }, so any bbc.com favorite matches bbcNews. PickerContent.js:96-97 and 113 render it witharia-checkedtrue anddisabled={done || existing}, so it never goes out inaddFavorites.
shakyShane
left a comment
There was a problem hiding this comment.
Thanks! there's a couple of small questions in there, but then a larger ask to be much more ruthless with regards to agent generated code.
- trim integration test count down to just a handful (avoid trying to enumerate every failure case ever and just focus on common flows)
- question if the unit tests have any additional value at all, or if they are just the LLM's reasoning record... feel free to drop them all or just leave ones that are genuinely capturing an algorithm not exercised seen in the integration tests
- trim almost all comments, leaving the minimum where they have genuine value (most are just the LLM recording it's own work/thoughts)
Nice work!
| }); | ||
| }); | ||
|
|
||
| test.describe('Given I am on the Top Sites picker step', () => { |
There was a problem hiding this comment.
can we scrutinize if every one of these tests is needed - probably a handful would cover most cases and won't lock us too tightly into the implementation.
Remember it's close to impossible to enumerate every failure case there'll ever be, so I'd prefer to see a smaller set of well known paths through.
I'd work with an agent with a goal of covering most flows through that a user can make and aim for roughly 5 to 8 tests
| // handle 'top-sites-picker-ask': ask native, then advance past the step before the picker with its answer applied. | ||
| // A no with nothing after the picker finishes onboarding, since there is no step left to advance to. | ||
| useEffect(() => { | ||
| if (state.status.kind !== 'executing' || state.status.action.kind !== 'top-sites-picker-ask') return; | ||
| const order = state.order; | ||
| askTopSitesPicker(messaging) | ||
| // eslint-disable-next-line promise/prefer-await-to-then | ||
| .then((answer) => { | ||
| const nextOrder = answer.show ? order : order.filter((id) => id !== 'topSitesPicker'); | ||
| dispatch({ kind: 'top-sites-picker-answer', ...answer }); | ||
| if (nextStepId(nextOrder, state.activeStep) !== null) { | ||
| dispatch({ kind: 'advance' }); | ||
| reportStepCompleted(state, nextOrder, messaging); | ||
| } else { | ||
| // Like Start Browsing on a last step, this sends no stepCompleted | ||
| messaging.dismissToAddressBar(); | ||
| } | ||
| }) | ||
| // eslint-disable-next-line promise/prefer-await-to-then | ||
| .catch((e) => console.warn('handling the picker answer failed', e)); | ||
| // eslint-disable-next-line react-hooks/exhaustive-deps -- runs once per ask, like the update-system-value effect below | ||
| }, [state.status.kind, messaging]); | ||
|
|
There was a problem hiding this comment.
this is one of the cases where the original version (the one below this) was wrong (it's a user-trigger effect so does NOT belong in a useEffect).
since you're adding this directly next to the other one I don't think we should block this for a sake of experiment, but as mentioned in 'you dont need an effect' in react docs, this is a mistake I put in place that I'd like us to avoid if this moves past experiment.
There was a problem hiding this comment.
I couldn't agree more, and this one slipped completely past me. I ended up putting a link to the "you might not need an effect" page in a React skill a made a while ago. Worked so well I forgot about it... and now that skill is not on this laptop and it came back to bite me
| /** | ||
| * Right before the picker, ask native whether to show it. Native enrolls the user at this point, so | ||
| * the page asks only when the user is about to reach the step, and drops it if the answer is no. | ||
| * The ask runs in the effect below, and its answer advances the page. | ||
| */ | ||
| if (msg.kind === 'advance' && nextStepId(state.order, state.activeStep) === 'topSitesPicker') { |
There was a problem hiding this comment.
can you ask an agent to do a brutal trim of every comment added in this PR - spot things that are LLM reasoning or justifications left over in the code and cut as much of them as possible. Any that are left over need to be justified
| export function hostKey(url) { | ||
| return urlKey(url)?.host ?? null; | ||
| } |
There was a problem hiding this comment.
this isn't called anywhere but tests, delete it and the tests can go too
| test('existingSiteIds returns the ids of matching sites only', () => { | ||
| assert.deepEqual(existingSiteIds([gmail, youtube], ['https://youtube.com/feed']), ['youtube']); | ||
| assert.deepEqual(existingSiteIds([gmail, youtube], ['https://google.com']), []); | ||
| }); | ||
|
|
||
| test('existingSiteIds skips malformed favorites', () => { | ||
| assert.deepEqual(existingSiteIds([gmail, youtube], ['::', '', 'https://www.youtube.com']), ['youtube']); | ||
| }); | ||
|
|
||
| test('m. hosts are a known miss', () => { | ||
| assert.deepEqual(existingSiteIds([youtube], ['https://m.youtube.com']), []); | ||
| }); | ||
|
|
||
| test('a site with a path needs the favorite under that path', () => { | ||
| /** @type {import('../types/onboarding.ts').TopSitesPickerSite} */ | ||
| const bbcNews = { id: 'bbcNews', url: 'https://www.bbc.com/news', title: 'BBC News', section: 'popular' }; | ||
| assert.deepEqual(existingSiteIds([bbcNews], ['https://www.bbc.com']), []); | ||
| assert.deepEqual(existingSiteIds([bbcNews], ['https://www.bbc.com/sport']), []); | ||
| assert.deepEqual(existingSiteIds([bbcNews], ['https://www.bbc.com/newsround']), []); | ||
| assert.deepEqual(existingSiteIds([bbcNews], ['https://bbc.com/news/']), ['bbcNews']); | ||
| assert.deepEqual(existingSiteIds([bbcNews], ['https://www.bbc.com/news/world']), ['bbcNews']); | ||
| }); |
There was a problem hiding this comment.
can you double check every test here is justified, some look like an agent was recording its decisions
| test('resolveSiteUrl ignores keys inherited from Object.prototype', () => { | ||
| assert.equal(resolveSiteUrl(store, { region: '__proto__' }), 'https://store.example'); | ||
| }); |
There was a problem hiding this comment.
we don't get outside data sources here, this is probably the agent being over cautious or logging it's decisions - just delete it
| // The second click of a double-click on the previous step's button can land here when the step switches | ||
| // instantly (reduced motion). It must not change the setting. | ||
| if (event.detail > 1) return; |
There was a problem hiding this comment.
something is off here that I can't put my finger on - if it's down to whether animations fire their ending events or not, then this logic should be near that code (a genuine use-case for a useEffect since it can get react to sync with the animation events)
Asana Task/Github Issue: https://app.asana.com/1/137249556945/task/1218157738560967
Description
To pin down the page↔native messages early, this adds a
pickeronboarding step where the user picks suggested sites to add as favorites. The site list is the one the experiment ships with. This PR does not include icons on purpose.topSitesPickeris opt-in and sits aftercustomize. It shows only when native lists it ininit.steps.shouldShowTopSitesPickerrequest. The response is{ show: boolean, existingFavorites?: string[] }. I chose a page-side ask over native pushingexcludeafter the import, because native then decides at the moment the user reaches the step, including users who skipped the import.picker. A failed request, an answer withoutshow: true, or no answer within 2 seconds skips the picker, and a late answer is ignored. While it waits, the page sits in the reducer'sexecutingstatus, so Next and the row controls are disabled and other actions are dropped.pickerstays in the order until the answer arrives.stepDefinitions.topSitesPickercarriessites(id,url,title,section). Schema inmessages/types/picker-step.json.existingFavoritesarrives in the answer, not inonConfigUpdate. The genericexcludeinonConfigUpdatestill works for other steps.app/v4/data/data.js. Gmail and Outlook savemail.google.comandoutlook.live.com, wheregmail.comandoutlook.comredirect, so they match the favorites people import.init.region(ISO 3166-1 alpha-2, e.g.GB). A picker site can carry aurlByRegiontable keyed on that region, or aurlTemplatewhose{locale}comes from the page language. Amazon lists its stores inurlByRegionand falls back to amazon.com. Wikipedia useshttps://{locale}.wikipedia.org, so every edition works without a list. I put the variants in the site data rather than in page code, so the list can move to native or remote config without the page naming a site. Asiteslist that native sends is resolved the same way.www., show as picked and locked. I chose that over hiding them so a user who just imported YouTube sees it there.addFavoritesnotify,{ favorites: [{ id, url, title }] }, without the existing favorites. Skip sends nothing.app/global.js), and it could silently pick "Search Only". The reducer now acceptstitle-completewhile a value saves, and the address bar options ignore a click withevent.detail > 1.Mock URL params
Previews run against the mock transport, which these params steer.
readme.mdlists them all.existingFavorites=<url>,<url>topSitesPicker=hideshow: false, so the page skips the picker.region=<code>init.region. Unlisted codes get amazon.com.locale=<lang>steps=<id>(repeatable)init.steps.pickermust be listed.page=<id>page=pickeropens the picker without asking native, which suits styling work only.platform=windowsdebugStateThere is no param for a slow or missing answer. The 2-second timeout is covered by Playwright on Windows, which holds the request.
Review notes, unfixed
executingfor that toggle, and anadvancelanding then throws. It affects every settings step, so it belongs in its own change.error-boundaryincluded, so a render error in that window wouldn't reachfatal.onConfigUpdateduring the wait and then answers yes,stepCompletedreportsnext: 'picker'.page=picker, shows without native being asked. Real orders start withwelcome.detail > 1clicks for a moment after any step change would cover every step, including Next and Start Browsing. That belongs in its own change.?region=with an empty value hidesinit.region(??rather than||).withResolvedSiteUrlstakes an object, unlike the otherwith*methods. A two-letter language with no Wikipedia edition gives a favorite that doesn't open.config-updatepushes don't resolve site URLs, though native doesn't send sites that way today.onboarding.mddoesn't listinit.regionyet. TheisBusycomment inSettingsContent.jsand the comment on locks inPickerContent.jspredate the ask. New tests inline locators rather than adding page-object helpers.main: a leftoverconsole.log('KV', ...)inSettings.withStepDefinitions, and a "Side effects" comment inapp/global.jsthat no longer matches its branch.Testing Steps
npm run build && npm run lintcd special-pages && npm run test-unitcd special-pages && npx playwright test pages/onboarding --reporter listEach preview starts on
customize. Skip its three rows, then click Next.https://www.amazon.co.uk.https://www.amazon.deand Wikipedia ishttps://de.wikipedia.org.https://www.amazon.com.Checklist
Please tick all that apply: