quality: web debt batch (tests runner, FireContainer, rate-limit, maps, i18n)

Independent-of-prod quality debt from PENDIENTE.md §2:

- test: migrate broken Jest -> meteortesting:mocha. Tests rewritten to chai +
  Meteor 3 async APIs, moved to test/server/ (server-only). test/server/
  00-setup.test.js re-runs the collection2/accounts init that `meteor test`
  skips (no server/main.js). New comments method + mediaAnalyzers coverage.
  Dropped rest.test.js (removed meteor/http; covered by smoke/). 36 passing.
- fix: scope FireContainer read by the URL _id on the archive route instead of
  a selector-less FiresCollection.findOne() (imports/ui/pages/Fires/Fires.js).
- feat: rate-limit abusable publications via rateLimitSubscriptions (fireFrom*
  and comments.forReference 5/1000ms; geo subs 10/1000ms).
- perf: append loading=async to the Google Maps loader URL (Gkeys.js).
- deps: meteor-accounts-t9n 2.0 -> 2.6 (no gl build -> keep gl->es fallback,
  documented); add 3 missing gl/common.json keys (0 missing now).
- deps: drop jest/babel/enzyme, add chai.
This commit is contained in:
vjrj 2026-07-21 22:59:06 +02:00
parent bc778bfd97
commit 6b6f02d92d
27 changed files with 602 additions and 7042 deletions

View file

@ -37,24 +37,34 @@ React 19: el `<Blaze serverFacts>` de Status.js (`findDOMNode`), solo en `/statu
## 2. Deuda funcional / de calidad de la web (independiente de prod)
- **Comentarios (feature React nueva): verificación manual en staging.** No la
cubre el smoke. Probar en una página de fuego: publicar/editar/borrar,
like/dislike, embed de imagen y YouTube, y el email a otros comentaristas.
- **`FireContainer` usa `FiresCollection.findOne()` sin selector**
(`imports/ui/pages/Fires/Fires.js`): puede devolver un doc de una suscripción
previa. Endurecer filtrando por el `_id` de la URL. (Preexistente, no bloquea,
pero conviene antes de prod.)
- **Suite de tests sin runner.** El stack de test (meteortesting:mocha, chai…)
se eliminó en la migración 2.x (arrastraba coffeescript que crasheaba el build).
Quedan tests Jest en `test/` (`rest.test.js`, `email.test.js`, …) y
`npm test → jest`, pero hay que **verificar/actualizar** que pasan sobre el
código async de Meteor 3. Hoy la ÚNICA red automática es `smoke/`.
- **Rate-limit de publications** pendiente (`imports/startup/server/api.js:18`).
- **Google Maps** se carga sin `loading=async` (aviso de rendimiento); el loader
`google-maps` npm es viejo → valorar el loader async moderno.
- **i18n de cuentas (`meteor-accounts-t9n`, T9n):** paquete antiguo aún usado
(Login, VerifyEmail, i18n). Verificar que funciona en Meteor 3; traducción
gallega (gl) incompleta (varios TODO en `i18n.js`).
- **Comentarios (feature React nueva): verificación manual en staging.** El smoke
no llega a la UI. Los **métodos** (insert/edit/remove/like/dislike) y el embed
(`mediaAnalyzers`) ya están cubiertos por mocha (`test/server/comments.test.js`),
pero quedan por probar a mano en una página de fuego:
- publicar / editar / borrar un comentario (UI React)
- like / dislike (toggle)
- render del embed de imagen y de YouTube
- email a otros comentaristas (`onCommentAdd.js`, entrega real de correo)
- ✅ **`FireContainer` endurecido** (`imports/ui/pages/Fires/Fires.js`): el
`findOne()` sin selector ahora se acota por el `_id` de la URL en la ruta
`archive` (`new Meteor.Collection.ObjectID(id)`); en active/alert/hash cada
publicación deja un único fire en minimongo, así que el read vacío es correcto.
- ✅ **Suite de tests con runner (`meteortesting:mocha`).** `npm test` corre
`meteor test … --driver-package meteortesting:mocha` (watch: `npm run test-watch`).
Tests reescritos a `chai` + APIs async de Meteor 3 en `test/server/*.test.js`
(server-only), incluyendo cobertura nueva de los métodos de comentarios. Jest y
`rest.test.js` (ya cubierto por `smoke/`) eliminados. **36 passing.** Pendiente
menor: portar los casos de token inválido (401/400) de `rest.test.js` al smoke.
- ✅ **Rate-limit de publications** (`imports/startup/server/api.js`): reglas
`type: 'subscription'` vía `rateLimitSubscriptions` — 5/1000ms en `fireFrom*` y
`comments.forReference`; 10/1000ms en las subs geo (map pan/zoom).
- ✅ **Google Maps con `loading=async`** (`imports/startup/client/Gkeys.js`):
se envuelve `GoogleMapsLoader.createUrl` para añadir el parámetro (el paquete
`google-maps` npm no expone hook). *Verificar en staging que el mapa carga y el
aviso de consola desaparece.*
- ✅ **`meteor-accounts-t9n` actualizado** a `^2.6.0` (es/en OK). El paquete sigue
sin build gallego (`gl`), así que se mantiene el fallback gl→es documentado en
`i18n.js`. Traducción gallega de la app (`gl/common.json`): 0 claves faltantes.
- **Salto Bootstrap 4→5 (CSS/JS) pendiente:** react-bootstrap ya está en v2 y
corre sobre el CSS Bootstrap 4 actual (`alexwine:bootstrap-4`) con un único
shim `.form-label` en `forms.scss`. El salto a Bootstrap 5 npm está diferido