Skip to content

fix(export): Preserve legacy fields and JSON payload values - #479

Open
Codeneos wants to merge 4 commits into
mainfrom
feature/476-export-fields
Open

Codeneos wants to merge 4 commits into
mainfrom
feature/476-export-fields

Conversation

@Codeneos

@Codeneos Codeneos commented Nov 2, 2026

Copy link
Copy Markdown
Owner

Retain parent name and type fields and nested internal reference details in OmniStudio exports without changing deployment matching definitions.

Preserve structured JSON field values through export and deployment using explicit field declarations, while retaining ordinary text references. Compare compatibility fields against Build Tools output and cover JSON round trips and reference handling with regression tests.

Refs #476

Retain parent name and type fields and nested internal reference details
in OmniStudio exports without changing deployment matching definitions.

Preserve structured JSON field values through export and deployment using
explicit field declarations, while retaining ordinary text references.
Compare compatibility fields against Build Tools output and cover JSON
round trips and reference handling with regression tests.

Refs #476
Copilot AI balanced review requested due to automatic review settings November 2, 2026 11:28
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-02T11:30:43.324867Z cde7d89 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Keep read-only values in exported datapacks and let deployment filter
fields Salesforce cannot write. Remove the includeReadOnly option and
retain explicit output exclusions through ignoreFields.

Refs #476

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The change alters core DataPack export and deployment JSON round-trip semantics affecting real customer output, and correctness depends on parity tests requiring runtime validation that cannot be executed here.

No open issues 🎉

What changed in this PR

This PR restores OmniStudio export output to match Salesforce Build Tools after a regression introduced in v2.4.5 (issue #476). It reintroduces two legacy behaviors without altering deployment matching/lookup criteria: (1) internal matching references again carry legacy display/identity fields (e.g. Name, owning-script references, ParentElementName/ParentElementType), and (2) structured JSON payload fields (e.g. PropertySetConfig) are preserved verbatim through export expansion and serialized back to strings on deployment — even when the payload is shaped like a record/reference or contains empty containers and nulls. New declarative knobs (referenceFields, field-level includeReadOnly) drive this via the bundled export definitions, and the fix spans both the export and deployment (datapackRecordFactory) sides so values round-trip losslessly.

Changes:

  • Added referenceFields (object-level) and includeReadOnly (field-level) config, wired through the TS interfaces, generated JSON schema, and bundled OmniStudio standard/managed YAML definitions.
  • Export pipeline now preserves parsed-JSON documents as-is (no null-policy/export-key rewriting, no treating payload objects as dependencies) and copies legacy referenceFields onto internal matching references; deployment re-serializes JSON payload fields back to text instead of resolving them as lookups.
  • Strengthened parity fixtures/tests to compare full internal references against Build Tools output, plus new round-trip and reference-handling regression tests.
File Description
export/​exportDefinitions.ts Adds referenceFields and includeReadOnly interface fields with doc comments.
export/​exportDefinitions.schema.json Regenerated schema reflecting the two new properties.
exportDefinitions/​omnistudioStandardDatapackDefinitions.yaml Adds referenceFields and includeReadOnly parent name/type fields for standard runtime.
exportDefinitions/​omnistudioManagedDatapackDefinitions.yaml Same additions for the managed/namespaced runtime.
export/​datapackNormalizer.ts Preserves parsed-JSON object/array field values instead of normalizing them as SObject graphs.
export/​datapackExportKeys.ts Skips JSON fields during collect/rewrite and merges referenceFields onto internal references.
export/​datapackExporter.ts Honors includeReadOnly so flagged calculated/auto-number fields are kept in output.
datapackRecordFactory.ts Builds a bundled-definition store to re-serialize JSON payload fields to strings on deployment rather than treating them as dependencies.
__tests__/​datapackRecordFactory.test.ts New test ensuring non-JSON object fields still become lookups.
__tests__/​datapackExporter.test.ts New round-trip test across payload shapes; parity comparable() now compares full references; marks parent fields calculated.
__tests__/​__fixtures__/​exportParity/​*.json Oracle fixtures updated to include legacy reference/parent fields.
__tests__/​__fixtures__/​exportParity/​generate.mjs Emits parent name/type and nested owner references when regenerating oracles.
__tests__/​__fixtures__/​exportParity/​README.md Documents narrowed normalization boundaries.
README.md Documents referenceFields, includeReadOnly, and JSON-payload preservation/serialization semantics.

Review effort: Balanced

Use the existing JSON serialization and reference handling. Remove the
extra definition store and speculative reserved-marker handling.

Preserve empty JSON arrays, which have no items for the existing
conversion loop to visit. Retain round-trip coverage for ordinary JSON
values and dependency coverage for text fields.

Refs #476
Keep calculated and auto-number exclusions and existing internal reference
output. Remove the speculative compatibility options and fixture changes
that only reproduced harmless legacy JSON differences.

Retain the reproduced empty-array serialization fix and regression tests
for JSON values and ordinary references.

Refs #476
@sonarqubecloud

sonarqubecloud Bot commented Nov 2, 2026

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
C Maintainability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

This branch has not been deployed

No deployments
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.

2 participants