Commit Graph
1 Commits
Author SHA1 Message Date
Miranda Limonczenko 447cfa5227 feat(docs): add docs-ia-mvp-v1 flag for the new navigation (#52049)
Closes DOCS-1464

## Problem

The new docs navigation, Option 1, needs an A/B test against today's
navigation. The docs app has no flag that switches the navigation per
visitor.

`docs:*` keys in this repo are build-time toggles from
`enabled-features`. They are the same for every visitor, so they can't
run an A/B. The flag is `docs-ia-mvp-v1`, a PostHog multivariate flag,
like `docs-search-v2`.

## Solution

- **Variant hook:** `useIaNavVariant` reads `docs-ia-mvp-v1` and returns
`control` or `option-1`. It copies `useSearchV2Variant`. It returns
`control` until the flag resolves, records exposure once resolved, and
respects consent.
- **Query param override:** `?docs-ia-mvp-v1=option-1` or
`?docs-ia-mvp-v1=control` forces a variant for dogfooding and evals. A
forced variant records no exposure.
- **Option 1 config:** `features/IaNav/option1.constants.ts` re-exports
today's navigation constants. An export defined in that file replaces
the re-exported one, so Option 1 in DOCS-1469 overrides only what
changes.
- **Consumers:** The top nav, the mobile menu, and the guide sidebar
read from `useNavItems`, which picks the config for the variant.

**Not changed:** Reference sidebars, breadcrumbs, and hub pages.
Breadcrumbs and hub pages can read `useIaNavVariant` in DOCS-1470 and
DOCS-1471.

**PostHog:** The flag doesn't exist in PostHog yet. Until it does, every
visitor gets `control`, and the query param still works.

## Manual testing

1. Open [Auth with Option 1
forced](https://docs-git-docs-ia-nav-flag-supabase.vercel.app/docs/guides/auth?docs-ia-mvp-v1=option-1).
The top nav and sidebar match today's navigation, because the Option 1
config is a copy. Locally, you can make a change to see the variant.
2. Open [Auth with no
param](https://docs-git-docs-ia-nav-flag-supabase.vercel.app/docs/guides/auth).
The navigation is unchanged.
2026-10-27 15:00:59 -07:00