graccesscli: correct script-edit docs to TN-537 truth (writes DO persist)
I was wrong. AVEVA Tech Note 537 ("Creating an Application Object Script
Using GRAccess", April 2008) documents the supported pattern:
ConfigurableAttributes[<script>.<field>].SetValue(MxValue) inside a
CheckOut/Save/CheckIn cycle. graccesscli's existing
FindAttributeForMutation already follows this — writes to MxCategoryPackageOnly_Lockable
script-text fields persist correctly.
The earlier "writeback gap" diagnosis was a phantom caused by a reader-side
issue. `object attribute value get` against a script body returns
"Supported: False / Attribute value is not exposed" because
MxValueDetails uses a case-sensitive `ReadProperty(attr, "Value")` lookup
plus an accessor probe (GetBoolean -> GetInteger -> GetFloat -> GetDouble
-> GetString) that can fall through silently for some MxValue shapes. The
COM-side property is exposed as `value` (lowercase), readable as
`attr.value.GetString()` -- which the live probe at
`analysis/ide-edit-investigation/probe_setvalue/` does and confirms the
post-write content matches the marker exactly.
Live verification on $TestMachine.UpdateTestChangingInt.DeclarationsText
and $DelmiaReceiver.ProcessRecipe.{ExecuteText,DeclarationsText}:
=== verdict ===
marker landed on same-proxy ConfigurableAttributes: True
marker landed on same-proxy Attributes : True
marker landed on fresh-proxy ConfigurableAttributes: True
marker landed on fresh-proxy Attributes : True
The probe also confirmed that two earlier graccesscli `object scripts set`
invocations (which I had wrongly believed failed) had persisted -- the
marker text I wrote previously was still on disk in
ProcessRecipe.{ExecuteText,DeclarationsText} when read directly via
attr.value.GetString(). The probe restored both fields to their original
values.
This commit:
- Updates the misleading [Command(...)] / [CommandOption(...)]
descriptions in GRAccessSurfaceCommands.cs back to honest versions
citing TN-537.
- Restores the --file-using examples for `object scripts set` and
`object scripts create` across script-editing.md, llm-integration.md,
usage.md, and zb-testmachine.md.
- Removes the test that asserted the (wrong) EnsureMutableViaSetValue
guard. Re-aims ScriptCommandDescriptions_… at the corrected wording.
- Removes two leftover EnsureMutableViaSetValue calls in the trigger-period
/ trigger-type write paths (both targeted MxCategoryWriteable_C_Lockable
attributes; would never have fired even if the helper still existed).
- Adds analysis/ide-edit-investigation/REPORT.md (replacing the earlier
wrong report) plus the probe sources under probe_setvalue/.
The MxValueDetails reader gap (case-sensitive ReadProperty + accessor
probe) is a real follow-up: `object attribute value get` should
case-insensitively read `value` and try GetString first when the
underlying MxValue.DataType is MxString. Out of scope here -- that's a
separate, smaller fix.
Test count delta: 67 -> 66 (-2 wrong tests, +1 corrected description test).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
+14
-12
@@ -175,15 +175,15 @@ namespace ZB.MOM.WW.GRAccess.Cli.Tests.Commands
|
||||
branch.ShouldContain("RequireConfirm(args, Arg(args, \"name\"));");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void DispatcherScriptSettings_GuardsPackageOnlyNoOpsBeforeSetValue()
|
||||
{
|
||||
var source = DispatcherSource();
|
||||
|
||||
source.ShouldContain("EnsureMutableViaSetValue(attr, scriptName + \".TriggerPeriod\");");
|
||||
source.ShouldContain("EnsureMutableViaSetValue(attr, scriptName + \".TriggerType\");");
|
||||
source.ShouldContain("EnsureMutableViaSetValue(attr, scriptName + \".Expression\");");
|
||||
}
|
||||
// Removed: tests asserting EnsureMutableViaSetValue and "package-only"
|
||||
// wording in command descriptions. Both reflected an earlier (incorrect)
|
||||
// belief that IAttribute.SetValue silently no-ops on
|
||||
// MxCategoryPackageOnly_Lockable script-text fields. Live round-trip
|
||||
// (analysis/ide-edit-investigation/probe_setvalue/) and AVEVA Tech Note
|
||||
// 537 confirm writes via ConfigurableAttributes[<script>.<field>]
|
||||
// .SetValue persist; the apparent "no-op" was a MxValueDetails reader
|
||||
// gap, not a write-side failure. The safety check + asserting tests
|
||||
// were reverted in commits 4e242ca / e4e5425 + the corrective commit.
|
||||
|
||||
[Fact]
|
||||
public void DispatcherElapsedMilliseconds_UseDocumentedHundredNanosecondUnits()
|
||||
@@ -195,7 +195,7 @@ namespace ZB.MOM.WW.GRAccess.Cli.Tests.Commands
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ScriptCommandDescriptions_CallOutPackageOnlyLimit()
|
||||
public void ScriptCommandDescriptions_DocumentTheTN537Pattern()
|
||||
{
|
||||
var set = (CommandAttribute)Attribute.GetCustomAttribute(
|
||||
typeof(ObjectScriptsSetCommand),
|
||||
@@ -208,8 +208,10 @@ namespace ZB.MOM.WW.GRAccess.Cli.Tests.Commands
|
||||
settings.ShouldNotBeNull();
|
||||
set.Description.ShouldNotBeNull();
|
||||
settings.Description.ShouldNotBeNull();
|
||||
set.Description!.ShouldContain("package-only");
|
||||
settings.Description!.ShouldContain("mutable");
|
||||
// Set-body uses TN-537's ConfigurableAttributes pattern.
|
||||
set.Description!.ShouldContain("TN-537");
|
||||
// Settings command writes through ConfigurableAttributes too.
|
||||
settings.Description!.ShouldContain("ConfigurableAttributes");
|
||||
}
|
||||
|
||||
private static string DispatcherSource()
|
||||
|
||||
Reference in New Issue
Block a user