Skip to content

fix(runtime): preserve event channel metadata compatibility (cherry-pick #12708) - #12840

Merged
pvijayakrish merged 1 commit into
release/1.4.0from
tmonty12/cp-12708-release-1.4.0
Aug 7, 2026
Merged

fix(runtime): preserve event channel metadata compatibility (cherry-pick #12708)#12840
pvijayakrish merged 1 commit into
release/1.4.0from
tmonty12/cp-12708-release-1.4.0

Conversation

@tmonty12

@tmonty12 tmonty12 commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Cherry-pick fix(runtime): preserve event channel metadata compatibility [DYN-3846] #12708 onto release/1.4.0.
  • Accept v1.2 EventChannel metadata by reconstructing legacy namespace and component fields as the current internal scope.
  • Emit the legacy fields alongside the current scope so v1.2 frontends can deserialize DWM records from current workers.
  • Preserve current endpoint scope, event-source advertisements, and publisher IDs.

Original PR

Release adaptation

Clean cherry-pick with no conflicts or release-specific code changes.

Validation

  • cargo test -p dynamo-runtime discovery::kube::crd::tests --lib — 4 passed
  • Explicit v1.2 event-channel wire-shape compatibility test passed
  • cargo fmt --all -- --check — passed
  • uvx pre-commit run --from-ref origin/release/1.4.0 --to-ref HEAD — passed
  • git diff --check origin/release/1.4.0..HEAD — passed
  • Branch contains exactly one signed, DCO-compliant cherry-pick commit with source provenance.

Related Issues

Signed-off-by: PeaBrane <yanrpei@gmail.com>
(cherry picked from commit a487897)
Signed-off-by: Thomas Montfort <tjmontfort12@gmail.com>
@github-actions github-actions Bot added the fix label Aug 7, 2026
@tmonty12
tmonty12 marked this pull request as ready for review August 7, 2026 19:11
@tmonty12
tmonty12 requested a review from a team as a code owner August 7, 2026 19:11

@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 2 potential issues.

Open in Devin Review

Comment on lines +105 to +113
channel.insert(
"namespace".to_string(),
serde_json::Value::String(scope.namespace().to_string()),
);
channel.insert(
"component".to_string(),
// v1.2 represented namespace-scoped publishers with an empty component.
serde_json::Value::String(scope.component().unwrap_or("").to_string()),
);

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.

🔍 Endpoint-scoped channels are downgraded to component identity, losing endpoint distinction for v1.2 readers

add_legacy_event_channel_fields maps every scope onto only namespace/component, so an EventScope::Endpoint channel becomes indistinguishable from a component-scoped one in the v1.2 wire shape (EventScope::component() returns the endpoint's component, lib/runtime/src/discovery/mod.rs:264-270). Two endpoint-scoped channels of the same component/topic on one worker share the same instance_id, so a v1.2 reader sees two map entries with identical legacy identity (namespace, component, topic, instance_id) but different transports; v1.2 keyed its own map by EventChannelInstanceId::to_path() (ns/comp/topic/id) and its subscribers group by discovery instance, so one publisher may be shadowed. Worth confirming whether the current runtime ever registers two endpoint-scoped channels with the same topic under one component, since that is the only scenario in which the downgrade is ambiguous. The reverse direction is also inherently lossy: upgraded v1.2 records always become EventScope::Component, so a current subscriber querying with EventChannelQuery::endpoint_topic(...) will not match a v1.2 publisher's record even for the same logical channel.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Comment on lines +82 to +86
/// Accept the pre-scope event-channel shape at the Kubernetes DWM boundary.
pub(super) fn deserialize_metadata(mut data: serde_json::Value) -> Result<DiscoveryMetadata> {
add_current_event_channel_scopes(&mut data)?;
Ok(serde_json::from_value(data)?)
}

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.

🔍 Compatibility shim applies only to the Kubernetes DWM path, not the KV-store discovery backend

The legacy field emission/reconstruction lives entirely in build_cr/deserialize_metadata for the Kubernetes CR boundary. lib/runtime/src/discovery/kv_store.rs serializes DiscoveryInstance directly (serde_json::to_vec(&instance) at lib/runtime/src/discovery/kv_store.rs:445, from_slice at :195) and derives keys from EventChannelInstanceId::from_path at :208, so etcd/KV-store deployments mixing v1.2 and current binaries remain incompatible for event channels. If mixed-version rollout is only supported on Kubernetes this is fine; otherwise the shim is incomplete.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

@datadog-official

datadog-official Bot commented Aug 7, 2026

Copy link
Copy Markdown

🎯 Code Coverage (details)
Patch Coverage: 100.00%
Overall Coverage: 42.49% (-5.99%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 3aeaee4 | Docs | Datadog PR Page | Give us feedback!

@pvijayakrish
pvijayakrish merged commit d4b92c6 into release/1.4.0 Aug 7, 2026
108 of 109 checks passed
@pvijayakrish
pvijayakrish deleted the tmonty12/cp-12708-release-1.4.0 branch August 7, 2026 21:56
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