Use a dynamic port in the last hardcoded test binding #705

Merged
weichen merged 2 commits from fix/svc-test-port-governance-deploy-txn into main 2026-10-22 14:09:13 +00:00
Owner

Why: this was the last file still binding hardcoded ports, so the test tree now carries none. test_svc_deploy_txn.py calls fx.seed_agent("txn", 9471) and fx.seed_agent("fwd", 9472), where fx is an IdentityTests instance whose seed_agent starts the stub binary and listens on the port given.

Evidence:

  • Verified by occupation: with 9471 and 9472 each held by an unrelated python3 -m http.server, both tests still pass. Before the change the first failed with [svc] 端口被占用(非本服务) on 9471.
  • free_test_port is imported from the shared tests/_port_alloc.py using the same sys.path preamble already used in tests/test_svc_identity.py. No new helper.
  • tests/test_svc_recover.py, which defines seed_agent, is untouched, as is tests/_port_alloc.py. No assertion was removed, skipped or relaxed, and no test logic changed beyond the port source.
  • The six affected modules are green together (127 tests, 2 skipped).
  • Scanning the whole tests/ tree for seed_agent("..", <literal>) and register_agent(.., <literal>) now returns zero matches, closing the governance that the earlier passes only applied to tests/test_svc.py.

Refs: final batch of the port governance that introduced tests/_port_alloc.py.

Why: this was the last file still binding hardcoded ports, so the test tree now carries none. `test_svc_deploy_txn.py` calls `fx.seed_agent("txn", 9471)` and `fx.seed_agent("fwd", 9472)`, where `fx` is an `IdentityTests` instance whose `seed_agent` starts the stub binary and listens on the port given. Evidence: - Verified by occupation: with 9471 and 9472 each held by an unrelated `python3 -m http.server`, both tests still pass. Before the change the first failed with `[svc] 端口被占用(非本服务)` on 9471. - `free_test_port` is imported from the shared `tests/_port_alloc.py` using the same sys.path preamble already used in `tests/test_svc_identity.py`. No new helper. - `tests/test_svc_recover.py`, which defines `seed_agent`, is untouched, as is `tests/_port_alloc.py`. No assertion was removed, skipped or relaxed, and no test logic changed beyond the port source. - The six affected modules are green together (127 tests, 2 skipped). - Scanning the whole `tests/` tree for `seed_agent("..", <literal>)` and `register_agent(.., <literal>)` now returns zero matches, closing the governance that the earlier passes only applied to `tests/test_svc.py`. Refs: final batch of the port governance that introduced `tests/_port_alloc.py`.
weichen added 2 commits 2026-10-22 13:53:37 +00:00
Why: establish the authorized task workspace and its initial baseline.

Evidence: preserved precheck receipt in .task/fix-svc-test-port-governance-deploy-txn.md; R0=cb36b59accd0418c5ca952912d7c181b83038a4c.

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

Refs: .task/fix-svc-test-port-governance-deploy-txn.md
agent-exec transport 2e46101738c303455c7fb4f286176c0e/4e605887db1b
ci / svc-realcombo (pull_request) Successful in 4m4s
ci / test (pull_request) Successful in 11m18s
ci / test-pg (pull_request) Successful in 14m34s
2739dcbfcc
weichen merged commit f673c2a15a into main 2026-10-22 14:09:13 +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#705