Skip to content

fix(env): allowlist JVSPATIAL_POSTGRES_* keys#22

Closed
eldonm wants to merge 1 commit into
devfrom
fix/postgres-env-allowlist
Closed

fix(env): allowlist JVSPATIAL_POSTGRES_* keys#22
eldonm wants to merge 1 commit into
devfrom
fix/postgres-env-allowlist

Conversation

@eldonm

@eldonm eldonm commented May 26, 2026

Copy link
Copy Markdown
Member

Summary

  • The Postgres backend in jvspatial/db/factory.py and jvspatial/db/postgres.py reads JVSPATIAL_POSTGRES_DSN, JVSPATIAL_POSTGRES_MIN_POOL_SIZE, JVSPATIAL_POSTGRES_MAX_POOL_SIZE, and JVSPATIAL_POSTGRES_POOLER_MODE, but the canonical ALLOWED_ENV_KEYS set in jvspatial/env_adapter.py did not list them.
  • Result: any PG deployment logged Unknown JVSPATIAL_* env var 'JVSPATIAL_POSTGRES_DSN' ignored. at boot even though the value was honored. With JVSPATIAL_STRICT_ENV_ALLOWLIST=true the warning escalates to a fatal ValueError and breaks startup.
  • Adds the four keys to the # Database block in ALLOWED_ENV_KEYS, alongside the existing Mongo / DynamoDB entries.

Test plan

  • pytest tests/api/test_env_allowlist_audit.py -q → 5 passed
  • Confirmed all four keys are referenced in jvspatial/db/factory.py and jvspatial/db/postgres.py via grep -rn 'JVSPATIAL_POSTGRES_' jvspatial/
  • CI green

🤖 Generated with Claude Code

The Postgres backend (jvspatial/db/factory.py, jvspatial/db/postgres.py)
reads JVSPATIAL_POSTGRES_DSN, JVSPATIAL_POSTGRES_MIN_POOL_SIZE,
JVSPATIAL_POSTGRES_MAX_POOL_SIZE, and JVSPATIAL_POSTGRES_POOLER_MODE,
but the canonical ALLOWED_ENV_KEYS set in env_adapter.py was missing
all four. PG deployments printed "Unknown JVSPATIAL_* env var ignored"
at boot, and JVSPATIAL_STRICT_ENV_ALLOWLIST=true would have made them
fatal.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

Benchmark comparison

Threshold: ±25% (informational, does not block merge)

benchmark baseline (s) current (s) delta status
tests/benchmarks/test_deferred_save_benchmarks.py::test_bench_deferred_save_batched_100 0.050066 0.040027 -20.1% OK
tests/benchmarks/test_deferred_save_benchmarks.py::test_bench_immediate_save_100 0.052645 0.040955 -22.2% OK
tests/benchmarks/test_jsondb_benchmarks.py::test_bench_jsondb_batched_saves_500 0.541573 0.419886 -22.5% OK
tests/benchmarks/test_jsondb_benchmarks.py::test_bench_jsondb_count_empty_query 1.159199 0.883640 -23.8% OK
tests/benchmarks/test_jsondb_benchmarks.py::test_bench_jsondb_count_filtered 1.361629 1.163736 -14.5% OK
tests/benchmarks/test_jsondb_benchmarks.py::test_bench_jsondb_find_filtered 1.017479 0.857027 -15.8% OK
tests/benchmarks/test_jsondb_benchmarks.py::test_bench_jsondb_save_throughput 0.001761 0.001464 -16.9% OK
tests/benchmarks/test_sqlite_benchmarks.py::test_bench_sqlite_count_empty 0.327689 0.224943 -31.4% IMPROVED (-31.4%)
tests/benchmarks/test_sqlite_benchmarks.py::test_bench_sqlite_count_fallback_via_regex 0.389060 0.299404 -23.0% OK
tests/benchmarks/test_sqlite_benchmarks.py::test_bench_sqlite_count_pushdown 0.327183 0.273227 -16.5% OK
tests/benchmarks/test_sqlite_benchmarks.py::test_bench_sqlite_find_fallback_via_regex 0.347182 0.272155 -21.6% OK
tests/benchmarks/test_sqlite_benchmarks.py::test_bench_sqlite_find_pushdown 0.340361 0.219355 -35.6% IMPROVED (-35.6%)
tests/benchmarks/test_sqlite_benchmarks.py::test_bench_sqlite_sort_limit_pushdown 0.355369 0.257158 -27.6% IMPROVED (-27.6%)

@eldonm

eldonm commented May 26, 2026

Copy link
Copy Markdown
Member Author

Closing — folding into existing WIP on dev rather than landing as standalone PR.

@eldonm eldonm closed this May 26, 2026
@eldonm eldonm deleted the fix/postgres-env-allowlist branch May 26, 2026 14:07
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