meteor3: port all 18 migration up() bodies to async

percolate:migrations 2.0.1 awaits async up(), so historical migrations
now run on Meteor 3: fetchAsync + for..of instead of cursor forEach,
insert/update/remove -> *Async, _ensureIndex -> createIndexAsync,
Accounts.createUser -> createUserAsync, awaited rawCollection indexes.

Verified: empty Mongo 7 DB migrates 0->18 cleanly (indexes + industry
registries created, control unlocked at v18); pre-marking version=18 is
no longer needed (UPGRADE.md updated). REST smoke stays byte-identical.
This commit is contained in:
vjrj 2026-07-14 11:36:30 +02:00
parent 1892c0ead0
commit 1f1f5c697d
2 changed files with 90 additions and 84 deletions

View file

@ -199,8 +199,8 @@ work lives on `meteor3-wip` until (a) production Mongo is migrated to 7 and
```bash
docker run -d --name tcef-mongo7 -p 27019:27019 mongo:7 --replSet rs0 --port 27019 --bind_ip_all
docker exec tcef-mongo7 mongosh --port 27019 --quiet --eval 'rs.initiate({_id:"rs0",members:[{_id:0,host:"localhost:27019"}]})'
# mark migrations current so historical (still-sync) up() bodies don't run:
docker exec tcef-mongo7 mongosh --port 27019 fuegos --quiet --eval 'db.migrations.replaceOne({_id:"control"},{_id:"control",version:18,locked:false},{upsert:true})'
# (migrations run from scratch on an empty DB — all up() bodies are async now,
# no need to pre-mark db.migrations at version 18)
export MONGO_URL="mongodb://localhost:27019/fuegos?replicaSet=rs0"
export NODE_OPTIONS="--dns-result-order=ipv4first --no-network-family-autoselection" # reach warehouse.meteor.com on Node 22
meteor --settings settings-development.json --port 3100
@ -272,8 +272,11 @@ MONGO_CONTAINER=tcef-mongo7 MONGO_SHELL=mongosh MONGO_PORT=27019 ./smoke/smoke.s
- Map/server publications not exercised by the REST smoke converted to
async: `activefiresmyloc`, `activefiresunionmyloc`, `fireAlerts`
(countAsync/fetchAsync/awaited firesUnion), and `oauth.verifyConfiguration`
(findOneAsync). `migrations.js` bodies stay sync **by design** (control is
pinned at v18; prod data arrives pre-migrated) — tracked as debt.
(findOneAsync). `migrations.js`: all 18 historical `up()` bodies ported to
async (`fetchAsync`+`for..of`, `*Async` writes, `createIndexAsync`,
`Accounts.createUserAsync`; percolate:migrations 2.0.1 awaits async `up()`).
Verified: empty Mongo 7 DB migrates 0→18 with no errors (indexes +
industry registries created); pre-marking `version=18` is no longer needed.
Verified in a real browser: `/` and `/fires` render (map, search, layers,
cookie banner), zero uncaught exceptions; REST smoke byte-identical.
- ✅ **React 16 → 18.3**`react`/`react-dom` bumped to `^18.3.1`