mesh-controller.try fault A: decide drop-only dead letters by a module's own retention: work-queue, not by the bus's work-queue retention alone (issue 1178)
sourceAge keyed AgainTo's clause-6 refusal on the stream's bus retention policy, which SEAT_* and other mesh-internal work queues share without being one of ADR 0436 §6's module streams — so every seat's ask, once given up on, was refused delivery again. Added a dedicated metadata key (WorkQueueMetadata), set only by ModuleStream.Stream() when the catalogue declared retention: work-queue, and read sourceAge from that instead of the stream's retention policy. New test proves a seat's own work queue carries neither that metadata nor the restricted one.
This commit is contained in:
@@ -31,6 +31,25 @@ func TestAWorkQueueStreamIsRestrictedOnTheBus(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// mesh-controller.try fault A, d8249dad: a seat's own work queue (SEAT_*, novox/hq ADR 0190, ADR 0264 §4) is
|
||||
// a JetStream work queue at the bus level too — exactly one worker takes each ask — but it is never a module
|
||||
// stream the catalogue declared retention: work-queue (ADR 0436 §6), so it carries none of that clause's
|
||||
// metadata and its dead letters are still delivered again (ADR 0264 §4), unlike mail-sends'.
|
||||
func TestASeatsWorkQueueIsNotADR0436WorkQueue(t *testing.T) {
|
||||
seatQueue := broker.Stream{Name: "SEAT_NODE_BUILD_AGENT", Retention: broker.RetentionWorkQueue, DiscardNew: true}
|
||||
cfg := broker.StreamConfigFor(seatQueue)
|
||||
if _, has := cfg.Metadata[broker.WorkQueueMetadata]; has {
|
||||
t.Fatalf("a seat's own work queue carries ADR 0436 §6's metadata: %+v", cfg.Metadata)
|
||||
}
|
||||
if _, has := cfg.Metadata[broker.RestrictedMetadata]; has {
|
||||
t.Fatalf("a seat's own work queue is restricted: %+v", cfg.Metadata)
|
||||
}
|
||||
// sourceAge (deadletters.go) reads exactly these two keys off a real stream's config; neither set means
|
||||
// KeepDeadLetter marks a seat's dead letter WorkQueue: false, so AgainTo never reaches clause 6's
|
||||
// drop-only case for it (proven directly in TestAWorkQueueDeadLetterIsNeverDeliveredAgain) and a seat's
|
||||
// ask is still delivered again (ADR 0264 §4), as it was before this release.
|
||||
}
|
||||
|
||||
// 1178/AC3: a dead letter's headers say it came from a work-queue stream, and reading it back carries that
|
||||
// (and the restricted flag its aging and hiding already key off, deadLetterOf being the one place both are
|
||||
// read: see DeadLetter.Restricted's doc).
|
||||
|
||||
Reference in New Issue
Block a user