Skip to content

Patching error message verbosity#27692

Open
Khairajani wants to merge 8 commits intomainfrom
automator_patch_error
Open

Patching error message verbosity#27692
Khairajani wants to merge 8 commits intomainfrom
automator_patch_error

Conversation

@Khairajani
Copy link
Copy Markdown
Contributor

@Khairajani Khairajani commented Apr 24, 2026

Summary

Improves error message verbosity for patch operations so failures are easier to diagnose, without leaking entity values into logs.

Changes

  • patch_mixin.py — When a patch call fails, the warning / RuntimeError now includes a compact summary of the JSON Patch (op count and op:path list) alongside the underlying error. A new _summarize_patch helper builds the summary and intentionally excludes patch values, since they may carry descriptions, sample data, or tag content that should not appear in logs. Also tightens control flow in the except block (drops the redundant else after return).
  • JsonUtils.javaapplyPatch now reports the target class name and the underlying exception message (Failed to convert JsonValue to <ClassName>: <message>) instead of the opaque Failed to convert JsonValue to target class.

Test plan

  • Trigger a failing patch (e.g. invalid field) and confirm the log line shows Patch ops: N op(s) [op:path, ...] with no values.
  • Trigger an applyPatch failure on the Java side and confirm the new error string includes the target class and root cause message.

@Khairajani Khairajani requested a review from a team as a code owner April 24, 2026 09:00
@github-actions
Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

@Khairajani Khairajani changed the title patching error message Automator [Don't Merge]: patching error message Apr 24, 2026
@Khairajani Khairajani added the safe to test Add this label to run secure Github workflows on PRs label Apr 24, 2026
Comment thread ingestion/src/metadata/ingestion/ometa/mixins/patch_mixin.py Outdated
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 24, 2026

🔴 Playwright Results — 5 failure(s), 7 flaky

✅ 3985 passed · ❌ 5 failed · 🟡 7 flaky · ⏭️ 86 skipped

Shard Passed Failed Flaky Skipped
✅ Shard 1 299 0 0 4
🟡 Shard 2 751 0 3 8
🟡 Shard 3 746 0 1 7
🔴 Shard 4 770 5 0 18
🟡 Shard 5 686 0 1 41
🟡 Shard 6 733 0 2 8

Genuine Failures (failed on all attempts)

Pages/DataContractInheritance.spec.ts › Edit Inherited Contract - Creates new asset contract instead of modifying parent (shard 4)
Error: �[2mexpect(�[22m�[31mlocator�[39m�[2m).�[22mtoContainText�[2m(�[22m�[32mexpected�[39m�[2m)�[22m failed

Locator: getByTestId('contract-title')
Expected substring: �[32m"dp_for_edit_inherited_05806599"�[39m
Timeout: 15000ms
Error: element(s) not found

Call log:
�[2m  - Expect "toContainText" with timeout 15000ms�[22m
�[2m  - waiting for getByTestId('contract-title')�[22m

Pages/DataContractInheritance.spec.ts › Delete Button Disabled - Fully inherited contracts cannot be deleted (shard 4)
Error: �[2mexpect(�[22m�[31mlocator�[39m�[2m).�[22mtoContainText�[2m(�[22m�[32mexpected�[39m�[2m)�[22m failed

Locator: getByTestId('contract-title')
Expected substring: �[32m"dp_delete_disabled_75cf7ee4"�[39m
Timeout: 15000ms
Error: element(s) not found

Call log:
�[2m  - Expect "toContainText" with timeout 15000ms�[22m
�[2m  - waiting for getByTestId('contract-title')�[22m

Pages/DataContractInheritance.spec.ts › Run Validation - Inherited contract validation uses entity-based validation (shard 4)
Error: �[2mexpect(�[22m�[31mlocator�[39m�[2m).�[22mtoContainText�[2m(�[22m�[32mexpected�[39m�[2m)�[22m failed

Locator: getByTestId('contract-title')
Expected substring: �[32m"dp_run_validation_6d11ce8b"�[39m
Timeout: 15000ms
Error: element(s) not found

Call log:
�[2m  - Expect "toContainText" with timeout 15000ms�[22m
�[2m  - waiting for getByTestId('contract-title')�[22m

Pages/DataContractInheritance.spec.ts › Remove Asset - Inherited contract no longer shown when asset is removed from Data Product (shard 4)
Error: �[2mexpect(�[22m�[31mlocator�[39m�[2m).�[22mtoContainText�[2m(�[22m�[32mexpected�[39m�[2m)�[22m failed

Locator: getByTestId('contract-title')
Expected substring: �[32m"dp_remove_asset_8da8f2c7"�[39m
Timeout: 15000ms
Error: element(s) not found

Call log:
�[2m  - Expect "toContainText" with timeout 15000ms�[22m
�[2m  - waiting for getByTestId('contract-title')�[22m

Pages/DataContractInheritance.spec.ts › Delete Asset Contract - Falls back to showing inherited contract from Data Product (shard 4)
Error: �[2mexpect(�[22m�[31mlocator�[39m�[2m).�[22mtoContainText�[2m(�[22m�[32mexpected�[39m�[2m)�[22m failed

Locator: getByTestId('contract-title')
Expected substring: �[32m"dp_delete_fallback_fd54c14b"�[39m
Timeout: 15000ms
Error: element(s) not found

Call log:
�[2m  - Expect "toContainText" with timeout 15000ms�[22m
�[2m  - waiting for getByTestId('contract-title')�[22m

🟡 7 flaky test(s) (passed on retry)
  • Features/ActivityAPI.spec.ts › Activity event is created when description is updated (shard 2, 1 retry)
  • Features/ActivityAPI.spec.ts › Activity event shows the actor who made the change (shard 2, 1 retry)
  • Features/Glossary/GlossaryHierarchy.spec.ts › should cancel move operation (shard 2, 1 retry)
  • Flow/AddRoleAndAssignToUser.spec.ts › Verify assigned role to new user (shard 3, 1 retry)
  • Pages/Entity.spec.ts › User as Owner with unsorted list (shard 5, 1 retry)
  • Pages/Lineage/DataAssetLineage.spec.ts › Column lineage for dashboardDataModel -> topic (shard 6, 1 retry)
  • Pages/Lineage/LineageFilters.spec.ts › Verify lineage schema filter selection (shard 6, 1 retry)

📦 Download artifacts

How to debug locally
# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip    # view trace

Comment thread ingestion/src/metadata/ingestion/ometa/mixins/patch_mixin.py Outdated
@github-actions
Copy link
Copy Markdown
Contributor

The Python checkstyle failed.

Please run make py_format and py_format_check in the root of your repository and commit the changes to this PR.
You can also use pre-commit to automate the Python code formatting.

You can install the pre-commit hooks with make install_test precommit_install.

@github-actions
Copy link
Copy Markdown
Contributor

The Python checkstyle failed.

Please run make py_format and py_format_check in the root of your repository and commit the changes to this PR.
You can also use pre-commit to automate the Python code formatting.

You can install the pre-commit hooks with make install_test precommit_install.

Khairajani and others added 2 commits April 27, 2026 21:42
Avoid leaking patch values (descriptions, sample data, tags) in WARNING
logs. The Jackson server message in 'Reason:' still carries the offending
value for the failing field, which is enough to debug deserialization
errors without dumping every field being changed.
@gitar-bot
Copy link
Copy Markdown

gitar-bot Bot commented May 1, 2026

Code Review ✅ Approved 2 resolved / 2 findings

Replaces full body dumps with op:path summaries in patch failure logs to prevent sensitive data exposure, and resolves lingering merge conflict markers in patch_mixin.py. No issues found.

✅ 2 resolved
Bug: Unresolved merge conflict markers left in source code

📄 ingestion/src/metadata/ingestion/ometa/mixins/patch_mixin.py:198-205
Lines 198–205 contain literal <<<<<<< automator_patch_error, =======, and >>>>>>> main merge conflict markers. This will cause a SyntaxError at import time, making the entire patch_mixin module (and anything that depends on it) completely non-functional.

Security: Patch body in logs/errors may expose sensitive fields

📄 ingestion/src/metadata/ingestion/ometa/mixins/patch_mixin.py:193 📄 ingestion/src/metadata/ingestion/ometa/mixins/patch_mixin.py:198 📄 ingestion/src/metadata/ingestion/ometa/mixins/patch_mixin.py:206
The patch body is now included in both logger.warning() and RuntimeError messages. Since build_patch diffs arbitrary entity models (including services with connection configs that may contain passwords, tokens, or secrets), logging str(patch) could expose sensitive data in log files or error traces propagated to callers.

Consider truncating or sanitizing the patch body before including it in messages, or at minimum limit the output length.

Options

Display: compact → Showing less information.

Comment with these commands to change:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 1, 2026

@Khairajani Khairajani changed the title Automator [Don't Merge]: patching error message Patching error message verbosity May 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

1 participant