fix(minimizer): address PR 2176 review feedback

This commit is contained in:
David Andrews (LexGenius.ai)
2026-06-09 06:00:59 -04:00
committed by can1357
parent ce7ec45d42
commit 3a73107cce
11 changed files with 70 additions and 166 deletions
@@ -2,8 +2,8 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "bun:test";
import * as fs from "node:fs";
import * as os from "node:os";
import * as path from "node:path";
import { resetSettingsForTest, Settings } from "@oh-my-pi/pi-coding-agent/config/settings";
import { executeBash } from "@oh-my-pi/pi-coding-agent/exec/bash-executor";
import { resetSettingsForTest, Settings, type ShellMinimizerSettings } from "@oh-my-pi/pi-coding-agent/config/settings";
import { buildMinimizerOptions, executeBash } from "@oh-my-pi/pi-coding-agent/exec/bash-executor";
import { DEFAULT_MAX_BYTES } from "@oh-my-pi/pi-coding-agent/session/streaming-output";
import * as shellSnapshot from "@oh-my-pi/pi-coding-agent/utils/shell-snapshot";
import type { Shell } from "@oh-my-pi/pi-natives";
@@ -52,6 +52,39 @@ describe("executeBash", () => {
}
});
it("omits minimizer options when the feature is disabled", () => {
const group: ShellMinimizerSettings = {
enabled: false,
settingsPath: undefined,
only: [],
except: [],
maxCaptureBytes: 4096,
sourceOutlineLevel: "default",
legacyFilters: undefined,
};
expect(buildMinimizerOptions(group)).toBeUndefined();
});
it("forwards source outline and legacy filter settings to native minimizer options", () => {
const group: ShellMinimizerSettings = {
enabled: true,
settingsPath: "minimizer.toml",
only: ["git"],
except: ["docker"],
maxCaptureBytes: 1234,
sourceOutlineLevel: "aggressive",
legacyFilters: true,
};
expect(buildMinimizerOptions(group)).toEqual({
enabled: true,
settingsPath: "minimizer.toml",
only: ["git"],
except: ["docker"],
maxCaptureBytes: 1234,
sourceOutlineLevel: "aggressive",
legacyFilters: true,
});
});
it("returns non-zero exit codes without cancellation", async () => {
const result = await executeBash("exit 7", { cwd: tempDir, timeout: 5000 });
expect(result.exitCode).toBe(7);