Skip to content

P3: API / SemVer cleanups before 1.0 - #26

Merged
stakach merged 6 commits into
spider-gazelle:masterfrom
n-rodriguez:feat/p3-api
Jul 12, 2026
Merged

P3: API / SemVer cleanups before 1.0#26
stakach merged 6 commits into
spider-gazelle:masterfrom
n-rodriguez:feat/p3-api

Conversation

@n-rodriguez

Copy link
Copy Markdown
Contributor

The P3 (API / SemVer) group from the audit (#7) — small public-contract cleanups to settle before 1.0. One commit per item.

Commits

  1. feat(pdu): value returns the value, add a varbind accessorPDU#value / Message#value returned the VarBind, contradicting their # shortcut for .varbinds[0].value doc. They now return the value BER; new #varbind returns the VarBind. ⚠️ Breaking.
  2. docs(v3): clarify engine_id vs community — document that engine_id is the v3 accessor and community is only mirrored for SNMP::Message compatibility.
  3. refactor: drop the dead, v3-broken build_reply — it had no callers and its self.class.new signature never matched V3::Message.new. ⚠️ Removes a public method (unused).
  4. docs: document the three parse entry pointsSNMP.parse (factory), Session#parse (v2c), V3::Session#parse (v3); their signatures are already aligned, the differences are intentional and now documented.
  5. refactor(client): add return-type restrictions to host/timeout/portgetter host : String, timeout/port : Int32.
  6. refactor(client): extract build_socket, dedup socket setup — the two constructors and with_socket shared the same socket-setup lines.

Breaking changes (pre-1.0)

  • PDU#value / Message#value now return the ASN1::BER value, not the VarBind (use #varbind for that).
  • Message#build_reply removed.

Tests

value_accessors_spec covers the new value/varbind semantics; the rest are doc/refactor with no behaviour change, guarded by the full suite. Deterministic 82/82, multi-threaded 82/82, legacy 3/3, ameba clean, format clean; commits bisect-clean.

Tracked in #7.

🤖 Generated with Claude Code

n-rodriguez and others added 6 commits July 12, 2026 04:10
PDU#value / Message#value returned the VarBind, contradicting their own "shortcut
for .varbinds[0].value" doc. Make them return the value BER and add #varbind for
the VarBind itself.

- pdu, message: value => varbinds[0].value; new varbind => varbinds[0]
- client: walk uses msg.varbind.end_of_mib_view? (was msg.value)
- spec: value_accessors_spec

BREAKING: PDU#value / Message#value now return the ASN1::BER value, not the VarBind.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
In SNMPv3 the engine id plays the community's role; document that engine_id is
the accessor to use and that community is only kept in sync for SNMP::Message
compatibility.

- v3/message: doc on engine_id / community

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
build_reply had no callers and its self.class.new signature does not match
V3::Message.new, so it was broken for v3. Remove it; reintroduce properly if an
agent-side reply API is ever needed.

- message: remove build_reply

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
SNMP.parse (version-dispatching factory), Session#parse (v2c) and
V3::Session#parse (v3, verifies + checks timeliness) are intentionally distinct;
document each role and the security-parameter conventions.

- snmp, session, v3/session: doc on parse

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- client: getter host : String / timeout : Int32 / port : Int32

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Both constructors and with_socket built and configured the UDP socket with the
same three lines. Extract build_socket.

- client: private build_socket; used by both initializers and with_socket

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@stakach
stakach merged commit 4ea4bf5 into spider-gazelle:master Jul 12, 2026
6 checks passed
@n-rodriguez
n-rodriguez deleted the feat/p3-api branch July 21, 2026 08:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants