Commit 448345b
committed
fix(eta): server-authoritative windowed-throughput ETA, consistent across admin + live
admin.html (updateETA) and live.html (cbRender) each computed ETA
independently from different inputs (run-start vs batch-start timestamp;
status counters vs deduped result rows), so they disagreed. The server now
owns one ETA and broadcasts it; both pages just render the same value.
server.js:
- computeEtaFinishAt(st): windowed real-throughput estimate. Keeps a rolling
window (ETA_WINDOW=12) of node-completion epochs, derives rate (nodes/ms)
from the first/last span, and returns an absolute finish epoch
Date.now() + remaining/rate. Null unless status==='running' with >=2
completions and total>0; Date.now() (finish-now) when remaining<=0.
- broadcast(): on 'result' record the completion FIRST (so the just-finished
node is in the window), detect a new pass via counter reset, then stamp
data.state.etaFinishAtMs onto any state payload (covers both 'state' and
direct-pipeline 'result' broadcasts).
- /api/events init frame computes etaFinishAtMs so a fresh admin isn't blank.
- etaFinishAtMs added to PUBLIC_STATE_KEYS so /live receives it.
admin.html + live.html: ETA is now a per-second countdown to
state.etaFinishAtMs (HH:MM:SS), replacing the divergent elapsed/tested math.
live.html gets a dedicated 1s ETA ticker (gated on _cb.startedAt so it freezes
on stop/done).
test/eta-estimate.test.js: vm-extracts the real computeEtaFinishAt and asserts
the null guards, finish-now path, first/last-span window math (rate 1/sec,
remaining 20 -> ~20000ms), and that PUBLIC_STATE_KEYS carries etaFinishAtMs.
public-sse-fields.test.js updated for the new 11-key allowlist. Full suite 0.1 parent 1bde963 commit 448345b
6 files changed
Lines changed: 248 additions & 69 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1488 | 1488 | | |
1489 | 1489 | | |
1490 | 1490 | | |
| 1491 | + | |
| 1492 | + | |
| 1493 | + | |
| 1494 | + | |
1491 | 1495 | | |
1492 | | - | |
1493 | | - | |
1494 | | - | |
1495 | | - | |
1496 | | - | |
1497 | | - | |
1498 | | - | |
1499 | | - | |
| 1496 | + | |
| 1497 | + | |
| 1498 | + | |
| 1499 | + | |
| 1500 | + | |
| 1501 | + | |
1500 | 1502 | | |
1501 | | - | |
1502 | | - | |
| 1503 | + | |
1503 | 1504 | | |
1504 | | - | |
1505 | | - | |
1506 | | - | |
1507 | | - | |
1508 | | - | |
1509 | | - | |
1510 | 1505 | | |
1511 | 1506 | | |
1512 | 1507 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1718 | 1718 | | |
1719 | 1719 | | |
1720 | 1720 | | |
1721 | | - | |
1722 | | - | |
1723 | | - | |
1724 | | - | |
1725 | | - | |
1726 | | - | |
1727 | | - | |
1728 | | - | |
| 1721 | + | |
| 1722 | + | |
| 1723 | + | |
| 1724 | + | |
| 1725 | + | |
| 1726 | + | |
| 1727 | + | |
| 1728 | + | |
| 1729 | + | |
| 1730 | + | |
| 1731 | + | |
1729 | 1732 | | |
1730 | | - | |
1731 | | - | |
1732 | 1733 | | |
1733 | 1734 | | |
1734 | 1735 | | |
| |||
1885 | 1886 | | |
1886 | 1887 | | |
1887 | 1888 | | |
1888 | | - | |
1889 | 1889 | | |
1890 | 1890 | | |
1891 | 1891 | | |
1892 | 1892 | | |
1893 | | - | |
1894 | | - | |
1895 | | - | |
1896 | | - | |
1897 | | - | |
1898 | | - | |
1899 | | - | |
1900 | | - | |
1901 | | - | |
1902 | | - | |
1903 | | - | |
1904 | | - | |
1905 | | - | |
1906 | | - | |
1907 | | - | |
1908 | | - | |
| 1893 | + | |
| 1894 | + | |
| 1895 | + | |
| 1896 | + | |
| 1897 | + | |
1909 | 1898 | | |
1910 | | - | |
1911 | | - | |
1912 | | - | |
1913 | | - | |
1914 | | - | |
1915 | | - | |
1916 | | - | |
1917 | | - | |
1918 | | - | |
1919 | | - | |
1920 | | - | |
1921 | | - | |
1922 | | - | |
1923 | | - | |
1924 | | - | |
1925 | | - | |
1926 | | - | |
1927 | | - | |
1928 | | - | |
1929 | | - | |
| 1899 | + | |
1930 | 1900 | | |
1931 | 1901 | | |
1932 | 1902 | | |
| |||
2477 | 2447 | | |
2478 | 2448 | | |
2479 | 2449 | | |
2480 | | - | |
| 2450 | + | |
| 2451 | + | |
| 2452 | + | |
2481 | 2453 | | |
2482 | 2454 | | |
2483 | 2455 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
| 41 | + | |
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
348 | 348 | | |
349 | 349 | | |
350 | 350 | | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
351 | 381 | | |
352 | 382 | | |
353 | 383 | | |
| |||
364 | 394 | | |
365 | 395 | | |
366 | 396 | | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
367 | 421 | | |
368 | 422 | | |
369 | 423 | | |
| |||
1900 | 1954 | | |
1901 | 1955 | | |
1902 | 1956 | | |
| 1957 | + | |
| 1958 | + | |
| 1959 | + | |
1903 | 1960 | | |
1904 | 1961 | | |
1905 | 1962 | | |
| 1963 | + | |
1906 | 1964 | | |
1907 | 1965 | | |
1908 | 1966 | | |
| |||
2316 | 2374 | | |
2317 | 2375 | | |
2318 | 2376 | | |
| 2377 | + | |
| 2378 | + | |
| 2379 | + | |
| 2380 | + | |
2319 | 2381 | | |
2320 | 2382 | | |
2321 | 2383 | | |
| |||
0 commit comments