Skip to content

test(audit): add coverage for audit log recording and pagination (#747) - #1

Closed
sammajayi wants to merge 1 commit into
mainfrom
test/issue-86-audit-coverage
Closed

test(audit): add coverage for audit log recording and pagination (#747)#1
sammajayi wants to merge 1 commit into
mainfrom
test/issue-86-audit-coverage

Conversation

@sammajayi

@sammajayi sammajayi commented Jul 26, 2026

Copy link
Copy Markdown
Owner

Summary

Added a #[cfg(test)] module to audit.rs with 24 tests covering audit log recording and pagination correctness.

Related Issue

Closes PhasoraLabs#747

Changes Made

  • AuditAction variant coverage (13 tests): one test per variant verifying action, actor, milestone_idx, and amount fields
  • Pagination correctness (5 tests): get_recent with empty log, zero n, n > len, exact n == len, and oldest-first slicing
  • Append-only invariant (3 tests): monotonically growing length, no overwrites, order preserved across grants
  • Metadata and helpers (3 tests): grant_id, timestamp/ledger_sequence, different actors, log_length consistency

Testing

  • cargo check --lib passes with no new warnings
  • cargo fmt --check clean
  • cargo test blocked by pre-existing compilation errors in reviewer_sla.rs on main

Notes for Reviewer

The test suite has pre-existing compilation errors in reviewer_sla.rs that prevent cargo test from running. These exist on main as well.

- Add #[cfg(test)] module with 24 tests covering all 13 AuditAction variants
- Verify get_recent pagination boundaries (empty log, zero n, n > len, exact n, oldest-first slicing)
- Assert append-only invariant: length grows monotonically, no overwrites, order preserved across grants
- Test metadata correctness: grant_id, timestamp, ledger_sequence, actor tracking
- Test log_length consistency with get_log

Closes PhasoraLabs#747
@sammajayi
sammajayi force-pushed the test/issue-86-audit-coverage branch from 6f6308a to 9edb218 Compare July 26, 2026 16:43
@sammajayi sammajayi changed the title test(audit): add coverage for audit log recording and pagination (#86) test(audit): add coverage for audit log recording and pagination (#747) Jul 26, 2026
@sammajayi sammajayi closed this Jul 26, 2026
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.

Add Test Coverage for audit Module

1 participant