feat: CF_LICENSE_KEY validation via Heimdall (closes #26) #31

Merged
pyr0ball merged 2 commits from feature/license-validation into main 2026-04-05 21:33:53 -07:00
Owner

Summary\n\n- New module circuitforge_core/config/license.py with validate_license() and get_license_tier()\n- Reads CF_LICENSE_KEY from env; calls POST {CF_LICENSE_URL}/licenses/verify\n- Graceful free-tier fallback on missing key, network errors, or invalid key\n- 30-minute module-level cache keyed on (key, product) pair\n- Both functions re-exported from circuitforge_core.config\n- 10 tests in tests/test_config/test_license.py\n\n## Test plan\n\n- [ ] conda run -n cf python -m pytest tests/test_config/test_license.py -v — 10/10 pass\n- [ ] conda run -n cf python -m pytest tests/ -v — full suite passes\n- [ ] CF_LICENSE_KEY absent → returns free tier\n- [ ] CF_LICENSE_URL env var overrides Heimdall URL\n- [ ] Network error → returns free tier gracefully

## Summary\n\n- New module `circuitforge_core/config/license.py` with `validate_license()` and `get_license_tier()`\n- Reads `CF_LICENSE_KEY` from env; calls `POST {CF_LICENSE_URL}/licenses/verify`\n- Graceful free-tier fallback on missing key, network errors, or invalid key\n- 30-minute module-level cache keyed on (key, product) pair\n- Both functions re-exported from `circuitforge_core.config`\n- 10 tests in `tests/test_config/test_license.py`\n\n## Test plan\n\n- [ ] `conda run -n cf python -m pytest tests/test_config/test_license.py -v` — 10/10 pass\n- [ ] `conda run -n cf python -m pytest tests/ -v` — full suite passes\n- [ ] `CF_LICENSE_KEY` absent → returns free tier\n- [ ] `CF_LICENSE_URL` env var overrides Heimdall URL\n- [ ] Network error → returns free tier gracefully
pyr0ball added 2 commits 2026-04-05 21:26:20 -07:00
Introduces circuitforge_core.config.license with validate_license() and
get_license_tier(). Both functions are safe to call when CF_LICENSE_KEY
is absent, returning free tier gracefully. Results are cached 30 min per
(key, product) pair. CF_LICENSE_URL env var overrides the default
Heimdall endpoint. Re-exports added to config.__init__. Existing
test_config.py moved into tests/test_config/ package to co-locate with
new test_license.py (10 tests; 204 total passing).
fix: parameterize bare dict type annotations in license module
Some checks failed
CI / test (pull_request) Has been cancelled
bb2ed3e992
pyr0ball merged commit e5c26f0e67 into main 2026-04-05 21:33:53 -07:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Circuit-Forge/circuitforge-core#31
No description provided.