Skip to content

Commit 3984b5c

Browse files
committed
fix(webapp): report card keeps its series and links, and the metric grid stops starving the value column
1 parent 49f42de commit 3984b5c

4 files changed

Lines changed: 13 additions & 9 deletions

File tree

apps/webapp/app/components/dashboard-agent/report-sparkline.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -563,15 +563,15 @@ export function ReportSparkline({
563563
* chart start on the same vertical whatever the value's width.
564564
*/
565565
/**
566-
* Below a 19rem container the fixed tracks no longer fit beside the value, so the
566+
* Below a 22rem container the fixed tracks no longer fit beside the value, so the
567567
* sparkline drops to its own line. The columns never change, so the value, delta
568568
* and note stay on the same verticals at every panel width.
569569
*/
570570
const METRIC_ROW_CLASS =
571-
"grid grid-cols-[7rem_minmax(0,1fr)_2.75rem_6.5rem] items-center gap-x-2 @max-[19rem]:grid-cols-[7rem_minmax(0,1fr)_2.75rem] @max-[19rem]:gap-y-1.5";
571+
"grid grid-cols-[7rem_minmax(0,1fr)_2.75rem_6.5rem] items-center gap-x-2 @max-[22rem]:grid-cols-[7rem_minmax(0,1fr)_2.75rem] @max-[22rem]:gap-y-1.5";
572572

573573
/** The sparkline cell: its own full-width line once the row goes narrow. */
574-
const SPARK_CELL_CLASS = "@max-[19rem]:col-span-3 @max-[19rem]:justify-self-end";
574+
const SPARK_CELL_CLASS = "@max-[22rem]:col-span-3 @max-[22rem]:justify-self-end";
575575

576576
// Labels are never truncated: the column is sized for the longest one and
577577
// anything longer wraps.
@@ -667,7 +667,7 @@ export function ReportMetricRow({
667667
) : (
668668
// Keeps the column occupied so a series-less metric doesn't pull the
669669
// rows out of alignment.
670-
<span aria-hidden className="@max-[19rem]:hidden" />
670+
<span aria-hidden className="@max-[22rem]:hidden" />
671671
)}
672672
</li>
673673

internal-packages/dashboard-agent/src/dashboard-agent.eval.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,6 @@ const FIXTURES: Record<string, unknown> = {
200200
},
201201
},
202202
footer: [{ code: "raise_env_limit" }],
203-
seriesOmitted: true,
204203
},
205204
get_queue: {
206205
queue: "task/send-email",

internal-packages/dashboard-agent/src/dashboard-agent.test.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2180,15 +2180,16 @@ describe("the view-model tools don't echo the view back to the model", () => {
21802180
aggregation: "max",
21812181
normal: 40,
21822182
severity: "crit",
2183+
series: { points: Array.from({ length: 60 }, (_, i) => i * 3), kind: "measured" },
21832184
breakdown: Object.fromEntries(
21842185
Array.from({ length: 60 }, (_, i) => [`task/queue-${i}`, i * 7])
21852186
),
21862187
annotation: { code: "pending.estimated", value: 4200 },
21872188
},
21882189
],
21892190
facts: { trustworthy: true, throughput: 12 },
2191+
links: [{ key: "queues", label: "Queues", url: "/queues" }],
21902192
footer: { code: "report.footer" },
2191-
seriesOmitted: true,
21922193
uri: "trigger://proj_abc/env_abc/report/health",
21932194
};
21942195

@@ -2207,6 +2208,8 @@ describe("the view-model tools don't echo the view back to the model", () => {
22072208
expect(serialized).not.toContain("breakdown");
22082209
expect(serialized).not.toContain("observations");
22092210
expect(serialized).not.toContain("footer");
2211+
expect(serialized).not.toContain("series");
2212+
expect(serialized).not.toContain("links");
22102213
expect(serialized.length).toBeLessThan(JSON.stringify(output).length / 2);
22112214
});
22122215

internal-packages/dashboard-agent/src/tool-curation.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,9 @@ export function curateError(group: any) {
146146
};
147147
}
148148

149-
// Drops the per-metric `series` arrays and `links`; `seriesOmitted` records that the
150-
// shape is lossy. Grades and `facts.trustworthy` survive verbatim.
149+
// The card's copy: everything it draws, including the per-metric `series` and the
150+
// `links` recommendations key into. The model's copy is trimmed separately by
151+
// `getReportModelOutput`, so this costs no context.
151152
export function curateReport(data: unknown) {
152153
const vm = (data ?? {}) as any;
153154
const facts = (vm.facts ?? {}) as any;
@@ -180,6 +181,7 @@ export function curateReport(data: unknown) {
180181
aggregation: m.aggregation,
181182
normal: m.normal,
182183
delta: m.delta,
184+
series: m.series,
183185
breakdown: m.breakdown,
184186
annotation: m.annotation,
185187
// "unknown" means `value` is a placeholder, not a measurement. "measured" is the
@@ -200,8 +202,8 @@ export function curateReport(data: unknown) {
200202
dlqDelta: flowEvidence.dlqDelta,
201203
},
202204
},
205+
links: vm.links,
203206
footer: vm.footer,
204-
seriesOmitted: true,
205207
};
206208
}
207209

0 commit comments

Comments
 (0)