Commit e316f12
committed
fix(live): bind "X / Y nodes tested" denominator to run total, not per-batch snapshot
The "X / Y nodes tested" headline (and the lsTested / Network Nodes tiles)
sourced their denominator from _cb.snapshotSize, the PER-BATCH count. On a
resumed batch the server emits batch:start with snapshotSize = remaining-
untested nodes only (continuous.js), while the cumulative tested count (X =
deduped resultsArr.length, including pre-resume rows replayed on init) needs
the FULL run total. Result after stop->resume: Y showed the previous run's
total and only caught up once the next full batch:start landed.
Root cause: the denominator was bound to the wrong scope. The authoritative
full-sweep total is state.totalNodes (maintained across resume by pipeline.js
and broadcast immediately via the state event). Three callers (cbRender,
renderLiveStats, applyHeaderStatsFromState) computed the denominator
independently with divergent priority.
Fix:
- live.html: add runTotalNodes() — single source of truth preferring
_liveState.totalNodes, then _cb.snapshotSize, then resultsArr.length. Route
all three callers through it.
- pipeline.js: zero state.totalNodes in the fresh-run (non-resume) reset so the
pre-scan state broadcasts no longer carry the prior run's total (which the
new denominator priority would otherwise flash as a wrong "Y" until the scan
completes). Falls back to "—" until the sweep size is known.
- live.html: defense-in-depth — resetLiveForNewRun() clears _liveState.totalNodes
so the run-number-change path cannot carry the old total before mergeLiveState.
Resume path unchanged. Tests 188/31/45/35 pass; inline scripts parse clean.1 parent 6935557 commit e316f12
2 files changed
Lines changed: 44 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
632 | 632 | | |
633 | 633 | | |
634 | 634 | | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
635 | 643 | | |
636 | 644 | | |
637 | 645 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1606 | 1606 | | |
1607 | 1607 | | |
1608 | 1608 | | |
| 1609 | + | |
| 1610 | + | |
| 1611 | + | |
| 1612 | + | |
| 1613 | + | |
| 1614 | + | |
| 1615 | + | |
| 1616 | + | |
| 1617 | + | |
| 1618 | + | |
| 1619 | + | |
| 1620 | + | |
| 1621 | + | |
| 1622 | + | |
| 1623 | + | |
| 1624 | + | |
| 1625 | + | |
| 1626 | + | |
| 1627 | + | |
| 1628 | + | |
| 1629 | + | |
| 1630 | + | |
1609 | 1631 | | |
1610 | | - | |
| 1632 | + | |
1611 | 1633 | | |
1612 | 1634 | | |
1613 | 1635 | | |
| |||
1685 | 1707 | | |
1686 | 1708 | | |
1687 | 1709 | | |
1688 | | - | |
1689 | | - | |
1690 | | - | |
1691 | | - | |
1692 | | - | |
1693 | | - | |
| 1710 | + | |
| 1711 | + | |
| 1712 | + | |
| 1713 | + | |
| 1714 | + | |
1694 | 1715 | | |
1695 | 1716 | | |
1696 | 1717 | | |
| |||
1939 | 1960 | | |
1940 | 1961 | | |
1941 | 1962 | | |
1942 | | - | |
1943 | | - | |
1944 | | - | |
1945 | | - | |
1946 | | - | |
1947 | | - | |
| 1963 | + | |
| 1964 | + | |
| 1965 | + | |
1948 | 1966 | | |
1949 | 1967 | | |
1950 | 1968 | | |
| |||
2071 | 2089 | | |
2072 | 2090 | | |
2073 | 2091 | | |
| 2092 | + | |
| 2093 | + | |
| 2094 | + | |
| 2095 | + | |
| 2096 | + | |
2074 | 2097 | | |
2075 | 2098 | | |
2076 | 2099 | | |
| |||
0 commit comments