Commit graph

196 commits

Author SHA1 Message Date
Claude
653db6563f
ax(node): replace prose comment on MinerManager with usage example
AX Principle 2 — comments show HOW with real values, not prose descriptions.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 14:20:03 +01:00
Claude
d0b37bf57f
ax(node): rename resp to response in controller.go
AX Principle 1 — predictable names over short names.
`resp` is an abbreviation that requires context to interpret;
`response` is self-describing at any reading distance.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 14:18:01 +01:00
Claude
9280527f19
ax(node): rename stopChan to stopChannel in PeerRegistry
'Chan' is an abbreviation; AX Principle 1 requires predictable names
over short names. stopChannel is unambiguous without a comment.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 14:16:07 +01:00
Claude
4b6ca745f5
ax(node): rename Transport receiver from t to transport
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
Single-letter receiver `t` violates AX Principle 1 (predictable names
over short names). All 15 Transport methods now use `transport` as the
receiver name for unambiguous semantic navigation.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 14:14:26 +01:00
Claude
fc7a1a2147
ax(node): replace banned path/filepath import with path in peer registry
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 14:10:22 +01:00
Claude
b404f622bb
ax(node): add Good and Ugly test cases for HandleStartMiner, HandleStopMiner, and HandleGetLogs
Some checks failed
Test / test (push) Waiting to run
Security Scan / security (push) Has been cancelled
AX principle: all three categories (Good, Bad, Ugly) are mandatory per
TestFilename_Function_{Good,Bad,Ugly} convention. Three handler functions
had only _Bad coverage; this pass fills the gap.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 14:08:49 +01:00
Claude
0ac701daea
ax(node): rename PeerRegistry.path to peersFilePath for predictable naming
Some checks failed
Security Scan / security (push) Has been cancelled
Test / test (push) Has been cancelled
AX Principle 1: predictable names over short names. The field `path` on
PeerRegistry is ambiguous — it could be any path. `peersFilePath` is
self-describing and removes the need for a comment to explain its purpose.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 14:05:02 +01:00
Claude
fb998ce2df
ax(node): replace banned path/filepath with path in worker.go
worker.go imported path/filepath (banned import) solely for two
filepath.Join calls building the miner install directory path.
Replaced with path.Join from the stdlib path package which is
not banned and behaves identically on Linux for absolute paths.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 14:03:13 +01:00
Claude
68ee594149
ax(node): replace prose comment on ProfileManager with usage example
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
Principle 2 (Comments as Usage Examples): the ProfileManager interface
comment described what the interface was rather than showing how to use it.
Replaced with concrete call examples for GetProfile and SaveProfile.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 14:02:05 +01:00
Claude
c03b040240
ax(node): replace prose comment on GracefulClose with usage examples
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
AX Principle 2 — comments as usage examples, not prose descriptions.
The previous comment restated what the function name already conveyed.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 14:00:25 +01:00
Claude
98d34ffd07
ax(node): replace banned strings import with bytes.HasPrefix in bundle.go
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
The strings package is banned per AX conventions. Both HasPrefix calls in
extractTarball now use bytes.HasPrefix with the bytes package already imported.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 13:58:05 +01:00
Claude
4b8271647a
ax(node): replace prose MinerInstance comment with usage example
AX Principle 2: comments show HOW with real values, not restate
what the type signature already says.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 13:54:44 +01:00
Claude
311e457e35
ax(node): rename PeerRegistry receiver r to registry
Some checks failed
Test / test (push) Waiting to run
Security Scan / security (push) Has been cancelled
AX Principle 1 — predictable names over short names.
The receiver `r` on PeerRegistry is a single-letter abbreviation;
all 29 methods now use `registry` for consistency with the rest of
the node package (controller, worker, transport all use full names).

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 13:52:26 +01:00
Claude
22b6e8ace6
ax(node): replace prose comment with usage example on createTarball
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
AX Principle 2 — comments show HOW with real values, not WHAT the
signature already says. The previous comment restated the function
signature in prose; replaced with a concrete call showing filename/
content pairs.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 13:49:16 +01:00
Claude
95cb6b6570
ax(node): replace prose comment with usage example on PeerAuthMode
Some checks failed
Security Scan / security (push) Successful in 34s
Test / test (push) Has been cancelled
AX Principle 2 — comments show HOW, not WHAT. The prose description
"controls how unknown peers are handled" restates the type name.
Replaced with concrete SetAuthMode call examples showing both modes.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 13:47:51 +01:00
Claude
f005921de9
ax(node): rename PeerRateLimiter receiver r to limiter
Single-letter receiver names are banned by AX Principle 1 except for
i (range loops), _ (discards), t (tests), and c (*core.Core).

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 13:40:44 +01:00
Claude
af7070f27a
ax(node): rename receiver d to deduplicator on MessageDeduplicator
Single-letter receiver `d` violates AX Principle 1 (predictable names
over short names). RFC-CORE-008 permits single-letter receivers only for
`i` (range loops), `_` (discards), `t` (tests), and `c` (*core.Core).

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 13:38:25 +01:00
Claude
ac3c869684
ax(node): replace prose comment on MessageHandler with usage example
AX Principle 2: comments show HOW with real values, not WHAT the type does.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 13:36:58 +01:00
Claude
aa36675cfb
ax(node): rename receiver h to handler in ResponseHandler (AX Principle 1)
Single-letter receiver `h` requires mental mapping to understand it refers to
*ResponseHandler. Renamed to `handler` for self-documenting, predictable naming.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 13:33:02 +01:00
Claude
1c1b2cadf1
ax(node): rename Transport.conns to connections for AX Principle 1 compliance
Abbreviated field name `conns` violates predictable-names-over-short-names.
Renamed to `connections` throughout transport.go — 14 call sites updated.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 13:31:03 +01:00
Claude
5aa17421f6
ax(node): rename vague local variables in lethean.go to predictable names
`result` → `rpcResponse` in GetChainInfo, DiscoverPools, DiscoverGateways.
`parsed` → `commentFields` at call sites; `result`/`part` → `fields`/`segment`
in parseComment. Applies AX Principle 1: predictable names over short names.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 13:27:25 +01:00
Claude
96a450eff5
ax(node): remove banned fmt import from lethean.go
Replace fmt.Sprintf endpoint construction with string concatenation
and return errors directly, eliminating the banned fmt import.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 13:25:41 +01:00
Claude
8775947341
ax(node): complete HandleGetStats test triple with Bad and Ugly cases
TestWorker_HandleGetStats_Bad and TestWorker_HandleGetStats_Ugly were
missing; AX requires all three categories mandatory per function.
Bad covers uninitialised identity, Ugly covers failed miner stat collection.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 13:23:22 +01:00
Claude
19b076002b
ax(node): replace prose comments with usage examples on encryptMessage/decryptMessage
AX Principle 2: comments must show usage, not restate the signature.
Both internal methods had descriptions that duplicated the function name.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 13:17:54 +01:00
Claude
895dec281b
ax(node): rename writeMu to writeMutex in PeerConnection
Abbreviation writeMu requires a reader to infer "mutex" — violates AX
Principle 1 (predictable names over short names). writeMutex is
self-describing with no mapping overhead.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 13:15:51 +01:00
Claude
5bf7509268
ax(node): rename nm/nm1/nm2 to nodeManager/nodeManager1/nodeManager2 in identity test
AX Principle 1: predictable names over short names. `nm` requires a
comment to explain; `nodeManager` is self-documenting.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 13:14:08 +01:00
Claude
519cbca6de
ax(node): rename errMsg to errorMessage in NewErrorMessage usage example
Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 13:11:02 +01:00
Claude
8d1e007d69
ax(node): rename errMsg to errorMessage in Worker.HandleMessage
AX Principle 1 — predictable names over short names. errMsg is an
abbreviation that requires a comment to explain; errorMessage is
self-documenting.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 13:09:22 +01:00
Claude
e08d475c13
ax(node): expand abbreviated loop variable in DiscoverGateways usage example
Comment used `gw` (AX-1: predictable names over short names).
Expanded to `gateway` so the usage example matches what code should look like.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 13:07:40 +01:00
Claude
5b0b0d638e
ax(node): rename nm to nodeManager in worker_test.go (AX Principle 1)
Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 13:05:57 +01:00
Claude
11f19c41b1
ax(node): replace prose comment on NodeManager with usage example
NodeManager's type comment restated the name in prose ("handles node
identity operations") rather than showing concrete usage. Replaced with
a three-line example demonstrating construction, identity check, and
retrieval — per AX Principle 2 (Comments as Usage Examples).

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 13:02:34 +01:00
Claude
d98073caa6
ax(node): remove banned fmt import from protocol.go
Replace fmt.Sprintf/fmt.Errorf with strconv.Itoa and string
concatenation; surface fmt.Errorf error paths as typed
*ProtocolError values for consistent protocol error handling.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 13:00:55 +01:00
Claude
f9b2a5dd75
ax(node): rename Worker receiver from w to worker
AX Principle 1 — predictable names over short names.
The single-letter receiver `w` is ambiguous; `worker` is self-describing.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 12:59:05 +01:00
Claude
f086c767ab
ax(node): rename protocol_test.go functions to TestFilename_Function_{Good,Bad,Ugly}
All test functions now follow the mandatory AX test naming convention.
TestResponseHandler_ValidateResponse, TestResponseHandler_ParseResponse,
TestProtocolError, and TestGetProtocolErrorCode_NonProtocolError renamed
and restructured into Good/Bad/Ugly triplets.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 12:56:35 +01:00
Claude
cd8d17cc78
ax(node): expand ctrl receiver to controller in Controller methods
AX Principle 1 — predictable names over short names. `ctrl` is an
abbreviation that requires a comment to explain; `controller` is
self-documenting and consistent with the `manager` pattern used in
NodeManager and PeerRegistry receivers.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 12:54:19 +01:00
Claude
ca3faa0144
ax(node): rename channel to responseChannel in handleResponse
AX Principle 1 — predictable names over short names. The variable
`channel` in handleResponse required context to understand its role;
`responseChannel` is self-describing on first read.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 12:49:30 +01:00
Claude
2792db3919
ax(node): rename pending to pendingRequests for AX Principle 1 compliance
The field name `pending` required an inline comment to explain its
purpose ("message ID -> response channel"). Per AX Principle 1,
names that require a comment to explain are too short — rename to
`pendingRequests` so the field is self-describing without annotation.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 12:46:55 +01:00
Claude
83a4d9d07d
ax(node): replace prose comments with usage examples in transport and identity
AX Principle 2: comments must show HOW with real values, not restate what
the function name already says. Five prose descriptions replaced with
concrete call-site examples.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 12:43:23 +01:00
Claude
836fc18ff3
ax(node): replace prose comments with usage examples (AX Principle 2)
Comments on saveNow, save, load, Close, and DefaultResponseHandler
restated what the signature already said. Replace with concrete call
examples showing how each is actually invoked.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 12:30:42 +01:00
Claude
8a899153ed
ax(node): strip _WrongURL suffix from lethean test names
Some checks failed
Security Scan / security (push) Successful in 34s
Test / test (push) Has been cancelled
Test names must follow TestFilename_Function_{Good,Bad,Ugly}.
The extra _WrongURL qualifier broke the AX naming convention
(RFC-CORE-008 §10 — CLI tests as artifact validation).

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 12:23:44 +01:00
Claude
ee3fb3d6b7
ax(node): replace prose comment with usage example on rebuildKDTree
AX principle 2: comments show HOW (usage example), not WHAT
(which the function name already says).

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 12:20:36 +01:00
Claude
c57462bd52
ax(node): replace prose struct comments with usage examples
AX Principle 2: comments must show HOW with real values, not restate
what the type signature already says. All payload struct comments in
message.go were prose descriptions ("HandshakePayload is sent during
connection establishment") — replaced with concrete construction
examples showing field usage.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 12:16:41 +01:00
Claude
d812ad92de
ax(node): add Bad and Ugly test categories for TestIdentity_NodeManager
Some checks failed
Test / test (push) Waiting to run
Security Scan / security (push) Has been cancelled
AX Principle 10 requires all three categories (Good, Bad, Ugly) per test
group. identity_test.go had TestIdentity_NodeManager_Good with no Bad or
Ugly counterparts. Adds error-path tests for non-writable paths and
uninitialised identity, plus edge cases for double-generation and
delete-before-generate.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 12:12:22 +01:00
Claude
bd11abb7df
ax(node): replace prose constant comment with usage example
Some checks failed
Test / test (push) Waiting to run
Security Scan / security (push) Has been cancelled
ChallengeSize comment restated the name ("is the size of the challenge
in bytes") — violating AX Principle 2. Replace with a concrete usage
example showing how the constant is used at call sites.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 12:04:30 +01:00
Claude
bf3b6c4b03
ax(node): replace prose constant comment with usage example
saveDebounceInterval had a description comment ("the minimum time between
disk writes") which restates what the name already says. Replaced with a
usage example showing the call site, per AX Principle 2.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 12:01:32 +01:00
Claude
8b49b73a6f
ax(node): rename f to outputFile in extractTarball (AX Principle 1)
Single-letter variable f is not in the permitted set (i, _, t, c).
outputFile names the handle by what it contains.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 11:53:43 +01:00
Claude
9394bbd768
ax(node): replace prose comments with usage examples on StreamBundle/ReadBundle
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 11:48:32 +01:00
Claude
f268b3990f
ax(node): rename abbreviated vars dirs/dir/mode to directories/directory/fileMode
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
AX-1: names that require a comment to explain are too short.
'dirs', 'dir', and 'mode' all needed the surrounding comment
to clarify their meaning; full names are self-documenting.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 11:46:49 +01:00
Claude
360c6c9d56
ax(node): rename mac to messageAuthCode in SignChallenge (AX Principle 1)
Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 11:43:55 +01:00
Claude
e9143e42b0
ax(node): replace prose comment on scheduleSave with usage example
AX Principle 2: comments show HOW with real values, not prose restating
what the name already says.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 11:41:43 +01:00