Skip to content

Commit 5153cca

Browse files
committed
chore: restore the comments an off-by-one over-trimmed
1 parent 9b7ca8c commit 5153cca

18 files changed

Lines changed: 92 additions & 46 deletions

File tree

apps/webapp/app/components/dashboard-agent/WatchChips.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,10 @@ const SEMANTIC_ICON: Record<WatchSemanticIcon, (props: { className?: string }) =
4343
info: InformationCircleIcon,
4444
};
4545

46-
// A terminal chip wears the resolved result's icon, not its lifecycle status: a
47-
// `run_finished` watch on a failed run resolves `condition_met`.
46+
/**
47+
* A terminal chip wears the resolved result's icon, not its lifecycle status: a
48+
* `run_finished` watch on a failed run resolves `condition_met`. Cancellation has none.
49+
*/
4850
function StatusIcon({ watch }: { watch: WatchChip }) {
4951
if (watch.status === "active") return <AgentSpinner size={14} />;
5052

apps/webapp/app/components/dashboard-agent/suggested-prompts/page-mappers.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
// A mapper may not cause a query, and signals are emitted only for abnormal state.
1+
/**
2+
* Route `handle` mappers: loader data in, `AgentPageContext` out. A mapper may
3+
* not cause a query, and signals are emitted only for abnormal state.
4+
*/
25
import type { AgentPageContext, AgentPageSignal } from "@internal/dashboard-agent-contracts";
36
import { z } from "zod";
47

apps/webapp/app/components/dashboard-agent/suggested-prompts/registry.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
// Pure: no React, no server imports, no clock beyond the `now` passed in.
1+
/**
2+
* The chips the panel can offer. `resolver.ts` orders the slots and applies the
3+
* cap. Pure: no React, no server imports, no clock beyond the `now` passed in.
4+
*/
25
import type {
36
AgentPage,
47
AgentPageContext,
@@ -14,8 +17,10 @@ import {
1417
} from "../investigate-prompts";
1518
import { isFailedBatchStatus } from "./page-mappers";
1619

17-
// Chip ids must stay stable and carry no run/queue identity: dismissals are stored by id,
18-
// so `fresh-failure:run_abc` would scope the dismissal to a single run.
20+
/**
21+
* Chip ids must stay stable and carry no run/queue identity: dismissals are stored
22+
* by id, so `fresh-failure:run_abc` would scope the dismissal to a single run.
23+
*/
1924
const ID_PREFIX = "sp";
2025

2126
function make(

apps/webapp/app/components/dashboard-agent/suggested-prompts/resolver.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
// Order: the promoted slot, then `PROMPT_SLOTS`, signal chips ahead of the page-kind
2-
// default within each slot.
1+
/**
2+
* Turns a page context into the chips the panel shows: the promoted slot, then
3+
* `PROMPT_SLOTS` in order, signal chips ahead of the page-kind default per slot.
4+
*/
35
import {
46
SUGGESTED_PROMPT_CAP,
57
type AgentPageContext,

apps/webapp/app/components/dashboard-agent/watch-recommendations.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@ export function runWatchRecommendation(runFriendlyId: string): WatchSpec {
2323
});
2424
}
2525

26-
// The recommendation must be a condition that isn't true yet: an already-true watch
27-
// one-shots instead of watching.
26+
/**
27+
* The recommendation must be a condition that isn't true yet: an already-true watch
28+
* one-shots instead of watching. Past the wait threshold that means the drain, not the SLA.
29+
*/
2830
export function queueWatchRecommendation(
2931
queueName: string,
3032
context?: { oldestWaitMs?: number | null }

apps/webapp/app/hooks/useAgentPageContext.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@ import { useLocation, useMatches } from "@remix-run/react";
22
import type { AgentPageContext } from "~/components/dashboard-agent/page-context-types";
33
import type { Handle } from "~/utils/handle";
44

5-
// The deepest `handle.agentPageContext` mapper that returns something wins; pages with no
6-
// mapper fall back to the path.
5+
/**
6+
* The page context the dashboard agent sees. Routes opt in with `handle = { agentPageContext }`.
7+
* The deepest mapper that returns something wins; pages with no mapper fall back to the path.
8+
*/
79
export function useAgentPageContext(): AgentPageContext {
810
const matches = useMatches();
911
const location = useLocation();

apps/webapp/app/hooks/useThemeMode.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@ import { useEffect, useState } from "react";
22

33
export type ThemeMode = "dark" | "light";
44

5-
// Resolved in an effect so server and hydration renders agree; `root.tsx` can flip
6-
// `data-theme` pre-paint.
5+
/**
6+
* The active theme's mode, for colors that can't come from a CSS variable. Resolved in an
7+
* effect so server and hydration renders agree; `root.tsx` can flip `data-theme` pre-paint.
8+
*/
79
export function useThemeMode(): ThemeMode {
810
const [mode, setMode] = useState<ThemeMode>("dark");
911
useEffect(() => {

apps/webapp/app/presenters/v3/reports/ReportPresenter.server.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,10 @@ export function createReportCache(ttlMs: number = REPORT_CACHE_TTL_MS): ReportCa
3232

3333
const defaultReportCache = createReportCache();
3434

35-
// The cache only helps once a load has finished, so without this collapsing every caller of a
36-
// cold key hits the query-concurrency limit at once.
35+
/**
36+
* Collapses concurrent identical requests into one computation: the cache only helps once a load has
37+
* finished, so all callers of a cold key would otherwise hit the query-concurrency limit at once.
38+
*/
3739
const inFlight = new Map<string, Promise<ReportViewModel | undefined>>();
3840

3941
export class ReportPresenter {

apps/webapp/app/presenters/v3/reports/health/health-core.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ export type HealthInput = {
88
windowMinutes: number;
99
/** Provenance. Drives caveat text, not logic. */
1010
flowSource: "snapshot+runs" | "queue_metrics_v1";
11-
// `normal` is the 7d baseline, omitted on the snapshot path. `availability: "unknown"` means the
12-
// depth was not measured and `now` is a placeholder, not a confident 0.
11+
/**
12+
* `normal` is the 7d baseline, omitted on the snapshot path. `availability: "unknown"` means the
13+
* depth was not measured and `now` is a placeholder, not a confident 0.
14+
*/
1315
pending: {
1416
now: number;
1517
normal?: number;
@@ -34,8 +36,10 @@ export type HealthInput = {
3436
runningSeries: number[];
3537
/** Epoch ms per `runningSeries` bucket. Absent means contiguity falls back to index adjacency. */
3638
runningBucketsMs?: number[];
37-
// `runningSeries` is not gap-filled. Absent cadence means received buckets are assumed to
38-
// spread evenly over the window.
39+
/**
40+
* Cadence and expected bucket count of `runningSeries`, which is not gap-filled. Absent means
41+
* the cadence is unknown and received buckets are assumed to spread evenly over the window.
42+
*/
3943
sampling?: { bucketMinutes: number; expectedBuckets: number } | null;
4044
envLimit: number;
4145
throttledShare: number;

apps/webapp/app/presenters/v3/reports/health/health-data.ts

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,10 @@ function envScalarQuery(): string {
198198
FROM env_metrics`;
199199
}
200200

201-
// `argMax(max_queued, bucket_start)` is point-in-time depth, not a peak. Rows stop at 20, so
202-
// the share's denominator comes from `queueTotalsQuery`.
201+
/**
202+
* `argMax(max_queued, bucket_start)` is a point-in-time depth, not a peak. These rows stop at 20, so
203+
* the share's denominator comes from `queueTotalsQuery`.
204+
*/
203205
function queueWorstQuery(): string {
204206
return `SELECT
205207
queue AS name,
@@ -210,8 +212,10 @@ ORDER BY latest_queued DESC
210212
LIMIT 20`;
211213
}
212214

213-
// `dlq_delta` is merged per queue then summed, never across queues. `total_queued` must be
214-
// computed here, not by summing the top-20 `queueWorstQuery` rows.
215+
/**
216+
* `dlq_delta` must be merged per queue then summed, never merged across queues. `total_queued` must
217+
* be computed here, not by summing the top-20 `queueWorstQuery` rows.
218+
*/
215219
function queueTotalsQuery(): string {
216220
return `SELECT sum(dlq) AS dlq_total, sum(latest_queued) AS total_queued
217221
FROM (
@@ -272,8 +276,10 @@ const EMPTY_EVIDENCE: HealthInput["flowEvidence"] = {
272276

273277
type RunsContext = { liveScalar: Row; liveSeries: Row[]; baselineScalar: Row };
274278

275-
// "unavailable" lets the next source down substitute. "failed" must make the flow verdict
276-
// unassessable, never fall through.
279+
/**
280+
* "unavailable" is a recognized rollout state, so the next source down is a legitimate substitute.
281+
* "failed" is anything else and must make the flow verdict unassessable, never fall through to it.
282+
*/
277283
export type FlowLoadResult =
278284
| { status: "ok"; data: FlowData }
279285
| { status: "unavailable" }
@@ -288,8 +294,10 @@ export interface FlowSource {
288294
): Promise<FlowLoadResult>;
289295
}
290296

291-
// The only failures the measured source may fall back on. Matched on error text because the
292-
// client collapses the error into a message. Codes: 60, 47, 81.
297+
/**
298+
* The only failures the measured source may treat as a benign fallback. Matched on error text
299+
* because the client collapses the error into a message. Codes: 60, 47, 81.
300+
*/
293301
const ROLLOUT_ERROR_PATTERNS = [
294302
/\bUNKNOWN_(?:TABLE|IDENTIFIER|DATABASE)\b/,
295303
/\bCode:\s*(?:60|47|81)\b/,
@@ -470,8 +478,10 @@ function buildQueueMetricsFlow(args: {
470478
};
471479
}
472480

473-
// The `runs` backlog proxy is shape-only: it starts at 0 within the window and can't see backlog
474-
// that predates it.
481+
/**
482+
* Fallback: live Redis depth plus a backlog proxy from `runs` (triggered minus finished). The proxy
483+
* is shape-only: it starts at 0 within the window and can't see backlog that predates it.
484+
*/
475485
export const SnapshotFlowSource: FlowSource = {
476486
async loadFlow(env, _period, ctx, deps) {
477487
// Last-resort source, so a Redis failure must not break the report.

0 commit comments

Comments
 (0)