Skip to content

Let pilots import their own SimBrief plan and check in with its estimated times - #348

Merged
oskarbarcz merged 1 commit into
mainfrom
pilot-simbrief-import
Nov 18, 2026
Merged

oskarbarcz merged 1 commit into
mainfrom
pilot-simbrief-import

Conversation

@oskarbarcz

@oskarbarcz oskarbarcz commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

Pilots no longer need operations to get a flight: a pilot imports the latest plan in their own SimBrief account and flies it straight away.

What changes

  • POST /api/v1/flight/create-with-simbrief accepts the CabinCrew role. An operations import is unchanged and stays created.
  • A pilot's import runs the same import, then MarkAsReadyCommand and CheckInPilotCommand. The pilot is the captain, and every check-in side effect runs: current flight, NOTOC acknowledgement, check-in travel, weather monitoring, Discord briefing. The estimated times come from the OFP's times.est_out/est_off/est_on/est_in, each falling back to its sched_* when the plan has no estimate. The flight's events carry the user scope.
  • A checked-in flight leaves the shared Ready pool, so it never shows up as another pilot's next flight.
  • A pilot with a flight in progress gets 409 ("A flight is already in progress. Close it before importing another plan."), checked before SimBrief is called.
  • The departure stand can now be set or changed until boarding starts, not only until check-in. Without that, a pilot's own import could never get a departure stand. The error now reads "…because boarding has started."
  • The SimBrief mock for 123456 carries est_* times a few minutes off the scheduled ones, so the scenario proves which set was used.

Tests

  • Unit: the estimates are taken from the plan, with a fallback to scheduled times; a pilot with a flight in progress is refused before the plan is fetched.
  • Functional, in flight.create-with-simbrief.feature:
    • a new pilot imports, is checked_in with the plan's estimated times, and can still set the departure stand
    • a pilot without a SimBrief ID gets 400
    • a pilot with a flight in progress gets 409
    • the old "cabin crew cannot create" 403 scenario is gone
  • The departure stand scenarios now refuse after boarding starts (LH83).
  • format (whole repo), lint, test and test:functional pass locally: 1433 unit tests, 1620 scenarios.

Version 3.89.0.

Knowledge base: mypreflight/product#78
Web app: mypreflight/app#364, which needs this deployed first.

🤖 Generated with Claude Code

…ated times

Cabin crew can now call the SimBrief import. A pilot's import is marked
ready and checks the pilot in with the plan's estimated off-block,
takeoff, arrival and on-block times, so the flight is theirs straight
away and never shows up as another pilot's next flight. A pilot with a
flight in progress is refused before SimBrief is called. Operations
imports still stay in created.

The departure stand can now be set until boarding starts rather than
only until check-in, so a flight checked in by its import can still get
one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

OpenTofu plan for infra

Commit c2aef8b · Plan: 1 to add, 1 to change, 1 to destroy.

Show plan
 OpenTofu used the selected providers to generate the following execution
 plan. Resource actions are indicated with the following symbols:
!  ~ update in-place (current -> planned)
!-/+ destroy and then create replacement
 
 OpenTofu will perform the following actions:
 
   # aws_ecs_service.app will be updated in-place
!  ~ resource "aws_ecs_service" "app" {
         id                                 = "arn:aws:ecs:eu-central-1:805830022748:service/mypreflight/flight-tracker-api"
         name                               = "flight-tracker-api"
         tags                               = {}
!      ~ task_definition                    = "arn:aws:ecs:eu-central-1:805830022748:task-definition/flight-tracker-api:22" -> (known after apply)
         # (19 unchanged attributes hidden)
 
         # (4 unchanged blocks hidden)
     }
 
   # aws_ecs_task_definition.app must be replaced
!-/+ resource "aws_ecs_task_definition" "app" {
!      ~ arn                      = "arn:aws:ecs:eu-central-1:805830022748:task-definition/flight-tracker-api:22" -> (known after apply)
!      ~ arn_without_revision     = "arn:aws:ecs:eu-central-1:805830022748:task-definition/flight-tracker-api" -> (known after apply)
!      ~ container_definitions    = jsonencode(
!          ~ [
                 {
                     command                = [
                         "tunnel",
                         "--no-autoupdate",
                         "--metrics",
                         "localhost:20241",
                         "--grace-period",
                         "20s",
                         "run",
                     ]
                     dependsOn              = [
                         {
                             condition     = "HEALTHY"
                             containerName = "flight-tracker-api"
                         },
                     ]
                     environment            = []
                     essential              = true
                     healthCheck            = {
                         command     = [
                             "CMD",
                             "cloudflared",
                             "tunnel",
                             "--metrics",
                             "localhost:20241",
                             "ready",
                         ]
                         interval    = 5
                         retries     = 6
                         startPeriod = 10
                         timeout     = 2
                     }
                     image                  = "cloudflare/cloudflared@sha256:4955524aeaa379e154023d5a027c250f7b35041a2e7e950cf13f144bc9b9c5ba"
                     linuxParameters        = {
                         capabilities = {
                             add  = []
                             drop = [
                                 "ALL",
                             ]
                         }
                     }
                     logConfiguration       = {
                         logDriver = "awslogs"
                         options   = {
                             awslogs-group         = "/ecs/flight-tracker-api"
                             awslogs-region        = "eu-central-1"
                             awslogs-stream-prefix = "cloudflared"
                         }
                     }
                     mountPoints            = []
                     name                   = "cloudflared"
                     portMappings           = []
                     readonlyRootFilesystem = true
                     secrets                = [
                         {
                             name      = "TUNNEL_TOKEN"
                             valueFrom = "arn:aws:ssm:eu-central-1:805830022748:parameter/mypreflight/api/cloudflare-tunnel-token"
                         },
                     ]
                     systemControls         = []
                     volumesFrom            = []
                 },
!              ~ {
!                  ~ image                  = "ghcr.io/mypreflight/flight-tracker-api:3.88.0" -> "ghcr.io/mypreflight/flight-tracker-api:3.89.0"
                     name                   = "flight-tracker-api"
                     # (11 unchanged attributes hidden)
                 },
             ] # forces replacement
         )
!      ~ enable_fault_injection   = false -> (known after apply)
!      ~ id                       = "flight-tracker-api" -> (known after apply)
!      ~ revision                 = 22 -> (known after apply)
-      - tags                     = {} -> null
         # (11 unchanged attributes hidden)
 
-      - volume {
-          - configure_at_launch = false -> null
-          - name                = "tmp" -> null
         }
+      + volume {
+          + configure_at_launch = (known after apply)
+          + name                = "tmp"
         }
 
         # (1 unchanged block hidden)
     }
 
 Plan: 1 to add, 1 to change, 1 to destroy.
 
 Changes to Outputs:
!  ~ app_image        = "ghcr.io/mypreflight/flight-tracker-api:3.88.0" -> "ghcr.io/mypreflight/flight-tracker-api:3.89.0"

Workflow run

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