Commit 4f9f40f
fix(cases-analytics-v2): gate cases-templates SO references behind templates.enabled
`xpack.cases.templates.enabled` defaults to false. When it's off, the
`cases-templates` SO type is not registered with core (see
saved_object_types/index.ts). The v2 internal repository was naming
`CASE_TEMPLATE_SAVED_OBJECT` unconditionally whenever v2 was on, so
`createInternalRepository` threw "Missing mappings for saved objects
types: 'cases-templates'" on boot and Kibana never came up. This is
the exact failure mode `config_analytics_v2.ts` (FTR config with v2
on / templates off) triggers, and the latent production crash for
any customer enabling v2 without templates.
Mirrors the cases-attachments gating pattern from PR3:
- plugin.ts: pass templatesEnabled to CasesAnalyticsV2Service and
conditionally spread CASE_TEMPLATE_SAVED_OBJECT into the v2 internal
repository via the same flag. Comment block on the repo opt-in
expanded to document the gate.
- cases_analytics_v2/service.ts: thread templatesEnabled through to
CasesAnalyticsV2DataViewService at start.
- cases_analytics_v2/data_view/service.ts: collectSnakeKeysForSpace
short-circuits to [] when templatesEnabled is false. Per-space data
views still bootstrap, with an empty runtime field overlay — the
correct shape when there are no templates to project.
- service.test.ts / data_view/service.test.ts: fixture updates plus a
new regression test asserting the internal SO client is never
queried for cases-templates when the flag is off.
Co-authored-by: Cursor <cursoragent@cursor.com>1 parent 0716d5d commit 4f9f40f
5 files changed
Lines changed: 93 additions & 4 deletions
File tree
Lines changed: 35 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
39 | 42 | | |
40 | 43 | | |
41 | 44 | | |
| |||
47 | 50 | | |
48 | 51 | | |
49 | 52 | | |
| 53 | + | |
50 | 54 | | |
51 | 55 | | |
52 | 56 | | |
| |||
145 | 149 | | |
146 | 150 | | |
147 | 151 | | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
148 | 181 | | |
149 | 182 | | |
150 | 183 | | |
| |||
490 | 523 | | |
491 | 524 | | |
492 | 525 | | |
| 526 | + | |
493 | 527 | | |
494 | 528 | | |
495 | 529 | | |
| |||
Lines changed: 20 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
| 61 | + | |
| 62 | + | |
62 | 63 | | |
63 | 64 | | |
64 | 65 | | |
65 | 66 | | |
66 | 67 | | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
67 | 79 | | |
68 | 80 | | |
69 | 81 | | |
| |||
427 | 439 | | |
428 | 440 | | |
429 | 441 | | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
430 | 449 | | |
431 | 450 | | |
432 | 451 | | |
| |||
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| |||
56 | 57 | | |
57 | 58 | | |
58 | 59 | | |
| 60 | + | |
59 | 61 | | |
60 | 62 | | |
61 | 63 | | |
| |||
72 | 74 | | |
73 | 75 | | |
74 | 76 | | |
| 77 | + | |
75 | 78 | | |
76 | 79 | | |
77 | 80 | | |
| |||
Lines changed: 15 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
69 | 81 | | |
70 | 82 | | |
71 | 83 | | |
| |||
138 | 150 | | |
139 | 151 | | |
140 | 152 | | |
| 153 | + | |
141 | 154 | | |
142 | 155 | | |
143 | 156 | | |
| |||
209 | 222 | | |
210 | 223 | | |
211 | 224 | | |
| 225 | + | |
212 | 226 | | |
213 | 227 | | |
214 | 228 | | |
| |||
368 | 382 | | |
369 | 383 | | |
370 | 384 | | |
| 385 | + | |
371 | 386 | | |
372 | 387 | | |
373 | 388 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
163 | 173 | | |
164 | 174 | | |
165 | 175 | | |
| |||
344 | 354 | | |
345 | 355 | | |
346 | 356 | | |
347 | | - | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
348 | 366 | | |
349 | 367 | | |
350 | 368 | | |
| |||
358 | 376 | | |
359 | 377 | | |
360 | 378 | | |
361 | | - | |
| 379 | + | |
362 | 380 | | |
363 | 381 | | |
364 | 382 | | |
| |||
0 commit comments