Skip to content

fix(salesforce): rebuild each relationship's join criteria independently - #593

Merged
jbonofre merged 1 commit into
apache:mainfrom
RyutoYoda:fix/salesforce-relationship-criteria-alignment
Oct 16, 2026
Merged

jbonofre merged 1 commit into
apache:mainfrom
RyutoYoda:fix/salesforce-relationship-criteria-alignment

Conversation

@RyutoYoda

Copy link
Copy Markdown
Contributor

Summary

Criteria are rebuilt per relationship after the relationships are mapped, and two
things made one relationship's state leak into the others:

  • a relationship whose join column is not a field of the entity it names is
    dropped before mapping, but the criteria were rebuilt by pairing the Salesforce
    relationships with the unfiltered Ossie list, so every relationship after a
    dropped one took the preceding relationship's join columns;
  • a relationship whose from_columns and to_columns cannot be paired returned
    out of the loop instead of skipping that one relationship, so every relationship
    after it was exported with no criteria at all.

Exporting a model whose first relationship is dropped produced a surviving
relationship joining on a column that does not exist, which Salesforce rejects
with ENTITY_NOT_VALID, and left a metric spanning that join unable to resolve.
Rebuild each relationship's criteria from the same filtered list the relationships
were mapped from, and independently of its neighbours.

The test added with #404 pinned the error the mismatched criteria produced; with
the criteria correct it now pins the metric resolving against the surviving
relationship's own join columns.

Verification

  • mvn -B clean verify in converters/salesforce: 353 tests, 0 failures, 0 errors, apache-rat:check clean.
  • End to end against a live Salesforce org, one model per case. Both are rejected
    ENTITY_NOT_VALID before this change -- the first naming the join column the
    surviving relationship inherited, the second naming the relationship left
    without criteria -- and both are accepted 201 after it, with the org reading
    the criteria back as declared.
  • Two new tests, each covering one of the two cases above.

Related Issues

No existing issue covers this.

Checklist

Converters

  • Converter changes include tests
  • Round-trip conversion verified

Tests

  • All tests pass locally
  • New tests added for the fix
  • Verified end to end against a live Salesforce org

Compliance

  • No third-party code added
  • Apache RAT check passes

@jbonofre jbonofre left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Building criteria from validateRelationships fixes the shift that a filtered relationship caused for the ones after it, and switching return to continue means one unpairable relationship no longer wipes out criteria for the rest.

LGTM! Thanks!

@jbonofre
jbonofre merged commit 464f396 into apache:main Oct 16, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants