Quiet the ordering trace behind pf_debug

It works now — inputs carrying a bucket_order and three seq values, both
expressions applied — so the console does not need narrating, least of all
during a demo.

Kept rather than deleted, gated like the depth tracing: the failure it
diagnosed (running before its inputs existed, then reporting nothing) is the
kind that recurs, and rebuilding this each time is wasted work. The
initViewer scaffolding goes, having served its purpose.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Paul Trowbridge 2026-09-17 14:47:38 -04:00
parent 424199c1aa
commit e7c266a871

View File

@ -698,9 +698,8 @@ export default function Forecast({ sources = [], sourceId, versions = [], versio
}
async function initViewer(vid, sid) {
dbgOrder('initViewer start', { vid, sid, hasViewer: !!viewerRef.current })
const viewer = viewerRef.current
if (!viewer) return dbgOrder('initViewer: no viewer element')
if (!viewer) return
const myId = ++initIdRef.current
setLoading(true)
setLargeDataset(false)
@ -738,7 +737,7 @@ export default function Forecast({ sources = [], sourceId, versions = [], versio
if (rowCount >= 500000) setLargeDataset(true)
if (myId !== initIdRef.current) return dbgOrder('initViewer: superseded before table')
if (myId !== initIdRef.current) return
if (!workerRef.current) workerRef.current = await perspective.worker()
const worker = workerRef.current
@ -811,8 +810,7 @@ export default function Forecast({ sources = [], sourceId, versions = [], versio
// by the very next line and the ordering columns never appeared in the
// column list.
try {
dbgOrder('reached the sync call')
await syncOrderExpressions()
await syncOrderExpressions()
} catch (err) {
// Its own try covers only restore(); save() and the builders sit outside
// it, and a throw there would abort the rest of initViewer silently.
@ -941,8 +939,13 @@ export default function Forecast({ sources = [], sourceId, versions = [], versio
//
// Removing an ordering removes its column: leaving a stale Bucket expression
// behind would keep ordering by an order that no longer exists.
// Silent unless localStorage.pf_debug is set, like the rest of the tracing.
// Kept rather than removed: it took several rounds to work out that this ran
// before its inputs existed, and it will be wanted again.
function dbgOrder(msg, extra) {
console.log(`[pf-order] ${msg}`, extra)
try { if (!localStorage.getItem('pf_debug')) return } catch { return }
if (extra === undefined) console.log(`[pf-order] ${msg}`)
else console.log(`[pf-order] ${msg}`, extra)
}
// Fetches its own inputs rather than reading the `versions` prop and the