Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 28 additions & 8 deletions test/e2e/live/openshell-version-pin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,14 +250,39 @@ esac`,
);
}

// tar stub: write the corresponding binary into the -C outdir. Each binary
// reports the replacement version + carries the messaging-rewrite and MCP-L7
// capability markers so the post-install feature probes pass.
// tar stub: model archive listing, inspection, and extraction. Each extracted
// binary reports the replacement version + carries the messaging-rewrite and
// MCP-L7 capability markers so the post-install feature probes pass.
function createFakeTar(binDir: string, replacementVersion: string): void {
writeExecutable(
path.join(binDir, "tar"),
`#!/usr/bin/env bash
set -euo pipefail
mode="\${1:-}"
archive="\${2:-}"
case "$(basename "$archive")" in
openshell-gateway-*) name="openshell-gateway" ;;
openshell-sandbox-*) name="openshell-sandbox" ;;
openshell-*) name="openshell" ;;
*) exit 2 ;;
esac

case "$mode" in
-tzf)
printf '%s\\n' "$name"
exit 0
;;
-tvzf)
printf '%s\\n' "-rwxr-xr-x 0/0 0 2026-01-01 00:00 $name"
exit 0
;;
xzf|-xzf)
;;
*)
exit 2
;;
esac

outdir=""
prev=""
for arg in "$@"; do
Expand All @@ -268,11 +293,6 @@ for arg in "$@"; do
prev="$arg"
done
[ -n "$outdir" ] || exit 1
case "$*" in
*openshell-gateway*) name="openshell-gateway" ;;
*openshell-sandbox*) name="openshell-sandbox" ;;
*) name="openshell" ;;
esac
cat > "$outdir/$name" <<'EOS'
#!/usr/bin/env bash
if [ "\${1:-}" = "--version" ]; then echo "openshell ${replacementVersion}"; exit 0; fi
Expand Down
15 changes: 15 additions & 0 deletions test/e2e/live/shields-config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,13 @@ test("shields-config: live shields up/down locks config and detects drift", {
});
expect(shieldsUp.exitCode, resultText(shieldsUp)).toBe(0);
expect(resultText(shieldsUp)).toContain("Lockdown active");
// Keep fixture teardown out of an artificial mutable window if a later
// assertion aborts before the explicit final restore below.
cleanup.trackDisposable(`restore shields for ${SANDBOX_NAME} before destroy`, async () => {
await runNemoclaw(host, [SANDBOX_NAME, "shields", "up"], {
artifactName: "cleanup-shields-up-before-destroy",
}).catch(() => undefined);
});

const configUp = await statPath(sandbox, CONFIG_PATH, "phase-3-config-perms-up");
expect(configUp.mode).toMatch(/^4[0-4][0-4]$/);
Expand Down Expand Up @@ -684,6 +691,14 @@ test("shields-config: live shields up/down locks config and detects drift", {
expect(doubleDown.exitCode, resultText(doubleDown)).not.toBe(0);
expect(resultText(doubleDown)).toContain("already unlocked");

// The duplicate-down assertion deliberately leaves its first timer active;
// restore the target's normal locked posture before generic destruction.
const finalUp = await runNemoclaw(host, [SANDBOX_NAME, "shields", "up"], {
artifactName: "phase-11-restore-shields-up",
});
expect(finalUp.exitCode, resultText(finalUp)).toBe(0);
expect(resultText(finalUp)).toContain("Lockdown active");

await artifacts.target.complete({
id: "shields-config",
sandboxName: SANDBOX_NAME,
Expand Down
Loading