Commit graph

424 commits

Author SHA1 Message Date
Claude
f32bf6f3ba
ax(mining): replace prose comment on NewTaskSupervisor with usage example
AX Principle 2: comments show HOW with real values, not WHAT the
function name already says. All other constructors in the file already
use usage-example comments; NewTaskSupervisor was the outlier.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 10:00:10 +01:00
Claude
60997f79d2
ax(mining): replace prose comments with usage examples on BaseMiner methods
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
GetPath, GetBinaryPath, and Stop had comments that restated what the
signature already said. AX Principle 2: comments show HOW with real
values, not WHAT the type signature already declares.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:58:17 +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
3d310faec7
ax(ueps): replace prose comments with usage examples in MarshalAndSign
Numbered step comments ("2. Calculate HMAC", "3. Write HMAC TLV") and
inline narration violated AX Principle 2 — comments must show concrete
usage, not restate what the code already says.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:58:02 +01:00
Claude
6118522c44
ax(ueps): replace prose rationale comment with usage example
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
MarshalAndSign had a prose comment "We write these first because they
are part of what we sign." — deleted per AX Principle 2 (comments as
usage examples, not prose descriptions). Replaced with a concrete
writeTLV call showing the wire encoding output.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:56:44 +01:00
Claude
ddfd62b8ce
ax(mining): replace prose comments with usage examples in settings_manager
Three comments restated the function/type name in prose (AX principle 2
violation). Replaced with concrete call-site examples showing real usage.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:56:40 +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
9664de2330
ax(mining): replace prose Config comment with usage example
Some checks are pending
Test / test (push) Waiting to run
Security Scan / security (push) Successful in 30s
AX principle 2: comments must show usage with realistic values, not
restate what the type signature already says.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:54:19 +01:00
Claude
9a9be5be2f
ax(ueps): rename TestPacket_NewBuilder_* to TestPacket_NewPacketBuilder_*
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
Test names must match the exact function name (NewPacketBuilder), not an
abbreviated form (NewBuilder). AX principle 1: predictable names over short names.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:51:59 +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
e4144c5f48
ax(mining): replace prose comment with usage example on FetchLatestGitHubVersion
AX Principle 2: comments must show concrete usage, not restate the signature.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:51:39 +01:00
Claude
5cd0e96a6e
ax(ueps): align const block and fix comment spacing in packet.go
Misaligned const tag values and trailing comment spacing violated
gofmt canonical formatting, reducing readability for agents scanning
the TLV tag table.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:51:38 +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
22d67f94c2
ax(mining): replace banned errors import with package error constructors in miner.go
Stop() and WriteStdin() used errors.New() (banned import) instead of the
package's own MiningError constructors. Replaced with ErrMinerNotRunning()
and ErrTimeout() which carry structured codes, HTTP status, and retry hints.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:50:43 +01:00
Claude
61c11cc0ee
ax(mining): replace prose comments with usage examples in events.go
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. Converted all exported function/method prose
descriptions to concrete call-site examples.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:49:06 +01:00
Claude
a565d77b7b
ax(ueps): remove prose step comments from ReadAndVerify per AX Principle 2
Internal numbered step comments (1. Read Tag, 2. Handle Payload Tag, etc.)
restate what the code does rather than showing concrete usage examples.
Per RFC-CORE-008 Principle 2: delete comments that restate what the code
already expresses; keep only usage examples with realistic values.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:48:18 +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
cb44a640cb
ax(mining): rename abbreviated variables b and h to randomBytes and digest in auth.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. Single-letter variables
b (random byte buffer) and h (MD5 digest array) require mental mapping; full
names make intent self-evident without comments.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:46:32 +01:00
Claude
840418c33e
ax(ueps): rename NewBuilder to NewPacketBuilder for AX Principle 1 compliance
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
Ambiguous constructor name required reading the return type to know what
it builds. NewPacketBuilder is self-documenting without context.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:45:23 +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
349f395cc6
ax(mining): replace banned encoding/json import in events.go with package wrapper
Some checks failed
Security Scan / security (push) Successful in 32s
Test / test (push) Has been cancelled
Add UnmarshalJSON wrapper to bufpool.go and route the json.Unmarshal
call in events.go readPump through the package-local wrapper, removing
the direct "encoding/json" import which is banned under AX RFC-025.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:44:40 +01:00
Claude
553f85ac60
ax(mining): rename ratelimiter tests to TestFilename_Function_{Good,Bad,Ugly} pattern
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. Test functions must
follow TestFilename_Function_{Good,Bad,Ugly} with all three categories.
Middleware coverage split across Good/Bad/Ugly; token-refill and stop tests
receive the mandatory suffixes. Comments updated to usage-example form (AX §2).

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:43:12 +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
21b7eb9a93
ax(ueps): test errMissingHMAC path in ReadAndVerify Ugly case
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
TestReader_ReadAndVerify_Ugly previously tested wrong-secret (errIntegrityViolation),
duplicating the Bad case. Replaced with a hand-crafted frame that omits the HMAC TLV,
exercising the errMissingHMAC sentinel that was entirely untested.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:41:48 +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
271f3c2580
ax(mining): replace prose comments with usage examples on BaseMiner history/log accessors
AX Principle 2 — comments show HOW with real values, not WHAT the signature already says.
GetHighResHistoryLength, GetLowResHistoryLength, and GetLogs all had comments that
restated the function name. Replaced with concrete call-site examples showing expected
return ranges and usage patterns.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:40:10 +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
442782a742
ax(ueps): replace prose IntentID 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 must show usage, not restate the name.
"semantic token identifying the packet's purpose" repeats what IntentID
already says — replaced with a concrete value example.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:37:52 +01:00
Claude
76fb616ba9
ax(mining): replace prose comments with usage examples in node_service.go
AX principle 2 — comments must show concrete call-site usage, not restate
the function signature in prose. Four public method comments updated to
show how callers invoke them with realistic values.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:37:23 +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
e3f017aa9b
ax(mining): remove banned strings import from mining.go
Some checks failed
Security Scan / security (push) Successful in 34s
Test / test (push) Has been cancelled
Replace strings.Contains in containsShellChars with a switch-on-rune
loop, matching the style of isValidAlgo already in the same file.
Also adds usage-example comments per AX principle 2.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:35:49 +01:00
Claude
64af8eb468
ax(ueps): remove superfluous payloadBytes intermediate variable
payload was declared via var at the top of ReadAndVerify; the inner
payloadBytes := io.ReadAll + payload = payloadBytes pattern introduced
an unnecessary name that added no semantic value. Assign directly to
the outer payload variable instead.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:35:35 +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
822ac004ea
ax(mining): remove banned fmt import from manager.go
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
Replace all fmt.Sprintf and fmt.Errorf calls with string concatenation
and the existing MiningError constructors (ErrMinerNotFound, ErrMinerExists,
ErrInvalidConfig, ErrInternal, ErrDatabaseError). Adds strconv for integer
formatting. No fmt import remains in the file.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:34:11 +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
df80dbddb5
ax(ueps): rename remaining to payloadBytes for semantic clarity
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
AX Principle 1: names should convey semantic meaning, not implementation
perspective. `remaining` describes a buffer operation; `payloadBytes`
describes what the data IS — the packet payload content.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:32:37 +01:00
Claude
fdc7064e09
ax(mining): replace prose comments with usage examples in container.go
Some checks failed
Test / test (push) Waiting to run
Security Scan / security (push) Has been cancelled
AX Principle 2 — comments as usage examples, not prose descriptions.
NewContainer, Start, and Shutdown had comments restating the signature
("creates a new container", "begins all background services", etc.).
Replaced with concrete call examples showing how to invoke each function.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:31:10 +01:00
Claude
02e60c2ab5
ax(ueps): rename frame1/frame2 to frameWithSecretA/frameWithSecretB
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
Numeric suffixes (frame1, frame2) violate AX principle 1 — predictable
names over short names. Descriptive names make the test intent clear
without reading the assertions.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:29:58 +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
a862480862
ax(mining): replace prose comment on Stop with usage example
AX principle 2: comments show HOW with concrete usage, not WHAT
the signature already says. The old two-line prose comment restated
the function name verbatim; replaced with a defer call example.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:29:25 +01:00
Claude
cc8eeab231
ax(mining): replace prose comments in auth.go with usage examples
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
All comments on AuthConfig, DefaultAuthConfig, AuthConfigFromEnv,
DigestAuth, NewDigestAuth, Stop, Middleware, and all private methods
were restating the type signature in prose. Replaced with concrete
call-site examples per AX Principle 2 (comments as usage examples).

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:29:03 +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
c7c2bd7df9
ax(ueps): rename tag to tagByte in ReadAndVerify loop (AX-1 predictable names)
`tag` is not in the accepted single-letter exception list (i, _, t, c).
`tagByte` is self-describing: the byte value of the TLV tag field.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:27:53 +01:00
Claude
eafd673d13
ax(ueps): replace abbreviated buf with buffer in writeTLV usage example comments
AX Principle 1 — predictable names over short names. Test comments showing
writeTLV usage had buf (abbreviated) while the actual code used buffer
(descriptive). Comments are usage examples that agents learn from; the name
must match what an agent would write.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:26:11 +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
d6c684df4c
ax(mining): replace prose comment on StopMiner 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 what the
signature already says. Prose restating the method signature deleted;
concrete call examples with realistic miner names substituted.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:24:36 +01:00
Claude
db124cff82
ax(ueps): rename expectedMAC to expectedMessageAuthCode
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
MAC is an abbreviation requiring context; expectedMessageAuthCode matches
the established messageAuthCode pattern and is self-describing (AX §1).

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:23:29 +01:00
Claude
865a690853
ax(mining): replace prose comment with usage example on RegisterMiner
AX Principle 2 — comments must show HOW with real values, not describe
WHAT the signature already states.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:23:12 +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
8a4af1634f
ax(ueps): replace non-standard errorA/errorB with idiomatic err
Some checks failed
Test / test (push) Waiting to run
Security Scan / security (push) Has been cancelled
AX Principle 1 — predictable names over short/non-standard names.
errorA and errorB are not ecosystem-standard; err is the correct
name for error variables. Each call now checks err immediately after
capture, matching the established Go and Core convention.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:21:29 +01:00