Skip to content

Commit 8ebcd4f

Browse files
committed
Split Rust and Go lookup codecs
1 parent 3e57f82 commit 8ebcd4f

10 files changed

Lines changed: 3590 additions & 3478 deletions

File tree

.agents/sow/current/SOW-0014-20260603-maintainability-hotspots.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1150,6 +1150,59 @@ Raw cache, Go typed-facade, apps lookup builder, cgroups lookup builder, apps lo
11501150
- End-user/operator skills: no update needed because exported/operator workflow is unchanged.
11511151
- SOW lifecycle: target remains part of active `SOW-0014`; SOW remains in progress pending metric re-check and next selected hotspot.
11521152

1153+
### 2026-06-04 Rust And Go Lookup Codec File Split
1154+
1155+
- The user requested continuing the code-organization fix after the C protocol split.
1156+
- Implemented Rust and Go source splits to match the approved rule that each service-kind codec owns its own implementation file:
1157+
- Rust `src/crates/netipc/src/protocol/lookup.rs` is now a small module wrapper.
1158+
- Rust shared lookup helpers live in `src/crates/netipc/src/protocol/lookup/common.rs`.
1159+
- Rust cgroups lookup implementation lives in `src/crates/netipc/src/protocol/lookup/cgroups_lookup.rs`.
1160+
- Rust apps lookup implementation lives in `src/crates/netipc/src/protocol/lookup/apps_lookup.rs`.
1161+
- Go `src/go/pkg/netipc/protocol/lookup.go` is now a package stub retained to avoid deleting the file.
1162+
- Go shared lookup helpers live in `src/go/pkg/netipc/protocol/lookup_common.go`.
1163+
- Go cgroups lookup implementation lives in `src/go/pkg/netipc/protocol/cgroups_lookup.go`.
1164+
- Go apps lookup implementation lives in `src/go/pkg/netipc/protocol/apps_lookup.go`.
1165+
- Go `src/go/pkg/netipc/protocol/lookup_test.go` was left unchanged in this pass because its largest remaining mixed tests deliberately exercise shared lookup validation, bounds, and dispatch behavior across both lookup codecs.
1166+
- `docs/code-organization.md` now reflects the Rust and Go protocol layout.
1167+
- Size result:
1168+
- Rust before: `src/crates/netipc/src/protocol/lookup.rs` had 1987 lines.
1169+
- Rust after:
1170+
- `src/crates/netipc/src/protocol/lookup.rs`: 9 lines.
1171+
- `src/crates/netipc/src/protocol/lookup/common.rs`: 382 lines.
1172+
- `src/crates/netipc/src/protocol/lookup/cgroups_lookup.rs`: 755 lines.
1173+
- `src/crates/netipc/src/protocol/lookup/apps_lookup.rs`: 886 lines.
1174+
- Go before: `src/go/pkg/netipc/protocol/lookup.go` had 1493 lines.
1175+
- Go after:
1176+
- `src/go/pkg/netipc/protocol/lookup.go`: 1 line.
1177+
- `src/go/pkg/netipc/protocol/lookup_common.go`: 469 lines.
1178+
- `src/go/pkg/netipc/protocol/cgroups_lookup.go`: 475 lines.
1179+
- `src/go/pkg/netipc/protocol/apps_lookup.go`: 553 lines.
1180+
- Validation:
1181+
- `cargo fmt --manifest-path src/crates/netipc/Cargo.toml -- --check` passed.
1182+
- `cargo test --manifest-path src/crates/netipc/Cargo.toml` passed: 332 Rust unit tests passed, plus bin/doc test targets.
1183+
- `go test -C src/go ./pkg/netipc/protocol` passed.
1184+
- `go test -C src/go ./...` passed for all Go module packages, including the longer raw service tests.
1185+
- `bash tests/interop_codec.sh` passed:
1186+
- Rust decoded C output: 89 passed, 0 failed.
1187+
- Go decoded C output: 90 passed, 0 failed.
1188+
- C decoded Rust output: 101 passed, 0 failed.
1189+
- Go decoded Rust output: 90 passed, 0 failed.
1190+
- C decoded Go output: 101 passed, 0 failed.
1191+
- Rust decoded Go output: 89 passed, 0 failed.
1192+
- C, Rust, and Go generated byte-identical protocol fixture files.
1193+
- `make` passed for the full local build.
1194+
- `/usr/bin/ctest --test-dir build --output-on-failure` passed: 46/46 tests.
1195+
- `codacy-analysis analyze --output-format json` passed with 0 issues and 0 errors across Checkov, Opengrep/Semgrep, Trivy, cppcheck, ShellCheck, and Spectral.
1196+
- `git diff --check` passed.
1197+
- `bash .agents/sow/audit.sh` passed and reported SOW initialization complete and clean.
1198+
- Artifact impact:
1199+
- `AGENTS.md`: no workflow or guardrail change.
1200+
- Runtime project skills: no reusable workflow change.
1201+
- Specs: no update needed because public protocol/API behavior and wire bytes are unchanged.
1202+
- End-user/operator docs: `docs/code-organization.md` updated because repository layout changed.
1203+
- End-user/operator skills: no update needed because exported/operator workflow is unchanged.
1204+
- SOW lifecycle: target remains part of active `SOW-0014`; SOW remains in progress pending metric re-check and next selected hotspot.
1205+
11531206
## Lessons Extracted
11541207

11551208
Pending.

docs/code-organization.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,23 @@ src/
4343
4444
crates/netipc/ # Rust library (Cargo crate)
4545
src/
46-
protocol.rs # Codec
46+
protocol/ # Codec
47+
mod.rs # Core wire primitives and codec re-exports
48+
lookup/ # Lookup codec family
49+
common.rs # Shared lookup helpers
50+
cgroups_lookup.rs # cgroups lookup codec
51+
apps_lookup.rs # apps lookup codec
4752
transport/
4853
posix.rs # L1: UDS, SHM
4954
windows.rs # L1: Named Pipe, SHM
5055
service/ # L2/L3: typed client/server helpers
5156
5257
go/pkg/netipc/ # Go library (Go package)
5358
protocol/ # Codec
59+
frame.go # Core wire primitives
60+
lookup_common.go # Shared lookup helpers
61+
cgroups_lookup.go # cgroups lookup codec
62+
apps_lookup.go # apps lookup codec
5463
transport/
5564
posix/ # L1: UDS, SHM
5665
windows/ # L1: Named Pipe, SHM

0 commit comments

Comments
 (0)