Commit graph

175 commits

Author SHA1 Message Date
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
Claude
b15b1654cb
ax(node): expand abbreviated json tag ts to timestamp on Message struct
AX Principle 1 — predictable names over short names. The wire format
field "ts" requires a reader to guess its meaning; "timestamp" is
self-documenting and consistent with every other field on the struct.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 11:36:07 +01:00
Claude
04c05c43a7
ax(node): replace prose comment with usage example on NewNodeManagerWithPaths
Some checks are pending
Test / test (push) Waiting to run
Security Scan / security (push) Successful in 40s
Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 11:33:27 +01:00
Claude
4e10e20a6b
ax(node): replace prose comment with usage example on GetConnection
Some checks failed
Security Scan / security (push) Successful in 34s
Test / test (push) Has been cancelled
AX Principle 2 — comments must show HOW with real values, not restate
what the signature already says. The old comment described the return
value in prose; replaced with a concrete call-site example.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 11:31:36 +01:00
Claude
0a0751e2e0
ax(node): rename dir to directoryPath (AX Principle 1)
Some checks failed
Test / test (push) Waiting to run
Security Scan / security (push) Has been cancelled
Short variable name `dir` violated predictable-names-over-short-names.
Renamed to `directoryPath` in savePrivateKey, saveIdentity, and saveNow.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 11:29:01 +01:00
Claude
d400946352
ax(node): rename u to peerURL in Transport.Connect
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
Single-letter variable name violates AX Principle 1 (predictable names
over short names). peerURL is self-describing without requiring context.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 11:26:37 +01:00
Claude
a10adc881b
ax(node): rename message_test.go functions to TestMessage_Function_{Good,Bad,Ugly}
Some checks failed
Test / test (push) Waiting to run
Security Scan / security (push) Has been cancelled
AX Principle 10 requires test names to follow TestFilename_Function_{Good,Bad,Ugly}.
message_test.go used bare names (TestNewMessage, TestMessageReply, etc.) with no
suffix. Added Bad/Ugly cases for ParsePayload (nil payload, malformed JSON).

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 11:25:07 +01:00
Claude
3a690ee485
ax(node): rename nm to manager in NewNodeManagerWithPaths for predictable naming
AX Principle 1 — nm abbreviates NodeManager, requiring mapping overhead.
Rename to manager and update the NewNodeManager usage-example comment to match.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 11:21:55 +01:00
Claude
a6eb29a486
ax(node): replace prose comment with usage example on extractTarball
RFC-025 Principle 2 — comments must show a concrete call with realistic
values, not restate what the signature already says.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 11:20:01 +01:00
Claude
cb02cdb6b8
ax(node): replace prose comment with usage example on handleWSUpgrade
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
The comment "handleWSUpgrade handles incoming WebSocket connections" restated
the function signature without adding information. Replaced with a concrete
call-site example showing how the method is wired in via Start().

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 11:18:29 +01:00
Claude
fd1aed63fe
ax(node): replace prose comment on NewErrorMessage with usage example
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 11:13:41 +01:00
Claude
10241f5803
ax(node): rename Caps to Capabilities on PoolGateway struct
Some checks failed
Test / test (push) Waiting to run
Security Scan / security (push) Has been cancelled
AX Principle 1 — predictable names over short names.
`Caps` is an abbreviation that requires context to understand;
`Capabilities` is self-documenting.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 11:11:41 +01:00
Claude
e0893bd299
ax(node): replace prose comment on NewTransport with usage example
Some checks failed
Security Scan / security (push) Successful in 34s
Test / test (push) Has been cancelled
AX Principle 2: comments must show how to call the function with real
values, not restate what the type signature already says.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 11:08:21 +01:00
Claude
a8e962a4df
ax(node): replace prose Worker comment with usage example
Principle 2: comments show HOW with real values, not WHAT the type is.
The old comment restated the struct name; the new block demonstrates the
full setup sequence an agent needs to wire a Worker.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 11:06:08 +01:00
Claude
6d77de500d
ax(node): rename dedup field to deduplicator in Transport struct
AX Principle 1: predictable names over short names. The abbreviated
struct field `dedup` requires a reader to mentally expand it; the
full name `deduplicator` is self-describing.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 11:03:44 +01:00
Claude
51595300a2
ax(node): rename abbreviated dn to dataNode in CreateMinerBundle
Some checks failed
Test / test (push) Waiting to run
Security Scan / security (push) Has been cancelled
AX Principle 1 — predictable names over short names. `dn` is an
opaque abbreviation for a *datanode.DataNode; `dataNode` conveys
the type at a glance without requiring context lookup.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 11:02:28 +01:00
Claude
5188cb617c
ax(ueps): remove redundant inline comment that restates the pre-function docstring
Some checks failed
Test / test (push) Has been cancelled
Security Scan / security (push) Has been cancelled
AX Principle 2: comments that restate what the surrounding code already
says are noise. The inline comment inside TestReader_ReadAndVerify_Ugly
duplicated the usage example already present in the function docstring.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 11:01:18 +01:00
Claude
2a5a3d6393
ax(node): add missing Bad and Ugly test variants for HandlePing
AX Principle 10 requires all three categories (Good, Bad, Ugly) for
every test function. TestWorker_HandlePing had only Good; add Bad
(invalid payload) and Ugly (zero SentAt edge case).

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 10:58:46 +01:00
Claude
871e6dd985
ax(node): replace prose comment on DefaultTransportConfig with usage example
AX Principle 2: comments must show HOW with real values, not restate what
the type signature already says. "returns sensible defaults" adds zero
information — the concrete call pattern teaches agents exactly how to use it.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 10:55:02 +01:00
Claude
e69816f978
ax(node): rename n to connectionCount in ConnectedPeers usage example
AX Principle 1: predictable names over short names. The comment example
used `n` which requires context to understand; `connectionCount` is
self-documenting.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 10:53:09 +01:00
Claude
ba9da9444c
ax(node): replace banned strings import with bytes in lethean.go
Some checks are pending
Test / test (push) Waiting to run
Security Scan / security (push) Successful in 41s
strings is a banned import per AX conventions. Replace strings.NewReader,
strings.Contains, strings.Split, and strings.IndexByte with bytes equivalents.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 10:52:06 +01:00
Claude
ed4a8637cd
ax(node): rename NodeManager receiver from n to manager
Some checks failed
Test / test (push) Has been cancelled
Security Scan / security (push) Has been cancelled
AX Principle 1 — predictable names over short names. The receiver `n`
for *NodeManager is a non-standard abbreviation; only `i`, `_`, `t`,
and `c` are permitted single-letter receivers per RFC-CORE-008.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 10:47:48 +01:00