Skip to content

fix(runtime): preserve event channel metadata compatibility [DYN-3846] - #12708

Merged
PeaBrane merged 2 commits into
mainfrom
agent/fix-event-channel-metadata-compat
Aug 7, 2026
Merged

fix(runtime): preserve event channel metadata compatibility [DYN-3846]#12708
PeaBrane merged 2 commits into
mainfrom
agent/fix-event-channel-metadata-compat

Conversation

@PeaBrane

@PeaBrane PeaBrane commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Accept v1.2 EventChannel metadata by reconstructing its legacy namespace / component fields as the current internal scope before DWM deserialization.
  • Emit legacy namespace / component fields alongside the current scope so v1.2 frontends can deserialize DWM records from current workers.
  • Keep current endpoint scope, event-source advertisements, and publisher IDs unchanged.

Root cause

#11841 replaced the serialized event-channel namespace / component fields with scope. During a rolling upgrade, either side treats the other version's required field as missing, and one incompatible event channel rejects the worker's entire DynamoWorkerMetadata record.

This patch confines the compatibility projection to the Kubernetes DWM boundary. Legacy channels remain component-scoped when read by current code; v1.2 workers cannot provide the newer endpoint-scoped event_sources recovery membership, and this patch does not synthesize that attribution.

Validation

  • cargo test -p dynamo-runtime discovery::kube::crd::tests
  • Commit-time pre-commit hooks

Summary by CodeRabbit

  • Bug Fixes
    • Improved Kubernetes event-channel metadata compatibility across current and legacy representations.
    • Event scope information is now preserved when creating and reading discovery resources.
    • Added support for processing metadata from both formats during snapshot aggregation.
    • Added coverage for metadata conversion and round-trip behavior.

Signed-off-by: PeaBrane <yanrpei@gmail.com>
@github-actions github-actions Bot added the fix label Aug 5, 2026
@PeaBrane
PeaBrane marked this pull request as ready for review August 5, 2026 18:21
@PeaBrane
PeaBrane requested a review from a team as a code owner August 5, 2026 18:21
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

Kubernetes discovery metadata now converts scoped event channels to legacy namespace/component fields during CR construction and restores EventScope during deserialization. Snapshot aggregation uses the shared deserializer, with compatibility tests for both formats.

Changes

Event metadata compatibility

Layer / File(s) Summary
Event-channel wire-format conversion
lib/runtime/src/discovery/kube/crd.rs
build_cr writes legacy event-channel fields. deserialize_metadata restores scoped channels and preserves transport data. Tests cover current and legacy representations.
Shared metadata reader integration
lib/runtime/src/discovery/kube/daemon.rs
aggregate_snapshot parses CR metadata through deserialize_metadata.

Estimated code review effort: 3 (Moderate) | ~20 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the change, root cause, scope, reviewer focus, and validation, but it omits the required Related Issues section. Add the required Related Issues section and confirm either the linked issue number or that no related issue exists.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: preserving event-channel metadata compatibility in the runtime.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
lib/runtime/src/discovery/kube/crd.rs (1)

343-372: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add direct coverage for legacy namespace scope.

Add a legacy fixture with "component": "". Assert that deserialize_metadata creates EventScope::Namespace. This covers the branch at Line 140 and protects the v1.2 compatibility mapping.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@lib/runtime/src/discovery/kube/crd.rs` around lines 343 - 372, Add a legacy
event-channel fixture in the existing deserialization test using an empty
"component" value, then call deserialize_metadata and assert the resulting
DiscoveryInstance::EventChannel uses EventScope::Namespace with the expected
namespace, topic, instance_id, and transport. Keep the existing component-scoped
assertion and ensure the new case exercises the legacy namespace mapping branch.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@lib/runtime/src/discovery/kube/crd.rs`:
- Around line 343-372: Add a legacy event-channel fixture in the existing
deserialization test using an empty "component" value, then call
deserialize_metadata and assert the resulting DiscoveryInstance::EventChannel
uses EventScope::Namespace with the expected namespace, topic, instance_id, and
transport. Keep the existing component-scoped assertion and ensure the new case
exercises the legacy namespace mapping branch.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: b4948e75-1da3-484d-b072-ca07653bca6f

📥 Commits

Reviewing files that changed from the base of the PR and between e322c8d and 7d22fdd.

📒 Files selected for processing (2)
  • lib/runtime/src/discovery/kube/crd.rs
  • lib/runtime/src/discovery/kube/daemon.rs

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

Open in Devin Review

Comment thread lib/runtime/src/discovery/kube/crd.rs
Signed-off-by: PeaBrane <yanrpei@gmail.com>
@datadog-official

This comment has been minimized.

@PeaBrane
PeaBrane merged commit a487897 into main Aug 7, 2026
117 checks passed
@PeaBrane
PeaBrane deleted the agent/fix-event-channel-metadata-compat branch August 7, 2026 01:43
pvijayakrish pushed a commit that referenced this pull request Aug 7, 2026
…ick #12708) (#12840)

Signed-off-by: PeaBrane <yanrpei@gmail.com>
Signed-off-by: Thomas Montfort <tjmontfort12@gmail.com>
Co-authored-by: Yan Ru Pei <yanrpei@gmail.com>
@PeaBrane PeaBrane changed the title fix(runtime): preserve event channel metadata compatibility fix(runtime): preserve event channel metadata compatibility [DYN-3846] Aug 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants