Skip to content

Commit 400e4bc

Browse files
committed
Split POSIX UDS Go transport implementation
1 parent ce9c5ed commit 400e4bc

8 files changed

Lines changed: 950 additions & 895 deletions

File tree

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

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,67 @@ Open decisions:
362362
- `bash .agents/sow/audit.sh`: passed.
363363
- `codacy-analysis analyze . --output-format json`: exit status 0, 0 issues, 1 known Revive adapter invocation error:
364364
- Revive error: `Failed to run revive: findings is not iterable`.
365+
- Committed and pushed `ce9c5edeee80732d60daf4e6654dd253a49711a5`.
366+
- Remote validation for `ce9c5edeee80732d60daf4e6654dd253a49711a5`:
367+
- GitHub CodeQL C/C++ POSIX, C/C++ Windows, Go POSIX, Go Windows, and Rust: success.
368+
- GitHub Static Analysis C, Go, Rust, workflow/shell, and bench/fixture Go checks: success.
369+
- GitHub Runtime Safety ASAN/UBSAN, TSAN, Go Race Detector, and Windows MSYS2 Runtime: success.
370+
- GitHub Supply Chain Security OSV-Scanner, Semgrep Secrets, and OpenSSF Scorecard: success.
371+
- GitHub Codacy Local Analysis: success.
372+
- GitHub C, Rust, and Go Coverage: success.
373+
- Valgrind: skipped.
374+
- Codacy Cloud analyzed `ce9c5edeee80732d60daf4e6654dd253a49711a5`:
375+
- issues: 0.
376+
- LOC: 41123.
377+
- coverage: 88%.
378+
- complex files: 30%.
379+
- duplicated files: 28%.
380+
- Windows Named Pipe file-level Codacy result after the split:
381+
- `src/go/pkg/netipc/transport/windows/pipe.go`: complexity 58, duplication 98.
382+
- `src/go/pkg/netipc/transport/windows/pipe_handshake.go`: complexity 48, duplication 213.
383+
- `src/go/pkg/netipc/transport/windows/pipe_listener.go`: complexity 31, duplication 14.
384+
- `src/go/pkg/netipc/transport/windows/pipe_receive.go`: complexity 46, duplication 32.
385+
- `src/go/pkg/netipc/transport/windows/pipe_send.go`: complexity 19, duplication 55.
386+
- `src/go/pkg/netipc/transport/windows/pipe_session.go`: complexity 26, duplication 79.
387+
- Top production complexity files after the Windows Named Pipe split:
388+
- `src/go/pkg/netipc/transport/posix/uds.go`: complexity 182, duplication 532.
389+
- `src/libnetdata/netipc/src/transport/posix/netipc_shm.c`: complexity 179, duplication 160.
390+
- `src/go/pkg/netipc/protocol/apps_lookup.go`: complexity 148, duplication 175.
391+
- `src/go/pkg/netipc/transport/posix/shm_linux.go`: complexity 147, duplication 39.
392+
- `src/crates/netipc/src/transport/posix.rs`: complexity 143, duplication 0.
393+
- Selected `src/go/pkg/netipc/transport/posix/uds.go` as the next file to read because it is now the top production complexity and duplication hotspot.
394+
- Read `src/go/pkg/netipc/transport/posix/uds.go` in full.
395+
- `uds.go` mixes these responsibilities in one file:
396+
- POSIX constants, errors, utility helpers, low-level SEQPACKET I/O, and socket path validation.
397+
- role/config/session types.
398+
- client connection lifecycle.
399+
- session close behavior.
400+
- send chunking.
401+
- receive chunk reassembly, inbound limit checks, response tracking, and batch validation.
402+
- listener lifecycle, accept, close, bind/listen, and socket unlink.
403+
- stale endpoint recovery.
404+
- client and server handshakes.
405+
- Selected low-risk implementation shape:
406+
- keep package name, exported API, types, errors, and behavior unchanged.
407+
- split the POSIX UDS package by goal inside the same package.
408+
- do not introduce a shared POSIX/Windows abstraction yet; the two transports have different syscall and stale-endpoint behavior.
409+
- create separate files for session/client lifecycle, send, receive, listener, stale endpoint recovery, and handshake.
410+
- Implemented the POSIX UDS Go split:
411+
- `uds.go`: constants, errors, path/service helpers, packet-size helper, low-level SEQPACKET I/O, and shared utility helpers.
412+
- `uds_session.go`: role/config/session types, session close behavior, and client connect lifecycle.
413+
- `uds_send.go`: outbound logical-message send and chunked-send flow.
414+
- `uds_receive.go`: receive path, inbound limit checks, response tracking, chunk reassembly, and batch payload validation.
415+
- `uds_listener.go`: listener lifecycle, accept/close behavior, bind/listen, and socket unlink.
416+
- `uds_stale.go`: stale endpoint detection and safe stale socket unlink policy.
417+
- `uds_handshake.go`: client/server HELLO negotiation, compatibility detection, rejection, and HELLO_ACK send.
418+
- Validation after the POSIX UDS Go split:
419+
- `gofmt` on the touched POSIX UDS files: passed.
420+
- `git diff --check`: passed.
421+
- `cd src/go && go test ./pkg/netipc/transport/posix`: passed.
422+
- `cd src/go && go test ./...`: passed.
423+
- `bash .agents/sow/audit.sh`: passed.
424+
- `codacy-analysis analyze . --output-format json`: exit status 0, 0 issues, 1 known Revive adapter invocation error:
425+
- Revive error: `Failed to run revive: findings is not iterable`.
365426

366427
## Validation
367428

0 commit comments

Comments
 (0)