Skip to content

Commit 7d892cd

Browse files
committed
Clarify typed service sizing mappings
1 parent 10d412c commit 7d892cd

14 files changed

Lines changed: 85 additions & 22 deletions

File tree

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

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -827,17 +827,47 @@ Implementation validation:
827827
- Windows/MSYS CTest service slice passed: `test_win_service`, `test_win_service_extra`, and `test_win_service_payload_limits`.
828828
- `git diff --check` passed.
829829
- `bash .agents/sow/audit.sh` passed.
830+
831+
### 2026-06-04 GitHub AI Quality Findings Review
832+
833+
- The GitHub quality AI findings page reported seven findings across typed Go service wrappers and C Windows service code.
834+
- Response-batch mapping findings:
835+
- Reported files include `src/go/pkg/netipc/service/apps_lookup/client.go`, `src/go/pkg/netipc/service/cgroups/client.go`, `src/go/pkg/netipc/service/cgroups_lookup/client.go`, `src/go/pkg/netipc/service/cgroups_lookup/client_windows.go`, and `src/libnetdata/netipc/src/service/netipc_service_win.c`.
836+
- Same-failure search also found the equivalent Go Windows apps lookup wrapper and POSIX C service mapping.
837+
- Decision: reject these as false positives, but clarify the code.
838+
- Evidence: public typed Go configs expose `MaxRequestBatchItems` and `MaxResponsePayloadBytes`, but no `MaxResponseBatchItems`; C `nipc_client_config_t` and `nipc_server_config_t` likewise expose only `max_request_batch_items` and `max_response_payload_bytes`.
839+
- Evidence: `docs/level1-wire-envelope.md` says `max_response_batch_items` is kept for wire symmetry and the agreed response batch count must equal the agreed request batch count.
840+
- Implementation plan: keep behavior unchanged, but route response-batch assignments through private helpers named as typed response-batch symmetry helpers so future reviewers do not interpret the mapping as accidental copy-paste.
841+
- Lookup request-payload default finding:
842+
- Reported file: `src/libnetdata/netipc/src/service/netipc_service_win.c`.
843+
- Same-failure search found the equivalent POSIX C lookup server initializers.
844+
- Decision: reject as intentional behavior, but clarify the code.
845+
- Evidence: `docs/level2-typed-api.md` says typed callers do not provide `max_request_payload_bytes`; the library derives the initial proposal internally from method schema, batch size, and dynamic-field assumptions.
846+
- Evidence: lookup requests contain dynamic path/PID arrays, and C lookup servers pre-size accepted-session SHM resources from `learned_request_payload_bytes` before serving typed requests.
847+
- Risk of applying the suggested change: changing lookup server request defaults from the larger lookup default to the generic request default could add avoidable reconnect churn or undersized SHM setup for lookup workloads.
848+
- Implementation plan: keep behavior unchanged, but replace direct `cgroups_response_payload_default()` calls in lookup request-default sites with a private helper named as a lookup request-payload default.
849+
- Implemented:
850+
- C POSIX and Windows typed service config conversion now routes response-batch symmetry through `nipc_service_common_typed_response_batch_items()`.
851+
- C POSIX and Windows lookup server request defaults now route through `nipc_service_common_lookup_request_payload_default()`.
852+
- Go POSIX and Windows typed service wrappers for apps lookup, cgroups lookup, and cgroups snapshot now route response-batch symmetry through per-package `typedResponseBatchItems()` helpers.
853+
- Same-failure verification: no remaining direct `MaxResponseBatchItems: config.MaxRequestBatchItems` or `max_response_batch_items = config->max_request_batch_items` assignments in typed service wrappers.
854+
- `cmake --build build` passed.
855+
- `/usr/bin/ctest --test-dir build --output-on-failure -R 'service|cache'` passed: 13/13 focused service/cache tests.
856+
- POSIX Go typed-service package tests passed for apps lookup, cgroups lookup, and cgroups snapshot.
857+
- Windows Go typed-service package compilation/tests passed for apps lookup, cgroups lookup, and cgroups snapshot.
858+
- Windows/MSYS rebuild passed for `netipc_service_win`, `test_win_service`, `test_win_service_extra`, `test_win_service_payload_limits`, `interop_service_win_c`, and `interop_cache_win_c`.
859+
- Windows/MSYS CTest service slice passed: `test_win_service`, `test_win_service_extra`, and `test_win_service_payload_limits`.
830860
- `codacy-analysis analyze --output-format json` passed:
831861
- Checkov: 0 issues.
832862
- Opengrep/Semgrep: 0 issues.
833863
- Trivy: 0 issues.
834864
- cppcheck: 0 issues.
835865
- ShellCheck: 0 issues.
836866
- Spectral: 0 issues.
837-
- total: 0 issues, 0 errors.
867+
- total: 0 issues, 0 errors.
838868
- `bash .agents/sow/audit.sh` passed and reported SOW initialization complete and clean.
839869
- `git diff --check` passed.
840-
- Sensitive-data scan across the touched SOW, C service, C service common, C codec, and CMake files returned no matches.
870+
- Sensitive-data scan across the touched SOW, Go service wrappers, and C service files returned no matches.
841871

842872
Sensitive data gate:
843873

src/go/pkg/netipc/service/apps_lookup/client.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ func clientConfigToTransport(config ClientConfig) posix.ClientConfig {
1212
PreferredProfiles: config.PreferredProfiles,
1313
MaxRequestBatchItems: config.MaxRequestBatchItems,
1414
MaxResponsePayloadBytes: config.MaxResponsePayloadBytes,
15-
MaxResponseBatchItems: config.MaxRequestBatchItems,
15+
MaxResponseBatchItems: typedResponseBatchItems(config.MaxRequestBatchItems),
1616
AuthToken: config.AuthToken,
1717
}
1818
}
@@ -23,7 +23,7 @@ func serverConfigToTransport(config ServerConfig) posix.ServerConfig {
2323
PreferredProfiles: config.PreferredProfiles,
2424
MaxRequestBatchItems: config.MaxRequestBatchItems,
2525
MaxResponsePayloadBytes: config.MaxResponsePayloadBytes,
26-
MaxResponseBatchItems: config.MaxRequestBatchItems,
26+
MaxResponseBatchItems: typedResponseBatchItems(config.MaxRequestBatchItems),
2727
AuthToken: config.AuthToken,
2828
}
2929
}

src/go/pkg/netipc/service/apps_lookup/client_common.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ type Client struct {
99
inner *raw.Client
1010
}
1111

12+
// typedResponseBatchItems keeps typed request/response batch counts symmetric.
13+
func typedResponseBatchItems(maxRequestBatchItems uint32) uint32 {
14+
return maxRequestBatchItems
15+
}
16+
1217
func NewClient(runDir, serviceName string, config ClientConfig) *Client {
1318
return &Client{inner: raw.NewAppsLookupClient(runDir, serviceName, clientConfigToTransport(config))}
1419
}

src/go/pkg/netipc/service/apps_lookup/client_windows.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ func clientConfigToTransport(config ClientConfig) windows.ClientConfig {
1212
PreferredProfiles: config.PreferredProfiles,
1313
MaxRequestBatchItems: config.MaxRequestBatchItems,
1414
MaxResponsePayloadBytes: config.MaxResponsePayloadBytes,
15-
MaxResponseBatchItems: config.MaxRequestBatchItems,
15+
MaxResponseBatchItems: typedResponseBatchItems(config.MaxRequestBatchItems),
1616
AuthToken: config.AuthToken,
1717
}
1818
}
@@ -23,7 +23,7 @@ func serverConfigToTransport(config ServerConfig) windows.ServerConfig {
2323
PreferredProfiles: config.PreferredProfiles,
2424
MaxRequestBatchItems: config.MaxRequestBatchItems,
2525
MaxResponsePayloadBytes: config.MaxResponsePayloadBytes,
26-
MaxResponseBatchItems: config.MaxRequestBatchItems,
26+
MaxResponseBatchItems: typedResponseBatchItems(config.MaxRequestBatchItems),
2727
AuthToken: config.AuthToken,
2828
}
2929
}

src/go/pkg/netipc/service/cgroups/client.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ func clientConfigToTransport(config ClientConfig) posix.ClientConfig {
1212
PreferredProfiles: config.PreferredProfiles,
1313
MaxRequestBatchItems: config.MaxRequestBatchItems,
1414
MaxResponsePayloadBytes: config.MaxResponsePayloadBytes,
15-
MaxResponseBatchItems: config.MaxRequestBatchItems,
15+
MaxResponseBatchItems: typedResponseBatchItems(config.MaxRequestBatchItems),
1616
AuthToken: config.AuthToken,
1717
}
1818
}
@@ -23,7 +23,7 @@ func serverConfigToTransport(config ServerConfig) posix.ServerConfig {
2323
PreferredProfiles: config.PreferredProfiles,
2424
MaxRequestBatchItems: config.MaxRequestBatchItems,
2525
MaxResponsePayloadBytes: config.MaxResponsePayloadBytes,
26-
MaxResponseBatchItems: config.MaxRequestBatchItems,
26+
MaxResponseBatchItems: typedResponseBatchItems(config.MaxRequestBatchItems),
2727
AuthToken: config.AuthToken,
2828
}
2929
}

src/go/pkg/netipc/service/cgroups/client_common.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ func snapshotDispatch(handler Handler) raw.DispatchHandler {
99
return raw.SnapshotDispatch(handler.Handle, handler.SnapshotMaxItems)
1010
}
1111

12+
// typedResponseBatchItems keeps typed request/response batch counts symmetric.
13+
func typedResponseBatchItems(maxRequestBatchItems uint32) uint32 {
14+
return maxRequestBatchItems
15+
}
16+
1217
// Client is the public L2 client context for the cgroups-snapshot service.
1318
type Client struct {
1419
inner *raw.Client

src/go/pkg/netipc/service/cgroups/client_windows.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ func clientConfigToTransport(config ClientConfig) windows.ClientConfig {
1212
PreferredProfiles: config.PreferredProfiles,
1313
MaxRequestBatchItems: config.MaxRequestBatchItems,
1414
MaxResponsePayloadBytes: config.MaxResponsePayloadBytes,
15-
MaxResponseBatchItems: config.MaxRequestBatchItems,
15+
MaxResponseBatchItems: typedResponseBatchItems(config.MaxRequestBatchItems),
1616
AuthToken: config.AuthToken,
1717
}
1818
}
@@ -23,7 +23,7 @@ func serverConfigToTransport(config ServerConfig) windows.ServerConfig {
2323
PreferredProfiles: config.PreferredProfiles,
2424
MaxRequestBatchItems: config.MaxRequestBatchItems,
2525
MaxResponsePayloadBytes: config.MaxResponsePayloadBytes,
26-
MaxResponseBatchItems: config.MaxRequestBatchItems,
26+
MaxResponseBatchItems: typedResponseBatchItems(config.MaxRequestBatchItems),
2727
AuthToken: config.AuthToken,
2828
}
2929
}

src/go/pkg/netipc/service/cgroups_lookup/client.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ func clientConfigToTransport(config ClientConfig) posix.ClientConfig {
1212
PreferredProfiles: config.PreferredProfiles,
1313
MaxRequestBatchItems: config.MaxRequestBatchItems,
1414
MaxResponsePayloadBytes: config.MaxResponsePayloadBytes,
15-
MaxResponseBatchItems: config.MaxRequestBatchItems,
15+
MaxResponseBatchItems: typedResponseBatchItems(config.MaxRequestBatchItems),
1616
AuthToken: config.AuthToken,
1717
}
1818
}
@@ -23,7 +23,7 @@ func serverConfigToTransport(config ServerConfig) posix.ServerConfig {
2323
PreferredProfiles: config.PreferredProfiles,
2424
MaxRequestBatchItems: config.MaxRequestBatchItems,
2525
MaxResponsePayloadBytes: config.MaxResponsePayloadBytes,
26-
MaxResponseBatchItems: config.MaxRequestBatchItems,
26+
MaxResponseBatchItems: typedResponseBatchItems(config.MaxRequestBatchItems),
2727
AuthToken: config.AuthToken,
2828
}
2929
}

src/go/pkg/netipc/service/cgroups_lookup/client_common.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ type Client struct {
99
inner *raw.Client
1010
}
1111

12+
// typedResponseBatchItems keeps typed request/response batch counts symmetric.
13+
func typedResponseBatchItems(maxRequestBatchItems uint32) uint32 {
14+
return maxRequestBatchItems
15+
}
16+
1217
func NewClient(runDir, serviceName string, config ClientConfig) *Client {
1318
return &Client{inner: raw.NewCgroupsLookupClient(runDir, serviceName, clientConfigToTransport(config))}
1419
}

src/go/pkg/netipc/service/cgroups_lookup/client_windows.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ func clientConfigToTransport(config ClientConfig) windows.ClientConfig {
1212
PreferredProfiles: config.PreferredProfiles,
1313
MaxRequestBatchItems: config.MaxRequestBatchItems,
1414
MaxResponsePayloadBytes: config.MaxResponsePayloadBytes,
15-
MaxResponseBatchItems: config.MaxRequestBatchItems,
15+
MaxResponseBatchItems: typedResponseBatchItems(config.MaxRequestBatchItems),
1616
AuthToken: config.AuthToken,
1717
}
1818
}
@@ -23,7 +23,7 @@ func serverConfigToTransport(config ServerConfig) windows.ServerConfig {
2323
PreferredProfiles: config.PreferredProfiles,
2424
MaxRequestBatchItems: config.MaxRequestBatchItems,
2525
MaxResponsePayloadBytes: config.MaxResponsePayloadBytes,
26-
MaxResponseBatchItems: config.MaxRequestBatchItems,
26+
MaxResponseBatchItems: typedResponseBatchItems(config.MaxRequestBatchItems),
2727
AuthToken: config.AuthToken,
2828
}
2929
}

0 commit comments

Comments
 (0)