Gate telemetry bar behind Help setting

This commit is contained in:
mmckeen-nv
2026-05-01 08:02:47 -07:00
parent 65309285fa
commit bc0cbac970
3 changed files with 67 additions and 3 deletions
+22
View File
@@ -0,0 +1,22 @@
import assert from 'node:assert/strict'
import { readFile } from 'node:fs/promises'
import path from 'node:path'
const root = process.cwd()
const pagePath = path.join(root, 'app/page.tsx')
const helpPanelPath = path.join(root, 'app/components/HelpPanel.tsx')
const [pageSource, helpPanelSource] = await Promise.all([
readFile(pagePath, 'utf8'),
readFile(helpPanelPath, 'utf8'),
])
assert.match(pageSource, /useState\(false\)/, 'telemetry bar must be disabled by default')
assert.match(pageSource, /TELEMETRY_BAR_ENABLED_KEY/, 'telemetry bar preference must have a persistent storage key')
assert.match(pageSource, /telemetryBarEnabled && <LiveTelemetryBar \/>/, 'live telemetry bar must only mount when enabled')
assert.match(pageSource, /localStorage\.setItem\(TELEMETRY_BAR_ENABLED_KEY/, 'telemetry bar preference must persist when toggled')
assert.match(helpPanelSource, /Enable Telemetry Bar - EXPERIMENTAL/, 'Help must expose the requested telemetry bar checkbox label')
assert.match(helpPanelSource, /The telemetry bar is setup for vLLM tokens per second and does not currently work with other endpoints\./, 'Help must include the requested experimental caveat')
assert.match(helpPanelSource, /type="checkbox"[\s\S]*checked=\{telemetryBarEnabled\}/, 'Help checkbox must reflect telemetry bar enabled state')
console.log('telemetry bar toggle checks passed')