Skip to content

test(deploy): assert twin-network-policy golden/template parity - #11

Merged
Harikeshav-R merged 1 commit into
feat/policies-and-loadgenfrom
test/network-policy-template-parity
Sep 11, 2026
Merged

Harikeshav-R merged 1 commit into
feat/policies-and-loadgenfrom
test/network-policy-template-parity

Conversation

@rsanghvi21

Copy link
Copy Markdown
Collaborator

Build-Plan Step Implemented

  • Step: A1.7 (test-coverage follow-up on an already-completed step).

Checkpoint Execution & Output

$ uv run pytest tests/unit/deploy/test_policies_manifests.py -v
6 passed in 0.16s

$ uv run pytest tests/unit --ignore=tests/unit/services --cov=understudy --cov-branch --cov-fail-under=100
110 passed, 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

  • ADR-014 (twin egress containment) -- this PR adds coverage that the golden
    NetworkPolicy and its template stay in sync; it does not change the policy
    itself.

Mock Registry Disclosures

  • None.

Documentation Updates

  • docs/02-architecture.md §2.1: corrected the repository-layout tree, which
    documented a deploy/twin/ directory for "twin manifest templates" that
    doesn't exist -- the *.template.yaml files actually live in
    deploy/policies/ alongside their golden copies.

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

A /code-review pass against PR #6 flagged that
deploy/policies/twin-network-policy.yaml (the golden copy, applied via
kubectl apply -n <namespace>) and twin-network-policy.template.yaml
(rendered at fork time) are maintained by hand with nothing keeping them in
sync -- the two existing tests validate each file independently and never
diff them against each other. This PR adds that diff as a test, and fixes an
unrelated but adjacent doc error found in the same area (a deploy/twin/
directory documented in the architecture doc's tree that was never actually
created).

Base branch is feat/policies-and-loadgen (PR #6, still open), since
deploy/policies/ only exists on that branch's stack.

🤖 Generated with Claude Code

https://claude.ai/code/session_01CzBeBUsZmE38K1kWeLMhNh

deploy/policies/twin-network-policy.yaml (the golden copy, applied
with `kubectl apply -n <namespace>`) and
twin-network-policy.template.yaml (rendered at fork time, carries
`namespace: ${TWIN_NAMESPACE}`) are maintained entirely by hand -- no
generation script exists yet (fleet manifest rendering is build-plan
step A2.2, unbuilt). The two existing unit tests validate each file's
own structure independently and never diff them against each other,
so a future edit to one that isn't mirrored in the other would pass
CI silently.

Add a test that loads both, strips the namespace field they're
expected to differ on, and asserts everything else is identical.

Also corrects docs/02-architecture.md's directory tree, which
documented a deploy/twin/ directory for "twin manifest templates"
that doesn't exist -- the templates actually live in deploy/policies/
next to their golden copies.

Implements build-plan step A1.7 (test coverage follow-up).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CzBeBUsZmE38K1kWeLMhNh
@Harikeshav-R
Harikeshav-R merged commit eb836df into feat/policies-and-loadgen Sep 11, 2026
1 check passed
@Harikeshav-R
Harikeshav-R deleted the test/network-policy-template-parity 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