Files
NetMesh/application/state/sftp/transferDirectoryOps.latchFreeze.test.ts
zhaolei 3c72efcb7f
Some checks failed
build-packages / resolve bundled mosh-client (push) Has been cancelled
build-packages / resolve bundled et-client (push) Has been cancelled
build-packages / build-macos (push) Has been cancelled
build-packages / build-windows (push) Has been cancelled
build-packages / build-linux-x64 (push) Has been cancelled
build-packages / build-linux-arm64 (push) Has been cancelled
build-packages / release (push) Has been cancelled
build-packages / update Nix release metadata (push) Has been cancelled
build-packages / bump homebrew tap (push) Has been cancelled
test / lint-and-test (push) Has been cancelled
AI automation / Route event (push) Has been cancelled
AI automation / Hand reopened issue to maintainers (push) Has been cancelled
AI automation / Clean source issue state (push) Has been cancelled
AI automation / Reconcile handoffs (push) Has been cancelled
AI automation / Classify issue (push) Has been cancelled
AI automation / Claude Code smoke (push) Has been cancelled
AI automation / Review issue follow-up (push) Has been cancelled
AI automation / Publish issue follow-up (push) Has been cancelled
AI automation / Implement with Claude Code (push) Has been cancelled
AI automation / Publish implement PR (push) Has been cancelled
AI automation / Continue queued issue comments (push) Has been cancelled
AI automation / Codex review loop (push) Has been cancelled
AI automation / Publish Codex fix (push) Has been cancelled
AI automation / Clear Codex dispatch marker (push) Has been cancelled
AI automation / Own PR re-request Codex (push) Has been cancelled
AI automation / External PR re-request Codex (push) Has been cancelled
AI automation / Poll Codex reaction / retry (push) Has been cancelled
build-et-binaries / build-linux-x64 (push) Has been cancelled
build-et-binaries / build-linux-arm64 (push) Has been cancelled
build-et-binaries / build-macos-universal (push) Has been cancelled
build-et-binaries / build-windows-x64 (push) Has been cancelled
build-et-binaries / release (push) Has been cancelled
[Init] Initial commit - NetMesh terminal manager
2026-09-13 18:24:01 +08:00

44 lines
2.3 KiB
TypeScript

import assert from "node:assert/strict";
import { readFileSync } from "node:fs";
import test from "node:test";
test("directory parent progress freezes while pausing without re-pausing child streams", () => {
const source = readFileSync(new URL("./transferDirectoryOps.ts", import.meta.url), "utf8");
assert.match(source, /const parentFrozen = !!parentRow/);
assert.match(source, /parentRow\.status === "paused"/);
assert.match(source, /parentRow\.status === "pausing"/);
assert.match(source, /\|\| isPauseLatched\(rootTaskId\)/);
assert.match(source, /if \(parentFrozen\) \{\s*return \{ \.\.\.t, speed: 0 \};/);
assert.doesNotMatch(source, /const pauseRequested = .*status === "paused"/);
});
test("directory pauseWatch undoes pause when control epoch is superseded", () => {
const source = readFileSync(new URL("./transferDirectoryOps.ts", import.meta.url), "utf8");
assert.match(source, /epochAtAttempt/);
assert.match(source, /isTransferControlEpochCurrent\(rootTaskId, epochAtAttempt\)/);
assert.match(source, /resumeTransfer\?\.\(task\.id\)/);
});
test("store soft-fail demotes and held rejoin uses bridge lifecycleEpoch (source contract)", () => {
const source = readFileSync(new URL("../sftpTransferCenterStore.ts", import.meta.url), "utf8");
// Soft-fail must demote before silent return
assert.match(source, /softFailedNeedsHard|Transfer session is no longer active/);
assert.match(source, /controller = undefined/);
// Held soft-rejoin must not stamp control-plane epoch onto task.lifecycleEpoch
assert.doesNotMatch(source, /lifecycleEpoch: heldResumeEpoch/);
assert.match(source, /Prefer bridge lifecycleEpoch|bridgeEpoch/);
});
test("directory childTask clears inherited lifecycleEpoch before stream arm", () => {
const source = readFileSync(new URL("./transferDirectoryOps.ts", import.meta.url), "utf8");
assert.match(source, /lifecycleEpoch: undefined/);
assert.match(source, /Never\s+inherit the parent's soft-resume epoch|New\/restarted child streams arm at bridge lifecycleEpoch 0/i);
});
test("softResume does not stamp parent resume epoch onto non-resumed siblings", () => {
const source = readFileSync(new URL("./globalSftpTransferControl.ts", import.meta.url), "utf8");
assert.match(source, /Non-resumed siblings under the folder/);
assert.match(source, /lifecycleEpoch: undefined/);
assert.match(source, /bridgeEpochById/);
});