From 367bdb96caaec23b7f895214ddf9ab6dd6b86e34 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Wed, 9 Sep 2026 09:23:30 +0200 Subject: docs: amend the contacts plan after task 1 to 5 Two corrections found while executing it. The offline proof in task 9 patched socket.socket itself, which breaks the ssl module at import time and produces false failures unrelated to network use. It now patches socket.socket.connect, which is the right target. Task 12 gains a step moving the imports in rdap.py to the top of the file. The module was built one task at a time, so several imports landed mid-file after function definitions. Doing it in the documentation pass keeps it out of the diff that contacts.py builds on. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01Wrfqr2xqQfhtXCscU7zrdz --- docs/plans/2026-09-09-contacts.md | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) (limited to 'docs/plans') diff --git a/docs/plans/2026-09-09-contacts.md b/docs/plans/2026-09-09-contacts.md index 40392d8..244fdce 100644 --- a/docs/plans/2026-09-09-contacts.md +++ b/docs/plans/2026-09-09-contacts.md @@ -1678,7 +1678,17 @@ from abusectl import contacts, parse, rdap class NothingOpensASocket(unittest.TestCase): def setUp(self): - for name in ("socket", "create_connection", "getaddrinfo"): + # socket.socket.connect, NOT socket.socket: replacing the class + # itself breaks the ssl module at import time and produces false + # failures that have nothing to do with network use. + patcher = mock.patch.object( + socket.socket, "connect", + side_effect=AssertionError("socket.socket.connect was called"), + ) + patcher.start() + self.addCleanup(patcher.stop) + + for name in ("create_connection", "getaddrinfo"): patcher = mock.patch.object( socket, name, side_effect=AssertionError(f"socket.{name} was called"), @@ -1935,15 +1945,27 @@ Update the Planned line to name only `report`, `submit` and `retry`. Add `contacts` to the usage section beside `parse`, matching the existing style, including that it needs network and that a re-run is safe. -- [ ] **Step 4: Run the suite one final time** +- [ ] **Step 4: Tidy the imports in `abusectl/rdap.py`** + +The module was built one task at a time, so `os`, `pathlib`, `time`, +`ipaddress` and `email.utils` are imported mid-file, after function +definitions, rather than grouped at the top. Move every import to the top of +the file in one block, standard library alphabetical, matching the other +modules in `abusectl/`. Change nothing else: this is a move, not a rewrite. + +Run: `python3 -m unittest discover tests` +Expected: OK, the same count as before the move. If the count changes, the +move broke something; revert and redo it. + +- [ ] **Step 5: Run the suite one final time** Run: `python3 -m unittest discover tests` Expected: OK -- [ ] **Step 5: Commit** +- [ ] **Step 6: Commit** ```bash -git add AGENTS.md README.md docs/BACKLOG.md +git add AGENTS.md README.md docs/BACKLOG.md abusectl/rdap.py git commit -S -m "docs: record the fourth property and the contacts command An RDAP query discloses what the user is looking at, and property 1 -- cgit v1.2.3