Skip to content

refactor(deploy): template-generate the four prod service manifests - #22

Closed
rsanghvi21 wants to merge 2 commits into
refactor/template-postgres-manifestsfrom
refactor/template-prod-manifests
Closed

rsanghvi21 wants to merge 2 commits into
refactor/template-postgres-manifestsfrom
refactor/template-prod-manifests

Conversation

@rsanghvi21

Copy link
Copy Markdown
Collaborator

Build-Plan Step Implemented

  • Step: A1.7/A1.8 (refactor on already-completed manifests).

Checkpoint Execution & Output

$ uv run python deploy/generate_prod_manifests.py --check
OK: deploy/prod/{auth-service,data-service,edge-gateway,worker}.yaml match the generator.

$ uv run pytest tests/unit/deploy -v
19 passed in 0.76s

$ uv run pytest tests/unit --ignore=tests/unit/services/test_edge_gateway.py -k "not test_run_loadgen_with_owned_client_and_zero_rps" --cov=understudy --cov-branch --cov-fail-under=100
192 passed, 1 deselected, 100.00% coverage

$ uv run ruff check . && uv run ruff format --check . && uv run mypy --strict src tests && uv run lint-imports && uv run python scripts/check_mocks.py
All green.

ADRs Relied On

Mock Registry Disclosures

  • None.

Documentation Updates

  • docs/02-architecture.md §2.5: notes the four prod service manifests are generated,
    cross-referencing the same convention as §2.10's postgres-manifest note.

Definition of Done

  • Implementation complete for the named build-plan step
  • Unit tests written; 100% line and branch coverage of the added lines
  • make check green
  • Checkpoint command run and output matches, OR marked unverified with a reason
  • Docs updated where this change made them untrue
  • No new # MOCKED: marker without a row in docs/MOCKS.md
  • Conventional commit(s), conventional branch, PR opened, never pushed to main

Context

Second half of the finding-12 manifest-duplication fix (first half: #21, the postgres
manifests). This PR applies the same generate-don't-hand-maintain treatment to the
four deploy/prod/*.yaml service manifests, which shared an identical label scheme,
Prometheus scrape annotations, resource limits, and probe shape with nothing
preventing them from drifting apart. Factored the shared PyYAML dumping helpers
(IndentedDumper, LiteralStr) out of generate_postgres_manifests.py into
deploy/_manifest_gen_common.py so both generators share one dumping convention
rather than duplicating it -- the two scripts otherwise remain fully independent
(different manifest families, no coupling between them beyond that shared helper).

As with #21, I diffed the generator's output against what was already committed
before touching anything: the only difference is YAML quoting style, confirming the
generator faithfully reconstructs the existing manifests -- including PR #3's
FAULT_INJECTION_SEED ConfigMap wiring, which every instance's env list includes via
a shared _fault_seed_env() helper so it can't be forgotten on a future edit.

Base branch is refactor/template-postgres-manifests (PR #21), since this PR reuses
that PR's deploy/_manifest_gen_common.py module -- rebasing onto
feat/policies-and-loadgen directly would mean redefining those helpers. Once #21
merges, this PR's diff will narrow to just this PR's changes.

🤖 Generated with Claude Code

https://claude.ai/code/session_01CzBeBUsZmE38K1kWeLMhNh

rsanghvi21 and others added 2 commits September 11, 2026 08:19
…red flags

deploy/prod/configmap.yaml's app-config.FAULT_INJECTION_SEED (1337)
exactly matches services/_common/faults.py's hardcoded
DEFAULT_FAULT_INJECTION_SEED, but nothing wired the ConfigMap value in
-- every service silently fell back to the code default. A code-review
pass against PR #6 flagged this as a dead ConfigMap key.

Wire FAULT_INJECTION_SEED into all four deploy/prod/*.yaml Deployments
via configMapKeyRef so the ConfigMap is the actual source of truth in
prod, with the code constant remaining only as the non-k8s/local
fallback.

feature-flags and app-config's ENVIRONMENT/LOG_LEVEL stay unwired:
docs/02-architecture.md §2.5 requires feature flags to be read live at
request time, not from a startup env var, which needs the actuator's
not-yet-built DISABLE_FLAG/REVERT_CONFIG live-read mechanism (Phase 5).
Document that explicitly in the ConfigMap so it is not re-flagged as
dead configuration before Phase 5 lands.

Implements build-plan step A1.7/A1.8 (fix + documentation follow-up).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CzBeBUsZmE38K1kWeLMhNh
deploy/prod/{auth-service,data-service,edge-gateway,worker}.yaml were
four independently hand-written, near-identical Deployment+Service
pairs (identical label scheme, Prometheus scrape annotations,
replicas, imagePullPolicy, resources, probe shape,
UNDERSTUDY_ROLE/FAULT_INJECTION_SEED env; differing only in each
service own env vars, Service type/ports, and
app.kubernetes.io/component) with nothing keeping them from drifting
apart -- the same problem generate_postgres_manifests.py (prior PR)
already solved for the postgres manifests.

Factor the shared PyYAML dumping helpers (indent-forcing Dumper,
literal-block-scalar str subclass) out of that script into
deploy/_manifest_gen_common.py so both generators use one convention
instead of duplicating it. Add deploy/generate_prod_manifests.py
following the same shape: each manifest built as a dict from one
template function plus a small per-instance parameter table, with
--check wired into tests/unit/deploy/test_prod_manifests.py so drift
fails CI.

The four committed files are now generator output; diffed against
what was already committed before touching anything, the only
difference is YAML quoting style (PyYAML's default quote-string-that-
looks-like-a-bool/number behavior), confirming the generator
faithfully reconstructs the existing, reviewed manifests including
the FAULT_INJECTION_SEED wiring from the ConfigMap PR.

Implements build-plan step A1.7/A1.8 (refactor on already-completed
manifests).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CzBeBUsZmE38K1kWeLMhNh
@Harikeshav-R

Copy link
Copy Markdown
Owner

Closed as integrated into main via PR #6.

@Harikeshav-R
Harikeshav-R deleted the refactor/template-prod-manifests branch September 11, 2026 19:49
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.

2 participants