fix(transport): blocker heuristic no longer hard-blocks valid imports — local declarations excluded, denylist extended, template-script findings downgraded to warnings

#05-T19. Import name-resolution findings are now split by origin: template-script
(and attribute-default-expression) references become non-blocking advisory
warnings (ConflictKind.Warning + ImportResult.Warnings) since the design-time
deploy gate re-validates authoritatively; ApiMethod-script references stay hard
errors (SemanticValidationException / ConflictKind.Blocker) as they have no
downstream gate. Names declared locally in a body (Roslyn-parsed local functions
/ methods) are excluded so a script's own helper isn't flagged; KnownNonReferenceNames
extended with common BCL/LINQ/SQL surface. DetectBlockersAsync and
RunSemanticValidationAsync Pass 1 apply the identical split so preview and apply
agree. Rollback/hard-fail tests retargeted to ApiMethods (the still-hard-failing
vehicle). CentralUI preview renders the new Warning badge/advisory.

Claude-Session: https://claude.ai/code/session_01MtdgwpEeCUn6cUA5f1LMPj
This commit is contained in:
Joseph Doherty
2026-07-10 02:12:26 -04:00
parent 8e92198078
commit c60347c5e7
10 changed files with 426 additions and 121 deletions
@@ -1,6 +1,12 @@
namespace ZB.MOM.WW.ScadaBridge.Commons.Types.Transport;
public enum ConflictKind { Identical, Modified, New, Blocker }
// Warning is a NON-blocking advisory finding (appended after Blocker so the
// enum ordinal of the existing members is unchanged). Import may proceed with
// Warning items present; only Blocker items stop an apply. Template-script
// name-resolution findings surface as Warning because the design-time deploy
// gate (ScriptCompiler.TryCompile) re-validates them authoritatively; ApiMethod
// findings — which have no downstream gate — stay Blocker.
public enum ConflictKind { Identical, Modified, New, Blocker, Warning }
public sealed record ImportPreviewItem(
string EntityType,
@@ -11,4 +11,15 @@ public sealed record ImportResult(
// Number of legacy inbound API keys found in the bundle that were ignored
// (keys are not transported; re-create them on this environment).
// Defaults to 0 so existing positional construction sites stay source-compatible.
int ApiKeysIgnored = 0);
int ApiKeysIgnored = 0,
// Advisory (non-blocking) import findings surfaced during apply — currently
// template-script name-resolution references that didn't resolve to a bundled
// or target SharedScript / ExternalSystem. These are warnings, NOT errors:
// the deploy-time gate re-validates them authoritatively. ApiMethod-script
// findings are hard errors instead and surface via SemanticValidationException.
// Defaulted null → normalized to empty so existing positional callers compile.
IReadOnlyList<string>? Warnings = null)
{
/// <summary>Advisory, non-blocking import findings. Never null.</summary>
public IReadOnlyList<string> Warnings { get; init; } = Warnings ?? Array.Empty<string>();
}