Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,17 @@ repos:
language: system
types: [python]
pass_filenames: false
- id: eslint-web-editor
name: eslint web-editor
entry: bash -c 'cd web-editor && npm run lint'
language: system
files: ^web-editor/
pass_filenames: false
types: [file]
- id: tsc-web-editor
name: tsc web-editor
entry: bash -c 'cd web-editor && npx tsc --noEmit'
language: system
files: ^web-editor/
pass_filenames: false
types: [file]
17 changes: 17 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,23 @@
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python Debugger: Start Server",
"type": "debugpy",
"request": "launch",
"module": "uvicorn",
"args": [
"openutm_verification.server.main:app",
"--reload",
"--port",
"8989"
],
"env": {
"PYTHONPATH": "${workspaceFolder}/src"
},
"jinja": true,
"justMyCode": true
},
{
"name": "Python Debugger: Verify with --debug",
"type": "debugpy",
Expand Down
9 changes: 9 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python",
"cSpell.words": [
"openutm"
],
Expand All @@ -11,5 +12,13 @@
"**/__pycache__": true,
"**/*.pyc": true,
".venv": true
},
"[python]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "charliermarsh.ruff",
"editor.codeActionsOnSave": {
"source.fixAll": "explicit",
"source.organizeImports": "explicit"
}
}
}
18 changes: 18 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# --- UI Builder Stage ---
FROM node:20-slim AS ui-builder
WORKDIR /app/web-editor
COPY web-editor/package.json web-editor/package-lock.json ./
RUN npm ci
COPY web-editor/ .
RUN npm run build

# --- Builder Stage ---
FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim AS builder

Expand Down Expand Up @@ -25,6 +33,7 @@ ENV PYTHONUNBUFFERED=1
# Copy dependency files first for better layer caching
COPY pyproject.toml uv.lock ./
COPY docs ./docs
COPY scenarios ./scenarios

# Install project dependencies using uv sync with cache mount for faster builds
# --frozen: ensures reproducible builds from uv.lock
Expand Down Expand Up @@ -64,6 +73,9 @@ RUN apt-get update \
ENV PYTHONUNBUFFERED=1
ENV TZ=UTC
ENV PATH="/app/.venv/bin:$PATH"
ENV WEB_EDITOR_PATH=/app/web-editor
ENV SCENARIOS_PATH=/app/scenarios
ENV DOCS_PATH=/app/docs

# Create non-root user and group for enhanced security
RUN (getent group "${GID}" || groupadd -g "${GID}" "${APP_GROUP}") \
Expand All @@ -72,6 +84,9 @@ RUN (getent group "${GID}" || groupadd -g "${GID}" "${APP_GROUP}") \
# Copy application artifacts from builder stage
COPY --chown=${UID}:${GID} --from=builder /app /app

# Copy UI artifacts from ui-builder stage
COPY --chown=${UID}:${GID} --from=ui-builder /app/web-editor/dist /app/web-editor/dist

# Set working directory
WORKDIR /app

Expand All @@ -82,6 +97,9 @@ RUN mkdir -p /app/config /app/reports \
# Switch to non-root user
USER ${UID}:${GID}

# Expose the server port
EXPOSE 8989

# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD python -c "import sys; print('OK'); sys.exit(0)" || exit 1
Expand Down
17 changes: 17 additions & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# --- UI Builder Stage ---
FROM node:20-slim AS ui-builder
WORKDIR /app/web-editor
COPY web-editor/package.json web-editor/package-lock.json ./
RUN npm ci
COPY web-editor/ .
RUN npm run build

# Development Dockerfile for hot reload and debugging
FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim AS development

Expand Down Expand Up @@ -30,6 +38,9 @@ ENV UV_COMPILE_BYTECODE=0
ENV UV_LINK_MODE=copy
ENV PYTHONUNBUFFERED=1
ENV PYTHONPATH=/app/src
ENV WEB_EDITOR_PATH=/app/web-editor
ENV SCENARIOS_PATH=/app/scenarios
ENV DOCS_PATH=/app/docs

# Copy dependency files
COPY --chown=${UID}:${GID} LICENSE README.md pyproject.toml uv.lock ./
Expand All @@ -43,10 +54,16 @@ RUN --mount=type=cache,target=/home/${APP_USER}/.cache/uv,uid=${UID},gid=${GID}
# Copy source code
COPY --chown=${UID}:${GID} . .

# Copy UI artifacts from ui-builder stage
COPY --chown=${UID}:${GID} --from=ui-builder /app/web-editor/dist /app/web-editor/dist

# Create directories
RUN mkdir -p /app/reports /app/config \
&& chown -R ${UID}:${GID} /app/reports /app/config

# Expose the server port
EXPOSE 8989

# Switch to non-root user
USER ${UID}:${GID}

Expand Down
2 changes: 1 addition & 1 deletion config/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ opensky:
# Air traffic data configuration
air_traffic_simulator_settings:
number_of_aircraft: 3
simulation_duration_seconds: 10
simulation_duration: 10
single_or_multiple_sensors: "multiple" # this setting specifiies if the traffic data is submitted from a single sensor or multiple sensors
sensor_ids: ["a0b7d47e5eac45dc8cbaf47e6fe0e558"] # List of sensor IDs to use when 'multiple' is selected

Expand Down
2 changes: 1 addition & 1 deletion config/pull_request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ opensky:
# Air traffic data configuration
air_traffic_simulator_settings:
number_of_aircraft: 3
simulation_duration_seconds: 10
simulation_duration: 10
single_or_multiple_sensors: "multiple" # this setting specifiies if the traffic data is submitted from a single sensor or multiple sensors
sensor_ids: ["a0b7d47e5eac45dc8cbaf47e6fe0e558"] # List of sensor IDs to use when 'multiple' is selected

Expand Down
43 changes: 43 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ services:
volumes:
- ./config:/app/config:Z
- ./reports:/app/reports:Z
- ./scenarios:/app/scenarios:Z
# Network configuration for local Flight Blender access
network_mode: host
# Resource limits
Expand Down Expand Up @@ -74,3 +75,45 @@ services:
network_mode: host
profiles:
- dev

# Server mode service
verification-server:
image: openutm/verification:latest
container_name: openutm-verification-server
build:
context: .
dockerfile: Dockerfile
args:
UV_COMPILE_BYTECODE: 1
UV_LINK_MODE: copy
APP_USER: appuser
APP_GROUP: appgrp
UID: ${HOST_UID:-1000}
GID: ${HOST_GID:-1000}
environment:
- PYTHONUNBUFFERED=1
- TZ=UTC
- FLIGHT_BLENDER_URL=${FLIGHT_BLENDER_URL:-http://host.docker.internal:8000}
- LOG_LEVEL=${LOG_LEVEL:-INFO}
volumes:
- ./config:/app/config:Z
- ./reports:/app/reports:Z
- ./scenarios:/app/scenarios:Z
ports:
- "8989:8989"
extra_hosts:
- "host.docker.internal:host-gateway"
command: ["--server", "--config", "config/default.yaml"]
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8989/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
restart: unless-stopped
labels:
- "project=openutm-verification"
- "component=verification-server"
- "environment=${ENVIRONMENT:-production}"
profiles:
- server
36 changes: 36 additions & 0 deletions docs/scenarios/F1_flow_no_telemetry_with_user_input.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# F1 Flow No Telemetry with User Input

## Overview

**Scenario Name:** `F1_flow_no_telemetry_with_user_input`
**Description:** This scenario validates a flight operation flow that requires manual user intervention to proceed. It activates a flight, pauses for user input, and then ends the operation, without submitting any telemetry data. This is useful for testing state transitions and operator interactions.

## Execution Flow

The scenario executes the following sequence of steps:

### 1. Setup Flight Declaration
- **Action:** Creates a flight declaration context.
- **Context:** Establishes the baseline for the flight operation.

### 2. Initial Wait
- **Step:** `Wait`
- **Action:** System pauses for **5 seconds**.
- **Context:** Simulates a pre-activation delay.

### 3. Activate Operation
- **Step:** `Update Operation State`
- **Action:** Transitions the flight operation state to **`ACTIVATED`**.

### 4. User Input Required
- **Step:** `Wait For User Input`
- **Action:** The simulation pauses and waits for the user to confirm continuation (e.g., "Press Enter to end the operation...").
- **Context:** Allows manual verification of the system state while the flight is active, or coordination with external events.

### 5. End Operation
- **Step:** `Update Operation State`
- **Action:** Transitions the flight operation state to **`ENDED`**.

### 6. Explicit Teardown
- **Step:** `Teardown Flight Declaration`
- **Action:** Explicitly invokes the teardown of the flight declaration to ensure no artifacts remain.
34 changes: 34 additions & 0 deletions docs/scenarios/F1_happy_path.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# F1 Happy Path

## Overview

**Scenario Name:** `F1_happy_path`
**Description:** This scenario validates the "Happy Path" (nominal flow) for a flight operation. It simulates a completely successful flight life-cycle without any deviations, interruptions, or off-nominal conditions.

## Execution Flow

The scenario executes the following sequence of steps:

### 1. Setup Flight Declaration
- **Action:** Creates a flight declaration context (uploading necessary declaration and trajectory validation).
- **Context:** Establishes the baseline for the flight operation.

### 2. Activate Operation
- **Step:** `Update Operation State`
- **Action:** Transitions the flight operation state to **`ACTIVATED`**.
- **Context:** Signals that the flight is ready to commence or has commenced.

### 3. Submit Telemetry
- **Step:** `Submit Telemetry`
- **Action:** Streams telemetry data for the flight.
- **Duration:** **30 seconds**
- The system submits position updates securely for a half-minute duration to simulate active flight tracking.

### 4. End Operation
- **Step:** `Update Operation State`
- **Action:** Transitions the flight operation state to **`ENDED`**.
- **Purpose:** Normally completes the flight operation.

### 5. Explicit Teardown
- **Step:** `Teardown Flight Declaration`
- **Action:** Explicitly invokes the teardown of the flight declaration to ensure no artifacts remain.
39 changes: 39 additions & 0 deletions docs/scenarios/F2_contingent_path.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# F2 Contingent Path

## Overview

**Scenario Name:** `F2_contingent_path`
**Description:** This scenario validates the system's handling of off-nominal flight conditions, specifically the transition to a **Contingent** state. It simulates a flight that activates normally but then encounters an issue requiring a state change before ending.

## Execution Flow

The scenario executes the following sequence of steps:

### 1. Setup Flight Declaration
- **Action:** Creates a flight declaration context.
- **Context:** Establishes the baseline for the flight operation.

### 2. Activate Operation
- **Step:** `Update Operation State`
- **Action:** Transitions the flight operation state to **`ACTIVATED`**.
- **Context:** The flight begins normal operations.

### 3. Normal Telemetry Stream
- **Step:** `Submit Telemetry`
- **Action:** Streams telemetry data for **10 seconds**.
- **Context:** Represents the initial phase of successful flight.

### 4. Contingency Declaration
- **Step:** `Update Operation State`
- **Action:** Transitions the flight operation state to **`CONTINGENT`**.
- **Duration:** **7 seconds**
- The system holds this state for 7 seconds to simulate the duration of the contingent event or the time taken to resolve/acknowledge it.

### 5. End Operation
- **Step:** `Update Operation State`
- **Action:** Transitions the flight operation state to **`ENDED`**.
- **Purpose:** Closes the operation after the contingency is resolved or the flight is terminated.

### 6. Explicit Teardown
- **Step:** `Teardown Flight Declaration`
- **Action:** Explicitly invokes the teardown of the flight declaration to ensure no artifacts remain.
44 changes: 44 additions & 0 deletions docs/scenarios/F3_non_conforming_path.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# F3 Non-Conforming Path

## Overview

**Scenario Name:** `F3_non_conforming_path`
**Description:** This scenario verifies the system's ability to detect and handle **Non-Conforming** flights. It simulates an operation that activates normally but subsequently reports telemetry positions that deviate significantly from its declared flight plan (Operational Intent), expecting the system to automatically transition the operation state to `NONCONFORMING`.

## Execution Flow

The scenario executes the following sequence of steps:

### 1. Setup Flight Declaration
- **Action:** Creates a flight declaration context.
- **Context:** Establishes the valid geometric boundaries (volumes) for the flight.

### 2. Activate Operation
- **Step:** `Update Operation State`
- **Action:** Transitions the flight operation state to **`ACTIVATED`**.

### 3. Initial Wait
- **Step:** `Wait`
- **Duration:** **5 seconds**
- **Context:** Short delay to allow system state to settle before data transmission begins.

### 4. Inject Non-Conforming Telemetry
- **Step:** `Submit Telemetry`
- **Action:** Streams simulated telemetry data for **20 seconds**.
- **Context:** The telemetry path used in this scenario is designed to breach the conformance thresholds of the declared volumes.

### 5. Verify State Transition
- **Step:** `Check Operation State`
- **Action:** Polls the operation status.
- **Expectation:** The state must be **`NONCONFORMING`**.
- **Wait Duration:** **5 seconds**
- Waits up to 5 seconds for the system to process the telemetry and flag the violation.

### 6. End Operation
- **Step:** `Update Operation State`
- **Action:** Transitions the flight operation state to **`ENDED`**.
- **Purpose:** Closes the operation.

### 7. Explicit Teardown
- **Step:** `Teardown Flight Declaration`
- **Action:** Clean up resources.
Loading
Loading