Skip to content

refactor+test: committed-only per-project storage + real-DB coverage & CI Postgres#100

Merged
ravirajsinh45 merged 3 commits into
mainfrom
chore/storage-usage-tests-and-alignment
Jul 7, 2026
Merged

refactor+test: committed-only per-project storage + real-DB coverage & CI Postgres#100
ravirajsinh45 merged 3 commits into
mainfrom
chore/storage-usage-tests-and-alignment

Conversation

@ravirajsinh45

Copy link
Copy Markdown
Contributor

Summary

Stacked on #99. Two related storage-consistency improvements.

Committed-only per-project storage

routers/projects.py per-project storage_bytes (batch + detail) now excludes uploading/failed
and soft-deleted versions, matching services.storage.instance_storage_used_bytes. Extracts a shared
_committed_media_sum helper and adds project_storage_used_bytes(db, project_id), so per-project and
instance-wide figures use one definition. (The displayed per-project storage number may drop slightly —
it no longer counts in-progress/failed/deleted media.)

Real-DB coverage + CI Postgres

The mock test harness can't execute the usage SUM/join/filter. Adds a real_db transaction-rollback
fixture and an integration test asserting committed-only totals (ready/processing counted;
uploading/failed/deleted excluded), and wires a postgres:15 service + alembic upgrade head into the
backend-test CI job so the integration test actually runs in CI.

Testing

  • Full backend suite: 88 passed (this branch).
  • Real-DB integration test verified against Postgres.

Stacked on fix/media-filesize-bigint (#99); retarget to main as the stack merges bottom-up.

@ravirajsinh45
ravirajsinh45 force-pushed the fix/media-filesize-bigint branch from 7a3dd00 to c90ba4c Compare July 7, 2026 04:28
@ravirajsinh45
ravirajsinh45 force-pushed the chore/storage-usage-tests-and-alignment branch from 9fac2a6 to ee28017 Compare July 7, 2026 04:28
@ravirajsinh45
ravirajsinh45 force-pushed the fix/media-filesize-bigint branch from c90ba4c to 97e9a38 Compare July 7, 2026 05:26
@ravirajsinh45
ravirajsinh45 force-pushed the chore/storage-usage-tests-and-alignment branch from ee28017 to f5e87a5 Compare July 7, 2026 05:26
@ravirajsinh45
ravirajsinh45 force-pushed the fix/media-filesize-bigint branch from 97e9a38 to b0e99df Compare July 7, 2026 05:39
@ravirajsinh45
ravirajsinh45 changed the base branch from fix/media-filesize-bigint to main July 7, 2026 05:46
routers/projects.py per-project storage_bytes (batch + detail) now excludes
uploading/failed and soft-deleted versions, matching
services.storage.instance_storage_used_bytes so per-project and instance-wide
storage figures share the same semantics.
… + CI Postgres

- Extract shared _committed_media_sum; instance_storage_used_bytes and new
  project_storage_used_bytes derive from it (one committed-only definition).
- routers/projects.py detail sum now calls project_storage_used_bytes.
- Real-DB integration test (transaction-rollback fixture): ready/processing counted,
  uploading/failed/deleted excluded; a 9GB insert cross-validates the BigInteger column.
- CI: add postgres:15 service + 'alembic upgrade head' step so the integration test
  runs in CI (the fully-mocked harness cannot execute the query).
@ravirajsinh45
ravirajsinh45 force-pushed the chore/storage-usage-tests-and-alignment branch from f5e87a5 to 43e578c Compare July 7, 2026 05:46
@ravirajsinh45
ravirajsinh45 merged commit 5ebf8fc into main Jul 7, 2026
4 checks passed
@ravirajsinh45
ravirajsinh45 deleted the chore/storage-usage-tests-and-alignment branch July 7, 2026 05:50
Everillangel pushed a commit to Everillangel/freeframe that referenced this pull request Jul 14, 2026
…& CI Postgres (Techiebutler#100)

* refactor: align projects.py per-project storage sum to committed-only

routers/projects.py per-project storage_bytes (batch + detail) now excludes
uploading/failed and soft-deleted versions, matching
services.storage.instance_storage_used_bytes so per-project and instance-wide
storage figures share the same semantics.

* test: real-Postgres integration test for committed-only storage usage + CI Postgres

- Extract shared _committed_media_sum; instance_storage_used_bytes and new
  project_storage_used_bytes derive from it (one committed-only definition).
- routers/projects.py detail sum now calls project_storage_used_bytes.
- Real-DB integration test (transaction-rollback fixture): ready/processing counted,
  uploading/failed/deleted excluded; a 9GB insert cross-validates the BigInteger column.
- CI: add postgres:15 service + 'alembic upgrade head' step so the integration test
  runs in CI (the fully-mocked harness cannot execute the query).

* docs(changelog): committed-only per-project storage under [Unreleased] (Techiebutler#100)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant