openclaw/test/scripts/docker-plugin-selection.test.ts
Peter Steinberger 95ae4098ca
test(scripts,ui): remove low-value tests (batch d466) (#182564)
* test(scripts): deslop q0163 tests

Remove the redundant root-changelog rejection harness; pr-closeout-gates.test.ts covers the same prepare_gates rejection before hosted gates. Keep the independent bot-credit boundary.

Trim installer wiring inventories covered by install-ps1.release.test.ts native-npm-stderr, pnpm-source-bootstrap-lifecycle, same-prefix-shim-transaction and method-switch-preservation. Retain Windows cwd, SQLite stdin, source-target, relative tarball and freshness guards. Reuse PowerShell arguments.

Drop baseline npm argument-shape assertions while keeping real probe execution, skip/failure diagnostics and temporary-install cleanup. CI-only: oxfmt, plain oxlint and diff check pass; tests and coverage not run. Shard lines 1108 to 1022; distinct parser and lifecycle contracts prevent the requested 40 percent cut.

* test(scripts): trim q0163 tooling assertion layers

Keep installer contracts as focused guards, with executable cwd, archive identity, shim transaction and runtime proof in install-ps1.release.test.ts. Keep all installer failure and checkout-boundary scenarios.

Remove copied calibration phase/receipt inventories and duplicate clawlog missing-value variants that share the same pre-dispatch guard. Retain resource observations, retirement rejection, no-retry, output preservation and option-specific parsing paths.

Keep baseline selection/skip evidence, leaving label and timeout policy to targeted-docker-lane-groups.test.ts. Replace changelog exception-decoding scaffolding with direct spawn status and diagnostic assertions. No production changes; CI-only static checks pass. Remaining unique parser and process-lifecycle contracts prevent a 40 percent cut.

* test(scripts): reuse q0163 fixtures and trim attribution variants

Reuse the existing release Git fixture and one PowerShell invocation helper. Keep real Git history and file/streamed installer entrypoints unchanged.

Exercise internal, named bot, app prefix, bot suffix, case normalization and multi-handle scanning once at the scanner boundary. Retain direct empty/null/internal non-bot classification and the shell human-credit rejection.

CI-only: formatting, plain oxlint and diff checks pass; no test runs. The shard is 946 lines versus 1108 at baseline. Unique parser and shared process-cleanup contracts prevent the remaining cut to 664 without deleting distinct behavior.

* test(ui): deslop q0165 tests

Remove the retained-sentinel E2E replay: pages/config/updates.test.ts covers sentinel rendering and recovery exclusion, and app/update-overlay-helpers.test.ts covers external-supervisor guidance without failure triage. Keep the full update dialog/read-failure/recovery browser scenario.

Drop optional screenshot writers while retaining required-field accessibility and keyboard autosave checks. Drop duplicate failure-count checks and row-mode request restatements; route tests cover dashboard/compact query shapes and session-list owner tests cover reconciliation. Keep all three live row-event routes and their no-refetch assertion.

CI-only validation: oxfmt, plain oxlint, and git diff --check. No test or coverage runs. Reduce 994 to 914 lines; retain distinct browser lifecycle paths rather than force the 40 percent target.

* test(scripts): deslop q0164 tests

Drop six redundant wrapper alias cases: retained two-identity-alias, star-barrel, and named-binding origin cases exercise the same collector paths; check-export-name-collisions.test.ts retains direct alias classification proof. Simplify Kova fixture data and reuse the existing script-file fixture writer for CI build selection. Preserve release authority, compiler lifetime, graph resolution, and ratchet boundary cases.

CI-only campaign: plain oxlint, oxfmt, and diff checks passed; runtime and coverage proof deferred to hosted CI. Shard LOC 1537 -> 1489; declarations 28 -> 27; expanded cases 66 -> 60. The 40% LOC target was not reached without dropping distinct boundary coverage.

* test(scripts): remove q0164 redundant proof layers

Replace the ratchet workflow/command inventory replay with direct prepare_ratchet_base_args proof on the real depth-one checkout; ci-baseline-ratchets.test.ts owns argument forwarding and ci-workflow-planning.test.ts keeps workflow wiring. ci-changed-node-test-plan.source-owners.test.ts retains focused source/no-dist ownership; ci-run-node-test-shard.test.ts retains child resource propagation.

Remove copied runner-label and credentialed-job assertions and replay only distinct event gates. Consolidate alias, type-only, ambient declaration and batch-resolution proof into one Madge cycle that depends on every resolver path. plugin-sdk-api-release-evidence.test.ts retains changed-payload rejection; preserve head-identity integration here. Trim Kova fixture scaffolding and CLI inputs without removing its error paths.

CI-only: oxfmt, plain oxlint and git diff --check passed; no tests or coverage run. Shard LOC 1537 -> 1350 (12.2%); this follow-up 1489 -> 1350. The 40% target remains unmet: remaining suites and consumed helpers have distinct publication, parser and lifecycle contracts, with no safe whole-file removal identified.

* test(scripts): consolidate q0164 routing and fixtures

Replace workflow-by-workflow routing replay with direct, shared-worker and dispatch-gated branch cases; retain a generic hosted-runner guard for protected publishers and forwarding through both release orchestrators. release-no-push-workflow.test.ts retains backend/candidate routing cases and ci-workflow-planning.test.ts retains native/hosted policy coverage.

Reduce wrapper graphs to minimal declarations while retaining every value-definition and origin-resolution case, including the cross-batch scan. Remove publish-result identity restatements already validated by resolveReleasePublishInputs and the internal fetch-count assertion. Drop compiler timing-log scaffolding without changing preparation or disposal assertions.

CI-only: oxfmt, plain oxlint and git diff --check passed; no tests or coverage run. Original shard LOC 1537 -> 1288 (16.2%); this additional commit 1350 -> 1288. The 40% target remains unmet; no unique parser, publication-authority or lifecycle cases were intentionally discarded to force the metric.

* test(daemon): deslop q0168 tests

Remove duplicate native restart and stop/start rows. The retained named-profile guarded host-service lifecycle exercises both launchd activation paths; keep SIGTERM respawn and stop/restart bootstrap as distinct native scenarios.

Reuse the PID already verified by the running-runtime wait in the co-located Gateway regression. Leave Windows lifecycle and cleanup proof intact. CI-only validation: oxfmt, oxlint and git diff --check; no tests or coverage run.

* test(daemon): deslop q0168 native e2e layers

Keep native SIGTERM/KeepAlive proof; remove launchd replays owned by launchd-missing-plist.test.ts (both ghost-registration cases), launchd.test.ts (bootstrap repair and stopped activation), launchd-service-membership.test.ts (co-located node/Gateway port), config/paths.test.ts and infra/gateway-supervision.test.ts (install identity), and managed-gateway-bindings.test.ts plus test/scripts/live-gateway-dist-fence.test.ts (loaded native publication refusal). Generic service start outcomes remain in service.test.ts.

Keep Windows native failure recovery, external Scheduler extinction, Doctor admission, hosted restart/stop, no-respawn and Startup fallback. Use one external Scheduler stop API instead of replaying the same process-tree behavior. Remove callback and generic service-restart replays covered by schtasks.stop.test.ts and schtasks.settlement.test.ts. Launcher readback remains in schtasks.install.test.ts and schtasks.test.ts; Startup migration removal remains in schtasks.startup-fallback.test.ts. Replace fixture diagnostic snapshots with the cleanup exit code; keep evidence retention and all resource verification. Supervisor completion remains checked by native process exit and completed task result, rather than duplicate probe trace events.

Shard base: 1193 lines; final: 715 lines (40.1% reduction). CI-only: oxfmt, plain oxlint and git diff --check passed; no test or coverage commands run.

* test(scripts): deslop q0166 tests

Remove the duplicate non-import inventory replay: ci-changed-node-test-plan.source-owners.test.ts keeps policy scanners beside ordinary importers and checks the same inventory; ci-check-family-scope.test.ts owns architecture routing; ci-changed-node-test-plan.test.ts retains direct-test lint inventory selection. The watch logic has no separate added/renamed/import-edge decision branch.

Consolidate backport fixture writes and CLI invocation, reuse the deferred helper, and pass hosted-health evidence tuples directly. Preserve release, permission, boundary, error and concurrency assertions. CI-only: oxfmt, plain oxlint and diff checks passed; no tests or coverage run. Line reduction falls short of 40% because the remaining small suites cover distinct behavior.

* test(scripts): consolidate q0166 owner proof

Derive materializer expectations from fixture lock bytes instead of copying release versions and hashes; retain lock rejection, lifecycle suppression, output paths and permissions. Remove the exact success-log snapshot and unused child environment settings.

Keep lexical comment/regexp cases in test/architecture-smells.test.ts and boundary-specific path encodings here. Keep Tool Search success, mode and timeout assertions in upgrade-survivor-assertions.test.ts, and CLI application in upgrade-survivor-config-recipe.test.ts. Frozen policy retains committed identity selection, recipe differences, old-baseline acceptance, missing config and disabled-search rejection.

Reduce GitHub normalization and permission variants to distinct wrapper branches. CI-only: oxfmt, plain oxlint and diff checks pass; no tests or coverage executed. No retired subjects found. Original 1461 lines now 1355; the 40 percent target remains unmet because the retained fixtures exercise distinct boundaries and lifecycle behavior.

* test(scripts): reduce q0166 fixture and request setup

Remove shadowed event-filter inputs and a schema-literal restatement. Share GitHub request deadline setup across fetch/body cases, pass selector flags directly, centralize successful CLI assertions, and minimize backport fixture bodies and bound arguments. Preserve separator and direct invocation paths, permission/error branches, and legacy frozen-recipe assertions.

Rechecked PASS 15 moves: all subjects remain active and the retained specialized cases have no stronger duplicate owner proof. Original shard 1461 lines becomes 1312, below the requested 40 percent reduction. Further deletions would remove distinct behavior. CI-only: oxfmt, plain oxlint and diff checks pass; no tests, builds or coverage run.

* test(ui): remove redundant q0165 e2e layers

Port q0165 commits 0acf5908952ed8483aae936a334f04975eb18cd7 and 7e4349a8c9ec5fdbfe27318692e415354e088cf1 onto the campaign lane. The first commit is already present at the lane head; preserve its cleanup and apply the remaining deletions. Keep unrelated lane inventory changes, including the already-removed external-supervisor entry.

Remove the redundant native health and external-supervisor E2E layers and short-enum replay. Retain owning native-health, update-report/recovery, required-field browser, and enum-control coverage. No affected test file differs between the source first commit and the original lane head.

CI-only validation: oxlint, oxfmt --check, and git diff --check passed. Independent static review found no actionable P0-P2 findings. No tests, coverage, Testbox, or check-changed were run.

* test(ui): deslop q0169 tests

Remove the duplicate Inbox E2E layer. Keep notification disclosure and dismissal proof in sidebar-issue-item.test.tsx, tab-scoped dismissal in sidebar-attention-layout.browser.test.ts, and desktop/mobile approval preservation in sidebar-attention-scope.e2e.test.ts.

Remove optional Activity proof capture scaffolding without changing its assertions. Leave the duplicate versions Escape interaction to chat-pane-versions-menu.browser.test.ts; retain outside-click, keyboard switch, geometry and browser Back integration.

CI-only validation: plain oxlint, oxfmt and git diff --check. Static cases 17 to 15; shard LOC 1123 to 945 (15.9%). Below the 40% target: retain unique missing-link recovery, packaged Nostr host-slot actions, warm-refresh DOM continuity, sidebar geometry and collapsed-reply reveal.

* test(ui): consolidate q0169 owner-boundary coverage

Remove remembered-session E2E replays covered by bootstrap.agent-selection.test.ts (removed-agent/default and missing-session recovery), bootstrap-location.test.ts, and route-resolution.test.ts (forced-literal collision). Keep the explicit dead-end screen and both escape routes.

Remove warm-owner-refresh E2E duplication: owner-first-roster.test.ts checks every publication through successful and failed warm refreshes; app-sidebar-row-identity.browser.test.ts checks keyed DOM reuse; sidebar-cached-list-stability.e2e.test.ts observes transient row stability through refresh. Drop only its two exact inventory entries.

Keep versions geometry with the original long headline and browser Back integration. Delegate repeated selection, focus and overlay interactions to chat-pane-versions-menu.test.ts, chat-pane-versions-menu.browser.test.ts, solid/menu-navigation.browser.test.ts, and solid/popover.browser.test.tsx. Remove literal copy and redundant RPC-shape assertions.

CI-only: plain oxlint exited 0; oxfmt and git diff --check passed. No tests run. Shard test LOC: original 1123, previous 945, now 673 (40.1% reduction).

* test(agents): deslop q0167 tests

Remove transport failure replays covered by subagent-announce-delivery.test.ts and subagent-announce-direct-delivery.test.ts. Keep failure formatting in the private parent-review case and empty-result behavior in subagent-announce.timeout.test.ts.

Compact usage fixtures and assert independent idempotency keys directly. Preserve the unique route, store, and lifecycle scenarios; the safe reduction is 1491 to 1380 lines (7.4%), below the 40% target. CI-only: oxlint, oxfmt, and diff checks passed; no tests or coverage run.

* test(agents): consolidate q0167 announce scenarios

Reduce the original shard from 1491 to 894 lines. Consolidate routing setup, failure findings with the immediate private handoff, account routing with same-timestamp idempotency, and pending/wake/forward lifecycle phases. Retain real-store unknown versus zero usage and concurrent bound-session delivery.

Exact-run final recovery remains covered by subagent-announce.requester-settle-wake.test.ts (delivers the complete final source reply after a same-run silent terminal) and subagent-announce-result.test.ts (registered deletion archive). Retain late non-final progress exclusion in the wake scenario. Accepted-wake revocation remains covered by registerDescendantWakeCurrencyTests in subagent-announce-delivery.test-support.ts, registered in subagent-announce-delivery.test.ts. Generic normalization/channel conflicts remain covered by src/utils/delivery-context.test.ts.

CI-only validation: oxfmt, plain oxlint and git diff --check pass. No tests, coverage or build commands run.

* test(plugins): deslop q0171 tests

Remove the compatibility-selection E2E replay covered by install.npm-spec.test.ts: preserves an existing npm plugin by resolving update metadata to a compatible version.

Remove the relocation replay covered by update-channel.consent.test.ts and the retained update-authority.e2e.test.ts bridge-publication case; carry source and load-path assertions into that case. Payload verification remains owned by payload-verification.test.ts.

Share the later-install peer-survival scenario while preserving runtime peer, host symlink, and manifest/lockfile assertions. Compact hook payload checks without dropping error, no-hook, or run-isolation cases.

CI-only validation: plain oxlint, oxfmt, and git diff --check pass. No tests or coverage run. Reduction is 1426 to 1300 lines; retain the distinct authority, lifecycle, and supply-chain boundaries rather than forcing the 40 percent target.

* test(plugins): remove duplicate q0171 e2e layers

Retire the stale-install replay covered by install-package-dir.test.ts: does not let a closed installer roll back under a successor live lease; install-package-dir.rollback.test.ts covers commit and rollback under successor leases. install.npm-spec.test.ts retains archive rollback and retry proof.

Retire retained-updater settlement replay: install-transaction.test.ts leaves deferred settlement with its caller and retains the original assertion; plugin-lifecycle-lease.test.ts fences nested index commits after outer/nested revocation; update-command-executor.test.ts retires direct preflight ownership before independent acquisition. Keep cohort publication revocation E2E.

Retire synchronous-authority replay covered by package-update-filesystem.test.ts: rejects a returned Promise at each raw authority boundary before effects; install-package-dir.rollback.test.ts retains async planning and publication-assertion rollback. Missing-integrity denial remains in npm-integrity.test.ts: rejects missing resolved integrity when an expected pin exists.

Retire hook-error replay covered by agent-tool-definition-adapter.after-tool-call.fires-once.test.ts: fires after_tool_call exactly once on error when both adapter and handler are active. Retain no-hook and colliding-run cases with independent expected payloads.

Original shard: 1426 lines. Final shard: 855 lines, down 40.04 percent. Plain oxlint, oxfmt and diff checks pass; tests and coverage intentionally not run in CI-only mode. Embedded download-cancellation program unchanged.

* test(scripts): deslop q0170 tests

Remove copied workload and deadcode argument inventories while retaining trusted helper/provider/output routing, Knip version pinning, admission, secret isolation, and concurrent scan outcome assertions.

Drop the publisher workflow command-shape check; mantis-publish-pr-evidence.test.ts retains executable manifest/render/upload behavior. The retained staging-user, Telegram failure, timing, worker-binding, and Mantis evidence cases cover distinct branches or authority/provenance boundaries. Preserve the capture-overlay regression from e8ffa3557d.

CI-only: oxfmt, plain oxlint, and git diff --check pass. No tests or coverage executed. Shard lines 1320 -> 1276 (3.3%); the 40% target is not met without discarding distinct proof.

* test(scripts): reduce q0170 duplicate proof layers

Remove workflow command/output inventories while keeping permission, credential isolation, trusted-helper and capture-overlay regression guards. Keep capture provenance in mantis-web-ui-chat-evidence; rendering and publication remain owned by mantis-publish-pr-evidence.test.ts.

Consolidate argument rejection setup and same-branch variants. Keep native timing preference in the independent-runs case. Retain one serialized diagnostic identity mismatch and exercise terminal-invalid diagnostic bounds once, preserving each ingress failure producer.

Static validation: oxfmt, plain oxlint, git diff --check. No test, coverage, or build runs (CI-only). Original shard 1320 lines -> 1165 (-11.7%); 40% remains unmet because remaining suites own distinct executable, authority, parser, and lifecycle branches.

* test(scripts): remove q0170 parser boundary replays

Keep strict Boolean parsing at the executable openclaw-release-clawhub-runtime-state.test.ts boundary. Keep duplicate and missing-string rejection in report-cli-helpers.test.ts and test-perf-budget.test.ts; missing split arguments remain covered by test-group-report.test.ts and docker-e2e-helper-cli.test.ts.

Retain empty split values, affirmative casing normalization, permissive token distinctions, numeric error paths, repeated strings, and option-separator contracts where equivalent boundary proof was not found. CI-only: oxfmt, plain oxlint, and git diff --check passed; no tests/builds/coverage run. Shard 1320 -> 1141 lines (-13.6%); 40% remains unachieved without dropping distinct proof.

* test(ui): deslop q0172 tests

Remove E2E replays already covered by the owning boundaries:
- Catalog refresh: config-page.session-observer.test.ts (slow refresh,
  stale result retirement, rejection recovery), app-host.chat-metadata.test.ts
  (config/metadata events and Gateway close), session-observer-settings.test.tsx
  (explicit utility model patch).
- Reply availability and request-free reconnect: chat-pane-history-reply.test.ts;
  retain the browser reconnect refresh and paginated source navigation scenario.
- Auto-follow: logs-page.test.tsx forces a scroll when re-enabled and covers
  incremental cursor reads; retain native-viewport wrapping geometry.
- Defaults mutations: config-mutation.test.ts, model-providers-page.actions.test.ts,
  and view.test.ts cover persistence, reset, busy/retry and advertised choices;
  retain browser alignment and open-option metadata geometry.

Remove optional screenshot/video capture plumbing, keeping visual assertions.
Drop only the deleted catalog file entries from owner inventory and timings.

CI-only: formatting, diff-check and plain oxlint passed; no tests or coverage run.
Shard lines 1332 -> 1043 (21.7%); declarations 13 -> 10; expanded cases 20 -> 15.
Below 40% target: retained source-preview interaction, publication races,
confirmed saved-split admission, ownership isolation and theme hot reload lack
an equivalent retained browser proof.

* test(scripts): deslop q0173 tests

Keep the ws relocation case for the shared generated-import branch. Keep npm manifest and CLI rejection cases for the shared manager validation loop; the complete manager-owned identity cases still cover npm, pnpm and Bun reads.

Keep canonical per-path guard cases and fork coverage in selects heavy lanes. Preserve all cleanup, redaction, publication, relocation and scheduler error boundaries. Factor npm expected commands and remove unused fixture labels and irrelevant malformed-limit host overrides.

* test(scripts): remove redundant q0173 proof layers

Keep per-path decisions in ci-check-family-scope.test.ts and selected UI/Windows target projection in ci-workflow-planning.test.ts (projects one selected test set into dedicated jobs; keeps cycle and Kysely checks blocking in the existing guard row). Retain heavy event selection and screenshot budget proof here.

Keep reference discovery in src/agents/docs-path.test.ts and custodian source composition in src/skills/loading/workspace-skill-snapshot.test.ts (keeps custodian skills absent from every non-custodian discovery surface). Snapshot proof now checks copied and pruned bytes at the canonical resource roots directly.

Keep metadata rejection policy in openclaw-npm-extended-stable-release.test.ts (completed successful plugin run at the exact branch and SHA; authenticated main recovery tooling with exact source identity). Retain workflow lineage and publisher authority cases. Simplify npm fixtures and import-result assertions without removing platform or resolver branches. CI-only: static lint and formatting passed; no test execution.

* test(scripts): consolidate q0173 owner-boundary fixtures

Remove the remaining heavy-lane inventory replay. ci-workflow-planning.test.ts retains complete family coverage by validation tier, macOS event selection, proof/boundary routing, and dedicated UI/Windows projection. ci-published-driver-update-plan.test.ts connects each event to the required job. Keep the unique screenshot-budget regression.

Run package identity against its real shell owner rather than replaying installation setup. docker-e2e-source-roots.test.ts preserves package proof settlement and the wrapper handoff to identity inspection. Keep manifest/CLI mismatch rejection, all manager identity details, and native-proof outcomes.

Consolidate scheduler cases without removing branches, preserve per-instance host snapshot proof with scoped spies, reuse numeric diagnostic fixture fields, and narrow fake GitHub calls to the two exact recovery endpoints. No production, config or helper edits. CI-only: oxlint, formatting and diff checks passed; no tests run.

* test(qa-lab): deslop q0174 tests

Share identical Telegram configuration and debug reads, reuse MCP pairing setup, and inline single-use Doctor and transcript fixtures. Keep all security, transport, and lifecycle cases and assertions; no safe whole-scenario deletion was found. CI-only validation: plain oxlint, oxfmt, and diff checks.

* test(ui): deslop q0175 tests

Remove duplicate file-copy and workspace-source E2E layers. Clipboard fallback and retirement remain in ui/src/lib/clipboard.test.ts and the file sidebar clipboard feedback suite in chat-sidebar.test.ts. Workspace source mismatch, retained draft identity and reopening remain in chat-session-workspace.test.ts, including the regression tests from a44dc77340 (#178336); editor draft persistence remains in chat-sidebar-file-view.browser.test.ts and chat-file-drafts.browser.test.ts.

Nullable enum identity, unset and required behavior remain in config-form-scalar-integrity.browser.test.ts, with schema normalization in config-form-composition-integrity.browser.test.ts. Message-width naming and reload persistence remain in settings-message-width.e2e.test.ts. Custom snooze rejection, Escape focus and Cancel remain in session-menu.browser.test.ts; retain both E2E viewport paths for native date segment editing and reuse.

Drop only the deleted file path entries from CI owner/proof inventories. Preserve catalog ordering, image revocation and submit browser-task ordering scenarios. Shard test LOC: 913 -> 542 (40.6% reduction); static expanded cases: 21 -> 12. CI-only mode: oxfmt, diff-check and plain oxlint passed; no tests, coverage, builds or check-changed run.

* test(e2e): deslop q0176 tests

Remove the duplicated Mattermost DM retry/retirement replay and its multi-purpose fixture. Retain the real redirect test, including queue ambiguity across database reopen and refusal to replay after dispatch.

Remaining owner proof: extensions/mattermost/src/mattermost/send.authority.test.ts (stops DM backoff after retirement), client.test.ts (DM retry success), channel.send-loopback.test.ts (sender authority over HTTP), src/infra/outbound/deliver-queue.cancellation-integration.test.ts (retired queued callers and recovery), and delivery-queue.storage.test.ts (durable terminal fences).

Keep both LINE reference-only and concrete-sender branches, dropping only the resolved-membership variant: doctor.ts classifies references without inspecting access-group membership. Keep Discord plugin-instance capture and Cloudflare HTTP/WebSocket authority proof unchanged.

CI-only validation: plain oxlint, oxfmt and git diff --check passed. No tests, coverage or build run. LOC 1323 -> 1139 (13.9%); static expanded cases 11 -> 8. Below 40% because the remaining capture lifecycle, redirect ambiguity, identity/expiry and LINE warning branches are distinct.

* test(e2e): remove redundant q0176 proof layers

Retire the Cloudflare visitor composite replay. Remaining proof: src/gateway/github-user-identity.oidc.test.ts covers canonical HTTP/WS identity and malformed numeric claims; extensions/visitor-access/src/visitors.authority.test.ts covers numeric grants and expiry; src/gateway/http-auth-utils.test.ts covers live admission authority; src/gateway/server.auth.identity-scopes.test.ts covers real WS denial and revocation.

Keep real Gateway capture execution, after-turn recording, model-backed notes, late-STT fencing and socket isolation. Remove duplicate wire/output and registry-inspection assertions; reuse the existing Responses SSE fixture. Runtime instance ownership remains covered by runtime-plugins.channel-ownership.test.ts, runtime-plugins.channel-borrowing.test.ts and prepared-model-runtime.registry-borrow.test.ts; summary content is covered by src/transcripts/summary-model.test.ts.

Keep LINE alias and reference-only/concrete-sender branches plus config preservation. Drop unrelated UI/entrypoint checks and owner-covered warning replays: src/commands/doctor/channel-capabilities.test.ts, shared/empty-allowlist-scan.test.ts, shared/allowfrom-fallback-migration.test.ts, extensions/line/src/doctor.test.ts and bot-handlers.join-intro.test.ts.

CI-only validation: plain oxlint, oxfmt and git diff --check pass; no tests, coverage or builds run. Original shard LOC 1323 -> 793 (40.06% reduction), previous commit 1139 -> 793. Only shard tests changed; Cloudflare replay has no remaining path-list references.

* test: retain release integrity guards and typed fixtures

* test(agents): remove stale announce lint artifacts

* test: preserve distinct fixtures and prune retired baselines

* test(ci): account for selected singleton capacity
2026-10-24 12:44:07 +00:00

135 lines
4.8 KiB
TypeScript

import { spawnSync } from "node:child_process";
import fs from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";
import { afterEach, beforeEach, expect, it } from "vitest";
import { resolveDockerPluginSelection } from "../../scripts/lib/docker-plugin-selection.mjs";
import { useAutoCleanupTempDirTracker } from "../helpers/temp-dir.js";
const repoRoot = path.resolve(fileURLToPath(new URL("../..", import.meta.url)));
const selectorScript = path.join(repoRoot, "scripts/lib/docker-plugin-selection.mjs");
const tempDirs = useAutoCleanupTempDirTracker(afterEach);
let fixtureRoot: string;
let extensionsRoot: string;
beforeEach(() => {
fixtureRoot = tempDirs.make("openclaw-docker-plugin-selection-");
extensionsRoot = path.join(fixtureRoot, "extensions");
fs.mkdirSync(extensionsRoot);
});
const writeJson = (file: string, value: unknown) => fs.writeFileSync(file, JSON.stringify(value));
function writePlugin(
dirName: string,
manifest?: { id: string; providers?: string[] },
pkg: {
dependencies?: Record<string, string>;
openclaw?: { install: { requiredPlatformPackages: string[] } };
} = {},
) {
const pluginDir = path.join(extensionsRoot, dirName);
fs.mkdirSync(pluginDir, { recursive: true });
writeJson(path.join(pluginDir, "package.json"), { name: dirName, ...pkg });
if (manifest) {
writeJson(path.join(pluginDir, "openclaw.plugin.json"), manifest);
}
}
function runSelector(selection: string, ...flags: string[]) {
return spawnSync(process.execPath, [selectorScript, extensionsRoot, selection, ...flags], {
encoding: "utf8",
});
}
function expectOutput(output: string, ...args: Parameters<typeof runSelector>) {
expect(runSelector(...args)).toMatchObject({ status: 0, stdout: output, stderr: "" });
}
it("adds standalone direct and Gateway provider selections to the shared live image", () => {
const result = spawnSync(
process.execPath,
[path.join(repoRoot, "scripts/print-live-docker-plugin-selection.mjs"), repoRoot, "twitch"],
{
encoding: "utf8",
env: {
PATH: process.env.PATH,
OPENCLAW_LIVE_PROVIDERS: "ollama",
OPENCLAW_LIVE_GATEWAY_MODELS: "mistral/mistral-large-latest",
},
},
);
expect(result.status, result.stderr).toBe(0);
expect(result.stdout.trim().split(",")).toEqual(
expect.arrayContaining(["ollama", "mistral", "twitch"]),
);
});
it("selects provider owners by manifest capability without assuming matching plugin ids", () => {
writePlugin("provider-source", {
id: "provider-plugin",
providers: ["api-provider", "portal-provider"],
});
writePlugin("other-source", { id: "other-plugin" });
expect(
resolveDockerPluginSelection({
extensionsRoot,
selection: "other-plugin,provider-plugin",
providers: ["portal-provider", "custom-unregistered-provider"],
}),
).toEqual(["other-source", "provider-source"]);
expect(resolveDockerPluginSelection({ extensionsRoot, providers: ["api-provider"] })).toEqual([
"provider-source",
]);
});
it("includes required core-bundled dependencies without changing optional plugin selections", () => {
const rootPackagePath = path.join(fixtureRoot, "package.json");
writeJson(rootPackagePath, { files: ["dist/", "!dist/extensions/optional-provider/**"] });
writePlugin("bundled-provider", { id: "bundled" }, { dependencies: { sdk: "1" } });
writePlugin("bundled-without-deps", { id: "without-deps" });
writePlugin(
"optional-provider",
{ id: "optional" },
{
dependencies: { sdk: "1" },
openclaw: { install: { requiredPlatformPackages: ["linux", "darwin", "linux"] } },
},
);
expectOutput("bundled-provider\n", "", "--required-bundled", rootPackagePath);
expectOutput(
"bundled-provider\noptional-provider\n",
"optional",
"--required-bundled",
rootPackagePath,
);
expectOutput("optional-provider\n", "optional");
expectOutput("darwin\nlinux\n", "optional", "--required-platform-packages");
expect(runSelector("", "--required-platform-packages").stdout).toBe("");
});
it("resolves manifest ids and source directory names deterministically", () => {
writePlugin("source-only");
writePlugin("provider-source", { id: "provider-id" });
expectOutput(
"provider-source\nsource-only\n",
"source-only,provider-id provider-source,provider-id",
);
});
it("fails closed for unknown, invalid, and ambiguous ids", () => {
writePlugin("shared");
writePlugin("other-source", { id: "shared" });
for (const [selection, message] of [
["missing-plugin", "unknown OPENCLAW_EXTENSIONS plugin id: missing-plugin"],
["../invalid", "invalid OPENCLAW_EXTENSIONS plugin id: ../invalid"],
["shared", "ambiguous OPENCLAW_EXTENSIONS plugin id: shared"],
] as const) {
expect(runSelector(selection)).toMatchObject({
status: 1,
stdout: "",
stderr: expect.stringContaining(message),
});
}
});