Skip to content

Fixes #38331: Change request preview returns the ops of an ungated descriptive edit - #38329

Merged
pmbrull merged 8 commits into
mainfrom
fmcardoso/preview-ops-for-ungated-edits
Nov 24, 2026
Merged

pmbrull merged 8 commits into
mainfrom
fmcardoso/preview-ops-for-ungated-edits

Conversation

@fmcardoso

@fmcardoso fmcardoso commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

Describe your changes:

Fixes #38331

POST /v1/changeRequests/preview/{entityType}/{id} returned ops only when an approval workflow would hold the edit. It now also returns them for an edit no workflow holds, as long as the patch touches descriptive metadata only (description, display name, tags, owners, domains, data products, columns, certification, glossary synonyms/related terms/parent, metric expression/type/granularity/related metrics). A client can then show the user exactly what a PATCH would change, as the change-request diff, before sending it. Collate's AI chat uses it to show a drafted change for approval.

  • ApprovalGate.previewOps plans the ops with MutationPlanner from the same prepared edit a gated preview uses (one shared helper); nothing is stored.
  • EntityRepository.previewPatchOps prepares the patched entity for the requesting user.
  • ChangeRequestService.preview calls it only when no workflow gated the edit and every patched field is in DESCRIPTIVE_FIELDS. Any other ungated edit gets no ops, as before. requiresApproval and workflowDefinitionId are unchanged.

Type of change:

  • Improvement

High-level design:

No new endpoint or schema field: the existing preview response's ops is filled in one more case. A gated edit still takes its ops from the staged change and does not compute them twice. Clients that read requiresApproval see no difference.

Tests:

Use cases covered

  • An ungated edit to the description is previewed with its ops, and no change request is stored.
  • An ungated edit that also touches a non-descriptive field gets no ops, and its ops are never computed.
  • A gated edit takes its ops from the staged change only.

Unit tests

  • I added unit tests for the new/changed logic.
  • Files added/updated: ChangeRequestServiceTest (48 tests pass locally).

Backend integration tests

  • I added integration tests in openmetadata-integration-tests/ for new/changed API endpoints.
  • Files added/updated: ChangeRequestResourceIT:
    • anUngatedDescriptionEditIsPreviewedWithItsOpsAndNothingIsSaved: 200, the description op with its old and new value, and neither the glossary nor a change request is saved. It fails on main.
    • anUngatedEditBeyondDescriptiveMetadataIsPreviewedWithoutOps.
  • ChangeRequestResourceIT passes locally: 12 of 12, postgres-opensearch profile.

Ingestion integration tests

  • Not applicable (no ingestion changes).

Playwright (UI) tests

  • Not applicable (no UI changes).

Manual testing performed

  1. Built Collate against this branch and ran it locally with sample data.
  2. Previewed description, tag, owner, display name and column description edits on sample_data tables: each returned the ops, and nothing was saved.
  3. Ran Collate's AI chat (companion PRs below) through the full flow of proposing, showing and applying those edits.

Companion PRs (Collate AI chat): open-metadata/ai-platform#2363, open-metadata/openmetadata-collate#8797.

UI screen recording:

Not applicable: backend-only change.

Checklist:

  • I have read the CONTRIBUTING document.

  • My PR title is Fixes <issue-number>: <short explanation>

  • My PR is linked to a GitHub issue via Fixes #<issue-number> above.

  • I have commented on my code, particularly in hard-to-understand areas.

  • For JSON Schema changes: I updated the migration scripts or explained why it is not needed. (No schema change.)

  • For a UI feature or feature task: not applicable, backend only.

  • I have added tests (unit / integration / Playwright as applicable) and listed them above.

  • Self-review: I reviewed the final diff (599fb15) against REVIEW.md; no 🔴 open. Only a public method is added; nothing Collate calls is renamed.

  • Decision check: docs/decisions/2026-11-20-a-change-request-preview-shows-an-ungated-edit-of-descriptive-metadata.md records which edits a preview now returns ops for, and that "no ops" means "cannot be shown".

  • I have added tests around the new logic.

🤖 Generated with Claude Code

RetriggerView in GreptileConfidence Score: 4/5

Fix the description preview mismatch for ingestion-bot before merging.

Findings

  1. P1 Preview shows an ignored removal ▶

Summary

Adds change ops to previews of ungated descriptive edits.

  • Ungated descriptive edits now show their changes in the preview.

Both earlier, unnumbered findings are addressed: changed descriptions are cleaned before planning, and derived tags are excluded from both sides.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Preview PATCH] --> B[Prepare and check permissions]
  B --> C{Workflow holds edit?}
  C -->|Yes| D[Return staged ops]
  C -->|No| E{Only descriptive fields?}
  E -->|No| F[Return no ops]
  E -->|Yes| G[Prepare again and clean description]
  G --> H[Exclude derived tags and plan ops]
  H --> I{All ops descriptive?}
  I -->|Yes| J[Return ungated ops]
  I -->|No| F
Loading

Reviews (6) · Last reviewed commit: "Preview a term that is not Approved as t..." · Reviewed by Greptile

POST /v1/changeRequests/preview returned ops only when an approval workflow
would hold the edit. It now also returns them for an edit no workflow holds,
computed by MutationPlanner from the same prepared entity, so a client can
show what a PATCH of descriptive metadata (description, display name, tags,
owners, domains, columns and similar) would change before sending it. An
ungated edit to any other field still gets no ops. requiresApproval and
workflowDefinitionId are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fmcardoso fmcardoso changed the title Change request preview returns the ops of an ungated descriptive edit Fixes #38331: Change request preview returns the ops of an ungated descriptive edit Nov 20, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fmcardoso
fmcardoso marked this pull request as ready for review November 23, 2026 09:35
@fmcardoso
fmcardoso requested a review from a team as a code owner November 23, 2026 09:35
@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR checks passed

The linked issue has a description and all required Shipping project fields set. Thanks!

fmcardoso and others added 2 commits November 23, 2026 11:02
fmcardoso and others added 4 commits November 23, 2026 14:44
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An ungated preview now returns no ops when preparing the patch changes a
field outside the descriptive set, and refuses a glossary term that is not
Approved, as the save does. New tests cover a caller without the edit and
tag, owner and column-description previews matching what PATCH saves.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Main now holds such a term as pending instead of refusing it, so the
preview no longer calls the check the save dropped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@gitar-bot

gitar-bot Bot commented Nov 23, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 🟡 Medium risk 1 closed / 1 findings

The preview endpoint now exposes ops for ungated descriptive edits, changing client-visible behavior and how clients may present proposed metadata updates.

Ungated change request previews now return ops for edits touching only descriptive metadata, without storing a change request. The previewOps copy of planStage's preparation was resolved by sharing the edit preparation between gated and ungated previews. No open issues found.

✅ 1 closed
✅ Quality: previewOps copies planStage's preparation instead of sharing it

📄 openmetadata-service/src/main/java/org/openmetadata/service/governance/approval/ApprovalGate.java:188-198
ApprovalGate.previewOps repeats the first five steps of planStage line for line: keepStoredStatusWhenOmitted, publishedByPut for PUT, the two valueToTree calls and changedFields. The new ADR's Decision 1 says ungated ops are planned "from the same prepared entity a gated preview uses", but nothing in the code enforces that. If someone later changes how planStage normalizes the edit (say, a new status or replaced-field rule), only the gated path picks it up, and an ungated preview would show ops the real PATCH does not make. The repo rules also ask for copy-pasted blocks to be pulled into a shared helper. The fix is to build the Edited record in one helper and call it from both planStage and previewOps.

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

@pmbrull
pmbrull merged commit b74209e into main Nov 24, 2026
60 checks passed
@pmbrull
pmbrull deleted the fmcardoso/preview-ops-for-ungated-edits branch November 24, 2026 07:44
fmcardoso added a commit that referenced this pull request Nov 27, 2026
…scriptive edit (#38329) (#38954)

* Change request preview reports the ops of an edit no workflow gates

POST /v1/changeRequests/preview returned ops only when an approval workflow
would hold the edit. It now also returns them for an edit no workflow holds,
computed by MutationPlanner from the same prepared entity, so a client can
show what a PATCH of descriptive metadata (description, display name, tags,
owners, domains, columns and similar) would change before sending it. An
ungated edit to any other field still gets no ops. requiresApproval and
workflowDefinitionId are unchanged.



* Share the edit preparation between the gated and ungated preview



* Preview a changed description as the PATCH saves it



* Leave derived tags out of an ungated preview's ops



* Return an ungated preview's ops only for descriptive fields

An ungated preview now returns no ops when preparing the patch changes a
field outside the descriptive set, and refuses a glossary term that is not
Approved, as the save does. New tests cover a caller without the edit and
tag, owner and column-description previews matching what PATCH saves.



* Preview a term that is not Approved as the save now holds it

Main now holds such a term as pending instead of refusing it, so the
preview no longer calls the check the save dropped.



---------


(cherry picked from commit b74209e)

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
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.

Change request preview should return the ops of an ungated edit of descriptive metadata

2 participants