Skip to content

Conversation

@makrsmark
Copy link
Collaborator

@makrsmark makrsmark commented Feb 6, 2026

require a message label, to choose the correct decoder

Summary by CodeRabbit

  • Breaking Changes
    • Message objects now require a label field (previously optional). Any code or integrations that construct or pass message payloads must include a non-empty label value to remain compatible with decoders.

@coderabbitai
Copy link

coderabbitai bot commented Feb 6, 2026

Walkthrough

Make Message.label required in lib/DecoderPluginInterface.ts and refactor numerous plugin test files to use a shared message fixture (with label) that mutates message.text and is passed to plugin.decode(...); tests now often assert decodeResult.message equals the shared object.

Changes

Cohort / File(s) Summary
Core Interface
lib/DecoderPluginInterface.ts
Changed Message.label from optional (label?: string) to required (label: string).
General test refactor (many plugins)
lib/plugins/.../*.test.ts
Refactored tests across most plugin suites to introduce a reusable message fixture (e.g., const message = { label: 'XX', text: '' }), set message.text per-case, call plugin.decode(message), and update assertions to expect decodeResult.message to be the shared object.
Tests converted to describe/ beforeEach style
lib/plugins/Label_4A*.test.ts, lib/plugins/Label_30_*.test.ts, lib/plugins/Label_44_*.test.ts, lib/plugins/Label_83.test.ts, lib/plugins/Label_H1_*.test.ts
Converted several suites to describe blocks with beforeEach that instantiates plugin and shared message; added/expanded qualifier and decoded-item assertions while switching inputs to the shared message object.
Label-specific small refactors
lib/plugins/Label_1L_*.test.ts, lib/plugins/Label_2P_*.test.ts, lib/plugins/Label_10_*.test.ts, lib/plugins/Label_12_*.test.ts, lib/plugins/Label_13Through18_Slash.test.ts, lib/plugins/Label_15*.test.ts, lib/plugins/Label_16_*.test.ts, lib/plugins/Label_20_POS.test.ts, lib/plugins/Label_21_POS.test.ts, lib/plugins/Label_22_*.test.ts, lib/plugins/Label_24_Slash.test.ts, lib/plugins/Label_58.test.ts, lib/plugins/Label_5Z_Slash.test.ts, lib/plugins/Label_80.test.ts, lib/plugins/Label_8E.test.ts, lib/plugins/Label_HX.test.ts, lib/plugins/Label_MA.test.ts, lib/plugins/Label_QQ.test.ts, lib/plugins/Label_SQ.test.ts, lib/plugins/Label_*others*.test.ts
Per-label refactors replacing inline { text: ... } decode inputs with the shared message object and updating invalid-case assertions to compare decodeResult.message to the fixture; no production API changes beyond the core interface edit.
Tests adding minor assertions
lib/plugins/Label_30_Slash_EA.test.ts, lib/plugins/Label_4A_*.test.ts, lib/plugins/Label_H1_*.test.ts
Some suites added extra decoded-item assertions (codes/labels/values) and qualifier checks when moving to shared plugin/message setup.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25–30 minutes

Possibly related PRs

Suggested reviewers

  • kevinelliott
  • andermatt64

Poem

"🐇
I found a label, snug and bright,
One message hops from test to test tonight.
Text is set, the plugin greets,
Decode returns the very same sweet beat.
Hooray — tidy fixtures, all is right!"

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Require label for Message' directly and clearly summarizes the main change: making the label property required in the Message interface, which is the primary alteration to the public API in this changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 9

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
lib/plugins/Label_2P_FM4.test.ts (1)

74-83: ⚠️ Potential issue | 🟡 Minor

Missing decodeResult.message assertion in the invalid test case.

Both variant 1 (Line 22) and variant 2 (Line 51) assert expect(decodeResult.message).toBe(message), but this test omits it. For consistency and to verify the decoder attaches the message reference even on failed decodes, consider adding the same check here.

Suggested addition
     expect(decodeResult.decoded).toBe(false);
     expect(decodeResult.decoder.decodeLevel).toBe('none');
+    expect(decodeResult.message).toBe(message);
     expect(decodeResult.formatted.description).toBe('Flight Report');
     expect(decodeResult.formatted.items.length).toBe(0);
lib/plugins/Label_22_POS.test.ts (1)

23-40: ⚠️ Potential issue | 🟡 Minor

Missing semicolon on Line 24.

Line 24 is missing a trailing semicolon, unlike the other message.text assignments in this file (e.g., Line 44).

Proposed fix
-    message.text = 'N 370824W 760010,-------,194936,30418, ,      , ,M 42,27335  42, 107,'
+    message.text = 'N 370824W 760010,-------,194936,30418, ,      , ,M 42,27335  42, 107,';
🤖 Fix all issues with AI agents
In `@lib/plugins/Label_10_LDR.test.ts`:
- Around line 23-25: Two message.text assignments in the tests are missing
trailing semicolons causing inconsistent style; add a semicolon to the end of
the string assignments where message.text is set (e.g., in the test "decodes
Label 10 Preamble LDR variant 1" and the other message.text assignment later in
the same test file) so both statements mirror the semicolon usage used elsewhere
(the decode call plugin.decode(message) should remain unchanged).

In `@lib/plugins/Label_13Through18_Slash.test.ts`:
- Around line 303-312: The test "does not decode <invalid>" uses message.text =
'/14 Bogus Message' while message.label remains '13', creating an unintended
label mismatch; update the test so the message.label matches the payload (set
message.label to '14') or explicitly assert a mismatched-label scenario—modify
the setup in this test to either set message.label = '14' before calling
plugin.decode(message) or change the test name/assertions to document that a
mismatched label is being tested, referencing the test case and the call to
plugin.decode(message).

In `@lib/plugins/Label_1L_070.test.ts`:
- Around line 25-26: Add the missing semicolon at the end of the message.text
assignment to match project style and avoid potential lint/parse issues; locate
the statement setting message.text (the line before the call to
plugin.decode(message)) and terminate it with a semicolon so the code becomes a
proper statement before invoking plugin.decode.

In `@lib/plugins/Label_30_Slash_EA.test.ts`:
- Line 13: The test name contains a typo: rename the test titled "matches
qualfiers" to "matches qualifiers" by updating the string in the test(...) call
(the test name literal) in the file containing the test function (the test
invocation starting with test('matches qualfiers', ...)); leave the test body
and assertions unchanged so only the human-readable test description is
corrected.

In `@lib/plugins/Label_44_ETA.test.ts`:
- Line 4: The describe block name is wrong: change the string in the top-level
describe call from 'Label 44 IN' to 'Label 44 ETA' so the test suite name
matches the file and imported plugin; locate the describe(...) invocation in
Label_44_ETA.test.ts and update its description accordingly.

In `@lib/plugins/Label_H1_FLR.test.ts`:
- Line 12: The test name string in the unit test 'matches  qualifiers' contains
a double space; update the test declaration in Label_H1_FLR.test.ts (the
test(...) call) to use a single space so it reads 'matches qualifiers' and
verify any related references (e.g., test descriptions or snapshots) are updated
to match the corrected string.

In `@lib/plugins/Label_H1_FTX.test.ts`:
- Around line 17-18: Add missing trailing semicolons for consistency: ensure
each statement like the message.text assignments and the following const
decodeResult = plugin.decode(message) have a semicolon at the end (e.g., add
semicolons to the message.text lines shown and to the decodeResult assignment)
so all occurrences of message.text and the plugin.decode(message) call follow
the same style.

In `@lib/plugins/Label_H1_PRG.test.ts`:
- Line 4: The test suite label is incorrect: update the describe call string
from "Label_H1 POS" to "Label_H1 PRG" so the suite name displays correctly;
locate the describe('Label_H1 POS', ...) invocation in the test file
(Label_H1_PRG.test.ts) and change the label text to "Label_H1 PRG".
- Line 124: Remove the stray debug statement console.log(JSON) from the skipped
test in Label_H1_PRG.test.ts; either delete that line entirely or replace it
with the intended debug output (e.g., the specific variable or value you meant
to inspect) so the global JSON constructor is not logged accidentally. Locate
the call in the skipped test block (search for console.log(JSON) inside the
Label_H1_PRG.test.ts test definitions) and update or remove it accordingly.
🧹 Nitpick comments (30)
lib/plugins/Label_H1_PER.test.ts (1)

7-7: Shared mutable fixture risks test isolation if decode() mutates the message object.

message is declared once at describe scope and never reset between tests. Each test correctly sets message.text, but if plugin.decode() ever adds or modifies other properties on the object (e.g., sets a flag, attaches metadata), that state leaks into subsequent tests. Consider resetting in beforeEach:

Suggested improvement
   let plugin: Label_H1;
-  const message = {label: 'H1', text: ''};
+  let message: { label: string; text: string };

   beforeEach(() => {
     const decoder = new MessageDecoder();
     plugin = new Label_H1(decoder);
+    message = { label: 'H1', text: '' };
   });

Since this pattern is replicated across 45+ test files, this may be an intentional trade-off — just flagging the risk.

lib/plugins/Label_16_Honeywell.test.ts (1)

6-11: Shared mutable message risks test coupling if decode() ever mutates the object.

message is declared once at suite scope and never reset in beforeEach. If plugin.decode() adds or modifies properties on the message beyond text (now or in the future), that state silently leaks into subsequent tests. Consider resetting it in beforeEach alongside plugin:

Suggested improvement
 describe("Label_16_Honeywell", () => {
   let plugin: Label_16_Honeywell;
-  const message = { label: "16", text: "" };
+  let message: { label: string; text: string };

   beforeEach(() => {
     const decoder = new MessageDecoder();
     plugin = new Label_16_Honeywell(decoder);
+    message = { label: "16", text: "" };
   });
lib/plugins/Label_2P_FM4.test.ts (1)

7-7: Shared mutable test fixture creates implicit coupling between tests.

Each test mutates message.text on a suite-level object. While this works given Jest's sequential execution, it means tests are order-dependent and a future test that forgets to set message.text will silently inherit stale state from the previous test. Consider resetting message inside beforeEach or constructing it per-test.

Given this is a project-wide convention across 45+ files, this is a minor observation rather than a blocking concern.

lib/plugins/Label_12_POS.test.ts (1)

7-12: Shared mutable message object is not reset between tests.

message is declared once at suite scope and mutated in each test, but beforeEach only resets plugin. Since each test sets message.text before calling decode, this works today. However, if decode ever mutates other properties on message (e.g., sets fields on the object), those mutations would leak between tests, causing hard-to-diagnose coupling.

Consider resetting message in beforeEach to isolate tests:

Suggested change
  let plugin: Label_12_POS;
- const message = {label: '12', text: ''};
+ let message: {label: string, text: string};

  beforeEach(() => {
    const decoder = new MessageDecoder();
    plugin = new Label_12_POS(decoder);
+   message = {label: '12', text: ''};
  });

This applies to all other test files in this PR that follow the same pattern.

lib/plugins/Label_1J_2J_FTX.test.ts (1)

7-7: Minor: let used instead of const — inconsistent with other test files in this PR.

All other test files use const message = .... Since the reference itself isn't reassigned (only message.text is mutated), const would be more appropriate here. Alternatively, if adopting the beforeEach reset pattern, let is correct.

lib/plugins/Label_H1_INI.test.ts (1)

7-7: Shared mutable message object across tests — consider resetting in beforeEach.

Since message is a const reference shared across all tests and mutated via message.text = ..., any properties the decode() method may attach to the message object will leak into subsequent tests. This applies to all 7 files in this PR. A safer pattern is to reinitialize the message in beforeEach:

♻️ Suggested reset pattern
- const message = {label: 'H1', text: ''};
+ let message: {label: string, text: string};

  beforeEach(() => {
    const decoder = new MessageDecoder();
    plugin = new Label_H1(decoder);
+   message = {label: 'H1', text: ''};
  });
lib/plugins/Label_16_N_Space.test.ts (1)

7-7: Shared mutable message risks test coupling if decode() ever mutates its input.

The message object is declared once with const and mutated across all tests. If plugin.decode() ever adds/modifies properties on the input (e.g., normalizes text, attaches metadata), later tests will inherit those mutations, causing order-dependent failures. This applies to all 7 test files in this PR.

A safer pattern is to reinitialize message in beforeEach, or use a factory function:

♻️ Suggested safer pattern
- const message = {label: '16', text: ''};
+ let message: {label: string, text: string};

  beforeEach(() => {
    const decoder = new MessageDecoder();
    plugin = new Label_16_N_Space(decoder);
+   message = {label: '16', text: ''};
  });
lib/plugins/Label_44_ON.test.ts (1)

23-49: Variant 1 and 2 are missing the decodeResult.message identity assertion.

Other test files and the invalid-case test in this file (Line 87) assert expect(decodeResult.message).toBe(message). The two success-path tests don't, which is inconsistent with the PR-wide pattern.

Also applies to: 51-78

lib/plugins/Label_44_OFF.test.ts (1)

23-54: Variant 1 is missing the decodeResult.message identity assertion, inconsistent with the invalid-case test at Line 63.

Same observation as in Label_44_ON.test.ts.

lib/plugins/Label_44_Slash.test.ts (1)

23-36: Variant 1 and 2 are missing the decodeResult.message identity assertion, inconsistent with the invalid-case test at Line 62.

Same observation as the other Label_44_* test files.

Also applies to: 38-54

lib/plugins/Label_44_ETA.test.ts (1)

23-57: Variant 1 is missing the decodeResult.message identity assertion, inconsistent with the invalid-case test at Line 66.

lib/plugins/Label_4J_POS.test.ts (1)

58-67: Missing decodeResult.message assertion for consistency.

Other test files (e.g., Label_12_N_Space.test.ts, Label_1L_Slash.test.ts) assert expect(decodeResult.message).toBe(message) in the invalid-message test case. This test omits it, which is inconsistent with the pattern established across the PR.

lib/plugins/Label_1L_3-line.test.ts (1)

83-92: Missing decodeResult.message assertion for consistency.

Same as flagged in Label_4J_POS.test.ts — the invalid-message test in other files asserts expect(decodeResult.message).toBe(message) but this one does not.

lib/plugins/Label_H1_StarPOS.test.ts (1)

44-53: Missing decodeResult.message assertion for consistency.

The valid-decode test (Line 21) asserts decodeResult.message reference equality, but this invalid test does not.

lib/plugins/Label_H1_FPN.test.ts (1)

14-40: Inconsistent decodeResult.message assertion coverage within this file.

Only the invalid test (Line 262) and the RM test (Line 282) assert expect(decodeResult.message).toBe(message). The other ~10 decode tests do not. Consider applying the assertion consistently across all tests in this file—or removing it from the two that have it—to keep the test suite uniform.

Also applies to: 255-263, 265-283

lib/plugins/Label_1L_660.test.ts (1)

6-6: Shared mutable message across tests risks silent test-order coupling.

Since message is declared once at describe scope and mutated by each test, any test that forgets to set message.text will silently inherit the value left by the previous test. Consider resetting message.text inside beforeEach, or creating a fresh object per test. This pattern repeats across all test files in this PR.

♻️ Suggested fix — reset in beforeEach
     beforeEach(() => {
         const decoder = new MessageDecoder();
         plugin = new Label_1L_660(decoder);
+        message.text = '';
     });
lib/plugins/Label_4N.test.ts (3)

13-19: Redundant decoder/plugin instantiation in qualifiers test.

This test creates its own decoder and decoderPlugin (lines 14-15) even though plugin is already available from beforeEach. Consider using the shared plugin instance for consistency with the rest of the file. This is pre-existing code now wrapped in the describe block.

Suggested cleanup
 test('matches Label 4N qualifiers', () => {
-  const decoder = new MessageDecoder();
-  const decoderPlugin = new Label_4N(decoder);
-
-  expect(decoderPlugin.decode).toBeDefined();
-  expect(decoderPlugin.name).toBe('label-4n');
+  expect(plugin.decode).toBeDefined();
+  expect(plugin.name).toBe('label-4n');
+  expect(plugin.qualifiers).toBeDefined();
+  expect(plugin.qualifiers()).toEqual({
+    labels: ['4N'],
+  });
 });

13-138: Inconsistent indentation: tests inside describe are not indented.

All test(...) blocks from lines 13–138 sit at the top indentation level despite being nested inside the describe block opened at line 4. Other files in this PR (e.g., Label_22_POS.test.ts, Label_SQ.test.ts) properly indent tests within their describe. This appears to be an artifact of wrapping existing tests without re-indenting.


129-138: Invalid-case test doesn't assert decodeResult.message.

Other invalid tests in this PR (e.g., Label_22_POS.test.ts line 49, Label_10_LDR.test.ts line 79) assert expect(decodeResult.message).toBe(message). This test omits that assertion, which is an inconsistency with the pattern established across the PR.

lib/plugins/Label_30_Slash_EA.test.ts (1)

13-41: Tests inside describe are not indented.

Same indentation inconsistency as in Label_4N.test.ts — the test blocks should be indented one level within the describe for consistency with other files in this PR (e.g., Label_22_POS.test.ts, Label_SQ.test.ts).

lib/plugins/Label_83.test.ts (1)

116-127: Variant 3 tests still create their own decoder/plugin despite shared plugin being available.

Lines 117–118 and 142–143 instantiate a local decoder/decoderPlugin while the shared plugin from beforeEach goes unused. These tests do use the shared message object, creating an inconsistent mix. Consider using plugin throughout for uniformity with the other tests in this file.

Suggested cleanup (variant 3)
 test('decodes Label 83 variant 3', () => {
-  const decoder = new MessageDecoder();
-  const decoderPlugin = new Label_83(decoder);
-
   // https://globe.adsbexchange.com/?icao=AC15A1&showTrace=2024-09-22&timestamp=1726977342
   message.text = '001PR22035539N4038.6W07427.80292500008';
-  const decodeResult = decoderPlugin.decode(message);
+  const decodeResult = plugin.decode(message);

Also applies to: 141-153

lib/plugins/Label_1M_Slash.test.ts (1)

13-58: Tests inside describe are not indented.

Same indentation issue as Label_4N.test.ts and Label_30_Slash_EA.test.ts — test blocks should be indented one level within the describe for consistency with files like Label_SQ.test.ts and Label_22_POS.test.ts in this PR.

lib/plugins/Label_H1_WRN.test.ts (1)

4-12: Shared mutable message object risks cross-test contamination.

message is a single const object declared at describe scope and mutated by each test. While this works because each test reassigns message.text before calling decode, the plugin stores a reference (decodeResult.message = message), so any post-decode mutation of message in a later test retroactively changes the decodeResult.message from a prior test. This is fragile if tests are later reordered or assertions are added that inspect results across tests.

A safer pattern is to create a fresh message per test (or reset in beforeEach):

Suggested approach
- const message = {label: 'H1', text: ''};
+ let message: {label: string, text: string};

  beforeEach(() => {
    const decoder = new MessageDecoder();
    plugin = new Label_H1_WRN(decoder);
+   message = {label: 'H1', text: ''};
  });

This applies to all 7 test files in this PR that use the same pattern.

lib/plugins/Label_8E.test.ts (1)

13-23: Redundant decoder/decoderPlugin creation in qualifiers test.

This test creates a local decoder and decoderPlugin (lines 14-15) despite plugin already being initialized in beforeEach. Other test files in this PR (e.g., Label_H1_WRN.test.ts line 15, Label_HX.test.ts line 15) use the shared plugin directly. This looks like leftover code from before the refactor.

Suggested fix
 test('matches qualifiers', () => {
-  const decoder = new MessageDecoder();
-  const decoderPlugin = new Label_8E(decoder);
-
-  expect(decoderPlugin.decode).toBeDefined();
-  expect(decoderPlugin.name).toBe('label-8e');
-  expect(decoderPlugin.qualifiers).toBeDefined();
-  expect(decoderPlugin.qualifiers()).toEqual({
+  expect(plugin.decode).toBeDefined();
+  expect(plugin.name).toBe('label-8e');
+  expect(plugin.qualifiers).toBeDefined();
+  expect(plugin.qualifiers()).toEqual({
     labels: ['8E'],
   });
 });
lib/plugins/Label_2P_FM3.test.ts (1)

14-32: Inconsistent decodeResult.message assertion across variants.

Variant 3 (line 65) asserts expect(decodeResult.message).toBe(message), but variants 1 and 2 do not. Other test files in this PR (e.g., Label_H1_WRN.test.ts, Label_HX.test.ts) consistently include this assertion in every test. Consider adding it to variants 1, 2, and the invalid test for consistency.

lib/plugins/Label_H1_OHMA.test.ts (2)

4-10: Shared message object is not reset in beforeEach, risking test pollution.

message.text is mutated per test but never reset in beforeEach. If a future test omits setting message.text, it will silently inherit the previous test's value. Consider resetting message.text = '' inside beforeEach alongside the plugin re-creation, or creating a fresh message object per test.

This concern applies to all the test files in this PR that follow the same pattern.

Proposed fix
   beforeEach(() => {
     const decoder = new MessageDecoder();
     plugin = new Label_H1_OHMA(decoder);
+    message.text = '';
   });

12-23: Qualifiers test doesn't use the shared plugin — inconsistent with the refactoring.

This test creates a local decoder and decoderPlugin instead of using the shared plugin from beforeEach. Other test files in this PR (e.g., Label_4A.test.ts, Label_4A_DIS.test.ts) use the shared plugin for their qualifiers test.

Proposed fix
 test('matches Label H1 Preamble OHMA qualifiers', () => {
-  const decoder = new MessageDecoder();
-  const decoderPlugin = new Label_H1_OHMA(decoder);
-
-  expect(decoderPlugin.decode).toBeDefined();
-  expect(decoderPlugin.name).toBe('label-h1-ohma');
-  expect(decoderPlugin.qualifiers).toBeDefined();
-  expect(decoderPlugin.qualifiers()).toEqual({
+  expect(plugin.decode).toBeDefined();
+  expect(plugin.name).toBe('label-h1-ohma');
+  expect(plugin.qualifiers).toBeDefined();
+  expect(plugin.qualifiers()).toEqual({
     labels: ['H1'],
     preambles: ['OHMA', '/RTNBOCR.OHMA', '#T1B/RTNBOCR.OHMA'],
   });
 });
lib/plugins/Label_4A_Slash_01.test.ts (1)

23-38: Decode test creates a redundant local decoder/plugin while mutating the shared message.

Lines 24–25 instantiate a local decoder and decoderPlugin, but line 28 mutates the shared message.text and line 29 passes the shared message to decoderPlugin.decode. The beforeEach already creates a shared plugin — this test should use it for consistency with the rest of the refactored suite.

Proposed fix
 test('decodes Label 4A_Slash_01', () => {
-  const decoder = new MessageDecoder();
-  const decoderPlugin = new Label_4A_Slash_01(decoder);
-
   // https://app.airframes.io/messages/3460403039
   message.text = '/01-C';
-  const decodeResult = decoderPlugin.decode(message);
+  const decodeResult = plugin.decode(message);
   
   expect(decodeResult.decoded).toBe(true);
lib/plugins/Label_4A_01.test.ts (1)

52-64: Skipped test still creates a redundant local decoder/plugin.

The skipped invalid test at lines 53–54 creates a local decoder and decoderPlugin, then uses the shared message. Since plugin is already available from beforeEach, this should use the shared instance for consistency — especially if the test is ever unskipped.

Proposed fix
 test.skip('decodes Label 4A_01 <invalid>', () => {
-  const decoder = new MessageDecoder();
-  const decoderPlugin = new Label_4A_01(decoder);
-
   message.text = '4A_01 Bogus message';
-  const decodeResult = decoderPlugin.decode(message);
+  const decodeResult = plugin.decode(message);
lib/plugins/Label_4A_DIS.test.ts (1)

12-12: Nit: double space in test name.

'matches Label 4A_DIS qualifiers' has a double space before "qualifiers".

Proposed fix
-test('matches Label 4A_DIS  qualifiers', () => {
+test('matches Label 4A_DIS qualifiers', () => {

@@ -3,6 +3,7 @@ import { Label_44_ETA } from './Label_44_ETA';

describe('Label 44 IN', () => {
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Describe block name 'Label 44 IN' appears to be a copy-paste error — this file tests Label_44_ETA.

Should be 'Label 44 ETA' to match the imported plugin and the rest of the test suite naming convention.

🔧 Proposed fix
-describe('Label 44 IN', () => {
+describe('Label 44 ETA', () => {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
describe('Label 44 IN', () => {
describe('Label 44 ETA', () => {
🤖 Prompt for AI Agents
In `@lib/plugins/Label_44_ETA.test.ts` at line 4, The describe block name is
wrong: change the string in the top-level describe call from 'Label 44 IN' to
'Label 44 ETA' so the test suite name matches the file and imported plugin;
locate the describe(...) invocation in Label_44_ETA.test.ts and update its
description accordingly.

@@ -4,6 +4,7 @@ import { Label_H1 } from './Label_H1';
describe('Label_H1 POS', () => {
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Incorrect describe label: "POS" should be "PRG".

This appears to be a copy-paste error from another H1 test file. The test suite name will display incorrectly in test output.

Proposed fix
-describe('Label_H1 POS', () => {
+describe('Label_H1 PRG', () => {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
describe('Label_H1 POS', () => {
describe('Label_H1 PRG', () => {
🤖 Prompt for AI Agents
In `@lib/plugins/Label_H1_PRG.test.ts` at line 4, The test suite label is
incorrect: update the describe call string from "Label_H1 POS" to "Label_H1 PRG"
so the suite name displays correctly; locate the describe('Label_H1 POS', ...)
invocation in the test file (Label_H1_PRG.test.ts) and change the label text to
"Label_H1 PRG".

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
lib/plugins/Label_H1_FLR.test.ts (1)

98-115: ⚠️ Potential issue | 🟡 Minor

Duplicate test name — this tests ATC, not LQD.

This test is named 'decodes Label H1 Preamble FLR LQD', identical to the test at line 79, but it actually decodes a #CFBFLR / ATC message. Duplicate names make it impossible to distinguish failures in test runner output.

Proposed fix
-test('decodes Label H1 Preamble FLR LQD', () => {
+test('decodes Label H1 Preamble FLR ATC', () => {
🧹 Nitpick comments (7)
lib/plugins/Label_H1_PRG.test.ts (1)

7-7: Shared mutable message not reset between tests — minor test-isolation risk.

The message object is shared across all tests and only message.text is reassigned before each test. If plugin.decode (or a future refactor of it) ever mutates the message object (e.g., adds or modifies a property), that mutation will leak into subsequent tests. Consider resetting the object in beforeEach for resilience:

Suggested improvement
   let plugin: Label_H1;
-  const message = {label: 'H1', text: ''};
+  let message: {label: string, text: string};

   beforeEach(() => {
     const decoder = new MessageDecoder();
     plugin = new Label_H1(decoder);
+    message = {label: 'H1', text: ''};
   });

Currently Label_H1.decode only reads message.text and stores a reference (decodeResult.message = message), so this is not a live bug today — just a fragility concern.

lib/plugins/Label_13Through18_Slash.test.ts (1)

22-27: Shared mutable message object across tests risks test isolation.

Each describe block declares a single message object and mutates .text before each test. If plugin.decode() ever mutates the input message (e.g., attaches metadata, normalizes fields), those side effects leak into subsequent tests, causing hard-to-debug order-dependent failures.

A safer approach is to construct a fresh object per test or use beforeEach to reset it:

♻️ Example using beforeEach
  describe('Label 13', () => {
-   const message = {label: '13', text: ''};
+   let message: {label: string, text: string};
+   beforeEach(() => {
+     message = {label: '13', text: ''};
+   });
    test('decodes 1-line', () => {

This applies to all six label describe blocks (lines 23, 65, 151, 194, 221, 269).

lib/plugins/Label_30_Slash_EA.test.ts (2)

4-11: Shared mutable message is not reset in beforeEach.

message is declared once at describe scope and its .text is mutated per test (line 23), but beforeEach only re-creates the plugin. If additional decode tests are added later, they'll inherit .text from whatever test ran previously, which breaks test isolation.

Consider resetting message.text in beforeEach:

Proposed fix
   beforeEach(() => {
     const decoder = new MessageDecoder();
     plugin = new Label_30_Slash_EA(decoder);
+    message.text = '';
   });

13-21: Indentation: test blocks inside describe are not indented.

Both test(...) blocks (lines 13 and 22) sit at column 0 while the rest of the describe body (lines 5–11) is indented by 2 spaces. This is purely cosmetic but inconsistent.

lib/plugins/Label_H1_FTX.test.ts (1)

7-12: Shared mutable message may leak state between tests.

If plugin.decode ever mutates the message object (e.g., attaches decoded properties), those mutations persist into subsequent tests since only plugin is reset in beforeEach. Consider resetting message in beforeEach as well, or constructing a fresh object per test.

♻️ Suggested change
   let plugin: Label_H1;
-  const message = {label: 'H1', text: ''};
+  let message: {label: string, text: string};

   beforeEach(() => {
     const decoder = new MessageDecoder();
     plugin = new Label_H1(decoder);
+    message = {label: 'H1', text: ''};
   });
lib/plugins/Label_H1_FLR.test.ts (2)

4-11: Shared message object is not reset in beforeEach.

plugin is re-created each run, but message retains the .text from the previous test. This works because every test re-assigns message.text before calling decode, but it would be more robust and consistent to move the message initialization inside beforeEach alongside plugin.

♻️ Suggested refactor
 describe('Label H1 Preamble FLR', () => {
   let plugin: Label_H1_FLR;
-  const message = {label: 'H1', text: ''};
+  let message: { label: string; text: string };

   beforeEach(() => {
     const decoder = new MessageDecoder();
     plugin = new Label_H1_FLR(decoder);
+    message = { label: 'H1', text: '' };
   });

12-20: Inconsistent indentation: tests are not indented inside the describe block.

Lines 5–11 are indented within the describe callback, but all test(...) blocks starting at line 12 are flush-left. Syntactically they're still inside describe (closed at line 128), but the indentation is misleading.

@makrsmark makrsmark merged commit fa66aca into airframesio:master Feb 6, 2026
6 checks passed
@makrsmark makrsmark deleted the feature/force-label branch February 6, 2026 13:11
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.

1 participant