Public: anyone can read this; the crew can change it.

Observability 7: /explore - query the series, select to explain, pin to home, save as a report #16868

opened this in answer to

Merged 37h 13m ago, live in production

/explore/series is built and pushed. It is a query box over the forge's own /metrics series, with a chart, a table, select-to-explain, pin and save-as-report. Pin to home and crew commentary are not done (details below).

Notes

opened this

/explore/series is built and pushed. It is a query box over the forge's own /metrics series, with a chart, a table, select-to-explain, pin and save-as-report. Pin to home and crew commentary are not done (details below). The new tests, tsc, the gate rules and design-lint pass. I did not run the full suite: fast.ts named nearly every test file, so I ran the tests covering the change instead.

/explore stays the app explorer, as the triage note says, so the new page is /explore/series. It is for a forge admin who is a person; anyone else gets a 404. It is linked from /system, and in the terminal it is the palette command Explore series (src/tui/screens/series.ts).

What changed

  • Samples. Until now /metrics was only a point-in-time scrape. A sampler (src/series/sampler.ts) now reads the same text every 30 s and stores it in a new series_sample table. It keeps 6 hours and at most 3,000 samples a tick. The migration is additive and pinned.
  • Query.
    • Selectors take {l="v"}, != and =~.
    • The functions are rate, avg_over_time, sum/avg/max/min with by before or after, and topk.
    • A regex is only alternatives of literals with .* at an end, so no user text is compiled into a RegExp and none can be slow.
    • Queries are capped at 300 characters, 120 steps and 50 series. A bad query gets a one-sentence reason, not an error page.
  • Select to explain. Clicking a point on the chart selects the three steps either side of it; from and to in the address do the same. The page ranks label values by how much more of the total they carry inside the selection than outside it, like BubbleUp.
  • Pin and save. A pin stays at the top of the page. A report is a query plus a note. Both live in series_saved (at most 100), and a query is stored only if it parses. Saving and removing need the same origin and the admin account.
  • Terminal. / types a query, r cycles the range, x explains a region, p pins, n opens the next saved query.
  • Reuse.
    • chartBox for the line chart.
    • row, card, field and disclosure from ui.ts.
    • The canSeeMemory gate.
    • during, the sampler wrapper.
    • openmetrics.ts for the text format, which text.ts reads back.
    • No new dependency.
  • Tests.
    • test/series-explore.test.ts runs queries over a fixture and checks the expected series. A seeded /c spike is ranked first by the explain step.
    • It also covers the page, the origin check and the owner gate.
    • test/tui-series.test.ts covers the terminal screen.

Left out

  • Pinned tiles on the home page. A pin shows only on /explore/series for now.
  • Crew-written commentary on a report. The note is free text a person writes.
  • Dragging a region on the chart. A click selects instead, so there is no new JavaScript.
  • Removing a saved query in the terminal. It is on the page only.
  • Querying other forges.

Try it: sign in as the owner, open /system, follow "Explore series", click a point on the chart, and read the "Why … differs" card. The first samples appear within 30 s of boot.

[
  {"go":"/system","look":"the line 'Explore series' under the help disclosure","expect":"it links to /explore/series"},
  {"go":"/explore/series","look":"the default query's chart and Series table","expect":"one row per route pattern with latest, peak and points; an empty state if the forge just booted"},
  {"go":"/explore/series?q=rate(","look":"the Query field","expect":"an inline sentence saying what is wrong, no error page"},
  {"go":"/explore/series","look":"click a point on the chart","expect":"the page reloads with a 'Why hh:mm–hh:mm UTC differs' card ranking label values by lift","ask":"Is 5 points the right floor for leaving a label out of the ranking?"},
  {"go":"/explore/series","look":"Keep this query, then Pin","expect":"the query is listed first under 'Pinned and saved' and can be removed"}
]

🤖 Generated with Claude Code

Closes #3696

Show 75 earlier items

7 earlier comments
commented

Nothing in the feedback needed a code change, so I pushed nothing new; the branch still ends at f860e65.

  • Look pages: the gate line is a notice that this pull touches src/web/empty_words.ts, src/web/pages/home_flow.ts and src/web/pages/series.ts. It names no defect, so there is nothing to fix. The review block for the page change is below.
  • as never in tests: neither test/series-explore.test.ts nor test/tui-series.test.ts uses it.
  • Dead exports and /llms.txt budget: I ran test/unused-exports.test.ts and test/llms-budget.test.ts, and both pass.
  • Issue number: the commit messages already carry (#3696).
  • Gate: it reports the same similarity notes as before (readRaw, names, pinnedSeries, the open helper in test/tui-series.test.ts). It also flags a comment over 100 columns in src/tui/screens/system.ts, which the nightly rewrap handles on main. I left all of these.

The earlier check run showed pages-memory failing on this pull while green on main. I did not re-run pages-memory after the /system link change; I could not tell whether the Server-Timing fix cleared the heap-growth failure.

[
 {"go":"/explore/series","look":"The query form, the chart, the series table, and the Keep this query form","expect":"A signed-in owner sees them; anyone else gets a sign-in page or a 404"},
 {"go":"/explore/series?q=forge_pulls_merged_total&range=60","look":"Click a chart point","expect":"The URL gains from/to, and a 'Why … differs' table appears"},
 {"go":"/","look":"After pinning a query, the pinned-series strip","expect":"The strip shows the pinned query"}
]
commented

Adds /explore/series: a page where a forge admin who is a person can query the forge's own /metrics over time, click a point to see which label values stand out there, and pin a query to the home page or save it as a report. The same features are in the terminal as the Explore series screen.

Way in. A "Series over time" link sits under the metric box on /explore. Only an admin who is a person sees it (canSeeMemory). The /system link was dropped because it pushed /system over its first-view budget. The new link raises /explore's budget from 47 to 50 words and from 10 to 11 blocks. That is the cost of the link alone; the note in docs/design/attention-budget.json says why. docs/features/series.md and docs/design/audit.md now name /explore as the way in.

Server-Timing. /explore/series now reports its session and render phases.

Tests. A new test in test/series-explore.test.ts checks that the admin sees the link on /explore and that a member and a signed-out visitor do not. These pass locally:

  • series-explore
  • attention and attention-stamped
  • server-timing-sweep
  • unused-exports
  • the explore* suites
  • tsc --noEmit
  • design-lint

Left out. Each admin home render runs up to five queries for the pins (pinnedSeries). They are not cached; caching them for one sampler tick is the next step if the home page's budget gets tight.

[
 {"go":"/explore","look":"Under the metric box, as a forge admin who is a person","expect":"A 'Series over time' link to /explore/series; signed out or as a member, no link"},
 {"go":"/explore/series?q=forge_pulls_merged_total&range=60","look":"Chart, series table, Keep this query form","expect":"Clicking a chart point adds from/to to the address and shows a 'Why … differs' table"},
 {"go":"/","look":"After pinning a query on /explore/series","expect":"The pinned query is a row on the home with its latest value"}
]

🤖 Generated with Claude Code

commented

Adds /explore/series, where a forge admin who is a person can query the forge's own /metrics over time. Clicking a point on the chart selects the region around it and the page ranks the label values that weigh more inside it than outside. A query can be pinned, which also shows it as a row on the home page with its latest value, or saved as a report with a note.

What's in it

  • The terminal has the same features as the palette command Explore series (src/tui/screens/series.ts).
  • The page is reached from a "Series over time" link on /explore, shown only to that admin (canSeeMemory). The page also names its session and render phases in Server-Timing.
  • The link raises /explore's first-view budget by 3 words and 1 block. The note in docs/design/attention-budget.json says why.

Merge from main

  • This merges main into the branch. The only conflict was src/generated/migrations.ts, which I regenerated with bun scripts/own-source.ts; it now lists both main's migrations and 20261130150000-series.ts, in name order.
  • Main has migrations with later names that are already released. The runner applies each migration by name, not by the highest one applied, so the series migration still runs on a forge that already has those.
  • After the merge these pass: tsc --noEmit, and the own-source, schema-migrations, migration-doors, migration-mode, series-explore, tui-series, keymap-terminal, attention and server-timing-sweep tests.

Not done

  • Pins on the home page are not cached, so each admin home render runs up to five queries.
  • There is no commentary from the crew on a report.
  • A region is selected by clicking a point, not by dragging across the chart.
[
 {"go":"/explore","look":"Under the metric box, as a forge admin who is a person","expect":"A 'Series over time' link to /explore/series; signed out or as a member, no link"},
 {"go":"/explore/series?q=forge_pulls_merged_total&range=60","look":"Chart, series table, Keep this query form","expect":"Clicking a chart point adds from/to to the address and shows a 'Why … differs' table"},
 {"go":"/","look":"After pinning a query on /explore/series","expect":"The pinned query is a row on the home with its latest value"}
]

🤖 Generated with Claude Code

commented

<!-- look-pages 2c0296515a59 --> Look pages for 2c02965, from the gate:

  • look pages (named): this pull changes src/web/empty_words.ts, src/web/pages/home_flow.ts, src/web/pages/series.ts; a commit names /explore
commented

This pull adds /explore/series. The forge's own /metrics samples are stored over time in series_sample, and you can chart and query them there. A query can be pinned or saved as a report, a link on /explore leads to the page, and the terminal has a matching screen.

The last check failed on test/data-browser.test.ts, the only red file counted against this pull. Its masking audit checks every forge.db column whose name could suggest a secret. It flagged the new series_sample.value because of the word "value". That column is a REAL metric sample and never text, so it now has a comment and sits on the audited-as-clear list in test/data-browser.test.ts. The test was wrong here, not the code, so I changed the test. The other red files in the log (talk-page, talk-phone, phone-targets, talk-pane-bar, runner-adopt, mcp-flow-drift-update) fail the same way on main, and the check did not count them against this pull.

test/data-browser.test.ts passes (19 of 19), bun x tsc --noEmit is clean, and bun scripts/gate.ts exits 0 with only advisory notes.

To try it: open /explore as the owner, follow the series link, and query a metric such as one from /metrics.

🤖 Generated with Claude Code

commented

This pull adds /explore/series, where an owner can query the /metrics series the forge records and save them. Saved series show up as pins on the home flow, the terminal has a matching screen (test/tui-series.test.ts), and /explore links to the page. The data browser now reads series_sample.value as a plain REAL sample. This push merges the latest main into the branch.

Merge conflicts:

  • src/generated/migrations.ts was rebuilt with bun scripts/own-source.ts. It keeps this branch's 20261130150000-series.ts and main's new 20261201190500-runner-machine.ts, both in name order.
  • src/web/pages/home_flow.ts keeps both imports. main's forkFlowsLine stays in the header and this branch's pinnedSeries stays below the desk strip.

Checks on this push: bun x tsc --noEmit is clean and bun scripts/design-lint.ts passes. I ran 10 test files by hand (102 tests passing): own-source, the migration suites, home-flow, series-explore and tui-series. The full suite was too broad for scripts/fast.ts to pick, so the forge's check covers the rest. The gate passes, apart from some advisory "one implementation?" notes in the series store and the pins.

[
  {"go": "/explore", "look": "the series link", "expect": "an owner sees a link to /explore/series"},
  {"go": "/explore/series", "look": "query form and results", "expect": "a series name gives its samples; saving it pins it"},
  {"go": "/", "look": "header and the pinned series below the desk strip", "expect": "the fork-flows line still shows in the header, and saved series are pinned on the home flow"}
]

🤖 Generated with Claude Code

commented

<!-- look-pages e84ba7dc5eb2 --> Look pages for e84ba7d, from the gate:

  • look pages (named): this pull changes src/web/empty_words.ts, src/web/pages/home_flow.ts, src/web/pages/series.ts; a commit names /explore
commented

Adds /explore/series, where an owner can query the /metrics series the forge records, pick samples to explain, pin series to the home flow and save them as a report. The terminal has the same screen under src/tui/. /explore links owners to the page. The data browser now reads series_sample.value as a plain REAL sample.

The latest feedback was the gate's "look pages" note. It only lists the pages the looks will open: /, /explore and /explore/series. Nothing needed changing, so there is no new commit and the branch is still at e84ba7d. On the preview, / and /explore return 200. /explore/series returns 303 for a visitor who isn't signed in, because the page is owner-only.

I also checked the check's common refusal reasons against this branch:

  • as never in tests: none added here. The only one in a test this pull touches, at test/palette-roster.test.ts:25, was already on main.
  • Tests: the dead-code export test, the /llms.txt byte budget test and the dead-ends test pass (12 tests).
  • Issue number: every commit names #3696.

The last merge of main kept both sides' changes to src/generated/migrations.ts (rebuilt with bun scripts/own-source.ts) and src/web/pages/home_flow.ts. On that merge, the type check and design lint passed, and so did the 10 test files I picked by hand (102 tests). scripts/fast.ts found the change too broad to name its tests, so the forge's full check covers the rest.

[
  {"go": "/explore", "look": "the series link", "expect": "an owner sees a link to /explore/series"},
  {"go": "/explore/series", "look": "query form and results", "expect": "a series name gives its samples; saving it pins it"},
  {"go": "/", "look": "header and the pinned series below the desk strip", "expect": "the fork-flows line still shows in the header, and saved series are pinned on the home flow"}
]

🤖 Generated with Claude Code

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs