Repository navigation
[2.0] Fixes #37164: Only Approved glossary terms can be applied through the API - #37689
Conversation
… API (#37643) * Fixes #37164: Only Approved glossary terms can be applied through the API The UI only offers Approved glossary terms when tagging an asset, but the API accepted Draft, In Review, Rejected and Deprecated terms on every write path. ApprovedGlossaryTermGuard now rejects, per target (asset or inline field), any glossary term that is newly applied and not Approved: on create, PUT, PATCH, bulk PUT, the table dataModel, a term's assets/add, the column API, and the column bulk-update / CSV previews. A term already held on the same target stays, so writes that carry it back still pass. * Judge bulk creates per input and match moved fields by name path createMany runs the glossary-term guard in BulkEntityCreator.prepare so a rejected input fails alone instead of failing the request. The updater keys the updated entity's targets by the stored FQN of the same name path, so a container move that rewrites its data-model column FQNs before the stored labels are re-keyed does not make a held term look new. Adds tests for both and for the column bulk-update and CSV dry-run previews. * Find tagged fields per repository and compare terms by hash The guard took nested fields from ChildFieldResolver, which leaves File columns out, and keyed name paths by field name alone, so a request and a response field with the same name collided. Fields now come from EntityRepository.taggedFieldContainers (FileRepository adds its columns), name paths carry the container path and ignore case like column matching, and terms are compared by FQN hash so a quoted FQN cannot slip past. * Keep IT fixture names short and record the ingestion decision The createMany test case's suite is named after its table, so the table now lives under a short service and schema. The container move test reads back with tags. The decision record notes that bots get no exemption and that dbt skips non-Approved terms client-side (#37256), shipping together. * Test the bulk PUT update rejection and document assets/add Adds the IT step for a bulk PUT that adds a Deprecated term to an existing table. assets/add rejects a non-Approved term for every asset in the request, as the endpoint only applies terms; the Javadoc and ADR now say so. * Approve the moved term before tagging it in the move-rewrite IT test_approvedGlossaryTermMoveRewritesTaggedAssetsInSearch tagged a table with a term still In Review, which is now refused. The test approves the term through its own approval task first; the aboutEntity filter matches by FQN prefix, so the task is picked by the term's id, not the first one. * Judge a column CSV dry-run in one guard call The dry-run called the approved-term guard once per row, so a file with many glossary-tagged rows looked terms up row by row on the request thread. It now pools every row's labels per column, runs the guard once for the file, and judges each row by its own terms against the shared result. (cherry picked from commit 9803398)
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
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 |
|
Code Review 1 closed / 1 findings✅ 1 closed✅ Quality: Misordered imports will fail CI spotless:check
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 |
|
Post-merge check on
Dispatched |
…l workflow on 2.0 (#37989) The 2.0 hand port of #37164 (#37689) created the test's glossaries without main's status-fixture prefix, and 2.0 had no bootstrap exclusion for it. Each created term therefore queued a GlossaryTermApprovalWorkflow run; with no reviewers that run ends in SetGlossaryTermStatusToApproved. When it landed after the test's status-only deprecate PATCH, the term flipped back to Approved and the "deprecated term is rejected" assertions got no 400. Port main's mechanism: GlossaryTestFactory.STATUS_TEST_GLOSSARY_PREFIX / createForStatusTests, and TestSuiteBootstrap excluding that prefix from the GlossaryTermApprovalWorkflow trigger before any test runs. The test's glossaries use the prefix. Test-only; no server change.
Describe your changes:
Fixes #37164
Backport of #37643 to
2.0, for the 2.0.9 release.2.0has diverged frommain, so this is a hand port, not a cherry-pick. It has the same rule and behaviour: the API rejects, with a 400, any write that newly applies a glossary term that is not Approved. A term that leaves Approved after it was applied stays on the asset, and writes that re-send it still pass.What differs from
main:2.0has noChildFieldResolver.EntityRepository.taggedFieldContainersreturns nothing by default, and each repository whose entity has tagged inline fields overrides it:FieldInterfaceon2.0, so they're wrapped in a smallApprovedGlossaryTermGuard.TaggedFieldadapter.assets/add. The check is inGlossaryTermRepository.bulkAddAndValidateGlossaryToAssets, because2.0has noAssetTagLabelServiceand writes those tags directly.createMany. It's all-or-nothing on2.0(noBulkEntityCreator, noonConflict), so a non-Approved term fails the whole request. The IT expects that.ColumnRepositorypredates the CSV-import refactor onmain. The search-mode bulk-update dry-run and/bulk-update-previewuse the same guard. The CSV dry-run, which already searches once per row, now also checks each row's terms.2.0has no status-fixture glossary that is excluded from the approval workflow. The IT uses plain glossaries, deprecates terms with a status-only PATCH (the workflow doesn't act on those), and gives the draft glossary a reviewer other than the creator, so the workflow can't approve the term on the creator's behalf.dbt's client-side skip of non-Approved terms is tracked in #37256 and should ship in the same release.
Type of change:
Tests:
Run locally on this branch:
ApprovedGlossaryTermGuardTestandTagLabelUtilTest. 22 run, 0 failures.GlossaryTermApprovedTaggingITcompiles on2.0but hasn't run locally, because Docker stopped responding. It runs in this PR's IT jobs. On2.0it covers create, PUT, PATCH, columns, bulk PUT, all-or-nothingcreateMany,assets/add,dataModel, the column API and preview, File columns, API request fields, container moves, and re-sending held terms.The first push didn't compile, so
3c8c08172dfixes the2.0-only differences:EntityInterfaceisn't generic on2.0.TagLabelUtil.isSystemGenerateddoesn't exist on2.0, so DERIVED labels are checked inline.The same change passed locally on
main(#37643) and2.1(#37688): unit tests, the IT, and the impacted Playwright specs.Checklist:
[2.0] Fixes <issue-number>: <short explanation>Fixes #<issue-number>above.🤖 Generated with Claude Code