Skip to content

Fixes #33324: let a force-sync refresh connector-supplied custom properties [Backport #35622 - 2.0] - #35707

Merged
harshsoni2024 merged 1 commit into
2.0from
backport-35622-2.0
Oct 19, 2026
Merged

harshsoni2024 merged 1 commit into
2.0from
backport-35622-2.0

Conversation

@harshsoni2024

@harshsoni2024 harshsoni2024 commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Describe your changes:

Backport of #35622 (38b3094) to 2.0. Fixes #33324 on 2.0.

Connector-supplied custom properties (extension) were written only on an entity's first ingestion. EntityRepository.updateExtension reverts every bot PUT to the stored extension, and ingestion writes as ingestion-bot over the bulk PUT path. So a changed source value never reached the entity, and a newly added one never appeared.

updateExtension now honours overrideMetadata, as updateDescription, updateDisplayName, updateTags and updateCertification already do. When it is set and the incoming extension is non-empty, the incoming properties are merged over the stored ones. Keys the connector sends win, and keys it omits, such as properties curated in the UI, are kept. overrideMetadata defaults to false, so nothing changes until an operator turns on Override Metadata for the pipeline. For why it merges instead of replacing, see #35622 and the ADR it adds.

Differences from the main commit

  • EntityRepository.java: applied cleanly. The change is identical to main's (same git patch-id).
  • EntityRepositoryExtensionTest.java: one import differs. On main, TagUsageDAO lives in ClassificationTagDAOs, which 2.0 doesn't have; on 2.0 it is nested in CollectionDAO. The test imports org.openmetadata.service.jdbi3.CollectionDAO.TagUsageDAO instead, and the rest of the file is unchanged.
  • ADR: docs/decisions/2026-10-16-a-force-sync-merges-connector-supplied-custom-properties.md is kept, because the new Javadoc cites it.

Everything the fix relies on is already on 2.0: EntityUpdater.overrideMetadata and its setter, the nullOrEmpty(JsonNode) overload, and JsonUtils.valueToTree/treeToValue. 2.0's updateExtension matches main's except for its last step, which persists the extension with removeExtension + storeExtension instead of main's replaceExtension. That step runs after the merge and stores whatever the merge produced, so it doesn't change what this fix does.

Tests

No tests were run locally for this backport. EntityRepositoryExtensionTest (9 cases) and the backend suites run in this PR's CI.

Checked locally:

  • mvn spotless:check -pl openmetadata-service passes.
  • Every class, constructor and method the new test uses exists on 2.0 with the same signature.

Type of change:

  • Bug fix

🤖 Generated with Claude Code

RetriggerView in GreptileConfidence Score: 4/5

The merge behavior appears sound, but the explicit Java requirements must be satisfied before merging.

Findings

  1. P2 Helper has two returns ▶
  2. P2 Unchanged values lack `final` ▶
  3. P2 Fixture strings repeat ▶
  4. P2 Helper skips the required import ▶
  5. P2 Reflection helper is copied ▶
  6. P2 Constructor repeats type arguments ▶
  7. P2 Test leaves shared types behind ▶

Summary

Lets bot PUTs refresh custom properties when overrideMetadata is enabled.

  • Force-syncs refresh connector properties without dropping omitted ones.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Bot PUT] --> B{Override enabled and extension non-empty?}
  B -->|No| C[Keep stored extension]
  B -->|Yes| D[Merge incoming keys over stored keys]
  D --> E[Compare properties]
  E --> F[Validate changed properties]
  F --> G[Store extension]
Loading

Reviews (1) · Last reviewed commit: "Fixes #33324: let a force-sync refresh c..." · Reviewed by Greptile

…erties (#35622)

* Fixes #33324: let a force-sync refresh connector-supplied custom properties

Connector-supplied `extension` values landed only on an entity's first write.
EntityRepository.updateExtension reverts any bot PUT to the stored extension,
and ingestion authenticates as ingestion-bot over the bulk PUT path, so a
changed custom property never propagated and a newly added one never appeared.
Deleting and re-ingesting the entity was the only workaround.

The guard itself is right - it stops a scheduled re-sync from clobbering custom
properties a user curated in the UI. What it lacked was the opt-out every
comparable field already has. overrideMetadata is set on the updater and read
in updateDescription, updateDisplayName, updateTags and updateCertification,
but updateExtension never consulted it: 0 of the 25 references in the class
were in that method. It now follows the same shape as its four siblings - the
bot guard applies unless overrideMetadata is set and the incoming extension is
non-empty.

Emptiness is tested through the nullOrEmpty(JsonNode) overload rather than
nullOrEmpty(Object), which stringifies an empty map to "{}" and would call it
non-empty. A connector that is not collecting custom properties sends no
extension, and that absence must not blank the stored ones.

A force-sync merges rather than replaces. The diff below the guard treats a
stored key the request omits as a deletion, so a plain replace would drop
custom properties a user set in the UI the moment any connector force-synced
one property of its own - reintroducing the exact loss the guard prevents.
Tags can afford replace semantics because TagLabel carries LabelType and the
update path filters on it; a custom property carries no provenance at all, and
ingestion only ever sends the properties its own source produces. So the keys
the connector sends win and the rest are left alone.

The cost of that choice: a property removed at the source lingers until someone
deletes it. Removing it automatically needs per-key provenance to tell a
connector-owned property from a curated one, which is the larger design #33324
raises as the alternative and is not attempted here.

Scope: updateExtension is on the generic EntityUpdater, so this reaches every
entity type and every writer of an extension - Athena and Glue via the table
hook, dbt on Metric, SAS on Table. Default behaviour is unchanged, because
overrideMetadata defaults to false; nothing moves unless an operator has
explicitly turned on Override Metadata for that pipeline.

Tests: EntityRepositoryExtensionTest, 7 cases driving updateExtension through
the updater. Three fail without the change - a bot PUT under overrideMetadata
leaving a value stale, dropping a newly added property, and losing a curated
property the connector does not send. The other four pin the behaviour that
must not move: a bot PUT without overrideMetadata keeps the stored extension,
a null or empty incoming extension never blanks it, and a human PUT still
applies.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* Record the force-sync merge decision, cover the non-object path

A force-sync merges the incoming extension over the stored one rather than
replacing it. Tags do replace under the same flag and can afford to, because
TagLabel carries LabelType; a custom property has no provenance at all, so the
merge reads like an inconsistency someone could tidy away. The squash-merge
drops the PR description, so the rule goes in the tree and is cited from the
Javadoc.

Also tests mergedOverStoredExtension's non-object path, taking it to 7/7 lines.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* fix(test): updateExtension behaviour

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
(cherry picked from commit 38b3094)
@harshsoni2024
harshsoni2024 requested a review from a team as a code owner October 19, 2026 08:15
@harshsoni2024
harshsoni2024 removed the request for review from a team October 19, 2026 08:15
@harshsoni2024
harshsoni2024 requested a review from IceS2 October 19, 2026 08:15
@harshsoni2024 harshsoni2024 added the safe to test Add this label to run secure Github workflows on PRs label Oct 19, 2026
@github-actions

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

  • No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.

The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically.

Maintainers can bypass this check by adding the skip-pr-checks label.

@gitar-bot

gitar-bot Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Code Review ✅ Approved

🔴 High risk · Allowing force-sync to merge connector-supplied properties into stored extensions could overwrite curated values when source data is incorrect.

Backports the fix that lets force-sync refresh connector-supplied custom properties by merging incoming extension values over stored ones when overrideMetadata is set, keeping UI-curated keys. No issues found.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

Comment on lines +9614 to +9619
if (!stored.isObject() || !incoming.isObject()) {
return incomingExtension;
}
ObjectNode merged = stored.deepCopy();
merged.setAll((ObjectNode) incoming);
return JsonUtils.treeToValue(merged, Object.class);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Helper has two returns

mergedOverStoredExtension has an early return and a second return at the end. The Java guide requires one return statement per method, placed at the end. Use a result variable and an if/else here. This repository requirement must be satisfied before merging.

Context Used: CLAUDE.md (source)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This backports #35622 and keeps the same code as main, so 2.0 stays in sync and later backports apply cleanly. A single-return refactor would need to land on main first.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

That’s fair. Since this is an intentional backport preserving the main-branch implementation for parity and clean future cherry-picks, I won’t require a 2.0-only single-return refactor. This style adjustment can be made on main first, then backported if desired.

Comment on lines +9611 to +9613
private Object mergedOverStoredExtension(Object storedExtension, Object incomingExtension) {
JsonNode stored = JsonUtils.valueToTree(storedExtension);
JsonNode incoming = JsonUtils.valueToTree(incomingExtension);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Unchanged values lack final

The new helpers declare unchanged parameters and local variables without final. The Java guide requires final on values that do not change. Apply it here and to the unchanged declarations in the new test. This repository requirement must be satisfied before merging.

Context Used: CLAUDE.md (source)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Same code as main's #35622. The backport intentionally matches main, so adding final would need to land on main first.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Understood. Since this backport intentionally matches #35622, adding final only here would create an unnecessary divergence from main. I’ll treat this finding as not applicable to the backport; consistency with main takes precedence.

Comment on lines +149 to +150
Pipeline original = pipelineWithExtension(BOT_NAME, extension("owner_team", "curated"));
Pipeline updated = pipelineWithExtension(BOT_NAME, extension("owner_team", "from-source"));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Fixture strings repeat

The new test repeats property names and other fixture strings. The Java guide requires a named constant when a string appears more than once. Extract constants for values such as owner_team and curated_note, and reuse Entity.INGESTION_BOT_NAME rather than defining the bot name again. This repository requirement must be satisfied before merging.

Context Used: CLAUDE.md (source)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This test is the same as on main (#35622), and the backport keeps it that way. Extracting constants would need to land on main first.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

That’s fair. Since this is an intentional backport of the accepted main change, extracting constants here would create an unnecessary divergence and require a separate change on main first. I’m withdrawing this finding; no change is needed for this PR.

.withName(Entity.PIPELINE)
.withCategory(Category.Entity)
.withCustomProperties(
java.util.Arrays.stream(propertyNames)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Helper skips the required import

java.util.Arrays.stream uses a fully qualified class name in the method body. The Java guide requires imports instead. Import Arrays and use Arrays.stream(propertyNames). This repository requirement must be satisfied before merging.

Context Used: CLAUDE.md (source)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Same code as main's #35622, kept as is so the backport matches main. Importing Arrays would need to land on main first.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

That’s fair. Since this backport intentionally preserves the main implementation verbatim, and the fully qualified java.util.Arrays.stream is functionally correct, I’ll withdraw this finding rather than require a backport-only style change. The import can be cleaned up on the main change if the project wants that convention applied consistently.

Comment on lines +268 to +273
private static void invokeUpdateExtensionOnRealPath(
EntityRepository<Pipeline>.EntityUpdater updater) throws Exception {
Method method =
EntityRepository.EntityUpdater.class.getDeclaredMethod("updateExtension", boolean.class);
method.setAccessible(true);
method.invoke(updater, false);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Reflection helper is copied

invokeUpdateExtensionOnRealPath duplicates the reflection code in invokeUpdateExtension; only the boolean argument differs. The Java guide requires copied blocks to become a shared, parameterized helper. Pass consolidatingChanges into one helper instead. This repository requirement must be satisfied before merging.

Context Used: CLAUDE.md (source)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Same as main's #35622, and we're keeping the backport identical to main. Merging the two helpers would need to land on main first.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

That’s fair. I verified that the two helpers are identical in #35622 and #35707 aside from the expected 2.0 import difference, so merging them only in this backport would make it diverge from main. I’m withdrawing this finding; it should be addressed in main first and then backported if desired.

registerBotUser();

Pipeline original = pipelineWithExtension(BOT_NAME, extension("owner_team", "curated"));
Pipeline updated = pipelineWithExtension(BOT_NAME, new LinkedHashMap<String, Object>());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Constructor repeats type arguments

new LinkedHashMap<String, Object>() repeats the type arguments. The Java guide requires the diamond operator. Use new LinkedHashMap<>(). This repository requirement must be satisfied before merging.

Suggested change
Pipeline updated = pipelineWithExtension(BOT_NAME, new LinkedHashMap<String, Object>());
Pipeline updated = pipelineWithExtension(BOT_NAME, new LinkedHashMap<>());

Context Used: CLAUDE.md (source)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Kept as in main's #35622 so the backport matches main. The diamond change would need to land on main first.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

That’s a valid backport constraint. Keeping the fixture identical to main is reasonable here, and changing it independently would reduce parity with #35622. I’m withdrawing this finding for the backport.

Comment on lines +250 to +258
private static void seedStringCustomProperties(String... propertyNames) {
TypeRegistry.instance()
.addType(new Type().withName("string").withSchema("{\"type\":\"string\"}"));
TypeRegistry.instance()
.addType(
new Type()
.withName(Entity.PIPELINE)
.withCategory(Category.Entity)
.withCustomProperties(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Test leaves shared types behind

seedStringCustomProperties changes the shared TypeRegistry, but tearDown only clears Entity. The registered string and pipeline types and their custom properties remain after this test. Restore or remove these registrations during cleanup so later tests do not inherit this fixture.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Same test as main's #35622, kept identical here. The TypeRegistry cleanup applies to main too, so it should be fixed there first and then backported.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

That’s fair. Since this fixture is intentionally identical to the main change and the TypeRegistry cleanup issue exists there as well, the correct fix is to update #35622 first and then backport that cleanup here. I’ll treat this as an upstream follow-up rather than requiring a 2.0-only deviation.

@harshsoni2024
harshsoni2024 merged commit 37cf5c4 into 2.0 Oct 19, 2026
134 of 150 checks passed
@harshsoni2024
harshsoni2024 deleted the backport-35622-2.0 branch October 19, 2026 09:36

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Ingestion safe to test Add this label to run secure Github workflows on PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants