Skip to content

Skip empty category cohorts and address XAI approval nits - #431

Merged
danielmawhirter merged 2 commits into
mainfrom
dm-xai-approval-followups
Nov 20, 2026
Merged

danielmawhirter merged 2 commits into
mainfrom
dm-xai-approval-followups

Conversation

@danielmawhirter

@danielmawhirter danielmawhirter commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Follow up on Aaron’s final approvals in #288 and #289: omit categorical columns with no populated cohorts so empty/missing multicategories and future-only timestamps cannot make the entire cohort artifact unreadable. Preserve healthy columns and strict reader validation. Also clarify the trainer comments and explanation documentation.

Review threads: cohort bug, trainer wording, documentation wording.

Change map

File-by-file change map.

Testing Done

  • 68 core producer/prediction-explanation tests passed; 57 public prediction-explanation tests passed.
  • Eight regression/control cases cover empty/missing multicategories, future-only timestamps, and a populated control with/without targets. Six cases fail without the fix.
  • Documentation reference check: 375 Markdown files passed.
  • Changed-file flake8 -j 1 and git diff --check passed.
  • CI-equivalent core ty checks passed after adding explicit result-type assertions to the regression test.
  • isort --check-only passes for the test file; both touched source files have existing import-format failures reproduced on pristine upstream/main. Their imports are unchanged; root CI excludes these files.
  • Existing CI failure: test_the_published_copy_matches_the_source detects stale published kumo-model-explanations skill copies inherited from Expose opt-in batch prediction XAI through the Python API #289. The source and generated skill files are unchanged by this PR; refreshing them is outside this follow-up’s approved scope.

Checklist

  • No breaking public API changes.
  • Updated the relevant documentation.
  • Added regression coverage.

@danielmawhirter
danielmawhirter temporarily deployed to gha-kumo-workflow-tests November 20, 2026 05:46 — with GitHub Actions Inactive
@coderabbitai

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

ColumnAnalysis.aggregate_category now returns None when all category counts are zero, before calculating predictions or targets. New parameterized tests cover empty, missing, future, and populated category values in prediction and validation stages. The trainer comment and explainability guide also update wording about the default cohort cap, explanation limit, prediction status, and sample membership.

Merge Risk: Minimal · up to bf75d

Categorical columns with no populated cohorts are now omitted instead of making the whole cohort artifact unreadable, and populated columns are unaffected. The earlier type-check concern in the new test is addressed. The only failing check is an inherited stale skill copy unrelated to this change.

Security architecture risk: Minimal · up to bf75d

Empty categories now use the existing omission behavior while populated categories retain their aggregation path. The inspected change introduces no material security, ownership, or failure-containment risk.

Pre-merge checks: Passed 2 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Change Map Design Review Inconclusive The check reviews the PR conversation comment that begins with <!-- kumo-pr-change-map -->. That comment is not in the checkout, and no tool here reads PR conversation comments. The PR description l… Make the <!-- kumo-pr-change-map --> conversation comment available to the reviewer, or add a retrieval capability for PR issue comments. Then rerun this check. The reviewer must confirm these points in the map: 1. The observed failure, f…
Passed Passed checks: 2 passed

Check name Status Explanation
Pr Size Passed The PR size check fails only when the changed-file count exceeds 40. I ran git diff --name-status over the review range (refs/coderabbit/pre-merge-check/base to refs/coderabbit/pre-merge-check/head)…
Public Resource Access Passed The check covers only external resource references whose text this PR adds or modifies. I listed the changed files from the review range (column_analysis.py, trainer.py, `test_producer_failures.py…
Full details: Pr Size

Explanation

The PR size check fails only when the changed-file count exceeds 40. I ran git diff --name-status over the review range (refs/coderabbit/pre-merge-check/base to refs/coderabbit/pre-merge-check/head). It lists 4 changed files, all modified (M), with no renames or additions: - packages/kumo-core/src/kumo_core/explain/column_analysis.py - packages/kumo-core/src/kumo_core/train/trainer.py - packages/kumo-core/tests/explain/test_producer_failures.py - packages/kumo-engine/explainability.md The count of 4 is well under 40, so no split recommendation applies. Line counts are ignored by this check.

Full details: Public Resource Access

Explanation

The check covers only external resource references whose text this PR adds or modifies. I listed the changed files from the review range (column_analysis.py, trainer.py, test_producer_failures.py, explainability.md) and scanned the full patch (150 lines). The added and removed lines contain no URLs, git or package source locations, registry references, or Markdown links. The GitHub links in the PR description are not part of the repository diff and are outside this check's scope. With no added or modified external resource reference, the check passes.

Full details: Change Map Design Review

Explanation

The check reviews the PR conversation comment that begins with &lt;!-- kumo-pr-change-map --&gt;. That comment is not in the checkout, and no tool here reads PR conversation comments. The PR description links to it (issuecomment-7031625526), but that link was not retrieved. The only match for the marker in the repository is in docs/development/review.md, which describes the required process and does not contain the map. Without the Change map text, I cannot check its necessity claims, abstraction-layer choices, stated failure or release requirement, rejected alternatives, verification scope, or stopping condition. Partial code evidence from the review range refs/coderabbit/pre-merge-check/base..head (2 commits, 4 files): - column_analysis.py adds an early return None when count &gt; 0 has no True values. It moves the positive-count mask above the weighted division. The later filter reuses that mask. This is a small change. The map's accuracy about it could not be checked. - trainer.py changes only a docstring and a comment. The code is unchanged. Its wording is "Default cohort cap in whole batches, at least the selection budget." The implementation was not compared with that wording. - The test file and the explanation Markdown were not used as design evidence for the map. I found no proven code defect in this review. The verdict is not a PASS, because the design review cannot be completed without the map. It is not a FAIL, because no explicit failure condition was shown.

Resolution

Make the &lt;!-- kumo-pr-change-map --&gt; conversation comment available to the reviewer, or add a retrieval capability for PR issue comments. Then rerun this check. The reviewer must confirm these points in the map: 1. The observed failure, for example the unreadable cohort artifact from empty or future-only columns, and the requirement that drives each change. 2. Why returning None from ColumnAnalysis.aggregate_category is the right layer. Compare it with the existing reader and omission contract. 3. Whether the new regression tests fail without the fix. The description reports six of eight failing without it. 4. Whether the trainer and documentation edits are optional refinements that the map keeps separate from the fix. 5. Any material behavior the map omits, such as the effect on healthy columns and on strict reader validation.

Finishing Touches

Fix failing CI checks

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 784e49b and bf75d84.

Files selected for processing: 1

  • packages/kumo-core/tests/explain/test_producer_failures.py

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 10 remain after this review.

@danielmawhirter

danielmawhirter commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator Author

Change map

Empty/missing multicategories or future-only timestamps could produce a column with no cohort labels. The strict reader then rejected the entire artifact, including healthy columns. This follow-up uses the existing None omission contract; reader validation stays strict.

File Function / scope What changed Why
packages/kumo-core/src/kumo_core/explain/column_analysis.py ColumnAnalysis.aggregate_category Return None when no category has a positive population, before weighted division; reuse the positive mask. Omit only the unusable column and preserve healthy cohorts in training and prediction.
packages/kumo-core/tests/explain/test_producer_failures.py test_empty_categories_preserve_cohorts Exercise empty/missing multicategories, future-only timestamps, and a populated control in PRED and VAL; round-trip JSON, assert result types, and verify healthy values survive. Six cases reproduce the bug without the fix; controls cover unchanged populated behavior and targets. Explicit assertions satisfy static checking.
packages/kumo-core/src/kumo_core/train/trainer.py Trainer._explain_prediction comments/docstring Lowercase “first” and describe the default cohort cap directly. Address Aaron’s final-approval wording nit in #288.
packages/kumo-engine/explainability.md Prediction limits and saved explanation status Describe omitted limits and saved sample membership directly. Address Aaron’s final-approval documentation nit in #289.

Verification: 68 core tests and 57 public-reader tests passed; documentation reference validation passed for 375 Markdown files; changed-file flake8 and whitespace checks passed. Direct isort passes for the test; both source files reproduce existing import-format errors on pristine upstream/main (imports untouched and excluded by root CI).

The signed follow-up commit adds two type-narrowing assertions after CI caught optional/union accesses in the new test. Producer tests (29), test-file flake8/isort, and the CI-equivalent core ty check pass afterward.

Unresolved inherited CI failure: test_the_published_copy_matches_the_source reports stale skills/kumo-model-explanations/SKILL.md and skills/kumo-model-explanations/references/artifacts.md from #289. This branch changes neither authored nor published skills. A publisher refresh would repair that baseline drift; it is outside the approved three-thread scope.

Stopping condition: all three deferred final-approval threads are addressed, empty columns are omitted without discarding healthy columns, and populated behavior remains covered. Broader aggregation/import-format cleanup is outside this PR.

@danielmawhirter
danielmawhirter temporarily deployed to gha-kumo-workflow-tests November 20, 2026 05:48 — with GitHub Actions Inactive

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between b58c6c2 and 784e49b.

Files selected for processing: 4

  • packages/kumo-core/src/kumo_core/explain/column_analysis.py
  • packages/kumo-core/src/kumo_core/train/trainer.py
  • packages/kumo-core/tests/explain/test_producer_failures.py
  • packages/kumo-engine/explainability.md

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.

@danielmawhirter
danielmawhirter merged commit 804ea96 into main Nov 20, 2026
129 of 131 checks passed
@danielmawhirter
danielmawhirter deleted the dm-xai-approval-followups branch November 20, 2026 17:24

This branch was previously deployed

1 inactive deployment
gha-kumo-workflow-tests — bf75d843 Deployed Nov 20, 2026 by danielmawhirter via import #2757
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants