Conversation
There was a problem hiding this comment.
馃挕 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ebf1b1ec6d
鈩癸笍 About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 馃憤.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ? sql<number>`COALESCE(( | ||
| SELECT ${resourceStorageAccounts.usedBytes} | ||
| FROM ${resourceStorageAccounts} | ||
| WHERE ${resourceStorageAccounts.userId} = ${users.id} | ||
| ), 0)::bigint` |
There was a problem hiding this comment.
Keep unreconciled storage usage unknown
When billing is enabled while the initial storage reconciliation is pending or failed, this query converts a missing account to zero and exposes nonzero accounts even if reconciledAt is null. In contrast, reportedOfficialUsedBytes in resources/service.ts returns null until the account or global reconciliation is complete. Consequently, the admin dashboard can filter out legacy users as having no usage or rank them using a partial ledger, so it still disagrees with the user resource screen during rollout; preserve the unreconciled state instead of silently coercing it to a usable total.
AGENTS.md reference: AGENTS.md:L48-L50
Useful? React with 馃憤聽/ 馃憥.
Summary
Root cause
The user resource screen read
resource_storage_accounts.used_bytes, while the admin dashboard still summed client-declared attachment sizes. This produced different totals for the same user.Validation
bun run buildbunx eslint utils/dbMethods/admin.tsgit diff --check