Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@rohilsurana
Copy link
Member

Summary

This PR migrates the Organization Audit Logs APIs from gRPC to Connect RPC following Linear ticket CLD-2271.

Progress

  • ListOrganizationAuditLogs API - migrated and tested
  • CreateOrganizationAuditLogs API - migrated and tested
  • GetOrganizationAuditLog API - migrated and tested
  • CreateAuditRecord API - already migrated (existing)

Changes Made

  • ListOrganizationAuditLogs: Successfully migrated from gRPC to Connect RPC format

    • Added proper organization validation and error handling
    • Implemented audit filter support for source, action, time range, and system filtering
    • Transform audit logs to protobuf format with proper timestamp handling
  • CreateOrganizationAuditLogs: Migrated with comprehensive validation

    • Organization existence and status validation
    • Required field validation (source and action)
    • Batch processing of multiple audit logs in single request
    • Proper actor, target, and context mapping
  • GetOrganizationAuditLog: Single audit log retrieval with organization checks

    • Organization validation before log retrieval
    • Proper error handling for missing logs
    • Complete audit log transformation with metadata

Testing

  • ✅ Build verification: make build passes
  • ✅ Tests: All 15 audit test cases pass with 100% coverage
  • ✅ Lint: make lint passes with no issues

Implementation Notes

  • All APIs follow established Connect RPC migration patterns
  • Consistent error handling using predefined constants (ErrOrgDisabled, ErrOrgNotFound)
  • Proper Connect error code mapping (CodeFailedPrecondition, CodeNotFound, CodeInternal)
  • Comprehensive test coverage for success and error scenarios
  • Reused existing transformAuditLogToPB helper function

APIs Covered

  1. ListOrganizationAuditLogs - Returns filtered audit logs for organization
  2. CreateOrganizationAuditLogs - Creates multiple audit logs for organization
  3. GetOrganizationAuditLog - Retrieves single audit log by ID
  4. CreateAuditRecord - Already migrated (audit record creation)

Error Handling

  • Organization disabled: connect.CodeFailedPrecondition
  • Organization not found: connect.CodeNotFound
  • Missing required fields: connect.CodeInvalidArgument
  • Internal service errors: connect.CodeInternal

- Migrate ListOrganizationAuditLogs API with proper error handling
- Migrate CreateOrganizationAuditLogs API with validation
- Migrate GetOrganizationAuditLog API with organization checks
- Add comprehensive test suite covering success and error scenarios
- Implement proper Connect RPC error codes and constants
- All 15 test cases pass with full coverage
@vercel
Copy link

vercel bot commented Oct 8, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
frontier Ready Ready Preview Comment Oct 8, 2025 9:00am

@coveralls
Copy link

Pull Request Test Coverage Report for Build 18339421395

Details

  • 92 of 100 (92.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.1%) to 37.132%

Changes Missing Coverage Covered Lines Changed/Added Lines %
internal/api/v1beta1connect/audit.go 92 100 92.0%
Totals Coverage Status
Change from base Build 18338403253: 0.1%
Covered Lines: 14447
Relevant Lines: 38907

💛 - Coveralls

@rohilsurana rohilsurana merged commit 8a597bf into main Oct 8, 2025
7 checks passed
@rohilsurana rohilsurana deleted the feature/migrate-frontier-rpc-audit branch October 8, 2025 10:35
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.

4 participants