feat(scoped-sd): wire cleaned_* into merged_sd + Codex P2 fix#789
Merged
Conversation
0e6f72d to
ea865c6
Compare
This was referenced May 21, 2026
…ation 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.
…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.
ea865c6 to
8faea19
Compare
Contributor
📦 TestPyPI package publishedpip install --index-strategy unsafe-best-match --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ buckaroo==0.14.3.dev26249360817or with uv: uv pip install --index-strategy unsafe-best-match --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ buckaroo==0.14.3.dev26249360817MCP server for Claude Codeclaude mcp add buckaroo-table -- uvx --from "buckaroo[mcp]==0.14.3.dev26249360817" --index-strategy unsafe-best-match --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ buckaroo-table📖 Docs preview🎨 Storybook preview |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #785. Wires the
cleaned_*scope intomerged_sd, fixes thebroken
filter_activegate (which was on key-inequality and mislabelledcleaning-affected stats as filtered), and applies Codex's P2 fix so
mutating
analysis_klassesinvalidates the scope cache.Changes
_merged_sdgates on chain-shape:cleaning_active = chains['clean'] != chains['raw'],filter_active = chains['filt'] != chains['clean']. Layerscleaned_*keys between raw bare keys andfiltered_*._scope_cache_keyincludesanalysis_klassesidentity in theextraarg. A klasses swap now invalidates cached scope SDs.Tests
cleaned_*emission, the cleaning-only no-filtered_*gate, both-scopes-present, andanalysis_klassescache-key invalidation.test_cleaning_only_does_not_emit_filtered_keys(the gate-bug pin from the failing-tests commit) now passes naturally.Closes the deferred items documented in
plans/0785-cleaning-scope-known-issues.mdandplans/0785-codex-p2-analysis-klasses.md.The
analysis_klassestest is asserted at the_scope_cache_keylevel rather than end-to-end throughmerged_sdbecauseanalysis_klassesis currently a plain class attribute (not a traitlet) onDataFlow— setting it on the instance doesn't fire the@observe('analysis_klasses')callbacks. The cache-key contract is the load-bearing invariant; makinganalysis_klassesobservable is an unrelated architectural change.[Claude Code]