Commit graph

267 commits

Author SHA1 Message Date
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
Claude
6010f02091
ax(mining): replace prose comments with usage examples in circuit_breaker.go
Three internal method comments restated what the function name already
expressed (AX Principle 2). Replaced with concrete call-site examples
that show how each method is used in context.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:21:25 +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
b0a39b9c71
ax(ueps): replace errors.Is usage example with direct equality check
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
Comment was teaching agents to use the banned errors package.
Direct sentinel comparison (err == errTLVValueTooLarge) is correct.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:19:37 +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
0e6290f703
ax(mining): replace prose comment on SetEventHub with usage example
Some checks are pending
Test / test (push) Waiting to run
Security Scan / security (push) Successful in 31s
Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:19:01 +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
c39c9b9ff8
ax(mining): replace prose comments with usage examples on Container
Some checks failed
Security Scan / security (push) Has been cancelled
Test / test (push) Has been cancelled
AX Principle 2 — comments must show HOW with real values, not restate
what the type signature already says. The Container struct comment and
Initialize method comment both described what the code does in prose;
replaced with concrete call-site examples.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:17:40 +01:00
Claude
5f9e74b573
ax(ueps): replace error-path comment on ReadAndVerify with happy-path usage example
Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:17:26 +01:00
Claude
649f57e91e
ax(mining): replace prose comment on StartMiner 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 signature already says.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:15:55 +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
b4dc3e6948
ax(mining): replace prose comment on NewManagerForSimulation with usage example
AX Principle 2: comments must show HOW with real values, not restate what
the type signature already says. Replaced description prose with a concrete
call pattern showing ctx + Config.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:13:26 +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
501d7ecf11
ax(ueps): rename length/lengthByte to tagLength/tagLengthByte
AX Principle 1 — Predictable Names Over Short Names: `length` and
`lengthByte` are too generic for the TLV parsing context. Renamed to
`tagLength` and `tagLengthByte` so the variable names are
self-describing at read time.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:13:08 +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
8066610192
ax(ueps): remove prose comment that restated intent without a usage example
AX Principle 2: "If a comment restates what the type signature already says,
delete it." The "Store for processing" comment above the switch statement added
no information — the switch itself communicates that action.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:11:32 +01:00
Claude
301a5428b0
ax(mining): replace prose comment with usage example on findAvailablePort
AX Principle 2 — comments must show HOW with real values, not restate
what the function name already says.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:11:24 +01:00
Claude
8e9f18ac3e
ax(mining): replace prose struct comment with usage example on CircuitBreaker
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
type already says in its name.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:08:29 +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
11cbfd5107
ax(ueps): replace prose claim with usage-example comment in MarshalAndSign_Ugly
Some checks failed
Test / test (push) Waiting to run
Security Scan / security (push) Has been cancelled
TestPacket_MarshalAndSign_Ugly commented "modifying any byte breaks HMAC
verification" (prose description) but never called ReadAndVerify to prove it.
Replaced with a usage-example comment and an actual ReadAndVerify call that
asserts errIntegrityViolation is returned — AX Principle 2.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:07:22 +01:00
Claude
cc829d1bc8
ax(mining): rename wg to waitGroup in collectMinerStats
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. `wg` requires
domain knowledge to decode; `waitGroup` is self-documenting.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:06:48 +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
9dea4d6ac4
ax(ueps): replace errors.Is usage examples with direct sentinel comparison
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
AX Principle 2 requires comments to show correct usage patterns.
errMissingHMAC and errIntegrityViolation are tlvError sentinels (comparable
values), so the examples should use == not errors.Is from the banned errors
package.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:05:29 +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
1ad014e71c
ax(mining): replace prose comments with usage examples in repository.go
Three comments on Path, Exists, and Delete restated what the signatures
already convey. Replaced with concrete call examples per AX Principle 2.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:04:34 +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
599603e2f4
ax(mining): replace prose comment with usage example on FetchJSONStats
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 old comment restated the function's
prose description; replaced with a concrete call site example.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:03:17 +01:00
Claude
69c61cc74a
ax(ueps): rename err1/err2 to errorA/errorB per AX predictable-names principle
Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:03:12 +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