fix(transport): bump bundle schemaVersion 1.2 -> 1.3 for the additive instance AreaPath (TRN-8 follow-up, decision A)
Minor bumps mark additive fields (1.1 sites/connections/instances, 1.2 #118 Derivation). TRN-8 added InstanceDto.AreaPath without a bump. Exporter now stamps 1.3; ManifestValidator still gates only on bundleFormatVersion, so 1.0-1.2 bundles import unchanged and older importers accept a 1.3 bundle (ignoring AreaPath, leaf-name fallback). Theory pins 1.0-1.4 validating Ok; version-pinning tests read the constant. Component-Transport.md + CLAUDE.md.
This commit is contained in:
+1
-1
@@ -614,7 +614,7 @@ public sealed class DerivedTemplateTransportTests : IDisposable
|
||||
await SeedPumpWithDerivedMotorAsync(provider);
|
||||
var bundle = await ExportAsync(provider, null, "Pump");
|
||||
Assert.Contains("\"Derivation\"", ReadEntry(bundle, "content.json"), StringComparison.Ordinal);
|
||||
Assert.Contains("\"SchemaVersion\":\"1.2\"", ReadEntry(bundle, "manifest.json"), StringComparison.Ordinal);
|
||||
Assert.Contains("\"SchemaVersion\":\"" + ManifestBuilder.CurrentSchemaVersion + "\"", ReadEntry(bundle, "manifest.json"), StringComparison.Ordinal);
|
||||
|
||||
await WipeTemplatesAsync(provider);
|
||||
var session = await LoadAsync(provider, bundle);
|
||||
|
||||
@@ -36,8 +36,9 @@ public sealed class ManifestBuilderTests
|
||||
Assert.Equal("user", manifest.ExportedBy);
|
||||
Assert.Equal("1.0.0", manifest.ScadaBridgeVersion);
|
||||
Assert.Equal(1, manifest.BundleFormatVersion);
|
||||
// Schema minor bumped 1.0 → 1.1; format version stays 1.
|
||||
Assert.Equal("1.2", manifest.SchemaVersion);
|
||||
// Schema minor bumped 1.2 → 1.3 (TRN-8 AreaPath); format version stays 1.
|
||||
Assert.Equal("1.3", manifest.SchemaVersion);
|
||||
Assert.Equal(ManifestBuilder.CurrentSchemaVersion, manifest.SchemaVersion);
|
||||
Assert.Null(manifest.Encryption);
|
||||
}
|
||||
|
||||
@@ -112,6 +113,37 @@ public sealed class ManifestBuilderTests
|
||||
Assert.Equal(ManifestValidationResult.Ok, result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifies that every schema minor up to and including the current one validates Ok —
|
||||
/// minor bumps are additive, so a 1.0/1.1/1.2 bundle keeps importing after the 1.3 bump
|
||||
/// (TRN-8 AreaPath), and so does a future additive minor (the validator gates only on
|
||||
/// <see cref="ManifestBuilder.CurrentBundleFormatVersion"/>).
|
||||
/// </summary>
|
||||
[Theory]
|
||||
[InlineData("1.0")]
|
||||
[InlineData("1.1")]
|
||||
[InlineData("1.2")]
|
||||
[InlineData("1.3")]
|
||||
[InlineData("1.4")]
|
||||
public void Validate_accepts_every_schema_minor_under_format_version_1(string schemaVersion)
|
||||
{
|
||||
var bytes = Encoding.UTF8.GetBytes("bundle-" + schemaVersion);
|
||||
var hash = "sha256:" + Convert.ToHexString(SHA256.HashData(bytes)).ToLowerInvariant();
|
||||
var manifest = new BundleManifest(
|
||||
BundleFormatVersion: ManifestBuilder.CurrentBundleFormatVersion,
|
||||
SchemaVersion: schemaVersion,
|
||||
CreatedAtUtc: DateTimeOffset.UtcNow,
|
||||
SourceEnvironment: "env",
|
||||
ExportedBy: "u",
|
||||
ScadaBridgeVersion: "v",
|
||||
ContentHash: hash,
|
||||
Encryption: null,
|
||||
Summary: EmptySummary,
|
||||
Contents: NoContents);
|
||||
|
||||
Assert.Equal(ManifestValidationResult.Ok, new ManifestValidator().Validate(manifest, bytes));
|
||||
}
|
||||
|
||||
/// <summary>Verifies that validation accepts an older schema version 1.0 manifest.</summary>
|
||||
[Fact]
|
||||
public void Validate_accepts_older_schemaVersion_1_0_manifest()
|
||||
|
||||
Reference in New Issue
Block a user