Skip to content

Commit ba54dd1

Browse files
committed
fix(scripting): normalize NoInteract <-> WithDialog semantics across 15 POCOs
Audit of every step that emits <NoInteract> found 11 POCOs where ToXml/FromXml/ToDisplayLine jointly produced the wrong display text — round-tripped byte-intact but said 'With dialog: On' for steps FM Pro authored with state='True' (dialog suppressed) and vice versa: Change Password, Dial Phone, Execute SQL, Omit Multiple Records, Open URL, Re-Login, Recover File, Relookup Field Contents, Replace Field Contents, Trigger Claris Connect Flow, Truncate Table. Plus 4 POCOs whose 'WithDialog' field was actually storing NoInteract raw and compensating at render time — the display was correct but the field semantic was inverted for programmatic use: Delete All Records, Delete Portal Row, Delete Record/Request, Revert Record/Request. All 15 now use the same rule: WithDialog=true means 'show the dialog', ToXml emits state='False' for that case, FromXml reads state!='True', and the display reads WithDialog directly as On/Off. Added NoInteractSemanticTests — a [Theory] over every NoInteract-bearing step plus a discovery test that fails if a new POCO ships with the child but isn't in the Theory data. Pins the invariant.
1 parent b61593f commit ba54dd1

18 files changed

Lines changed: 204 additions & 36 deletions

src/SharpFM.Model/Scripting/Steps/ChangePasswordStep.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public override XElement ToXml() =>
3535
new XAttribute("name", XmlName),
3636
new XElement("OldPassword", OldPassword.ToXml("Calculation")),
3737
new XElement("NewPassword", Password.ToXml("Calculation")),
38-
new XElement("NoInteract", new XAttribute("state", WithDialog ? "True" : "False")));
38+
new XElement("NoInteract", new XAttribute("state", WithDialog ? "False" : "True")));
3939

4040
public override string ToDisplayLine() =>
4141
"Change Password [ " + "Old Password: " + OldPassword.Text + " ; " + "Password: " + Password.Text + " ; " + "With dialog: " + (WithDialog ? "On" : "Off") + " ]";
@@ -49,7 +49,7 @@ public override string ToDisplayLine() =>
4949
var password_vWrapEl = step.Element("NewPassword");
5050
var password_vCalcEl = password_vWrapEl?.Element("Calculation");
5151
var password_v = password_vCalcEl is not null ? Calculation.FromXml(password_vCalcEl) : new Calculation("");
52-
var withDialog_v = step.Element("NoInteract")?.Attribute("state")?.Value == "True";
52+
var withDialog_v = step.Element("NoInteract")?.Attribute("state")?.Value != "True";
5353
return new ChangePasswordStep(oldPassword_v, password_v, withDialog_v, enabled);
5454
}
5555

src/SharpFM.Model/Scripting/Steps/DeleteAllRecordsStep.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@ public override XElement ToXml() =>
2929
new XAttribute("id", XmlId),
3030
new XAttribute("name", XmlName),
3131
new XElement("NoInteract",
32-
new XAttribute("state", WithDialog ? "True" : "False")));
32+
new XAttribute("state", WithDialog ? "False" : "True")));
3333

3434
public override string ToDisplayLine() =>
35-
$"Delete All Records [ With dialog: {(WithDialog ? "Off" : "On")} ]";
35+
$"Delete All Records [ With dialog: {(WithDialog ? "On" : "Off")} ]";
3636

3737
public static new ScriptStep FromXml(XElement step)
3838
{
3939
var enabled = step.Attribute("enable")?.Value != "False";
40-
var state = step.Element("NoInteract")?.Attribute("state")?.Value == "True";
40+
var state = step.Element("NoInteract")?.Attribute("state")?.Value != "True";
4141
return new DeleteAllRecordsStep(state, enabled);
4242
}
4343

src/SharpFM.Model/Scripting/Steps/DeletePortalRowStep.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@ public override XElement ToXml() =>
2929
new XAttribute("id", XmlId),
3030
new XAttribute("name", XmlName),
3131
new XElement("NoInteract",
32-
new XAttribute("state", WithDialog ? "True" : "False")));
32+
new XAttribute("state", WithDialog ? "False" : "True")));
3333

3434
public override string ToDisplayLine() =>
35-
$"Delete Portal Row [ With dialog: {(WithDialog ? "Off" : "On")} ]";
35+
$"Delete Portal Row [ With dialog: {(WithDialog ? "On" : "Off")} ]";
3636

3737
public static new ScriptStep FromXml(XElement step)
3838
{
3939
var enabled = step.Attribute("enable")?.Value != "False";
40-
var state = step.Element("NoInteract")?.Attribute("state")?.Value == "True";
40+
var state = step.Element("NoInteract")?.Attribute("state")?.Value != "True";
4141
return new DeletePortalRowStep(state, enabled);
4242
}
4343

src/SharpFM.Model/Scripting/Steps/DeleteRecordRequestStep.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@ public override XElement ToXml() =>
2929
new XAttribute("id", XmlId),
3030
new XAttribute("name", XmlName),
3131
new XElement("NoInteract",
32-
new XAttribute("state", WithDialog ? "True" : "False")));
32+
new XAttribute("state", WithDialog ? "False" : "True")));
3333

3434
public override string ToDisplayLine() =>
35-
$"Delete Record/Request [ With dialog: {(WithDialog ? "Off" : "On")} ]";
35+
$"Delete Record/Request [ With dialog: {(WithDialog ? "On" : "Off")} ]";
3636

3737
public static new ScriptStep FromXml(XElement step)
3838
{
3939
var enabled = step.Attribute("enable")?.Value != "False";
40-
var state = step.Element("NoInteract")?.Attribute("state")?.Value == "True";
40+
var state = step.Element("NoInteract")?.Attribute("state")?.Value != "True";
4141
return new DeleteRecordRequestStep(state, enabled);
4242
}
4343

src/SharpFM.Model/Scripting/Steps/DialPhoneStep.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public override XElement ToXml() =>
3333
new XAttribute("enable", Enabled ? "True" : "False"),
3434
new XAttribute("id", XmlId),
3535
new XAttribute("name", XmlName),
36-
new XElement("NoInteract", new XAttribute("state", WithDialog ? "True" : "False")),
36+
new XElement("NoInteract", new XAttribute("state", WithDialog ? "False" : "True")),
3737
new XElement("UseDialPreferences", new XAttribute("value", UseDialPreferences ? "True" : "False")),
3838
Calculation.ToXml("Calculation"));
3939

@@ -43,7 +43,7 @@ public override string ToDisplayLine() =>
4343
public static new ScriptStep FromXml(XElement step)
4444
{
4545
var enabled = step.Attribute("enable")?.Value != "False";
46-
var withDialog_v = step.Element("NoInteract")?.Attribute("state")?.Value == "True";
46+
var withDialog_v = step.Element("NoInteract")?.Attribute("state")?.Value != "True";
4747
var useDialPreferences_v = step.Element("UseDialPreferences")?.Attribute("value")?.Value == "True";
4848
var calculation_vEl = step.Element("Calculation");
4949
var calculation_v = calculation_vEl is not null ? Calculation.FromXml(calculation_vEl) : new Calculation("");

src/SharpFM.Model/Scripting/Steps/ExecuteSqlStep.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public override XElement ToXml()
2626
new XAttribute("enable", Enabled ? "True" : "False"),
2727
new XAttribute("id", XmlId),
2828
new XAttribute("name", XmlName),
29-
new XElement("NoInteract", new XAttribute("state", WithDialog ? "True" : "False")));
29+
new XElement("NoInteract", new XAttribute("state", WithDialog ? "False" : "True")));
3030
if (Profile is not null) step.Add(Profile.ToXml());
3131
return step;
3232
}
@@ -43,7 +43,7 @@ public override string ToDisplayLine()
4343
public static new ScriptStep FromXml(XElement step)
4444
{
4545
var enabled = step.Attribute("enable")?.Value != "False";
46-
var withDialog = step.Element("NoInteract")?.Attribute("state")?.Value == "True";
46+
var withDialog = step.Element("NoInteract")?.Attribute("state")?.Value != "True";
4747
var profileEl = step.Element("Profile");
4848
var profile = profileEl is not null ? SqlProfile.FromXml(profileEl) : null;
4949
return new ExecuteSqlStep(withDialog, profile, enabled);

src/SharpFM.Model/Scripting/Steps/OmitMultipleRecordsStep.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public override XElement ToXml() =>
3030
new XAttribute("enable", Enabled ? "True" : "False"),
3131
new XAttribute("id", XmlId),
3232
new XAttribute("name", XmlName),
33-
new XElement("NoInteract", new XAttribute("state", WithDialog ? "True" : "False")),
33+
new XElement("NoInteract", new XAttribute("state", WithDialog ? "False" : "True")),
3434
Calculation.ToXml("Calculation"));
3535

3636
public override string ToDisplayLine() =>
@@ -39,7 +39,7 @@ public override string ToDisplayLine() =>
3939
public static new ScriptStep FromXml(XElement step)
4040
{
4141
var enabled = step.Attribute("enable")?.Value != "False";
42-
var withDialog_v = step.Element("NoInteract")?.Attribute("state")?.Value == "True";
42+
var withDialog_v = step.Element("NoInteract")?.Attribute("state")?.Value != "True";
4343
var calculation_vEl = step.Element("Calculation");
4444
var calculation_v = calculation_vEl is not null ? Calculation.FromXml(calculation_vEl) : new Calculation("");
4545
return new OmitMultipleRecordsStep(withDialog_v, calculation_v, enabled);

src/SharpFM.Model/Scripting/Steps/OpenURLStep.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public override XElement ToXml() =>
3333
new XAttribute("enable", Enabled ? "True" : "False"),
3434
new XAttribute("id", XmlId),
3535
new XAttribute("name", XmlName),
36-
new XElement("NoInteract", new XAttribute("state", WithDialog ? "True" : "False")),
36+
new XElement("NoInteract", new XAttribute("state", WithDialog ? "False" : "True")),
3737
new XElement("Option", new XAttribute("state", InExternalBrowser ? "True" : "False")),
3838
Calculation.ToXml("Calculation"));
3939

@@ -43,7 +43,7 @@ public override string ToDisplayLine() =>
4343
public static new ScriptStep FromXml(XElement step)
4444
{
4545
var enabled = step.Attribute("enable")?.Value != "False";
46-
var withDialog_v = step.Element("NoInteract")?.Attribute("state")?.Value == "True";
46+
var withDialog_v = step.Element("NoInteract")?.Attribute("state")?.Value != "True";
4747
var inExternalBrowser_v = step.Element("Option")?.Attribute("state")?.Value == "True";
4848
var calculation_vEl = step.Element("Calculation");
4949
var calculation_v = calculation_vEl is not null ? Calculation.FromXml(calculation_vEl) : new Calculation("");

src/SharpFM.Model/Scripting/Steps/ReLoginStep.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public override XElement ToXml() =>
3333
new XAttribute("enable", Enabled ? "True" : "False"),
3434
new XAttribute("id", XmlId),
3535
new XAttribute("name", XmlName),
36-
new XElement("NoInteract", new XAttribute("state", WithDialog ? "True" : "False")),
36+
new XElement("NoInteract", new XAttribute("state", WithDialog ? "False" : "True")),
3737
new XElement("AccountName", AccountName.ToXml("Calculation")),
3838
new XElement("Password", Password.ToXml("Calculation")));
3939

@@ -43,7 +43,7 @@ public override string ToDisplayLine() =>
4343
public static new ScriptStep FromXml(XElement step)
4444
{
4545
var enabled = step.Attribute("enable")?.Value != "False";
46-
var withDialog_v = step.Element("NoInteract")?.Attribute("state")?.Value == "True";
46+
var withDialog_v = step.Element("NoInteract")?.Attribute("state")?.Value != "True";
4747
var accountName_vWrapEl = step.Element("AccountName");
4848
var accountName_vCalcEl = accountName_vWrapEl?.Element("Calculation");
4949
var accountName_v = accountName_vCalcEl is not null ? Calculation.FromXml(accountName_vCalcEl) : new Calculation("");

src/SharpFM.Model/Scripting/Steps/RecoverFileStep.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public override XElement ToXml() =>
2929
new XAttribute("enable", Enabled ? "True" : "False"),
3030
new XAttribute("id", XmlId),
3131
new XAttribute("name", XmlName),
32-
new XElement("NoInteract", new XAttribute("state", WithDialog ? "True" : "False")),
32+
new XElement("NoInteract", new XAttribute("state", WithDialog ? "False" : "True")),
3333
new XElement("UniversalPathList", UniversalPathList));
3434

3535
public override string ToDisplayLine() =>
@@ -38,7 +38,7 @@ public override string ToDisplayLine() =>
3838
public static new ScriptStep FromXml(XElement step)
3939
{
4040
var enabled = step.Attribute("enable")?.Value != "False";
41-
var withDialog_v = step.Element("NoInteract")?.Attribute("state")?.Value == "True";
41+
var withDialog_v = step.Element("NoInteract")?.Attribute("state")?.Value != "True";
4242
var universalPathList_v = step.Element("UniversalPathList")?.Value ?? "";
4343
return new RecoverFileStep(withDialog_v, universalPathList_v, enabled);
4444
}

0 commit comments

Comments
 (0)