Skip to content

Failing test: Custom resolution rules - previews, links local users to AD, stops on disable, resumes on enable, and cleans up on delete #299611

Description

@kibanamachine

A test failed on a tracked branch

Scout Test Details:

Field Value
Test ID ddd5b28c53d0781-c77d58aee342dfb
Target cloud-serverless-security_complete
Location x-pack/platform/plugins/shared/entity_store/test/scout/crud_and_resolution/api/tests/custom_resolution_rules.spec.ts
Duration 50.92s
Module entityStore (plugin)
Config path x-pack/platform/plugins/shared/entity_store/test/scout/crud_and_resolution/api/playwright.config.ts
Code Owners elastic/security-entity-analytics
Error: expect(received).toBeUndefined()

Received: {"deferredByDeadline": false, "definitionFingerprint": "ed44715c0b288b89fae1965e1f1e3337e1a0d78917113d680acbd8cd4f66d93b", "lastAttemptAt": "2026-10-21T15:42:20.558Z", "lastError": null, "lastProcessedTimestamp": "2026-10-21T15:42:03.853Z", "lastRun": {"cascadeRetargeted": 0, "cascadesBlocked": 0, "resolutionsCreated": 1, "skippedAmbiguousBuckets": 0, "skippedNoopBuckets": 0, "skippedOversizedBuckets": 0}, "lastStartedFirstAt": "2026-10-21T15:42:20.558Z"}
    at x-pack/platform/plugins/shared/entity_store/test/scout/crud_and_resolution/api/tests/custom_resolution_rules.spec.ts:402:76
    at x-pack/platform/plugins/shared/entity_store/test/scout/crud_and_resolution/api/tests/custom_resolution_rules.spec.ts:388:9

First failure: appex-qa-serverless-kibana-scout-tests - main

Test history: passes and failures over time

Activity

  1. added
    failed-testA test failure on a tracked branch, potentially flaky-test
    scout-playwrightScout (Playwright) related issues and PRs
    on Oct 21, 2026
  2. github-actions commented on Oct 21, 2026

    @github-actions
    Contributor

    Test needs an update — one maintainer run isn't a guaranteed prune

    custom_resolution_rules.spec.ts:363 asserted the deleted rule's saved progress was gone after a single sync=true maintainer run, but read back — unchanged — the state the preceding "re-enabled" run wrote (lastAttemptAt = lastStartedFirstAt = 15:42:20.558Z, lastRun.resolutionsCreated: 1), i.e. the prune never landed (medium confidence: Cloud serverless ships no Kibana logs, so the exact path can't be pinned).

    Details

    Proposed fix

    In the delete removes the rule and its saved progress, links stay step, replace the one-shot assertion at custom_resolution_rules.spec.ts:363 with a bounded convergence wait: poll readCustomRuleState(apiClient, ruleId) until it is undefined, re-issuing triggerMaintainerRun(..., { sync: true }) between attempts, and fail with the last-read state. Pruning only happens inside a run, so a read-only poll can't converge within the 5-minute task interval — re-triggering is required, and it is safe here because the maintainer is an idempotent reconciliation task the product itself re-runs every 5 minutes. helpers.ts:650-655 already does exactly this (trigger → read → trigger → read) for the SID watermark; generalise it into a shared waitForMaintainerState-style helper rather than open-coding a second copy. This keeps the test's intent intact — the progress is pruned — while matching the guarantee the product offers, per Design tests with a cloud-first mindset.

    Subordinate alternative, if the team wants one run to always prune: make pruneDeletedRules derive its candidate set from the custom: state keys alone (confirming each with the realtime by-id read) and run it before the rule listing, so pruning no longer depends on the eventually-consistent listing or on the listing succeeding at all.

    Root cause & evidence

    The state read back is byte-for-byte what the previous step's run wrote, which is what "the prune never ran" looks like — not "the prune ran and was wrong". runCustomResolutionRules is deliberately best-effort about that prune, and at least three paths through it leave the entry in place; all three are consistent with the observed state, and nothing in the available artifacts separates them:

    • It returns before pruneDeletedRules whenever the rule listing rejects (custom_rules.ts:151-158) — a transient saved-objects/PIT error, which pipelines.md calls out as a Cloud characteristic, is enough.
    • Membership is decided by a PIT search (findCustomResolutionRules, client.ts:101-117) while the confirmation read is a realtime soClient.get (client.ts:119-130). The test's 404 at line 360 goes through the realtime path, so it can pass while the search still lists the rule as live and the key is never even considered for pruning.
    • Nothing serialises the sync route against the maintainer's own 5-minute Task Manager tick: runSync reads the task state, runs, then writes it back wholesale, so a tick already in flight across the delete finishes afterwards and writes back its pre-delete snapshot.

    The test is the only place that assumes one run settles this; the same fixture file's own helper already assumes it doesn't (helpers.ts:650-655 triggers, reads, then triggers and reads again). The spec is two days old — added by #297506 (merged 2026-10-19), which introduced both the assertion and the best-effort prune — and this is its first failure, on cloud-serverless-security_complete only.

    Additional context

    • Ruled out: lane/worker interference (createPlaywrightConfig defaults to workers: 1 and Cloud provisions a project per config, so no sibling spec could have been triggering runs); a stale read in the assertion itself (getMaintainers reads the task document with a realtime taskManager.get, not a search).
    • Open questions: the failed job uploaded only the HTML failure report and test-failures-summary.json — Cloud serverless runs ship no .scout/server.log — so I could not pin which of the three paths fired. entityStore maintainer logs at info/warn for the window 15:42:20–15:42:35Z would settle it in one line: Skipping custom resolution rules this run; failed to load them: ... (listing failed), custom:<id>: keeping its state; ... (by-id read threw), or two overlapping Custom resolution rules this run, in order: ... lines (a concurrent tick). Capturing plugins.entityStore at info and shipping the Kibana log with Cloud serverless Scout artifacts would make the next occurrence conclusive.
    • Verification: node scripts/scout.js run-tests --location cloud --arch serverless --domain security_complete --config x-pack/platform/plugins/shared/entity_store/test/scout/crud_and_resolution/api/playwright.config.ts

    Tip

    Marked "AI-fixable". Add ai:fix-flaky to request a fix now; otherwise it will be requested automatically if the test fails again.

    Generated by Failed Test Investigator for #299611 · claude · opus · 404.6 AIC · ⌖ 56.5 AIC · ⊞ 14.1K · ◷

  3. added
    failure:ai-fixableFailed test investigator: a fix is available and a PR can be opened
    failure:insufficient-dataFailed test investigator: not enough logs/artifacts to reach a confident verdict
    failure:test-needs-updateFailed test investigator: failure lives in the test code
    on Oct 21, 2026
  4. infra-vault-gh-plugin-prod commented on Oct 21, 2026

    @infra-vault-gh-plugin-prod
    Contributor

    Pinging @elastic/security-entity-analytics (Team:Entity Analytics)

  5. kibanamachine commented on Oct 24, 2026

    @kibanamachine
    ContributorAuthor

    New failure for "cloud-serverless-security_complete" target: appex-qa-serverless-kibana-scout-tests - main

    Test history: passes and failures over time

    New error message:

    Error: expect(received).toBeUndefined()
    
    Received: {"deferredByDeadline": false, "definitionFingerprint": "ed44715c0b288b89fae1965e1f1e3337e1a0d78917113d680acbd8cd4f66d93b", "lastAttemptAt": "2026-10-24T15:36:50.746Z", "lastError": null, "lastProcessedTimestamp": "2026-10-24T15:36:34.066Z", "lastRun": {"cascadeRetargeted": 0, "cascadesBlocked": 0, "resolutionsCreated": 1, "skippedAmbiguousBuckets": 0, "skippedNoopBuckets": 0, "skippedOversizedBuckets": 0}, "lastStartedFirstAt": "2026-10-24T15:36:50.746Z"}
    
  6. github-actions commented on Oct 24, 2026

    @github-actions
    Contributor

    ✅ Flaky Test Fixer completed successfully!

    Generated by Flaky Test Fixer for #299611

  7. github-actions commented on Oct 24, 2026

    @github-actions
    Contributor

    ➡️ A fix PR is ready for review: #300346

    The maintainer now prunes a deleted custom rule's saved progress from the realtime read-by-id rather than from the eventually consistent rule listing, so a single sync=true run prunes it as the spec expects.

    Generated by Flaky Test Fixer for #299611 · claude · opus · 436 AIC · ⌖ 54.1 AIC · ⊞ 15.2K · ◷

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Team:Entity AnalyticsSecurity Entity Analytics Teamfailed-testA test failure on a tracked branch, potentially flaky-testfailure:ai-fixableFailed test investigator: a fix is available and a PR can be openedfailure:insufficient-dataFailed test investigator: not enough logs/artifacts to reach a confident verdictfailure:test-needs-updateFailed test investigator: failure lives in the test codescout-playwrightScout (Playwright) related issues and PRs

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions