Commit graph

134 commits

Author SHA1 Message Date
Claude
f8d3ee8c98
ax(ueps): name magic secret literals in NewPacketBuilder tests
Some checks failed
Test / test (push) Waiting to run
Security Scan / security (push) Has been cancelled
TestPacket_NewPacketBuilder_Bad and _Ugly used inline []byte("secret")
literals; extracted to sharedSecret variable per AX Principle 1
(predictable names over magic literals).

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 14:12:18 +01:00
Claude
74f310b10c
ax(ueps): rename reader to frameReader in ReadAndVerify tests
AX Principle 1 — predictable names over short names.
The variable reader is ambiguous; frameReader states
exactly what is being read.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 14:09:28 +01:00
Claude
35342e2349
ax(ueps): align comment examples with predictable variable names
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
Use sharedSecret in doc-comment examples to match actual test body
variable names — resolves AX principle 1+2 violation where comment
examples used the abbreviated form secret while code used sharedSecret.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 14:07:29 +01:00
Claude
6df2566acb
ax(ueps): include method name in sentinelError test names
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
TestFilename_Function_{Good,Bad,Ugly} requires the function being
tested, not just the type name. sentinelError tests exercise the
.Error() method so names must be TestPacket_sentinelError_Error_*.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 14:02:58 +01:00
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
316049d3ae
ax(ueps): make Bad test comment a self-contained usage example
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
TestReader_ReadAndVerify_Bad referenced `frame` without defining it in
the comment block, leaving an agent without enough context to understand
the setup. Replace with a complete, standalone snippet showing frame
construction, corruption, and the expected error outcome.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 13:58:30 +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
ea40c035b5
ax(ueps): expand MarshalAndSign comment to full usage example with error handling
AX Principle 2: comments show concrete usage with realistic values, not
minimal call-site only. Single-line comment omitted error handling and
downstream use — now shows the complete call pattern.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 13:45:50 +01:00
Claude
45da2e4e88
ax(ueps): fix writeTLV comment to match actual parameter name
Comment examples used 'buffer' but the parameter is named 'writer' —
the example was not a valid call site. AX Principle 2 requires comments
to show concrete, accurate usage with real values.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 13:38:31 +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
37bd7b8855
ax(ueps): replace placeholder name with concrete value in errTLVValueTooLarge comment
AX Principle 2: comments must show HOW with real values, not placeholder names.
`oversized` is a non-executable placeholder; `bytes.Repeat([]byte("x"), 256)` is
the concrete call that produces the error, matching the example already used in
the writeTLV body comment.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 13:35:03 +01:00
Claude
84d0515974
ax(ueps): add field-level usage example comments to PacketBuilder
PacketBuilder.Header and .Payload lacked inline usage comments,
inconsistent with the pattern established by UEPSHeader fields.
AX Principle 2 requires comments as usage examples, not prose.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 13:30:29 +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
e0ed9048a1
ax(ueps): replace prose arrow comment with usage example on messageAuthCode
Comment "→ covers all header TLVs before the HMAC tag" was prose
describing effect rather than showing usage with concrete values,
violating AX Principle 2 (comments as usage examples, not descriptions).
Replaced with a full usage example showing all three messageAuthCode calls.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 13:19:43 +01:00
Claude
a212d1c5f0
ax(ueps): rename single-letter sentinel test variables to descriptive names
Variables e, a, b violate AX Principle 1 (predictable names over short names).
Renamed to sentinel, sentinelFirst, sentinelSecond across test functions and
the usage-example comment in packet.go.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 13:16:32 +01:00
Claude
2dcdc48a68
ax(ueps): add missing sentinelError.Error() Good/Bad/Ugly tests
TestPacket_sentinelError_{Good,Bad,Ugly} were absent — AX requires all
three test categories for every exported and package-level function.
The Error() method on sentinelError had no direct coverage.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 13:13:39 +01:00
Claude
413d735abf
ax(ueps): replace duplicate usage comment on sentinelError type
The comment on `sentinelError` restated the `errTLVValueTooLarge`
declaration directly above it (AX principle 2 violation). Replaced
with a distinct concrete example showing how to define any sentinel
of this type.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 13:10:42 +01:00
Claude
a84d999984
ax(ueps): replace fictional sentinel example with concrete package sentinel
AX Principle 2 — comments must show realistic usage with actual values from
the codebase, not placeholder examples. The sentinelError type comment used
errNotFound (a fictional variable) instead of errTLVValueTooLarge (the actual
sentinel declared on the next line).

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 13:09:47 +01:00
Claude
00d0e5ed96
ax(ueps): replace variable placeholder with concrete value in writeTLV usage comment
AX Principle 2 requires comments to show concrete usage with realistic values.
The writeTLV comment used `intentID` (a variable name) as a placeholder
rather than a real value; replaced with `0x01` and added error-capture
pattern to show the full call site shape.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 13:07:53 +01:00
Claude
b8d7216905
ax(ueps): fix AX-2 violation in TestReader_ReadAndVerify_Bad — add errIntegrityViolation sentinel check
Comment described assertion in prose ("integrity violation" in error message) rather
than showing the concrete sentinel pattern. Test also failed to verify err identity
consistently with TestReader_ReadAndVerify_Ugly and packet_test.go error tests.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 13:04:43 +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
7abfc54b3f
ax(ueps): add usage-example comment to sentinelError.Error method
AX-2 — the Error() method on sentinelError had no comment; added a
concrete call-and-result example so an agent can understand the
sentinel identity contract without tracing the type definition.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 12:59:05 +01:00
Claude
fdbfbabe87
ax(ueps): add usage-example comment to sentinelError type
sentinelError had no comment, violating AX Principle 2 (comments as
usage examples). Added a concrete call-site example showing sentinel
identity comparison pattern.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 12:55:51 +01:00
Claude
f0d988b980
ax(ueps): fix writeTLV comment to use frameBuffer matching actual callers
AX Principle 2: usage example comments must show realistic call sites.
The writeTLV header comments used `buffer` as the first argument name,
but the parameter is `writer` and all callers pass `frameBuffer`.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 12:53:25 +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
c20670f062
ax(ueps): remove double-slash comment prefix violating AX Principle 2
Some checks failed
Test / test (push) Successful in 4m40s
Security Scan / security (push) Failing after 12m22s
Test doc-comments used `// //` to prefix expected-result lines, producing
comments-within-comments rather than clean usage examples. Strip the
redundant inner `//` so all lines read as plain code-example comments.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 12:25:45 +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
0a30a45b7d
ax(ueps): add usage-example comments to exported tag constants
Some checks failed
Security Scan / security (push) Successful in 30s
Test / test (push) Has been cancelled
TagCurrentLayer, TagTargetLayer, TagIntent, and TagThreatScore were
exported constants with no comment, violating AX Principle 2 (comments
as usage examples). Each now has a concrete writeTLV call showing the
tag, value encoding, and valid range where relevant.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 12:13:50 +01:00
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