From 9d9ee92d156153eaf16b7ae0fbd70f535175358d Mon Sep 17 00:00:00 2001 From: Dotta <34892728+cryppadotta@users.noreply.github.com> Date: Fri, 13 Nov 2026 12:56:40 -0600 Subject: [PATCH] refactor(evals): remove the orphaned chat TestOps dispatch guard (#21241) ## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - The chat catalog eval harness sends selected cases to TestOps plans through GitHub workflows. > - PR #18322 added a dispatch guard script for the `chat-feature-testops` workflow. The guard checked each dispatch event before the workflow could use credentials. > - PR #18625 retired the duplicate chat TestOps plans. That PR deleted the `chat-feature-testops` workflow, the workflow step that ran the guard, and the only import of the guard function. > - The guard file stayed in the repository after that removal, but nothing calls it now. > - This pull request deletes the unused guard file. > - The benefit is less test support code to maintain. No protection is lost, because the workflow it guarded no longer exists. ## Linked Issues or Issue Description No public issue exists for this cleanup. The problem is described here, following the enhancement template. **What existing behavior does this improve?** The chat TestOps eval support under `tests/runner-e2e`. The guard script `testops-chat-dispatch.ts` verified workflow dispatch events for a retired workflow. **Current behavior** `tests/runner-e2e/testops-chat-dispatch.ts` holds a guard for the `chat-feature-testops` workflow. That workflow was deleted in #18625. A search of all tracked file content finds no import, no run command, and no test that uses the guard file today. **Proposed behavior** The repository does not keep the unused guard file. The runner-e2e typecheck program and the test tree load one support file less. **Reason and benefit** The guard protected a workflow dispatch path that no longer exists. Keeping the file suggests a live guard where none runs. Deleting it removes 31 lines of test support code. No regression coverage is lost: no test executes the file, and the contract it guarded is retired. **Breaking changes** None. The deleted file has no callers. No workflow, script, test, or documentation references it. ## What Changed - Deleted `tests/runner-e2e/testops-chat-dispatch.ts` (31 lines of test support code). No production code changed. ## Verification - Searched all tracked file content for `testops-chat-dispatch`, `validateChatTestOpsDispatch`, and `ChatTestOpsDispatch`. Only the deleted file matched. - Checked every selection path that could run the file: it is not a `*.test.ts` file; the runner-e2e harness selects test files through the catalog manifest, which does not name it; the root vitest projects do not include `tests/`; the `node --test` script lists do not name it; no workflow runs it. - Confirmed the history: #18322 added the file; #18625 deleted the workflow step `node tests/runner-e2e/testops-chat-dispatch.ts` and removed the only import and the assertions that referenced it; no commit touched the file after that. - Local limitation: this workspace has no installed dependencies, so the layered typecheck and the vitest suites could not run locally. The CI lanes on this pull request must confirm them. ## Risks - Low risk. The file had no callers. The remaining risk is a hidden reference that a text search cannot find. The typecheck lane and the CI test lanes on this pull request would find such a reference. ## Model Used - GLM by Z.ai, model id `z-ai/glm-5.3`, run through opencode by the Paperclip Runner. Extended reasoning enabled, with shell and file tool use. ## 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 - [ ] I have run tests locally and they pass - [ ] 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 - [ ] All Paperclip CI gates are green - [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [ ] I will address all Greptile and reviewer comments before requesting merge --- tests/runner-e2e/testops-chat-dispatch.ts | 31 ----------------------- 1 file changed, 31 deletions(-) delete mode 100644 tests/runner-e2e/testops-chat-dispatch.ts diff --git a/tests/runner-e2e/testops-chat-dispatch.ts b/tests/runner-e2e/testops-chat-dispatch.ts deleted file mode 100644 index 29047e2cf6d..00000000000 --- a/tests/runner-e2e/testops-chat-dispatch.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { execFileSync } from "node:child_process"; -import { appendFileSync, lstatSync, readFileSync } from "node:fs"; -import { pathToFileURL } from "node:url"; - -export function validateChatTestOpsDispatch(env: NodeJS.ProcessEnv, event: unknown, triggeringActorId: number) { - const e = event as { ref?: unknown; sender?: { id?: unknown }; repository?: { full_name?: unknown; private?: unknown; default_branch?: unknown }; inputs?: Record }; - const branch = e.repository?.default_branch, allowed = JSON.parse(env.TESTOPS_ALLOWED_ACTOR_IDS ?? "null"); - const operation = e.inputs?.operation ?? "evaluate"; - if (env.GITHUB_ACTIONS !== "true" || env.GITHUB_EVENT_NAME !== "workflow_dispatch" || env.GITHUB_REPOSITORY !== "paperclipai/paperclip" - || e.repository?.full_name !== "paperclipai/paperclip" || e.repository.private !== false || typeof branch !== "string" || !/^[A-Za-z0-9._/-]+$/.test(branch) - || env.GITHUB_REF !== `refs/heads/${branch}` || e.ref !== env.GITHUB_REF || env.GITHUB_WORKFLOW_REF !== `paperclipai/paperclip/.github/workflows/chat-feature-testops.yml@refs/heads/${branch}` - || !/^[a-f0-9]{40}$/.test(env.GITHUB_SHA ?? "") || env.GITHUB_RUN_ATTEMPT !== "1" || !/^[1-9][0-9]{0,19}$/.test(env.GITHUB_RUN_ID ?? "") - || !/^[1-9][0-9]{0,19}$/.test(env.GITHUB_ACTOR_ID ?? "") || e.sender?.id !== Number(env.GITHUB_ACTOR_ID) - || !Array.isArray(allowed) || !allowed.length || allowed.some(v => !Number.isSafeInteger(v) || v <= 0) || !allowed.includes(Number(env.GITHUB_ACTOR_ID)) || !allowed.includes(triggeringActorId) - || !e.inputs || Object.keys(e.inputs).some(k => !["operation", "ALLURE_JOB_RUN_ID", "ALLURE_USERNAME"].includes(k)) || !["bootstrap", "launch-plan", "evaluate"].includes(String(operation)) - || operation === "evaluate" && !/^[1-9][0-9]{0,19}$/.test(String(e.inputs.ALLURE_JOB_RUN_ID ?? "")) - || operation !== "evaluate" && (e.inputs.ALLURE_JOB_RUN_ID ?? "") !== "") throw new Error("Chat TestOps dispatch rejected"); - return { sha: env.GITHUB_SHA!, operation: String(operation), triggeringActorId: String(triggeringActorId) }; -} - -if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) { - try { - if (!/^[A-Za-z0-9-]{1,39}$/.test(process.env.GITHUB_TRIGGERING_ACTOR ?? "")) throw new Error("Invalid actor"); - const file = process.env.GITHUB_EVENT_PATH!; - const stat = lstatSync(file); - if (!stat.isFile() || stat.isSymbolicLink() || stat.size > 65536) throw new Error("Invalid event"); - const actor = Number(execFileSync("gh", ["api", `users/${process.env.GITHUB_TRIGGERING_ACTOR}`, "--jq", ".id"], { encoding: "utf8", timeout: 30_000, stdio: ["ignore", "pipe", "pipe"] }).trim()); - const checked = validateChatTestOpsDispatch(process.env, JSON.parse(readFileSync(file, "utf8")), actor); - appendFileSync(process.env.GITHUB_OUTPUT!, `sha=${checked.sha}\noperation=${checked.operation}\ntriggering_actor_id=${checked.triggeringActorId}\n`); - } catch { process.stderr.write("Fixed chat TestOps dispatch identity rejected before credential access\n"); process.exitCode = 1; } -}