R1.11 DelTep capture + R1.3/R1.4/R1.12/R1.13 bounded out
DelTep (extended-property delete) — wire format captured + serializer golden-proven, but live delete is server-blocked and NOT exposed publicly: - Captured the DelTep inBuff via a cross-session trick (harness add-tep gains --tep-skip-add + read-for-sync before --tep-delete; Capture-DeleteTagExtended Properties.ps1 / decode-del-tep-capture.py). Layout = same group framing as AddTEx but property-name-only (no 0x43 value) + 0x00 group trailer. - SerializeDeleteRequest + 4 golden tests pin the server-accepted buffer. - A decisive experiment shows SDK-added properties ARE deletable (the native client read-syncs and deletes one), so SDK-add is complete; the SDK's own DelTep is rejected by CHistStorage::DeleteTagExtendedProperties even with byte-identical inBuff, matching mode/handle, GetTgByNm+GetTepByNm prime, open channel, and 60s retries. Root cause: the native multiplexes services over one connection (per-connection working set); the SDK's per-service WCF channels don't reproduce it. Kept as documented-but-blocked internal orchestrator path; no public HistorianClient delete API. Bounded out with evidence (no code; docs + roadmap + probe): - R1.12 localized-property write — no op on 2020 (mirror of R1.6); no *LocalizedPropert*/TagLocalized* symbol in any current/*.dll. - R1.13 non-analog tag create — GATED; native AddTag rejects every non-analog type client-side (ValidationFailed, before any WCF op): SingleByteString, DoubleByteString, Int1 all fail, Float works. No Discrete type in the native enum, no TagType setter. No wire request to capture. - R1.3 timezone + R1.4 EventStorageMode — re-confirmed 2023R2/gRPC-only from the Runtime DB schema (no timezone param, no EventStorageMode anywhere) and a parameter-op probe (GetSystemParameter + GETRP return null/throw for every candidate; only HistorianVersion works). 238 unit tests pass; full solution builds with 0 warnings. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B6mcaT2PjRFKcogzp9UkfC
This commit is contained in:
@@ -565,6 +565,12 @@ public sealed class HistorianClientIntegrationTests
|
||||
}
|
||||
}
|
||||
|
||||
// Extended-property DELETE (DelTep) has no live integration test: the wire format is captured and
|
||||
// the serializer is golden-verified (WcfTagExtendedPropertyWriteProtocolTests), but the SDK
|
||||
// cannot yet make the server accept the delete (the native single-connection working-set
|
||||
// requirement isn't reproduced by per-service WCF channels). See
|
||||
// docs/reverse-engineering/wcf-add-tag-extended-properties.md §Delete.
|
||||
|
||||
// Round-trip every live-verified analog data type + the non-default-range case. The
|
||||
// sandbox tag name is suffixed per case so the runs don't collide. Always cleans up.
|
||||
[Theory]
|
||||
|
||||
@@ -153,4 +153,43 @@ public sealed class StringHandleProbeDiagnosticTests
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// R1.3 / R1.4 reachability probe: ask GetSystemParameter (config) and GetRuntimeParameter (GETRP,
|
||||
/// live runtime state) for timezone + event-storage-mode candidate keys. If the server timezone or
|
||||
/// EventStorageMode surfaces through either named-parameter op, R1.3/R1.4 are deliverable on 2020;
|
||||
/// if every candidate returns null, they are confirmed 2023R2/gRPC-only from the parameter angle.
|
||||
/// Prints results — not an assertion test.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async Task TimezoneAndStorageMode_ParameterProbe_AgainstLocalHistorian()
|
||||
{
|
||||
if (!ShouldRun(out string host)) return;
|
||||
|
||||
HistorianClient client = new(new HistorianClientOptions
|
||||
{
|
||||
Host = host,
|
||||
IntegratedSecurity = true,
|
||||
Transport = HistorianTransport.LocalPipe
|
||||
});
|
||||
|
||||
// Timezone (R1.3) candidates + the one existing time-ish SystemParameter (TimeStampRule);
|
||||
// EventStorageMode (R1.4) candidates + the existing EventStorage* params as controls.
|
||||
string[] candidates =
|
||||
[
|
||||
"TimeZone", "ServerTimeZone", "SystemTimeZone", "TimeZoneName", "SystemTimeZoneName",
|
||||
"TimeStampRule", "ServerTime",
|
||||
"EventStorageMode", "StorageMode", "EventStorage", "EventStorageDuration",
|
||||
"HistorianVersion", // known-good control
|
||||
];
|
||||
|
||||
foreach (string key in candidates)
|
||||
{
|
||||
string? sys = null, run = null;
|
||||
string sysErr = "", runErr = "";
|
||||
try { sys = await client.GetSystemParameterAsync(key); } catch (Exception ex) { sysErr = ex.GetType().Name; }
|
||||
try { run = await client.GetRuntimeParameterAsync(key); } catch (Exception ex) { runErr = ex.GetType().Name; }
|
||||
_output.WriteLine($"{key,-22} SystemParameter={(sys is null ? "<null>" : $"\"{sys}\"")}{(sysErr.Length > 0 ? $" [{sysErr}]" : "")} RuntimeParameter={(run is null ? "<null>" : $"\"{run}\"")}{(runErr.Length > 0 ? $" [{runErr}]" : "")}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,4 +69,58 @@ public sealed class WcfTagExtendedPropertyWriteProtocolTests
|
||||
Assert.Throws<ArgumentException>(() =>
|
||||
HistorianTagExtendedPropertyProtocol.SerializeAddRequest("T", Array.Empty<HistorianTagExtendedProperty>()));
|
||||
}
|
||||
|
||||
// Server-accepted DelTep inBuff for tag "RetestSdkWriteDelTepSdk", property "SdkDelProp",
|
||||
// extracted byte-for-byte from the native DeleteTagExtendedPropertiesByName WriteMessage in the
|
||||
// cross-session capture (scripts/Capture-DeleteTagExtendedProperties.ps1) — DelTep returned
|
||||
// success, so it is server-validated.
|
||||
private const string ServerAcceptedDeleteInBuffBase64 =
|
||||
"AQAAAAEJFwBSZXRlc3RTZGtXcml0ZURlbFRlcFNkawEAAAACCQoAU2RrRGVsUHJvcAAA";
|
||||
|
||||
[Fact]
|
||||
public void SerializeDeleteRequest_MatchesServerAcceptedBuffer()
|
||||
{
|
||||
byte[] expected = Convert.FromBase64String(ServerAcceptedDeleteInBuffBase64);
|
||||
byte[] actual = HistorianTagExtendedPropertyProtocol.SerializeDeleteRequest(
|
||||
"RetestSdkWriteDelTepSdk", ["SdkDelProp"]);
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SerializeDeleteRequest_SingleProperty_HasExpectedLayout()
|
||||
{
|
||||
byte[] buf = HistorianTagExtendedPropertyProtocol.SerializeDeleteRequest(
|
||||
"ReactorTemp", ["Location"]);
|
||||
|
||||
int c = 0;
|
||||
Assert.Equal(1u, BinaryPrimitives.ReadUInt32LittleEndian(buf.AsSpan(c, 4))); c += 4; // group count
|
||||
Assert.Equal(0x01, buf[c++]); // group marker
|
||||
Assert.Equal(0x09, buf[c++]); // compact string marker
|
||||
Assert.Equal(11, BinaryPrimitives.ReadUInt16LittleEndian(buf.AsSpan(c, 2))); c += 2; // tag byte len
|
||||
Assert.Equal("ReactorTemp", Encoding.ASCII.GetString(buf.AsSpan(c, 11))); c += 11;
|
||||
Assert.Equal(1u, BinaryPrimitives.ReadUInt32LittleEndian(buf.AsSpan(c, 4))); c += 4; // property count
|
||||
Assert.Equal(0x02, buf[c++]); // property marker
|
||||
Assert.Equal(0x09, buf[c++]);
|
||||
Assert.Equal(8, BinaryPrimitives.ReadUInt16LittleEndian(buf.AsSpan(c, 2))); c += 2;
|
||||
Assert.Equal("Location", Encoding.ASCII.GetString(buf.AsSpan(c, 8))); c += 8;
|
||||
// Delete carries NO value variant (Add would have 0x43 ... here).
|
||||
Assert.Equal(0x00, buf[c++]); // group trailer (0x00 for delete, vs 0x01 for add)
|
||||
Assert.Equal(0x00, buf[c++]); // buffer terminator
|
||||
Assert.Equal(buf.Length, c);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SerializeDeleteRequest_MultipleNames_EncodesCount()
|
||||
{
|
||||
byte[] buf = HistorianTagExtendedPropertyProtocol.SerializeDeleteRequest("T", ["A", "B"]);
|
||||
// group count @0, then 0x01 marker, 0x09 + u16(1) + "T" => property count at offset 4+1+1+2+1 = 9
|
||||
Assert.Equal(2u, BinaryPrimitives.ReadUInt32LittleEndian(buf.AsSpan(9, 4)));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SerializeDeleteRequest_NoProperties_Throws()
|
||||
{
|
||||
Assert.Throws<ArgumentException>(() =>
|
||||
HistorianTagExtendedPropertyProtocol.SerializeDeleteRequest("T", Array.Empty<string>()));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user