[breaking] Make MinIO bucket creation opt-in with production-safe defaults #36

Merged
brian merged 2 commits from cursor/minio-bucket-creation-opt-in into main 2026-07-09 15:16:56 +02:00
Owner

Summary

  • Add create_bucket_if_missing: bool = False to MinioConfig, wired to MINIO_CREATE_BUCKET_IF_MISSING.
  • Change MinioAdapter.connect() to fail fast when the configured bucket is missing unless auto-creation is explicitly enabled.
  • Extract boolean env parsing into internal env_bool module with dedicated unit tests.
  • Refactor adapter __init__ validation to use guard-clause style in both MinIO and Redis adapters.
  • Update README and .env.example to document production vs local dev settings (MINIO_SECURE, MINIO_CREATE_BUCKET_IF_MISSING).

Breaking change: connect() no longer creates the bucket by default. Existing deployments that relied on implicit bucket creation must either provision the bucket beforehand or set MINIO_CREATE_BUCKET_IF_MISSING=true / create_bucket_if_missing=True.

Test plan

  • pytest tests/unit/env_bool_test.py tests/unit/minio_config_test.py tests/unit/minio_adapter_test.py -v
  • pytest tests/integration/minio_adapter_test.py -v
  • Pre-commit hooks pass on commit
## Summary - Add `create_bucket_if_missing: bool = False` to `MinioConfig`, wired to `MINIO_CREATE_BUCKET_IF_MISSING`. - Change `MinioAdapter.connect()` to fail fast when the configured bucket is missing unless auto-creation is explicitly enabled. - Extract boolean env parsing into internal `env_bool` module with dedicated unit tests. - Refactor adapter `__init__` validation to use guard-clause style in both MinIO and Redis adapters. - Update README and `.env.example` to document production vs local dev settings (`MINIO_SECURE`, `MINIO_CREATE_BUCKET_IF_MISSING`). **Breaking change:** `connect()` no longer creates the bucket by default. Existing deployments that relied on implicit bucket creation must either provision the bucket beforehand or set `MINIO_CREATE_BUCKET_IF_MISSING=true` / `create_bucket_if_missing=True`. ## Test plan - [x] `pytest tests/unit/env_bool_test.py tests/unit/minio_config_test.py tests/unit/minio_adapter_test.py -v` - [x] `pytest tests/integration/minio_adapter_test.py -v` - [x] Pre-commit hooks pass on commit
brian added 1 commit 2026-07-09 14:56:43 +02:00
Make MinIO bucket creation opt-in with production-safe defaults.
PR Title Check / check-title (pull_request) Successful in 6s
Test Python Package / unit-tests (pull_request) Successful in 18s
Code Quality Pipeline / code-quality (pull_request) Successful in 1m28s
Test Python Package / integration-tests (pull_request) Failing after 1m54s
Test Python Package / coverage-report (pull_request) Has been skipped
4a5b3b631f
Require buckets to exist by default on connect, extract env_bool parsing, and document local dev overrides for secure and auto-creation settings.

Co-authored-by: Cursor <[email protected]>
brian added 1 commit 2026-07-09 15:06:36 +02:00
Fix examples integration test by provisioning MinIO bucket in fixture.
Test Python Package / unit-tests (pull_request) Successful in 18s
PR Title Check / check-title (pull_request) Successful in 34s
Test Python Package / integration-tests (pull_request) Successful in 33s
Code Quality Pipeline / code-quality (pull_request) Successful in 49s
Test Python Package / coverage-report (pull_request) Successful in 51s
39baf9badc
Ensure set_example_env depends on raw_minio_client so ArtifactObjectRepository connects against an existing bucket under the new production-safe default.

Co-authored-by: Cursor <[email protected]>
Member

Test Coverage Report:

Name                                                            Stmts   Miss    Cover   Missing
-----------------------------------------------------------------------------------------------
python_repositories/__init__.py                                    12      0  100.00%
python_repositories/adapters/__init__.py                           13      0  100.00%
python_repositories/adapters/connection_aware_adapter.py           45      0  100.00%
python_repositories/adapters/minio_adapter.py                     124      0  100.00%
python_repositories/adapters/redis_adapter.py                     111      0  100.00%
python_repositories/config/__init__.py                              4      0  100.00%
python_repositories/config/dotenv_loader.py                         7      0  100.00%
python_repositories/config/env_bool.py                             14      0  100.00%
python_repositories/config/minio_config.py                         21      0  100.00%
python_repositories/config/redis_config.py                         14      0  100.00%
python_repositories/examples/__init__.py                            0      0  100.00%
python_repositories/examples/artifact_object_repository.py          9      0  100.00%
python_repositories/examples/user_json_repository.py               10      0  100.00%
python_repositories/interfaces/__init__.py                          5      0  100.00%
python_repositories/interfaces/connection_aware_interface.py        8      0  100.00%
python_repositories/interfaces/context_aware_interface.py           8      0  100.00%
python_repositories/interfaces/json_repository_interface.py        14      0  100.00%
python_repositories/interfaces/object_repository_interface.py      11      0  100.00%
-----------------------------------------------------------------------------------------------
TOTAL                                                             430      0  100.00%

**Test Coverage Report:** ``` Name Stmts Miss Cover Missing ----------------------------------------------------------------------------------------------- python_repositories/__init__.py 12 0 100.00% python_repositories/adapters/__init__.py 13 0 100.00% python_repositories/adapters/connection_aware_adapter.py 45 0 100.00% python_repositories/adapters/minio_adapter.py 124 0 100.00% python_repositories/adapters/redis_adapter.py 111 0 100.00% python_repositories/config/__init__.py 4 0 100.00% python_repositories/config/dotenv_loader.py 7 0 100.00% python_repositories/config/env_bool.py 14 0 100.00% python_repositories/config/minio_config.py 21 0 100.00% python_repositories/config/redis_config.py 14 0 100.00% python_repositories/examples/__init__.py 0 0 100.00% python_repositories/examples/artifact_object_repository.py 9 0 100.00% python_repositories/examples/user_json_repository.py 10 0 100.00% python_repositories/interfaces/__init__.py 5 0 100.00% python_repositories/interfaces/connection_aware_interface.py 8 0 100.00% python_repositories/interfaces/context_aware_interface.py 8 0 100.00% python_repositories/interfaces/json_repository_interface.py 14 0 100.00% python_repositories/interfaces/object_repository_interface.py 11 0 100.00% ----------------------------------------------------------------------------------------------- TOTAL 430 0 100.00% ```
brian merged commit 547a1b3a90 into main 2026-07-09 15:16:56 +02:00
brian deleted branch cursor/minio-bucket-creation-opt-in 2026-07-09 15:16:56 +02:00
Sign in to join this conversation.
No Reviewers
No labels
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: lille-vemmelund/python-repositories#36