tilt-dev / tilt-dev/tilt

Log pane: text filter shows only matching lines — prologues are gated to level filters

Open
#6,824 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
10.1k
Forks
413
Avg merge
1d 10h
Merged PRs (30d)
6

Description

Disclaimer: Everything after the image was written by AI.

We got this piece of feedback from an engineer:

Image

Problem

Filtering the log pane by a search term (with level = All Levels) only shows the bare matching lines, with no context. This is nearly useless when logs are structured — e.g. pretty-printed JSON — because the matching line is often a single field of a larger record and carries no information about what request/entity it belongs to.

Example: searching for an order ID in JSON logs returns a wall of lines that look like this, over and over, with no way to tell which record each one came from:

  "id": "01a00064-7eb4-8d00-b300-36131c1ae6db",
    "01a00064-7eb4-8d00-b300-36131c1ae6db"
  "id": "01a00064-7eb4-8d00-b300-36131c1ae6db",
  "id": "01a00064-7eb4-8d00-b300-36131c1ae6db",
    "01a00064-7eb4-8d00-b300-36131c1ae6db"
  "id": "01a00064-7eb4-8d00-b300-36131c1ae6db",
    "01a00064-7eb4-8d00-b300-36131c1ae6db"
    "01a00064-7eb4-8d00-b300-36131c1ae6db",
    "01a00064-7eb4-8d00-b300-36131c1ae6db",

What's odd

Tilt already implements exactly this feature for level filters (Errors/Warnings) — a rolling buffer of preceding lines ("prologues") is shown before each match, with a divider and a "… (more) …" link back to the unfiltered view. It's just gated off for text search:

// web/src/logs.ts
shouldDisplayPrologues(): boolean {
  return this.filterSet.level !== FilterLevel.all   // ← term filters never get here
}

So filtering by Errors gives 5 lines of lead-in per match; filtering by a term with All Levels gives none.

Proposal

Extend shouldDisplayPrologues() to also return true when a term filter is parsed, and reuse the existing prologue/grouping machinery (OverviewLogPane's isStartOfAlert/isEndOfAlert, currently keyed off level equality — needs a small tweak to work for terms too, since term matches don't share a level the way level-filtered matches do).

I have a small PR ready that does this (frontend-only, no Go changes) — opening it against this issue.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in web/src/logs.ts at shouldDisplayPrologues(), then inspect OverviewLogPane's isStartOfAlert and isEndOfAlert grouping logic. Confirm how level-filtered prologues are selected and how term matches differ. Done means term filters also show the existing preceding-line context and grouping behavior without Go changes.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.