fix(cv): preserve rewrite language and qualify responsive document controls

This commit is contained in:
cesnimda
2026-10-25 22:55:22 +01:00
parent 2bfaf6c14b
commit 8948c988e2
12 changed files with 822 additions and 5 deletions
+27 -1
View File
@@ -197,10 +197,36 @@ public sealed class AiWorkspaceTests
Assert.DoesNotContain("Hidden Corp", ai.LastText);
Assert.Contains("CURRENT DOCUMENT TO REVISE", ai.LastText);
Assert.Contains("Existing manual draft", ai.LastText);
Assert.Contains("Norwegian Bokmål", ai.LastInstruction);
Assert.Contains("Preserve the source language and meaning; do not translate.", ai.LastInstruction);
Assert.Contains("Shorten the current cover letter", ai.LastInstruction);
}
[Theory]
[InlineData("improve", "en", true)]
[InlineData("improve", "nb-NO", true)]
[InlineData("grammar", "en", true)]
[InlineData("grammar", "nb-NO", true)]
[InlineData("shorten", "en", true)]
[InlineData("shorten", "nb-NO", true)]
[InlineData("generate", "en", false)]
[InlineData("generate", "nb-NO", false)]
[InlineData("regenerate", "en", false)]
[InlineData("regenerate", "nb-NO", false)]
public async Task Letter_prompt_preserves_source_language_for_rewrites_only(string action, string language, bool preserve)
{
var (db, svc, ai) = New("user-1");
await using var _ = db;
var jobId = await SeedJobAsync(db, "user-1");
await SeedLinkedProfileAsync(db, jobId);
await svc.GenerateAsync("user-1", jobId, "unused fallback", "Ada", new("cover-letter", "professional", null, language, "Existing factual letter", action), "p", default);
if (preserve)
{
Assert.Contains("Preserve the source language and meaning; do not translate.", ai.LastInstruction);
Assert.DoesNotContain("Write in natural, professional", ai.LastInstruction);
}
else Assert.Contains(language == "nb-NO" ? "Write in natural, professional Norwegian" : "Write in natural, professional English.", ai.LastInstruction);
}
[Fact]
public async Task History_is_newest_first_and_filters_by_module()
{