Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion .github/benchmark-site/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,27 @@ This static shell replaces the generic benchmark-action index at
for metric trends. `executions.js` indexes workflow attempts, and
`runs/<execution-id>.json` supplies the complete retained reports.

Open a local preview from the repository root:
Import the default local report and serve the real dashboard from the repository
root:

```bash
python3 .github/scripts/serve_harness_e2e_dashboard.py
```

Pass files or directories to import other local executions:

```bash
python3 .github/scripts/serve_harness_e2e_dashboard.py \
harness/target/e2e-reactive-fix/results.json \
target/harness-e2e-glm-5.2
```

Imports accumulate in `target/harness-e2e-dashboard-local`. Reimporting the same
report is idempotent. Use `--reset` to start a new local history, or `--host`
and `--port` to change the default `127.0.0.1:4173` listener. The command only
reads existing reports; it does not run E2E scenarios.

To preview the sample fixtures instead, serve `.github/benchmark-site` directly:

```bash
python3 -m http.server 4173 --directory .github/benchmark-site
Expand Down
1 change: 1 addition & 0 deletions .github/benchmark-site/execution-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@
);
return {
schemaVersion: Number(raw.schema_version) || 1,
mode: raw.mode === "local" ? "local" : "published",
lastUpdate: raw.last_update || benchmarkData?.lastUpdate || "",
repoUrl: raw.repo_url || benchmarkData?.repoUrl || "",
preview: Boolean(globalThis.HARNESS_BENCHMARK_PREVIEW),
Expand Down
9 changes: 9 additions & 0 deletions .github/benchmark-site/execution-data.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,25 @@ test("merges manifest executions and finds a retained detail", () => {
const history = mergeExecutionHistory(
{
schema_version: 2,
mode: "local",
last_update: "2026-07-29T06:10:00Z",
executions: [execution()],
},
{ snapshots: [] },
);

assert.equal(history.executions.length, 1);
assert.equal(history.mode, "local");
assert.equal(findExecution(history, "123-1").detail_path, "runs/123-1.json");
});

test("defaults execution history to published mode", () => {
assert.equal(
mergeExecutionHistory({ executions: [] }, { snapshots: [] }).mode,
"published",
);
});

test("keeps workflow attempts distinct and newest first", () => {
const history = mergeExecutionHistory(
{
Expand Down
1 change: 1 addition & 0 deletions .github/benchmark-site/execution.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@
document.title = `Run ${runLabel} · Harness E2E`;

const workflowUrl = safeUrl(execution.workflow_url);
elements.workflowLink.hidden = !workflowUrl;
if (workflowUrl) elements.workflowLink.href = workflowUrl;
const commit = execution.source?.sha || "";
const repo = history.repoUrl.replace(/\/$/, "");
Expand Down
7 changes: 4 additions & 3 deletions .github/benchmark-site/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ <h1 id="page-title">Execution dashboard</h1>
<p>Workflow-level health with scenario results and complete run diagnostics.</p>
</div>
<div class="sync-block">
<span>Last published</span>
<span id="sync-label">Last published</span>
<time id="last-update" datetime="">Waiting for data</time>
</div>
</section>

<section id="empty-state" class="empty-state" hidden>
<div class="empty-icon" aria-hidden="true">⌁</div>
<h2>No executions published</h2>
<p>The next scheduled Harness E2E workflow will appear here.</p>
<h2 id="empty-title">No executions published</h2>
<p id="empty-description">The next scheduled Harness E2E workflow will appear here.</p>
</section>

<div id="overview-content">
Expand Down Expand Up @@ -212,6 +212,7 @@ <h2 id="executions-heading">All executions</h2>
<option value="all">All triggers</option>
<option value="schedule">Scheduled</option>
<option value="workflow_dispatch">Manual</option>
<option value="local">Local</option>
</select>
</label>
</div>
Expand Down
19 changes: 16 additions & 3 deletions .github/benchmark-site/overview.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@
content: document.querySelector("#overview-content"),
count: document.querySelector("#execution-count"),
empty: document.querySelector("#empty-state"),
emptyDescription: document.querySelector("#empty-description"),
emptyTitle: document.querySelector("#empty-title"),
efficiencyBody: document.querySelector("#efficiency-body"),
efficiencyCost: document.querySelector("#efficiency-cost"),
efficiencyCostDelta: document.querySelector("#efficiency-cost-delta"),
Expand Down Expand Up @@ -125,6 +127,7 @@
),
scenarioHistoryDialog: document.querySelector("#scenario-history-dialog"),
scenarioHistoryTitle: document.querySelector("#scenario-history-title"),
syncLabel: document.querySelector("#sync-label"),
status: document.querySelector("#status-filter"),
};

Expand Down Expand Up @@ -1086,7 +1089,16 @@
}

async function initialize() {
elements.preview.hidden = !history.preview;
const isLocal = history.mode === "local";
elements.preview.hidden = !(history.preview || isLocal);
elements.preview.textContent = isLocal ? "Local data" : "Preview data";
if (isLocal) {
elements.syncLabel.textContent = "Last imported";
elements.emptyTitle.textContent = "No local executions imported";
elements.emptyDescription.textContent =
"Import a results.json file to populate this dashboard.";
elements.actionsLink.textContent = "View repository ↗";
}
const lastUpdate = history.lastUpdate || history.executions[0]?.completed_at;
if (lastUpdate) {
elements.lastUpdate.dateTime = new Date(lastUpdate).toISOString();
Expand All @@ -1095,8 +1107,9 @@
if (history.repoUrl) {
const repo = safeUrl(history.repoUrl);
if (repo) {
elements.actionsLink.href =
`${repo.replace(/\/$/, "")}/actions/workflows/harness-e2e-daily.yml`;
elements.actionsLink.href = isLocal
? repo
: `${repo.replace(/\/$/, "")}/actions/workflows/harness-e2e-daily.yml`;
}
}
elements.scenarioHistoryClose.addEventListener("click", () => {
Expand Down
10 changes: 10 additions & 0 deletions .github/scripts/publish_harness_e2e_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,9 +377,12 @@ def publish(
repo_url: str,
max_summaries: int,
max_details: int,
site_mode: str = "published",
) -> dict[str, Any]:
if max_summaries < 1 or max_details < 0 or max_details > max_summaries:
raise PublishError("retention must satisfy 0 <= details <= summaries")
if site_mode not in {"local", "published"}:
raise PublishError("site mode must be local or published")
site_dir.mkdir(parents=True, exist_ok=True)
runs_dir = site_dir / "runs"
runs_dir.mkdir(parents=True, exist_ok=True)
Expand Down Expand Up @@ -456,6 +459,7 @@ def publish(

updated = {
"schema_version": SCHEMA_VERSION,
"mode": site_mode,
"last_update": metadata["completed_at"] or metadata["started_at"],
"repo_url": repo_url,
"retention": {
Expand Down Expand Up @@ -492,6 +496,11 @@ def build_parser() -> argparse.ArgumentParser:
parser.add_argument("--repo-url", required=True)
parser.add_argument("--max-summaries", type=int, default=100)
parser.add_argument("--max-details", type=int, default=30)
parser.add_argument(
"--site-mode",
choices=("local", "published"),
default="published",
)
return parser


Expand Down Expand Up @@ -522,6 +531,7 @@ def main(argv: list[str] | None = None) -> int:
repo_url=args.repo_url,
max_summaries=args.max_summaries,
max_details=args.max_details,
site_mode=args.site_mode,
)
print(
json.dumps(
Expand Down
Loading
Loading