Skip to content

Commit ce9c5ed

Browse files
committed
Split Windows pipe transport implementation
1 parent 50c16fa commit ce9c5ed

7 files changed

Lines changed: 1008 additions & 940 deletions

File tree

.agents/sow/current/SOW-0015-20260605-codacy-scope-and-maintainability.md

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,8 +300,68 @@ Open decisions:
300300
- cppcheck: success, 51 files, 0 issues.
301301
- ShellCheck: success, 3 files, 0 issues.
302302
- Spectral: success, 11 files, 0 issues.
303-
- Revive: partial, 90 files, 0 issues, 1 `findings is not iterable` invocation error.
303+
- Revive: partial, 90 files, 0 issues, 1 `findings is not iterable` invocation error.
304304
- Note: plain `ctest` resolves to a broken user-local Python wrapper at `~/.local/bin/ctest`; system `/usr/bin/ctest` was used for validation.
305+
- Committed and pushed `50c16fa17e4aa4df0b5fb1211b4239f5d71ecc28`.
306+
- Remote validation for `50c16fa17e4aa4df0b5fb1211b4239f5d71ecc28`:
307+
- GitHub Static Analysis: success.
308+
- GitHub CodeQL: success.
309+
- GitHub Codacy Local Analysis: success.
310+
- GitHub Codacy Coverage: success.
311+
- GitHub Runtime Safety: success.
312+
- GitHub Supply Chain Security: success.
313+
- Codacy push quality check: success.
314+
- Codacy Cloud analyzed `50c16fa17e4aa4df0b5fb1211b4239f5d71ecc28`:
315+
- issues: 0.
316+
- LOC: 41001.
317+
- complex files: 29%.
318+
- duplicated files: 27%.
319+
- POSIX UDS file-level Codacy result after the split:
320+
- `src/libnetdata/netipc/src/transport/posix/netipc_uds_lifecycle.c`: complexity 70, duplication 96.
321+
- `src/libnetdata/netipc/src/transport/posix/netipc_uds_handshake.c`: complexity 59, duplication 57.
322+
- `src/libnetdata/netipc/src/transport/posix/netipc_uds_receive.c`: complexity 50, duplication 0.
323+
- `src/libnetdata/netipc/src/transport/posix/netipc_uds_send.c`: complexity 42, duplication 12.
324+
- `src/libnetdata/netipc/src/transport/posix/netipc_uds.c`: complexity 15, duplication 0.
325+
- `src/libnetdata/netipc/src/transport/posix/netipc_uds_inflight.c`: complexity 12, duplication 31.
326+
- Top production complexity files after the POSIX UDS split:
327+
- `src/go/pkg/netipc/transport/windows/pipe.go`: complexity 214, duplication 773.
328+
- `src/go/pkg/netipc/transport/posix/uds.go`: complexity 182, duplication 745.
329+
- `src/libnetdata/netipc/src/transport/posix/netipc_shm.c`: complexity 179, duplication 160.
330+
- `src/go/pkg/netipc/protocol/apps_lookup.go`: complexity 148, duplication 175.
331+
- `src/go/pkg/netipc/transport/posix/shm_linux.go`: complexity 147, duplication 39.
332+
- Selected `src/go/pkg/netipc/transport/windows/pipe.go` as the next file to read because it is now the top production complexity and duplication hotspot.
333+
- Read `src/go/pkg/netipc/transport/windows/pipe.go` in full and compared its function map with `src/go/pkg/netipc/transport/posix/uds.go`.
334+
- `pipe.go` mixes these responsibilities in one file:
335+
- Win32 syscall wrappers and constants.
336+
- pipe name derivation and service-name validation.
337+
- role/config/session/listener types.
338+
- client connection lifecycle.
339+
- session wait/close behavior.
340+
- send chunking.
341+
- receive chunk reassembly and batch validation.
342+
- listener accept/close behavior.
343+
- client and server handshakes.
344+
- Selected low-risk implementation shape:
345+
- keep package name, exported API, types, errors, and behavior unchanged.
346+
- split the Windows named-pipe package by goal inside the same package.
347+
- do not introduce a shared cross-platform abstraction yet; POSIX and Windows package boundaries make that higher risk.
348+
- create separate files for session/client lifecycle, send, receive, listener, and handshake.
349+
- Implemented the Windows Named Pipe Go split:
350+
- `pipe.go`: Win32 constants/syscall wrappers, pipe-name/service-name helpers, common low-level I/O, and shared utility helpers.
351+
- `pipe_session.go`: role/config/session types, session wait/close behavior, and client connect lifecycle.
352+
- `pipe_send.go`: outbound logical-message send and chunked-send flow.
353+
- `pipe_receive.go`: receive path, inbound limit checks, response tracking, chunk reassembly, and batch payload validation.
354+
- `pipe_listener.go`: listener lifecycle, accept/close behavior, and pipe instance creation.
355+
- `pipe_handshake.go`: client/server HELLO negotiation, compatibility detection, rejection, and HELLO_ACK send.
356+
- Validation after the Windows Named Pipe Go split:
357+
- `gofmt` on the touched Windows pipe files: passed.
358+
- `git diff --check`: passed.
359+
- `cd src/go && go test ./...`: passed.
360+
- `cd src/go && GOOS=windows GOARCH=amd64 go test -c -o /tmp/netipc-transport-windows.test.exe ./pkg/netipc/transport/windows`: passed.
361+
- `win11`, isolated validation copy, `cd src/go && MSYSTEM=MSYS go test ./pkg/netipc/transport/windows`: passed.
362+
- `bash .agents/sow/audit.sh`: passed.
363+
- `codacy-analysis analyze . --output-format json`: exit status 0, 0 issues, 1 known Revive adapter invocation error:
364+
- Revive error: `Failed to run revive: findings is not iterable`.
305365

306366
## Validation
307367

0 commit comments

Comments
 (0)