Files
wwtools/graccesscli
Joseph Doherty c52d8d0171 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>
2026-05-05 21:33:51 -04:00
..

graccesscli

A .NET Framework 4.8 / x86 CliFx-based CLI for automating AVEVA / Wonderware System Platform Galaxy configuration through the ArchestrA GRAccess COM interop library (ZB.MOM.WW.GRAccess.Cli).

Hard constraints

GRAccess is a 32-bit COM stack. Skipping any of these will fail at load or corrupt Galaxy state:

  • Target framework / arch: net48, x86, [STAThread]. No exceptions.
  • Cannot be loaded from a .NET 10 / x64 process — see GRAccess-DLL-and-DotNet10-Notes.md.
  • AVEVA System Platform must be installed locally (or ArchestrA.GRAccess.dll registered in the GAC at C:\Windows\assembly\GAC\Archestra.GRAccess\1.7.0.0_23106a86e706d0ae\). The bundled copy in lib/ is for build-time reference only.
  • In daemon mode, every COM call must be marshalled through Session/StaComThread.cs; calling GRAccess from any other thread will deadlock or corrupt state.
  • Keep the root GRAccessApp alive for the lifetime of any derived IGalaxy / IgObject handle.
  • Mutation flow is fixed: CheckOut → modify → Save → CheckIn(comment). Skipping CheckIn leaves the object locked in the Galaxy repo.
  • Build requires Visual Studio / MSBuild with the x86 platform target.

Layout

graccesscli/
  ZB.MOM.WW.GRAccess.Cli.slnx        # solution
  lib/ArchestrA.GRAccess.dll         # bundled COM interop assembly (reference only)
  src/ZB.MOM.WW.GRAccess.Cli/        # CLI project (net48, x86, CliFx)
  tests/ZB.MOM.WW.GRAccess.Cli.Tests # test project
  docs/                              # CLI workflows, LLM contract, parsing/editing guides
  AGENTS.md                          # coding-agent rules for this tool
  CLAUDE.md                          # detailed agent guide
  graccess_documentation.md          # full GRAccess API reference
  graccess_operations.md             # GRAccess operations grouped by functional area
  usage.md                           # compatibility copy of docs/usage.md
  GRAccess-DLL-and-DotNet10-Notes.md # platform / 32-bit COM / .NET 10 incident notes
  requirements-mutation-typelib-fix.md # active mutation-path defect tracker

Resource index

Task Go to
Coding-agent rules for working in this folder AGENTS.md
General agent guide (project overview, references) CLAUDE.md
Full GRAccess API surface (types, methods) graccess_documentation.md
GRAccess operations grouped by functional area, with page refs graccess_operations.md
CLI commands, options, session mode, IPC protocol docs/usage.md
LLM-facing operating contract (envelopes, safety, batch) docs/llm-integration.md
Add a new CLI command end-to-end docs/adding-features.md
Inspect / read existing templates (read-only) docs/template-parsing.md
Parse template attributes and setting families docs/attribute-parsing.md
Parse script libraries and object-level scripts docs/script-parsing.md
Edit existing templates safely docs/template-editing.md
Create / edit template instances, areas, engine assignments, I/O docs/template-instance-editing.md
Edit template attributes, UDAs, extensions, setting families docs/attribute-editing.md
Edit script libraries and script-bearing template content docs/script-editing.md
Live ZB galaxy reference (read-only capture) docs/zb-galaxy.md
Live ZB $TestMachine template family reference docs/zb-testmachine.md
CliFx framework reference (commands, options, DI, testing) docs/clifx_reference.md
GRAccess DLL / 32-bit COM / .NET 10 platform notes GRAccess-DLL-and-DotNet10-Notes.md
Active mutation-path COM lifecycle defects requirements-mutation-typelib-fix.md
Index for docs/ only docs/README.md

Maintenance

Documentation rules live in ../DOCS-GUIDE.md; the root task → tool index lives in ../CLAUDE.md. When adding, renaming, or removing any doc in this folder, update the resource index above in the same change. When the user-facing CLI surface changes, update docs/usage.md (and keep usage.md aligned).