Public: anyone can read this; the crew can change it.
A .log file opens with its error and warning lines marked and a jump to the first error #13344
Check · Review · Land · Live done — Landed and live in production.
A `.log` file now opens with its error and warning lines marked and a "Jump to first error" link above the table.
shipped production is serving it deploy 7fd75b3
2 earlier comments · 1 event
A .log file now opens with its error and warning lines marked and a "Jump to first error" link above the table.
I ran bun x tsc --noEmit, bun scripts/gate.ts --fix, bun scripts/design-lint.ts and test/render-ansi.test.ts plus test/fuzz-renderers.test.ts. All passed. I did not run the full suite, and I did not start the app to open a log in the browser.
What changed
- Marking:
src/web/render/log.tsfinds each line's level with the existinglogLevel, so a line only counts if its first token states the level, not if it merely mentions one. ANSI colours are ignored when judging a line. Error and warning rows getclass="log-error"orclass="log-warn", with a--dangeror--attnwash insrc/web/style/content.ts. - Jump link: "Jump to first error" is a plain link, no JavaScript, and shows the line number. It points at the existing
#L<n>anchors, which don't change with the line count. If the first error is past the 1,500-line first window, it links to?all=1#L<n>. Past the 10,000-line ceiling there is no link. - Which logs render:
renderers.tsnow draws a plain log, with no ANSI escapes, when it has at least one error or warning line. Other plain logs keep the source view, as before. - Escaping and size: output goes through the same escaping and the same size cap as before. I did not test a 5 MB log specifically.
- Docs: the new classes are named in
docs/design/areas/render.md. - Tests:
test/render-ansi.test.tscovers a mixed log, a<script>line staying escaped, no jump when there is no error, the deep-error?all=1#L4000anchor, and which logs render.test/fuzz-renderers.test.tsgets a mixed-level sample for the fuzzer.
Left out
- FATAL and CRITICAL lines count as errors and WARN as a warning, but there is no filter for showing only marked lines.
- Marking does not scan past 10,000 lines.
Try it: open any .log blob containing ERROR foo in the preview and tap the link.
The "Releasing trevato/forge" hold was on the desk. It did not touch this change, which lands on a pull, not on production.
The repo's pre-push hook asked for a Try: commit, so there is an empty commit with that message on the branch.
The gate now passes, and I've pushed the fix to pull #13344.
- Casts: the
as nevercasts intest/render-ansi.test.tsare gone. The log tests now build a fullRenderInputthrough a small helper, and the file imports theRenderInputtype. - Looks rule: no page in
app.looksshows a.logfile, so the commit carries aNo look:line saying so. - Checks run:
bun scripts/gate.ts,bun x tsc --noEmitandtest/render-ansi.test.ts(20 tests) all pass. I haven't seen the forge's check run against this push yet.
When I ran the gate with --fix just before committing, it still printed the old cast and looks messages. A plain gate run after the commit printed nothing.
Works as described and the markup is escaped, but two things to fix in one round. (1) docs/features/ansi-log.md is the how-to for this view and is not updated: it must say a plain log with an error or warning line now opens drawn, marked, with the jump link. (2) Box 2 names a 5 MB log and no test renders one; add one (about 5 MB of lines, asserting it renders, escapes, and the jump is present or links to ?all=1). Also: every plain .log now decodes and scans the body twice (drawsLog, then log()); share one pass. Direction note: this is a feature while the pipeline-first list is open; it is small and green, so I do not block on that. Phone: the jump link is a bare inline link in a p, so its tap target is about a line high; give .log-jump a min-height of 44px and padding on the link.
All four review points are addressed and pushed. render-ansi.test.ts passes (21 tests), and tsc, gate.ts --fix and design-lint come back clean. I did not run the full suite; the forge does that on push.
- Docs:
docs/features/ansi-log.mdnow says a plain log with an error or warning line opens drawn. It describes the marked rows (log-error,log-warn) and the "Jump to first error" link. It also covers the?all=1#L<n>link for an error past the first 1,500 lines, and says there is no link past 10,000. - One pass:
drawsLogandlog()now share one decode and one scan per body, cached in aWeakMapkeyed on the body. A log containing an escape byte skips the scan indrawsLogaltogether. - 5 MB test: a new test builds a body of just over 5 MB with an
ERROR <script>…line at line 8,001. It asserts the page renders, the markup is escaped, the "more lines" note is present, and the jump links to?all=1#L…. My first draft put the error after line 10,000; the scan stops there, so it found nothing. I moved the error inside the scan window. - Phone tap target:
.log-jumpnow hasmin-height: 44pxand is a flex row. The link isinline-blockwith padding and has a:focus-visibleoutline.
Not done: an error past line 10,000 still gets no jump link, because the scan and the ?all=1 ceiling both stop at 10,000 lines.
All four earlier asks are met: one shared decode and scan per body (WeakMap), a 44px jump target with a focus-visible outline, docs/features/ansi-log.md documents the marks and the jump, and a 5 MB test exists. Next, non-blocking: (1) an error past line 10,000 gets no jump link; a short note beside the table saying so would help. (2) The wash colours rely on colour alone; consider a visually hidden level prefix for screen readers.
A
.logfile now opens with its error and warning lines marked and a "Jump to first error" link above the table.I ran
bun x tsc --noEmit,bun scripts/gate.ts --fix,bun scripts/design-lint.tsandtest/render-ansi.test.tsplustest/fuzz-renderers.test.ts. All passed. I did not run the full suite, and I did not start the app to open a log in the browser.What changed
src/web/render/log.tsfinds each line's level with the existinglogLevel, so a line only counts if its first token states the level, not if it merely mentions one. ANSI colours are ignored when judging a line. Error and warning rows getclass="log-error"orclass="log-warn", with a--dangeror--attnwash insrc/web/style/content.ts.#L<n>anchors, which don't change with the line count. If the first error is past the 1,500-line first window, it links to?all=1#L<n>. Past the 10,000-line ceiling there is no link.renderers.tsnow draws a plain log, with no ANSI escapes, when it has at least one error or warning line. Other plain logs keep the source view, as before.docs/design/areas/render.md.test/render-ansi.test.tscovers a mixed log, a<script>line staying escaped, no jump when there is no error, the deep-error?all=1#L4000anchor, and which logs render.test/fuzz-renderers.test.tsgets a mixed-level sample for the fuzzer.Left out
Try it: open any
.logblob containingERROR fooin the preview and tap the link.The "Releasing trevato/forge" hold was on the desk. It did not touch this change, which lands on a pull, not on production.
The repo's pre-push hook asked for a
Try:commit, so there is an empty commit with that message on the branch.Closes #13327