Skip to content

Bug: Label_20_CFB.01.ts is dead code — never imported, has a self-contradictory preamble/regex, and would emit fake decodeLevel:'full' if enabled #503

Description

@kevinelliott

Summary

lib/plugins/Label_20_CFB.01.ts is not imported anywhere (no export * from './Label_20_CFB.01' in lib/plugins/official.ts, no reference in MessageDecoder.pluginClasses). Even if it were wired up, it can never match its intended payload: the qualifier preamble is #CFB.01 while the regex is anchored ^IN02,…, so the preamble filter and the body regex are mutually exclusive. Separately, the tail of decode() sets decoded = true; decodeLevel = 'full' outside the if (results?.groups) block, meaning any input that survived the preamble filter would emit a fake full decode with zero populated fields — the same anti-pattern already filed against Label_8E (#463), Label_H2_02E (#476), Label_ColonComma (#483), and Label_MA (#486).

Location

lib/plugins/Label_20_CFB.01.ts:13,26,65-66

Reproduction

  • grep -r 'CFB.01' lib/ | grep -v Label_20_CFB.01 → no matches.
  • Registering the plugin and sending { label: '20', text: '#CFB.01 anything' } would produce decoded: true, decodeLevel: 'full' with no fields populated.

Impact

Chore-level today (dead code, no production effect), but a latent silent-wrong-output waiting for the day someone adds export * from './Label_20_CFB.01'; without noticing the always-true tail.

Suggested fix

Pick one of:

  1. Delete the file (and its test, if any).
  2. Fix the qualifier vs. regex mismatch (either preamble IN and regex ^IN02,…, or preamble #CFB.01 and regex matching what actually follows), guard the decoded = true / decodeLevel = 'full' inside the if (results?.groups) block, register the plugin in official.ts + MessageDecoder.ts.

Also consider renaming the file to avoid the dot in Label_20_CFB.01.ts for consistency with the rest of lib/plugins/.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions