Skip to content

Feature/sma 107 audit log operator docs readme final cleanup#212

Open
mrnkslv wants to merge 41 commits into
feature/sma-99-audit-log-architecturefrom
feature/sma-107-audit-log-operator-docs-readme-final-cleanup
Open

Feature/sma 107 audit log operator docs readme final cleanup#212
mrnkslv wants to merge 41 commits into
feature/sma-99-audit-log-architecturefrom
feature/sma-107-audit-log-operator-docs-readme-final-cleanup

Conversation

@mrnkslv

@mrnkslv mrnkslv commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Add docs/audit-log.md — a new operator-facing reference for the nodectl
audit log subsystem. Covers:

  • What the audit log is and how it differs from the tracing service log
  • Event types and event schema (id, ts, outcome, event_type, data, actor, target)
  • File layout: audit.jsonl + rotated .1–.9 files, header line format
  • Full AuditLogConfig reference table with actual defaults from code
    (enabled, path, max_size_bytes, max_files, batch_interval_ms,
    batch_max_events, queue_capacity, queue_full_timeout_ms, fsync_on_batch,
    include_payload, record_client_ip, ip_anonymize, ring_buffer_capacity)
  • Durability semantics: fsync_on_batch, what is lost on hard kill
  • PII and retention: three record_client_ip / ip_anonymize modes
  • File permissions (0600) and trust model
  • Where the audit log is consumed (ring buffer → GET /v1/elections)
  • Ready-to-use jq / tail recipes for log analysis

Update README.md:

  • Add "Audit log" entry to the Table of Contents
  • Add "## Audit log" section before Related Setup Guides
  • Add docs/audit-log.md to the Related Setup Guides list

Closes SMA-107.

mrnkslv and others added 30 commits May 27, 2026 18:18
…-101-audit-log-trait-noop-factory-composition-root-wiring
:tests
…-102

Integrate SMA-101 wiring (enabled flag, audit in ElectionRunner) with
JsonlAuditLog implementation: factory returns NoopAuditLog when disabled
and starts JsonlAuditLog when enabled.

Co-authored-by: Cursor <[email protected]>
Take sma-99 audit writer/log hardening (oneshot shutdown, rotated paths,
shutdown timeout, flush/recovery). Adapt to SMA-103 event format:
AuditFileHeader, system_audit_events_dropped constructor, payload.source()
in record diagnostics, header-aware writer tests.

Co-authored-by: Cursor <[email protected]>
… events to CLI

- Merge feature/sma-104-audit-log-rest-producers-auditactorbuilder into current branch
- Resolve conflicts: AppState gains both audit_ring (SMA-105) and actor_builder (SMA-104)
- Fix RestApiAuthLoginSuccess → RestApiAuthLoginSucceeded in event.rs and auth_tests.rs
- Add recent elections audit events to GET /v1/elections response (recent_events field, newest-first, from ring buffer)
- Add elections events table to `nodectl api elections` CLI output

Co-authored-by: Cursor <[email protected]>
…cture' into feature/sma-104-audit-log-rest-producers-auditactorbuilder
- Add `use serde::{Deserialize, Serialize}` to enums.rs (bare derives on
  StakeSkipReason/ConfigFieldChange/AuditOutcome broke after SMA-103 merge)
- Add ElectionsTickFailed arm to severity() and source() match blocks
- Restore REST event constructors to event.rs (rest_api_auth_login_success,
  rest_api_auth_login_rejected, rest_api_token_rejected, rest_api_config_updated)
  removed by SMA-103 merge; required by rest_audit.rs (SMA-104)
- Fix RestApiAuthLoginSuccess -> RestApiAuthLoginSucceeded in auth_tests.rs

Co-authored-by: Cursor <[email protected]>
…roducers-auditactorbuilder' into feature/sma-105-audit-log-in-memory-ring-buffer-for-read-path
mrnkslv and others added 8 commits June 9, 2026 15:45
- Rename ElectionsStakeSubmittedParams.stake_nanotons → stake and
  elections_stake_recovered param amount_nanotons → amount to match
  the enum field names introduced by sma-104 (which dropped _nanotons
  suffixes from all payload fields).
- Remove dead duplicate function adaptive_split50_defer_reason that
  was synthesised by the ort merge strategy from both SMA-103 and
  SMA-104 versions of adaptive_strategy.rs; the identical logic with
  node_id is already in adaptive_split50_status.
- Update runner.rs and event.rs test fixtures to use the renamed fields.

All 310 lib tests pass.

Co-authored-by: Cursor <[email protected]>
Remove the intermediate AdaptiveStakeZero enum and move its variants
(Defer, NoTopUpNeeded, InsufficientFree) directly into AdaptiveStakeResult.
Update all call-sites in runner.rs accordingly, renaming
adaptive_zero_to_skip → adaptive_result_to_skip.

Co-authored-by: Cursor <[email protected]>
…a-105

Pull SMA-104 review fixes merged into sma-99 (test_support refactor,
middleware without headers clone, AppError::internal in config handlers,
rest_audit noop-update comment) while keeping sma-105 audit ring buffer.

Co-authored-by: Cursor <[email protected]>
Apply sma-105 conflict resolutions (test_support builders, jsonl_writer
cleanup) while keeping sma-106 projection test helpers for custom ring.

Co-authored-by: Cursor <[email protected]>
…tion

- Atomic dedup: replace two-step contains+push with push_unless_dedup_duplicate
  that holds a single write lock, eliminating the TOCTOU race on concurrent
  record() calls for the same elections.stake_skipped key.
- Zero-copy dedup: replace dedup_key() -> Option<String> with
  dedup_identity() -> Option<AuditDedupIdentity<'_>>, removing per-event
  String allocations on the hot path.
- Contract fix in collect_recent_election_ids: early-return when max == 0
  and after inserting current_election_id when ids.len() >= max.

Co-authored-by: Cursor <[email protected]>
@linear

linear Bot commented Jun 11, 2026

Copy link
Copy Markdown

SMA-107

mrnkslv and others added 3 commits June 15, 2026 15:21
Resolve conflicts preferring sma-99 for audit core (dedup, ring buffer,
jsonl) while keeping sma-106 projection into elections response.

Co-authored-by: Cursor <[email protected]>
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.

1 participant