mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-08 21:35:36 +01:00
## Thinking Path > - Paperclip manages agent work through governed product workflows. > - Product E2E tests check those workflows through the real app and runner. > - The saved Product regression plan has 20 imported case identities. > - The plan has no live executor, so historical baseline rows do not qualify its current behavior. > - The existing paid full-stack workflow already owns all 20 required journeys. > - This change binds TestOps selection and reporting to that workflow without changing the product oracle or paid admission. > - Maintainers can run the plan and inspect current case verdicts and retained evidence. ## Linked Issues or Issue Description **What happened?** The standing Product regression plan has no executor. Its dashboard points at a historical 355-result snapshot across several suites and revisions. **Expected behavior** A TestOps plan run must select the intended existing full-stack cells, execute them on GitHub, and report their original case IDs, assertions and source revision. Missing evidence must remain a visible failure. **Steps to reproduce** Open the Product regression plan and inspect Executors. There is no live job. The existing full-stack workflow accepts exact cell IDs but has no TestOps selection or reporting path. **Paperclip version or commit** The branch includes reviewed master correction04a24f4e06. This change does not alter scenario prompts, models, deadlines or assertions. Related public work: #18542 establishes the separate chat-catalog lane. #18666 repairs its workflow URL binding. These changes do not implement this Product plan. ## What Changed - Add optional TestOps service inputs and a manual bootstrap selector to the existing full-stack workflow. - Map the original 20 case IDs and full names to existing native Codex/local cells, with the existing native OpenCode/local task-workspaces case. - Keep reporting tokens in trusted default-branch selection and publication jobs. Keep the existing paid provider authorization and protected environments. - Bind retained results to the workflow, job run, launch, source revision and selection hash. Preserve missing-result failures and earlier attempt verdict receipts. - Verify uploaded identities, coverage and verdicts. Document full-plan and subset reporting limits. - Keep the outstanding-decision reservation live while its existing deletion-fence test asserts the original 409 guard. Release the test provider in finally. Production deletion and accounting code stay unchanged. ## Verification - `node --test tests/runner-e2e/product-regression-testops.test.mjs`: 13 positive and negative controls pass, including the separated CLI handoff. - Existing paid-workflow security regression passes. - `actionlint -shellcheck= .github/workflows/runner-full-stack-e2e.yml`: passes. - The Product E2E catalog compatibility test confirms all 20 exact cells exist: passes. - `pnpm test:e2e:runner:typecheck`: passes. - Fresh Greptile review of final head61ef7a6eis 5/5 (11 files, no new findings); both initial reporting findings are repaired and resolved. - `server/src/__tests__/decision-models.test.ts`: all 37 controls pass on a disposable official PostgreSQL 18 container in 22.02 seconds. The unchanged focused case passed once and all five local samples; the original Linux CI failure remains retained. This is not a claimed deterministic local red reproduction. The new gate explicitly preserves the outstanding-reservation precondition. - The existing master readiness-fixture correction passes all three retained-workspace controls on the same database in 25.79 seconds. It is incorporated from master, not duplicated in this PR's diff. - Final-head Linux CI also passed all 37 decision-model controls in 7.047 seconds; the server shard passed 120 files and 2,004 tests. See [the retained successful shard](https://github.com/paperclipai/paperclip/actions/runs/41870214517/job/126715358759). - Previous CI failures are retained: [three stale readiness-fixture cases](https://github.com/paperclipai/paperclip/actions/runs/41864061890/job/126694812885) and [the reservation fixture race](https://github.com/paperclipai/paperclip/actions/runs/41864061890/job/126694812894). The separate [Canary Dry Run](https://github.com/paperclipai/paperclip/actions/runs/41864061890/job/126694811605) recorded a lost self-hosted runner connection before any step. The fixture repairs are verified on changed source; the separate Spot-interrupted CI attempt and its bounded retry are recorded below. - Actual one-cell GitHub canary on the unchanged product source: https://github.com/paperclipai/paperclip/actions/runs/41860189801 . The native Codex/local message-marker case passed all six assertions and cleanup in 35.24 seconds. The persisted issue is Done and its one run succeeded. This is supporting evidence; it is not TestOps acceptance. - Final-head CI attempt 1 was interrupted: three failed jobs have EC2 `Server.SpotInstanceTermination` receipts; six cancelled jobs show the same simultaneous shutdown. Original logs are retained. One [failed-job retry](https://github.com/paperclipai/paperclip/actions/runs/41870214517/attempts/2) passed all nine interrupted checks while preserving prior successful jobs. - Final-head full repository CI passes, including both required `ci / verify` and `ci / e2e` gates. GitHub still requires a non-author code-owner approval for the workflow change; normal auto-merge is queued. A fresh TestOps-triggered subset/full-plan acceptance remains pending. Local projection checks do not establish a live Product pass. ## Risks - The first bootstrap upload must establish the official TestOps job before the saved plan can use it. - This lane tests one declared local native configuration per case. It does not qualify the historical 355-row matrix. - Upload failures remain visible. A missing retained report produces broken case results and cannot pass. - The existing non-TestOps campaign path must keep its selection and scheduling behavior; paid-workflow regression coverage remains in place. ## Model Used OpenAI Codex with reasoning, code execution and tool use. The host does not expose the exact model ID or context window to 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>
164 lines
12 KiB
JavaScript
164 lines
12 KiB
JavaScript
import { createHash, randomUUID } from 'node:crypto';
|
|
|
|
// These are the standing, reviewed TestOps plan-2 identities. A case selects one
|
|
// existing full-stack cell; it does not change the prompt, matcher or runtime.
|
|
export const productRegressionCases = [
|
|
[8, 'core-compatibility', 'plan-revise-accept'],
|
|
[9, 'configured-repository', 'repository-output'],
|
|
[30, 'core-compatibility', 'ask-question'],
|
|
[32, 'first-task', 'reject-no-execution'],
|
|
[35, 'agent-chat', 'reassign-task'],
|
|
[45, 'agent-chat', 'multi-repository'],
|
|
[54, 'task-workspaces', 'task-directory-repository-resume', 'runner-opencode'],
|
|
[60, 'first-task', 'task-card-accept'],
|
|
[61, 'continuation', 'completed-action-resume'],
|
|
[62, 'agent-chat', 'clarify-reuse'],
|
|
[66, 'core-compatibility', 'message-marker'],
|
|
[68, 'continuation', 'revision-preserves-approval'],
|
|
[112, 'agent-chat', 'create-backlog'],
|
|
[123, 'first-task', 'revise-accept'],
|
|
[134, 'first-task', 'clarify-propose-accept'],
|
|
[140, 'agent-chat', 'stop-new-resume'],
|
|
[145, 'agent-chat', 'continuity-restart'],
|
|
[159, 'continuation', 'clarification-not-approval'],
|
|
[164, 'agent-chat', 'plan-handoff'],
|
|
[168, 'agent-chat', 'new-session'],
|
|
].map(([id, suite, name, profile = 'runner-codex']) => Object.freeze({
|
|
id, suite, name, profile,
|
|
fullName: `paperclip.Product E2E.${suite}.${name}`,
|
|
executionId: `${suite}.${profile}.local.${name}`,
|
|
}));
|
|
|
|
const fail = code => { throw new Error(`product_regression_testops_${code}`); };
|
|
const sha = value => createHash('sha256').update(value).digest('hex');
|
|
const identifier = value => typeof value === 'string' && /^[a-zA-Z0-9._:-]{1,200}$/.test(value);
|
|
const modelIdentifier = value => typeof value === 'string' && /^[a-zA-Z0-9][a-zA-Z0-9._:/-]{0,199}$/.test(value);
|
|
export const endpoint = 'https://paperclip.testops.cloud';
|
|
export const workflowUrl = 'https://github.com/paperclipai/paperclip/actions/workflows/runner-full-stack-e2e.yml';
|
|
// Official GitHub/Allure job metadata uses these exact aliases for workflow
|
|
// 343807492, independently read from GitHub's workflow API before registration.
|
|
export const workflowUrls = new Set([workflowUrl,
|
|
'https://github.com/paperclipai/paperclip/blob/master/.github/workflows/runner-full-stack-e2e.yml',
|
|
'https://github.com/paperclipai/paperclip/actions/workflows/343807492',
|
|
]);
|
|
|
|
export function selectProductRegression(plan, manual = 'all', fromTestOps = false) {
|
|
if (fromTestOps && !plan) fail('plan_required');
|
|
if (plan) {
|
|
if (plan.version !== '1.0' || !Array.isArray(plan.tests) || !plan.tests.length || plan.tests.length > productRegressionCases.length) fail('plan_invalid');
|
|
const selected = plan.tests.map(test => {
|
|
const row = productRegressionCases.find(value => String(value.id) === String(test.id));
|
|
if (!row || test.selector !== row.fullName) fail('case_mismatch');
|
|
return row;
|
|
});
|
|
if (new Set(selected.map(row => row.id)).size !== selected.length) fail('duplicate_case');
|
|
return selected.sort((a, b) => a.id - b.id);
|
|
}
|
|
if (manual === 'all') return [...productRegressionCases];
|
|
const selected = productRegressionCases.find(row => row.name === manual || String(row.id) === manual);
|
|
if (!selected) fail('manual_selection_invalid');
|
|
return [selected];
|
|
}
|
|
|
|
export function validateSelection(value, env) {
|
|
if (value?.schema !== 'paperclip.product-regression-testops-selection/v1'
|
|
|| value.runId !== env.GITHUB_RUN_ID || value.attempt !== env.GITHUB_RUN_ATTEMPT
|
|
|| value.workflowSha !== env.GITHUB_SHA || !/^[a-f0-9]{40}$/.test(value.workflowSha)
|
|
|| value.targetSha !== env.SOURCE_SHA || !/^[a-f0-9]{40}$/.test(value.targetSha)
|
|
|| !/^[1-9][0-9]{0,15}$/.test(value.jobRunId) || !Array.isArray(value.cases)
|
|
|| !value.cases.length || value.cases.length > productRegressionCases.length) fail('selection_binding');
|
|
const selected = selectProductRegression({ version: '1.0', tests: value.cases.map(row => ({ id: row.id, selector: row.fullName })) }, 'all', true);
|
|
if (JSON.stringify(selected) !== JSON.stringify(value.cases)) fail('selection_binding');
|
|
return value;
|
|
}
|
|
|
|
export function projectProductResults(campaign, selection, sourceSha) {
|
|
if (!/^[a-f0-9]{40}$/.test(sourceSha)) fail('source_missing');
|
|
if (campaign && (campaign.schema !== 'paperclip.runner-e2e.campaign/v2'
|
|
|| campaign.campaignId !== `gha-${selection.runId}-${selection.attempt}` || campaign.source?.sha !== sourceSha
|
|
|| !Array.isArray(campaign.results) || !Array.isArray(campaign.expected)
|
|
|| JSON.stringify([...campaign.expected].sort()) !== JSON.stringify(selection.cases.map(row => row.executionId).sort()))) fail('report_binding');
|
|
const rows = campaign?.results ?? [];
|
|
if (rows.length > selection.cases.length || new Set(rows.map(row => row.executionId)).size !== rows.length
|
|
|| rows.some(row => !selection.cases.some(value => value.executionId === row.executionId))) fail('unexpected_result');
|
|
const accounting = campaign?.accounting;
|
|
if (accounting && (accounting.version !== 1 || !['retained_attempts', 'selected_results'].includes(accounting.scope)
|
|
|| !Array.isArray(accounting.attempts) || accounting.attempts.length > selection.cases.length * 10
|
|
|| !Number.isSafeInteger(accounting.missingAttempts) || accounting.missingAttempts < 0
|
|
|| !Number.isSafeInteger(accounting.excludedArtifacts) || accounting.excludedArtifacts < 0
|
|
|| accounting.attempts.some(row => !selection.cases.some(value => value.executionId === row.executionId)
|
|
|| !Number.isSafeInteger(row.attempt) || row.attempt < 1 || row.attempt > 10
|
|
|| !['passed', 'failed'].includes(row.status) || !['passed', 'failed', 'not_started'].includes(row.cleanup)))) fail('accounting_invalid');
|
|
const records = [], summaries = [];
|
|
for (const selected of selection.cases) {
|
|
const attempts = rows.filter(row => row.executionId === selected.executionId).sort((a, b) => a.attempt - b.attempt);
|
|
if (new Set(attempts.map(row => row.attempt)).size !== attempts.length) fail('duplicate_attempt');
|
|
if (!attempts.length) attempts.push(null);
|
|
for (const result of attempts) {
|
|
const missingArtifact = result?.attempt === 0 && result.status === 'failed'
|
|
&& result.failureClass === 'permanent_infrastructure' && result.cleanup === 'not_started'
|
|
&& result.error === 'No result artifact was uploaded' && result.matcherResults === undefined;
|
|
if (result && ((!missingArtifact && result.source?.sha !== sourceSha)
|
|
|| (missingArtifact && result.source?.sha != null && result.source.sha !== sourceSha)
|
|
|| result.suiteId !== selected.suite || result.caseId !== selected.name
|
|
|| result.profileId !== selected.profile || result.environmentId !== 'local'
|
|
|| !Number.isSafeInteger(result.attempt) || result.attempt < (missingArtifact ? 0 : 1) || result.attempt > 10
|
|
|| !['passed', 'failed'].includes(result.status) || (!missingArtifact && !Array.isArray(result.matcherResults)))) fail('result_binding');
|
|
const checks = result?.matcherResults ?? [];
|
|
if (checks.length > 300 || checks.some(check => typeof check.passed !== 'boolean')) fail('checks_invalid');
|
|
const passed = result?.status === 'passed' && result.cleanup === 'passed' && checks.length > 0 && checks.every(check => check.passed);
|
|
const infrastructure = !result || ['permanent_infrastructure', 'transient_infrastructure', 'setup_blocked'].includes(result.failureClass);
|
|
const status = passed ? 'passed' : infrastructure ? 'broken' : 'failed';
|
|
const provenance = {
|
|
schema: 'paperclip.product-regression-testops-result/v1', caseId: selected.id,
|
|
executionId: selected.executionId, workflowRunId: selection.runId, workflowAttempt: selection.attempt,
|
|
workflowSha: selection.workflowSha, sourceSha, status, originalStatus: result?.status ?? null,
|
|
attempt: result?.attempt ?? null, cleanup: result?.cleanup ?? 'not_started',
|
|
profile: selected.profile, environment: 'local',
|
|
model: modelIdentifier(result?.model) ? result.model : null,
|
|
suiteDefinitionHash: /^[a-f0-9]{64}$/.test(result?.suiteDefinitionHash ?? '') ? result.suiteDefinitionHash : null,
|
|
failureClass: identifier(result?.failureClass) ? result.failureClass : null,
|
|
durationMs: Number.isFinite(result?.durationMs) && result.durationMs >= 0 ? result.durationMs : null,
|
|
checks: checks.map(check => ({
|
|
name: identifier(check.matcher?.path) ? check.matcher.path : identifier(check.matcher?.kind) ? check.matcher.kind : 'assertion',
|
|
passed: check.passed,
|
|
})),
|
|
retainedAttempts: (accounting?.attempts ?? []).filter(row => row.executionId === selected.executionId).map(row => ({
|
|
attempt: row.attempt, status: row.status, cleanup: row.cleanup,
|
|
durationMs: Number.isFinite(row.durationMs) && row.durationMs >= 0 ? row.durationMs : null,
|
|
startedAt: Number.isFinite(Date.parse(row.startedAt)) ? new Date(row.startedAt).toISOString() : null,
|
|
finishedAt: Number.isFinite(Date.parse(row.finishedAt)) ? new Date(row.finishedAt).toISOString() : null,
|
|
})),
|
|
attemptAccounting: accounting ? { scope: accounting.scope, missingAttempts: accounting.missingAttempts,
|
|
excludedArtifacts: accounting.excludedArtifacts } : null,
|
|
note: result && !missingArtifact ? 'Original full-stack assertions, attempts and diagnostics remain in the linked workflow report.'
|
|
: 'No bound full-stack result was retained. This case is unverified and cannot pass.',
|
|
};
|
|
const uuid = randomUUID(), attachment = `${randomUUID()}-attachment.json`;
|
|
const value = {
|
|
uuid, name: selected.name, fullName: selected.fullName, testCaseId: sha(selected.fullName),
|
|
historyId: sha(JSON.stringify([selected.fullName, selected.profile, provenance.model, 'local'])),
|
|
status, stage: 'finished', statusDetails: { message: provenance.note },
|
|
labels: [{ name: 'AS_ID', value: String(selected.id) }, { name: 'parentSuite', value: 'Product E2E' },
|
|
{ name: 'suite', value: selected.suite }, { name: 'framework', value: 'Paperclip Evals' }],
|
|
parameters: [{ name: 'profile', value: selected.profile }, { name: 'environment', value: 'local / GitHub Actions' },
|
|
{ name: 'model', value: provenance.model ?? 'Not recorded' }, { name: 'sourceSha', value: sourceSha }],
|
|
links: [{ name: 'Full-stack execution and retained diagnostics', type: 'custom',
|
|
url: `https://github.com/paperclipai/paperclip/actions/runs/${selection.runId}` },
|
|
{ name: 'Evaluated source', type: 'custom', url: `https://github.com/paperclipai/paperclip/commit/${sourceSha}` }],
|
|
attachments: [{ name: 'Bound execution provenance and assertions', source: attachment, type: 'application/json' }],
|
|
steps: provenance.checks.map(check => ({ name: check.name, status: check.passed ? 'passed' : 'failed', stage: 'finished' })),
|
|
};
|
|
if (result && !missingArtifact) for (const [key, date] of [['start', result.startedAt], ['stop', result.finishedAt]]) {
|
|
const timestamp = Date.parse(date);
|
|
if (Number.isFinite(timestamp)) value[key] = timestamp;
|
|
}
|
|
records.push({ file: `${uuid}-result.json`, value }, { file: attachment, value: provenance });
|
|
if (result === attempts.at(-1)) summaries.push({ caseId: selected.id, status });
|
|
}
|
|
}
|
|
return { records, summary: { selected: selection.cases.length, passed: summaries.filter(row => row.status === 'passed').length,
|
|
failed: summaries.filter(row => row.status === 'failed').length, broken: summaries.filter(row => row.status === 'broken').length,
|
|
fullPlan: selection.cases.length === productRegressionCases.length, cases: summaries } };
|
|
}
|