Use dynamic ports across the five test files that shared hardcoded bindings #702

Merged
weichen merged 4 commits from fix/svc-test-port-governance-batch1 into main 2026-10-22 13:26:12 +00:00
Owner

Why: the port governance was whack-a-mole because earlier passes only scanned tests/test_svc.py. Scanning the whole tree found five more files whose seed_agent calls bind hardcoded ports, and the clearest proof they are a real hazard is that ports 9461 and 9462 each appear in three different files at once — test_svc_lifecycle_isolation.py, test_svc_rdm_admin.py and test_svc_u2.py all use both. Any parallel or leftover-process scenario makes those files collide.

Evidence:

  • seed_agent (defined in tests/test_svc_recover.py:269) starts the stub binary, which listens on the port it is given, so these literals are genuine flaky sources rather than cosmetic ones.
  • Verified by occupation: with 9461 and 9462 each held by an unrelated python3 -m http.server, all five files still pass (125 tests). Before the change the rdm_admin, u2 and lifecycle_isolation files would have fought over the same two ports.
  • Each file imports free_test_port from the shared tests/_port_alloc.py, using the same sys.path preamble already present in tests/test_svc.py. No new helper was introduced.
  • Where a test seeds the same instance more than once, the original single-port semantics are preserved by reusing one variable rather than allocating twice.
  • tests.test_svc_recover, which defines seed_agent, is untouched, as is tests/test_svc.py. No assertion was removed, skipped or relaxed, and no test logic changed beyond the port source.
  • The broader svc suite is green: 173 tests across the nine affected and adjacent modules, 2 skipped.

This batch covers test_svc_identity.py (16 sites), test_svc_rdm_admin.py (12), test_svc_u2.py (7), test_svc_user_binding.py (5) and test_svc_lifecycle_isolation.py (2). One file remains — test_svc_deploy_txn.py, which does not inherit seed_agent and needs its own fixture wiring; it is deliberately left out of this batch rather than half-changed.

Refs: continues the governance that introduced tests/_port_alloc.py and the two earlier batches.

Why: the port governance was whack-a-mole because earlier passes only scanned `tests/test_svc.py`. Scanning the whole tree found five more files whose `seed_agent` calls bind hardcoded ports, and the clearest proof they are a real hazard is that ports 9461 and 9462 each appear in three different files at once — `test_svc_lifecycle_isolation.py`, `test_svc_rdm_admin.py` and `test_svc_u2.py` all use both. Any parallel or leftover-process scenario makes those files collide. Evidence: - `seed_agent` (defined in `tests/test_svc_recover.py:269`) starts the stub binary, which listens on the port it is given, so these literals are genuine flaky sources rather than cosmetic ones. - Verified by occupation: with 9461 and 9462 each held by an unrelated `python3 -m http.server`, all five files still pass (125 tests). Before the change the rdm_admin, u2 and lifecycle_isolation files would have fought over the same two ports. - Each file imports `free_test_port` from the shared `tests/_port_alloc.py`, using the same sys.path preamble already present in `tests/test_svc.py`. No new helper was introduced. - Where a test seeds the same instance more than once, the original single-port semantics are preserved by reusing one variable rather than allocating twice. - `tests.test_svc_recover`, which defines `seed_agent`, is untouched, as is `tests/test_svc.py`. No assertion was removed, skipped or relaxed, and no test logic changed beyond the port source. - The broader svc suite is green: 173 tests across the nine affected and adjacent modules, 2 skipped. This batch covers `test_svc_identity.py` (16 sites), `test_svc_rdm_admin.py` (12), `test_svc_u2.py` (7), `test_svc_user_binding.py` (5) and `test_svc_lifecycle_isolation.py` (2). One file remains — `test_svc_deploy_txn.py`, which does not inherit `seed_agent` and needs its own fixture wiring; it is deliberately left out of this batch rather than half-changed. Refs: continues the governance that introduced `tests/_port_alloc.py` and the two earlier batches.
weichen added 2 commits 2026-10-22 12:38:10 +00:00
Why: establish the authorized task workspace and its initial baseline.

Evidence: preserved precheck receipt in .task/fix-svc-test-port-governance-batch1.md; R0=3d3474a731f9ef3ee1f41935e63bca3afb70db56.

Impact: task metadata only; the feature workspace starts at 3d3474a731.

Refs: .task/fix-svc-test-port-governance-batch1.md
agent-exec transport 8c38703572870841a8c0c81bef7c6773/e8f9fe72723f
ci / svc-realcombo (pull_request) Successful in 2m55s
ci / test (pull_request) Successful in 9m8s
ci / test-pg (pull_request) Successful in 20m53s
f84d7c724e
weichen added 2 commits 2026-10-22 13:10:41 +00:00
Why: include the current integration baseline before verification.

Evidence: fetched origin/main=c92443280ef8e9ed29bf5bf5250df650c01b4478.

Impact: integrate upstream changes without rewriting task history.

Refs: task-sync
Record the sync checkpoint
ci / svc-realcombo (pull_request) Successful in 3m53s
ci / test (pull_request) Successful in 9m55s
ci / test-pg (pull_request) Successful in 14m38s
9d5ed689ce
Why: bind the task validation checkpoint to the integration baseline.

Evidence: SELF recursive component checks; sync_base=c92443280ef8e9ed29bf5bf5250df650c01b4478; before_record=c22b9fb34a3702191a9e5f6007f3538520db694b.

Impact: task metadata only.

Refs: .task/fix-svc-test-port-governance-batch1.md
weichen merged commit cb36b59acc into main 2026-10-22 13:26:12 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: weichen/Agent-System-Dev#702