fix(transport): import diff compares secrets and bindings; preview honours the name map; CI lookups; area paths; no Rename where unsupported (TRN-2, TRN-3, TRN-6, TRN-7, TRN-8, TRN-9, WP2 tasks 2.4+2.5)
2.4 — ArtifactDiff: - TRN-2: secret-bearing values (data-connection primary/backup config, DB connection string, external-system auth, SMTP credentials, SMS token) are compared by SHA-256 and reported value-free as <present> -> <changed>, so a changed endpoint no longer reads Identical and is force-skipped. - TRN-6: the instance diff resolves each existing binding's DataConnectionId to its name and compares it (a rebind OPC1 -> OPC2 is Modified); State is no longer compared (the import never carries a live state). 2.5 — BundleImporter / ManagementActor / Central UI: - TRN-3: PreviewAsync takes an optional BundleNameMap (additive optional param); under a MapToExisting redirect the connection/instance diffs, connection auto-match and unresolved-connection blocker run against the mapped target. The CLI import path passes its explicit --map-site/--map-connection redirects to the preview before the blocker gate; the Central UI re-runs the preview under the Map-step choices at Confirm. Apply binds a CreateNew site/connection whose identifier/name already exists to that row instead of inserting a duplicate the unique index rejects. - TRN-7: connection, instance, instance-template and composition/base-template lookups match exact spelling first, then case-insensitively. - TRN-8: InstanceDto gains the additive AreaPath (root->leaf); the exporter fills it and the importer resolves/creates areas level by level under their real parent. A legacy leaf-only bundle with an ambiguous leaf resolves deterministically and adds an ImportResult warning. - TRN-9: Rename is rejected by ApplyAsync for Site, DataConnection, SmtpConfiguration and SmsConfiguration (ImportRenameSupport); the UI does not offer it there and the CLI rename policy falls back to Skip with a warning. Also moves a doc comment misplaced by the 2.6 commit. Reflection round-trip guard (RoundTripEquivalenceTests) re-run: green.
This commit is contained in:
@@ -30,8 +30,15 @@ public interface IBundleImporter
|
||||
/// </summary>
|
||||
/// <param name="sessionId">Session id returned by <see cref="LoadAsync"/>.</param>
|
||||
/// <param name="ct">Cancellation token.</param>
|
||||
/// <param name="nameMap">
|
||||
/// TRN-3: optional operator site/connection mapping. When supplied, every site-scoped
|
||||
/// preview lookup (connection and instance diffs, the required-mapping auto-match and
|
||||
/// the unresolved-connection blocker) runs against the MAPPED target site and connection
|
||||
/// names instead of the source identity, so a preview reflects what the apply with the
|
||||
/// same map will do. <c>null</c> (the default) keeps the identity auto-match.
|
||||
/// </param>
|
||||
/// <returns>A task that resolves to a per-artifact import preview with conflict details.</returns>
|
||||
Task<ImportPreview> PreviewAsync(Guid sessionId, CancellationToken ct = default);
|
||||
Task<ImportPreview> PreviewAsync(Guid sessionId, CancellationToken ct = default, BundleNameMap? nameMap = null);
|
||||
|
||||
/// <summary>
|
||||
/// Applies the chosen conflict resolutions and commits the import transaction.
|
||||
|
||||
@@ -7,3 +7,25 @@ public sealed record ImportResolution(
|
||||
string Name,
|
||||
ResolutionAction Action,
|
||||
string? RenameTo);
|
||||
|
||||
/// <summary>
|
||||
/// TRN-9: which preview entity types a <see cref="ResolutionAction.Rename"/> resolution
|
||||
/// is meaningful for. A Site, a site-scoped DataConnection, an SMTP configuration and
|
||||
/// an SMS configuration have no renameable identity: a renamed site/connection was
|
||||
/// silently treated as Skip, and a renamed SMTP/SMS row mangled the Host / AccountSid
|
||||
/// into a junk second row that delivery (lowest-id wins) never used. The importer
|
||||
/// rejects Rename for these types, the Central UI does not offer it, and the CLI's
|
||||
/// <c>--conflict-policy rename</c> falls back to Skip for them with a warning.
|
||||
/// </summary>
|
||||
public static class ImportRenameSupport
|
||||
{
|
||||
private static readonly HashSet<string> Unsupported = new(StringComparer.Ordinal)
|
||||
{
|
||||
"Site", "DataConnection", "SmtpConfiguration", "SmsConfiguration",
|
||||
};
|
||||
|
||||
/// <summary>True when a Rename resolution is supported for <paramref name="entityType"/>.</summary>
|
||||
/// <param name="entityType">The preview item / resolution entity type.</param>
|
||||
/// <returns><c>false</c> for Site, DataConnection, SmtpConfiguration and SmsConfiguration.</returns>
|
||||
public static bool IsSupported(string entityType) => !Unsupported.Contains(entityType);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user