fix(ui): Task 11 review — verify false override end-to-end, move HasOverrideDelta to the partial, label wording

Claude-Session: https://claude.ai/code/session_01Y5ef34iUUMjmwnMpL9xgmB
This commit is contained in:
Joseph Doherty
2026-09-11 10:11:53 -04:00
parent cbb5e83633
commit c259614a78
4 changed files with 43 additions and 13 deletions
@@ -527,7 +527,9 @@ public sealed class InstanceConfigureTests : IClassFixture<InstanceConfigureFixt
/// priority DELETES the override, so a reportable-only choice has to count as a delta on its own
/// or it would be silently dropped. The assertion is therefore that choosing ONLY "Reportable"
/// (leaving the trigger config and priority untouched) creates the override — badge + a summary
/// naming <c>mesReportable</c> — and that switching back to Inherited removes it again.
/// naming <c>mesReportable</c> — that switching to "Not reportable" persists <c>false</c>
/// (verified against the read-back document, since an absent/null field there would mean the
/// negative pin was dropped), and that switching back to Inherited removes the override again.
/// </para>
///
/// <para>
@@ -563,6 +565,31 @@ public sealed class InstanceConfigureTests : IClassFixture<InstanceConfigureFixt
// Summary part is "mesReportable" (the negative pin renders "notMesReportable").
await Assertions.Expect(row).ToContainTextAsync("mesReportable", new() { Timeout = 15_000 });
// Reopen → switch to the NEGATIVE pin. This is the leg that proves "Not reportable" is
// a real write and not a clear: the row must stay overridden and the persisted
// isMesReportableOverride must be JSON false, never absent/null.
await row.Locator("[data-test='alarm-edit-btn']").ClickAsync();
await Assertions.Expect(mesSelect).ToBeVisibleAsync(new() { Timeout = 15_000 });
await mesSelect.SelectOptionAsync("false");
await page.Locator("[data-test='alarm-save-override']").ClickAsync();
await Assertions.Expect(row.Locator("[data-test='alarm-override-badge']"))
.ToBeVisibleAsync(new() { Timeout = 15_000 });
await Assertions.Expect(row).ToContainTextAsync("notMesReportable", new() { Timeout = 15_000 });
using (var negDoc = await CliRunner.GetInstanceDocumentAsync(_cfg.InstanceId))
{
var negOverrides = negDoc.RootElement.GetProperty("alarmOverrides");
var entry = negOverrides.EnumerateArray().Single(o =>
o.GetProperty("alarmCanonicalName").GetString() == _cfg.AlarmName);
Assert.True(entry.TryGetProperty("isMesReportableOverride", out var flag),
"alarmOverrides entry is missing isMesReportableOverride.");
// JSON false specifically — an absent/null field would mean the negative pin was
// dropped and the alarm silently fell back to the template's flag.
Assert.Equal(JsonValueKind.False, flag.ValueKind);
}
// Reopen → back to Inherited (blank) → Save. With nothing else set that is now a
// no-delta save, which clears the override outright.
await row.Locator("[data-test='alarm-edit-btn']").ClickAsync();
@@ -46,6 +46,9 @@ public class InstanceConfigureMesReportableTests
var selectEnd = markup.IndexOf("</select>", selectStart, StringComparison.Ordinal);
Assert.True(selectEnd > selectStart, "MES reportable select is not closed.");
// Label mirrors the adjacent "Priority override" control.
Assert.Contains("MES reportable override</label>", markup);
var selectBody = markup[selectStart..selectEnd];
var optionCount = selectBody.Split("<option").Length - 1;
Assert.Equal(3, optionCount);