Repository navigation
Fixes #37164: Reject non-Approved glossary terms when an approval workflow holds the edit - #37928
Conversation
…kflow holds the edit An Enforce approval workflow holds an edit before it is written, so the write-time Approved-term check never ran: the request answered 202 and opened a change request for a term the write would refuse. ApprovalGate.stage now runs the same check before it opens a change request, so a held edit gets the same 400 an unheld write gets, and bulk PUT fails only that item. The guard now drops terms a target already holds before looking terms up, so a write or held edit that applies no new glossary term makes no query.
Code Review ✅ Approved 🟡 Medium riskPre-stage validation rejects held edits that add non-Approved glossary terms, so those edits cannot enter approval queues and callers may receive 400 responses. Closes the gap where a held glossary edit applying a non-Approved term returned 202 and opened a change request. VerificationRules No rules evaluated Functional validation Not enabledAuto-approval Not enabledFor more verification details, comment OptionsDisplay: compact → Showing compact verification results. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
|
🤖 Backport to |
|
🤖 Not backported to
|
Describe your changes:
Fixes #37164 (follow-up to #37643).
#37643 rejects a non-Approved glossary term when a write applies it. An approval workflow in Enforce mode holds an edit before it is written, so that check never ran for a held edit. The request answered 202 and opened a change request for a term the write would refuse. The term then landed only if someone approved the review task after the term itself was Approved.
Now
ApprovalGate.stageruns the same check before it opens a change request. A held edit that newly applies a non-Approved term gets the 400 an unheld write gets, no change request is opened, and bulk PUT fails only that item.The guard also drops terms a target already holds before it looks anything up. A write or held edit that applies no new glossary term now makes no query. Before, it looked up every glossary term on the entity once per write.
Type of change:
High-level design:
ApprovalGate.stagecallsrejectUnapprovedGlossaryTermsbeside the existingrejectMutuallyExclusiveTags. The check runs on every edit a workflow holds, not only whentagschanged. A column's labels change undercolumns, so a workflow that gates onlycolumnswould otherwise still hold an In Review term.EntityRepository.checkNewlyAppliedGlossaryTermsApproved(original, updated)is the one entry point. The gate calls it with the stored entity and the entity as it would be published (for PUT, afterpublishedByPut).EntityUpdaterdelegates to it, so the write-time check stays as the backstop.ApprovedGlossaryTermGuard.rejectedTermsdrops held terms in memory first, then looks up only the remaining terms in one batch, then readstag_usageonly for non-Approved terms the loaded state does not show held. Both steps only remove hashes, so the result is the same in either order.2026-11-06-only-approved-glossary-terms-can-be-newly-applied-to-an-assetamended (v2).Query cost per request:
tag_usagereadtag_usageread (unchanged)A held edit is staged instead of written, so it still runs the check exactly once. No request runs it twice. Entity types no workflow gates, and edits by bots, never reach
stage.Blast radius. Every caller of
ApprovalGate.stagenow gets a 400, or a per-item failure, where it got a held 202 before. It does so only when the edit newly applies a non-Approved glossary term:/tables/bulketc.)IllegalArgumentExceptionhandling)EntityPatchBatch.prepare)POST /changeRequests/preview/{type}/{id}admitRelations(data product ports)Not changed:
ChangeRequestService.flagConflicts); now covered by a test.ApprovalGate, so it can't hold an edit; it gets only the lookup change.Tests:
Unit tests
ApprovedGlossaryTermGuardTest: addedanEditApplyingNoNewTermLooksNothingUp(no term lookup, notag_usageread) andonlyTheNewlyAppliedTermIsLookedUp.GovernanceApprovalRegistryTest,NativeOntologyChangeSetTest,ApprovedGlossaryTermGuardTest,TagLabelUtilTest,ChangeRequestServiceTest,ApprovalGateBulkResponseTest,ColumnRepository*Test,EntityRepository*Test: 318 run, 0 failures.Backend integration tests
ChangeRequestUnapprovedTermIT(7 cases, owned byChangeRequest*ITin the impact map):columns) with a non-Approved term → 400, no change request, nothing publishedmain: with the three service files reverted, 7 run, 4 failures: the four rejection cases answer 202 /numberOfRowsPendingApproval: 1.parallellane, on this branch:ChangeRequestUnapprovedTermIT7/0,ChangeRequestAdmissionIT23/0,ChangeRequestApplyIT11/0,ChangeRequestImportAndBulkIT10/0,GlossaryTermApprovedTaggingIT19/0. 70 run, 0 failures.Ingestion integration tests
Playwright (UI) tests
Manual testing performed
Repro before the fix (API only, a server built from
mainplus the guard): an Enforce workflow ontablegatingtags, and a term created In Review. A human admin attached the term to the table: 202, change request Pending, table unchanged. Approving the term did not publish the edit; it waited for the review task.UI screen recording:
Not applicable.
Checklist:
Fixes <issue-number>: <short explanation>docs/decisions/2026-11-06-only-approved-glossary-terms-can-be-newly-applied-to-an-asset.md(v2).Backports: 2.1 (full fix); 2.0 (lookup change only, since 2.0 has no approval gate).
🤖 Generated with Claude Code


Confidence Score: 5/5
The PR appears safe to merge; no actionable issues were found.Summary
Checks newly applied glossary terms before an approval workflow opens a change request.
No actionable issues were found. Tests were not run during this review.
Diagram
%%{init: {'theme': 'neutral'}}%% flowchart TD A[Prepared edit] --> B{Workflow holds edit?} B -->|Yes| C[Check newly applied glossary terms] C --> D{All new terms Approved?} D -->|No| E[Return 400 without a change request] D -->|Yes| F[Open change request] F --> G[Reviewer approves] G --> H[Write-time glossary check] B -->|No| H H --> I[Publish if valid]Reviews (1) · Last reviewed commit: "Fixes #37164: Reject non-Approved glossa..." · Reviewed by Greptile