From 7c36a62d69ee5729c7a578ce7488a27bfc4b7a2f Mon Sep 17 00:00:00 2001 From: Vijit Singh Date: Mon, 24 Aug 2026 10:22:56 -0500 Subject: [PATCH] fix(pools): the port guard keys on length, so say length (#405) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Follow-up to #406, which I merged before its review reached me. The guard is correct; two artefacts describing it are not, and one of them is operator-facing. The guard tests `[ "${#_p}" -gt 5 ]` — digit count, nothing else. The CHANGELOG, the code comment and the test names all said "zero-padded port", which is a different and wider property. Measured on the shipped validator: 065535 rejected (six digits — trips the cut) 08080 ACCEPTED (padded, five digits) 00080 ACCEPTED (padded, five digits) 080 ACCEPTED (padded, three digits) 999999 rejected, and told to remove padding it does not have That last line is the operator-facing half and the reason this is not a docs-only change. A fat-fingered extra digit is the likeliest input to reach this guard, it carries no padding, and the one message it got was about padding. The message now names the digit count. The claim is narrowed rather than the behaviour widened. Implementing actual padding-rejection would be a real tightening on any rig that has a padded port today, and there is no XMRig build here to establish what one currently does with it — the same call that left the second half of #405 to #408. `h:08080` is now PINNED as accepted. The reviewing lane established that the suite cannot distinguish the two implementations, so this behaviour was untested in either direction; pinning it means a later tightening has to go red first and be chosen deliberately, rather than drifting in. Evidence, re-derived rather than inherited: fixed tree 1877 passed, 0 failed, rc 0 old message restored (control) 1874 passed, 3 failed, rc 1 make lint rc 0, make's own exit code The three failures under the control are the two digit-count message assertions and the assert_absent proving an unpadded port is not told about padding — so all three new assertions are load-bearing, not decoration. Also corrected on #406 itself: its evidence table carried a control figure measured mid-edit, before the last two assertions existed. Re-derived against base 16b6fed with the tip's tests held constant: 1870 passed / 4 failed, not the figure recorded. Not done: no live pool was dialled, and nothing here establishes what XMRig does with a padded port — only what this validator does with one. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01E5tRnh79JUNv6q2q4F5qRh --- CHANGELOG.md | 7 ++++--- rigforge.sh | 13 ++++++++----- tests/run.sh | 32 +++++++++++++++++++++++++------- 3 files changed, 37 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d22f5fc..e5be0e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,9 +23,10 @@ All notable changes to RigForge are documented here. The format is based on read `[ "$port" -lt 1 ]`, and on a value bash cannot evaluate as an integer that returns an error rather than false — so the check fell through, an unusable port reached the generated config, and the operator got a raw shell diagnostic instead of the clear message the check exists to give. A - digit-count guard now runs first. The largest legal port is five digits, so nothing in range is - affected — with one exception worth knowing: a zero-padded port such as `:065535` used to be - accepted and is now rejected, and must be written without the padding. + digit-count guard now runs first. It keys on digit count and nothing else: the largest legal port + is five digits, so nothing in range is affected — except a port padded PAST five digits, such as + `:065535`, which used to be accepted and is now rejected. Padding that stays within five digits + (`:08080`) is unaffected and still accepted, as before. - **A failed watchdog re-render no longer reports the change as applied (#395).** `install_watchdog` ended on `systemctl enable ... || true`, so it returned success whatever had happened above it, and diff --git a/rigforge.sh b/rigforge.sh index 205c4b2..a9940ad 100755 --- a/rigforge.sh +++ b/rigforge.sh @@ -398,12 +398,15 @@ _validate_host_port() { #