mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-27 12:56:01 -06:00
refactor(deadcode): privatize runtime test seams (#108338)
* refactor(sessions): privatize runtime test seams * refactor(commitments): privatize extraction test seams * refactor(flows): privatize doctor health seams * refactor(tasks): privatize registry test seams * build(commitments): bundle Docker test support * chore(deadcode): shrink runtime export baseline
This commit is contained in:
committed by
GitHub
parent
8d5592548b
commit
3d76a4af92
@@ -91,12 +91,12 @@ function scheduleDrainSoon(debounceMs: number): void {
|
||||
}
|
||||
|
||||
/** Installs runtime hooks for extraction tests or alternate batch extraction. */
|
||||
export function configureCommitmentExtractionRuntime(next: CommitmentExtractionRuntime): void {
|
||||
function configureCommitmentExtractionRuntime(next: CommitmentExtractionRuntime): void {
|
||||
runtime = next;
|
||||
}
|
||||
|
||||
/** Clears queued work, timers, and injected hooks for isolated tests. */
|
||||
export function resetCommitmentExtractionRuntimeForTests(): void {
|
||||
function resetCommitmentExtractionRuntimeForTests(): void {
|
||||
if (timer) {
|
||||
clearTimer(timer);
|
||||
}
|
||||
@@ -299,7 +299,7 @@ function takeAgentBatch(
|
||||
}
|
||||
|
||||
/** Drains queued extraction work in batches and returns processed item count. */
|
||||
export async function drainCommitmentExtractionQueue(): Promise<number> {
|
||||
async function drainCommitmentExtractionQueue(): Promise<number> {
|
||||
if (draining) {
|
||||
return 0;
|
||||
}
|
||||
@@ -357,3 +357,15 @@ export async function drainCommitmentExtractionQueue(): Promise<number> {
|
||||
draining = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
process.env.VITEST ||
|
||||
process.env.NODE_ENV === "test" ||
|
||||
process.env.OPENCLAW_COMMITMENTS_SAFETY_E2E === "1"
|
||||
) {
|
||||
(globalThis as Record<PropertyKey, unknown>)[Symbol.for("openclaw.commitmentRuntimeTestApi")] = {
|
||||
configureCommitmentExtractionRuntime,
|
||||
drainCommitmentExtractionQueue,
|
||||
resetCommitmentExtractionRuntimeForTests,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user