Commit graph

225 commits

Author SHA1 Message Date
Claude
07ba7b7e62
ax(node): replace banned fmt import in peer.go with ProtocolError
Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 16:47:06 +01:00
Claude
485411912a
ax(node): replace banned fmt import in worker.go with ProtocolError
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
All fmt.Errorf calls replaced with &ProtocolError{Code, Message} using
the package-native error type, removing the banned fmt import entirely.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 16:44:42 +01:00
Claude
b4c73147fe
ax(node): replace direct encoding/json with package-level UnmarshalJSON wrapper
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
worker.go imported encoding/json directly and called json.Unmarshal at two
call sites. bufpool.go already provided MarshalJSON as the package wrapper;
add matching UnmarshalJSON and route both worker.go call sites through it,
removing the encoding/json import from worker.go.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 16:42:45 +01:00
Claude
695a62b61a
ax(node): remove banned fmt import from controller.go
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
Replace all fmt.Errorf calls with typed *ProtocolError values using the
native node error type — consistent with how protocol.go was cleaned up.
Error wrapping cases (failed to create message) now surface the original
error directly, preserving the call chain without fmt.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 16:41:30 +01:00
Claude
68fbe70c54
ax(node): rename ack to acknowledgement in controller (AX Principle 1)
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 16:38:18 +01:00
Claude
acef50ad62
ax(node): rename tt loop variable to testCase in lethean_test.go
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 `tt` loop variable
is a two-letter abbreviation with no defined exception in the AX naming rules
(only `i`, `_`, `t`, `c` are acceptable short names). Renamed to `testCase`
throughout TestParseComment_{Good,Bad,Ugly}.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 16:36:41 +01:00
Claude
676d7b13a9
ax(node): remove prose description lines from PeerRegistry method comments
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
AX Principle 2: comments show usage examples, not prose descriptions.
Five methods (AddPeer, UpdatePeer, RemovePeer, UpdateMetrics, UpdateScore)
had a redundant "Note: Persistence is debounced..." prose line appended
after the usage example. The usage example already communicates intent;
the prose line restated implementation detail without adding value.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 16:33:20 +01:00
Claude
81f4fc9d96
ax(node): replace prose constant comments with usage examples
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
Score constants had comments restating the name in prose
("Increment for successful interaction") rather than showing
how they are used. AX Principle 2: comments are usage examples,
not descriptions.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 16:31:11 +01:00
Claude
152952e101
ax(node): rename allowedPublicKeyMutex to allowedPublicKeysMutex
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
Mutex name was singular (allowedPublicKeyMutex) while the field it
protects is plural (allowedPublicKeys). AX Principle 1 requires
predictable names — the mutex name must mirror the field it guards.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 16:29:43 +01:00
Claude
e06f8de589
ax(node): rename buf to buffer in bundle_test for predictable naming
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. `buf` is an
abbreviation that requires a comment to understand; `buffer` is
self-describing.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 16:26:37 +01:00
Claude
8fe169aeb6
ax(node): replace prose comment with usage example on bufferPool
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
RFC-025 Principle 2: comments must show HOW with real values, not
restate what the variable does in prose.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 16:24:39 +01:00
Claude
58701498ea
ax(node): rename w/r HTTP handler params to responseWriter/request
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
Single-letter parameter names w and r violate AX Principle 1
(predictable names over short names). Only i, _, t, and c are
permitted as single-letter names per the AX spec.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 16:23:25 +01:00
Claude
e263fe7f1e
ax(node): rename loop variable p to peer in peer_test.go
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 single-letter `p` in `for _, p := range peers` is not listed
in the allowed exceptions (only `i`, `_`, `t`, `c` are permitted).
Rename to `peer` for semantic clarity.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 16:21:34 +01:00
Claude
39ebb63eac
ax(node): replace prose comment with usage example on peerNamePattern
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 code does.
The old comment restated the variable name; the new comment shows concrete
validatePeerName calls that demonstrate valid and invalid inputs.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 16:19:45 +01:00
Claude
956f8de643
ax(node): replace prose comment with usage example in NewController
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
AX-2: comments must show concrete usage, not restate what the code does.
The "Register message handler for responses" prose comment was replaced
with a usage-example comment that shows the actual call pattern.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 16:18:23 +01:00
Claude
cdeb66b82d
ax(node): rename pe to protocolError in GetProtocolErrorCode
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
AX Principle 1: pe is an abbreviation requiring a comment to explain.
Renamed to protocolError throughout, including the usage example comment.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 16:16:44 +01:00
Claude
d5d60d39e1
ax(node): rename ChainInfo.Aliases to AliasCount for type clarity
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
The field Aliases int was ambiguous — agents and readers expect Aliases
to be a slice, not a count. AliasCount makes the int type self-evident
without requiring a comment (AX Principle 1: predictable names).

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 16:15:07 +01:00
Claude
53654cffbc
ax(node): replace prose type comments with usage examples in bundle.go
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
BundleType, Bundle, and BundleManifest had comments restating what the
type signature already says (AX Principle 2 violation). Replaced with
concrete usage examples showing how each type is constructed and used.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 16:13:16 +01:00
Claude
5a76b5c624
ax(node): replace banned path/filepath import with path in identity.go
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 16:11:32 +01:00
Claude
c9e39451f0
ax(node): replace prose comments with usage examples on debug log vars
Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 16:09:43 +01:00
Claude
9945f2b031
ax(node): replace banned path/filepath import with path in worker.go
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
path/filepath is a banned import per AX conventions; path is the
correct alternative when core.JoinPath is not available in this repo.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 16:08:14 +01:00
Claude
dc2f415fc2
ax(node): rename ttl to timeToLive in MessageDeduplicator
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 field `ttl` requires context to decode; `timeToLive` is
self-describing without a comment.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 14:37:36 +01:00
Claude
22c52c0b70
ax(node): replace prose comment with usage example on chain constants
Some checks failed
Test / test (push) Waiting to run
Security Scan / security (push) Failing after 32s
LetheanDefaults comment restated what the constant block name already says (AX
Principle 2). Replaced with concrete call examples showing GetChainInfo and
DiscoverPools usage against both daemon endpoints.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 14:35:46 +01:00
Claude
237a22e9a5
ax(node): rename single-letter variable u to parsedURL in CheckOrigin
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 variable `u`
in the WebSocket upgrader CheckOrigin closure required context to
understand; `parsedURL` is self-describing.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 14:33:43 +01:00
Claude
7901442c9b
ax(node): rename pr/pr1/pr2 to registry/firstRegistry/secondRegistry in peer_test.go
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. `pr` requires mapping to
PeerRegistry; `registry` is self-documenting on first read.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 14:32:21 +01:00
Claude
ea5996ce40
ax(node): rename ctx→cancelContext/requestContext/shutdownContext
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.
`ctx` is an abbreviation that requires prior knowledge to decode;
renamed to describe intent at each call site.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 14:28:07 +01:00
Claude
4d4ee5dd2a
ax(node): replace prose type comments with usage examples
Some checks failed
Security Scan / security (push) Successful in 34s
Test / test (push) Has been cancelled
AX Principle 2: comments show HOW with real values, not WHAT the
type signature already says. Converted 8 prose-style comments on
type declarations (Transport, TransportConfig, PeerConnection,
PeerRateLimiter, MessageDeduplicator, DisconnectPayload, NodeRole,
NodeIdentity, Peer) to concrete call-site examples.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 14:25:58 +01:00
Claude
906b2c9456
ax(node): rename abbreviated receiver names to full predictable names
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
Replace single-letter receivers (m *Message, e *ProtocolError) and
parameter (v interface{}) with full names (message, protocolError, target)
per AX Principle 1: predictable names over short names.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 14:22:52 +01:00
Claude
2f75ac7c62
ax(node): replace prose PeerRegistry 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 show HOW with real values, not prose that restates the type name.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 14:21:29 +01:00
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