Files
PaperClipAI/tests/runner-e2e/history-browser.ts
T
DottaandPaperclip d8bd8fe9fb feat(evals): browse E2E suites across targets and models (#18027)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work.
> - E2E tests show whether people can complete real app and agent
journeys.
> - Operators need to choose a suite and inspect its evidence across
deployments and models.
> - The history page listed campaigns without a suite browser or clear
coverage filters.
> - QA smoke also appeared separate from the other retained E2E
measurements.
> - This pull request puts suites, deployment targets, and named
selections in one history browser.
> - The benefit is that a passing subset stays distinct from a full
suite run, with direct links to evidence.

## Linked Issues or Issue Description

Related: #18009 added clear per-test details and links to the tested
application. This PR extends the shared E2E history browser.

**What happened?**

The public directory called full app testing “Product E2E Evals” and
made users choose campaigns before they could find a suite. The history
list could not filter independently by tested app, agent execution,
model, or run selection. A recent passing subset could be mistaken for a
full suite result.

**Expected behavior**

Browse current and retained suites in one E2E category. Keep QA smoke in
normal campaign history. Show the latest matching run and latest full
suite run. Preserve the recorded definition and denominator when filters
change.

**Steps to reproduce**

1. Open the E2E history directory.
2. Find a suite, then compare a narrow passing run with a full run
across execution environments and models.
3. Find the QA smoke measurement and open its retained screenshots.

**Paperclip version or commit**

The previous report UI was at `8279c99008`. This branch is rebased on
current master.

**Deployment mode**

Static E2E history and campaign reports generated from retained
measurements.

## What Changed

- Call full-product testing “E2E tests.” Keep Runner protocol evals
separate because they use a mock control plane.
- Add a searchable suite sidebar that includes current suites and suites
found only in retained history.
- Add correlated suite, coverage, deployment target, execution,
provider, model, profile, runtime, result, date, and named-selection
filters. Keep filters in the URL for reload and back navigation. Sidebar
suite links clear other filters; the Suite dropdown keeps deliberate
intersections. Incompatible suite/preset URLs explain the empty
selection and link to the suite runs.
- Show latest matching and latest full run links. Distinguish full,
subset, unfinished, and unknown coverage from the recorded suite
definition and execution counts. Keep failed full runs visible.
- Retain the tested application URL and runtime mode in new history
records. Older records show “Not recorded.” Browser-only journeys do not
gain an inferred agent or model.
- Add an index-only refresh command that can import a reviewed public
campaign once. It rejects private Cloud bundles and does not replace
retained campaigns or upload evidence.
- Keep existing report URLs, test IDs, commands, and measurement
timestamps stable. Campaign links carry suite/profile/environment;
target/model/provider/runtime remain history-level filters.
- Add unit and synthetic browser regressions, including mobile
navigation, long source refs, sidebar filter reset, and empty-selection
repair. Inset dropdown carets in the shared report styles. Document
direct Node entry points without adding package.json shortcuts.
- Add a prominent Reset all filters button, blue active-filter borders
and tint, and visible active counts for the main and advanced filters.
Reset clears all 13 history filters, sidebar search, URL state, and the
attention view. Campaign-page filters use the same active styling.

## Verification

- Post-rebase focused Vitest: 127 tests passed across 10 files. The
latest follow-up selection passed 100 tests across 9 files. E2E support
TypeScript passed after both changes.
- The synthetic Chromium journey covers full and subset coverage,
unfinished selections, correlated filters, browser-only QA selection,
URL/back/reload, and desktop and touch navigation. The expanded journey
verifies 13 active history fields, the collapsed advanced-filter count,
reset of every field and sidebar search, and active border color changes
that revert after reset. It makes zero provider calls.
- Hub Python tests: 7 passed. The browser harness also exits promptly
when Chromium is unavailable; its HTTP server closes on launch failure.
- Real history verification covered 419 campaigns and 59 suites. All 418
previous campaign records remained deeply equal after importing the
reviewed QA campaign. Publication used the authoritative history ETag.
Only mutable index/history/pointer files were written; immutable
campaign bundles stayed unchanged.
- A live browser walkthrough passed from the two-family eval hub through
QA smoke, Basic app journeys, target filtering, the retained report,
screenshot gallery, history, and the logo link. The QA URL was clickable
and the image loaded. No browser JavaScript errors occurred. The
original QA normalized results and all three PNG hashes remained
unchanged.
- Live [E2E
history](https://d1p6rlowie26tp.cloudfront.net/runner-e2e/?view=history),
[core compatibility
suite](https://d1p6rlowie26tp.cloudfront.net/runner-e2e/?view=history&suite=core-compatibility),
and [QA smoke
runs](https://d1p6rlowie26tp.cloudfront.net/runner-e2e/?view=history&preset=qa-smoke).
- The live follow-up verified the incompatible Stock harness/QA-smoke
URL, the repair link to 21 Stock harness campaigns, and sidebar
navigation that clears preset/model filters. Dropdown carets were
inspected in dark, light, and mobile views. No JavaScript errors
occurred.
- The final live follow-up verified reset of history controls, URL
state, sidebar search, and the attention view, plus reload/back
restoration and mobile touch reset. Active filter borders and tint were
inspected in dark and light views. Campaign-page reset restored all
three QA cases. All 419 history records and original QA
measurement/evidence hashes stayed unchanged.
- Full repository typecheck, test, build, and E2E CI gates passed on
final head `1334cb79a5`. Both enforced aggregates, `ci / verify` and `ci
/ e2e`, completed successfully. Fresh Greptile review scored that exact
head 5/5 with no unresolved review threads.

## Risks

- Historical metadata can be missing. Unknown targets and runtime
details stay explicit instead of being inferred from a worker
environment.
- Full suite coverage follows the saved definition and selection.
Filtering to one model does not redefine that denominator. The latest
full-run shortcut can cross coverage selections and says so in its
detail text.
- This changes shared report presentation. It adds no application
runtime or database changes. The browser harness and index refresh do
not invoke models.
- Public history publication must keep its existing conditional-write
and retained-evidence boundaries. Private bundles, raw logs,
credentials, and screenshots are not part of this PR.

## Model Used

- OpenAI Codex, GPT-6 family, with reasoning, code execution, and
browser tools. The exact backend model ID and context-window size are
not exposed in this session.

## Checklist

- [x] I have included a thinking path that traces from project context
to this change
- [x] I have specified the model used (with version and capability
details)
- [x] I have checked ROADMAP.md and confirmed this PR does not duplicate
planned core work
- [x] I have searched GitHub for duplicate or related PRs and linked
them above
- [x] I have either (a) linked existing issues with `Fixes: #` / `Closes
#` / `Refs #` OR (b) described the issue in-PR following the relevant
issue template
- [x] I have not referenced internal/instance-local Paperclip issues or
links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip`
URLs)
- [x] My branch name describes the change (e.g. `docs/...`, `fix/...`)
and contains no internal Paperclip ticket id or instance-derived details
- [x] I have run tests locally and they pass
- [x] I have added or updated tests where applicable
- [x] I have updated relevant documentation to reflect my changes
- [x] I have considered and documented any risks above
- [x] All Paperclip CI gates are green
- [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups
- [x] I will address all Greptile and reviewer comments before
requesting merge

---------

Co-authored-by: Paperclip <noreply@paperclip.ing>
2026-10-28 09:48:31 -05:00

218 lines
17 KiB
TypeScript

import { retainedSuiteLabels, type ReportExecution } from "./report-catalog.js";
import type { RunnerE2EHistoryCampaign, RunnerE2EHistoryIndex, RunnerE2ESuiteSummary } from "./types.js";
export function fullSuiteSelection(suite: RunnerE2ESuiteSummary) {
return suite.complete && suite.expected > 0 && suite.selected === suite.expected;
}
export function historySuiteCoverage(suite: RunnerE2ESuiteSummary) {
if (fullSuiteSelection(suite)) return suite.executed === suite.selected ? "full" : "unfinished";
return suite.selected < suite.expected ? "subset" : "unknown";
}
export function historySuiteCatalog(history: RunnerE2EHistoryIndex, catalog: readonly ReportExecution[]) {
const suites = new Map(catalog.map(row => [row.suite.id, { id: row.suite.id, label: row.suite.label }]));
for (const campaign of history.campaigns) for (const suite of campaign.suites) {
if (!suites.has(suite.suiteId)) suites.set(suite.suiteId, {
id: suite.suiteId, label: retainedSuiteLabels[suite.suiteId] ?? suite.suiteId.replaceAll("-", " "),
});
}
return [...suites.values()].map(suite => ({ ...suite,
campaignCount: history.campaigns.filter(campaign => campaign.suites.some(row => row.suiteId === suite.id)).length,
})).sort((a, b) => a.label.localeCompare(b.label));
}
/** Only recorded metadata is searchable; old records keep an explicit unknown target. */
export function historyBrowserCampaign(campaign: RunnerE2EHistoryCampaign) {
return {
id: campaign.campaignId, date: campaign.generatedAt, url: campaign.publicUrl,
search: [campaign.campaignId, campaign.source.sha, campaign.source.ref].filter(Boolean).join(" ").toLowerCase(),
complete: campaign.complete, selected: campaign.selected, executed: campaign.executed,
passed: campaign.passed, failed: campaign.failed, incomplete: campaign.incomplete ?? 0,
cleanup: campaign.cleanupPassed, preset: campaign.preset ?? "",
coverage: campaign.complete && campaign.selected > 0
? campaign.executed === campaign.selected ? "full" : "unfinished"
: "subset",
suites: campaign.suites.map(suite => ({ id: suite.suiteId, full: historySuiteCoverage(suite) === "full", coverage: historySuiteCoverage(suite),
expected: suite.expected, selected: suite.selected, executed: suite.executed, passed: suite.passed,
failed: suite.failed, incomplete: suite.incomplete ?? 0, cleanup: suite.cleanupPassed, hash: suite.suiteDefinitionHash })),
executions: campaign.executions.map(execution => {
let target = "__unknown__";
try {
const url = new URL(execution.targetUrl ?? "");
if (["http:", "https:"].includes(url.protocol) && !url.username && !url.password) target = url.origin;
} catch { /* Historical records did not retain the application URL. */ }
return { suite: execution.suiteId, profile: execution.profileId, environment: execution.environmentId,
provider: execution.provider ?? (execution.runtimeMode === "none" ? "__none__" : "__unknown__"),
model: execution.model ?? (execution.runtimeMode === "none" ? "__none__" : "__unknown__"),
runtime: execution.runtimeMode ?? "__unknown__", target, case: execution.caseId,
status: execution.status, cleanup: execution.cleanup, executed: execution.attempt > 0 };
}),
};
}
export function historyBrowserJson(history: RunnerE2EHistoryIndex, catalog: readonly ReportExecution[]) {
return JSON.stringify({ suites: historySuiteCatalog(history, catalog),
campaigns: [...history.campaigns].sort((a, b) => Date.parse(b.generatedAt) - Date.parse(a.generatedAt)).map(historyBrowserCampaign),
}).replaceAll("<", "\\u003c").replaceAll("\u2028", "\\u2028").replaceAll("\u2029", "\\u2029");
}
export const historyBrowserScript = String.raw`
(() => {
const data = JSON.parse(document.querySelector('[data-index-data]').textContent);
const shell = document.querySelector('.report-shell');
const rows = new Map([...document.querySelectorAll('[data-index-campaign]')].map(row => [row.dataset.indexId, row]));
const suiteLabels = new Map(data.suites.map(suite => [suite.id, suite.label]));
const names = ['suite','coverage','target','environment','provider','model','profile','runtime','preset','status','from','through','q'];
const executionNames = ['target','environment','provider','model','profile','runtime'];
const controls = Object.fromEntries(names.map(name => [name, document.querySelector('[data-index-filter="'+name+'"]')]));
const unknown = value => value === '__none__' ? 'Browser only' : value === '__unknown__' ? 'Not recorded' : value;
const label = (name, value) => name === 'suite' ? suiteLabels.get(value) || value :
name === 'target' && value !== '__unknown__' ? (new URL(value).hostname === 'qa.test.paperclip.app' ? 'QA staging · ' : '') + value :
name === 'preset' && value === 'qa-smoke' ? 'QA smoke' : unknown(value);
for (const name of [...executionNames, 'preset']) {
const values = [...new Set(data.campaigns.flatMap(campaign => name === 'preset' ? [campaign.preset].filter(Boolean) : campaign.executions.map(execution => execution[name])))].sort();
for (const value of values) { const option = document.createElement('option'); option.value = value; option.textContent = label(name, value); controls[name].append(option); }
}
let state = {}, view = 'overview';
const reportHref = campaign => {
const url = new URL(campaign.url,location.href); url.searchParams.set('view','all');
for (const name of ['suite','profile','environment']) if (state[name]) url.searchParams.set(name,state[name]);
if (state.suite) url.hash = 'suite-' + state.suite;
return url.href;
};
const status = counts => counts.failed > 0 || !counts.cleanup || counts.executed < counts.selected ? 'failed' : counts.incomplete > 0 ? 'incomplete' : 'passed';
const selection = campaign => {
const suite = state.suite ? campaign.suites.find(suite => suite.id === state.suite) : null;
if (state.suite && !suite || state.preset && campaign.preset !== state.preset) return null;
if (state.from && campaign.date.slice(0,10) < state.from || state.through && campaign.date.slice(0,10) > state.through) return null;
const executions = campaign.executions.filter(execution => (!state.suite || execution.suite === state.suite) && executionNames.every(name => !state[name] || execution[name] === state[name]));
const narrowed = executionNames.some(name => state[name]);
if (narrowed && !executions.length) return null;
const search = [campaign.search, ...executions.flatMap(execution => Object.values(execution)),
...campaign.suites.filter(item => !state.suite || item.id === state.suite).map(item => suiteLabels.get(item.id))].join(' ').toLowerCase();
if (state.q && !search.includes(state.q.trim().toLowerCase())) return null;
const counts = narrowed ? { selected: executions.length, executed: executions.filter(execution => execution.executed).length,
passed: executions.filter(execution => execution.status === 'passed' && execution.cleanup === 'passed').length,
failed: executions.filter(execution => execution.status === 'failed').length,
incomplete: executions.filter(execution => execution.status === 'incomplete').length,
cleanup: executions.every(execution => execution.cleanup === 'passed') } : suite || campaign;
const result = status(counts);
if (state.status && result !== state.status || view === 'attention' && result === 'passed') return null;
const coverage = suite ? suite.coverage : campaign.coverage;
return { campaign, suite, counts, result, full: coverage === 'full', coverage, narrowed };
};
const fillPointer = (kind, selected) => {
const root = document.querySelector('[data-index-latest="'+kind+'"]');
const link = root.querySelector('a'), detail = root.querySelector('small');
link.hidden = !selected;
if (!selected) { detail.textContent = kind === 'full' ? 'No full run recorded for these filters.' : 'No matching run recorded.'; link.removeAttribute('href'); return; }
link.href = reportHref(selected.campaign);
link.textContent = selected.campaign.id;
detail.textContent = new Date(selected.campaign.date).toLocaleString('en-US',{timeZone:'UTC'}) + ' UTC · ' +
selected.counts.passed + '/' + selected.counts.selected + ' passed' + (selected.suite ? ' · ' + selected.suite.selected + '/' + selected.suite.expected + ' selected · definition ' + selected.suite.hash.slice(0,8) : '') +
(kind === 'full' && state.coverage && state.coverage !== 'full' ? ' · across coverage selections' : '');
};
const apply = () => {
shell.dataset.view = view;
const activeCount = names.filter(name => state[name]).length;
const active = activeCount > 0;
for (const name of names) controls[name].dataset.filterActive = String(Boolean(state[name]));
const activeLabel = document.querySelector('[data-index-active-count]');
activeLabel.textContent = active ? activeCount + ' active' : 'None active';
activeLabel.dataset.active = String(active);
document.querySelector('[data-index-reset]').dataset.active = String(active);
const moreCount = names.filter(name => !['suite','coverage','target','q'].includes(name) && state[name]).length;
const moreLabel = document.querySelector('[data-index-more-count]');
moreLabel.hidden = moreCount === 0;
moreLabel.textContent = moreCount + ' active';
const selectedLabel = state.suite ? suiteLabels.get(state.suite) || state.suite : '';
document.querySelector('[data-index-title]').textContent = selectedLabel || (view === 'attention' ? 'Needs attention' : 'E2E tests');
document.querySelector('[data-index-description]').textContent = state.suite ? 'Campaigns that included this suite. Full runs selected and executed the entire recorded suite definition; failed tests remain visible.' : 'Browse suites and retained campaigns across deployment targets, agent execution environments, and models.';
document.querySelector('[data-index-overview]').hidden = view !== 'overview' || active;
document.querySelector('[data-index-trends]').hidden = view !== 'history' || active;
document.querySelector('.summary').hidden = active;
document.querySelector('[data-index-suite-summary]').hidden = !state.suite;
const candidates = data.campaigns.map(selection).filter(Boolean);
fillPointer('any', candidates.find(row => !state.coverage || row.coverage === state.coverage));
fillPointer('full', candidates.find(row => row.full));
let visible = 0;
for (const campaign of data.campaigns) rows.get(campaign.id).hidden = true;
for (const selected of candidates) {
if (state.coverage && state.coverage !== selected.coverage) continue;
if (view === 'overview' && !active && visible >= 10) continue;
const row = rows.get(selected.campaign.id); row.hidden = false; visible++;
for (const link of row.querySelectorAll('.campaign-link,.open-cell > a')) link.href = reportHref(selected.campaign);
const result = row.querySelector('[data-index-row-status]'); result.textContent = selected.result; result.className = 'status status-' + selected.result;
row.querySelector('[data-index-row-counts]').textContent = selected.counts.passed + '/' + selected.counts.selected + (selected.narrowed ? ' matching executions passed' : state.suite ? ' suite executions passed' : ' passed') + ' · ' + selected.counts.executed + ' executed';
const coverageLabel = {full:'Full run',subset:'Subset selection',unfinished:'Unfinished full selection',unknown:'Coverage not established'}[selected.coverage];
row.querySelector('[data-index-row-coverage]').textContent = coverageLabel + (selected.suite ? ' · ' + selected.suite.selected + '/' + selected.suite.expected + ' selected' : '');
}
document.querySelector('[data-index-result]').textContent = visible + ' matching campaign' + (visible === 1 ? '' : 's') + (view === 'overview' && !active && candidates.length > 10 ? ' · Showing the 10 most recent; open Campaign history for all.' : '');
document.querySelector('[data-index-empty]').hidden = visible !== 0;
const presetHasSuite = data.campaigns.some(campaign => campaign.preset === state.preset && campaign.suites.some(suite => suite.id === state.suite));
const incompatiblePreset = state.suite && state.preset && !presetHasSuite;
document.querySelector('[data-index-empty-message]').textContent = incompatiblePreset
? 'No ' + selectedLabel + ' campaigns are included in ' + label('preset', state.preset) + '.'
: 'No campaigns match these filters.';
const suiteRuns = document.querySelector('[data-index-empty-suite]');
suiteRuns.hidden = !incompatiblePreset;
if (incompatiblePreset) {
suiteRuns.href = '?view=history&suite=' + encodeURIComponent(state.suite);
suiteRuns.textContent = 'View ' + selectedLabel + ' runs';
}
controls.coverage.closest('label').querySelector('span').textContent = state.suite ? 'Suite coverage' : 'Campaign coverage';
controls.coverage.setAttribute('aria-label',state.suite ? 'Suite coverage' : 'Campaign coverage');
document.querySelectorAll('[data-index-suite-link]').forEach(link => { if (link.dataset.indexSuiteLink === state.suite) link.setAttribute('aria-current','page'); else link.removeAttribute('aria-current'); });
document.querySelectorAll('[data-nav-view]').forEach(link => { if (link.dataset.navView === view && !state.suite) link.setAttribute('aria-current','page'); else link.removeAttribute('aria-current'); });
document.querySelectorAll('[data-index-preset-link]').forEach(link => { if (link.dataset.indexPresetLink === state.preset) link.setAttribute('aria-current','page'); else link.removeAttribute('aria-current'); });
document.querySelectorAll('[data-history-suite-trends]').forEach(section => { section.hidden = Boolean(state.suite) && section.dataset.historySuiteTrends !== state.suite; });
const crumbs = document.querySelector('[data-nav-breadcrumbs]'); crumbs.replaceChildren();
const home = document.createElement('a'); home.href = '?view=history'; home.textContent = 'E2E tests'; crumbs.append(home);
const separator = document.createElement('span'); separator.textContent = '/'; separator.setAttribute('aria-hidden','true'); crumbs.append(separator);
const current = document.createElement('span'); current.textContent = selectedLabel || (view === 'attention' ? 'Needs attention' : view === 'overview' ? 'Overview' : 'Campaign history'); current.setAttribute('aria-current','page'); crumbs.append(current);
};
const write = push => {
const url = new URL(location.href); url.search = ''; url.searchParams.set('view',view);
for (const name of names) if (state[name]) url.searchParams.set(name,state[name]);
history[push ? 'pushState' : 'replaceState'](null,'',url); read();
};
const read = () => {
const params = new URLSearchParams(location.search); view = ['history','attention'].includes(params.get('view')) ? params.get('view') : 'overview';
state = Object.fromEntries(names.map(name => [name,params.get(name) || '']));
for (const name of names) {
const control = controls[name];
if (control.tagName === 'SELECT' && state[name] && ![...control.options].some(option => option.value === state[name])) {
const option = document.createElement('option'); option.value = state[name]; option.textContent = 'Unknown: ' + state[name]; control.append(option);
}
control.value = state[name];
}
if (names.filter(name => !['suite','coverage','target','q'].includes(name)).some(name => state[name])) document.querySelector('[data-index-more]').open = true;
apply();
};
document.addEventListener('click', event => {
if (event.defaultPrevented || event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;
const link = event.target.closest('[data-index-suite-link],[data-index-preset-link],[data-nav-view]'); if (!link) return;
event.preventDefault();
if (link.hasAttribute('data-index-suite-link')) { state = { suite: link.dataset.indexSuiteLink }; view = 'history'; }
else if (link.hasAttribute('data-index-preset-link')) { state = {}; state.preset = link.dataset.indexPresetLink; view = 'history'; }
else { view = link.dataset.navView; if (view === 'overview') state = {}; }
write(true); window.scrollTo({top:0,behavior:'instant'});
});
for (const name of names) controls[name].addEventListener(name === 'q' ? 'input' : 'change', () => { state[name] = controls[name].value; write(name !== 'q'); });
document.querySelector('[data-index-reset]').addEventListener('click', () => {
state = {}; view = 'history';
const suiteSearch = document.querySelector('[data-index-suite-query]');
suiteSearch.value = ''; suiteSearch.dataset.filterActive = 'false';
document.querySelectorAll('.report-suite-catalog a').forEach(link => { link.hidden = false; });
write(true);
});
const suiteSearch = document.querySelector('[data-index-suite-query]');
suiteSearch.addEventListener('input', () => {
suiteSearch.dataset.filterActive = String(Boolean(suiteSearch.value));
for (const link of document.querySelectorAll('.report-suite-catalog a')) link.hidden = !link.textContent.toLowerCase().includes(suiteSearch.value.trim().toLowerCase());
});
window.addEventListener('popstate',read); read();
})();
`;