fix: allow API to run against a read-only /ref mount#30
Merged
lewisjared merged 5 commits intomainfrom Apr 13, 2026
Merged
Conversation
- Add REF_READ_ONLY_DATABASE setting that opens SQLite via file: URI with mode=ro&immutable=1, avoiding WAL/journal writes. - Bump climate-ref to >=0.13.0,<0.14 so bundled alembic scripts match the migrations applied by the climate-ref-aft chart. - Replace the hand-rolled revision check with a status check modelled on `ref db status`; tolerate DBs stamped by a newer CLI instead of raising. - Harden the Dockerfile: install climate-ref(-core) via a non-editable uv sync and fail the build early if climate_ref_core/pycmec/cv_cmip7_aft.yaml is missing from the installed wheel.
✅ Deploy Preview for climate-ref canceled.
|
- climate-ref >=0.13.1,<0.14: use upstream Database.from_config(read_only=True) and Database.migration_status helpers; drop ref-app's _build_readonly_database and _check_migration_status shims. Packaging test in climate-ref-core 0.13.1 also lets us drop the Dockerfile pycmec-yaml build guard. - vite >=7.3.2 <8: security fix; vite 8's manualChunks type-break blocks bumping further without a config rewrite. - pydantic-settings >=2.13.1. - Drop tenacity (unused) and python-multipart (transitive via fastapi[standard]).
lewisjared
added a commit
to Climate-REF/climate-ref-aft
that referenced
this pull request
Apr 13, 2026
ref-app v0.3.1 (Climate-REF/ref-app#30) ships cv_cmip7_aft.yaml and read-only DB support, and bumps its bundled climate-ref to v0.13.1. Track the new appVersion and update default image tags.
lewisjared
added a commit
to Climate-REF/climate-ref-aft
that referenced
this pull request
Apr 13, 2026
ref-app v0.3.1 (Climate-REF/ref-app#30) ships cv_cmip7_aft.yaml and read-only DB support, and bumps its bundled climate-ref to v0.13.1. Track the new appVersion and update default image tags.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Resolves #29. Lets
climate-ref-frontendrun against a read-only/refPVC without init-container workarounds.REF_READ_ONLY_DATABASEsetting opens the configured SQLite DB viasqlite:///file:<path>?mode=ro&immutable=1&uri=true, so SQLite does not attempt to create a WAL/journal sidecar. Plumbed throughmain.pyandapi/deps.py.>=0.13.0,<0.14so the API's bundled alembic scripts match the revision the chart's migrate Job writes.uv.lockregenerated.ref db status: replaced the hand-rolled probe inget_databasewith a head-vs-current comparison usingalembic.script.ScriptDirectory(the same pattern the CLI uses inclimate_ref.cli.db). When the DB is stamped with a revision this image doesn't know, we log a warning and continue rather than raising — migration ownership stays with the CLI/Job.uv syncto--no-editable, and added a build-time assertion thatclimate_ref_core/pycmec/cv_cmip7_aft.yamlis present in the installed wheel so missing package data fails the build instead of the pod at startup.Test plan
uv run pytest src tests— 185 passed, 1 xfaileduv run ruff check src tests && uv run ruff format --check src testsuv run mypy srctests/test_core/test_ref.py:test_get_database_read_only_rejects_writes— asserts writes on aread_only=TrueDB raiseOperationalErrortest_get_database_tolerates_unknown_revision— DB stamped with an unknown alembic revision doesn't raisedocker build -t ref-app:test .;docker run -v $PWD/backend/tests/test-data/.../db:/ref:ro -e REF_CONFIGURATION=/ref -e REF_READ_ONLY_DATABASE=true ref-app:test;curl /api/v1/executionsreadOnly: trueon the/refmount (tracked in chore: align REF configuration and migrate to SemVer climate-ref-aft#7)