Commit graph

53 commits

Author SHA1 Message Date
Claude
61c45810ba
ax(ueps): rename header to packetHeader for AX Principle 1 compliance
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
Generic name `header` replaced with `packetHeader` throughout ReadAndVerify
to satisfy AX predictable-names-over-short-names; the name now conveys what
is being built without requiring context from the surrounding function.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 14:01:08 +01:00
Claude
7f02b47445
ax(ueps): rename tagLengthByte to tagLength — type suffix violates AX Principle 1
Variable name tagLengthByte encoded its type (byte) rather than its role
(the length field of a TLV record). AX Principle 1: names must be semantic,
not type-annotated. tagLength is unambiguous without the redundant Byte suffix.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 13:59:57 +01:00
Claude
be6f915ac5
ax(ueps): rename tagValueLength to tagLengthByte to signal byte type
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
Variable named tagValueLength implied int semantics but held a byte
value from ReadByte(); AX Principle 1 requires names that are
unambiguous without comments — tagLengthByte makes the type explicit
and the int(tagLengthByte) cast at make() call site clarifies the
byte→int conversion for agent readers.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 13:53:22 +01:00
Claude
7664917fc2
ax(ueps): group related var declarations into a single block
Four separate var statements in ReadAndVerify consolidated into a
var () block — more declarative and AX principle #5 compliant.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 13:37:05 +01:00
Claude
41761823d3
ax(ueps): expand ReadAndVerify comment to show error sentinel branches
AX Principle 2 — comments as usage examples: the ReadAndVerify doc
comment only showed the success path; both errMissingHMAC and
errIntegrityViolation sentinel branches are now illustrated so callers
can copy-paste correct dispatch logic.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 13:28:59 +01:00
Claude
4bca7bcced
ax(ueps): remove prose from Payload field comment, keep usage example only
AX Principle 2: comments show usage examples, not descriptions.
The trailing "raw bytes after the 0xFF payload tag" restated what
the tag constant already communicates — deleted.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 13:25:00 +01:00
Claude
5918ac3f1e
ax(ueps): add field-level usage example comments to ParsedPacket
ParsedPacket.Header and ParsedPacket.Payload lacked inline comments
showing concrete values, violating AX Principle 2 (comments as usage
examples). UEPSHeader had per-field examples; ParsedPacket now matches.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 13:21:38 +01:00
Claude
bec37d0a84
ax(ueps): use var declaration for header in ReadAndVerify
Replaces `header := UEPSHeader{}` with `var header UEPSHeader` for
consistency with the surrounding zero-value var declarations in the
same block — predictable, uniform pattern over mixed init styles.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 13:02:14 +01:00
Claude
222edcd070
ax(ueps): rename uepsError to sentinelError — redundant package prefix on private type
The type name uepsError used the package abbreviation as a prefix, which
adds no semantic value inside the ueps package and violates AX Principle 1
(predictable names over short names). sentinelError names what the type IS:
an immutable, comparable error value.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 12:50:34 +01:00
Claude
0785f4fcf8
ax(ueps): rename packetError to uepsError for package-scoped clarity
The type was named packetError but also used in reader.go for reader-side
sentinel errors (errMissingHMAC, errIntegrityViolation). The name implied
packet-only scope, misleading agents reading reader.go. uepsError names the
type after the package it belongs to, matching AX principle 1.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 12:47:43 +01:00
Claude
dc9d7d5041
ax(ueps): remove redundant comment restating code in default switch case
AX Principle 2 — comments must show usage examples, not restate what
the code already says. The inline comment in the default branch of
ReadAndVerify's tag-switch duplicated the three lines beneath it verbatim,
adding zero information.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 12:43:23 +01:00
Claude
be4d388860
ax(ueps): fix inaccurate default-case comment in ReadAndVerify
Comment showed Write([]byte{...}) but code uses WriteByte — misleading
concrete example violates AX Principle 2 (comments as accurate usage examples).

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 12:31:03 +01:00
Claude
067a4c38f8
ax(ueps): rename signedData to hmacInputBuffer for predictable naming
Some checks failed
Test / test (push) Waiting to run
Security Scan / security (push) Has been cancelled
signedData was ambiguous — it did not convey that the buffer holds
accumulated header TLVs fed as input to HMAC, nor whether data was
already signed or pending signing. hmacInputBuffer makes the purpose
unambiguous on first read (AX Principle 1: predictable names over
short names).

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 12:21:22 +01:00
Claude
6cc373051f
ax(ueps): fix misleading errIntegrityViolation comment and message
All checks were successful
Security Scan / security (push) Successful in 35s
Test / test (push) Successful in 4m24s
The comment said "threat score incremented" and the error string said
"(ThreatScore +100)" but ReadAndVerify never mutates ThreatScore — it
only returns an error. Updated the comment to show the caller's
responsibility (header.ThreatScore += 100) and removed the parenthetical
from the error string.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 11:54:45 +01:00
Claude
d54d576546
ax(ueps): replace prose comment on ParsedPacket with usage example
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
AX Principle 2 requires comments to show concrete usage, not describe
behaviour. The old comment restated when fields are populated; the new
comment shows the dispatch call an agent would make after ReadAndVerify.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 11:48:43 +01:00
Claude
fe074699ad
ax(ueps): remove duplicate usage-example comment on ParsedPacket
AX Principle 2 — comments as usage examples, not restatements.
ParsedPacket carried the identical dispatch example twice: once above
the type and again above ReadAndVerify. The type-level copy added no
new information; replaced with a field-reference note that describes
what the struct exposes without duplicating the call-site example.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 11:46:29 +01:00
Claude
559e63b0a9
ax(ueps): replace blank-identifier discards with realistic dispatch example
ParsedPacket comment used `_ = packet.Header.IntentID` — a discard
pattern that is not a realistic usage example (AX-2 violation). Replaced
with `dispatch(packet.Header.IntentID, packet.Header.ThreatScore, packet.Payload)`
to show how callers actually consume the parsed packet fields.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 11:43:53 +01:00
Claude
b846e1f895
ax(ueps): rename tlvError to packetError for AX Principle 1 compliance
tlvError used an abbreviated subsystem name (tlv = Type-Length-Value),
requiring domain knowledge to decode. packetError is self-describing
from the path alone, matching the AX rule: predictable names over short names.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 11:10:44 +01:00
Claude
8d9606c2d8
ax(ueps): replace prose comment with usage example in ReadAndVerify default case
Per AX Principle 2, comments must show concrete usage, not describe intent.
The `default:` branch comment now demonstrates the write calls rather than
explaining what they protect against.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 11:03:35 +01:00
Claude
b64ce31f69
ax(ueps): replace code-restatement comment with semantic explanation
Some checks failed
Test / test (push) Waiting to run
Security Scan / security (push) Has been cancelled
The default switch-case comment in ReadAndVerify restated the three
lines immediately following it verbatim, violating AX Principle 2
(comments as usage examples, not code descriptions). Replaced with a
single line explaining the security intent of the behaviour.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 10:58:52 +01:00
Claude
813cf2d632
ax(ueps): rename tagByte to tagType for semantic clarity
Some checks failed
Test / test (push) Waiting to run
Security Scan / security (push) Has been cancelled
tagByte described the storage type (a byte), not the purpose. All
constants in the package use Tag* naming (TagVersion, TagPayload, etc.)
so the loop variable should match: tagType aligns with the domain
vocabulary and satisfies AX Principle 1 (predictable names over short
names).

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 10:55:02 +01:00
Claude
80b8b20507
ax(ueps): fix inaccurate usage example in ReadAndVerify default case
The comment omitted tagValueLength from the signedData write sequence,
making it an incorrect usage example (AX Principle 2).

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 10:41:54 +01:00
Claude
0ab8c0fe7d
ax(ueps): remove redundant err shadow in ReadAndVerify payload branch
The inner scope re-declared `var err error` immediately before assigning
from `io.ReadAll`, unnecessarily shadowing the `err` already in scope from
`reader.ReadByte()`.  Removing the shadow simplifies the control flow and
eliminates the redundant declaration (AX Principle 1 — names should not
introduce unnecessary cognitive overhead).

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 10:39:30 +01:00
Claude
2f2d863bed
ax(ueps): fix comment in reader.go default case to use real variable name
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
The default switch case comment referenced `unknownTag` which does not
exist in scope; the actual variable is `tagByte`. AX Principle 2 requires
comments to show real, runnable examples — not invented identifiers.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 10:27:40 +01:00
Claude
092aaf4870
ax(ueps): rename tagLengthByte/tagLength to tagValueLength
AX Principle 1 — the `Byte` suffix encodes storage type not semantics,
and the intermediate `tagLength` variable was an immediate int cast of
`tagLengthByte` with no additional meaning. Collapsed to a single
`tagValueLength` variable that names what it is, not how it is stored.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 10:25:39 +01:00
Claude
729ad75d6f
ax(ueps): rename signature to hmacSignature for AX Principle 1 compliance
Some checks failed
Security Scan / security (push) Successful in 31s
Test / test (push) Has been cancelled
The variable name `signature` is ambiguous — any cryptographic operation
produces a signature. `hmacSignature` is unambiguous and self-describing,
consistent with the TagHMAC comment that already used `hmacSignature` as
the example parameter name.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 10:22:18 +01:00
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Claude
577775cbf8
ax(ueps): rename h→header and p→packet in usage example comments
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
Single-letter variables in comments teach bad habits to agents.
Usage examples must use predictable names matching AX principle 1.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 08:00:43 +01:00
Claude
8a4010f4a5
ax(ueps): remove banned fmt import, use errors.New
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
fmt.Errorf with static string replaced by errors.New.
Removes banned import per AX RFC-025.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 07:48:46 +01:00
Claude
59d8ad388e
ax(ueps): rename mac to messageAuthCode (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 07:46:09 +01:00
Claude
9949942ff5
ax(ueps): replace ParsedPacket field-list 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 07:31:38 +01:00