Skip to content

Commit de6137f

Browse files
kevinelliottclaude
andcommitted
Spec: Label_4A → whole-plugin hatch (matches the pattern of other complex plugins)
The variant+field+formatter-custom shape worked in theory but had no clean contract for who owns the formatted.items list when the formatter is custom. Other complex plugins (CBand, ARINC_702, MIAM, etc.) use the whole-plugin parse-custom + format-description shape; Label_4A follows suit. Implementation lives in lib/plugins/escape_hatches/Label_4A.ts in each language repo. Validates clean: 68 specs OK. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent c037de4 commit de6137f

1 file changed

Lines changed: 8 additions & 56 deletions

File tree

spec/labels/4A.yaml

Lines changed: 8 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -7,62 +7,14 @@ plugin:
77
qualifiers:
88
labels: ["4A"]
99
parse:
10-
- { split: ",", into: fields }
11-
variants:
12-
# Variant 1: 11 fields → timestamp + tail + callsign + airports
13-
- name: latest_new_format_11
14-
when: { equals: [{ length: $fields }, 11] }
15-
fields:
16-
- name: timestamp
17-
from: $fields[0]
18-
decode: { fn: timestamp_hhmmss }
19-
- name: tail
20-
from: $fields[2]
21-
decode: { fn: tail_number, args: { strip_chars: "." } }
22-
- name: callsign
23-
from: $fields[3]
24-
when: { not_equal: ["$fields[3]", ""] }
25-
decode: { fn: callsign }
26-
- name: departure_icao
27-
from: $fields[4]
28-
decode: { fn: airport }
29-
- name: arrival_icao
30-
from: $fields[5]
31-
decode: { fn: airport }
32-
33-
# Variant 2: 6 fields, first one starts with N or S — coords + waypoints.
34-
# Complex enough that it gets an escape hatch.
35-
- name: latest_new_format_6_position
36-
when:
37-
all:
38-
- { equals: [{ length: $fields }, 6] }
39-
- { matches: ["$fields[0]", "^[NS]"] }
40-
fields:
41-
- name: variant_2_result
42-
from: $fields
43-
decode:
44-
fn: custom
45-
custom: label_4a_variant_2_decode
46-
47-
# Variant 3: 6 fields, not starting with N or S — timestamp + ETA + position
48-
- name: latest_new_format_6_status
49-
when: { equals: [{ length: $fields }, 6] }
50-
fields:
51-
- name: timestamp
52-
from: $fields[0]
53-
decode: { fn: timestamp_hhmmss }
54-
- name: eta
55-
from: $fields[1]
56-
decode: { fn: timestamp_hhmmss }
57-
- name: altitude
58-
from: $fields[3]
59-
decode: { fn: integer }
60-
- name: position
61-
from: $fields
62-
decode:
63-
fn: custom
64-
custom: label_4a_variant_3_position
65-
- default: fail
10+
# Whole-plugin hatch. The original Label_4A.ts has three variants selected
11+
# by field-count + first-char inspection, with each variant doing inline
12+
# ResultFormatter calls (position via substring slicing, route with two
13+
# waypoints, temperature, eta, altitude, callsign, tail, airports). The
14+
# field-level + format-level decomposition the spec previously attempted
15+
# didn't have a clean contract for formatter-owning-raw, so the hatch
16+
# form is the right shape here.
17+
custom: label_4a_dispatch
6618
formatted:
6719
description: "Latest New Format"
6820
custom: label_4a_format

0 commit comments

Comments
 (0)