Skip to content

Add unknown aircraft from a SimBrief import, unconfirmed until operations confirm them - #347

Merged
oskarbarcz merged 2 commits into
mainfrom
feat/unconfirmed-aircraft-from-simbrief
Nov 17, 2026
Merged

oskarbarcz merged 2 commits into
mainfrom
feat/unconfirmed-aircraft-from-simbrief

Conversation

@oskarbarcz

@oskarbarcz oskarbarcz commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

A SimBrief import used to fail with 404 when the plan's registration wasn't in the fleet. It now adds the aircraft, marked unconfirmed, so operations can check it later. This prepares for pilots requesting a SimBrief plan themselves, without switching to an operations account.

  • ImportAircraftByRegistrationCommand (aircraft module) finds the aircraft by the plan's registration, trimmed and upper-cased. If none exists, it creates one for the plan's operator with the plan's aircraft.icaocode, the operator's default livery and no SELCAL, base or ETOPS rating, with isConfirmed: false. It replaces GetAircraftByRegistrationQuery, which nothing else used.
  • A registration already in the fleet with a different type fails the import with 409 (Aircraft D-AIMC is registered as A359, but the flight plan uses A339.), and no flight is created. A plan without a registration or type gets a 422, and a new registration whose type isn't a known airframe gets a 404.
  • Aircraft gain isConfirmed, added by migration 20261117150000_add_aircraft_is_confirmed. It defaults to true, so existing and manually created aircraft stay confirmed, and the previous release can still insert rows during the deploy. Every aircraft read model returns it. PATCH /operator/:operatorId/aircraft/:aircraftId accepts it and rejects null, which is how operations confirm an aircraft; the app shows that as its own "Confirm correctness" button.
  • The import now resolves the operator before the aircraft, because a new aircraft needs it.
  • A separate commit adds defaultAtisSource to the seeded users. Remember the ATIS source each pilot prefers #346 made it required without updating the seed. CI runs the seed untyped, but the dev server type-checks it and wouldn't start.
  • The seed adds D-AIXP, an unconfirmed Lufthansa A350-900 set up the way an import creates one, so a fresh local stack shows the state. Lufthansa's seeded fleet summary becomes 9 aircraft, A339 and A359.
  • The SimBrief mocks now carry icaocode: A339. The "non existing aircraft" mock (D-TEST) is now a complete plan, so the import gets past the aircraft.
  • Version 3.88.0. New scenarios cover creating an unknown aircraft, refusing a type mismatch, confirming, and rejecting null. Every aircraft response expectation now includes isConfirmed. There's a unit spec for the command, and the aircraft-management spec describes both rules.

Lint, Jest (1,430 tests) and Cucumber (1,618 scenarios) pass locally.

Knowledge base: mypreflight/product#76 (draft). The app change follows separately.

The user's defaultAtisSource is required on the Prisma type, but the
seeded users never set it. The seed runs untyped in CI, so nothing
failed there, but the dev server type-checks it and would not start.
Each user gets say_intentions, the column's default.
…ions confirm them

An imported plan whose registration isn't in the fleet now creates the
aircraft for the plan's operator with the plan's ICAO type and the
operator's default livery, marked unconfirmed, instead of failing with
404. A plan that flies a fleet registration as another type is refused
with 409, and a plan without a registration or type with 422.

Aircraft gain isConfirmed (default true, so existing and manually created
aircraft stay confirmed). Every aircraft read model returns it and the
aircraft PATCH accepts it, which is how operations confirm an aircraft.
@github-actions

Copy link
Copy Markdown

OpenTofu plan for infra

Commit c541e84 · 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:21" -> (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:21" -> (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.86.0" -> "ghcr.io/mypreflight/flight-tracker-api:3.88.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                 = 21 -> (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.86.0" -> "ghcr.io/mypreflight/flight-tracker-api:3.88.0"

Workflow run

@oskarbarcz oskarbarcz self-assigned this Nov 17, 2026
@oskarbarcz
oskarbarcz merged commit 05e921e into main Nov 17, 2026
4 checks passed
@oskarbarcz
oskarbarcz deleted the feat/unconfirmed-aircraft-from-simbrief branch November 17, 2026 16:24
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