Repository navigation
Fixes 31564: pass the extended config when formatting a single-value rule - #31565
Conversation
…rule elasticSearchFormat extends the incoming config once and hands extendedConfig to every branch except the single-value half of the rule branch, which passed the raw config to buildEsRule. buildEsRule resolves the field's widget through that config, so a raw one resolves no widget and returns undefined. The difference is invisible while formatting a whole tree, because a rule is then always reached through its group and so always gets an extended config. It surfaces when elasticSearchFormat is called on a rule node directly, which is what hasUnfinishedRule does: every completed condition looked like it built no clause, and the persona AI context rule editor refused to save it as an "unfinished condition". Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
❌ 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 ✅ ApprovedPasses the extended configuration to buildEsRule in the single-value branch of the query builder formatter, fixing false incomplete rule validation errors on save. No issues found. OptionsDisplay: compact → Showing less information. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
|
🔴 Playwright Results — workflow failedValidated commit ✅ 550 passed · ❌ 0 failed · 🟡 0 flaky · ⏭️ 0 skipped · 🧰 0 lifecycle flaky Pipeline and setup failures (1)
PerformanceBlocking targets: ❌ unmet · Optimization targets: 🟡 in progress Shard-job maxima below are not the full workflow wall time; the linked run includes build, fixture, planning, and reporting. 🕒 Full workflow signal wall (to summary) 1h 0m 42s ⏱️ Max setup 2m 58s · max shard execution 18m 14s · max shard-job elapsed before upload 30m 53s · reporting 5s 🌐 214.51 requests/attempt · 2.83 app boots/UI scenario · 4.20% common-shard skew Optimization targets still in progress:
How to debug locally# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip # view trace |
…rule (#31565) elasticSearchFormat extends the incoming config once and hands extendedConfig to every branch except the single-value half of the rule branch, which passed the raw config to buildEsRule. buildEsRule resolves the field's widget through that config, so a raw one resolves no widget and returns undefined. The difference is invisible while formatting a whole tree, because a rule is then always reached through its group and so always gets an extended config. It surfaces when elasticSearchFormat is called on a rule node directly, which is what hasUnfinishedRule does: every completed condition looked like it built no clause, and the persona AI context rule editor refused to save it as an "unfinished condition". Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
|
picked by hand to 2.0 |
|
Failed to cherry-pick changes to the 1.13 branch. |
|
Failed to cherry-pick changes to the 2.0 branch. |
…31581) * test(playwright): add E2E coverage for Persona AI Context rule builder Adds 11 Playwright tests covering the full rule CRUD flow, filter validation, and individual field behaviours for the AI Context tab in Persona settings. The most important addition is a regression test for #31564: before PR #31565 a fully-completed single-value condition (e.g. Description Contains "…") was incorrectly rejected with the "unfinished condition" error because `elasticSearchFormat` passed raw `config` instead of `extendedConfig` to `buildEsRule`, causing widget resolution to fail and `hasUnfinishedRule` to return true. Tests added: - Rule CRUD serial group: empty state, create, edit, delete - Filter validation serial group: incomplete condition blocks save, regression #31564 (Description Contains allows save), entity-type switch clears filter, duplicate name rejected - Rule editor fields: max-assets clamping, toggle visibility, knowledge entity-type forces Fully rendered on Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * fix(playwright): fix regression test selector and add operator selection step Live browser testing revealed two issues with the Persona AI Context regression spec: 1. `page.locator('.rule').first()` finds the GROUP container which can be hidden in some builds — go directly to `.rule--field .ant-select` at page level instead. 2. The Description field uses `match_phrase` operators. The text widget (`.rule--widget--TEXT`) only renders after an operator is selected. Add an explicit "Contains" operator selection step so the input is available before we try to fill it. Also: add `.first()` guard on the Fully rendered switch locator in the knowledge-entity-type test (multiple elements can match) and add a note that react-aria Switch stores state in the checked property, not aria-checked. Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * fix(playwright): address gitar-bot review findings in AI Context spec Three issues raised in PR #31581 review: 1. `openAddRuleDrawer`: `isVisible({ timeout: 500 })` silently ignores the timeout and returns synchronously — replace with `emptyBtn.or(headerBtn).first().waitFor()` so we genuinely wait, then branch on `isVisible()` after the element is confirmed present. 2. `waitForTimeout(300)` sleeps after clicking add-context-condition are flaky: replaced with `page.locator('.rule--field .ant-select').first() .waitFor({ state: 'visible' })` at all three call sites. 3. Comment on the Fully rendered switch assertion said "use .isChecked()" but the code uses Playwright's `toBeChecked()` matcher — reworded to accurately describe why the property-based check is needed. Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * refactor(playwright): merge CRUD serial tests into one test, remove serial from filter validation CRUD tests (empty→create→edit→delete) are an inherently sequential flow where edit and delete depend on state created by earlier steps. Collapsing them into a single test with test.step() makes the dependency explicit and atomic: a step failure aborts only that test rather than silently skipping later ones via describe.serial. Filter validation tests are each self-contained (each creates and discards its own rule within a single test body), so describe.serial was unnecessary. Removing it ensures a failure in the "incomplete condition" test never prevents the regression test (#31564) from running. Also replace waitForTimeout(300) with waitFor({ state: 'visible' }) on the condition-row field selector to eliminate timing-based flakes. Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * ci(playwright): add impact mapping for PersonaAIContextRules spec Adds a mapping so changes to the PersonaAIContext component tree (src/components/Settings/Persona/PersonaAIContext/**) or PersonaAPI.ts on a future PR automatically include the three AI Context spec files in the CI plan rather than falling through to an unmapped-file warning. Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * ci(playwright): seed timing-baseline.json for PersonaAIContextRules spec The plan-playwright gate hard-fails when a wholly-new spec file has >= 5 tests with no timing history — the FALLBACK_TEST_MS reservation (30s × 8 = 4 min) would under-budget the shard and risk a SIGTERM on the merge queue (see PR #30812). Add 8 entries using the real Playwright test IDs (obtained via `playwright test --list`) and calibrated durations based on comparable tests in PersonaAIContext.spec.ts and PersonaFlow.spec.ts. The nightly full-mode run will replace these estimates with measured values via the auto-refresh workflow once the spec first executes. Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * fix(playwright): address gitar-bot/greptile PR comments for PersonaAIContextRules spec - Wrap all tests in test.describe.serial: shared PersonaClass instance running under fullyParallel:true caused the CRUD "empty state" assertion to race against filter/editor tests concurrently creating rules on the same persona - Move beforeAll/afterAll inside the serial describe using test.beforeAll/test.afterAll (not base.beforeAll), matching the pattern in PersonaAIContext.spec.ts - Remove test.slow(true) from both hooks — Playwright throws "can only be called inside test" when used in beforeAll/afterAll - Remove two redundant // Cleanup inline comments (greptile P2) that just restated the next line of code Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * ci(playwright): refresh PersonaAIContextRules test IDs in timing-baseline.json The describe.serial wrapper added in the previous commit changed all 8 test-ID hashes for PersonaAIContextRules.spec.ts (test ID is computed from the full describe-path, so wrapping the suite in an outer describe.serial changes every hash). The plan-playwright gate hard-fails when every test in a file >= 5 tests falls through to FALLBACK_TEST_MS with no timing history. Surgically replace the 8 stale IDs with the IDs from the current structure obtained via `npx playwright test --list --reporter=json`. File and title fields are unchanged; only the `"id"` values are updated. Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * ci: retrigger plan-playwright after timing-baseline refresh The previous CI run used a merge commit that predated the timing-baseline ID refresh in 7fa030d. Force a new run against the updated merge commit. Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * fix(plan-playwright): always include timing-baseline.json alongside history artifacts The stale-baseline gate fires when all tests in a new spec file have no timing history. Previously, timing-baseline.json was only used as a fallback when NO history artifacts were downloaded from recent CI runs. Once any artifact existed (typical for an active repo), the baseline was skipped entirely — so seeding a new spec's durations into the baseline had no effect and the gate would always fire for newly-added spec files. Fix: unconditionally append --history timing-baseline.json so it is always consulted alongside downloaded artifacts. When artifacts exist the baseline acts as a supplemental seed for new specs not yet in any full-run artifact; when no artifacts were downloaded it remains the sole source. Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * Revert "fix(plan-playwright): always include timing-baseline.json alongside history artifacts" This reverts commit 25613c8. --------- Co-authored-by: Claude Sonnet 4.6 <[email protected]> (cherry picked from commit 31cca94)
…pen-metadata#31581) * test(playwright): add E2E coverage for Persona AI Context rule builder Adds 11 Playwright tests covering the full rule CRUD flow, filter validation, and individual field behaviours for the AI Context tab in Persona settings. The most important addition is a regression test for open-metadata#31564: before PR open-metadata#31565 a fully-completed single-value condition (e.g. Description Contains "…") was incorrectly rejected with the "unfinished condition" error because `elasticSearchFormat` passed raw `config` instead of `extendedConfig` to `buildEsRule`, causing widget resolution to fail and `hasUnfinishedRule` to return true. Tests added: - Rule CRUD serial group: empty state, create, edit, delete - Filter validation serial group: incomplete condition blocks save, regression open-metadata#31564 (Description Contains allows save), entity-type switch clears filter, duplicate name rejected - Rule editor fields: max-assets clamping, toggle visibility, knowledge entity-type forces Fully rendered on Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * fix(playwright): fix regression test selector and add operator selection step Live browser testing revealed two issues with the Persona AI Context regression spec: 1. `page.locator('.rule').first()` finds the GROUP container which can be hidden in some builds — go directly to `.rule--field .ant-select` at page level instead. 2. The Description field uses `match_phrase` operators. The text widget (`.rule--widget--TEXT`) only renders after an operator is selected. Add an explicit "Contains" operator selection step so the input is available before we try to fill it. Also: add `.first()` guard on the Fully rendered switch locator in the knowledge-entity-type test (multiple elements can match) and add a note that react-aria Switch stores state in the checked property, not aria-checked. Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * fix(playwright): address gitar-bot review findings in AI Context spec Three issues raised in PR open-metadata#31581 review: 1. `openAddRuleDrawer`: `isVisible({ timeout: 500 })` silently ignores the timeout and returns synchronously — replace with `emptyBtn.or(headerBtn).first().waitFor()` so we genuinely wait, then branch on `isVisible()` after the element is confirmed present. 2. `waitForTimeout(300)` sleeps after clicking add-context-condition are flaky: replaced with `page.locator('.rule--field .ant-select').first() .waitFor({ state: 'visible' })` at all three call sites. 3. Comment on the Fully rendered switch assertion said "use .isChecked()" but the code uses Playwright's `toBeChecked()` matcher — reworded to accurately describe why the property-based check is needed. Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * refactor(playwright): merge CRUD serial tests into one test, remove serial from filter validation CRUD tests (empty→create→edit→delete) are an inherently sequential flow where edit and delete depend on state created by earlier steps. Collapsing them into a single test with test.step() makes the dependency explicit and atomic: a step failure aborts only that test rather than silently skipping later ones via describe.serial. Filter validation tests are each self-contained (each creates and discards its own rule within a single test body), so describe.serial was unnecessary. Removing it ensures a failure in the "incomplete condition" test never prevents the regression test (open-metadata#31564) from running. Also replace waitForTimeout(300) with waitFor({ state: 'visible' }) on the condition-row field selector to eliminate timing-based flakes. Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * ci(playwright): add impact mapping for PersonaAIContextRules spec Adds a mapping so changes to the PersonaAIContext component tree (src/components/Settings/Persona/PersonaAIContext/**) or PersonaAPI.ts on a future PR automatically include the three AI Context spec files in the CI plan rather than falling through to an unmapped-file warning. Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * ci(playwright): seed timing-baseline.json for PersonaAIContextRules spec The plan-playwright gate hard-fails when a wholly-new spec file has >= 5 tests with no timing history — the FALLBACK_TEST_MS reservation (30s × 8 = 4 min) would under-budget the shard and risk a SIGTERM on the merge queue (see PR open-metadata#30812). Add 8 entries using the real Playwright test IDs (obtained via `playwright test --list`) and calibrated durations based on comparable tests in PersonaAIContext.spec.ts and PersonaFlow.spec.ts. The nightly full-mode run will replace these estimates with measured values via the auto-refresh workflow once the spec first executes. Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * fix(playwright): address gitar-bot/greptile PR comments for PersonaAIContextRules spec - Wrap all tests in test.describe.serial: shared PersonaClass instance running under fullyParallel:true caused the CRUD "empty state" assertion to race against filter/editor tests concurrently creating rules on the same persona - Move beforeAll/afterAll inside the serial describe using test.beforeAll/test.afterAll (not base.beforeAll), matching the pattern in PersonaAIContext.spec.ts - Remove test.slow(true) from both hooks — Playwright throws "can only be called inside test" when used in beforeAll/afterAll - Remove two redundant // Cleanup inline comments (greptile P2) that just restated the next line of code Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * ci(playwright): refresh PersonaAIContextRules test IDs in timing-baseline.json The describe.serial wrapper added in the previous commit changed all 8 test-ID hashes for PersonaAIContextRules.spec.ts (test ID is computed from the full describe-path, so wrapping the suite in an outer describe.serial changes every hash). The plan-playwright gate hard-fails when every test in a file >= 5 tests falls through to FALLBACK_TEST_MS with no timing history. Surgically replace the 8 stale IDs with the IDs from the current structure obtained via `npx playwright test --list --reporter=json`. File and title fields are unchanged; only the `"id"` values are updated. Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * ci: retrigger plan-playwright after timing-baseline refresh The previous CI run used a merge commit that predated the timing-baseline ID refresh in 7fa030d. Force a new run against the updated merge commit. Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * fix(plan-playwright): always include timing-baseline.json alongside history artifacts The stale-baseline gate fires when all tests in a new spec file have no timing history. Previously, timing-baseline.json was only used as a fallback when NO history artifacts were downloaded from recent CI runs. Once any artifact existed (typical for an active repo), the baseline was skipped entirely — so seeding a new spec's durations into the baseline had no effect and the gate would always fire for newly-added spec files. Fix: unconditionally append --history timing-baseline.json so it is always consulted alongside downloaded artifacts. When artifacts exist the baseline acts as a supplemental seed for new specs not yet in any full-run artifact; when no artifacts were downloaded it remains the sole source. Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * Revert "fix(plan-playwright): always include timing-baseline.json alongside history artifacts" This reverts commit 25613c8. --------- Co-authored-by: Claude Sonnet 4.6 <[email protected]>



Fixes #31564
Problem
In Settings → Personas → <persona> → AI Context → Add Rule, a filter condition that is fully
filled in is rejected on save:
Nothing is unfinished. The match preview in the same drawer resolves the filter and reports the right
count, and "View in Explore" returns the same assets. The rule just cannot be saved from the UI.
It hits any condition using a single-value operator (
Is,Is not,Contains,Is null,Between, …) on a normal field. Two cases escape: multiselect operators (Any in,Not any in),and custom-property (
extension.*) fields.Root cause
elasticSearchFormatextends the incoming config once at the top and handsextendedConfigto everybranch — the group branch, and the multiselect half of the rule branch — except the single-value half,
which passed the raw
configstraight tobuildEsRule.buildEsRuleresolves the field's widget through that config (getWidgetForFieldOp→config.widgets[widget]). A raw config resolves no widget, so it returnsundefined.The difference is invisible while a whole tree is formatted, because a rule is then always reached
through its group and so always receives an extended config. It surfaces the moment
elasticSearchFormatis called on a rule node directly — which is exactly whathasUnfinishedRule(added in #30716) does to decide whether a row was left unfinished. It saw
undefined, concluded therow constrained nothing, and blocked the save.
Same tree, same config, opposite answers before this change:
Fix
Pass
extendedConfigtobuildEsRulein the single-value branch, matching what the multiselectbranch beside it and the group branch already do. Formatting a whole tree is unaffected — the config
reaching
buildEsRulethere was already extended.Tests
QueryBuilderElasticsearchFormatUtils.test.js, four new cases. The existinghasUnfinishedRulecoverage all used
extension.*fields, which return throughbuildExtensionQuerybefore the widgetis ever resolved, so it could not see this; the new cases use a plain
selectfield and a realQbUtils.loadTree/checkTreetree.not regress
Also green:
QueryBuilder*,AdvancedSearch*,ContextRule*,PersonaAIContext*,Explore*,CuratedAssets*— 487 tests. ESLint clean, no new warnings.🤖 Generated with Claude Code