Skip to content

Commit 2449a6a

Browse files
committed
chore: mark benchmark/report output as stub
1 parent a52e36b commit 2449a6a

2 files changed

Lines changed: 20 additions & 10 deletions

File tree

src/commands/benchmark.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,13 @@ export const registerBenchmarkCommand = (program: Command) => {
8989
const startedAt = new Date();
9090
const runs = buildPlaceholderRuns(startedAt);
9191
const finishedAt = new Date(
92-
new Date(runs[runs.length - 1]?.finishedAt ?? startedAt.toISOString())
93-
.getTime()
92+
new Date(runs[runs.length - 1]?.finishedAt ?? startedAt.toISOString()).getTime()
9493
);
9594
const avgLatencyMs =
96-
runs.reduce((sum, run) => sum + run.metrics.latencyMs, 0) /
97-
runs.length;
95+
runs.reduce((sum, run) => sum + run.metrics.latencyMs, 0) / runs.length;
9896

9997
const result = {
98+
status: "stub",
10099
suite,
101100
startedAt: startedAt.toISOString(),
102101
finishedAt: finishedAt.toISOString(),
@@ -105,6 +104,7 @@ export const registerBenchmarkCommand = (program: Command) => {
105104
runCount: runs.length,
106105
avgLatencyMs,
107106
},
107+
warnings: ["Benchmark results are placeholders."],
108108
};
109109

110110
await fs.writeFile(resolvedOutput, JSON.stringify(result, null, 2), "utf8");

src/commands/report.ts

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ type ReportOptions = {
88
};
99

1010
type BenchmarkResults = {
11+
status?: string;
1112
suite?: string;
1213
runs?: Array<{
1314
metrics?: {
@@ -17,6 +18,7 @@ type BenchmarkResults = {
1718
summary?: {
1819
avgLatencyMs?: number;
1920
};
21+
warnings?: string[];
2022
};
2123

2224
const toErrorMessage = (error: unknown): string =>
@@ -105,24 +107,32 @@ export const registerReportCommand = (program: Command) => {
105107
.filter(isFiniteNumber);
106108
const avgLatency =
107109
latencies.length > 0
108-
? latencies.reduce((sum, value) => sum + value, 0) /
109-
latencies.length
110+
? latencies.reduce((sum, value) => sum + value, 0) / latencies.length
110111
: isFiniteNumber(parsed.summary?.avgLatencyMs)
111112
? parsed.summary?.avgLatencyMs
112113
: undefined;
113114
const avgLatencyText =
114-
typeof avgLatency === "number"
115-
? avgLatency.toFixed(2)
116-
: "N/A";
115+
typeof avgLatency === "number" ? avgLatency.toFixed(2) : "N/A";
116+
117+
const status = parsed.status ? parsed.status : "unknown";
118+
const warnings = Array.isArray(parsed.warnings) ? parsed.warnings : [];
117119

118120
const lines = [
119121
"# Benchmark Report",
120122
"",
123+
`- Status: ${status}`,
121124
`- Suite: ${suite}`,
122125
`- Runs: ${runCount}`,
123126
`- Avg latency (ms): ${avgLatencyText}`,
124127
"",
125-
];
128+
warnings.length > 0 ? "## Warnings" : "",
129+
...warnings.map((warning) => `- ${warning}`),
130+
warnings.length > 0 ? "" : "",
131+
"## Notes",
132+
"- If this report is marked as stub, replace placeholder metrics with real benchmark output.",
133+
"- Re-run `dws benchmark --suite <name>` after integrating the DWS API.",
134+
"",
135+
].filter((line) => line !== "");
126136

127137
await fs.writeFile(resolvedOutput, lines.join("\n"), "utf8");
128138
console.log(`Wrote report to ${resolvedOutput}`);

0 commit comments

Comments
 (0)