Refactor pipeline task handling and UI flows
This commit is contained in:
@@ -93,10 +93,10 @@ test("auditGenerationAction exports processAuditGeneration with runId validator"
|
||||
assert.equal(
|
||||
hasPattern(
|
||||
actionSource,
|
||||
/processAuditGeneration\s*=\s*internalAction\(\s*{\s*args:\s*{\s*runId:\s*v\.id\(\s*["']agentRuns["']\s*\)\s*,?\s*}/,
|
||||
/processAuditGeneration\s*=\s*internalAction\(\s*{\s*args:\s*{[\s\S]*?runId:\s*v\.id\(\s*["']agentRuns["']\s*\)[\s\S]*?rootRunId:\s*v\.optional\(v\.id\(\s*["']agentRuns["']\s*\)\)/,
|
||||
),
|
||||
true,
|
||||
"processAuditGeneration should validate runId: v.id(\"agentRuns\")",
|
||||
"processAuditGeneration should validate runId and optional rootRunId as agentRuns IDs",
|
||||
);
|
||||
});
|
||||
|
||||
@@ -280,18 +280,38 @@ test("German copy prompt uses first-contact email tone guidelines without a new
|
||||
);
|
||||
});
|
||||
|
||||
test("quality review blocks when model review or German copy guard fails", () => {
|
||||
test("quality review can rewrite copy once without making copy feedback a hard failure", () => {
|
||||
const qualityPromptSource = extractFunctionSource("buildQualityReviewPrompt");
|
||||
|
||||
assert.match(
|
||||
assert.doesNotMatch(
|
||||
actionSource,
|
||||
/qualityPassed\s*=\s*qualityResult\.object\.isValid\s*&&\s*guardResult\.passed/,
|
||||
"qualityPassed should require both model review validity and German copy guard.",
|
||||
"Copy quality feedback should not be a hard AND-gate with the deterministic German copy guard.",
|
||||
);
|
||||
assert.doesNotMatch(
|
||||
actionSource,
|
||||
/qualityPassed\s*=\s*guardResult\.passed\s*;/,
|
||||
"qualityPassed must not ignore the model quality review.",
|
||||
"The deterministic German copy guard should not be the quality pass condition.",
|
||||
);
|
||||
assert.match(
|
||||
actionSource,
|
||||
/rewriteRequired[\s\S]*revisedCopy[\s\S]*applyRevisedCopy/,
|
||||
"Quality review should be able to request one revised copy and apply it before persistence.",
|
||||
);
|
||||
assert.match(
|
||||
actionSource,
|
||||
/copyReviewAttempts\s*<\s*2/,
|
||||
"Quality review should run at most the initial review plus one rewrite review.",
|
||||
);
|
||||
assert.match(
|
||||
actionSource,
|
||||
/message:\s*["']Copy-Review hat korrigiert\.["']/,
|
||||
"A successful rewrite should be visible as a warning event.",
|
||||
);
|
||||
assert.match(
|
||||
actionSource,
|
||||
/message:\s*["']Copy-Review mit Hinweisen abgeschlossen\.["']/,
|
||||
"Remaining copy feedback should be stored as warning telemetry.",
|
||||
);
|
||||
assert.match(
|
||||
qualityPromptSource,
|
||||
@@ -308,6 +328,11 @@ test("quality review blocks when model review or German copy guard fails", () =>
|
||||
/verified findings|verifizierte Befunde/i,
|
||||
"Quality review should keep concrete claims tied to verified findings.",
|
||||
);
|
||||
assert.match(
|
||||
qualityPromptSource,
|
||||
/revisedCopy|rewriteRequired/,
|
||||
"Quality review prompt should ask for revised copy when rewrite is needed.",
|
||||
);
|
||||
});
|
||||
|
||||
test("action handles post-start failure paths in action-level catch", () => {
|
||||
@@ -536,27 +561,21 @@ test("action handles missing screenshots with warning event fallback", () => {
|
||||
);
|
||||
});
|
||||
|
||||
test("action runs german copy guard and blocks outreach-ready on validation failure", () => {
|
||||
test("action keeps German copy guard as telemetry without blocking outreach-ready", () => {
|
||||
assert.equal(
|
||||
hasPattern(actionSource, /validateCustomerFacingCopy/),
|
||||
true,
|
||||
"Action should run German copy validation",
|
||||
"Action should still run German copy validation for telemetry.",
|
||||
);
|
||||
assert.equal(
|
||||
hasPattern(
|
||||
actionSource,
|
||||
/qualityPassed\s*=\s*qualityResult\.object\.isValid\s*&&\s*guardResult\.passed/,
|
||||
),
|
||||
true,
|
||||
"Model QA and deterministic German copy guard failures should hard-block the audit run.",
|
||||
assert.doesNotMatch(
|
||||
actionSource,
|
||||
/guardResult\.passed[\s\S]{0,500}finishAuditGenerationRun[\s\S]{0,250}status:\s*["']failed["']/,
|
||||
"German copy guard findings should not finish the audit generation as failed.",
|
||||
);
|
||||
assert.equal(
|
||||
hasPattern(
|
||||
actionSource,
|
||||
/qualityPassed\s*=\s*guardResult\.passed\s*;/,
|
||||
),
|
||||
false,
|
||||
"Action must not ignore the model QA validity flag.",
|
||||
assert.match(
|
||||
actionSource,
|
||||
/guardTelemetry|deterministicGuard/,
|
||||
"German copy guard output should be persisted as telemetry in the quality payload.",
|
||||
);
|
||||
assert.equal(
|
||||
hasPattern(actionSource, /internal\.leads\.reviewUpdateInternal/),
|
||||
|
||||
Reference in New Issue
Block a user