libredb / libredb/libredb-studio
SQLite and LibreDB providers report databaseSizeBytes as 0 when the size is unknown
- Dominant language
- TypeScript
- Stars
- 726
- Forks
- 119
- Avg merge
- 7h 47m
- Merged PRs (30d)
- 265
Description
`DatabaseOverview.databaseSizeBytes` is optional on purpose: absence and zero are different facts (see the docblock in `src/lib/db/types.ts`). The two embedded providers get this wrong by coercing an unreadable size into a literal `0`: the size initializer in `src/lib/db/providers/sql/sqlite.ts`, and `fileSizeBytes()` in `src/lib/db/providers/embedded/libredb.ts`, which returns 0 when `statSync` throws. `StorageTab.tsx` keys its whole breakdown UI off `databaseSizeBytes !== undefined`, so a fabricated 0 does not hide a number, it renders a breakdown over a zero-byte database.
**Scope.** This issue covers only the two embedded engines, SQLite and LibreDB, which need no database server to test. The other providers in the backlog entry are out of scope here.
**Fix.** Make `databaseSizeBytes` absent when the size genuinely cannot be read, keep a real 0 reading as 0, update `docs/providers/sqlite.md` and `docs/providers/libredb.md`, and add a test per provider pinning both arms (the sibling `activeConnections` fix is the pattern to mirror).
**Done when** both providers, their docs and their tests move together in the same PR, per the provider triad rule.
Context: `docs/BACKLOG.md`, entry D44.
---
Curated for Hacktoberfest 2026. Comment to claim it before you start so two people do not work on the same issue. A PR must reference this issue and land with its tests in the same change; see CONTRIBUTING.md. Repo rules that apply: write the failing test first, run `bun run test` (never bare `bun test`), and the 100% line-coverage gate must stay green.
Contributor guide
Assessment
This issue has not been assessed yet.