oclaw/openclaw/test/helpers/channels/AGENTS.md
oliver dbbe3add6a 重构主控编排与运行时预热链路,统一工作区提示词/专家调度协议并补齐 wiki 记忆注入与写回闭环。
同时收敛启动与运维脚本默认行为(含 wiki worker)、更新 Admin 可观测性与相关测试,降低首轮时延并提高运行稳定性。

Made-with: Cursor
2026-04-26 08:34:33 +08:00

1.5 KiB

Test Helper Boundary

This directory holds shared channel test helpers used by core and bundled plugin tests.

This file adds channel-specific rules on top of test/helpers/AGENTS.md.

Bundled Plugin Imports

  • Core test helpers in this directory must not hardcode repo-relative imports into extensions/**.
  • When a helper needs a bundled plugin public/test surface, go through src/test-utils/bundled-plugin-public-surface.ts.
  • Prefer loadBundledPluginTestApiSync(...) for eager access to exported test helpers.
  • Prefer resolveRelativeBundledPluginPublicModuleId(...) when a test needs a module id for dynamic import or mocking.
  • If vi.mock(...) hoisting would evaluate the module id too early, use vi.doMock(...) with the resolved module id instead of falling back to a hardcoded path.
  • For contract helpers, prefer minimal in-memory channel/plugin fixtures when the contract only needs capabilities, session binding hooks, routing metadata, or outbound payload helpers. Do not load broad api.ts, runtime-api.ts, or test-api.ts barrels for incidental setup.
  • If a bundled plugin parser is the contract under test, load the narrow module that owns that parser or promote a small public artifact. Avoid pulling a full extension barrel just to parse a target id.

Intent

  • Keep shared test helpers aligned with the same public/plugin boundary that production code uses.
  • Avoid drift where core test helpers start reaching into bundled plugin private files by path because it is convenient in one test.