Problem
packages/gds-framework/gds/helpers.py:170 — The _CUSTOM_CHECKS module-level list is mutated by the @gds_check decorator at import time. No locking or thread-safety mechanism exists.
Same concern applies to GDSSpec (spec.py) — a mutable registry with no concurrent access guards.
Impact
- Parallel test runners could register checks multiple times
- Multi-threaded applications building specs concurrently could corrupt state
- Not a problem today (single-threaded usage), but a latent issue
Options
- Document that
_CUSTOM_CHECKS and GDSSpec are not thread-safe (cheapest)
- Add
threading.Lock guards to mutation points
- Use
contextvars for per-context isolation