Repository navigation
feat(services): add services-scoped layered Settings - #19
Closed
rsanghvi21 wants to merge 1 commit into
Closed
rsanghvi21 wants to merge 1 commit into
rsanghvi21 wants to merge 1 commit into
Conversation
Every tunable across services/ was read ad hoc via os.getenv(...)
with a hardcoded string default, scattered per-module -- no
services/ equivalent of src/understudy/common/config.py's layered
pydantic Settings pattern existed, violating AGENTS.md §5.10 ("no
magic numbers in code... thresholds, weights, timeouts and ceilings
live in config/*.yaml and are named in docs/02-architecture.md").
Add services/_common/settings.py mirroring config.py's shape (layered
load, frozen pydantic BaseModel per section, cached singleton with a
reset hook for tests) as an independent module -- services/ and
src/understudy/ share no imports, and src/understudy/common must stay
psycopg/fastapi-free, so it cannot host these tunables either.
One deliberate divergence: fields keep the exact env var name they
already used before this module existed (e.g.
AUTH_TOKEN_CACHE_MAX_SIZE, FAULT_INJECTION_SEED), rather than a new
UNDERSTUDY_<SECTION>__<FIELD> scheme -- those names are already wired
into deploy/prod/*.yaml's env/configMapKeyRef entries and loadgen's
CLI flag fallbacks, and renaming them would silently break
already-deployed configuration for no benefit.
Adds config/services.yaml (defaults) and config/services.local.yaml
to .gitignore (mirroring config/local.yaml) for local overrides.
Documents every field in docs/02-architecture.md §2.5.1.
This is infrastructure only: no call site reads from Settings yet
(follow-up PR). Implements build-plan step A1.8.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CzBeBUsZmE38K1kWeLMhNh
7 tasks done
Harikeshav-R
added a commit
that referenced
this pull request
Sep 11, 2026
Owner
|
Closed as integrated into main via PR #6. |
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.
Build-Plan Step Implemented
Checkpoint Execution & Output
ADRs Relied On
Mock Registry Disclosures
Documentation Updates
docs/02-architecture.md§2.5.1 (new): documents everyServicesSettingsfield, itsdefault, and its env var name, per §5.10 ("if you introduce a tunable, document it
there in the same PR").
Definition of Done
make checkgreen# MOCKED:marker without a row in docs/MOCKS.mdContext
A
/code-reviewpass against PR #6 flagged that every tunable acrossservices/(HTTP timeouts, cache sizes, poll intervals, loadgen defaults, pool sizes, fault-seed,
metrics buckets) is a hardcoded literal or ad hoc
os.getenv(...)call scattered acrossmodules -- a §5.10 violation. This PR is the infrastructure half of the fix:
services/_common/settings.py, a layeredServicesSettingsmodel mirroringsrc/understudy/common/config.py's shape but living independently inservices/(these are separate package trees with zero imports between them).
No call site has been migrated to use it yet -- that's a separate, wide-touching PR
(10b) so this one stays a single logical change (§4) and 10b can be reviewed as a
mechanical migration on its own. 10b depends on this PR and on #8/#15 (bootstrap
refactor) and #13 (worker fault fix) to avoid conflicting with those in-flight
refactors.
Base branch is
feat/policies-and-loadgen(PR #6, still open), sinceservices/onlyexists on that branch's stack.
🤖 Generated with Claude Code
https://claude.ai/code/session_01CzBeBUsZmE38K1kWeLMhNh