Why: three more test methods in tests/test_svc.py still bound hardcoded ports, the same class of issue closed for test_addr_change_keeps_database_and_auth and register_agent in the previous pull request. Any of them could fail intermittently when the runner already held the port, and none of the failures would point at the real cause.
Evidence:
The ports that actually matter are the ones seed_agent binds: its stub binary starts a real HTTPServer, whereas register_pg only writes text into svc.env. Both are fixed anyway so the file has no stray literals.
Verified by occupation rather than assumption: with 18791, 18792, 18796, 18797, 18798 and 18799 each held by an unrelated python3 -m http.server, all three tests still pass. Before the change the first of them failed with [svc]端口被占用(非本服务).
register_pg ports and the DSN strings are coupled — the DSN must match what was registered or the recovery path resolves a different database — so each pair now shares one pg_port from free_test_port(), and each seed_agent shares one port with its --addr.
In the refusal test the conflicting DSN port is allocated separately from the pg1 registration, so the "dbref and dsn point at different databases" construction still holds.
No new import and no new helper: free_test_port was already imported from the shared tests/_port_alloc.py in an earlier change. No assertion was removed, skipped, or relaxed, and no test logic was altered beyond the port source.
tests.test_svc is green (23 tests) as is the broader svc suite (97 tests, 1 skipped). The full make test and the CI test job cover the rest.
With this, the file no longer carries any hardcoded binding port, closing the last of the cases found by scanning the test tree.
Refs: follows the same governance that introduced tests/_port_alloc.py; closes the remaining three methods left out of the previous pull request.
Why: three more test methods in `tests/test_svc.py` still bound hardcoded ports, the same class of issue closed for `test_addr_change_keeps_database_and_auth` and `register_agent` in the previous pull request. Any of them could fail intermittently when the runner already held the port, and none of the failures would point at the real cause.
Evidence:
- The ports that actually matter are the ones `seed_agent` binds: its stub binary starts a real `HTTPServer`, whereas `register_pg` only writes text into `svc.env`. Both are fixed anyway so the file has no stray literals.
- Verified by occupation rather than assumption: with 18791, 18792, 18796, 18797, 18798 and 18799 each held by an unrelated `python3 -m http.server`, all three tests still pass. Before the change the first of them failed with `[svc]端口被占用(非本服务)`.
- `register_pg` ports and the DSN strings are coupled — the DSN must match what was registered or the recovery path resolves a different database — so each pair now shares one `pg_port` from `free_test_port()`, and each `seed_agent` shares one `port` with its `--addr`.
- In the refusal test the conflicting DSN port is allocated separately from the `pg1` registration, so the "dbref and dsn point at different databases" construction still holds.
- No new import and no new helper: `free_test_port` was already imported from the shared `tests/_port_alloc.py` in an earlier change. No assertion was removed, skipped, or relaxed, and no test logic was altered beyond the port source.
- `tests.test_svc` is green (23 tests) as is the broader svc suite (97 tests, 1 skipped). The full `make test` and the CI `test` job cover the rest.
With this, the file no longer carries any hardcoded binding port, closing the last of the cases found by scanning the test tree.
Refs: follows the same governance that introduced `tests/_port_alloc.py`; closes the remaining three methods left out of the previous pull request.
Why: establish the authorized task workspace and its initial baseline.
Evidence: preserved precheck receipt in .task/fix-svc-test-port-governance-final.md; R0=955a32de2bb49171348bad5f566cce935df19212.
Impact: task metadata only; the feature workspace starts at 955a32de2b.
Refs: .task/fix-svc-test-port-governance-final.md
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Why: three more test methods in
tests/test_svc.pystill bound hardcoded ports, the same class of issue closed fortest_addr_change_keeps_database_and_authandregister_agentin the previous pull request. Any of them could fail intermittently when the runner already held the port, and none of the failures would point at the real cause.Evidence:
seed_agentbinds: its stub binary starts a realHTTPServer, whereasregister_pgonly writes text intosvc.env. Both are fixed anyway so the file has no stray literals.python3 -m http.server, all three tests still pass. Before the change the first of them failed with[svc]端口被占用(非本服务).register_pgports and the DSN strings are coupled — the DSN must match what was registered or the recovery path resolves a different database — so each pair now shares onepg_portfromfree_test_port(), and eachseed_agentshares oneportwith its--addr.pg1registration, so the "dbref and dsn point at different databases" construction still holds.free_test_portwas already imported from the sharedtests/_port_alloc.pyin an earlier change. No assertion was removed, skipped, or relaxed, and no test logic was altered beyond the port source.tests.test_svcis green (23 tests) as is the broader svc suite (97 tests, 1 skipped). The fullmake testand the CItestjob cover the rest.With this, the file no longer carries any hardcoded binding port, closing the last of the cases found by scanning the test tree.
Refs: follows the same governance that introduced
tests/_port_alloc.py; closes the remaining three methods left out of the previous pull request.