docs: document runtime plan type tests · openclaw/openclaw@22f21ed
steipete
·
2026-06-05
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +// Runtime plan auth tests cover provider/auth-profile selection and plugin |
| 2 | +// alias loading behavior for the auth portion of the plan. |
1 | 3 | import { beforeEach, describe, expect, it, vi } from "vitest"; |
2 | 4 | |
3 | 5 | const pluginRegistryMocks = vi.hoisted(() => { |
@@ -52,6 +54,8 @@ describe("buildAgentRuntimeAuthPlan", () => {
|
52 | 54 | }); |
53 | 55 | |
54 | 56 | it("does not load provider auth aliases when plugins are disabled", () => { |
| 57 | +// Disabling alias support should avoid metadata loading entirely, not just |
| 58 | +// ignore aliases after doing plugin work. |
55 | 59 | pluginRegistryMocks.loadPluginManifestRegistryForPluginRegistry.mockReturnValue({ |
56 | 60 | plugins: [ |
57 | 61 | { |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +// Runtime plan tool-diagnostics tests cover the legacy provider diagnostic path |
| 2 | +// used when no runtime plan owns tool schema diagnostics. |
1 | 3 | import { describe, expect, it, vi } from "vitest"; |
2 | 4 | |
3 | 5 | const mocks = vi.hoisted(() => ({ |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +// Runtime plan type-compat tests keep copied structural aliases aligned with |
| 2 | +// their source runtime contracts without importing those sources in production. |
1 | 3 | import { describe, expectTypeOf, it } from "vitest"; |
2 | 4 | import type { ReplyPayload } from "../../auto-reply/reply-payload.js"; |
3 | 5 | import type { ThinkLevel } from "../../auto-reply/thinking.js"; |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +// Runtime plan type tests keep the leaf type contract free from concrete |
| 2 | +// runtime policy modules so the plan can stay a low-dependency boundary. |
1 | 3 | import fs from "node:fs/promises"; |
2 | 4 | import { fileURLToPath } from "node:url"; |
3 | 5 | import { describe, expect, it } from "vitest"; |
@@ -23,6 +25,8 @@ describe("AgentRuntimePlan leaf contracts", () => {
|
23 | 25 | }); |
24 | 26 | |
25 | 27 | it("guards against policy type imports re-entering the leaf contract", () => { |
| 28 | +// The patterns intentionally match representative forbidden imports so the |
| 29 | +// first test fails if concrete policy types creep into the leaf contract. |
26 | 30 | const forbiddenImports = [ |
27 | 31 | 'import type { PromptContribution } from "../system-prompt.types.js";', |
28 | 32 | 'import type { TranscriptPolicy } from "../transcript-policy.types.js";', |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +// Runtime proxy tests cover SSE parsing, terminal error handling, and request |
| 2 | +// payload scrubbing before proxying model streams. |
1 | 3 | import { afterEach, describe, expect, it, vi } from "vitest"; |
2 | 4 | import type { Context, Model, Usage } from "../../llm/types.js"; |
3 | 5 | import { streamProxy } from "./proxy.js"; |
@@ -46,6 +48,8 @@ describe("streamProxy", () => {
|
46 | 48 | }); |
47 | 49 | |
48 | 50 | it("flushes a final SSE frame without a trailing newline", async () => { |
| 51 | +// Provider proxies can close immediately after the last SSE frame; the |
| 52 | +// parser still has to emit the terminal done event. |
49 | 53 | const fetchMock = vi.fn(async (_input: RequestInfo | URL, _init?: RequestInit) => |
50 | 54 | responseFromText( |
51 | 55 | `data: ${JSON.stringify({ |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +// Git utility tests cover plugin git source parsing, ref extraction, and path |
| 2 | +// traversal rejection before managed checkouts are created. |
1 | 3 | import { describe, expect, it } from "vitest"; |
2 | 4 | import { parseGitUrl } from "./git.js"; |
3 | 5 | |
@@ -38,6 +40,8 @@ describe("parseGitUrl", () => {
|
38 | 40 | }); |
39 | 41 | |
40 | 42 | it("rejects repository paths that could escape managed checkout roots", () => { |
| 43 | +// Managed plugin checkouts derive local paths from repo path segments, so |
| 44 | +// dot-segments are rejected instead of normalized. |
41 | 45 | expect(parseGitUrl("git:https://example.com/openclaw/../outside")).toBeNull(); |
42 | 46 | expect(parseGitUrl("git:git@example.com:openclaw/../outside")).toBeNull(); |
43 | 47 | expect(parseGitUrl("git:example.com/openclaw/./outside")).toBeNull(); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。