Skip to content

Leaving / Reaching {altitude} {instruction}#873

Open
Jud6969 wants to merge 28 commits into
mmp:masterfrom
Jud6969:leaving-reaching-commands
Open

Leaving / Reaching {altitude} {instruction}#873
Jud6969 wants to merge 28 commits into
mmp:masterfrom
Jud6969:leaving-reaching-commands

Conversation

@Jud6969

@Jud6969 Jud6969 commented Apr 23, 2026

Copy link
Copy Markdown
Contributor

Closes #438
Added "Leaving / Passing {altitude} {instruction}" -> LVALT/INSTRUCTION
Added "Reaching {altitude} {instruction}" -> "RC100/DAAC"

Jud6969 and others added 28 commits April 20, 2026 20:46
Spec for mmp#438: controller-issued "leaving {alt}, do X" and
"reaching {alt}, do X" commands. Follows the existing A{fix}/... typed-
dispatch precedent.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Implements ConditionalDirectFix with Execute (calls public DirectFix,
discarding the intent since conditional firing is silent) and Render
(emits direct/left-direct/right-direct fragments). Adds Execute and
Render tests using a route-bearing Nav helper.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…ough Execute

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Implements the exported trigger predicate that checks whether a pending
LV/RC conditional command should fire based on the aircraft's current
altitude and vertical rate.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Extract fireConditionalIfTriggered helper so the per-second update loop
runs ConditionalTriggered and, when true, silently executes the deferred
action and clears the slot. The slot clears before Execute so that a
follow-on conditional installed from within Execute doesn't fire on the
same tick.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Review noted the guard protects against a follow-on conditional installed
by Execute rather than a mis-parse. Match the ConditionalAction interface
doc which describes this as intentional re-entrancy safety.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Registers conditional-leaving patterns for heading, direct-fix, speed,
and mach inner commands. Each template mirrors the phraseology of its
non-conditional sibling.

Implementation notes:
- "leaving" is a fillerWords entry (prevents fuzzy match with "heading"),
  so two companion fixes are required:
  - parse.go: check for leaving|passing + altitude BEFORE the filler-skip
    loop, same pattern as the existing "then" and "at {altitude}" checks
  - matcher.go: literalMatcher filler-skip loop now exempts a token that
    exactly matches one of the matcher's own target keywords, so the
    "leaving|passing" literal can match its own keyword even though
    "leaving" is in fillerWords

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Adds subtests for left-direct, right-direct, maintain-speed, and mach —
four templates registered in fabd822 that lacked explicit coverage.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…t}/{inner}

Mirror of the LV section. "reaching", "level", "on", "at" are not filler
words, so no parse.go or matcher.go changes are needed.

The plan's single combined template "reaching|level at|on reaching" cannot
be expressed as one template string because the parser splits alternations
on spaces — multi-word phrases like "level at" decompose into two separate
required matchers. Instead each inner command is registered twice:
  - "[on] reaching {altitude} ..." — covers "reaching X" and "on reaching X"
  - "level [at] {altitude} ..."   — covers "level X" and "level at X"

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
When "leaving|passing|reaching {alt} direct|proceed {fix}" matches through
direct/proceed but the fix isn't in the aircraft's Fixes map, the template
would previously fail silently and fall through to the standalone_altitude
handler, producing a misleading A{alt} output (e.g., "reaching 7000 direct
DANNY" → A70 when DANNY isn't on the route).

Add WithSayAgainOnFail() to the 9 LV/RC direct-fix handlers so they emit
SAYAGAIN/FIX instead. Guard with WithSayAgainMinTokens(3) to require
keyword + altitude + direct/proceed to all match before triggering —
prevents false positives where "leave" fuzzy-matches unrelated words in
transcripts like "leave in november" without a following altitude.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…commands

# Conflicts:
#	sim/control.go
#	sim/sim.go
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.

add support for "leaving/reaching [alt]..." aircraft instructions

1 participant