feat(exo): support viewport-free exo responses [SPA-5371] - #3149
Conversation
Changelist by BitoThis pull request implements the following key changes.
|
|
| Source | Requirement / Code Area | Status | Notes |
|---|---|---|---|
| SPA-5371, SPA-5269, Viewport-Removal-Client-Migration | Update affected ExO clients and public types so responses without the deprecated viewports field are accepted. | ✅ Met | The public ExO entity types now make viewports optional across lib/entities/component-type.ts, lib/entities/component.ts, lib/entities/experience.ts, lib/entities/experience-fragment.ts, lib/entities/experience-template.ts, lib/entities/fragment.ts, and lib/entities/template.ts. Type-level coverage in lib/entities/exo.test-d.ts verifies that responses without the deprecated field are accepted. |
| SPA-5371, Viewport-Removal-Client-Migration | Allow ExO value-side payloads without viewports to use flattened design-property values while continuing to support dimensioned design-property values when viewports are present. | ✅ Met | The new EntityDesignProperties type in lib/entities/component-type.ts allows each design-property entry to be either a flattened DesignPropertyValue or a dimensioned DimensionedDesignPropertyValue. Experience, Experience Fragment, Fragment, and inline node types use this shared type, and lib/entities/exo.test-d.ts verifies the updated value-side shapes. |
| SPA-5371, Viewport-Removal-Client-Migration | Ensure read-modify-write flows preserve the matching viewports and design-property value shape, and do not replace an omitted viewports field with an empty array. | 🟡 Partial | The type changes preserve compatibility with both optional viewports and dimensioned design-property values when viewports are present, but the diff contains no read-modify-write implementation or behavioral tests proving that matching shapes are preserved or that an omitted viewports field is not replaced with an empty array. Existing fixtures in the repository still contain empty viewport arrays, so the required migration behavior cannot be confirmed. |
Impact Analysis by BitoInteraction DiagramsequenceDiagram
participant Consumer as SDK Consumer
participant Client as Plain Client
participant Types as Entity Types<br/>🔄 Updated | ●●● High
participant API as Contentful API
participant RefTree as 🔗 Reference Tree (experience-packages)
participant Tests as Type Contract Tests<br/>🟩 Added | ●●○ Medium
Consumer->>Client: Request experience or fragment data
Client->>API: GET ExO entity endpoint
API-->>Client: Return entity response
Client->>Types: Apply updated entity response types
Types-->>Client: Accept optional viewports and flattened properties
Client-->>Consumer: Return typed entity data
Consumer->>Types: Compile against EntityDesignProperties
Types->>Tests: Validate entity property contracts
Tests-->>Types: Confirm absent viewports are supported
Consumer->>RefTree: Pass typed entity design properties
RefTree->>Types: Resolve shared entity property types
Types-->>RefTree: Provide compatible flattened property values
alt response includes deprecated viewports
API-->>Client: Include viewport collection when present
Client-->>Consumer: Expose optional viewport data
else response omits deprecated viewports
API-->>Client: Return flattened design properties only
Client-->>Consumer: Expose the new compatible shape
end
Consumer-->>RefTree: Render or process the typed entity tree
This MR updates the entity type transformation contract by adding EntityDesignProperties and making deprecated viewports optional across ExO entities, while adding type-level contract tests. The Plain Client still integrates with the Contentful API, and the downstream Reference Tree package can consume responses with flattened design properties or without viewports. The main upstream impact is on SDK consumers that compile against these exported types, with no runtime persistence changes. Cross-Repository Impact Analysis
Code Paths AnalyzedImpact: Flow: Direct Changes (Diff Files): Repository Impact: Cross-Repository Dependencies: Database/Caching Impact: API Contract Violations: Infrastructure Dependencies: Additional Insights: Testing RecommendationsFrontend Impact: Service Integration: Data Serialization: Privacy Compliance: Backward Compatibility: OAuth Functionality: Cross-Service Communication: Reliability Testing: Additional Insights: Analysis based on known dependency patterns and edges. Actual impact may vary. |
There was a problem hiding this comment.
Code Review Agent Run #a80e52
Actionable Suggestions - 3
-
lib/entities/fragment.ts - 1
- Undocumented exported-type change · Line 69-70
-
lib/entities/experience.ts - 1
- Exported type contract change · Line 49-50
-
lib/entities/experience-fragment.ts - 1
- Exported type change undocumented · Line 46-47
Additional Suggestions - 1
-
lib/entities/experience.ts - 1
-
Duplicated inline design-property type · Line 50-50The inline union `Record` is repeated at lines 50 and 87 (and in `experience-fragment.ts`/`fragment.ts`). Extracting a named alias would keep the flattened-vs-dimensioned shape defined once and avoid divergence when it changes.
-
Review Details
-
Files reviewed - 8 · Commit Range:
273e6f3..74897db- lib/entities/component-type.ts
- lib/entities/component.ts
- lib/entities/exo.test-d.ts
- lib/entities/experience-fragment.ts
- lib/entities/experience-template.ts
- lib/entities/experience.ts
- lib/entities/fragment.ts
- lib/entities/template.ts
-
Files skipped - 0
-
Tools
- Whispers (Secret Scanner) - ✔︎ Successful
- Detect-secrets (Secret Scanner) - ✔︎ Successful
- Eslint (Linter) - ✔︎ 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
Code Review Agent Run #e7391cActionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
Code Review Agent Run #8c9434Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
Code Review Agent Run #cc32fdActionable Suggestions - 0Additional Suggestions - 1
Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
94db81c to
85c83c1
Compare
There was a problem hiding this comment.
Code Review Agent Run #49cb36
Actionable Suggestions - 2
-
lib/entities/fragment.ts - 1
- Breaking type change undocumented · Line 65-65
-
lib/entities/experience-fragment.ts - 1
- CWE-1078: Inappropriate Coupling Breaking Type · Line 45-45
Additional Suggestions - 2
-
lib/entities/exo.test-d.ts - 2
-
Misleading test title · Line 15-15The test title calls `viewports` 'deprecated', but no `@deprecated` tag exists on `viewports` in `ComponentProps`, `ComponentTypeProps`, `ExperienceProps`, `ExperienceFragmentProps`, `ExperienceTemplateProps`, `FragmentProps`, or `TemplateProps` (verified via grep across `lib/`). Either rename the test to describe optionality, or add the deprecation marker to the types if that is intended.
-
Title references untested scenario · Line 33-33The title says 'when viewports are absent', but the body only asserts `designProperties` types and never references `viewports`. Rename it to describe the actual assertion (e.g. 'designProperties is EntityDesignProperties') so the title does not imply coverage that does not exist.
-
Review Details
-
Files reviewed - 8 · Commit Range:
ed806d8..85c83c1- lib/entities/component-type.ts
- lib/entities/component.ts
- lib/entities/exo.test-d.ts
- lib/entities/experience-fragment.ts
- lib/entities/experience-template.ts
- lib/entities/experience.ts
- lib/entities/fragment.ts
- lib/entities/template.ts
-
Files skipped - 0
-
Tools
- Whispers (Secret Scanner) - ✔︎ Successful
- Detect-secrets (Secret Scanner) - ✔︎ Successful
- Eslint (Linter) - ✔︎ 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
9b11d66 to
2f5957f
Compare
Lisa White (whitelisab)
left a comment
There was a problem hiding this comment.
While it is technically correct that this is a breaking change to the Experiences API, we have specifically noted in the README that breaking changes can happen with Experiences since this is still "experimental" while we are pre-beta. We would prefer to not ship this as a new major release for the entire SDK. Can you remove any feat! and BREAKING CHANGE: annotations from your commits and the PR title so that we can ensure that this goes out as a new minor release? Thank you!
2f5957f to
9303acd
Compare
9303acd to
cb6e62b
Compare
Code Review Agent Run #41e6fbActionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
Summary
Allow ExO entity responses without the deprecated
viewportsfield.Description
Updates the public types for both the legacy and renamed ExO entities so API responses that omit
viewportstype-check. Adds a type-level regression test covering every affected response type.Motivation and Context
SPA-5371 coordinates clients ahead of the API response change that removes
viewports. Without this relaxation, consumers cannot parse the post-migration response shape.PR Checklist
CONTRIBUTING.mdfileSummary by Bito
This PR updates the public ExO TypeScript entity models to accept API responses that omit the deprecated viewports field. It also broadens designProperties for experience and fragment entities to accept both flattened and dimensioned values, with compile-time regression coverage for the affected current and legacy types.
Detailed Changes