Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Tighten the comments added by this PR

danielhanchen8a028ba175c4
diff --git a/studio/frontend/src/features/profile/hooks/use-profile-stats.ts b/studio/frontend/src/features/profile/hooks/use-profile-stats.ts
index d4a22105098..057bcbcb62d 100644
--- a/studio/frontend/src/features/profile/hooks/use-profile-stats.ts
+++ b/studio/frontend/src/features/profile/hooks/use-profile-stats.ts
@@ -44,11 +44,7 @@ export function useProfileStats(): ProfileStatsState {
return () => abortRef.current?.abort();
}, [load]);
- // Coming back to the tab is when the numbers can have moved: the user chatted
- // in another window, or an API client spent tokens while this one sat open.
- // Reopening Settings needs no watcher of its own -- the dialog content is not
- // force-mounted, so the panel unmounts on close and the effect above refetches
- // when it mounts again.
+ // Tokens move while backgrounded. Reopen needs no watcher: the dialog is not force-mounted.
useEffect(() => subscribeResidentStatusRefresh(load), [load]);
const reload = useCallback(() => {
diff --git a/studio/frontend/src/features/profile/utils/stats-format.ts b/studio/frontend/src/features/profile/utils/stats-format.ts
index 21999f69b46..c0ce89bc4f1 100644
--- a/studio/frontend/src/features/profile/utils/stats-format.ts
+++ b/studio/frontend/src/features/profile/utils/stats-format.ts
@@ -342,10 +342,7 @@ export type ActivityGridCell = {
export type ActivityGridColumn = ActivityGridCell[];
-/**
- * Headline number for the activity card subtitle. Daily and cumulative sum
- * tokens in the visible window; weekly reports the busiest week in that window.
- */
+/** Subtitle headline: weekly reports the busiest week, other modes sum the window. */
export function activitySummaryForMode(
grid: ActivityGridColumn[],
mode: ActivityMode,
diff --git a/studio/frontend/tests/profile-stats-format.test.ts b/studio/frontend/tests/profile-stats-format.test.ts
index 82dd4dbb5c5..3921c68391e 100644
--- a/studio/frontend/tests/profile-stats-format.test.ts
+++ b/studio/frontend/tests/profile-stats-format.test.ts
@@ -212,9 +212,6 @@ test("activity summaries follow the selected chart mode", () => {
});
test("daily and cumulative still total the window, as the card always did", () => {
- // The helper replaced an inline reduce over the same grid. If these two modes
- // ever stop matching it, every existing subtitle silently changes number, and
- // nothing else in the suite would notice.
const legacyVisibleTotal = (grid: ActivityGridColumn[]) =>
grid.reduce(
(sum, column) =>
@@ -246,8 +243,7 @@ test("daily and cumulative still total the window, as the card always did", () =
});
test("the shapes a real grid actually takes summarise without NaN", () => {
- // Every column is padded to a Monday-started week, so null cells are the norm
- // rather than an edge case, and the final column is short.
+ // Columns are padded to Monday-started weeks, so nulls are normal and the last column is short.
const allPadding = [Array.from({ length: 7 }, () => ({ day: null }))];
const ragged = [
[
diff --git a/studio/frontend/tests/profile-stats-refresh.test.ts b/studio/frontend/tests/profile-stats-refresh.test.ts
index 1fe92da4a32..13d947dc637 100644
--- a/studio/frontend/tests/profile-stats-refresh.test.ts
+++ b/studio/frontend/tests/profile-stats-refresh.test.ts
@@ -51,9 +51,7 @@ function fakeTargets(hidden = false) {
}
test("the profile stats hook refreshes when the tab returns to the foreground", () => {
- // Source-asserted, like tests/chat-speech-model-not-adopted.test.ts does for
- // the chat runtime: the wiring is one line and a renderer is not worth it, but
- // dropping the line would silently restore the stale-stats bug.
+ // Source-asserted: one line of wiring, but dropping it silently restores the stale-stats bug.
assert.match(HOOK, /subscribeResidentStatusRefresh/);
assert.match(
HOOK,
@@ -64,17 +62,11 @@ test("the profile stats hook refreshes when the tab returns to the foreground",
});
test("the hook does not watch the settings dialog store", () => {
- // The panel lives inside a DialogContent that is not force-mounted, so it
- // unmounts on close and the mount effect already refetches on reopen. A
- // closed->open watcher here would be unreachable code plus a dependency from
- // features/profile on features/settings.
+ // DialogContent is not force-mounted, so the panel remounts and refetches; a watcher is dead code.
assert.doesNotMatch(HOOK, /useSettingsDialogStore/);
});
test("the refresh subscription hands back a working unsubscribe", () => {
- // The contract the effect above depends on. If this ever returned void, every
- // reopen of Settings would leave another listener behind and one focus would
- // fire a request per listener.
const harness = fakeTargets();
let calls = 0;
const stop = subscribeResidentStatusRefresh(() => {
@@ -108,8 +100,6 @@ test("a tab going hidden does not refetch; coming back does", () => {
});
test("mounting and unmounting repeatedly leaves no listeners behind", () => {
- // Opening and closing Settings twenty times should not make one focus fire
- // twenty requests.
const harness = fakeTargets();
let calls = 0;
const stops = Array.from({ length: 20 }, () =>