Repository navigation
fix(workflows): make tag "Is Not" mean "not tagged" and show negated rules - #36220
Conversation
…rules The JSON Logic rule editor (workflow check conditions and trigger filters, data asset rules, data contract semantics) saved "Tags Is Not X" as some(tags, tagFQN != X), which the rule engine reads as "has a tag other than X": an untagged asset failed it and one tagged X plus another tag passed it. "Not In" and "Is Not Set" on multi-value fields had the same per-element problem. These now save as a negation of the whole list (!some(tags, tagFQN == X)) and load back into the same row. Negations the loader cannot turn back into a row (Related Terms "Not Contains") keep their previous shape. A NOT the editor cannot express as a row (one written through the API around several conditions) was loaded but never drawn, so the node read as the opposite of what runs. The group now shows a NOT badge and helper text that holds under the negation. Rules saved before this change keep their old meaning until re-saved. The stored shape is recorded in docs/decisions/2026-10-26-negated-list-conditions-are-stored-as-negated-some.md.
❌ 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 |
🔄 Playwright impact map auto-refreshedThis PR touched specs or UI source that changed the source→spec routing map. I regenerated What is this file? It is the auto-generated half of Playwright's PR planner. It routes "if source X changes, run specs Y" by walking spec imports and cross-referencing What if I want to regenerate locally instead? Run this before pushing your next change to skip the bot commit: python3 .github/scripts/generate_playwright_impact_map.py
git add .github/playwright/impact-map.generated.json
git commit --amend --no-edit # or a separate commit |
Rules saved before the editor fix keep their per-element meaning
("has a tag other than X") while their row reads "Is Not X", and would
change meaning the next time someone saves them. The 2.0.7 data
migration rewrites them once, with the same rewrite the editor uses, so
every rule runs as its row reads from the upgrade on:
- workflow check conditions and event trigger filters, stored through
the repository so each changed workflow is redeployed to Flowable
- data contract semantics, in keyset batches, parsing only contracts
with a list condition
- the entity rules settings
Each part is a runOnce step; a failed workflow deploy fails the step so
the next run retries it.
… map A trigger filter stored as a string is a JSON-encoded map of entity type to rule, the only string form the trigger reads. The migration handed the whole string to the rewriter, which saw the map and changed nothing. Decode it, rewrite each rule, and store it back as a string.
Regression reviewI checked the fix against I found these regressions: 1. A rule written through the API under an explicit
Suggestion: don't rewrite inside an explicit 2. One workflow that fails to deploy blocks the upgrade. 3. Collate: Reverse Metadata filters are not migrated. Behaviour change that needs a release note (intended):
Minor: contracts are rewritten through |
The editor offers no NOT, so a rule with one came through the API and a
per-element condition under it was meant per element. Neither the
editor's save/load rewrite nor the 2.0.7 migration reaches inside an
explicit `!` any more, so `!some(tags, tagFQN != X)` ("every tag is X")
keeps its meaning at upgrade and on a save that changes nothing.
The migration now logs a workflow it cannot redeploy and continues, as
earlier workflow migrations do, instead of failing the upgrade.
|
@anuj-kumary thanks. I checked each point before changing anything. 1. API rules under an explicit
2. One undeployable workflow blocking the upgrade (correct, fixed). 3. Collate Reverse Metadata filters (correct). I confirmed the channel Minor (contract DAO update): agreed it skips search and version history. That's deliberate for a format-only rewrite and follows the existing v210 Release note: I'll add the trigger-filter point to the description. A trigger filter "Tags Is Not X" is an exclusion, so after the upgrade it also excludes untagged entities. Tests on a55914b: Jest 73 suites / 1100 passed; Java unit |
| } catch (RuntimeException e) { | ||
| // Flowable reports a failed deploy with its own unchecked exceptions. | ||
| LOG.error( | ||
| "[v207] Failed to rewrite workflow '{}'; save it again to apply the corrected rules", | ||
| stored.getName(), | ||
| e); | ||
| } |
There was a problem hiding this comment.
Failed deployments lose automatic recovery
When a workflow deployment fails, this catch logs the error and lets runOnce mark the migration step complete. Rerunning the upgrade then skips the failed workflow. The repository stores corrected rules before deploying them, so the editor can show the new rule while Flowable still runs the old one.
Removing the fallback redeployment also prevents recovery after an interruption between storage and deployment. Keep failed deployments retryable, including workflows whose stored rules were already rewritten.
Collate stores reverse metadata filters built with the same editor; its 2.0.7 migration rewrites them with this same rewrite.
One class for the version's migration: the negated list rule rewrite and its workflow, data contract and entity rules steps move into v207/MigrationUtil, with rewriteNegatedListRule public for Collate.
Code Review ✅ Approved 3 closed / 3 findings🔴 High risk · The 2.0.7 migration rewrites stored workflow, trigger, contract, and entity rules, which could reverse automation branches or validation outcomes across existing assets. Makes tag and list-field "Is Not" / "Not In" / "Is Not Set" rules mean "no element matches" and shows top-level NOT groups in the rule editor, with a 2.0.7 migration rewriting stored rules. Resolved this session: legacy string-encoded trigger filters are now rewritten, and rows inside a NOT group keep their intended per-element meaning. No open findings; approved. ✅ 3 closed✅ Bug: Legacy string trigger filters (a JSON-encoded map) are never rewritten
✅ Bug: Rows inside a NOT group keep the per-element meaning they were meant to lose
Closed: Bug: Collect Metadata
|
| Compact |
|
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source
|



Describe your changes:
Fixes open-metadata/openmetadata-collate#7854
A customer reported two problems with tag rules in a workflow's Check Condition node. Both are in the shared JSON Logic rule editor (
QueryBuilder). The backend rule engine evaluates whatever rule is stored correctly; the editor was storing or displaying the wrong one.some(tags, tagFQN != X), which means "has a tag other than X". An untagged asset failed it, and an asset tagged X plus another tag passed it. "Is Not Set" savedsome(tags, tagFQN == null), which never matches anything. The same applies to every list field (Owners, Reviewers, Domains, Data Products, Column Tags, table custom-property rows).{"!":{"and":[some(tags, tagFQN == X)]}}, loaded with the NOT intact and kept it on save, but the editor never drew it. The node read "Tags Is X", the opposite of what runs.Fix
utils/queryBuilder/formatters.ts): these rows are now stored as a negation of the whole list,!some(tags, tagFQN == X),!some(tags, in [...])and!some(tags, tagFQN != null).utils/queryBuilder/tree.ts): those shapes, and a negated single-rule group like the customer's, are mapped back to the same row. The customer's API rule now reads "Tags Is Not X".utils/queryBuilder/jsonLogicNegation.ts) cover exactly the same shapes. Negations the loader can't turn back into a row, such as Related Terms "Not Contains", keep their previous form.QueryBuilderConjunctionHint, used in the group header and for a negated root drawn as peer cards. The canvas still offers no NOT toggle.toNegatedRulerewrite gives the same result applied on top (unit-tested).docs/decisions/2026-10-26-negated-list-conditions-are-stored-as-negated-some.md.Rules saved before this change are migrated (2.0.7). A stored
some(tags, tagFQN != X)loads as the same "Is Not" row as the corrected shape, so without a migration it would keep its old meaning until its next save and then change. The 2.0.7 data migration (migration/utils/v207/NegatedListRuleMigration.java) rewrites every stored rule once, using the same rewrite as the editor (NegatedListRuleRewriter, tested against the same case table). From the upgrade on, every rule runs as its row reads, and saving an untouched rule leaves it unchanged. It covers:rulesand the event triggerfilter(a single string or one per entity type). These are stored throughWorkflowDefinitionRepository.createOrUpdate, not SQL, so each changed workflow is redeployed to Flowable. A workflow that fails to redeploy is logged, with a hint to save or redeploy it, and the migration continues, like earlier workflow migrations. One broken workflow can't block the upgrade.someare parsed, and only rows that change are written. Inherited contracts aren't copied per table, so the work scales with contracts that were actually written.Each part is a
runOncestep in the MySQL and Postgresv207migrations. Nothing under an explicit!is rewritten, by the editor or the migration. The editor offers no NOT, so such a rule came through the API and its per-element meaning was intended. For example,!some(tags, tagFQN != X)("every tag is X") keeps its meaning.Release note needed:
MigrationUtil.rewriteNegatedListRule.Before and after
The customer's API rule
{"!":{"and":[Tags == PII.Sensitive]}}. Before, it reads "Tags Is Sensitive", the opposite of what runs:After, it reads "Tags Is Not Sensitive":
NOT around two conditions. Before, the NOT is invisible:
After, the NOT badge and negated helper text are shown:
Choosing "Is Not" on Tags in the editor (the screen looks the same before and after; the saved rule is what changed):
{"and":[{"some":[{"var":"tags"},{"!=":[{"var":"tagFQN"},"PII.Sensitive"]}]}]}(has a tag other than X){"and":[{"!":{"some":[{"var":"tags"},{"==":[{"var":"tagFQN"},"PII.Sensitive"]}]}}]}(no tag is X)Evaluated with the backend's json-logic-java 1.0.7 (the engine
RuleEngineuses;LogicOpsdoesn't overridesome,!=,!orin):Type of change:
High-level design:
The rule editor keeps RAQB's internal tree unchanged. The only translation is at the JSON Logic save/load boundary:
toEngineJsonLogicruns afterQbUtils.jsonLogicFormat.fromEngineJsonLogicruns aftermigrateJsonLogicand beforeQbUtils.loadFromJsonLogic.Both directions walk
and/or/!and rewrite only these shapes:some(v, != X)!some(v, == X)some(v, !in)!some(v, in)some(v, !contains)!some(v, contains)some(v, == null)!some(v, != null)On load, a single-rule
!and[x]/!or[x]is unwrapped only whenxbecomes a row; any other NOT stays a negated group, so the canvas can show it. Elasticsearch output is untouched.Alternatives I rejected:
showNot: themaincanvas (QueryBuilderCanvas) replaces RAQB's<Builder>and never readsproperties.not, so this alone shows nothing. It also offers a generic NOT toggle the product doesn't want.mode: 'array'withnone: a much larger change to the field configs and the canvas.Tests:
Use cases covered
some(reviewers, fqn != null)) are untouched.Unit tests
src/utils/queryBuilder/jsonLogicNegation.test.ts: 20 tests. They cover the pure save/load rewrites, idempotency, the Data Contract rewrite on top, and round trips through the real builder config. 5 of them fail with the save/load hookup reverted.QueryBuilderCanvas.test.tsx: 3 new negation tests (badge on a negated group, badge on a negated root drawn as peer cards, no badge plus an "Is Not" row for the customer's shape). 2 fail with the canvas change reverted.src/utils/queryBuilder,src/components/common/QueryBuilder,src/components/WorkflowDefinitions,src/components/DataContract,src/components/DataAssetRules,src/utils/JSONLogicSearchClassBase): 73 suites, 1088 tests passed.Backend integration tests
NegatedListRuleMigrationIT(openmetadata-integration-tests), 2 tests against the real database, rule engine and Flowable:rulesExpr).NegatedListRuleRewriterTest(17: the same case table as the UI, idempotency, non-JSON input, and truth tables from json-logic-java) andNegatedListRuleMigrationTest(6: workflow rule discovery, per-entity filters, contract batching, entity rules).make java_affected_run:Local Java test run: PASSED
Ingestion integration tests
Playwright (UI) tests
playwright/e2e/Features/Workflows/WorkflowCheckConditionNegation.spec.ts, 3 tests. The spec is covered by the existingFeatures/Workflows/**impact-map entry.!and[Tags Is X]opens as "Is Not" with no NOT badge;!some(tags, tagFQN == X)in the workflow PUT.PLAYWRIGHT_IS_OSS=true). 60 passed (56 existing tests + the 3 new ones + setup/teardown):Pages/DataContractsSemanticRules.spec.ts: all Owner / Domain / Data Product / Description / Version / DisplayName / Updated-on rules, including Is_Not, Not_In, Is_Not_Set and Not Contains;Pages/DataContracts.spec.ts: the semantic tests, including "Semantic with Not_Contains Operator should work for Tier, Tag and Glossary";Features/Workflows/ChangeRequestReviewLifecycle.spec.ts: all 7;Features/Workflows/WorkflowCheckConditionNegation.spec.ts: 3/3.yarn lint:playwright: 0 errors, and none of the existing warnings are in the new spec.Manual testing performed
POST /api/v1/governance/workflowDefinitionswith:{"!":{"and":[some(tags, tagFQN == "PII.Sensitive")]}};rulesis{"and":[{"!":{"some":[…"==":…]}}]}.some(tags, tagFQN != X).UI screen recording:
Not applicable: this is a bug fix, not a UI feature. Before/after screenshots from the run above are included instead.
Checklist:
I have read the CONTRIBUTING document.
My PR title is
Fixes <issue-number>: <short explanation>(conventional-commit title; the issue is in the Collate tracker and is linked above).My PR is linked to a GitHub issue via
Fixes …above.I have commented on my code, particularly in hard-to-understand areas.
For JSON Schema changes: not applicable (no schema changes).
For a UI feature or feature task: not applicable (bug fix); screenshots above.
I have added tests (unit / integration / Playwright as applicable) and listed them above.
Self-review: I reviewed the final diff against
REVIEW.md(thepr-checklistskill runs it) and fixed every 🔴 finding, or answered it on the line below.5a294eab92. The only changes since then are a test name and the decision record's wording.Decision check: adds
docs/decisions/2026-10-26-negated-list-conditions-are-stored-as-negated-some.md.I have added a test that covers the exact scenario we are fixing.
🤖 Generated with Claude Code
The PR still needs failed workflow deployments to remain retryable before merging.
Findings
Summary
Makes list-field exclusions mean “no element matches” and shows group negations in the editor.
Diagram
%%{init: {'theme': 'neutral'}}%% flowchart LR A["Editor rows"] --> B["toEngineJsonLogic"] B --> C["Stored JSON Logic"] C --> D["fromEngineJsonLogic"] D --> A E["Legacy stored rules"] --> F["2.0.7 migration"] F --> C F --> G["Redeploy changed workflows"]Reviews (6) · Last reviewed commit: "refactor(migrations): keep the 2.0.7 mig..." · Reviewed by Greptile