From b42d9808777952570594ebee727a2b6a910626c6 Mon Sep 17 00:00:00 2001 From: EugeneTes Date: Thu, 3 Sep 2026 13:08:39 +0200 Subject: [PATCH] Fix UDP port 9100 test race; correct CompositeDiscoveryService design doc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FIX 1 — UDP 9100 binding race: SprtDiscoveryServiceTests and CompositeDiscoveryServiceTests both use exclusive UDP 9100 binds. xunit runs test classes concurrently by default, causing the tests to fail intermittently with AddressAlreadyInUse. Add [Collection("udp-9100")] attribute to both classes so they run serially instead. FIX 2 — Design doc: CompositeDiscoveryService does NOT forward the callback down to children; it raises the caller's callback itself after all children finish, once per unique IP. Rewrite the relevant sentence to describe the real behavior. Verify: 30 tests pass (x2), build clean, no production code touched. Claude-Session: https://claude.ai/code/session_01E6N3P4nSZLtp4BC2LXVref --- Inspectron.Epson.Tests/CompositeDiscoveryServiceTests.cs | 1 + Inspectron.Epson.Tests/SprtDiscoveryServiceTests.cs | 1 + .../superpowers/specs/2026-09-03-pos895-integration-design.md | 4 +++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Inspectron.Epson.Tests/CompositeDiscoveryServiceTests.cs b/Inspectron.Epson.Tests/CompositeDiscoveryServiceTests.cs index 4e3276d..548ae13 100644 --- a/Inspectron.Epson.Tests/CompositeDiscoveryServiceTests.cs +++ b/Inspectron.Epson.Tests/CompositeDiscoveryServiceTests.cs @@ -2,6 +2,7 @@ using Inspectron.Epson; namespace Inspectron.Epson.Tests; +[Collection("udp-9100")] public class CompositeDiscoveryServiceTests { private sealed class StubDiscovery : IDiscoveryService diff --git a/Inspectron.Epson.Tests/SprtDiscoveryServiceTests.cs b/Inspectron.Epson.Tests/SprtDiscoveryServiceTests.cs index 4ea5050..817aec2 100644 --- a/Inspectron.Epson.Tests/SprtDiscoveryServiceTests.cs +++ b/Inspectron.Epson.Tests/SprtDiscoveryServiceTests.cs @@ -3,6 +3,7 @@ using Inspectron.Epson; namespace Inspectron.Epson.Tests; +[Collection("udp-9100")] public class SprtDiscoveryServiceTests { // The exact 39 bytes the printer returned on the bench: diff --git a/docs/superpowers/specs/2026-09-03-pos895-integration-design.md b/docs/superpowers/specs/2026-09-03-pos895-integration-design.md index 80247cf..54e0853 100644 --- a/docs/superpowers/specs/2026-09-03-pos895-integration-design.md +++ b/docs/superpowers/specs/2026-09-03-pos895-integration-design.md @@ -67,7 +67,9 @@ this service. **`CompositeDiscoveryService`** - takes `IEnumerable`, runs them concurrently on the shared timeout, merges results by `IPAddress` with -first-wins, and forwards each child's `onPrinterDiscovered` callback as it fires. +first-wins. It does not pass the `onPrinterDiscovered` callback to its children; +instead, it raises the caller's callback itself after all children finish, +once per unique IP, so a printer answering two discovery protocols notifies only once. It absorbs a single child's failure (logs it, keeps the other children's results) but rethrows when every child fails, since that means discovery itself is broken rather than that the network simply has no printers on it.