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

A spark finding on the games page links to the slow tick it came from #18241

opened this

Its check is red, 1h 53m ago

check failed: gate: rule "the diff is the change": test/tui-games.test.ts:458 only rewraps a comment this pull did not write; restore the lines, and keep the diff to the change (`bun scripts/gate.ts --fix` rewraps…

A slow spark finding now shows on the box page and links to the slow tick it came from. The new test file and the existing spark view tests pass, and tsc and design-lint are clean. I did not run the full suite; the forge runs it on the push.

Notes · 8 files · +155 −4

opened this

A slow spark finding now shows on the box page and links to the slow tick it came from. The new test file and the existing spark view tests pass, and tsc and design-lint are clean. I did not run the full suite; the forge runs it on the push.

What changed

  • The finding: no finding derived from a spark profile existed, so I added one in src/games/spark_finding.ts. For a box's newest sampler profile, if the slowest tick is over 50 ms (the budget at 20 TPS), it says so. For example: "Tick time reached 62.5 ms at its slowest (budget 50 ms, window 3, 18.5 TPS); most time attributed to <mod>, 40%." It carries the profile's key and the tick window.
  • The box page: the line sits in the Profiles block of /games/<box> and links to /games/<box>/spark/<key>#tick-<window>. The games.ts edit is one rendering line plus its import.
  • The profile page: each slowest-ticks row now has id="tick-<window>", so the link lands on it. The edit is in games_spark_ticks.ts.
  • Key validation: the key comes from the box's own stored profiles, never from the request, so another box's profile is never linked.
  • Unchanged cases: a box with no sampler profile, or none over budget, shows no line.
  • Terminal: the Profiles screen (p on the box screen) shows the same sentence with the profile key and row. docs/features/game-spark.md has a new section.
  • Decoding cost: each profile is decoded once per process and cached (up to 64), so the box page doesn't re-decode a profile on every render.

Tests: test/games-spark-finding.test.ts checks the following:

  • A 62.5 ms window becomes a finding carrying the key and window.
  • The box page's href and the profile page's <tr id="tick-3"> use the same anchor.
  • A 40 ms profile gives no finding.
  • Another box never links a profile it doesn't hold.

I didn't run the tests without the change, but the link and anchor tests can't pass without it.

Chose not to do

  • The 50 ms threshold is fixed, not configurable.
  • Only the newest profile is considered, and at most one finding per box.
  • The finding doesn't join the per-service findings list. Spark profiles belong to the box, so it sits with the Profiles block.
  • GC and memory are still not shown.

Gate: the gate printed two "one implementation?" similarity notes about test helpers (varint, keep) copied from other tests. I did not dedupe them.

To try: store a slow sampler profile on a box, open /games/<box>, and follow the "Tick time reached…" line under Profiles. It opens /games/<box>/spark/<key>#tick-<window> on the matching row.

[
  {"go": "/games/<box> (a box with a sampler profile whose slowest tick is over 50 ms)", "look": "Profiles block, above the list of stored profiles", "expect": "A link reading 'Tick time reached N ms at its slowest…'"},
  {"go": "Follow that link", "look": "Slowest ticks table on the profile page", "expect": "URL ends #tick-<window> and the browser scrolls to that window's row"},
  {"go": "/games/<box> for a box whose profiles are all within budget, or that has none", "look": "Profiles block", "expect": "No tick line; the list is as before"}
]

Closes #18213

Show 1 earlier items

7 earlier comments
commented

<!-- look-pages daa02bb498a5 --> Look pages for daa02bb, from the gate:

  • look pages (none): this pull changes src/web/pages/games.ts, src/web/pages/games_spark_ticks.ts but the forge could not trace the route of /, /admin/telemetry, /explore and 29 more (an inline or wrapped handler), so it could not infer a page; the reviewer decides. A "Looks: <path>" line naming the nearest page, or a "No look: <why>" line (10+ characters), says it
commented

A slow spark finding now shows on the box page and links to the slow tick it came from. That link is the first push's change; this push only fixes the failing module-state test. That test refused the module-level Map I used to cache decoded profiles. The cache is now a WeakMap keyed by the app's database, so no state is shared across the process. I reran module-state and games-spark-finding, and both pass along with tsc. I did not rerun the full suite; the forge runs it on this push.

What changed

  • Finding: src/games/spark_finding.ts is new. When a box's newest sampler profile has a slowest tick over 50 ms (the budget at 20 TPS), it says so, for example "Tick time reached 62.5 ms at its slowest (budget 50 ms, window 3, 18.5 TPS)…". The finding carries the profile's key and the tick window.
  • Box page: the line sits in the Profiles block of /games/<box> and links to /games/<box>/spark/<key>#tick-<window>. The games.ts edit is one rendering line plus its import.
  • Profile page: each slowest-ticks row now has id="tick-<window>" (games_spark_ticks.ts), so the link lands on it.
  • Key validation: the key is read from the box's own stored profiles, never from the request, so another box's profile is never linked.
  • Unchanged cases: a box with no sampler profile, or none over budget, shows no line.
  • Terminal: the Profiles screen shows the same sentence with the profile key and row. docs/features/game-spark.md has a new section.
  • Tests: test/games-spark-finding.test.ts checks that a 62.5 ms window becomes a finding, and that the box page's href and the profile page's <tr id="tick-3"> use the same anchor. It also checks that a 40 ms profile gives no finding, and that another box's profile is never linked.

Not done

  • The 50 ms threshold is fixed.
  • Only the newest profile is considered, and there is at most one finding per box.
  • The finding is not in the per-service findings list, because profiles belong to the box.
  • GC and memory are still not shown.

The gate prints two "one implementation?" notes on test helpers (varint, keep) copied from other tests. I did not dedupe them.

To try: store a slow sampler profile on a box, open /games/<box>, and follow the "Tick time reached…" line under Profiles. It opens the profile page with the matching row targeted at #tick-<window>.

[
  {"go": "/games/<box> (a box with a sampler profile whose slowest tick is over 50 ms)", "look": "Profiles block, above the list of stored profiles", "expect": "A link reading 'Tick time reached N ms at its slowest…'"},
  {"go": "Follow that link", "look": "Slowest ticks table on the profile page", "expect": "URL ends #tick-<window> and the browser scrolls to that window's row"},
  {"go": "/games/<box> for a box whose profiles are all within budget, or that has none", "look": "Profiles block", "expect": "No tick line; the list is as before"}
]
commented

I pushed a commit with a Looks: /games/net line, which names the page the gate could not trace. The commit also carries "Direction: … (#18213)" and has no code changes. I haven't seen the gate's verdict on it yet.

The Looks: path is /games/net, which is the box page the finding link appears on. I don't know whether the gate accepts that path or wants another form.

The earlier module-state failure was already fixed in the previous push (the decode cache is a WeakMap keyed by the app's database). The games.ts change is still one rendering line plus its import.

The pull's change itself:

  • Box page: a box whose newest sampler profile has a slowest tick over 50 ms gets a line in its Profiles block: "Tick time reached N ms at its slowest…". It links to /games/<box>/spark/<key>#tick-<window>.
  • Profile page: each slowest-ticks row has the matching id="tick-<window>", so the link lands on it.
  • Key validation: the key is read only from the box's own stored profiles, never from the request.
  • Unchanged cases: a box with no profile, or none over budget, shows no line.
  • Terminal: the Profiles screen shows the same sentence with the profile key and row.
  • Not done: the 50 ms threshold is fixed, and only the newest profile gets a finding.

To try: store a slow sampler profile on a box, open /games/<box>, and follow the "Tick time reached…" line under Profiles.

[
  {"go": "/games/<box> (a box with a sampler profile whose slowest tick is over 50 ms)", "look": "Profiles block, above the list of stored profiles", "expect": "A link reading 'Tick time reached N ms at its slowest…'"},
  {"go": "Follow that link", "look": "Slowest ticks table on the profile page", "expect": "URL ends #tick-<window> and the browser scrolls to that window's row"},
  {"go": "/games/<box> for a box whose profiles are all within budget, or that has none", "look": "Profiles block", "expect": "No tick line; the list is as before"}
]
commented

I merged main into the branch and pushed; the merge touched three files and I resolved two conflicts. I ran tsc and the spark, tui-games and module-state tests (42 pass); I did not run the full suite. The earlier gate verdict was green, but I haven't seen the check's result on the merged push.

Conflicts resolved

  • games_spark_ticks.ts: main deleted this file when #18178 moved the slowest-ticks table into summarySections in src/games/spark_view.ts. I took the deletion and put the row anchor into summarySections instead.
  • docs/features/game-spark.md: I kept main's paragraph and my new "A finding links to its slow tick" section.

What the merge changed in my code

  • Anchor on the rows: the slowest-ticks rows now carry id="tick-<window>", so a finding's link still lands on its row.
  • Row titles: the rows are titled with the profile's real window number ("Window 3"), where main had used their rank ("Window 1"). That matches the window the finding names. No test or doc depended on the rank title.
  • tickAnchor moved: it now lives in spark_view.ts, to avoid an import cycle with spark_finding.ts.
  • Test: the anchor test now looks for <li id="tick-3"> rather than a table row.

Open gate notes

  • Looks line: the gate says Looks: /games/net is not a page listed in app.looks in forge.json. I haven't found which path it wants, so it is probably still unresolved.
  • Duplicate helpers: the gate flags my test's varint as a copy of test/helpers/spark_fixture.ts#varint (it was another test's varint before the merge). I did not switch to the shared one.

The feature is as before: a box whose newest sampler profile has a tick over 50 ms gets a "Tick time reached…" line in its Profiles block. It links to /games/<box>/spark/<key>#tick-<window>. The key comes only from the box's own profiles, and the terminal's Profiles screen shows the same sentence.

[
  {"go": "/games/<box> (a box with a sampler profile whose slowest tick is over 50 ms)", "look": "Profiles block", "expect": "A link reading 'Tick time reached N ms at its slowest…'"},
  {"go": "Follow that link", "look": "Slowest ticks section of the profile page", "expect": "URL ends #tick-<window>; the row titled 'Window <window>' is the one scrolled to"},
  {"go": "/games/<box> for a box with no profile or none over budget", "look": "Profiles block", "expect": "No tick line"}
]
commented

<!-- look-pages 158eedb91829 --> Look pages for 158eedb, from the gate:

  • look pages (none): "Looks: /games/net" is not a page of app.looks in forge.json; this pull changes src/web/pages/games.ts, src/web/pages/games_spark_view.ts but the forge could not trace the route of /, /admin/telemetry, /explore and 29 more (an inline or wrapped handler), so it could not infer a page; the reviewer decides. A "Looks: <path>" line naming the nearest page, or a "No look: <why>" line (10+ characters), says it
commented

I pushed one commit with a No look: line, which answers the look-pages note. The commit changes no code. The check has not yet reported on it.

I used No look: instead of naming a page. /games/<box> isn't in app.looks in forge.json, and none of the listed pages seeds a game box with a stored sampler profile, so there is no nearest page to name. The commit says that the tests render both pages.

The pull itself

  • Finding and link: a box whose newest sampler profile has a slowest tick over 50 ms gets a "Tick time reached N ms at its slowest…" line in its Profiles block on /games/<box>. The line links to /games/<box>/spark/<key>#tick-<window>.
  • Anchor: the matching row in the profile page's Slowest ticks section has id="tick-<window>", so the link lands on it.
  • Validation: the key comes only from the box's own stored profiles, never from the request.
  • Unchanged case: a box with no profile, or none over budget, shows no line.
  • Terminal: the Profiles screen shows the same sentence with the profile key and row.
  • Tests: test/games-spark-finding.test.ts covers the finding, its href, the matching anchor on the profile page, the within-budget case, and that another box's profile is never linked.
  • Not done: the 50 ms threshold is fixed, only the newest profile gets a finding, and there is at most one finding per box.
  • Open gate note: the gate still flags my test's varint as a copy of the one in test/helpers/spark_fixture.ts. I did not switch to the shared one.

To try: store a slow sampler profile on a box, open /games/<box>, and follow the "Tick time reached…" line under Profiles.

[
  {"go": "/games/<box> (a box with a sampler profile whose slowest tick is over 50 ms)", "look": "Profiles block", "expect": "A link reading 'Tick time reached N ms at its slowest…'"},
  {"go": "Follow that link", "look": "Slowest ticks section of the profile page", "expect": "URL ends #tick-<window>; the row titled 'Window <window>' is the one scrolled to"},
  {"go": "/games/<box> for a box with no profile or none over budget", "look": "Profiles block", "expect": "No tick line"}
]
commented

Still red on current main: check failed: gate: rule "the diff is the change": test/tui-games.test.ts:458 only rewraps a comment this pull did not write; restore the lines, and keep the diff to the change (`bun scripts/gate.ts -. Fix it and push.

commented

API Error: 402 This request requires more credits, or fewer max_tokens. You requested up to 128000 tokens, but can only afford 4000. To increase, visit https://openrouter.ai/workspaces/default/keys/b36b4d5ca03526e2ce9b015c94d62cc19d23669897752807e5fe44ac6efc00fd and adjust the key's monthly limit

Sign in to join this conversation.

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

Keyboard shortcuts

Docs