Repository navigation
fix(salesforce): restore metric custom_extensions, default label, respect restored dataType - #512
Merged
jbonofre merged 2 commits intoOct 4, 2026
Conversation
MetricMappingHandler.mapOssieToSalesforce() is the only one of the four array-level handlers (datasets, relationships, semantic model, metrics) that never called CustomExtensionHandler.restoreCustomExtensionsAtLevel() for its own level, even though the METRICS case in that switch has existed since the custom-extensions mechanism was added. A metric's custom_extensions (e.g. a Salesforce-specific label) were silently dropped on Ossie -> Salesforce export. Wire the same restore call used by DatasetMappingHandler and RelationshipMappingHandler, placed before the expression is compiled so it only fills in properties the generic mapping didn't already produce. Signed-off-by: Ashfaq <105435085+Ashfaqbs@users.noreply.github.com>
Ossie metrics have no label field, so every exported semanticCalculatedMeasurement had none unless custom_extensions restored one. Default it to apiName, matching DatasetMappingHandler/SemanticModelMappingHandler's existing pattern. Also switch the Tua compiler's dataType assignment to putIfAbsent, so an exact Salesforce dataType restored from custom_extensions (e.g. Currency) is not clobbered by the derived type. Signed-off-by: Ashfaq <105435085+Ashfaqbs@users.noreply.github.com>
jbonofre
approved these changes
Oct 4, 2026
jbonofre
left a comment
Member
There was a problem hiding this comment.
LGTM!
Thanks @Ashfaqbs for cleanly re-deriving this on top of #404.
- Metric
custom_extensionsrestoration atLevel.METRICSaligns with the other array handlers. - Defaulting
labeltoapiNamefollows the pattern inDatasetMappingHandler/SemanticModelMappingHandler. putIfAbsentpreserves exact types (likeCurrency) without disturbing expression compilation.- I verified cleanly against
mainwith all test passing.
6 tasks done
RyutoYoda
added a commit
to RyutoYoda/ossie
that referenced
this pull request
Oct 6, 2026
An Ossie field's label is optional and the schema puts no minLength on it, so an exported semanticDimension, semanticMeasurement or semanticCalculatedDimension could carry no label, an empty one, or a null restored from custom_extensions. Salesforce requires MasterLabel on every field and rejects all three the same way on create: RequiredFieldException: [MasterLabel] Fall back to the apiName in applyFieldDefaults, which already runs after custom extensions so a restored exact Salesforce label still wins. This matches DatasetMappingHandler, SemanticModelMappingHandler and the metric fix in apache#512; FieldMappingHandler was the one handler left without it.
jbonofre
pushed a commit
that referenced
this pull request
Oct 6, 2026
An Ossie field's label is optional and the schema puts no minLength on it, so an exported semanticDimension, semanticMeasurement or semanticCalculatedDimension could carry no label, an empty one, or a null restored from custom_extensions. Salesforce requires MasterLabel on every field and rejects all three the same way on create: RequiredFieldException: [MasterLabel] Fall back to the apiName in applyFieldDefaults, which already runs after custom extensions so a restored exact Salesforce label still wins. This matches DatasetMappingHandler, SemanticModelMappingHandler and the metric fix in #512; FieldMappingHandler was the one handler left without it.
7 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implemented with Claude Code (model: Claude Sonnet 5, autonomous mode); comment/commit fully AI-drafted.
Supersedes #402, which was based on
MetricMappingHandlerbefore #404 rewroteunwrapExpressions()into a full JSqlParser-backed Tua expression compiler. Rebasing #402 directly produced conflicts in the same file, and most of its TABLEAU-only enforcement logic is now obsolete (the new compiler already supports TABLEAU/SNOWFLAKE/ANSI_SQL dialects properly). This PR re-derives just the part of #402 that is still a real, unaddressed gap on currentmain, carrying forward @jbonofre's review feedback from #402:mapOssieToSalesforce()is the only one of the four array-level handlers (datasets, relationships, semantic model, metrics) that never calledCustomExtensionHandler.restoreCustomExtensionsAtLevel()for its own level, even thoughLevel.METRICShas existed in that switch since the mechanism was added. A metric'scustom_extensionswere silently dropped on Ossie -> Salesforce export.labelfield, so every exportedsemanticCalculatedMeasurementhad none unlesscustom_extensionsrestored one. Defaulted it toapiName, matchingDatasetMappingHandler/SemanticModelMappingHandler.dataTypeassignment now usesputIfAbsent, so an exact SalesforcedataTyperestored fromcustom_extensions(e.g.Currency) isn't clobbered by the derived type.Restore runs before
unwrapExpressions(), sincerestoreSalesforceCustomExtensiononly fills keys that are still absent.Added
testMetricCustomExtensionsRestoredBeforeExpressionCompilationcovering: a metric withcustom_extensions(label + dataType) gets both restored without disturbing its compiled Tua expression/syntax, while a metric withoutcustom_extensionsstill gets its label defaulted toapiNameand keeps its deriveddataType.Test plan
mvn testinconverters/salesforce: 285 tests, 0 failures, 0 errors.