openclaw/test/scripts/plugin-prerelease.test-support.ts
Peter Steinberger ae36330b76
test: remove low-value tests (batch d469) (#182595)
* test(ui): deslop q0203 tests

Remove duplicate scratch E2E and its CI path registrations. Retained proof: cron-migrated-policies.e2e.test.ts covers on-demand loading and editing; scratch-editor.test.ts covers read admission, read failures and access retirement; cron-page.test.ts covers removal of admin-only scratch after access loss.

Trim LM Studio fixture repetition and a viewport transition immediately reset by returnToLocalModelSettings. Preserve IME, mobile Files placement, image retry authorization and cold tooltip browser regressions. CI-only campaign: oxfmt, oxlint and diff checks passed; tests and coverage deferred to hosted CI.

* test(scripts): deslop q0202 tests

Remove copied compatibility inventories and manifest metadata assertions. Keep deployment wiring, secret references, security context and persistence checks.

The retained mixed proof-video render case covers caption timing and speed filters; the zoom-only case retains the no-annotation path. Inventory CLI invalid-argument representatives and test/scripts/arg-utils.test.ts cover removed same-path parser variants.

Reuse a real backpressure-controlled response fixture for size and timeout cancellation, and match persisted timing metadata without masking its timestamp.

CI-only: oxfmt, diff-check and plain oxlint passed. No tests or coverage run. Cut 70 of 1030 lines (6.8%); remaining publication, lifecycle, SQLite and CI planner branches prevented the 40% target without loss of distinct proof.

* test(scripts): consolidate q0202 owner coverage

Replace the copied kustomization inventory and fixed cross-manifest names with generic completeness and wiring invariants. Retain credential, writable-state and gateway security assertions. Drop report metadata and wording restatements.

Exercise shared inventory argument parsing once, retaining both CLI boundaries and the env-only flag. Renderer limits remain covered by test/scripts/test-env-mutation-report.test.ts and test/scripts/test-skip-inventory.test.ts; generic flag rejection remains in test/scripts/arg-utils.test.ts.

Chunk timing isolation is covered by test/scripts/test-projects-build-admission.test.ts: records inherited include selections without replacing whole-config history, and carries chunk targets without changing launch selection. Basic docs-map creation/removal is covered by test/e2e/qa-lab/runtime/package-openclaw-for-docker.e2e.test.ts: keeps the docs-map lock when changelog restoration fails. Retain concurrent ownership, operator-edit refusal and interrupted cleanup cases here.

Remove the empty-selection replay of the default publication branch, redundant SQLite spawn-shape/file-read assertions, and the Windows single-file inventory replay. Shrink caption and changelog fixtures.

CI-only: plain oxlint, oxfmt and git diff --check passed; no tests or coverage run. Additional reduction: 960 to 806 lines. Total from shard base: 1030 to 806 (21.7%); below the 40% goal because the remaining owner branches and safety/recovery checks are distinct.

* test(scripts): remove remaining q0202 release replays

Use the real CLI coverage in test/scripts/release-verify-publish.test.ts for direct qualified success, baseline published-registry success, missing tarballs and missing planned publishers. Its gates release success on qualified plugin readback cases call the actual readback owner and assert CLI success, failure and evidence. Keep the detailed unique fault matrix and superseded-registry case here.

Share the SQLite success fixture across platform rows without dropping manifest, library or Linux directory assertions. Simplify the bounded response stream fixture and remove a catalog nonemptiness assertion.

CI-only: oxfmt, plain oxlint and git diff --check passed; no tests or coverage run. Additional 18 lines removed; total shard 1030 to 788 (23.5%). Independent read-only audit found no safe whole-file layer deletion: workflow tests stub Windows placement, K8s deploy tests do not inspect manifests, and FFmpeg output and publication faults retain unique behavior. The 40% target remains unmet.

* test(scripts): deslop q0204 tests

Reuse existing fixture writers, compact security inputs and share CLI assertions without dropping distinct cases. Remove the retired SDK alias inventory and the duplicate foreign-runner rejection: frozen-with-own-runner still exercises loadWorkerOwner's mismatched owner rejection. The chunk-boundary request-log case retains successful OpenAI endpoint detection.

Static census: 992 to 938 lines, 31 to 30 declarations, 46 to 44 expanded cases. Below the 40% target: remaining suites cover distinct preload, release rendering, CI ownership, diagnostics, report validation and artifact security boundaries. CI-only instructions: formatting, diff check and plain oxlint pass; tests and coverage intentionally not run.

* test(scripts): cut redundant q0204 fixture layers

Replace the copied source-I/O inventory with a generic duplicate-read invariant and retain rule/root/line ordering without exact diagnostic prose. Keep one quarantine fixture per decision branch, removing duplicate suffix and symlink variants plus log wording checks.

The remaining docs-mirror index case covers split lookup; legacy markup covers HTML conversion. Mirror production belongs to release-changelog.test.ts (release docs mirrors), so feed the HTML consumer a minimal mirror fixture rather than rebuilding docs. Keep the release-sized appendix regression, built AI package proof, worker ownership boundaries, and wrapper-specific log-tail/regex-chunk checks: their distinct behavior is not proved by another owner.

CI-only: oxfmt, diff check and plain oxlint pass; no tests or coverage run. Follow-up saves 52 lines (938 to 886); cumulative shard reduction is 106/992 lines (10.7%), below the requested 40% because the remaining cases have unique boundary coverage. No files deleted or production changes.

* test(auto-reply): deslop q0207 tests

Share held-producer and reply-capture fixtures while retaining native Stop settlement and reset self-preemption regression coverage (8bd1e73f90).

Remove duplicate bare /new assertion and its otherwise unused helper: acknowledges bare command without invoking the model or loading startup memory retains the same acknowledgement and no-agent checks. All declared cases remain; this shard cannot reach the 40 percent target without dropping distinct lifecycle, routing, authorization, or persistence proof. CI-only validation: oxfmt, oxlint and git diff --check.

* test(auto-reply): remove q0207 owner-covered e2e replays

Keep native idle-topic self-preemption regression, authorization, model/auth target routing, and worker compaction with persisted-count assertion. Inline single-use setup and minimize startup-memory fixtures.

Coverage retained: abort.test.ts fast-aborts authorized slash stop before queuing even with text commands disabled, plus persists cutoff only for the command's own session; abort.target-owner.test.ts stops a running request's command while preserving its independent service; queue/lifecycle.test.ts retains source custody during pending abandonment; queue/cleanup.delivery-correlations.test.ts settles captured pending, summary and elided sources once through stop. session-rollover-preemption.test.ts preempts a running turn and cancels two queued follow-ups before /new resets. commands-compact.test.ts routes manual compaction with explicit trigger and context metadata; retained worker case also asserts compactionCount.

Shard 831 -> 497 lines (-40.2%; previous commit 797). No source-grep inventories or obsolete subjects found. CI-only validation: oxfmt, oxlint, git diff --check; no tests run.

* test(sdk): deslop q0209 tests

Remove namespace replays covered by index.test.ts list defaults, tool invocation, approval RPCs, and model status. Transport retry ownership remains covered by transport.test.ts: ignores stale connection failures after a replacement client starts.

Consolidate real Gateway event mapping into the late-replay scenario while retaining start, assistant, completion, and ordered live-tail assertions. Keep the writer takeover and live-provider scenarios. Replace the packed consumer RPC dispatcher with one strict wait contract; artifact and environment RPC behavior remains in index.test.ts.

CI-only validation: oxfmt, plain oxlint, and git diff --check pass. No tests or coverage run. Lines 572 -> 470 (17.8%); the 40% target is not met because unique SDK, lifecycle, live, and package boundary contracts remain.

* test(sdk): remove duplicate q0209 e2e layers

The superseded-writer scenario is identical to packages/sdk/src/terminal-outcome.e2e.test.ts, which remains its real-Gateway owner for cancellation order, stored writer, event and wait status. Remove the redundant copy and its imports.

Keep one canonical protocol-type identity invariant instead of seven additional re-export inventory assertions. Preserve the packed consumer projection fixtures and custom transport proof. Share namespace response and event emission setup; remove live list smoke already covered by index.test.ts list-default and model-auth tests while retaining the real live run.

Cumulative shard lines: index.e2e.test.ts 456 -> 261; app-sdk-external-boundary.e2e.test.ts 116 -> 82; total 572 -> 343 (-40.03%). Additional commit only. CI-only: oxfmt, plain oxlint, and diff checks pass; no test or coverage runs.

* test(infra): deslop q0206 tests

Keep ordinary doctor-failure rollback in package-update-self-replay.e2e.test.ts; retain npm wrapper failure reporting and unsafe recovery in the late recovery refusal case. Remove the obsolete validation exchange from the repair worker harness: current workers defer released starts and execute delegated turns without parent validation. Preserve all seven repair boundary cases and both relocated-runtime cases.

* test(infra): prune duplicate q0206 e2e scenarios

Retain malformed-envelope coverage in update-repair.worker.test.ts: bounds parse-error reasons and emits responses the released parser accepts. Keep real-process receiver binding, requester revocation, manual repair, and released-start behavior.

Keep late replay and rollback in package-update-self-replay.e2e.test.ts; preserve-only behavior in package-update-activation-lifetime.test.ts (preserves local overrides from the activation-owned displaced tree); conflict detection in package-local-overrides.test.ts (preserves concurrent bytes during unrecorded); symlink rejection in package-dist-inventory.test.ts (rejects symlinked entries at the inventory boundary); failed installation cleanup in package-update-steps.test.ts (bounds npm ECONNRESET retry).

Reuse the existing model configuration builder and remove the custom stdout/stderr diagnostic layer. CI-only: no tests or coverage run; oxlint, oxfmt, and diff checks passed. Remaining native relocation, npm integration, and repair authority harnesses prevent an honest 40 percent line reduction.

* test(infra): consolidate q0206 e2e harnesses

Merge the three remaining override scenarios into the self-replay suite. Exercise real npm packaging, installation, CLI output, override notices, and recovery through an installed bundled updater with copied native dependencies. Retain independent cases for successful late replay, doctor rollback, no changes, legacy inventory, and late recovery refusal; remove the duplicate package harness.

Leave repair E2E focused on real manual repair and released-parent deferral. Delegated success and requester revocation remain in update-repair-turn-worker.test.ts (checks before effects; keeps in-turn liveness cheap and refuses revoked authority before tool effects). Receiver PID/start rejection remains in update-command-executor.test.ts (checks the Windows receiver live handoff identity, including foreign receivers) and update-command-executor-reader.test.ts (does not reuse a live row as proof of a changed process identity). Native positive delegation remains in update-command-executor-native.test.ts.

Original shard: 903 lines. Consolidated shard: 525 lines (-41.9%), 18 expanded cases to 7. CI-only: no test or build execution. Oxlint, oxfmt, diff-check, and embedded runner syntax checks passed; both kept files remain in the same E2E include glob.

* test(scripts): deslop q0211 tests

Share cloudflared fixture writes without changing staging, checksum, architecture, or preservation assertions. Remove the full UI plus owner matrix replay: the retained full UI/no-owner rows exercise the same full override, and the non-full owner row retains owner selection coverage.

CI-only audit: preserve distinct release profile, survivor, native build failure, and checkpoint admission boundaries. This shard was already compact; avoid dropping those behaviors to force the line target. Static oxlint and formatting checks pass; test execution is deferred to hosted CI.

* test(scripts): remove q0211 UI selection replays

Keep full-CI UI override with Node enabled and disabled, and scheduled-main equivalence. Ordinary selected-file projection remains covered by ci-workflow-planning.test.ts: projects one selected test set into dedicated jobs. Owner selection and partitioning remain covered by ci-ui-e2e-selection.test.ts: selects and publishes selection cases.

Remove duplicate matrix bookkeeping and the generic options wrapper. Other shard files retain their unique native execution, package preparation, and final Git-admission boundary proof. CI-only: oxlint, oxfmt, and git diff --check pass; no tests executed.

* test(scripts): trim q0211 fixture and branch replays

Remove the full release-profile replay: releasePathChunkLanes distinguishes beta from the shared stable/full path, which the retained beta and stable rows cover. Retain one denied arbitrary Git write plus malformed allowlisted commands, wrong cwd, redirected env, stale ownership, symlink, escaped root, and missing-root checks.

Share the native shell fixture writer, omit irrelevant consumer deployment metadata, and remove the one-child cloudflared suite wrapper. Keep all native execution, integrity, publication package, and admission assertions. CI-only: oxfmt, oxlint, and diff checks pass; no tests executed.

* test(secrets): deslop q0213 tests

Remove opt-in screenshot/video capture plumbing while retaining all nine browser cases and their behavioral assertions. Keep layout, contrast, validation, save/import, method discovery, and reconnect authority coverage intact.

* test(secrets): consolidate q0213 browser proof

Combine name/action layout probes by responsive and pointer branch. Keep measured bounds and wrapping; remove copied CSS declarations. Merge save/import proof into the validation workflow and keep both reconnect deletion authority cases.

Remaining owner proof: ui/src/pages/secrets/view.test.tsx: never renders a secret value even when hostile input carries one; hides mutation controls when the gateway does not advertise them. ui/src/lib/gateway-methods.test.ts: blocks method catalog omitted calls. ui/src/lib/secrets-store/index.test.ts: reloads the canonical list after a set; reloads after every sequential bulk set. Empty add/edit rejection shares submitDraft validation; retain edit rejection and successful add.

CI-only: formatting, diff-check, and plain oxlint passed. No test or coverage runs. Shard reduced from 484 to 288 lines overall.

* test(ui): deslop q0212 tests

Share browser lifecycle, detail navigation, publisher checks, and clamp assertions. Remove optional screenshot capture plumbing and redundant inventory/preview replays.

Retained owner proof: claws-home.test.ts lists every release file inline and opens every release file without treating help as navigation. Keep responsive geometry, keyboard tooltip behavior, publisher refresh, and add-to-chat checks here. Retain the narrow-card regression from 2b18fc8eb8.

CI-only: oxlint, oxfmt, and diff checks pass; no tests or coverage run. 491 to 369 lines (24.8%); 4 declarations and 7 expanded cases retained. Below the 40% target to preserve distinct behavior.

* test(ui): consolidate q0212 catalog e2e coverage

Remove catalog metadata inventories and replayed content checks. Merge stale publisher verification into the personal Claw add-to-chat flow, keeping all four responsive cases and the narrow-card regression.

Owner proof retained: claws-home.test.ts lists every release file inline and opens every release file without treating help as navigation; claws-workspace-files.test.ts distinguishes canonical roles and accessible purposes; plugin-skills.e2e.test.ts opens the full bundle from installed settings and checks shared description clamping. Keep Claw skill content wiring, workspace clamping, tooltip interaction, installed/empty sections, and chat.send here.

Shrink unused fixture metadata and share the agent roster. No subjects were obsolete. CI-only: oxfmt, oxlint, and diff checks pass; no test or coverage runs. Shard 491 to 289 lines (41.1% reduction), follow-up 369 to 289.

* test(ollama): deslop q0210 tests

Consolidate repeated node.invoke envelopes, inline the single-use HTTP auth wrapper, capture fake-server state locally, and use the stream consumer for request JSON. Keep the paired-node transport scenario and all distinct assertions; the removed command assertion remains in waitForPairedInferenceNode.

Retain readiness and cleanup protections from 42e9558110 and the strict model request fixture from 865a7286c8. CI-only validation: plain oxlint, oxfmt, and git diff --check passed. No test or coverage runs. Test LOC 625 to 583; one case retained. Below the 40 percent target because the remaining harness protects real pairing, transport, phase deadlines, and child/state lifetime.

* test(ollama): consolidate q0210 paired-node harness

Reduce the shard from 625 baseline lines to 375 while retaining its single real Gateway and paired-node scenario. Replace bespoke HTTP server cleanup with withServer, share connection/pairing state, and use authenticated hello as the startup readiness boundary instead of duplicate health polling. Keep the 90-second test timeout and bounded startup, pairing, inference, and shutdown.

The removed request-format assertions remain covered by node-inference.test.ts: runs bounded chat and returns compact usage. Successful discovery and chat cover the removed command/path inventories. Retain 401 rejection, discovery beyond 200 embeddings, cloud filtering, loaded-first order, strict model request field, response/usage, and node endpoint isolation. No production or other shard changes.

CI-only validation: plain oxlint, oxfmt, and git diff --check passed; no tests, coverage, or builds run. This is an additional commit after fa0b8dab2968, not an amendment.

* test(proxy): deslop q0215 tests

Replace unused HTTP-forwarding fixture behavior with an explicit unexpected-route failure. Preserve real CONNECT tunneling, loopback transport probes, and TLS hostname validation in both existing scenarios. Consolidate response, environment, socket cleanup, and child-process plumbing without changing timeout budgets.

Static checks: oxfmt, plain oxlint, and git diff --check. CI-only campaign: no runtime tests or coverage executed. Reduced 433 to 325 lines; retain both distinct regression scenarios rather than forcing the 40 percent target.

* test(proxy): reduce q0215 e2e fixture layers

Keep both distinct routing and TLS hostname scenarios. Replace the CA/CSR/signing fixture with one explicitly trusted self-signed certificate carrying the same discord.com SAN. Keep CONNECT recording and real TLS transport while restricting the fixture to its sole allowed upstream.

Use Node event/response helpers, inline synthetic target URLs, and share fetch response collection. Preserve request and subprocess timeout budgets and all behavioral assertions. Static-only validation: oxfmt, plain oxlint and git diff --check; runtime proof deferred to hosted CI. Shard total: 433 to 259 lines (40.2 percent reduction).

* test(ui): consolidate q0203 browser proof

Port the remaining q0203 browser fixture consolidations onto the campaign lane. Preserve both mobile Files placements, both IME guards, and distinct image recovery and authorization paths.

The lane already contains the first shard cleanup. Retain its modified LM Studio scenario and CI registrations under the HEAD coverage preservation rule.

CI-only validation: oxlint, oxfmt --check, and git diff --check passed. Independent review found no actionable issues. Tests and coverage were not run; affected tests are deferred to landing PR CI.

* test: retain staging and checkpoint boundary proof

* test: preserve fixture return and layout contracts

* test: normalize repair fixture failures

* test: retain typed fixture contracts
2026-10-24 13:59:20 +00:00

89 lines
2.9 KiB
TypeScript

import { spawnSync } from "node:child_process";
import { existsSync, readFileSync, symlinkSync } from "node:fs";
import { join } from "node:path";
import { expectDefined } from "@openclaw/normalization-core";
import { afterEach } from "vitest";
import { parse } from "yaml";
import { useAutoCleanupTempDirTracker } from "../helpers/temp-dir.js";
import { writeFixtureFiles } from "./z0632-fixtures.test-support.js";
type WorkflowStep = Partial<Record<"id" | "name" | "run", string>> & {
env?: Record<string, string>;
};
type ExtensionMatrixRow = {
check_name: string;
extensions_csv: string;
includePatterns: string[];
requires_bun?: boolean;
task: string;
test_runtime_policy?: string;
vitest_config: string;
exclusion_configs: { config: string; includePatterns: string[] }[];
};
export function parseManifestOutputs(output: string): Record<string, string> {
return Object.fromEntries(
output
.trim()
.split("\n")
.map((line) => {
const separator = line.indexOf("=");
return [line.slice(0, separator), line.slice(separator + 1)];
}),
);
}
export function parseExtensionMatrix(matrix: string | undefined): ExtensionMatrixRow[] {
return JSON.parse(expectDefined(matrix, "extension matrix")).include;
}
export function readWorkflow(name = "plugin-prerelease") {
return parse(readFileSync(`.github/workflows/${name}.yml`, "utf8"));
}
export function findStep(job: { steps: WorkflowStep[] }, name: string) {
return expectDefined(
job.steps.find((step) => step.name === name || step.id === name),
name,
);
}
export function createPrereleaseFixtures() {
const tempDirs = useAutoCleanupTempDirTracker(afterEach);
return {
make: tempDirs.make.bind(tempDirs),
manifest(
eventName = "workflow_dispatch",
runtimePolicy = "",
cwd?: string,
fullReleaseValidation = eventName !== "schedule",
phase = "independent",
) {
const outputPath = join(tempDirs.make("plugin-prerelease-manifest-"), "github-output");
const run = expectDefined(
findStep(readWorkflow().jobs.preflight, "Build plugin prerelease manifest").run,
"plugin prerelease manifest script",
);
const result = spawnSync("bash", ["-c", run], {
cwd,
encoding: "utf8",
env: {
PATH: process.env.PATH,
FULL_RELEASE_VALIDATION: String(fullReleaseValidation),
GITHUB_EVENT_NAME: eventName,
GITHUB_OUTPUT: outputPath,
PHASE: phase,
OPENCLAW_CI_TEST_RUNTIME_POLICY: runtimePolicy,
},
});
return { result, output: existsSync(outputPath) ? readFileSync(outputPath, "utf8") : "" };
},
target(prefix: string, files: Record<string, string>, linkType: "dir" | "junction") {
const root = tempDirs.make(prefix);
symlinkSync(join(process.cwd(), "node_modules"), join(root, "node_modules"), linkType);
writeFixtureFiles(root, files);
return root;
},
};
}