Repository navigation
[NETPATH-1182] Add Network Path metadata to the CNM connection payload - #527
gh-worker-dd-mergequeue-cf854d[bot] merged 1 commit into
Conversation
7e2ca1b to
6ed7c04
Compare
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
The PR remains a draft pending human validation of the implementation plan and coordinated downstream rollout.
Review effort: Balanced
Findings: None
What changed in this PR
Adds Network Path metadata to CNM connections, enabling downstream consumers to distinguish evaluation states and correlate flows with Network Path events.
Changes:
- Adds field 65 with test eligibility and a correlation key.
- Preserves absent versus present-empty metadata.
- Regenerates Go message bindings and streaming builders.
| File | Description |
|---|---|
| proto/process/connections.proto | Defines Network Path metadata and advances the field marker. |
| process/connections.proto_builder.go | Adds builders for the new metadata. |
| process/connections.pb.go | Adds generated types, descriptors, and serialization support. |
Files not reviewed (1)
- process/connections.pb.go: Generated file
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
The PR explicitly remains a not-for-merge draft pending human sign-off on the cross-service contract and coordinated rollout.
Review effort: Balanced
Findings: None
Files not reviewed (1)
- process/connections.pb.go: Generated file
6ed7c04 to
b12df20
Compare
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@DataDog review |
1 similar comment
|
@DataDog review |
There was a problem hiding this comment.
More details
The generated message and builder encoders preserve absent, empty, and populated Network Path metadata. Field 65 is unused in the base schema, and the completed static reviewer reported no actionable regression.
🤖 Bits Code Review · Commit b12df20
b12df20 to
2b352cc
Compare
Adds a nested NetworkPath message on Connection at field 65, carrying:
- hasTest: policy approved a dynamic Network Path test for this connection
- correlationKey: identity of that test, matching correlation_key on the
Network Path event
The nested message is a pointer in the generated Go, so absent (nil) stays
distinguishable from present-but-false (empty message). That three-state
encoding is what lets consumers tell "never evaluated" apart from
"evaluated, policy said no".
Regenerated with Go 1.24.0 to match go.mod.
NETPATH-1182
2b352cc to
c0196dc
Compare
AlexandreYang
left a comment
There was a problem hiding this comment.
Review Summary
Reviewed the new NetworkPath message on Connection (field 65), the regenerated gogo code in connections.pb.go, and the new NetworkPathBuilder / ConnectionBuilder.SetNetworkPath.
Assessment: safe to merge. Nothing blocks this.
- Compatibility: the change only adds a field. 65 is unused and not reserved. Old receivers skip the field and old senders leave it
nil. - Builder tag
0x20a=(65<<3)|2is correct, andSetNetworkPathfollows the same pattern asSetLaddrand the other nested setters. invoke codegenCI passes, so the generated code matches the proto.- I checked locally with a throwaway test that the three states survive builder → gogo
Unmarshal→Marshal→Unmarshal. Not set givesnil. Set but empty gives a non-nil empty message. Populated givestestEligible:true correlationKey:"abc". - The earlier nit about the
next identifiercomment has been fixed.
| # | Priority | File | Finding |
|---|---|---|---|
| 1 | process/connections.proto_builder.go:1366 |
Optional: no test locks in the three-state presence contract |
Test Coverage
| Code path | Test | Status |
|---|---|---|
NetworkPath gogo Marshal/Unmarshal |
— (generated; invoke codegen CI) |
Partial |
SetNetworkPath nil / empty / populated presence |
— | Missing (P3, verified manually) |
Overall: Gaps found, but none block the merge. The repo has no per-field builder tests, so the generated code relies on codegen CI.
Positive Observations
- Making it a nested message so
niland "evaluated, no test" stay distinct is a good choice, and the PR description explains it clearly. - The field comments spell out what
testEligibledoes not mean and whencorrelationKeycan be empty, which will save downstream consumers from guessing.
| x.scratch = protowire.AppendVarint(x.scratch, uint64(v)) | ||
| x.writer.Write(x.scratch) | ||
| } | ||
| func (x *ConnectionBuilder) SetNetworkPath(cb func(w *NetworkPathBuilder)) { |
There was a problem hiding this comment.
Optional: add a round-trip test for the three-state presence contract
The main point of this PR is that nil, set-but-empty, and populated stay distinct on the wire. Nothing tests that. I checked by hand and it works today. The risk is a later change, such as a generator option like nullable=false or making the field flat, which would silently merge nil and empty while CI stays green.
Suggested test in process/connections_test.go: build a Connection with ConnectionBuilder in three cases and Unmarshal it:
SetNetworkPathnot called →NetworkPath == nilSetNetworkPath(func(*NetworkPathBuilder){})→NetworkPath != nil,TestEligible == false,CorrelationKey == ""SetTestEligible(true)andSetCorrelationKey("k")→ both values come back
This is optional and fine to skip, since the repo doesn't test builders field by field.
What
Nested
NetworkPathmessage onConnectionat field 65 (next identifierbumped 65 → 66).Why nested
Generated as a pointer, so three states survive the wire:
nilA flat
boolcollapses the first two.Order
logs-backend → dd-go CNM → dd-go NPP → datadog-agent → web-ui