Repository navigation
#476 - Restore OmniStudio export compatibility - #477
Conversation
Restore hierarchy and mapping order, serialization, filenames, and portable namespace values for direct OmniStudio exports. Keep export identities separate from deployment matching keys and retain identity inputs across consolidated and expanded exports. Add native and managed Build Tools parity fixtures and identity regression coverage. Refs #476
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
vlocode/packages/vlocity/src/vlocityNamespaceService.ts
Lines 47 to 48 in 3ed0bfb
When JSON exported from a managed org is later consumed in a namespace-free OmniStudio org, this turns /vlocity_cmt/v1 into /%vlocity_namespace%/v1, but updateNamespace() removes only the placeholder and therefore restores it as //v1. That malformed Apex REST path breaks the cross-runtime portability this change introduces; the namespace-free replacement needs to remove one adjacent slash as well.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
🟡 Changes recommended
The new vlocity sort implementation treats boolean false as an empty value (sorted last), which can produce incorrect ordering for configured sort fields.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Restores direct OmniStudio export output parity with Vlocity Build Tools by introducing export-key-based identity expansion plus deterministic normalization (sorting, null handling, JSON parsing) driven by export definitions for OmniScripts, Integration Procedures, and DataRaptors.
Changes:
- Adds
exportKey(separate frommatchingKeyFields) and expansion-time key rewriting viaVlocityRecordExportKeyValues. - Centralizes output normalization (ordering, null policies, JSON parsing controls, file expansion ordering) and adds Build Tools parity fixtures/tests.
- Updates OmniStudio standard/managed export definitions to match legacy Build Tools behavior (hierarchy ordering, mapping sort, filenames/extensions, parsing policies).
File summaries
| File | Description |
|---|---|
| packages/vlocity/src/vlocityNamespaceService.ts | Extends namespace placeholder replacement to handle namespaced REST path segments. |
| packages/vlocity/src/datapack/datapack.ts | Introduces VlocityRecordExportKeyValues reserved field constant for export identity inputs. |
| packages/vlocity/src/constants.ts | Adds VlocityRecordExportKeyValues to reserved datapack field list. |
| packages/vlocity/src/tests/vlocityNamespaceService.test.ts | Adds coverage for round-tripping namespaced API paths in JSON strings. |
| packages/vlocity-deploy/src/exportDefinitions/omnistudioStandardDatapackDefinitions.yaml | Aligns standard OmniStudio export definitions with Build Tools parity (exportKey, sorting, parsing, filenames). |
| packages/vlocity-deploy/src/exportDefinitions/omnistudioManagedDatapackDefinitions.yaml | Aligns managed OmniStudio export definitions with Build Tools parity (exportKey, sorting, parsing, filenames). |
| packages/vlocity-deploy/src/export/exportDefinitionStore.ts | Adds exportKey support and improves definition/field lookup across scopes and namespace/casing variants. |
| packages/vlocity-deploy/src/export/exportDefinitions.ts | Extends export definition types (exportKey/nullValues/parseJson/sortParentField/sortMode). |
| packages/vlocity-deploy/src/export/exportDefinitions.schema.json | Updates JSON schema to reflect new export definition capabilities. |
| packages/vlocity-deploy/src/export/datapackValue.ts | Adds shared datapack value helpers (field access, canonical key sorting). |
| packages/vlocity-deploy/src/export/datapackSorting.ts | Adds Build Tools-compatible comparators and hierarchical sort helper. |
| packages/vlocity-deploy/src/export/datapackNormalizer.ts | Introduces normalization pipeline for consolidated and expanded outputs (sort, prune, null policy, key ordering). |
| packages/vlocity-deploy/src/export/datapackExportKeys.ts | Implements expansion-time export identity rewriting using exportKey + retained inputs. |
| packages/vlocity-deploy/src/export/datapackExporter.ts | Integrates normalization, export-key input capture, and configurable JSON parsing during export. |
| packages/vlocity-deploy/src/export/datapackExpander.ts | Applies export keys before naming/expansion and uses normalizer for stable output + canonical JSON serialization. |
| packages/vlocity-deploy/src/tests/exportDefinitionStore.test.ts | Adds regression coverage for scoped exportKey resolution. |
| packages/vlocity-deploy/src/tests/datapackSorting.test.ts | Adds unit coverage for vlocity comparator normalization caching behavior. |
| packages/vlocity-deploy/src/tests/datapackNormalization.test.ts | Adds tests for normalization policies (sorting, pruning order, JSON parsing, circular hierarchy detection). |
| packages/vlocity-deploy/src/tests/datapackExportKeys.test.ts | Adds tests for exportKey application across records/references and managed/standard behavior. |
| packages/vlocity-deploy/src/tests/datapackExporter.test.ts | Adds end-to-end parity and regression coverage for export behavior and fixtures. |
| packages/vlocity-deploy/src/tests/fixtures/exportParity/standard-OmniScript.json | Adds frozen Build Tools oracle fixture (standard OmniScript). |
| packages/vlocity-deploy/src/tests/fixtures/exportParity/standard-IntegrationProcedure.json | Adds frozen Build Tools oracle fixture (standard Integration Procedure). |
| packages/vlocity-deploy/src/tests/fixtures/exportParity/standard-DataRaptor.json | Adds frozen Build Tools oracle fixture (standard DataRaptor). |
| packages/vlocity-deploy/src/tests/fixtures/exportParity/managed-OmniScript.json | Adds frozen Build Tools oracle fixture (managed OmniScript). |
| packages/vlocity-deploy/src/tests/fixtures/exportParity/managed-IntegrationProcedure.json | Adds frozen Build Tools oracle fixture (managed Integration Procedure). |
| packages/vlocity-deploy/src/tests/fixtures/exportParity/managed-DataRaptor.json | Adds frozen Build Tools oracle fixture (managed DataRaptor). |
| packages/vlocity-deploy/src/tests/fixtures/exportParity/README.md | Documents parity fixture intent, boundaries, and regeneration procedure. |
| packages/vlocity-deploy/src/tests/fixtures/exportParity/generate.mjs | Adds offline Build Tools-only oracle generator script for fixtures. |
| packages/vlocity-deploy/README.md | Documents export identity/output behaviors and new export definition options. |
Review details
- Files reviewed: 29/29 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| function toSortValue(value: DatapackValue): SortValue { | ||
| if (!value && value !== 0) { | ||
| return null; | ||
| } | ||
| return typeof value === 'object' ? JSON.stringify(sortObjectKeys(value)) : value; | ||
| } |
Direct OmniStudio exports differed from Vlocity Build Tools output in element and mapping order, export identity, serialization, and filenames. Restore compatibility for OmniScripts, Integration Procedures, and DataRaptors through export definitions.
Export keys are field lists independent of deployment matching keys. Expansion applies them to records and cross-datapack references, preserving the required inputs across streamed and consolidated exports. Sorting and naming run before ignored fields are removed.
Validation: 253 tests across 30 suites passed, including six native/managed Build Tools parity fixtures and export-key regression coverage. Workspace build passed. Full lint still reports existing failures. Managed parity is covered by fixtures; it has not been validated against a live managed org.
Refs #476