Commit Graph

380 Commits

Author SHA1 Message Date
henryor
c9e5d6f472 fix(console): hidrata ProtectedRoute antes de redirigir al login
ProtectedRoute mostraba 'Restaurando sesión...' siempre en el primer render,
incluso cuando el usuario nunca tuvo sesión, porque el state inicial siempre
arrancaba sin token. La heurística ahora consulta hasHydrated() de Zustand y
usa el user persistido (que sí sobrevive al reload) para decidir si vale la
pena intentar refresh: si nunca hubo user, redirige directo al login sin
flash.

Tests cubren el cold visit (sin user, no se llama a refresh) y el warm visit
(con user persistido, muestra el restoring y resuelve).
2026-05-07 21:14:30 -05:00
henryor
0e876f9ce8 refactor(console): separa apiClient y apiClientVoid para respuestas 204
apiClient devolvía null casteado a T en respuestas 204, lo que silenciaba un
error de tipos en tiempo de compilación. La auditoría confirmó que ningún
caller actual pega a un endpoint 204, por lo que el cast era código muerto.

Se separa en dos funciones:
- apiClient<T>: devuelve T y lanza si el server responde 204 sin body.
- apiClientVoid: devuelve void en 204, para endpoints que no retornan body.

Tests cubren la deduplicación del refresh ante 401 concurrentes, el path
200-con-body, el throw en 204 y el path void de apiClientVoid.
2026-05-07 21:14:23 -05:00
henryor
c14f513cc1 fix(console): unifica accessToken y alinea LoginResponse con el backend
El store de auth duplicaba el token en dos campos (token y accessToken) que
quedaban siempre iguales pero con consumers divididos. Se elimina token: el
accessToken queda como única fuente de verdad.

LoginResponse refleja el contrato real del backend (services/backend-api auth
handler emite access_token primario y token como legacy compat). LoginPage lee
response.access_token directo, sin fallback. refresh_token sale del body porque
viaja en cookie HttpOnly, no en el JSON.

Tests pinean el contrato: setSession y logout no escriben token, y los campos
de LoginResponse mantienen los tipos esperados.
2026-05-07 21:14:15 -05:00
henryor
9444836a49 chore(console): integra vitest y testing library
Configura el runner de tests inline en vite.config.ts replicando el setup de
frontend-admin (jsdom, setupFiles, restoreMocks, clearMocks). Agrega el archivo
src/test/setup.ts con el mock de storage y la flag IS_REACT_ACT_ENVIRONMENT.

Esto habilita escribir tests RED-GREEN para los cambios de auth, api-client,
ProtectedRoute y access-requests que vienen en los siguientes commits.
2026-05-07 21:14:05 -05:00
henryor
f348b4d3cd fix(deploy): fija version de pnpm en frontends 2026-05-07 20:49:27 -05:00
henryor
ea94722133 fix(db): corrige historial de migraciones 2026-05-07 10:27:37 -05:00
henryor
346c2833bf fix(landing): optimiza memoria y marca visual 2026-05-07 10:15:26 -05:00
henryor
757cd73931 fix(landing): simplify hero actions 2026-05-07 09:18:17 -05:00
henryor
55e0b55256 feat(landing): move access requests to landing 2026-05-06 21:33:17 -05:00
henryor
4aa27f0117 feat(platform): add provider control plane 2026-05-06 21:31:30 -05:00
henryor
afc4a7397c feat(admin): add B2B access request flow 2026-05-04 19:48:47 -05:00
Wilman Yesid Farfan Diaz
729a98a115 feat: implement edge project CRUD handlers and update S3 installers bucket configuration 2026-05-03 17:47:03 -05:00
Wilman Yesid Farfan Diaz
1b29607313 feat: implement OTA update service with authenticated backend proxy for agent binaries 2026-05-03 17:35:49 -05:00
Wilman Yesid Farfan Diaz
94fce47882 feat: implement full-stack platform architecture including backend services, edge agents, frontend dashboard, and monitoring infrastructure 2026-05-03 16:04:51 -05:00
Wilman Yesid Farfan Diaz
58db4c76a7 feat(api): Phase 6 — OpenAPI docs, version header, enhanced health endpoint
- Add static OpenAPI 3.0.3 spec (services/backend-api/static/openapi.yaml)
  covering all ~70 endpoints with schemas, security, tags and responses
- Serve Swagger UI at GET /docs (embedded HTML, dark OmniOil theme)
- Serve raw YAML at GET /docs/openapi.yaml (include_str! at compile time)
- Add Tower middleware (api_version.rs) injecting X-API-Version: 1 and
  X-Powered-By: OmniOil/1.0 on every response
- Replace static /health handler with enhanced health_check that probes
  DB latency, tracks uptime via OnceLock, returns structured HealthResponse
- Expand API Explorer frontend: 70+ endpoints in 10 groups, PATCH color
  coding (purple), group filter pills, count badge, Swagger UI links

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-03 15:14:50 -05:00
Wilman Yesid Farfan Diaz
3d724b66d2 feat: add multi-stage Dockerfile to cross-compile and build edge-agent MSI installer 2026-05-03 11:48:14 -05:00
Wilman Yesid Farfan Diaz
9b3c5a1b0f feat: implement individual service Dockerfiles and update unified build configuration 2026-05-03 11:47:19 -05:00
Wilman Yesid Farfan Diaz
19de03c4e8 feat: implement edge agent, build orchestrator, and backend telemetry services with multi-region MQTT support 2026-05-03 10:51:38 -05:00
Wilman Yesid Farfan Diaz
13c6b3c90b feat: implement edge-agent service with MQTT listener for deployment signals and Windows service management 2026-05-02 22:36:56 -05:00
Wilman Yesid Farfan Diaz
196b706895 feat: implement provisioning infrastructure with P256-based ECIES encryption and binary overlay support 2026-05-02 21:43:49 -05:00
Wilman Yesid Farfan Diaz
7caccf7e21 feat: introduce EdgeDevice model and update database schema to support additional industrial protocols including S7 2026-05-02 20:18:20 -05:00
Wilman Yesid Farfan Diaz
5067b5730f feat: implement native Edge Agent service with MQTT, SQLite storage, and remote configuration management 2026-05-02 20:03:30 -05:00
Wilman Yesid Farfan Diaz
821d93b840 feat(edge-agent): limpieza automática de logs y cola SQLite
- log_cleaner.rs: elimina archivos edge-agent.log.YYYY-MM-DD con
  más de 30 días al arrancar y cada 24h (evita llenado de disco 24/7)
- persistence_manager: cleanup_old_queue_entries() borra telemetría
  no enviada con más de 7 días (protege ante outages prolongados)
- main.rs + service_manager.rs: spawns de ambas tareas de limpieza

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-02 13:11:51 -05:00
Wilman Yesid Farfan Diaz
2f5f9af3c8 security: HIGH-5/6/8, MED-1/5 — rate limiting, HSTS, HttpOnly cookies, Argon2id
HIGH-5: Rate limiting por IP con governor (Docker-compatible via X-Real-IP)
  - Login/refresh: 10 req/min; Register: 5 req/min
  - services/backend-api/src/rate_limiter.rs (nuevo módulo)

HIGH-6: HSTS + X-Forwarded-Proto en Nginx; TLS terminado por Dokploy
  - infrastructure/nginx/gateway.conf

HIGH-8: Refresh token movido a cookie HttpOnly; access token solo en memoria
  - Backend: login emite cookie, refresh rota cookie, logout la borra
  - Frontend: Zustand v3 sin tokens en localStorage; credentials: include

MED-1: Eliminado PBKDF2 legacy; Argon2id m=65536 t=3 p=1 en todos los hashes
  - services/shared-lib/src/overlay.rs (imports limpiados)
  - services/backend-api/src/handlers/auth.rs (hash_password helper)

MED-5: Rotación atómica de refresh tokens con detección de replay

SECURITY_AUDIT_REPORT.md: riesgo reducido a 🟡 MEDIO

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-02 12:42:58 -05:00
Wilman Yesid Farfan Diaz
2f2b8f3538 feat: implement edge agent service core, industrial simulators, and build orchestration tools 2026-05-02 09:02:23 -05:00
Wilman Yesid Farfan Diaz
3bdd7b7594 feat: implement edge agent, build orchestrator, ANH reporting service, and Node-RED E2E test infrastructure 2026-05-01 19:09:20 -05:00
Wilman Yesid Farfan Diaz
58448b5496 feat: implement base microservice architecture with relay, generator, and edge-agent services 2026-04-29 22:11:23 -05:00
dc0d9b99a8 feat(frontend-pwa): mejora flujo de sincronizacion y UX de campo 2026-04-29 20:52:05 -05:00
Wilman Yesid Farfan Diaz
ccb25a91a3 feat: add project-wide Docker support including build orchestrator and frontend service containers 2026-04-27 22:25:50 -05:00
Wilman Yesid Farfan Diaz
83c3713bea feat: implement telemetry ingestor service and build-orchestrator image registry push functionality 2026-04-27 21:24:39 -05:00
Wilman Yesid Farfan Diaz
67840dac0e feat: implement periodic container health checker with auto-restart and rollback capabilities 2026-04-25 23:55:30 -05:00
Wilman Yesid Farfan Diaz
3d6bcf66b2 feat: add DashboardPage and ProjectDetailsPage to frontend-admin feature modules 2026-04-25 23:36:45 -05:00
Wilman Yesid Farfan Diaz
c1b5d8a72e feat: implement real-time dashboard page with WebSocket telemetry integration and historical data visualization 2026-04-25 22:54:25 -05:00
Wilman Yesid Farfan Diaz
1adeb7448e feat: implement frontend PWA and Admin services with Vite, Docker configurations, and routing logic. 2026-04-25 22:42:17 -05:00
Wilman Yesid Farfan Diaz
42e7f20d2d feat: bootstrap initial project architecture, shared libraries, and core service modules for edge, backend, and frontend applications. 2026-04-25 21:52:46 -05:00
Wilman Yesid Farfan Diaz
c7648ff0e6 feat: add Dockerfile for frontend-admin and configure VITE_ADMIN_APP_ORIGIN in docker-compose 2026-04-25 21:15:55 -05:00
Wilman Yesid Farfan Diaz
d22b4191ae feat: implement dashboard page with real-time monitoring and operational stats overview 2026-04-25 20:51:13 -05:00
Wilman Yesid Farfan Diaz
8131bb3093 feat: add dashboard and project details pages with domain-based routing configuration 2026-04-25 20:47:35 -05:00
Wilman Yesid Farfan Diaz
86df19afe9 feat: implement admin dashboard and project details pages for monitoring and asset management 2026-04-25 20:43:59 -05:00
Wilman Yesid Farfan Diaz
b18e0af4c3 feat: implement cross-domain routing logic and initial admin dashboard page architecture 2026-04-25 20:40:22 -05:00
Wilman Yesid Farfan Diaz
546b82e560 feat: initialize core services, MQTT infrastructure, and backend API with telemetry processing and watchdog monitoring 2026-04-25 19:18:07 -05:00
Wilman Yesid Farfan Diaz
e227eccb57 Reconstrucci[on validada. 2026-04-25 16:39:18 -05:00
Wilman Yesid Farfan Diaz
76113ab9d2 Cargar valores por defecto.
Actualización de nuevas variables de entorno y comunicación.
2026-04-25 13:42:47 -05:00
Wilman Yesid Farfan Diaz
4ab80e24bc feat: implement backend API service with MQTT telemetry handling and edge system management routes 2026-04-24 13:51:57 -05:00
Wilman Yesid Farfan Diaz
42ffe50202 feat: implement dynamic MQTT configuration and automated edge-agent binary injection in build orchestrator 2026-04-24 13:42:56 -05:00
Wilman Yesid Farfan Diaz
fa33e268a3 feat: initialize core microservices architecture including telemetry, backend API, build orchestrator, edge-agent, and admin dashboard. 2026-04-24 00:34:16 -05:00
Wilman Yesid Farfan Diaz
e83accea80 feat: implement JWT-based authentication service and initialize core infrastructure across backend, edge-agent, and dashboard services 2026-04-23 18:15:25 -05:00
Wilman Yesid Farfan Diaz
2f229b6cfb Actualizaciones locales. 2026-04-20 21:49:37 -05:00
Wilman Yesid Farfan Diaz
790b1213c3 Actualizaci[on de agente con la configuraci[on para despliegue. 2026-04-20 20:47:32 -05:00
Wilman Yesid Farfan Diaz
4daba89ba3 Cambio de usuarios, inscripci[on activada. 2026-04-20 17:52:55 -05:00