cp7 #439
No reviewers
Labels
No labels
bug
dependencies
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
refactor
rust
technical-debt
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
navicore/patch-seq!439
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "cp7"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Code Review: PR #439 — OSC over UDP loopback test
Overview
Adds an end-to-end integration test (
test_osc_loopback.seq) that proves the full chain: Seq OSC encoder → UDP send → UDP receive → byte-equality assert. This complements the existingtest_osc.seq(byte-format unit tests) by promoting them to a real round-trip. Thejustfilewires it intotest-integrationalongside the encoder tests.Code Quality & Style ✅
# ( ... )) and inline;comments for the aux stack are consistent with the existing codebase (comparetest-udp.seqandosc.seq).test-*convention and are self-describing.Correctness ✅
Traced the stack through
udp-loopbackagainst theudp.send-to/udp.receive-fromcontracts established intest-udp.seq:0 udp.bind→( socket port success )→drop→( msg socket port )✓swap / dup >aux / swap / "127.0.0.1" swap / rotshuffle, the stack is( msg "127.0.0.1" port socket )which matchesudp.send-to ( bytes host port socket -- success )✓auxfor theudp.receive-fromcall, correct for single-socket loopback ✓dup >auxbeforeudp.receive-frompreserves the handle forudp.closeat the end ✓drop drop droppeelsok / port / hostoff( bytes host port ok ), leaving( bytes )✓aux> udp.close dropalways runs — no socket leak ✓Kernel buffering makes the single-socket bind/send/receive sequencing sound (same rationale called out in
test-udp.seq).Potential Issues / Suggestions
1. No
osc.msg-iround-trip (minor gap, not a blocker)test_osc.seqtestsosc.msg-ifor byte format, buttest_osc_loopback.seqskips it. The coverage delta is small sincemsg-fandmsg-ifexercise the same serialisation path, but adding it would make the suite exhaustive for completeness.2. Hang-on-failure vs. hard failure (acknowledged tradeoff)
The word-level comment documents the deliberate choice to let a failed send produce a receive hang rather than assert on the success flag. This is a reasonable CI tradeoff (a real loopback failure causes a visible timeout rather than a misleading equality failure), and the explanation is clear. Worth noting that CI jobs should have a test timeout configured if they don't already.
3.
drop drop dropordering comment (very minor)The comment
# ( bytes )is correct, but adding a brief label — e.g.# drop ok port host → ( bytes )— would make it immediately obvious which values are being discarded without having to reconstruct the stack. The existingtest-udp.sequses this more verbose style.4. Success path only
All three round-trip tests use well-formed messages where
osc.msg/osc.msg-f/osc.msg-ifare known-good (validated intest_osc.seq). That's appropriate for this test's stated goal (prove the full chain aligns), not a gap.Performance ✅
One UDP loopback socket per test word, closed after use. No unbounded allocation. Negligible overhead for an integration test suite.
Security ✅
Binds only to
127.0.0.1(loopback); OS-assigned port avoids inter-test conflicts. No external network exposure.Summary
Solid PR. The implementation is correct, the comments are clear and honest about the failure-mode tradeoffs, and it fills a real gap (no prior round-trip test existed). The suggestions above are all minor. Happy to approve as-is or with the
osc.msg-icoverage added if you want exhaustive parity.Code Review — PR #439: OSC UDP Loopback Integration Test
Overview
This PR adds
test_osc_loopback.seq, an end-to-end integration test that encodes OSC messages using the Seq encoder, round-trips them through a UDP loopback socket, and asserts byte equality on the received payload. It wires the test intojustfile'stest-integrationtarget. A solid addition that closes the gap between the byte-format unit tests intest_osc.seqand actual wire delivery.What's Good
0 udp.bindfor port selection — letting the OS assign the ephemeral port is the right call; it eliminates port collision across concurrent CI runs without any coordination.osc.msg,osc.msg-i,osc.msg-f, andosc.msg-ifeach get a round-trip test. Good coverage of the existing encoder surface.aux> udp.close dropruns unconditionally after the receive, so the handle is never leaked on the happy path.udp-loopback— for a concatenative language the inline stack annotations (# ( msg socket port )etc.) make the manipulation auditable without running the code mentally.Concerns / Suggestions
1. No timeout on
udp.receive-from— hangs silently if send is droppedThe comment acknowledges this explicitly:
That's a deliberate tradeoff, but it's worth noting: when
udp.send-todrops its success flag and the send actually failed, the test will block indefinitely. The only backstop is a CI-level job timeout. If the Seq runtime ever gains audp.receive-timeoutor similar word, this would be the first place to use it.2.
drop drop dropordering is inverted in the commentThe stack after
udp.receive-fromhasokon top, thenport, thenhost, thenbytesat the bottom. The drops execute TOS-first, so the actual order is: dropok, dropport, drophost. The annotation "drop ok port host" correctly lists the discard order — that's fine. But the arrow notationdrop ok port host → ( bytes )slightly implies these are simultaneous rather than sequential, which could mislead someone reading fast. A clearer phrasing would be:Minor, but the existing
test_osc.seqhas no inline comments at all, so any comment here sets a style precedent.3. Missing round-trip test for negative int / edge-case float
test_osc.seqtestsosc.int32 -1andosc.float32 0.0at the primitive level. The loopback suite only exercisesosc.msg-iwith60andosc.msg-fwith440.0. A round-trip of a negative integer (e.g.-1) throughosc.msg-iwould confirm the big-endian sign extension survives the UDP path end-to-end. Low priority since the byte-format tests already cover encoding; this is more about belt-and-suspenders for the transport layer.4. Comment verbosity inconsistent with sibling file
test_osc.seqhas zero inline comments — just word definitions.test_osc_loopback.seqopens with a 14-line block comment and sprinkles rationale throughout. Given how complexudp-loopbackis as stack manipulation, the comments are justified here. Worth a quick team decision on whether the file-header rationale block should become standard for integration tests, or whether to trim it back to match the sibling file's style.5. justfile comment is accurate but slightly redundant with the existing one
The new comment says "Same dir" which implies the reader needs to connect it to the comment three lines up. If the two lines ever get separated by a future addition, "Same dir" loses its meaning. Consider making it self-contained:
# Lives in the live-coding-csound dir (same include-path constraint as test_osc above).Stack Trace Audit —
udp-loopbackTraced through manually to verify correctness:
( msg )[]0 udp.bind drop( msg socket port )[]swap( msg port socket )[]dup >aux( msg port socket )[socket]swap( msg socket port )[socket]"127.0.0.1" swap( msg socket "127.0.0.1" port )[socket]rot( msg "127.0.0.1" port socket )[socket]udp.send-to drop( )[socket]aux>( socket )[]dup >aux( socket )[socket]udp.receive-from( bytes host port ok )[socket]drop drop drop( bytes )[socket]aux> udp.close drop( bytes )[]Logic is correct. The
>aux/aux>usage for carrying the socket across the send is clean.Summary
Approve with minor suggestions. The test is correct, covers the important code paths, and the CI-parallel-safe port binding is a nice touch. The main thing to think about is the infinite-hang risk if send fails silently — acceptable today given CI timeouts, but worth documenting as a known limitation or filing a follow-up for
udp.receive-timeout.