feat(h4-3): modo simulación con flota ficticia (RF-12)#27
Merged
Conversation
Nuevo `application/simulacion.py` con: - `ReporteSimulacion` (dataclass frozen+slots): incidentes_procesados, tupla de ResultadoDespacho, pct por motivo, ETA media y p95. - `simular(incidentes, flota_ficticia, grafo, *, repositorio_eventos, factor_hora, factor_sirena) → ReporteSimulacion`. Semántica v1: sin evolución temporal entre incidentes (cada uno ve la flota inicial). Determinístico — sólo depende de los inputs. Para event-driven simulation con liberación por eta_segundos haría falta ADR nuevo y reloj virtual. Persistencia opt-in: por default NO escribe al log canónico (modo simulación ≠ operativo). Si el caller provee `repositorio_eventos`, los eventos persisten con `despacho_id` prefijado `SD-SIM-` para distinguir despachos simulados de operativos. Nuevo subcomando CLI `sentinel simular --flota --incidentes --graph --out [--persistir-en]`. El reporte JSON incluye `"modo": "simulacion"` como marca explícita. Tests: 7 nuevos verdes (Normal/Borde/RN/Métricas). Suite total 256/256, cov 90.60 %.
Trazabilidad: RF-12 ✅ apuntando a `application/simulacion.py` + `interfaces/cli/simular_cmd.py`. Documenta la semántica v1 (sin evolución temporal) y la persistencia opt-in vía `--persistir-en`. CHANGELOG: entrada "H4 fase 3: modo simulación" bajo [Unreleased] con resumen del módulo, decisiones de diseño y métricas del test suite.
Jacket-69
added a commit
that referenced
this pull request
May 29, 2026
feat(h4-3): modo simulación con flota ficticia (RF-12)
Jacket-69
added a commit
that referenced
this pull request
May 29, 2026
feat(h4-3): modo simulación con flota ficticia (RF-12)
Jacket-69
added a commit
that referenced
this pull request
May 29, 2026
feat(h4-3): modo simulación con flota ficticia (RF-12)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resumen
Tercera fase de H4: modo simulación que ejecuta el cálculo de despacho sobre flota ficticia sin afectar el estado operativo real. Cierra RF-12.
Cambios
application/simulacion.py:ReporteSimulaciondataclass frozen+slots con métricas agregadas (pct por motivo, ETA media, ETA p95).simular(incidentes, flota_ficticia, grafo, *, repositorio_eventos=None, factor_hora=1.0, factor_sirena=1.0) → ReporteSimulacion.repositorio_eventos, los eventos van condespacho_idprefijadoSD-SIM-.CLI
interfaces/cli/simular_cmd.py:sentinel simular --flota --incidentes --graph --out [--persistir-en].\"modo\": \"simulacion\"como marca explícita.Decisiones intencionales
eta_segundos) haría falta reloj virtual + ADR nuevo. Documentado en el docstring del módulo.--persistir-en data/eventos_sim.jsonl(archivo separado).SD-SIM-prefix: eldespacho_idde eventos simulados es distinguible visualmente de los operativos (SD-), facilitando filtros downstream.Validación local
ruff check+ruff format --check: ✓ (71 archivos).mypy src/sentinel_dispatch: ✓ (38 archivos).pytest tests/unit tests/integration --no-cov: 256 passed in 3.61s (249 baseline + 7 nuevos).DoD
comparedebe seguir 12/12 OK bit-exacto (no se toca RT-02).Commits
cc41075feat(h4-3): modo simulación con flota ficticia (RF-12)8b783a0docs(quality): RF-12 ✅ + entrada H4-3 en CHANGELOGEstado H4
Con este PR, los 3 RFs sustanciales de H4 quedan ✅ (RF-06, RF-11, RF-12). Siguen: H4 fase 4 = spike CP-12 + ADR-0019; fase 5 = calibración CP-01c (ADR-0013 → accepted); fase 6 = FTR-03 formal de cierre.