# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/).

## [Unreleased]

## [0.5.0] - 2026-03-24

### Added
- `snmpv3 trap listen` command — blocking SNMPv3 trap receiver using pysnmp v7's asyncio transport (#1)
- `TrapReceived` TypedDict (`host`, `timestamp` UTC ISO-8601 with Z suffix, `varbinds`) exported from package
- `print_trap_received()` streaming formatter: Rich table output or JSON newline-delimited (`--format json`)
- Auto-loads all saved profiles when no credentials are specified; falls back to inline credentials when provided
- Robust error handling: port bind failures, malformed varBinds, per-profile load errors (warns and skips)

## [0.4.1] - 2026-03-23

### Fixed
- `snmpv3 trap send` and `snmpv3 trap stress` now correctly default to port 162 instead of 161 (#39)

## [0.4.0] - 2026-03-22

### Added
- `-v` (verbose/INFO) and `-vv` (debug/DEBUG) flags for all CLI commands (#36)
- New `debug.py` module with `configure_logging()` for structured log levels and `translate_error()` for actionable SNMP error hints
- Core modules emit `logger.info()`/`logger.debug()` messages for SNMP operations
- `-vv` enables pysnmp internal debug logging for deep protocol inspection

## [0.3.3] - 2026-03-22

### Fixed
- Added `cryptography` as a runtime dependency — pysnmp requires it for all privacy protocols (DES, AES128, AES256) but does not declare it, causing "Ciphering services not available" errors on any `authPriv` operation (#33)

## [0.3.2] - 2026-03-22

### Fixed
- `resolve_credentials()` errors (bad profile name, invalid enum) now show clean error messages instead of raw Python tracebacks (#27)
- Auth/priv keys shorter than 8 characters now raise a clear `ValueError` instead of pysnmp's cryptic `WrongValueError` with raw OID bytes (#29)

## [0.3.1] - 2026-03-22

### Fixed
- Empty SNMPv3 username now raises a clear error instead of cryptic pysnmp `SnmpAdminString` constraint traceback (#25)
- All CLI commands validate credentials before attempting SNMP operations

## [0.3.0] - 2026-03-22

### Added
- `snmpv3 trap stress <host>` command for high-volume trap load testing (#4)
- Async orchestrator with `asyncio.gather`, semaphore-based concurrency control, and rate limiting
- Count mode (`--count N`) and duration mode (`--duration N` seconds)
- Rich progress bar with real-time rate display
- JSON summary output with `--format json`
- `StressResult` TypedDict for structured stress test results
- `stress_progress()` context manager in `output.py` for progress display
- `docs/architecture.md` as lasting architecture reference

### Fixed
- Duration mode with `rate=0` no longer creates unbounded tight loop (#19)
- Stress error output now shows meaningful message instead of raw dict (#20)
- `pytest-asyncio` moved to correct dependency group (#21)
- Architecture docs and module docstrings updated for new functions (#22, #24)
- Stress command handles `KeyboardInterrupt` gracefully (#23)

## [0.2.0] - 2026-03-21

### Changed
- Refactored all SNMP operations to async internals (`_get`, `_getnext`, `_walk`, `_bulk`, `_set_oid`) with `_*_with_transport` wrappers; public sync API unchanged
- `bulk_check` now runs credential checks in parallel via `asyncio.gather()` with a shared engine and transport
- Removed sync wrappers (`getCmd`, `nextCmd`, `setCmd`, `walkCmd`, `bulkCmd`) and `_transport` helper

### Added
- `max_concurrent` parameter on `bulk_check` (default 10, `None` = no limit) for concurrency control via `asyncio.Semaphore`
- `_parse_row_to_usm` helper for testable CSV row parsing
- `_check_creds_async` for async single-credential verification
- Transport failure and exception path tests for query and auth modules

### Fixed
- `_walk` now wraps async iteration in `try/except` consistent with other SNMP operations
- `asyncio.gather` uses `return_exceptions=True` so one task failure doesn't destroy all results
- CSV file is read once in `_bulk_check_async` instead of potentially twice
- `max_concurrent` validated to be a positive integer or `None`

## [0.1.1] - 2026-03-21

### Fixed
- Fix stale `_build_usm` docstring in `cli/_options.py` (#9)
- Use `TYPE_CHECKING` guard for `UsmUserData` import in `cli/_options.py` (#11)
- Re-export `UsmUserData` from `security.py` to maintain architecture boundary
- Replace TOCTOU file check with `try/except` in auth bulk CLI (#12)
- Widen error handling in `auth bulk` to catch `PermissionError`, `IsADirectoryError`, and `csv.Error`

### Changed
- Expand allowed commit prefixes to include `refactor:` and `style:` (#10)
- Allow `fix/`, `docs/`, `chore/` branch name prefixes in addition to `feat/`

### Added
- Test coverage for `auth bulk` CLI command (file-not-found and success paths)

## [0.1.0] - 2026-03-20

### Added
- Initial release with full SNMPv3 query, trap, and credential testing support
- `snmpv3 query` — GET, GETNEXT, WALK, BULK, SET
- `snmpv3 trap` — send (trap + inform), listen (stub, asyncio pending)
- `snmpv3 auth` — single credential check, bulk CSV check
- `snmpv3 profile` — add, delete, list, show profiles
- Full SNMPv3 security matrix: noAuthNoPriv, authNoPriv, authPriv
- Auth protocols: MD5, SHA1, SHA256, SHA512
- Priv protocols: DES, AES128, AES256
- Credential resolution: defaults → .env → profile → CLI flags
- Rich and JSON output via `--format` flag
