Skip to content

fix(dashboard): numbers that add up: one Bayesian denominator, pure label helpers (slice 67D, first bundle) - #269

Merged
neomatrix369 merged 14 commits into
mainfrom
slice/67d-explainable-cards
Nov 5, 2026
Merged

neomatrix369 merged 14 commits into
mainfrom
slice/67d-explainable-cards

Conversation

@neomatrix369

@neomatrix369 neomatrix369 commented Nov 5, 2026 •

Copy link
Copy Markdown
Owner

What and why

Slice 67D, first bundle (D-1, D-2, D-3 plus Detail-screen wiring and finding F), shipped as one PR by owner decision. Several dashboard numbers disagreed with each other or were wrong; this makes them agree and says how they were reached. Tips and formula lines on every inventory row, the glossary and the Explorer planned total are not in this PR (see "Not in this PR").

  • Bayesian "not started" counted once (finding D): the list screen subtracted attempted and discarded trials from a value the backend had already reduced, so "5 not started" showed as 0. One pure helper, bayesianNotStartedCount, is used by the list and the Detail screen.
  • Progress and ETA (finding E): failed and interrupted runs count as finished work for the ring and the ETA, with clamps (ring at most 100%, remaining runs at least 0). The clock is an injected now; the fixed rule text is shown while a failed or interrupted run exists in a running sweep.
  • Compare, Walkthru and stats labels (finding G): "Only run in this group" instead of a misleading 100.0 (group size is taken from the unfiltered groups, which also fixed a real bug where a store filter produced a false lone-run claim); a score note (best single chunk, not an average); a dedup note; "est." with the formula (average dimensions) and a scope label on the stats panels; a baseline note on the Walkthru improvement panel. A Python contract test fails if the formula's byte constants drift from stats_common.py.
  • One denominator for Bayesian sweeps (finding F): detailDenominator() feeds the Total tile, ring, subtitle, totals line, "Planned Bayesian Trials", the N/grid trials header and every arm of the sweep-overview sentence. This fixed a real divergence: the Total tile read run_count (25) while the totals line read planned_trials (20). The totals line reads "Total 20 = 13 attempted + 4 discarded + 3 not started" and says so when the parts disagree. Grid sweeps are unchanged (the 67A header = Total rule still holds).
  • Determinism guard widened (owner rule): regexes in deterministicNumbers.patterns.ts with a positive-control test; new Date tokens are counted per pure module against a per-file allowance (one, in parseSafeTimestamp); the new pure modules and ProgressSubtitle are on the lists; inline counts moved to selectableExperimentIds and components/explore/scoreCounts.ts.

Verification

  • ./scripts/ci/quality-gates.sh: all gates passed on the final commit (1295 backend tests, 570 frontend tests, coverage above the floors, npm audit 0, pip-audit clean).
  • Mutation proofs: each of the Bayesian denominator sites (Total tile, ring, subtitle, totals line, planned trials, header and each arm of the overview sentence) and the lone-run fix was reverted independently and a test failed every time.
  • Real browser at 1280 px and 390 px (own dev server; API responses stubbed for the Bayesian fixtures, real data for the rest): Bayesian partial fixture (25 / 20) shows 20 everywhere; running fixture (12 / 10 with a failed and an interrupted run) shows ring 40%, "4 of 10 runs finished" and the rule text readable at 390 px; Compare store filter keeps numeric scores; a real grid sweep still shows 120 configurations equal to the Total tile; no sideways overflow.
  • Reviews: code quality (APPROVED, three rounds) and acceptance coverage (three rounds). The last acceptance blocker, that the sweep-overview sentence still divided by run_count, was fixed with per-arm mutation proof but was not re-reviewed by the acceptance reviewer.

Notes for the reviewer

  • Assertions changed: only two regexes (chunks × dimensions became chunks × average dimensions), the intended wording change.
  • Known and accepted: the list screen's "N runs configured" and run-count cell still print run_count for Bayesian rows (at creation it equals the capped planned trials, and changing it would break existing assertions); formatDuration prints a NaN-derived string for an invalid timestamp (unchanged).
  • Spec, PROGRESS, CHANGELOG, GROWTH, DECISIONS #312 and Key Files are updated. No attribution trailers.

Not in this PR

Tips and formula lines on every inventory row, the UI glossary, the Explorer planned total from sweep_plan (and removing observedTotal), the backend duplicates_collapsed count, and the Query Results breakdown (slice 67E: backend branch reviewed, frontend after this PR).

Complexity

Automatically refreshed by CI for product-code changes.

Scope Tool Result
Python Radon highest CC 40 (rank E), 897 blocks
JS/TS ESLint 18 function(s) above CC 10
JS/TS ESLint sonarjs 7 function(s) above cognitive 15
Functions above the JavaScript threshold
  • ExperimentDetailScreen.tsx:53 — CC 118
  • SearchExplorerScreen.tsx:35 — CC 38
  • ExplorePanels.tsx:415 — CC 29
  • LoadingFeedbackPanel.tsx:41 — CC 28
  • labels.ts:36 — CC 25
  • ExperimentsScreen.tsx:64 — CC 21
  • VectorDbStatsPanel.tsx:84 — CC 18
  • ExperimentControlButtons.tsx:54 — CC 14
  • loadWalkthruResults.ts:37 — CC 14
  • ExperimentsScreen.tsx:465 — CC 13
Functions above the cognitive-complexity threshold
  • ExperimentDetailScreen.tsx:53 — cognitive 60
  • LoadingFeedbackPanel.tsx:41 — cognitive 27
  • labels.ts:36 — cognitive 25
  • ExplorePanels.tsx:415 — cognitive 23
  • markdown.ts:59 — cognitive 20
  • SearchExplorerScreen.tsx:35 — cognitive 17
  • steps.ts:63 — cognitive 16

The list subtracted attempted and discarded trials from a backend not_started that already excluded them, under-reporting the remainder. One shared pure helper now owns the subtraction so the detail screen can adopt it.
…ress and ETA

Failed and interrupted runs never complete later, so leaving them out
stalled the ring and inflated the ETA. The rule is one fixed string
(FINISHED_RUN_RULE) beside pure functions; the clock is injected via now.
… dedup, est., scope, baseline)

Plain-text labels from pure helpers so every explanation is deterministic.
…the detail screen

Detail now uses bayesianNotStartedCount, passes failed and interrupted to the
progress subtitle, takes the ring percent from calculateProgressPercent, and
shows a fixed-template line so Bayesian Total = attempted + discarded +
not started with Discarded listed apart from runs.
…violations it finds

The guard now covers the status, progress, score-label and estimate-label
modules and flags filter().length and / x * 100 in the list, detail and
explorer screens. Inline counts move into selectableExperimentIds and
countConfigsAtScore.
The regexes live in one module so a control can assert they match the exact
expressions slice 67D removed and that a parse of a given date stays allowed.
… from planned trials

ProgressSubtitle no longer reads the clock or builds its sentence inline
(progressSentence in experimentDetailProgress, now passed by the screen), and
joins the determinism guard. For Bayesian sweeps the Total tile now reads
planned_trials like the totals line; it showed run_count and disagreed when the
two differ. Tests assert every card against the line, forward started_at with a
fixed clock, and cover the partial-Bayesian list label call site.
… line, keep date parsing to one helper

Remaining runs and the ring percent are clamped so an under-reported run_count
cannot give a negative ETA or more than 100 percent. The Bayesian totals line
annotates in-progress runs inside attempted. countConfigsAtScore moves to an
explore-scoped pure module, and the guard now forbids every clock read in pure
modules and allows one counted date-parse helper.
…n detail screen

The Total tile, ring percent, subtitle, totals line, Planned Bayesian Trials
item and Bayesian Summary header all read detailDenominator; they showed
run_count in some places and planned_trials in others when the two differ.
Tests use run_count 12 / planned_trials 10 and 25 / 20.
… the finished-run rule

A multi-run group filtered to one store row showed 'Only run in this group';
group size now comes from the unfiltered groups. ProgressSubtitle renders
FINISHED_RUN_RULE when failed or interrupted runs exist (the vacuous self-equality
test is gone), and a contract test pins the estimate constants to the server's.
…lanned-trials denominator

The sweep overview (running, paused, cancelled, complete and fallback arms) and
the terminal and cancellation notes used run_count while the tiles used
planned_trials. The totals line now says when attempted_trials disagrees with the
loaded run rows, the lone-run group size has no fallback, and the estimate wording
names average dimensions.
…12, key files, progress

Records the first 67D bundle: the one-denominator rule for Bayesian sweeps, the
pure label helpers, the widened determinism guard and what is still open.
@neomatrix369
neomatrix369 merged commit c307a8e into main Nov 5, 2026
7 checks passed
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.

1 participant