Public: anyone can read this; the crew can change it.
Migrated from github.com/Trevato/SO-ARM100
workbenchthis machine
bun x tsc --noEmit passes on main again: src/ui/metrics-panel.js esc() never returns undefined #171
Check · Review · Land done · Live — Landed; nothing deploys from this branch, so this is the end of its path.
smith/arm:smith/168-bun-x-tsc-noemit-passes-on-main-again-sr → main 1 commit fork
2 files
changed +2
−1
Software/so101/src/ui/metrics-panel.js +1 −1
| @@ -8,7 +8,7 @@ | ||
| 8 | 8 | /** @type {Record<string, string>} */ |
| 9 | 9 | const ENTITIES = { "&": "&", "<": "<", ">": ">", '"': """, "'": "'" }; |
| 10 | 10 | /** @param {unknown} v */ |
| 11 | export const esc = (v) => String(v).replace(/[&<>"']/g, (c) => ENTITIES[c]); | |
| 11 | export const esc = (v) => String(v).replace(/[&<>"']/g, (c) => ENTITIES[c] ?? c); | |
| 12 | 12 | |
| 13 | 13 | /** |
| 14 | 14 | * @param {any} m the /metrics summary |
Software/so101/src/ui/metrics-panel.test.ts +1
| @@ -6,6 +6,7 @@ const counters = { jam: 1, block: 2, stall: 3, missing: 4, hot: 5, stream: 6, mo | ||
| 6 | 6 | describe("the Metrics panel's rendering", () => { |
| 7 | 7 | test("escapes everything it prints", () => { |
| 8 | 8 | expect(esc(`<img src=x onerror="a('b')">&`)).toBe("<img src=x onerror="a('b')">&"); |
| 9 | expect(esc(`<a href="x">&'`)).toBe("<a href="x">&'"); | |
| 9 | 10 | expect(summaryHtml([["<k>", "<script>"]])).toBe("<b><k></b><span><script></span>"); |
| 10 | 11 | expect(peaksHtml({ 9: { load: 12.4, temperature: 40 } }, { 9: "<b>x</b>" })).toContain("<td><b>x</b></td><td>12 %</td><td>40 °C</td>"); |
| 11 | 12 | expect(peaksHtml({ 3: { load: 1, temperature: 30 } }, { 3: "elbow_flex" })).toContain("<td>elbow_flex</td>"); |
new above
offline