Commit graph

65 commits

Author SHA1 Message Date
Claude
4cd24158eb
ax(ueps): replace prose comment with usage example on default tag case
AX Principle 2: comments must show usage, not describe intent in prose.
The default switch branch comment was prose-first; rewritten as a
concrete call-site example that shows what the code does and why.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 10:16:38 +01:00
Claude
aae2734273
ax(ueps): replace prose section label with usage example on const block
// TLV Types restated what Tag* names already made obvious (AX §2 violation).
Replace with a concrete usage example showing the three-tag write sequence.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 10:14:50 +01:00
Claude
3ba5080234
ax(ueps): replace prose field comments with usage examples on UEPSHeader
CurrentLayer and TargetLayer had prose descriptions restating the field
names. AX Principle 2 requires comments to show concrete usage with real
values, not restate what the type signature already says.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 10:11:26 +01:00
Claude
ba4c5398b1
ax(ueps): replace prose comment with usage example in MarshalAndSign test
AX Principle 2 — comments show HOW with real values, not prose describing
what the code does. "Verify each expected tag is present in the frame"
restated intent with zero new information; replaced with a concrete call
showing the bytes.Contains check and the expected result.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 10:08:51 +01:00
Claude
57fff3ddd2
ax(ueps): rename buffer to frameBuffer in MarshalAndSign (AX Principle 1)
Generic name "buffer" violates predictable-names-over-short-names.
"frameBuffer" names the thing by what it holds.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 10:06:27 +01:00
Claude
c8edfee8ae
ax(ueps): add usage-example comment on default HMAC coverage path
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
AX Principle 2 — comments as usage examples. The default switch case in
ReadAndVerify silently included unknown extension tags in signedData with
no explanation of why; added a concrete comment showing the pattern and
the security rationale (tag-injection prevention).

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 10:04:01 +01:00
Claude
794a584766
ax(ueps): replace prose comment with usage example in writeTLV
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
AX principle 2 requires comments to show HOW via concrete examples,
not describe WHAT the code does in prose.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 10:01:06 +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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
7aada5fc78
ax(ueps): remove duplicate inline usage comment from ReadAndVerify body
AX-2 violation: usage examples belong at the declaration site, not
scattered inside function bodies. The errIntegrityViolation usage hint
was already present at the variable declaration (line 17) and was
duplicated inside ReadAndVerify, creating noise in the implementation.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 09:01:28 +01:00
Claude
ddb62cb269
ax(ueps): use full variable name in TagHMAC and TagPayload comments
AX Principle 1 — predictable names over short names. Comments showing
usage examples must use the same full names as the implementation:
'buffer' not 'buf'.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 08:58:53 +01:00
Claude
9779caa10e
ax(ueps): remove prose comments inside ReadAndVerify that restate implementation
AX Principle 2: comments show usage, not prose descriptions of what the code
does. The two inline comments in ReadAndVerify described buffer reconstruction
in words rather than showing a call — deleted per RFC-025 §2.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 08:57:10 +01:00
Claude
f4dbfcc251
ax(ueps): rename generic 'result' to 'encodedTLV' in writeTLV tests
AX Principle 1 — predictable names over short names. 'result' does not
describe what it holds; 'encodedTLV' names the TLV-encoded byte slice
exactly, matching the function under test.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 08:55:11 +01:00
Claude
06d8878528
ax(ueps): replace prose constant comments with usage examples
TagHMAC and TagPayload had inline prose comments ("The Signature",
"The Data") that restated what the names already convey. Replace
with concrete call-site examples per AX Principle 2.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 08:52:49 +01:00
Claude
de6e4d019f
ax(ueps): rename value to tagValue in ReadAndVerify loop
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 generic
local variable `value` required surrounding context to understand;
`tagValue` is self-documenting at every read site in the switch.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 08:50:53 +01:00
Claude
dae27bb10b
ax(ueps): remove surviving prose fragment from MarshalAndSign_Ugly comment
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 08:49:53 +01:00
Claude
0c4cf1f7c3
ax(ueps): strip 11 prose test comments that restate function names
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
Test names encode intent — prose descriptions add zero information.
Per AX-2: if comment restates the signature, delete it.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 08:48:01 +01:00
Claude
e65057e8af
ax(ueps): rename buf→buffer in usage example comments
Some checks failed
Test / test (push) Waiting to run
Security Scan / security (push) Has been cancelled
Abbreviated names in comments teach agents bad patterns.
AX Principle 1 applies to usage examples too.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 08:37:35 +01:00
Claude
58e1c23f0c
ax(ueps): replace prose threat comment with error-handling usage example
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 08:33:58 +01:00
Claude
9dbde075b2
ax(ueps): remove prose description from TestReader_ReadAndVerify_Good comment
AX Principle 2 — comments must be usage examples, not prose descriptions.
The leading "verifies a well-formed signed frame" line restated the test
name without adding information; the usage example below it was sufficient.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 08:30:33 +01:00
Claude
e0e80e990b
ax(ueps): strip 7 lines of implementation prose from MarshalAndSign
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
Replaced descriptive rationale with 2-line factual comment + byte layout example.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 08:29:22 +01:00
Claude
6704ac781c
ax(mining): replace prose comments with usage examples in settings_manager.go
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
Seven setter/getter comments restated the function signature rather than
showing a concrete call (AX Principle 2). Replaced all with real invocation
examples so agents know exactly how to call each method.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 08:26:55 +01:00
Claude
40b57849ff
ax(ueps): fix tlvError comment to show type usage, not sentinel usage
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
The comment was a duplicate of errTLVValueTooLarge's example.
Fixed to show how tlvError defines new sentinels.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 08:25:01 +01:00
Claude
3aa83c3e2b
ax(ueps): remove prose line from tlvError comment, keep usage example
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 08:23:19 +01:00
Claude
0d9071d528
ax(ueps): replace prose errTLVValueTooLarge comment with usage example
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 08:20:47 +01:00
Claude
9ad8808d08
ax(ueps): replace prose sentinel error comments with usage examples
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
errMissingHMAC and errIntegrityViolation comments were prose
descriptions. Replaced with errors.Is() usage patterns.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 08:18:04 +01:00
Claude
d6f69faf6b
ax(ueps): replace errors import in reader.go with tlvError sentinels
Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 08:13:57 +01:00
Claude
72d85986c6
ax(ueps): add reader_test.go with Good/Bad/Ugly coverage for ReadAndVerify
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
One test file per source file is mandatory per AX conventions. reader.go
had no corresponding test file — this adds the three required test cases
covering valid round-trip, tampered frame rejection, and wrong-secret rejection.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 08:11:05 +01:00
Claude
d709b2125c
ax(node): expand abbreviated mutex field name per AX Principle 1
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
Renamed `allowedPublicKeyMu` to `allowedPublicKeyMutex` in PeerRegistry.
`Mu` is an abbreviation that violates AX Principle 1 (predictable names
over short names) — the full word `Mutex` removes any ambiguity about
what the field represents.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 08:08:48 +01:00
Claude
82e52fb058
ax(ueps): rename parameter r to reader in ReadAndVerify
Some checks failed
Security Scan / security (push) Successful in 36s
Test / test (push) Has been cancelled
Single-letter parameter not in AX exception list.
r→reader across function signature and 4 call sites.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 08:04:28 +01:00