[GH-ISSUE #3252] test(pcap): align retained cleanup fixture with emitted stdout #1166

Closed
opened 2026-10-15 18:31:40 +00:00 by bsakaguchi · 1 comment
Owner

Originally created by @N0zoM1z0 on GitHub (Oct 14, 2026).
Original GitHub issue: https://github.com/morluto/rea/issues/3252

Originally assigned to: @N0zoM1z0 on GitHub.

The newly added retained-cleanup regression in tests/boundary/pcap/pcapProvider.test.ts fails because its expected raw capinfos stdout differs from the bytes emitted by its own fixture. The production adapter correctly preserves those bytes.

Baseline: main 7375ab6e34e511095a74d5a67e57cec28d56fd10, containing the pcap partial-observation change 23c70d674. Hosted reproduction: job 115710939578 in CI 38520960964. The same two-stage focused test is reproducible locally with the pinned Node 24.18.0 / npm 11.16.0 / Vitest 5.0.3 toolchain.

./node_modules/.bin/vitest run tests/boundary/pcap/pcapProvider.test.ts -t 'cleanup is unresolved' --coverage.enabled=false

The capinfos branch of retains parsed output and cleanup ownership when %s cleanup is unresolved expects CAPINFOS_OUTPUT. That constant has no trailing newline, while the executable fixture prints it with printf '%s\n'. Consequently diagnostics.captured_output.stdout contains one additional newline. Local result: one failed and one passed retained-cleanup case; the remaining 18 cases were intentionally excluded by the focused filter. The tshark fixture deliberately emits its JSON without an added newline and its corresponding branch passes.

The failed assertion happens before mayClean = true, leaving the deliberate cleanup-failure injection active during teardown. This produces a second cleanup error that obscures the primary byte mismatch. The real owned producer has already been supervised; this is not evidence that stdout should be trimmed or cleanup failure should be ignored.

Fix the fixture's ownership of expected output bytes: make the constant describe the complete stdout, including the newline, and emit that exact constant without adding a second newline. Ensure the injected failure is released during test teardown even if an assertion fails. Preserve the adapter's output, partial observations, resource ownership, producer-launch count and explicit cleanup checks.

Validation: demonstrate the baseline byte mismatch, run both capinfos/tshark retained-cleanup cases and the complete pcap command/provider family, verify successful cleanup and that the input capture remains byte-identical, then run applicable static checks and current-head CI. This is fixture drift and test cleanup robustness; it does not establish real Wireshark behavior or a runtime performance improvement.

Originally created by @N0zoM1z0 on GitHub (Oct 14, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/3252 Originally assigned to: @N0zoM1z0 on GitHub. The newly added retained-cleanup regression in `tests/boundary/pcap/pcapProvider.test.ts` fails because its expected raw capinfos stdout differs from the bytes emitted by its own fixture. The production adapter correctly preserves those bytes. Baseline: main `7375ab6e34e511095a74d5a67e57cec28d56fd10`, containing the pcap partial-observation change `23c70d674`. Hosted reproduction: job `115710939578` in [CI 38520960964](https://github.com/morluto/rea/actions/runs/38520960964). The same two-stage focused test is reproducible locally with the pinned Node 24.18.0 / npm 11.16.0 / Vitest 5.0.3 toolchain. ```sh ./node_modules/.bin/vitest run tests/boundary/pcap/pcapProvider.test.ts -t 'cleanup is unresolved' --coverage.enabled=false ``` The capinfos branch of `retains parsed output and cleanup ownership when %s cleanup is unresolved` expects `CAPINFOS_OUTPUT`. That constant has no trailing newline, while the executable fixture prints it with `printf '%s\n'`. Consequently `diagnostics.captured_output.stdout` contains one additional newline. Local result: one failed and one passed retained-cleanup case; the remaining 18 cases were intentionally excluded by the focused filter. The tshark fixture deliberately emits its JSON without an added newline and its corresponding branch passes. The failed assertion happens before `mayClean = true`, leaving the deliberate cleanup-failure injection active during teardown. This produces a second cleanup error that obscures the primary byte mismatch. The real owned producer has already been supervised; this is not evidence that stdout should be trimmed or cleanup failure should be ignored. Fix the fixture's ownership of expected output bytes: make the constant describe the complete stdout, including the newline, and emit that exact constant without adding a second newline. Ensure the injected failure is released during test teardown even if an assertion fails. Preserve the adapter's output, partial observations, resource ownership, producer-launch count and explicit cleanup checks. Validation: demonstrate the baseline byte mismatch, run both capinfos/tshark retained-cleanup cases and the complete pcap command/provider family, verify successful cleanup and that the input capture remains byte-identical, then run applicable static checks and current-head CI. This is fixture drift and test cleanup robustness; it does not establish real Wireshark behavior or a runtime performance improvement.
bsakaguchi 2026-10-15 18:31:40 +00:00
Author
Owner

@N0zoM1z0 commented on GitHub (Oct 14, 2026):

Fixed independently on main in 1341e8c831. Verified at 29d3dcb7ea: both pcap command/provider files pass all 22 tests. A controlled wrong-stdout assertion still fails, but now produces only the primary assertion failure and no secondary pcap.close error; the source was restored afterward. A real offline DNS PCAP also passes the production PcapProvider using installed capinfos/tshark 4.0.17: one packet, two endpoints, the exact audit.example.test query, complete coverage, unchanged input SHA-256 and successful resource closure. This does not claim Wireshark 4.6.6 validation. No duplicate runtime or fixture change is needed in this task.

<!-- gh-comment-id:6162753553 --> @N0zoM1z0 commented on GitHub (Oct 14, 2026): Fixed independently on main in 1341e8c831388fa9b7d421d43b67e364643eb187. Verified at 29d3dcb7ea85b3be37cd81e977ae4e09cebdd2fc: both pcap command/provider files pass all 22 tests. A controlled wrong-stdout assertion still fails, but now produces only the primary assertion failure and no secondary pcap.close error; the source was restored afterward. A real offline DNS PCAP also passes the production PcapProvider using installed capinfos/tshark 4.0.17: one packet, two endpoints, the exact audit.example.test query, complete coverage, unchanged input SHA-256 and successful resource closure. This does not claim Wireshark 4.6.6 validation. No duplicate runtime or fixture change is needed in this task.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#1166
No description provided.