Files
alro65 deb04c9315 sprint-0: fundaciones VMS-Sailor
Sprint 0 completo del producto VMS-Sailor (Vessel Management System
integrado para buques 30-40m). Brief de referencia en
VMS_Sailor_v2_Parte_*.md (intacto).

Core (vmssailor.core, 95.17% coverage, 99 tests verde):
- ShipCoord: sistema naval x_pp/y_cl/z_bl frozen
- Vessel, Deck, Bulkhead
- Equipment, EquipmentModel, Sensor, EquipmentSpec
- Tag, AlarmConfig, TagBinding, Scaling
- CardInstance, Bus, Topology con validacion 21 puntos I/O AR-NMEA-IO-v1.0
- Alarm, PermissiveRule, Condition
- Project agregado raiz con validacion cross-entity
- Persistencia portable .vmsproj (SQLite) con roundtrip verificable

Biblioteca curada seed (vmssailor.library):
- systems_catalog.json completo (catalogo maestro Parte 1 sec 7)
- 2 vessels: Sunseeker 76, Ferretti 850
- 2 motores: MTU 12V 2000 M96, Volvo D13-900
- 1 genset: Northern Lights M65C13
- yacht_motor_planeo.yaml (reglas heuristicas)
- TODO marcado data_source=seed_estimate - requiere validacion datasheets

Tools:
- vms-validate-library: CLI valida biblioteca completa
- vms-generate-test-project: CLI demo + verificacion roundtrip persistencia

Design System + 8 mockups HTML estaticos:
- docs/design_system.md (paleta Deep Ocean, gradientes, typography, motion)
- docs/brand/ (logo + variantes SVG)
- docs/mockups/splash, studio_main, runtime_overview,
  runtime_mimic_fuel (P&ID animado), runtime_alarms, runtime_trim (panel
  estrella con horizonte artificial), mobile_overview, mobile_trim
- docs/mockups/index.html (galeria)

Firmware (Sprint 12+ implementacion):
- firmware/ar_nmea_io_v1/src/config/pinout.h con macros GPIO

Decisiones autonomas documentadas en docs/decisions_sprint0.md.

Stack: Python 3.11 + uv + Pydantic v2 + SQLite stdlib + hatchling +
pytest 9 + ruff + mypy. Sin PySide6, FastAPI, Flutter ni firmware
funcional (entran en sprints siguientes).

Criterio de aceptacion Sprint 0: cumplido.
- uv sync: OK
- pytest: 99/99 verde
- cov vmssailor.core: 95.17% (objetivo >=80%)
- ruff: clean
- vms-validate-library: OK
- vms-generate-test-project: INTEGRIDAD OK

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-17 07:26:06 -04:00

52 lines
1.4 KiB
Python

"""Tests de generación de IDs."""
from __future__ import annotations
import pytest
from vmssailor.shared.ids import (
make_alarm_config_id,
make_alarm_instance_id,
make_project_id,
make_tag_id,
new_uuid,
)
def test_make_tag_id_basic() -> None:
assert make_tag_id("ME_PORT", "oil_press") == "ME_PORT.OIL_PRESS"
def test_make_tag_id_rejects_lowercase_prefix() -> None:
with pytest.raises(ValueError):
make_tag_id("me_port", "oil_press")
def test_make_tag_id_rejects_uppercase_sensor() -> None:
with pytest.raises(ValueError):
make_tag_id("ME_PORT", "OIL_PRESS")
def test_alarm_config_id() -> None:
cid = make_alarm_config_id("ME_PORT.OIL_PRESS", "low")
assert cid == "ME_PORT.OIL_PRESS.LOW"
def test_alarm_instance_id_deterministic() -> None:
a = make_alarm_instance_id("ME_PORT.OIL_PRESS", "ME_PORT.OIL_PRESS.LOW", 1234567890.0)
assert a.startswith("alm.ME_PORT.OIL_PRESS.LOW.")
def test_new_uuid_unique() -> None:
a = new_uuid()
b = new_uuid()
assert a != b
assert len(a) == 36 # UUID canonical
def test_project_id_normalization() -> None:
pid = make_project_id("Acme Yachts S.A.", "Sunseeker_76")
# Espacios y puntuación se normalizan
assert pid == "acme_yachts_s_a___sunseeker_76" or pid.startswith("acme_yachts_s_a")
assert "__" in pid # separador customer__vessel