Skip to content

ref: handle zero-work window-union reports - #663

Merged
juliankang4 merged 1 commit into
midagedev:mainfrom
Burntgogi:fix/issue656-zero-host
Oct 22, 2026
Merged

juliankang4 merged 1 commit into
midagedev:mainfrom
Burntgogi:fix/issue656-zero-host

Conversation

@Burntgogi

Copy link
Copy Markdown
Contributor

Problem

A valid placement with no selected host experts reaches 0 / 0 in the predicted-ratio column. A valid window size that fits no chunk also divides by zero in slots/window, even with positive predicted host work.

Change

  • Keep the existing undefined-ratio convention: nan, not a fabricated ratio of zero.
  • Keep actual zero work at 0.0; report undefined measured means as nan when no complete window exists.
  • Add numeric report regressions for zero-host windows, empty windows, and pooling zero-work and positive-work sets.
  • Document these boundaries in the tool's reference header.

No placement/parser changes; this is independent of #659.

Verification

  • New report regression failed before the fix with ZeroDivisionError; python3 tools/ref/window-union.py --self-test passes afterward.
  • Actual CLI: the issue's full-card placement, only selected experts resident, full-card strata, and empty-window cases with/without predicted host work all exit 0.
  • Four positive-work CLI reports are unchanged before/after, including a placement with one idle layer and a strata placement.
  • LC_ALL=C bash tools/contrib-check.sh --tier t0 --only '^(fmt|check-recipes|check-comments|check-arch|check-levers)$': 5 checks, 0 red (160 s).

CPU tooling only; no GPU/model validation claimed. Local just pre-review is unavailable because the Claude CLI is not installed.

Closes #656.

@github-actions github-actions Bot added the tools Tools, recipes, CI and the toolchain: tools/, justfile, .github/, Cargo label Oct 22, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Verdict: CLEAN: Both report divisions handle zero denominators, and the regression assertions distinguish undefined measurements from zero work.

Checked

Duplicates: 0 new functions, types or constants; manual search found no new duplicate owner.
Complexity: report gains two guards for independent denominators.
Silent failure: 2 guarded divisions followed to printed columns; undefined values print nan, while measured zero work remains zero.
Tests: the new report assertions pass with in-memory router sets and fail on the base with ZeroDivisionError. Removing either guard at tools/ref/window-union.py:246 and tools/ref/window-union.py:247 raises ZeroDivisionError; replacing either nan fallback with zero fails an assertion.
Boundaries: full-card and selected-only residency, empty windows and mixed-set pooling checked; three positive-work reports match the base output.
Gates: no existing pins or assertions relaxed; the PR reports FAIL-first evidence for the regression.
Escape catalog: no patterns matched.

Notes

No Rust file changed; dryer and crapper did not run.
Validation used in-memory router sets; the full self-test was not rerun.

🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)

@juliankang4
juliankang4 merged commit f70d923 into midagedev:main Oct 22, 2026
6 checks passed
@juliankang4

Copy link
Copy Markdown
Collaborator

@Burntgogi Thanks for the contribution. The review is done, so I'm merging this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tools Tools, recipes, CI and the toolchain: tools/, justfile, .github/, Cargo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

window-union: a valid placement with no host selections divides by zero

2 participants