Skip to content

Conversation

@sl-cloud
Copy link
Owner

Develop -> Main

…t lead repository

- Extract UpdateModifiedLeadTimestamps() method to eliminate DRY violation
  * Caches dateTimeProvider.UtcNow once to ensure transactional consistency
  * All modified entities in same transaction receive identical timestamp
  * Improves performance with early exit when no entities modified
  * Single source of truth for timestamp update logic

- Implement LeadRepository with EF Core
  * SaveLeadAsync: Handles insert/update with automatic timestamp management
  * ExistsByCorrelationIdAsync: Optimized query for idempotency checks
  * GetByCorrelationIdAsync: Efficient correlation ID lookups
  * Automatic EF Core tracking conflict resolution
  * Full cancellation token support
  * Comprehensive input validation and exception handling

- All 24 repository tests passing
- All 9 DbContext tests passing (no regressions)
- 175 total tests passing (100% pass rate)
- Zero build warnings/errors

This completes Step 4.3 and prepares infrastructure for Step 4.4 configuration settings.
…e and AWS

- Implement DatabaseSettings configuration class
  * IOptions pattern for strongly-typed configuration
  * Properties: ConnectionString, Server, Port, Database, User, Password
  * Retry and timeout settings: MaxRetryAttempts, MaxRetryDelaySeconds, CommandTimeoutSeconds
  * Debug flags: EnableDetailedErrors, EnableQueryLogging
  * Comprehensive Validate() method with 13+ validation rules
  * Default values: Port=3306, MaxRetryAttempts=3, CommandTimeout=30s

- Implement AwsSettings configuration class
  * IOptions pattern for AWS services configuration
  * Properties: Region, SqsQueueUrl, SqsDlqUrl, SecretsManagerSecretName, RdsEndpoint
  * IAM authentication support: UseIamDatabaseAuthentication, IamTokenLifetimeSeconds
  * Credential validation: ValidateCredentialsAtStartup flag
  * Comprehensive Validate() method with URL format and endpoint validation
  * Default values: MaxRetryAttempts=3, IamTokenLifetime=900s

- 51 comprehensive unit tests
  * DatabaseSettingsTests: Valid/invalid values, port ranges, retry settings
  * AwsSettingsTests: Valid/invalid URLs, region variations, format validation
  * Edge case coverage: null handling, minimum values, boundary conditions
  * All 226 tests passing (100% pass rate)

This completes Step 4.4 and provides production-ready configuration
management following .NET best practices with the IOptions pattern.
…afe caching

- Implement IDbConnectionStringProvider interface
  * Thread-safe singleton with lock-based synchronization
  * Initialize once during Lambda cold start
  * GetConnectionString for cached retrieval
  * Comprehensive error handling and validation
- Replace AWSSDK.SecretsManager with Cloudvelous.Aws.SecretsManager
- Add Cloudvelous packages (Core, SecretsManager, RDS, SQS) v1.0.8
- Remove manual caching and JSON deserialization logic
- Leverage Cloudvelous built-in caching (60min TTL) and retry policies
- Create DatabaseCredentials immutable record for type-safe secret deserialization
- Refactor SecretsManagerService to use ISecretsManagerClient
- Simplify unit tests due to Cloudvelous SDK's optional parameter constraints
- Update ISecretsManagerService interface with comprehensive XML documentation
- Add 'where T : class' constraint to GetSecretAsync<T> for reference type safety

Technical Details:
- Cloudvelous SDK provides automatic caching with configurable TTL
- Built-in retry policies using Polly (3 retries, exponential backoff)
- Thread-safe operations using concurrent collections
- Type-safe JSON deserialization with System.Text.Json
@gitguardian
Copy link

gitguardian bot commented Oct 22, 2025

⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secret in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
21798294 Triggered Generic Password ee7e665 tests/LeadProcessor.UnitTests/Infrastructure/Services/DbConnectionStringProviderTests.cs View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secret safely. Learn here the best practices.
  3. Revoke and rotate this secret.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@sl-cloud sl-cloud merged commit d9d5a90 into main Oct 22, 2025
3 checks passed
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