Skip to content

feat(auditserver): expose MatchFrame library API#28

Merged
ncode merged 1 commit intomainfrom
juliano/use_as_external_library
Feb 17, 2026
Merged

feat(auditserver): expose MatchFrame library API#28
ncode merged 1 commit intomainfrom
juliano/use_as_external_library

Conversation

@ncode
Copy link
Owner

@ncode ncode commented Feb 17, 2026

This pull request introduces a new library-mode API for evaluating audit log frames outside the event loop, and refactors the rule-group matching logic for improved testability and clarity. The main change is the addition of the MatchFrame method to AuditServer, which allows direct evaluation of raw audit log frames and returns detailed match results. The pull request also adds comprehensive documentation and tests for the new API.

New library-mode API and documentation:

  • Added the MatchFrame method to AuditServer, enabling callers to evaluate raw audit log frames and receive a structured MatchResult containing whether any rule group matched, the parsed log, and the names of matched groups.
  • Introduced a new package-level documentation in pkg/auditserver/doc.go, describing the library-mode usage and providing example code for MatchFrame.

Refactoring and test coverage:

  • Refactored internal frame matching logic by extracting rule-group evaluation into a reusable matchFrame function, simplifying the event loop handling and improving separation of concerns. [1] [2]
  • Added extensive unit tests for MatchFrame, covering matching, non-matching, error cases, multiple rule groups, and order preservation, as well as a usage example.
  • Introduced a new benchmark for MatchFrame to measure allocation and performance.

@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.22%. Comparing base (b2bcdbc) to head (8eb5dc0).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #28      +/-   ##
==========================================
+ Coverage   96.07%   96.22%   +0.15%     
==========================================
  Files          10       10              
  Lines         611      636      +25     
==========================================
+ Hits          587      612      +25     
  Misses         19       19              
  Partials        5        5              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ncode ncode merged commit 651ca24 into main Feb 17, 2026
5 checks passed
@ncode ncode deleted the juliano/use_as_external_library branch February 17, 2026 05:29
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

Comments