Skip to content

docs(docs): add v1 to v2 migration guide - #514

Merged
Charles Hudson (phobetron) merged 1 commit into
mainfrom
docs/v1-v2-migration-guide
Sep 21, 2026
Merged

Charles Hudson (phobetron) merged 1 commit into
mainfrom
docs/v1-v2-migration-guide

Conversation

@phobetron

Copy link
Copy Markdown
Collaborator

Summary

  • add a public migration guide for moving the final v1 Optimization package releases to the coordinated v2 release
  • cover the clientId to spaceId rename, the main to master default change, Web Component and native initialization updates, API route changes, direct schema changes, and runtime-specific validation
  • add verified v1 migration knowledge, a migration blueprint, and the shared current API transport fact used by the guide
  • link the guide from the documentation index, repository README, and affected package READMEs so it is discoverable from the published package surfaces
  • strengthen the migration-guide authoring checklist with staged-version, cross-runtime example, and performable-validation rules found during newcomer review

Release coordination

This documentation is intended to ship with release PR #503. Its version matrix matches that release: ten coordinated 2.0.0 packages and @contentful/optimization-api-schemas@1.2.1.

Generated changelogs in #503 are intentionally not modified by this PR.

Review

  • completed an independent newcomer review and resolved the reader blockers it found
  • completed a technical-foundation review against the final v1 tags, current package source, SDK knowledge, and migration knowledge
  • confirmed every remaining load-bearing interface and behavioral claim has the appropriate source

Validation

  • pnpm guides:check
  • pnpm knowledge:check
  • pnpm fern:check
  • targeted Prettier check for every changed file
  • pnpm docs:generate — completed with 0 errors; TypeDoc reported its existing warning class for unsupported code-block highlighting and unresolved generated-reference links
  • git diff --check

The repository-wide pnpm format:check also inspected ignored Angular cache output and reported formatting warnings there. No cache files were modified; every file in this PR passes the targeted Prettier check.

Document the coordinated package upgrade, configuration and transport changes, direct schema migration, and runtime-specific validation paths. Add verified v1 migration knowledge, a guide blueprint, documentation navigation, and package README links so the guide ships with the v2 release.
@bito-code-review

bito-code-review Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

Code Review Agent Run #2a3121

Actionable Suggestions - 0
Additional Suggestions - 1
  • packages/web/web-sdk/README.md - 1
    • Broken migration-guide link · Line 30-35
      This link currently 404s: the guide isn't in the published Guides index, and both the filename-based URL and the fern-slug URL return 404. The file exists in-repo (`documentation/guides/migrating-optimization-sdk-packages-from-v1-to-v2.md`) but isn't published yet. Publish the guide first, or hold this callout until it's live.
Review Details
  • Files reviewed - 18 · Commit Range: e92398e..e92398e
    • README.md
    • documentation/authoring/migration-blueprints/optimization-sdk-v1-to-v2.md
    • documentation/guides/README.md
    • documentation/guides/migrating-optimization-sdk-packages-from-v1-to-v2.md
    • documentation/internal/migration-knowledge/optimization-sdk-v1.md
    • documentation/internal/sdk-knowledge/shared/concepts.md
    • packages/android/README.md
    • packages/ios/ContentfulOptimization/README.md
    • packages/node/node-sdk/README.md
    • packages/react-native-sdk/README.md
    • packages/universal/api-client/README.md
    • packages/universal/api-schemas/README.md
    • packages/universal/core-sdk/README.md
    • packages/web/frameworks/nextjs-sdk/README.md
    • packages/web/frameworks/react-web-sdk/README.md
    • packages/web/preview-panel/README.md
    • packages/web/web-sdk/README.md
    • skills/optimization-guide-authoring/references/authoring-checklist.md
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers an incremental AI Review.

  • /review full - Manually triggers a full AI Review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Default Agent You can customize the agent settings here or contact your Bito workspace admin at jared.jolton@contentful.com.

Documentation & Help

AI Code Review powered by Bito Logo

@phobetron
Charles Hudson (phobetron) merged commit 0612b43 into main Sep 21, 2026
41 checks passed
@phobetron
Charles Hudson (phobetron) deleted the docs/v1-v2-migration-guide branch September 21, 2026 10:40
@bito-code-review

Copy link
Copy Markdown

Impact Analysis by Bito

Cross-Repository Impact Analysis
What Changed Impact of Change Suggested Review Actions
The migration guide documents the v1-to-v2 configuration rename from clientId to spaceId and the default environment change from main to master. - verify-needed: external applications and SDK layers using clientId or relying on the omitted environment default: Existing integrations may fail type checking, target the wrong Contentful environment, or silently change personalization results after upgrading. - Search all consuming repositories and examples for clientId, client-id, and omitted environment configuration.
- Add migration tests proving that an application explicitly configured for main continues to query main after upgrading.
- Verify that every supported runtime documents the same spaceId and environment behavior.
Experience API and Insights API route prefixes move from organization-scoped v1/v2 paths to space-scoped v2/v3 paths. - verify-needed: direct API Client consumers, reverse proxies, network allow-lists, request mocks, and route diagnostics: Infrastructure or tests matching the legacy organization routes can return route-not-found errors or block requests after migration. - Search dependent repositories and deployment configuration for v2/organizations/ and v1/organizations/.
- Add request-mock tests for v3/spaces/{spaceId}/environments/{environment} and v2/spaces/{spaceId}/environments/{environment}/events.
- Update proxy and firewall allow-lists before publishing the migration guide.
The documented response and event schema contracts change, including ResponseEnvelope.error, the Change union, and Experience/Insights event members. - verify-needed: applications, adapters, fixtures, and tooling that import API schemas or perform exhaustive type switching: Consumers assuming error is boolean, Change is only Variable, or the old event members are exhaustive may reject valid v2 payloads or fail compilation. - Run schema fixture tests with error objects, Experience and Fragment changes, and exo_node_view/exo_node_click/exo_node_hover events.
- Check exhaustive switch statements for assumptions about alias, group, and the previous event union.
- Coordinate schema and consumer releases if these contracts are published from separate packages.
The PR adds a coordinated migration guide, internal migration blueprint, migration knowledge, shared SDK transport knowledge, and links from package READMEs. - intra-repo: documentation navigation, SDK package onboarding, and optimization-guide-authoring workflow: Readers now receive migration instructions from the root README, package READMEs, the guides index, and the authoring checklist. - Validate every newly added relative link and generated documentation URL.
- Run documentation linting, link checks, and the guide-generation pipeline.
- Confirm the internal blueprint and knowledge source remain synchronized with the public migration guide.
Code Paths Analyzed

Impact:
This is a documentation-only change that introduces a v1-to-v2 migration workflow for all supported Optimization SDK runtimes. It documents configuration, environment, transport, schema, package-version, preview-panel, and validation changes without modifying runtime implementation.

Flow:
Package/root README entry points → migration guide → package inventory and configuration migration → optional direct API/schema migration → dependency verification → event and personalization smoke checks → troubleshooting.

Direct Changes (Diff Files):
• README.md [5-11] — Adds a root-level link to the v1-to-v2 migration guide.
• documentation/authoring/migration-blueprints/optimization-sdk-v1-to-v2.md [19-86] — Adds the structured migration blueprint and reader-goal metadata.
• documentation/guides/README.md [88-114] — Adds the migration guide to the documentation guide index.
• documentation/guides/migrating-optimization-sdk-packages-from-v1-to-v2.md [116-444] — Adds the complete public migration guide covering versions, configuration, routes, schemas, runtimes, validation, and troubleshooting.
• documentation/internal/migration-knowledge/optimization-sdk-v1.md [447-546] — Adds factual internal migration references and v1 package baselines.
• documentation/internal/sdk-knowledge/shared/concepts.md [549-561] — Documents v2 API transport scope and the master environment default.
• packages/android/README.md [569-579] — Adds Android migration callout.
• packages/ios/ContentfulOptimization/README.md [587-599] — Adds iOS migration callout.
• packages/node/node-sdk/README.md [605-615] — Adds Node migration callout.
• packages/react-native-sdk/README.md [623-633] — Adds React Native migration callout.
• packages/universal/api-client/README.md [641-651] — Adds API Client migration and route-infrastructure callout.
• packages/universal/api-schemas/README.md [659-667] — Adds migration guidance for the deprecated schema facade.
• packages/universal/core-sdk/README.md [675-685] — Adds Core SDK migration callout.
• packages/web/frameworks/nextjs-sdk/README.md [693-703] — Adds Next.js migration callout.
• packages/web/frameworks/react-web-sdk/README.md [711-721] — Adds React Web migration callout.
• packages/web/preview-panel/README.md [729-739] — Adds Preview Panel migration and package-alignment callout.
• packages/web/web-sdk/README.md [747-757] — Adds Web SDK migration callout.
• skills/optimization-guide-authoring/references/authoring-checklist.md [765-777] — Adds checklist requirements for staged examples, runtime labeling, and actionable validation.

Repository Impact:
• Documentation navigation: Multiple package READMEs and the guides index now route readers to a single migration guide.
• SDK migration guidance: The guide covers JavaScript, TypeScript, Swift, Kotlin, Web Components, and framework SDKs.
• Schema and transport documentation: Direct API Client and API schema consumers receive explicit route and union-shape migration instructions.
• Documentation authoring process: The checklist now requires version-aware staged examples, runtime labels, and performable validation steps.

Cross-Repository Dependencies:
• External applications using Optimization SDK packages: They may need to rename clientId to spaceId, pin environment explicitly, and upgrade coordinated package versions.
• Direct API Client integrations and deployment infrastructure: Proxies, allow-lists, request mocks, and diagnostics may depend on the old organization-based route prefixes.
• Direct API schema consumers: Schema parsing and exhaustive union handling must support the documented v2 response and event shapes.

Database/Caching Impact:
• None

API Contract Violations:
• The guide documents breaking configuration and transport changes but does not provide compatibility aliases; consumers retaining clientId or organization-based routes may fail after upgrading.
• The documented environment default changes from main to master, which can cause a silent behavioral change for integrations that omitted environment.
• ResponseEnvelope.error changes from boolean | null to { code: string } | null.
• The Change and event unions expand and remove legacy assumptions, requiring exhaustive consumers to be updated.
• The package matrix should be validated against actual published versions before release; the diff itself changes documentation only.

Infrastructure Dependencies:
• Reverse proxies, network allow-lists, route mocks, and diagnostics matching v1/v2 organization paths.
• Package-manager lockfiles and dependency resolution for coordinated v2 packages.
• Gradle, Swift Package Manager, npm, pnpm, and Yarn dependency inspection workflows described by the guide.
• Generated documentation and link validation for the new guide URLs.
• Contentful space and environment configuration used by migration smoke tests.

Additional Insights:
• Documentation correctness: The guide distinguishes preparatory v1 edits from target v2 edits, reducing the risk of readers applying spaceId before upgrading packages.
• Runtime coverage: Validation instructions cover Node, Web, React Web, Next.js, React Native, iOS, and Android event and personalization checks.
• Preview compatibility: The guide explicitly requires aligning Preview Panel with upgraded Web and Core packages.

Testing Recommendations

Frontend Impact:
• Run documentation link checks for every package README callout and the generated migration-guide URL.
• Verify the Web Component example uses space-id and spaceId consistently, including the imperative DOM property example.
• Validate the Preview Panel migration instructions against a Web SDK instance using spaceId and environment.

Service Integration:
• Exercise an end-to-end migration smoke test for each supported runtime: initialize with spaceId and explicit environment, emit one accepted event, and resolve an all-visitors variant.
• For direct API Client consumers, verify requests use v3/spaces/{spaceId}/environments/{environment} for Experience and v2/spaces/{spaceId}/environments/{environment}/events for Insights.

Data Serialization:
• Run schema fixtures with ResponseEnvelope.error equal to null and { code: string }.
• Test Change payloads for Variable, Experience, and Fragment.
• Test Experience and Insights event payloads for exo_node_view, exo_node_click, and exo_node_hover, and verify old alias/group assumptions are not treated as exhaustive.

Privacy Compliance:
• Verify the guide's statement that migration does not require a profile-cookie reset, and confirm consent-denied events remain blocked rather than replayed.
• Ensure migration validation does not require adding new network instrumentation or expose sensitive identifiers in diagnostics.

Backward Compatibility:
• Check that the guide clearly distinguishes v1 preparatory configuration using clientId from v2 configuration using spaceId.
• Verify the package matrix against published releases: coordinated packages target 2.0.0, while @contentful/optimization-api-schemas targets 1.2.1.
• Test an integration that omitted environment under v1 and confirm explicit main preserves behavior after migration.

OAuth Functionality:
• None

Cross-Service Communication:
• Test proxy, allow-list, and request-mock configurations against the new space-scoped route prefixes.
• Inspect lockfiles for unintended mixed v1/v2 Optimization package trees after installation.
• Validate direct API Client response and event handling across the API boundary using v2 payload fixtures.

Reliability Testing:
• None

Additional Insights:
• Run Markdown linting, table formatting checks, spelling checks, and the documentation generation pipeline.
• Validate that the internal migration blueprint, internal migration knowledge, shared concepts documentation, public migration guide, and package README callouts remain consistent.
• Run the optimization guide authoring checks to cover the newly added checklist items for staged examples, runtime labels, and actionable validation.

Analysis based on known dependency patterns and edges. Actual impact may vary.

@bito-code-review

Copy link
Copy Markdown

✅ Review Settings Overridden

Status: Overridden Successfully

Guidelines:

  • Accepted:

    • General : Review Posture, Repo Truth And Boundaries, Domain Invariants

    • Language : typescript= TypeScript Review Evidence

Note: Extra guidelines beyond 3 general purpose guidelines and 1 language specific guideline per language are not processed. Guidelines are fetched from the source branch.

Tim Beyer (TimBeyer) added a commit that referenced this pull request Sep 21, 2026
…rn lock (#515)

* feat(docs): require every published doc slug to be recorded in the Fern lock

`documentation/guides/migrating-optimization-sdk-packages-from-v1-to-v2.md`
merged in #514 without a `documentation/fern-slugs.lock.json` entry, which was
allowed: the exporter reconciles an unrecorded document in memory, so the page
publishes either way. What it silently lost was slug protection. The existing
check can only compare a slug against one the lock already names, and the sync
workflow runs `pnpm docs:fern` without `--update-lock`, so an entry an author
never commits never appears. That page's first slug reword would have moved a
live URL with no redirect — the exact failure the lock exists to prevent.

It was the first new page since the lock landed in #442, so the gap had never
been reachable before.

`pnpm fern:check` now reports an unrecorded slug the same way it reports a
changed one, naming the command that fixes it, and records the missing v1-to-v2
entry so the check passes on `main`. The slug-change path is unchanged.

Because a check only catches what reaches CI, the contract is also written down
where an author meets it: a new `docs-site-publishing` skill owns the four
artifacts that decide whether a page ships (group README `children:`, the
`fern:` block, the slug lock, MDX safety), the group-global sidebar ordering
rule, and the release-gated sync. `optimization-guide-authoring` now routes to
it from a publication step in its workflow, and the self-review checklist gains
a mechanical section G. `documentation/AGENTS.md` documented only how to change
a slug, never how to record one, and never that `children:` is what publishes a
document at all; both are now stated.

Validation: `pnpm fern:check`, `pnpm guides:check`, `pnpm knowledge:check`,
`pnpm lint`, `pnpm typecheck`, ESLint on both changed scripts, targeted Prettier
on every changed file, `git diff --check`. Verified by hand that the new check
fires on an unrecorded page and that a changed slug is still reported.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* refactor(docs): cut the publishing skill to what is not already written down

The first draft restated ADR 0002 and the `documentation/AGENTS.md` publishing
section at length. Both already own this material, so the skill was mostly a
third copy that could drift from them. It now points at those two as sources of
truth and keeps only what neither records: that a document absent from its group
README `children:` is silently not published, that `children:` order is global
across the group so an index decides position *within* a section, and that a new
slug has to be recorded and committed with the page.

Same cut in the self-review checklist. `pnpm fern:check` mechanically enforces
the `fern:` block shape, slug format, link and anchor resolution, MDX safety, and
slug recording, so restating those as human checkboxes added nothing. Section G
now asks only what a check cannot judge: intent — whether the `children:` index
is the intended position, whether a slug change is deliberate, and whether the
lock diff shipped with the guide.

Descriptions are matched, not read, so the skill's own description is now a
short purpose plus its trigger conditions rather than a summary of its contents.

Wire `fern:check` into the documentation-integrity Stop hook, which ran
`knowledge:check` and `guides:check` but not the check that decides whether an
edit reaches the public site at all. This is the part that actually fires
unprompted: the publishing contract breaks silently, so it needs a trigger that
does not depend on anyone thinking to look. Watched paths gain
`documentation/concepts`, the slug lock, and the fern scripts.

Validation: `pnpm fern:check`, `pnpm guides:check`, `pnpm knowledge:check`,
`bash -n` on the hook, targeted Prettier, `git diff --check`. Exercised the hook
both ways — silent and exit 0 on a clean tree, and reporting the unrecorded-slug
problem with its fix command after removing the lock entry.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant