aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-node/tests/transfer_probe.py
Commit message (Collapse)AuthorAgeFilesLines
* style: ruff's own fixes, mechanically appliedChristophe Besson6 days1-7/+5
| | | | | | | | | | | | | | | | | | | | `ruff check .` had gone unrun long enough to report 568 errors, which is the same as having no linter: the next real finding would have been invisible in the noise. This is the 521 it fixes by itself, in 173 files, and nothing else — the 98 it cannot fix are the next commit. What actually changed: import sorting (225), imports nobody used (87, none of them a re-export — no `__init__.py` is touched, which was the one way this could have broken an import elsewhere), `datetime.timezone.utc` to `datetime.UTC` (69) and `asyncio.TimeoutError` to `TimeoutError` (18), both plain aliases on the 3.12 this project requires, `Optional[X]` to `X | None` (24), and f-strings with nothing to interpolate (19). Checked rather than assumed: every module in the three packages still imports, and the suite is 2893 passed — the same count, test for test, as the merge before it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* test(node): match transfer replies by id, not by arrival orderChristophe Besson2026-09-091-6/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | Three defects in the probe, found while extending it to cover the per-member hot-swap. The third is the one worth keeping. `transfer_state` is the reply to an open, the acknowledgement of a close, and the push that carries a grant minutes later. Reading "the next one" therefore returns somebody else's answer as soon as more than one transfer is in play — the probe took two stale `closed` acks as the replies to two opens and reported a working cap as broken. That is exactly the defect `req_id` exists for in this protocol, committed inside the tool written to check it. Replies are matched on `tr` now. The other two: the `transfers show` parser counted the pool summary line as a lease once that command grew a per-group section (a probe that reads a human-facing format signs up for this), and the per-member check began with a member who already held several leases, which measures nothing. It waits for the operator's own view to go quiet first — waited for, not slept through. Both probes written today reproduced a bug already recorded in CLAUDE.md: this one, and yesterday's timer with no strong reference. A tool that verifies the code is not exempt from the code's rules. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HCGdheDLxGReuKHga3BtST
* test(node): the two checks that need the operator's own CLIChristophe Besson2026-09-081-0/+114
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `--operator` closes the last two items of the live pass, from the side the client cannot see: - **a cap raised live starts what was waiting**, with no restart and no reconnection. Draft-v6 §2.11 promises this and it was false for months: `ops.set_node_settings` hot-swapped by assigning `webrtc._stream_sem`, an attribute that has never existed. Now it goes through `set_capacity`, and this is what says so from outside; - **a vanished peer's slots are back before anyone asks.** §5 of the plan makes that a hook on the connection rather than a timeout, and the difference is two minutes of a node that looks full. Plus the operator's view of the queue itself, which is the only window into a transfer stuck at "waiting" — and which reported the module defaults instead of the operator's values until this afternoon. Two mistakes in the check, none in the code, and the second is worth keeping: the first version set the node cap and the member cap both to 2, so one account holding two transfers hit both at once. Raising the node-wide cap then correctly changed nothing — per-member is checked first, by design — and the probe reported the design working as a failure. It now puts the node cap below the member cap so the queue is held by the machine, which is the only arrangement where this can be measured at all. The cap is restored to whatever the node was running before the probe touched it, not to a default. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HCGdheDLxGReuKHga3BtST
* test(node): keep the transfer probe in the repoChristophe Besson2026-09-081-0/+416
It lived in `QE/`, which is deliberately not versioned — credentials and test artefacts go there — so a tool that found several defects no test in the suite could reach existed on exactly one machine. What it found, none of it reachable from pytest: a cap that was never enforced, a queue that granted a slot and never told the peer waiting on it, leases that outlived the session holding them, and `transfers show` reporting the module defaults instead of the operator's own values. Not collected: the filename does not match `test_*.py`, and that is the point. It talks to a real hub with real credentials and takes minutes; what belongs in the suite is already there. It still needs two things from `QE/`, which stay out of the repo: `e2e.py`, the second implementation of the client whose `Client` speaks MNP over a real WebRTC DataChannel, and `demo.env`. Both are located at run time and their absence is explained in a sentence rather than raised as an ImportError from four frames down. Verified from the new location against the live node: 4/4. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HCGdheDLxGReuKHga3BtST