fix: keep route descriptors when routing feedback can't rebuild them - #1497
Merged
Merged
Conversation
RoutingFeedbackManager removed every route descriptor for a destination's
input port before re-deriving them from routing feedback, and didn't put
them back when the walk found no source. ReleaseRouteInternal depends on
those descriptors to know what to switch off, so clearing a port-keyed
destination found nothing to release and left the route up. Destinations
routed with no port key ('auto') escaped because the removal matched on
the port key.
- Add RouteDescriptorCollection.ReplaceRouteDescriptor: replaces the
descriptor for one destination, input port and signal type, only when
there is a replacement, and keeps the executed descriptor when the
source is unchanged
- RoutingFeedbackManager no longer removes descriptors up front; a
rebuilt route goes through ReplaceRouteDescriptor, and a walk with no
source only updates the current source
Fixes #1496
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1496. This is a regression in rc.10.
Problem
RoutingFeedbackManager.UpdateDestinationImmediateremoved every route descriptor for a destination's input port before re-deriving them from routing feedback. Both re-add paths were conditional, and both were skipped when the walk couldn't resolve a source or resolved to no source.ReleaseRouteInternaldepends on those descriptors to know what to switch off, so clearing the destination afterwards found nothing to release, and the route stayed up.Only port-keyed destinations were affected. The removal matched on the input port key, so descriptors for destinations routed without a
destinationPortKey(auto, nullInputPort) never matched. #1494 made the removal take every descriptor rather than one, which made the damage larger.This leaves sinks that don't report
CurrentInputPort(e.g.MockVC) with no working configuration. Without a port key their feedback can't resolve, and with one their teardown breaks.Fix
RouteDescriptorCollection.ReplaceRouteDescriptor(replacement)(new) replaces the descriptor recorded for one destination, input port and signal type, and only when a replacement exists. If the existing descriptor already names the same source, nothing changes: that's the descriptor that was executed, and it holds the output ports' in-use registrations.RoutingFeedbackManagerno longer removes anything up front. A rebuilt route goes throughReplaceRouteDescriptor. A walk with no source still sets the destination's current source to none, but leaves the descriptors for the release.This follows the issue's first suggestion: derive the replacement first, and replace only when one exists.
Tests
RouteDescriptorCollectionTests:ReplaceRouteDescriptorswaps only the matching port and signal, keeps the executed descriptor when the source is unchanged, ignores null, and a release still finds both descriptors after a feedback pass that offers no replacement.RoutingFeedbackManagerTests(new): drivesUpdateDestinationImmediatewith a sink that never reportsCurrentInputPortand a matrix that reports nothing routed. Both descriptors survive. Against the rc.10 code this fails with the issue's symptom (an empty collection).All 59 tests pass, 8 out of 8 runs. This hasn't been run on a processor.
Note for anyone extending these tests: the feedback-manager tests deliberately avoid the paths that reach
Extensions.GetRouteToSource. Its static constructor creates aGenericQueue, which subscribes to the real Crestron SDK'sCrestronEnvironment.ProgramStatusEventHandler, and off a processor that call intermittently spins forever and hangs the test host.Not in this PR
CurrentRoutes, and is worth a separate look.MockVC.CurrentInputPortis never assigned, which is why MockVC destinations needdestinationPortKeyat all.🤖 Generated with Claude Code