refactor: explicit sentinel for validation command redaction (D-09)

This commit is contained in:
wdawdwa committed 2026-08-23 11:43:04 +08:00
1 parent 3408c9dc77
commit cd30a49dcc
2 files changed
+16 -5

No files matched your search

+9 -3
View File
@@ -426,7 +426,9 @@ async function runProcess(
logger.info(
{
cmd: command,
args: redactProcessArgs(args, label),
args: redactProcessArgs(args, label, {
redactLastAsValidationCommand: label === "isolated repository validation"
}),
timeoutMs
},
`Spawning ${label}.`
@@ -618,9 +620,13 @@ function redactPrompt(args: string[]): string[] {
);
}
export function redactProcessArgs(args: string[], label: string): string[] {
export function redactProcessArgs(
args: string[],
label: string,
options: { redactLastAsValidationCommand?: boolean } = {}
): string[] {
const redacted = redactPrompt(args);
if (label === "isolated repository validation" && redacted.length > 0) {
if (options.redactLastAsValidationCommand && redacted.length > 0) {
const commandIndex = redacted.length - 1;
redacted[commandIndex] = `[validation command: ${args[commandIndex]?.length ?? 0} chars]`;
}