fix(grpc-data): A3 condition items carry the origin's canonical root view (metadata asked like the browse resolver) — live a3b-cond-2 found map-uns refused Denied
This commit is contained in:
@@ -287,8 +287,15 @@ public sealed partial class ProjectedConditionAccess : IProjectedConditionAccess
|
||||
{
|
||||
public ProjectedMappingPlacement Placement { get; } = placement;
|
||||
public string MappingId => Placement.Mapping.RemoteNamespaceMappingId;
|
||||
public DataView Root { get; } = new(placement.Anchor.Address, placement.Mapping.Realm, null, 0, placement.Anchor.Address.Identifier);
|
||||
// The origin view of the remote root, built exactly as RemoteNamespaceResolver builds it (subject = the mapping's
|
||||
// RemoteRootEntityId): a UNS root's address identifier is an opaque id, and the origin refuses a root item whose subject
|
||||
// is not its own (live a3b-cond-2: map-uns item Denied).
|
||||
public DataView Root { get; } = new(placement.Anchor.Address, placement.Mapping.Realm, null, 0,
|
||||
string.IsNullOrWhiteSpace(placement.Mapping.RemoteRootEntityId) ? placement.Anchor.Address.Identifier : placement.Mapping.RemoteRootEntityId);
|
||||
public string? RootSubject { get; set; }
|
||||
/// <summary>The origin's canonical view of the remote root (from metadata): the root item must carry the origin's own
|
||||
/// subject — a view built from the address alone (subject = identifier) is refused for an opaque-id UNS root.</summary>
|
||||
public DataView? RootView { get; set; }
|
||||
public ulong? Handle { get; set; }
|
||||
public ProjectedConditionMappingStatus Status { get; set; } = ProjectedConditionMappingStatus.Pending;
|
||||
public int Total { get; set; }
|
||||
@@ -407,7 +414,11 @@ public sealed partial class ProjectedConditionAccess : IProjectedConditionAccess
|
||||
var metadata = await connection.GetMetadataAsync(new MetadataRequest(states.Select(x => x.Root).ToArray(), budget), token)
|
||||
.ConfigureAwait(false);
|
||||
for (var i = 0; i < states.Length && i < metadata.Count; i++)
|
||||
if (metadata[i] is { Status: DataItemStatus.Good, Value: { } root }) states[i].RootSubject = root.View.Subject;
|
||||
if (metadata[i] is { Status: DataItemStatus.Good, Value: { } root })
|
||||
{
|
||||
states[i].RootSubject = root.View.Subject;
|
||||
states[i].RootView = root.View;
|
||||
}
|
||||
}
|
||||
catch (Exception ex) when (ex is not OperationCanceledException) { }
|
||||
|
||||
@@ -417,7 +428,7 @@ public sealed partial class ProjectedConditionAccess : IProjectedConditionAccess
|
||||
epoch, _connectionId, states.Length, Serving?.NodeId ?? "(no provenance)");
|
||||
var subscriptionId = "conditions-" + Guid.NewGuid().ToString("N");
|
||||
var settings = new DataSubscriptionSettings(TimeSpan.Zero, TimeSpan.Zero, DataChangeTrigger.StatusValue, null);
|
||||
var items = states.Select(x => new DataSubscriptionItem(x.MappingId, x.Root, settings, new DataConditionScope(IncludeInfo: true))).ToArray();
|
||||
var items = states.Select(x => new DataSubscriptionItem(x.MappingId, x.RootView ?? x.Root, settings, new DataConditionScope(IncludeInfo: true))).ToArray();
|
||||
await subscription.SendAsync(new OpenSubscription(subscriptionId, epoch, "open", TimeSpan.FromSeconds(30), items, false,
|
||||
TimeSpan.FromMinutes(60), new DataBudget(TimeSpan.FromSeconds(30), 1000, 4 * 1024 * 1024)), token).ConfigureAwait(false);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user