Repository navigation
Description
Summary
TestAccResourcePrebuiltRules/default (internal/kibana/prebuilt_rules) fails deterministically on Elastic Stack 8.14.3, 8.15.5 and 8.16.6 whenever it runs in the same acceptance shard as internal/fleet/elastic_defend_integration_policy. It was first seen on #5489, which does not touch either package.
acc_test.go:119: Step 2/3 error: Expected a non-empty plan, but got an empty refresh plan
It fails on every re-run (initial attempt plus 5 re-runs) on all three versions. TestAccResourcePrebuiltRules/in_space passes, so the problem is specific to the default space.
Cause
- A PR that touches
provider/orinternal/clients/(both are inforceAllPrefixesinscripts/targeted-testacc/classifier.go) makes the targeted-testacc selector pick every acceptance package. Add the elasticstack_kibana_alerting_v2_rule resource #5489 hits this simply by registering a new resource inprovider/plugin_framework.go. - The selector builds its own 2-way split. In the Add the elasticstack_kibana_alerting_v2_rule resource #5489 run it put
internal/fleet/elastic_defend_integration_policyandinternal/kibana/prebuilt_rulesin the same shard. With the full-suite split onmain(go list ./... | sort | awk '(NR-1) % 2 == idx') they land in different shards (shard 0 and shard 1), which is whymaindoesn't see it. - The Elastic Defend tests skip below 8.14. On 8.14+ they cause Fleet to install
security_detection_enginefrom EPR into thedefaultspace. The job logs show twoEndpoint Security (Elastic Defend)detection rules indefaultwith different rule ids. deleteSingleDetectionRule(internal/kibana/prebuilt_rules/acc_test.go) callsFindRuleswith no filter and deletesData[0]. If that is a duplicate or an EPR-installed rule rather than a bundled prebuilt one, the prepackaged_statusstill reportsrules_not_installed == 0, so step 2 (ExpectNonEmptyPlan: true) gets an empty plan every time.
Step 4 is the best-supported explanation from the logs; I did not observe the deleted rule id directly.
Evidence
- Failing run: https://github.com/elastic/terraform-provider-elasticstack/actions/runs/45441436993 (and the later run
46664172867on the same PR) - Failing jobs:
Matrix Acceptance Test8.14.3, 8.15.5, 8.16.6 (shard 0);Provider Gatefails as a result - 8.17+ and the 9.x lanes pass (prebuilt rules moved to the Fleet package model there)
- Reproduced locally with the targeted selector:
go run ./scripts/targeted-testacc/... --base=<merge-base> --total-shards=2 --dry-runreportsforce-all prefix matchedand places both packages in shard 0 for Add the elasticstack_kibana_alerting_v2_rule resource #5489.
Impact
Any PR that triggers force-all selection can hit this depending on how the planner splits packages, so it can block unrelated PRs at the Provider Gate (re-running does not help). It is a latent isolation bug in the test, exposed by shard layout.
Suggested fix (any of)
- Make
deleteSingleDetectionRuledeterministic: select a bundled, immutable prebuilt rule explicitly rather thanData[0], and assertrules_not_installedgoes up by exactly 1 around the delete. - Run the
defaultcase in an isolated space, or skip it on versions where Defend can pollutedefault. - Optionally teach the shard planner to keep packages that mutate default-space detection rules (
elastic_defend_integration_policy,prebuilt_rules,security_detection_rule,security_enable_rule) in separate shards.
Related
- Seen on Add the elasticstack_kibana_alerting_v2_rule resource #5489 (new
elasticstack_kibana_alerting_v2_ruleresource), which is unrelated to this failure.
Activity
github-actions commentedon Dec 1, 2026
Thanks for the bug report! The needs-reproduction label has been added to this issue.
This looks like a reproducible bug, so it has been queued for the reproducer-factory pipeline. Reproducer-factory will attempt to confirm the behaviour and create a minimal reproduction case. The detailed root-cause analysis, failing run links, and local reproduction steps included in this report should make that process much smoother. Thank you for the thoroughness!
If this classification is wrong or there is additional context to add, please leave a comment so a maintainer can adjust the label manually.
github-actions commentedon Dec 1, 2026
✅ Research Factory Issue Intake completed successfully!
github-actions commentedon Dec 1, 2026
Implementation research
Run: 2026-12-01 · Workflow run
Problem framing
TestAccResourcePrebuiltRules/default(internal/kibana/prebuilt_rules/acc_test.go) failsdeterministically on Elastic Stack 8.14.3, 8.15.5, and 8.16.6 whenever a PR's targeted-testacc
selector places it in the same shard as
internal/fleet/elastic_defend_integration_policy.Step 2 of the test (
PlanOnly: true, ExpectNonEmptyPlan: true, afterdeleteSingleDetectionRuleruns as aPreConfig) gets an empty refresh plan instead of anon-empty one.
TestAccResourcePrebuiltRules/in_spacepasses under the same conditions.Confirmed from the repo (
internal/kibana/prebuilt_rules/acc_test.go:311-344):deleteSingleDetectionRulecallsFindRulesWithResponsewith emptykbapi.FindRulesParams{}— no filter, sort, or paging constraints — then unconditionally deletesresp.JSON200.Data[0]. Empty params mean Kibana's documented defaults apply:page=1,per_page=20(generated/kbapi/oas.yaml:30363-30378), so only the first 20 rules in the spaceare ever visible to this call; with more rules present (e.g. Defend/EPR-installed ones alongside
the bundled prebuilt set)
Data[0]is not just "unfiltered", it is also "first of a truncated,arbitrarily-ordered page". Step 2 expects that deleting a bundled prebuilt rule drives the
_statusendpoint'srules_not_installedabove zero, which the resource's refresh plan reflects.Confirmed in
internal/kibana/prebuilt_rules/resource.go:60-101:ModifyPlanproduces a plandiff when any of four counters is nonzero —
rules_not_installed(76-80),rules_not_updated(82-85),timelines_not_installed(87-91), ortimelines_not_updated(93-96) — each independently sets
updated = true, andresp.Plan.Setonly runs whenupdatedis true (98-100). The model (
models.go:29-40,56-63) and read path (read.go:34,40, viakibanaoapi.GetPrebuiltRulesStatus) carry only these aggregate_statuscounters — no individualrule IDs. So the empty-plan failure requires that deleting
Data[0]leaves all four countersat zero, not just
rules_not_installed: this holds ifData[0]is a rule the_statusendpointdoesn't track as missing/outdated at all (e.g. a Fleet/EPR-installed rule outside the prepackaged
set it audits), but would not hold if the deleted rule happened to also be "outdated" by some
other measure. That nuance is why Approach A's regression outline below checks the counter delta
directly rather than only "plan non-empty".
Two facts anchor the "why sharding matters" half of the issue, both confirmed in-repo:
forceAllPrefixesinscripts/targeted-testacc/classifier.go:29-52includesprovider/andinternal/clients/; a change under either makes the targeted selector pick every acceptancepackage (
scripts/targeted-testacc/selector.go:32-40), then round-robin shard it(
selector.go:90-121) over the sorted list of acceptance-only packages.main(Makefile:136) applies the same% shardCountrule butover sorted
go list ./...(all packages, includinggenerated/...,scripts/..., moduleroot) — a different list. The same modulo over two different sorted lists can and does put
internal/fleet/elastic_defend_integration_policyandinternal/kibana/prebuilt_rulesin thesame PR shard while they land in different shards on
main, matching the issue's observationthat
maindoesn't reproduce this.The specific claim that installing the Elastic Defend integration causes Kibana/Fleet to install
security_detection_engineprebuilt rules into thedefaultspace on 8.14–8.16 is notverifiable from the repo or current public docs (see Open questions). Nothing in
internal/fleet/elastic_defend_integration_policyreferencessecurity_detection_engine, and theElastic Defend install docs don't mention rule installation as a side effect. The issue's own
evidence for that causal chain — the two linked CI workflow runs
(
45441436993,46664172867) showing two differently-id'd "Endpoint Security (Elastic Defend)"rules in
default, and the issue's claimed localtargeted-testacc --dry-runreproduction of theshard placement for #5489 — are the issue author's reports, not independently re-run or
re-verified by this research (this research did not execute the selector locally or fetch those
workflow logs). Treat this causal chain, and the version boundary at which prebuilt rules moved to
a Fleet-package delivery model (the issue's 8.17+ claim), as the working theory, not a confirmed
fact, through the rest of this writeup; both remain open questions below. Likewise, the theory that
deleting a non-bundled rule leaves
_statusunchanged is plausible given the confirmedModifyPlan/_statusmechanics above, but the counterfactual — what_statusactually reportsafter deleting a Fleet/EPR-installed rule on a real 8.14–8.16 stack — was not reproduced here
either.
A related, confirmed concurrency fact narrows how fully either fix below can eliminate the flake:
TestAccResourcePrebuiltRulesandTestAccResourcePrebuiltRulesDefaultSpaceIDare sequentialtop-level tests in the same package (no
t.Parallel()at the top level), so they don't race eachother in-process. But
elastic_defend_integration_policyandprebuilt_rulesrun as separatetest binaries against the same shared Kibana instance, driven concurrently by gotestsum's
-p/--parallelflags (Makefile:41-42,136,150) whenever both land in one shard — matching theissue's own description of the collision. Any Defend-side rule installs into
defaultcantherefore happen at any point during
prebuilt_rules's 3-step flow, independent of which ruledeleteSingleDetectionRuletargets.Approaches considered
Approach A: Make
deleteSingleDetectionRuleselect a specific, known rule deterministicallyInstead of
Data[0], delete a rule identified by a stablerule_id(or by aFindRulesfilteron a distinguishing attribute), so the deleted rule is always a bundled prebuilt rule tracked by
the
_statuscounts — regardless of what else exists in the space.FindRules(GET /api/detection_engine/rules/_find) only documents filteringon
name,enabled,tags,createdBy,interval,updatedBy— notrule_idorimmutable. There is no dedicatedrule_idquery param onFindRules. The generated clientdoes expose
ReadRuleandDeleteRule(GET/DELETE /api/detection_engine/rules) with anidorrule_idquery param, so a hard-coded, known bundledrule_idcould be deleteddirectly via
DeleteRuleWithResponse(..., &kbapi.DeleteRuleParams{RuleId: &ruleID})withoutgoing through
FindRules/Data[0]at all.(
generated/kbapi/kibana.gen.go:84033-84076,oas.yaml:30337-30345,oas.yaml:27944-27974)immutable(deprecated boolean) and arule_sourceunion(
external/internal) that in principle distinguish bundled-prebuilt from custom rules — butwhether Fleet/EPR-installed rules are distinguishable from CLI/UI-bundled prebuilt rules via
these same fields is unverified from the spec (the spec's own comment suggests EPR-distributed
rules are also "prebuilt"/
external, so filtering onimmutable/rule_sourcealone may notseparate "safe to delete for this test" from "installed by the other test's Fleet package").
(
generated/kbapi/kibana.gen.go:62990-62992,:63121-63123,oas.yaml:197123-197141)internal/kibana/prebuilt_rules/acc_test.go."default" subtest runs in its own freshly-created space (Approach B), the install resource's
prepackaged install is the only writer of rules into that space for the duration of the test —
there is no concurrently-running Fleet/Defend policy targeting it, so the selection contract
only needs to be correct relative to the bundled prepackaged set itself, not robust against
arbitrary third-party rules. Given that, the simplest correct selector is: loop
FindRulespages (using the always-present
page/perPage/totalresponse fields to know when to stop,since
per_pagedefaults to 20 with no documented maximum) and pick the first rule withimmutable == true, explicitly failing the test (not panicking onData[0]) if zero such rulesare found after exhausting all pages. This sidesteps the still-open question of whether
immutablealso matches EPR-installed rules, because in the isolated space there are noEPR-installed rules to confuse it with. A hard-coded
rule_id(viaReadRule) remains a viablealternative but is not required once isolation removes the ambiguity driving the current bug.
_statusimmediately before deletingData[N], delete it, read_statusagain, andassert the deltas directly rather than only "plan is non-empty":
rules_not_installedincreases by exactly 1,
rules_installeddecreases by exactly 1, and the other threeModifyPlan-relevant counters (rules_not_updated,timelines_not_installed,timelines_not_updated) are unchanged — this is what actually proves the selected rule was atracked prebuilt rule, not merely that some diff appeared.
pre-delete values (a distinct assertion from the immediate post-delete deltas above).
message, not an index-out-of-range panic.
(or closure) returning canned
FindRulespages, so pagination can be exercised with a unittest independent of a live Kibana: assert it (a) skips a page-1 response containing no
immutable == truerule and finds a qualifying rule on page 2, and (b) returns a clear errorwhen every page is exhausted with no qualifying rule — both scenarios are not reliably
reproducible by just installing >20 rules into a live test space, since the first
immutablerule would typically appear well before page 2.
cycle.
elastic_defend_integration_policyin one shard on 8.14.3, 8.15.5, and 8.16.6 to confirm theoriginally reported collision no longer reproduces.
papering over the symptom; smallest code change if applied alone (test helper only).
insulate the test from a concurrently-running Defend test installing/reinstalling rules into the
same shared
defaultspace mid-flow — per the concurrency fact above, both would still targetdefault, andimmutablemay not distinguish EPR-installed rules from bundled ones (openquestion below) in that shared setting. This is why the recommendation pairs Approach A's
selector with Approach B's isolation rather than proposing A standalone.
Approach B: Isolate
TestAccResourcePrebuiltRules/defaultin its own Kibana spaceConvert the
defaultsubtest to the same shape as the existingin_spacesubtest: create arandom
elasticstack_kibana_space, point the install resource at it, and rundeleteSingleDetectionRuleagainst that isolated space instead of the shareddefaultspace.TestAccResourcePrebuiltRules/in_spaceitself (testdata/TestAccResourcePrebuiltRules/in_space/create/main.tf,random space id via
RandStringFromCharSetatacc_test.go:95), plusTestAccResourceSecurityDetectionRule_QueryMinimalWithSpace(
internal/kibana/security_detection_rule/acc_test.go:2182-2303) andsecuritylistitem(
internal/kibana/securitylistitem/acc_test.go:31-32,168-169)._find,prepackaged,prepackaged/_status, ruleCRUD) are space-scoped — "if
space_idis not provided in the URL, the default space is used" —so running the whole flow in an isolated space is a documented, supported pattern
(
https://www.elastic.co/docs/solutions/security/get-started/spaces-elastic-security:"detection rules ... are private to the space ... will run independently").
tuning which Defend policies/artifacts are visible from a given space) is "Generally available
since 9.1"; for deployments that existed before 9.1 it requires a one-time, irreversible, manual
migration with an Enterprise subscription
(
https://www.elastic.co/docs/deploy-manage/manage-spaces-fleet,.../spaces-defend-faq). Nothing in those docs states this opt-in is available or meaningful on8.14–8.16 specifically — it is a 9.1+ migration path, not an 8.x feature. That said, this gates
where Defend's policies/artifacts are scoped, not where this test's own install/status/find
calls run: isolating
prebuilt_rules's calls to a dedicated space is still expected to preventthis specific collision, because the rule-isolation guarantee above is a property of the
detection-engine APIs this test calls directly, not of Fleet/Defend space-awareness. This also
fully addresses the cross-process concurrency fact noted above: whatever Defend installs lands
in
defaultand the test's own calls would simply never touchdefault, regardless of timing.elasticstack_kibana_space.testtotestdata/TestAccResourcePrebuiltRules/default/create/main.tfand updatetestAccResourcePrebuiltRules(t, spaceID)to use the new space id for the "default"-namedsubtest (keeping the subtest name "default" for continuity, or renaming — a scope decision left
open below). Wire the install resource's
space_idtoelasticstack_kibana_space.test.space_id(an attribute reference), not independently to
var.space_idas the existingin_spacefixturedoes today — the existing
in_spacefixture has both resources readvar.space_idindependently with no
depends_onor attribute reference, so Terraform has no explicitdependency edge between them and only works by same-value correlation. The repo's own
convention for this exact pattern (space + dependent resource) is an attribute reference, e.g.
security_detection_rule's..._QueryMinimalWithSpacefixture(
space_id = elasticstack_kibana_space.test.space_id,security_detection_rule.tf:13-17,20) and the APMsource_mapspace fixture(
main.tf:20-23,32); the newdefaultfixture should follow that convention rather thancopying
in_space's looser var-correlation.prebuiltRulesInSpaceConstraints(< 9.4.0or>= 9.6.0-0,acc_test.go:46-49) exists because installing the full prepackaged rule set into a new,custom space fails on 9.4.x/9.5.x (comment cites
elastic/kibana#285497,acc_test.go:43-45); it is currently applied only to thein_spacetable entry(
acc_test.go:97), not to"default"(acc_test.go:90-93), because"default"doesn't use acustom space today. Converting
"default"to an isolated-space fixture means it would hit thesame known 9.4.x/9.5.x failure and needs the same constraint applied — this is a real scope item
for Approach B, not a free rewrite, and is why
TestAccResourcePrebuiltRulesDefaultSpaceID(which targets the real default space and carries no such constraint) should stay as-is rather
than also being converted.
default-space-sharing root cause; reuses an already-passing,in-package pattern; no dependency on guessing a stable
rule_id.defaultspace, whichmay have been intentional (e.g.
TestAccResourcePrebuiltRulesDefaultSpaceIDalready existsspecifically to check default-space behavior at
acc_test.go:197-219, so coverage of the literaldefault space would still exist elsewhere, just without a destructive delete/reinstall cycle
against it in that other test either — so isolating
default's delete/reinstall subtest wouldlose the one test that exercises that rebuild flow against the real default space).
Recommendation
Scope classification: this is a test-only fix. Neither approach touches the
elasticstack_kibana_install_prebuilt_rulesresource's schema, state model, or any migrationpath —
models.go's six aggregate counters andresource.go'sModifyPlanlogic are unchanged;only
internal/kibana/prebuilt_rules/acc_test.goand itstestdata/fixtures change.Approach A (make
deleteSingleDetectionRuledeterministic) is necessary regardless — the currentData[0]selection is a real bug independent of sharding (it can panic on an empty page, andsilently picks an arbitrary rule from a 20-row page) — but, per the confirmed cross-process
concurrency fact above, it does not by itself fully close the collision with
elastic_defend_integration_policy: both still operate against the shareddefaultspace, so aDefend install/update landing mid-flow could still perturb
_statuscounts outside what the testexpects. Approach B (isolate the delete/reinstall subtest into its own space) directly removes the
shared-space dependency that makes this collision possible at all, and reuses an
already-passing, in-package pattern (
in_space). The recommended spine is Approach B, pairedwith Approach A's deterministic-selection fix applied inside the now-isolated test (so the helper
is correct on its own merits, not just safe by virtue of isolation). This is a real, acknowledged
trade-off rather than a free rewrite:
TestAccResourcePrebuiltRulesDefaultSpaceIDexercisesdefault-space install behavior, but it is single-step and create-only (
acc_test.go:197-219),so moving
"default"'s destructive delete/reinstall cycle to an isolated space means no test inthis package still exercises a prebuilt-rule delete-and-reinstall cycle against the literal
default space after this change. That loss is accepted deliberately because reproducing the
collision safely in the real default space (with Defend potentially present) is the exact problem
the issue reports — it is called out explicitly here rather than glossed over.
Open questions
elastic_defend_integration_policyon Stack 8.14–8.16 actually cause Kibana toinstall
security_detection_engine/"Endpoint Security (Elastic Defend)" prebuilt rules into thedefaultspace? Neither the repo nor current elastic.co docs confirm this; it is inferred onlyfrom the issue author's CI log excerpt. Not blocking for Approach B (space isolation is correct
regardless of the exact mechanism, since it removes shared-space exposure to any default-space
side effect), but it does matter for Approach A alone, whose value is otherwise just "delete a
better-chosen rule in a space something else might still be mutating."
rule_idguaranteed to exist across 8.14.3, 8.15.5, and 8.16.6 thatApproach A could hard-code, or must the fix instead filter
FindRules'sDataclient-side onimmutable/rule_source? Not covered by the OpenAPI spec (data-dependent, not schema-defined).immutableandrule_sourcereliably distinguish "bundled prebuilt" from "Fleet/EPR-packageprebuilt" rules, or do EPR-delivered rules also report
immutable: true/rule_source: external(same as CLI/UI-installed prebuilt rules)? The spec's prose suggests the latter, whichwould mean Approach A's filter-based variant still needs a
rule_id- ortags-baseddistinguisher, not just
immutable.rules_not_installedbehavior of_statusafter deleting a non-bundled (e.g.EPR-installed) rule actually "unchanged" (producing the empty plan), as the issue theorizes, or
could the empty plan instead stem from a different mechanism (e.g.
Data[0]being a duplicaterule_id that the resource's refresh dedupes)? Not confirmed by docs or repo; would benefit from a
reproduction against a real 8.14–8.16 stack with Defend installed.
Out of scope
keeping
elastic_defend_integration_policyandprebuilt_ruleson different shards). Thiswould mask the test's non-determinism rather than fix it, and the issue itself frames it as a
secondary/optional mitigation.
elastic_defend_integration_policyinstalls or configures the Elastic DefendFleet package policy — the suspected side effect (installing detection rules) is Kibana-server
behavior, not something the provider's Defend resource controls.
prepackaged/_findAPI wrappers ininternal/clients/kibanaoapi/prebuilt_rules.go— no evidence the wrappers themselves are wrong; the bug is confined to the acceptance-test
helper.
scope Defend's own side effects away from
default— not available as a documented mechanism on8.14–8.16, and orthogonal to isolating
prebuilt_rules's own test calls (Approach B).Quality gate
Outcome:
ready-for-change-factory- round 5 scored 95/85 with no actionable critic feedback; converged.Score: 95/100 (threshold 85) · Rounds used: 5
Unambiguous version-constraint contract for implementation: nothing in
internal/kibana/prebuilt_rulesbehaves differently across 8.14.3, 8.15.5, 8.16.6, or laterversions today (no
8.14/8.15/8.16references in that package), so no new version floor isneeded beyond what already exists. Concretely, the fix should: (1) keep the package's existing
minVersionPrebuiltRules = 8.0.0floor unchanged for all subtests; (2) apply the existingprebuiltRulesInSpaceConstraints(< 9.4.0 || >= 9.6.0-0, currently only onin_space) toboth custom-space table entries once
"default"is converted to use an isolated space underApproach B — i.e. the converted
"default"entry is no longer exempt, because the 9.4.x/9.5.xcustom-space install failure (
elastic/kibana#285497) is a property of installing into any newcustom space, not of the subtest's name; and (3) leave
TestAccResourcePrebuiltRulesDefaultSpaceIDuntouched, with no custom-space constraint, since it continues to target the real default space.
The 8.14.0 version gate that matters for the original issue (
minVersionElasticDefend = 8.14.0)belongs to the other package and is unaffected by either fix. Named acceptance probe to confirm
this gating strategy before merging: run the converted
"default"entry (with thein_space-styleconstraint applied) plus the existing
in_spaceentry on both a pre-9.4.0 and a 9.6.0+ stack toconfirm neither regresses, and run it once in a shard alongside
elastic_defend_integration_policyon 8.14.3, 8.15.5, and 8.16.6 per the regression outline above — this is the concrete check that
would surface if any unknown version-specific behavior (e.g. an undiscovered 8.17 Fleet-package
transition per the open question below) actually matters for this fix.
References
internal/kibana/prebuilt_rules/acc_test.go(lines 84-109, 122-192, 197-219, 276-344)internal/kibana/prebuilt_rules/models.go(lines 56-60)internal/clients/kibanaoapi/prebuilt_rules.go(lines 31-62)internal/clients/kibanautil/spaces.go(lines 27-49)internal/fleet/elastic_defend_integration_policy/common.go,create.go,acc_test.goscripts/targeted-testacc/classifier.go(lines 29-102)scripts/targeted-testacc/selector.go(lines 32-121)Makefile(line 136)openspec/specs/makefile-workflows/spec.md(lines 182, 189)internal/kibana/security_detection_rule/acc_test.go(lines 2182-2303)internal/kibana/security_detection_rule/testdata/TestAccResourceSecurityDetectionRule_QueryMinimalWithSpace/create/security_detection_rule.tf(lines 13-20)internal/apm/source_map/testdata/TestAccResourceApmSourceMap_space/main.tf(lines 20-23, 32)internal/kibana/securitylistitem/acc_test.go(lines 31-32, 168-169)generated/kbapi/kibana.gen.go(FindRules/ReadRule/DeleteRule/prepackaged operations)generated/kbapi/oas.yaml(FindRules, prepackaged install/status schemas)internal/kibana/prebuilt_rules/resource.go(lines 60-101)internal/clients/kibanaoapi/security_enable_rule.go(lines 71-96)🤖 Pipeline metadata
{ "schema_version": "1.1", "recommendation": { "spine": "isolated-space-plus-deterministic-selection", "confidence": "medium", "approach_index": 1 }, "open_questions": [ { "id": "defend-causes-epr-rules-in-default", "text": "Does installing elastic_defend_integration_policy on 8.14-8.16 actually install security_detection_engine prebuilt rules into the default space?", "blocking": false }, { "id": "stable-bundled-rule-id", "text": "Is there a bundled prebuilt rule_id guaranteed present across 8.14.3/8.15.5/8.16.6 for Approach A to hard-code?", "blocking": false }, { "id": "immutable-discriminates-epr-vs-bundled", "text": "Do immutable/rule_source distinguish bundled prebuilt rules from EPR/Fleet-package-installed prebuilt rules?", "blocking": false }, { "id": "status-dedupe-mechanism", "text": "Does _status rules_not_installed truly stay unchanged when a non-bundled rule is deleted, confirming the proposed root cause?", "blocking": false } ], "affected_capabilities": [], "estimated_scope": "small", "references": [ { "type": "repo-path", "path": "internal/kibana/prebuilt_rules/acc_test.go" }, { "type": "repo-path", "path": "internal/clients/kibanaoapi/prebuilt_rules.go" }, { "type": "repo-path", "path": "internal/clients/kibanautil/spaces.go" }, { "type": "repo-path", "path": "internal/fleet/elastic_defend_integration_policy" }, { "type": "repo-path", "path": "scripts/targeted-testacc/classifier.go" }, { "type": "repo-path", "path": "scripts/targeted-testacc/selector.go" }, { "type": "repo-path", "path": "Makefile" }, { "type": "repo-path", "path": "internal/kibana/security_detection_rule/acc_test.go" }, { "type": "repo-path", "path": "generated/kbapi/kibana.gen.go" }, { "type": "repo-path", "path": "internal/kibana/prebuilt_rules/resource.go" }, { "type": "repo-path", "path": "internal/clients/kibanaoapi/security_enable_rule.go" }, { "type": "elastic-docs", "url": "https://www.elastic.co/docs/solutions/security/configure-elastic-defend/install-elastic-defend" }, { "type": "elastic-docs", "url": "https://www.elastic.co/docs/api/kibana/operation/operation-installprebuiltrulesandtimelines" }, { "type": "elastic-docs", "url": "https://www.elastic.co/docs/api/kibana/operation/operation-readprebuiltrulesandtimelinesstatus" }, { "type": "elastic-docs", "url": "https://www.elastic.co/docs/solutions/security/get-started/spaces-elastic-security" }, { "type": "elastic-docs", "url": "https://www.elastic.co/docs/deploy-manage/manage-spaces-fleet" }, { "type": "issue", "url": "https://github.com/elastic/terraform-provider-elasticstack/issues/5541" } ], "gate": { "outcome": "ready-for-change-factory", "checklist": { "grounded": true, "mapped": true, "compatible": true, "versioned": true, "testable": true, "idiomatic": true }, "score": 95, "scores": [69, 80, 88, 48, 95], "converged": true, "rounds": 5, "outstanding_feedback": [], "author_model": "anthropic/claude-sonnet-5", "critic": { "model": "openai/gpt-6.1-sol", "status": "ok" } } }tehbooom commentedon Dec 1, 2026
/change-factory go with approach a and b.
Scope
defaultto an isolated space. In the fixture, wirespace_idviaelasticstack_kibana_space.test.space_id.prebuiltRulesInSpaceConstraintsto it.TestAccResourcePrebuiltRulesDefaultSpaceIDas is.deleteSingleDetectionRule, use a largeperPageand pick the firstimmutable == truerule. Fail withrequire.NotEmptyinstead of indexingData[0]._statusdelta:rules_not_installed+1,rules_installed−1, other counters unchanged.Out of scope: hard-coded
rule_id, a paginated-selector helper and its unit test, and shard planner changes.github-actions commentedon Dec 1, 2026
✅ Change Factory Issue Intake completed successfully!
Pull request created: #5542
Add OpenSpec proposal for prebuilt-rules default-space test isolation
Propose test isolation for TestAccResourcePrebuiltRules/default (elas…
Isolate TestAccResourcePrebuiltRules/default and drop 9.4/9.5 skips (e…