Skip to content

Preserve default fallback result when no decoder plugin matches#440

Draft
Copilot wants to merge 2 commits into
masterfrom
copilot/fix-message-decoder-default-result
Draft

Preserve default fallback result when no decoder plugin matches#440
Copilot wants to merge 2 commits into
masterfrom
copilot/fix-message-decoder-default-result

Conversation

Copy link
Copy Markdown

Copilot AI commented May 28, 2026

MessageDecoder.decode() initialized a useful fallback result for unmatched messages, but then replaced it with each plugin's unsuccessful return. As a result, callers could receive the last plugin's partial "unknown" response instead of the intended top-level failure payload.

  • Decoder fallback semantics

    • Keep the prebuilt default DecodeResult as the return value unless a plugin actually decodes the message.
    • Stop replacing the fallback with intermediate plugin failures, so unmatched messages retain:
      • error: 'No known decoder plugin for this message'
      • decoder: { name: 'none', type: 'none', decodeLevel: 'none' }
      • the original message
      • full remaining.text
      • formatted.description: 'Not Decoded'
  • Regression coverage

    • Add a MessageDecoder test for a registered label (44) with garbage payload that no plugin can decode.
    • Assert that the returned object is the default unmatched-message result rather than the last attempted plugin result.
  • Behavioral change

    let result = defaultNoMatchResult;
    
    for (const plugin of usablePlugins) {
      const pluginResult = plugin.decode(message, options);
      if (pluginResult.decoded) {
        result = pluginResult;
        break;
      }
    }
    
    return result;

Copilot AI changed the title [WIP] Fix MessageDecoder.decode to preserve default failure result Preserve default fallback result when no decoder plugin matches May 28, 2026
Copilot AI requested a review from kevinelliott May 28, 2026 03:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: MessageDecoder.decode discards default failure result when no plugin decodes

2 participants