AEROSIM-TS-6
End a flight and record its outcome
The player can deliberately end or abort an active flight and receives one explicit recorded session outcome.
- Verified flow state
- Done
- Owner
- AeroSim Architecture and Delivery
- Feature
- AEROSIM-FT-5
- Component
- Web Application — flight-session lifecycle and outcome presentation
- Repository
- corp-v1-aerosim/corp-v1-aerosim
Delivery scope
Implement applications/web/src/flight/session/flight-completion-coordinator.ts, applications/web/test/flight/flight-completion.browser.spec.ts. Consume only the inputs listed in this contract, publish only its listed outputs, enforce every failure boundary before commit, and prove the listed exclusions remain unchanged through the verification steps.
Implementation contract
Implementation artifacts
- applications/web/src/flight/session/flight-completion-coordinator.ts
- applications/web/test/flight/flight-completion.browser.spec.ts
Inputs
- EndFlightRequested { attemptId, commandId, reason: COMPLETED | ABORTED } for the current ACTIVE or PAUSED attempt.
- Last committed SimulationSnapshot and SessionSummaryAccumulator for the same attempt.
Outputs
- Immutable FlightOutcome { attemptId, terminalState, reason, finalStep, simulationTimeMs, finalAircraftState, summary, completedAt } persisted before runtime disposal.
- EndFlightAccepted { attemptId, commandId, outcomeId } and one session transition to COMPLETED or ABORTED, followed by presentation of that exact outcome.
Failure boundaries
- Reject a terminal request for a stale attempt or a session already outside ACTIVE/PAUSED; do not overwrite an existing outcome.
- Treat duplicate commandId or repeated terminal requests after commit as idempotent and return the original outcome reference.
- If outcome validation or persistence fails, keep the session in its prior state and runtime intact, emit EndFlightRejected, and allow the same command to be retried; never dispose before durable commit.
Excluded scope
- Retry/restart state reconstruction and selection changes.
- Release analytics, camera implementation, and mutation of the final aircraft snapshot.
Verification steps
- Run applications/web/test/flight/flight-completion.browser.spec.ts for completion and deliberate abort from ACTIVE and PAUSED; assert outcome commit precedes runtime disposal and displayed values equal the committed record.
- Repeat terminal commands and send stale-attempt/invalid-state requests; assert exactly one immutable outcome and one terminal transition.
- Inject outcome validation and persistence failure; assert the prior session/runtime remain usable, no partial outcome appears, retry succeeds once, and completion-to-presentation timing meets the configured limit.
Traceability
Dependencies
- AEROSIM-TS-96Canonical ID: TASK-0096
UI/UX applicability
non_visual
This Task owns technical or behavioral acceptance and does not claim direct visual conformance to the approved UI/UX package.
Acceptance evidence
Verified delivery: application PR #139 reviewed head abc81582eb2e9b5092fbe2786446da5d8fb9a71d merged as 28ee48de26badd56200f0496f7c010c9c3ef57f7. Completion and abort from ACTIVE/PAUSED persist one immutable outcome before disposal and present that exact record; duplicates are idempotent; stale, invalid, mismatched, and persistence-failure paths preserve runtime/state and support safe retry. Focused tests pass 8/8; web tests pass 1,104/1,104 plus invalid-action 11/11, flight-completion 8/8, flight-instruments 5/5, and environment-presentation 27/27; lint, typecheck, build, production audit, candidate runs 4376-4377, and integration/publication runs 4378-4379 passed. Release completion verified on product 1.0.0.0 at GitOps revision 5d3712d89dfbf7dacd993348e55f497d126c7bf9 with Argo Synced/Healthy, exact image digests, authenticated API/database access, and three-world configured-flight acceptance.
Current evidence boundary
No current implementation, acceptance, release, or deployment evidence is claimed for this planned Task. Any prior implementation may be used only as prototype and discovery evidence.