Commit graph

118 commits

Author SHA1 Message Date
Claude
3cf01162d5
ax(node): rename loop variable p to peer in GetPeersByScore
AX Principle 1 — predictable names over short names. Single-letter
variable p in GetPeersByScore replaced with peer, matching the type
it holds and the usage in surrounding code.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 10:27:32 +01:00
Claude
6d70f4a85f
ax(node): replace prose comments with usage examples on private identity methods
Some checks failed
Security Scan / security (push) Successful in 29s
Test / test (push) Has been cancelled
AX-2: comments that restate the function name add zero information.
savePrivateKey, saveIdentity, and loadIdentity now show a concrete
call-site with context on when each is invoked.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 10:25:57 +01:00
Claude
bf44c296d9
ax(node): add usage example comment to parseComment
AX-2: every function must show a concrete call with real values, not
prose. parseComment had no comment at all — added three-line example
showing input string, key lookup, and expected return values.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 10:23:23 +01:00
Claude
e4989be633
ax(node): rename tmpPath to temporaryPath in peer registry save
AX Principle 1: predictable names over short names.
`tmp` is an abbreviation requiring mental mapping; `temporaryPath`
is unambiguous and self-describing.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 10:21:31 +01:00
Claude
6854b7b054
ax(node): replace prose comment with usage example on PeerConnection.Close
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
AX Principle 2: comments must show HOW with real values, not restate what
the signature already says. "Close closes the connection." adds zero
information; a usage example shows call site and error handling pattern.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 10:16:45 +01:00
Claude
35da3edcab
ax(node): rename bundle_test.go functions to TestFilename_Function_{Good,Bad,Ugly} convention
Some checks failed
Security Scan / security (push) Has been cancelled
Test / test (push) Has been cancelled
All 10 test functions in bundle_test.go lacked the AX Principle 10 naming
convention. Renamed to TestBundle_* with _Good/_Bad/_Ugly suffixes and
converted inlined Bad/Ugly subtests into top-level functions where needed.
Added usage-example comments per AX Principle 2.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 10:15:00 +01:00
Claude
1d319b5f96
ax(node): rename n to count in SelectNearestPeers (AX-1 predictable names)
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
Single-letter parameter n violates AX Principle 1 — names must be
predictable without a comment to explain them. count is unambiguous.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 10:11:11 +01:00
Claude
4990e78156
ax(node): rename worker_test.go functions to Good/Bad/Ugly convention
Some checks failed
Security Scan / security (push) Successful in 32s
Test / test (push) Has been cancelled
Test function names lacked the required {Good,Bad,Ugly} suffix mandated
by AX Principle 10. Renamed HandlePing and HandleGetStats (missing suffix),
and _NoManager/_Profile/_UnknownType variants to _Bad/_Bad/_Ugly.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 10:09:20 +01:00
Claude
985fc78c40
ax(node): rename TestWorker_SetProfileManager to include _Good suffix
AX Principle 10 requires test functions follow TestFilename_Function_{Good,Bad,Ugly}
naming. TestWorker_SetProfileManager was missing the mandatory category suffix.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 10:07:07 +01:00
Claude
0074577210
ax(node): rename pr to peerRegistry in worker_test.go
AX-1 (Predictable Names): the local variable `pr` is an abbreviation
that requires context to decode. Renamed to `peerRegistry` across all
test functions so the type is self-evident at the point of use.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 10:06:24 +01:00
Claude
482b2e6f23
ax(node): replace prose description with usage example on SelectNearestPeers
AX principle 2: comments show HOW with real values, not WHAT the signature already says.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 10:04:15 +01:00
Claude
aca34610e6
ax(node): expand abbreviated variable names in bufpool to predictable full names
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
Renames `buf` to `buffer` and `enc` to `encoder` throughout bufpool.go.
AX Principle 1 — predictable names over short names: abbreviations increase
semantic ambiguity for agents pattern-matching across the codebase.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 10:02:11 +01:00
Claude
c603303f1e
ax(node): rename test and add Good/Bad/Ugly suite for NewPeerRegistry
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
TestPeerRegistry_NewPeerRegistry violated AX-10 (test naming must follow
TestFilename_Function_{Good,Bad,Ugly}). Renamed to TestPeer_NewPeerRegistry_Good
and added Bad (unwritable path) and Ugly (corrupted JSON) cases.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 10:00:15 +01:00
Claude
50169f5a8e
ax(node): replace prose comments with usage examples in transport.go
Four functions in Transport had comments that restated the signature
("sets the handler", "establishes a connection", "sends a message to all
connected peers") rather than showing concrete call examples. Converted
to AX Principle 2 style — usage examples with realistic values.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:58:10 +01:00
Claude
9a38c8d547
ax(node): add _Good suffix to TestWorker_SetMinerManager per AX-10 test naming
AX-10 requires test functions follow TestFilename_Function_{Good,Bad,Ugly}.
TestWorker_SetMinerManager tested only the happy path with no suffix.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:56:33 +01:00
Claude
66d925ab56
ax(node): replace prose comment with usage examples on isJSON
AX Principle 2: comments must show how to call the function, not
restate what the type signature already says.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:51:58 +01:00
Claude
a27cedd0a5
ax(node): replace prose comments with usage examples on ExtractProfileBundle and ExtractMinerBundle
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
AX Principle 2: comments must show HOW with real values, not restate what the signature already says.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:50:43 +01:00
Claude
d56f6749ad
ax(node): replace prose comments with usage examples on Start/Stop
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
Transport.Start and Transport.Stop had prose comments that restated
the function name — the pattern AX Principle 2 explicitly bans.
Replaced with concrete call-site examples showing how callers use them.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:47:21 +01:00
Claude
a1939ff5f7
ax(node): rename identity test functions to AX TestFilename_Function_{Good,Bad,Ugly} convention
TestNodeIdentity, TestNodeRoles, TestChallengeResponse violated AX Principle 2 (test
naming). Renamed to TestIdentity_NodeManager_Good, TestIdentity_NodeRoles_Good,
TestIdentity_ChallengeResponse_Good to follow the mandatory TestFilename_Function_Good
naming pattern.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:45:13 +01:00
Claude
89599c122c
ax(node): replace prose comments with usage examples in bundle.go
CreateProfileBundleUnencrypted and CreateMinerBundle had comments that
restated the signature in prose. AX Principle 2 requires comments to
show a concrete call with realistic values, not describe what the type
signature already says.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:43:00 +01:00
Claude
cbc876fdaf
ax(node): rename single-letter goroutine parameter p to connectedPeer
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
AX Principle 1: predictable names over short names. The goroutine
parameter in GetAllStats used `p *Peer` — a single-letter abbreviation
with no justification under the AX exception list (i, _, t, c only).
Renamed to `connectedPeer` to match the variable's semantic role.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:41:18 +01:00
Claude
e837423cb7
ax(node): replace prose comment with usage example on PeerRateLimiter.Allow
Some checks failed
Test / test (push) Waiting to run
Security Scan / security (push) Has been cancelled
Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:39:46 +01:00
Claude
21d205a0dc
ax(node): rename pr to registry in NewPeerRegistryWithPath
`pr` abbreviates PeerRegistry — violates AX Principle 1
(predictable names over short names). Renamed to `registry`
so the variable is self-describing without context.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:37:22 +01:00
Claude
df8f17c1cb
ax(node): replace prose comment with usage example on ParseResponse
AX Principle 2 — comments show HOW with real values, not what the
signature already says. The previous comment restated the method name
as prose; replaced with a concrete call pattern.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:34:58 +01:00
Claude
2ea46d8ec0
ax(node): rename Transport.mu to mutex (AX Principle 1)
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
Abbreviated field name `mu` is ambiguous — rename to `mutex` to satisfy
AX-025 §1 (predictable names over short names).

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:33:54 +01:00
Claude
017d386c6d
ax(node): fix test name to follow TestFilename_Function_Good convention
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
TestConvertMinerStats did not follow the AX Principle 10 test naming
convention (TestFilename_Function_{Good,Bad,Ugly}). Renamed to
TestWorker_ConvertMinerStats_Good to match the required pattern.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:29:26 +01:00
Claude
f18991470d
ax(node): replace prose comments with usage examples on Controller
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
Controller type and sendRequest had comments that restated the type
signature in prose. RFC-025 §2: if a comment restates what the type
signature says, delete it; show a concrete call instead.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:28:02 +01:00
Claude
3ed2453413
ax(node): replace prose comment on NewNodeManager with usage example
Some checks failed
Security Scan / security (push) Successful in 32s
Test / test (push) Has been cancelled
AX Principle 2: comments must show HOW with real values, not restate
what the signature already says.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:25:06 +01:00
Claude
aab44e7814
ax(node): rename PeerRegistry.mu and saveMu to mutex and saveMutex
AX-1 (Predictable Names): abbreviated field names require mental mapping.
mutex and saveMutex are self-describing; mu and saveMu are not.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:22:48 +01:00
Claude
33db5f2dc6
ax(node): rename mu to mutex in NodeManager for AX Principle 1 compliance
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
Short name `mu` requires context to decode; `mutex` is self-describing.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:20:35 +01:00
Claude
7a967b9249
ax(node): rename MessageDeduplicator.mu to mutex for AX Principle 1 compliance
Abbreviated field name `mu` violated AX Principle 1 (predictable names over
short names). Renamed to `mutex` to match the convention already used in the
sibling `PeerRateLimiter` struct in the same file.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:19:26 +01:00
Claude
35c178ce05
ax(node): replace prose comments with usage examples in PeerRegistry
AX Principle 2: comments that restate the type signature add zero
information. Replaced all prose-description comments on PeerRegistry
methods with concrete call-site examples that show real usage.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:18:29 +01:00
Claude
32290b839b
ax(node): replace prose comment with usage example on GetRemoteLogs
Some checks failed
Test / test (push) Waiting to run
Security Scan / security (push) Has been cancelled
AX Principle 2 — comments must show HOW with real values, not restate
the signature in prose. "GetRemoteLogs requests console logs from a
remote miner" added zero information; replaced with a concrete call
showing peerID, minerName, lines, and result handling.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:15:35 +01:00
Claude
546d97ae6a
ax(node): replace prose comment with usage example on ParsePayload
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
AX-2: comments must show HOW with real values, not restate the signature.
"ParsePayload unmarshals the payload into the given struct" adds zero
information. Replaced with a concrete call showing the pattern callers
actually use throughout this package.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:14:28 +01:00
Claude
39e0df4de3
ax(node): replace AddPeer prose comment with usage example
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
AX Principle 2: comments restate the signature — replace with a concrete
call showing realistic values and the debounce behaviour as a note.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:13:10 +01:00
Claude
05fb333686
ax(node): replace prose comment with usage example on StopRemoteMiner
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
AX Principle 2 — comments must show HOW with real values, not restate
what the type signature already says.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:11:34 +01:00
Claude
0bb5287f4b
ax(node): replace prose comment with usage example on IsPublicKeyAllowed
AX Principle 2: comments show HOW with real values, not WHAT the function does.
"checks if a public key is in the allowlist" restates the signature — replaced
with a concrete call example.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:08:17 +01:00
Claude
2646772ed6
ax(node): replace prose comment on VerifyBundle with usage example
AX Principle 2 — comments show HOW with real values, not WHAT the
signature already says.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:06:38 +01:00
Claude
0c77689877
ax(node): rename mu to mutex in Controller (AX-1 predictable names)
Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:05:26 +01:00
Claude
9ad9ecfa05
ax(node): replace prose-description comments with usage examples on MessageDeduplicator
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
IsDuplicate/Mark/Cleanup had comments restating the signature ("checks if",
"records a", "removes") — AX Principle 2 violation. Replaced with concrete
call-site examples showing how to sequence IsDuplicate → Mark → Cleanup.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:03:35 +01:00
Claude
9a7fd68e99
ax(node): replace prose comments with usage examples on crypto challenge functions
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
GenerateChallenge, SignChallenge, and VerifyChallenge had comments that
restated what the type signature already says. Replaced with concrete call
examples showing how each function is used in the handshake flow (AX §2).

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:01:52 +01:00
Claude
315d052b15
ax(node): rename PeerRateLimiter.mu to mutex (AX-1 predictable names)
Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 08:58:53 +01:00
Claude
89100776e9
ax(node): replace prose comment with usage example on StartRemoteMiner
RFC-CORE-008 Principle 2: comments show HOW with real values, not restate the signature.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 08:57:07 +01:00
Claude
28dfe3f31e
ax(node): replace prose comment with usage examples on IsProtocolVersionSupported
Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 08:56:12 +01:00
Claude
0979fd1aea
ax(node): replace prose comment with usage example on GetRemoteStats
Some checks failed
Security Scan / security (push) Successful in 31s
Test / test (push) Has been cancelled
AX Principle 2 — comments must show HOW with real values, not restate
what the type signature already says.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 08:54:44 +01:00
Claude
df8d7189d8
ax(node): replace prose description with usage example on CreateProfileBundle
AX Principle 2: comments show HOW with real values, not WHAT the signature
already says. The prose "creates an encrypted bundle containing a mining
profile" restates the type signature — deleted in favour of a concrete call.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 08:52:42 +01:00
Claude
d886b3905c
ax(node): replace prose comments with usage examples on NewMessage and Reply
AX Principle 2: comments must show HOW with real values, not restate the
type signature in prose. The previous comments added zero information.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 08:50:39 +01:00
Claude
fbdb14e98f
ax(node): rename TestNewWorker to follow AX test naming convention
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
AX principle requires TestFilename_Function_{Good,Bad,Ugly}.
TestNewWorker → TestWorker_NewWorker_Good.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 08:48:41 +01:00
Claude
1ff90ba170
ax(node): replace prose comments with usage examples on PeerRegistry auth methods
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
SetAuthMode, GetAuthMode, AllowPublicKey, and RevokePublicKey all had
comments that restated the function signature rather than showing concrete
usage. Replaced with call-site examples per AX Principle 2.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 08:47:20 +01:00
Claude
4c355049e7
ax(node): remove dangling prose comment in peer.go
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
Line 715 contained "// Example usage inside a connection handler" with no
code following it — a prose description stub with no usage example. This
violates AX Principle 2 (comments must show concrete usage with real values,
not describe intent in prose).

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 08:44:40 +01:00