test(grpc-data): A4 review r2 NITs — F4 ungranted caller is refused without promoting the folder (fake gate honours ConditionBearing; control is BadUserAccessDenied), EventId retention across a held-set takeover
Adds the ProjectedFolderEventNotifier test observation. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
+37
@@ -164,6 +164,43 @@ public sealed class ImportedConditionMethodWireTests
|
||||
_ = refresh; // review S6: the RefreshRequired itself is pinned over the wire by A_resync_that_cannot_re_bind_…
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A4 review r2 NIT (F1 EventId retention across a held-set takeover, previously only live-gated by A03): the consumer
|
||||
/// holds its conditions across its own deploy and the next runner re-snapshots ONTO the same nodes. What reaches the
|
||||
/// node manager is a restart of the stream's versions with the same marker — and, after an origin reload restatement
|
||||
/// (#935), a new record time. The condition instance, its current EventId and every older still-retained EventId stay
|
||||
/// bound, no event is reported; the takeover's RefreshRequired is not a condition event either.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async Task R2_a_takeover_re_snapshot_with_the_same_marker_keeps_the_instance_and_every_retained_EventId()
|
||||
{
|
||||
var ct = TestContext.Current.CancellationToken;
|
||||
await using var rig = await ServerEventRig.StartAsync("a4-r2-takeover", encrypted: false, ct);
|
||||
var f = Fixture.Install(rig);
|
||||
var t0 = DateTimeOffset.UtcNow.AddMinutes(-1);
|
||||
f.Apply(Update(version: 3, active: true, acked: false, time: t0, message: "first"));
|
||||
var older = f.CurrentEventId();
|
||||
f.Apply(Update(version: 4, active: true, acked: false, time: t0.AddSeconds(1), message: "second"));
|
||||
var current = f.CurrentEventId();
|
||||
current.ShouldNotBe(older, "positive control: a real transition mints a new EventId");
|
||||
var instance = rig.Nm.FindImportedCondition(Connection, Key1);
|
||||
var reported = rig.Nm.ImportedEventsReported;
|
||||
|
||||
// The takeover runner's first snapshot: versions restart (new stream), same marker, a restated (newer) record time.
|
||||
f.Apply(Update(version: 1, active: true, acked: false, time: t0.AddSeconds(30), message: "second"));
|
||||
rig.Nm.RequireRefresh(Connection);
|
||||
ReferenceEquals(rig.Nm.FindImportedCondition(Connection, Key1), instance).ShouldBeTrue("the same condition object — not removed and re-created");
|
||||
f.CurrentEventId().ShouldBe(current, "no event, no new EventId");
|
||||
rig.Nm.ImportedEventsReported.ShouldBe(reported, "an unchanged occurrence reports nothing");
|
||||
|
||||
using var session = await rig.ConnectAsync(anonymous: false, ct);
|
||||
var id = f.ConditionId(session);
|
||||
(await CallAsync(session, id, MethodIds.AcknowledgeableConditionType_Acknowledge, older, "older", ct)).ShouldBe(StatusCodes.Good);
|
||||
(await CallAsync(session, id, MethodIds.AcknowledgeableConditionType_Acknowledge, current, "current", ct)).ShouldBe(StatusCodes.Good);
|
||||
f.Port.Calls.Count.ShouldBe(2);
|
||||
f.Port.Calls.ShouldAllBe(c => c.ExpectedActivation == Marker1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// §5.6 step 6 / §9.3 L3 (hard gate): the origin's method handler stalls 5 s. Read, Browse and a data Publish on the
|
||||
/// consumer complete in < 200 ms meanwhile, the node manager's <c>Lock</c> is free, and no acknowledged state is
|
||||
|
||||
Reference in New Issue
Block a user