test(template): M2.8 review nits — stale-binding comment + stale-ID & inert-check tests (#23)
Add code comments in ValidateConnectionBindingCompleteness explaining that the unbound-attribute branch also covers the silently-dropped stale-binding case (cross-reference FlatteningService.ApplyConnectionBindings), and that the `continue` skips the exists-at-site check for unbound attrs. Add two new tests: - FlatteningPipelineConnectionBindingTests: stale DataConnectionId (999) not present in site connections → flattener drops it silently → validator reports ConnectionBinding Error, IsValid false. - ValidationServiceTests: enforce:true + siteConnectionNames:null on a properly-bound attribute → no ConnectionBinding error (exists-at-site check stays inert when site set is not supplied).
This commit is contained in:
@@ -580,6 +580,17 @@ public class ValidationService
|
||||
// Unbound data-sourced attribute. At deploy time this gates the
|
||||
// deployment; at design time the binding is set later, so it is
|
||||
// only advisory.
|
||||
//
|
||||
// NOTE: this branch fires for TWO distinct cases that are
|
||||
// indistinguishable post-flattening:
|
||||
// 1. The user genuinely never set a binding.
|
||||
// 2. The user set a binding, but FlatteningService.ApplyConnectionBindings
|
||||
// silently dropped it because the stored DataConnectionId no longer
|
||||
// resolves to any loaded site DataConnection (i.e. the connection was
|
||||
// deleted after the binding was created). In that case the flattener
|
||||
// leaves BoundDataConnectionId == null, and the attribute falls into
|
||||
// this same "unbound → Error" path.
|
||||
// The error message covers both cases; no behavioral change is needed.
|
||||
if (enforce)
|
||||
{
|
||||
errors.Add(ValidationEntry.Error(ValidationCategory.ConnectionBinding,
|
||||
@@ -592,6 +603,7 @@ public class ValidationService
|
||||
$"Attribute '{attr.CanonicalName}' has a data source reference but no connection binding.",
|
||||
attr.CanonicalName));
|
||||
}
|
||||
// Skip the "exists at site" check below — it only applies to bound attributes.
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user