test(aml): add regression suite for AMLRuleRepository error paths and boundary contracts - #1239
Open
eteonninob-arch wants to merge 1 commit into
Conversation
… boundary contracts
|
@eteonninob-arch Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #955
Title
test(aml): add regression suite for AMLRuleRepository error paths and boundary contracts
Description
This PR implements a comprehensive regression suite for AMLRuleRepository to cover explicit failure and boundary paths and prevent silent behavior or contract regressions.
Evidence Covered
src/aml/amlRuleRepository.ts:130:throw new Error(\Rule ${ruleId} not found`);`src/aml/amlRuleRepository.ts:236:throw new Error(\Version ${JSON.stringify(version)} not found for rule ${ruleId}`);`Changes Made
src/aml/amlRuleRepository.test.tswith deterministic unit and regression tests.BEGIN,COMMIT,ROLLBACK, client release tracking).Exercised Cases
Rule Update Failure & Boundary Paths (
amlRuleRepository.ts:130):Error("Rule nonexistent not found")."") throwsError("Rule not found")." ") throwsError("Rule not found")."rule/404#special!") throwsError("Rule rule/404#special! not found").Error("Rule <uuid> not found").ROLLBACKis executed and database connection is released without committing.UPDATEquery rolls back transaction and releases client.Rollback Failure & Boundary Paths (
amlRuleRepository.ts:236):Error("Version {\"major\":99,\"minor\":99,\"patch\":99} not found for rule rule_1").{ major: 0, minor: 0, patch: 0 }not in history throws exact contract error.{ major: 0, minor: -1, patch: 0 }throw exact contract error.Error("Version ... not found for rule nonexistent").ROLLBACKis executed and database connection is released without committing.Neighboring Normal Paths:
1.0.0, records history, commits, and releases client.ROLLBACKand releases client.1.0.0->1.1.0).1.0.0->1.0.1).1.0.0) increments patch (1.0.1), restores historical config and enabled state, and logs audit reasonRollback to version {\"major\":1,\"minor\":0,\"patch\":0}.1.2.3->1.2.4).Validation
npx jest src/aml/amlRuleRepository.test.ts(36/36 passed, 100% branch and line coverage)npx jest src/aml/(9 suites, 223/223 passed)npx tsc --noEmitpassed with 0 errorsnpx eslint src/aml/amlRuleRepository.test.tspassed with 0 errors / 0 warnings