Commit 76743bf
authored
feat(scoped-sd): wire cleaned_* into merged_sd + Codex P2 fix (#789)
* test(scoped-sd): failing tests for cleaned_* scope + Codex P2 invalidation
Adds four tests pinning the deferred items on #785:
- ``test_cleaned_keys_appear_when_cleaning_active`` — clean scope SD
must be layered into ``merged_sd`` with a ``cleaned_*`` prefix when
cleaning ops are active.
- ``test_cleaning_only_does_not_emit_filtered_keys`` — the broken
``filter_active`` gate currently mislabels cleaning-affected stats
as ``filtered_*`` when no search filter is active. The right gate is
on chain-shape diff (``filt != clean``).
- ``test_filter_and_clean_both_emit_correctly`` — both scopes layered
without cross-talk; ``cleaned_null_count`` reflects the clean df,
``filtered_null_count`` reflects the search-nulled df.
- ``test_analysis_klasses_change_invalidates_scoped_sd`` — Codex P2
pin: a swap of ``analysis_klasses`` must invalidate the per-scope
SD cache so the new stat klass's keys surface in ``merged_sd``.
All four are expected to fail on this commit; fixes follow.
* feat(scoped-sd): wire cleaned_* into merged_sd + chain-shape gates + Codex P2
A. ``_merged_sd``: reads the clean scope's SD from the keyed cache and
layers ``cleaned_*`` keys between the raw bare keys and the
``filtered_*`` keys. Adds ``clean_sd_key`` to the observed set so the
observer fires after ``_populate_sd_cache`` has updated the pointer.
Replaces the broken ``filter_active = filt_sd_key != raw_sd_key``
gate (which fired whenever cleaning was active, mislabelling
cleaning-affected stats as ``filtered_*``) with chain-shape diffs:
chains = split_chain_by_scope(self.operations)
cleaning_active = chains['clean'] != chains['raw']
filter_active = chains['filt'] != chains['clean']
``filtered_*`` now only fires when the filt chain extends the clean
chain — i.e. a real quick-command op was added.
B. ``_scope_cache_key``: includes ``id(self.analysis_klasses)`` in the
``extra`` arg passed to ``hash_chain``. Pins Codex P2: a klass-list
swap with an unchanged op chain now produces a distinct cache key,
so the scope SD is recomputed against the new klasses.
The previously-failing ``test_cleaning_only_does_not_emit_filtered_keys``
(the gate-bug pin from the failing-tests commit) now passes naturally;
no test changes in this commit.1 parent 8c6210a commit 76743bf
2 files changed
Lines changed: 155 additions & 53 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
405 | 405 | | |
406 | 406 | | |
407 | 407 | | |
408 | | - | |
| 408 | + | |
409 | 409 | | |
410 | 410 | | |
411 | 411 | | |
412 | | - | |
413 | | - | |
414 | | - | |
415 | | - | |
416 | | - | |
417 | | - | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
418 | 419 | | |
419 | | - | |
420 | | - | |
421 | | - | |
422 | | - | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
423 | 425 | | |
424 | 426 | | |
425 | 427 | | |
| |||
428 | 430 | | |
429 | 431 | | |
430 | 432 | | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
431 | 436 | | |
432 | 437 | | |
433 | 438 | | |
434 | 439 | | |
435 | | - | |
436 | | - | |
437 | | - | |
438 | | - | |
439 | | - | |
440 | | - | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
441 | 448 | | |
| 449 | + | |
442 | 450 | | |
443 | 451 | | |
444 | 452 | | |
| |||
451 | 459 | | |
452 | 460 | | |
453 | 461 | | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
454 | 469 | | |
455 | 470 | | |
456 | 471 | | |
| |||
505 | 520 | | |
506 | 521 | | |
507 | 522 | | |
508 | | - | |
509 | | - | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
510 | 526 | | |
511 | 527 | | |
512 | 528 | | |
| |||
515 | 531 | | |
516 | 532 | | |
517 | 533 | | |
518 | | - | |
519 | | - | |
520 | | - | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
521 | 537 | | |
522 | 538 | | |
523 | 539 | | |
524 | | - | |
| 540 | + | |
| 541 | + | |
525 | 542 | | |
526 | 543 | | |
527 | 544 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | 115 | | |
146 | 116 | | |
147 | 117 | | |
| |||
166 | 136 | | |
167 | 137 | | |
168 | 138 | | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 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 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
0 commit comments