-
Notifications
You must be signed in to change notification settings - Fork 4
test: add comprehensive behavior tests #125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jgowdy-godaddy
wants to merge
16
commits into
main
Choose a base branch
from
add-behavior-tests
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
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
- Add RequireParameterStringWithLength to get string and length in one call - Reduces N-API boundary crossings from 2-3 to 1 for partition ID validation - Same functionality, better performance by eliminating duplicate GetUtf8StringLength calls
- Add RequireParameterStringWithLength to get string and length in one call - Add optional utf8_length parameter to CobhanBufferNapi constructors and copy_from_string - Add optional utf8_length parameter to StringToAllocationSize - Update BeginEncryptToJson/BeginDecryptFromJson to return partition_id_length - Reduces redundant GetUtf8StringLength calls when validating empty partition IDs - Foundation for further optimization to eliminate all redundant string length calls
- Pass partition_id_length through all async methods to avoid redundant GetUtf8StringLength calls - Update stack allocation cases to use pre-calculated length for StringToAllocationSize - Reduces N-API boundary crossings from 2-3 to 1 for partition ID validation This completes the optimization suggested in PR feedback to calculate string length once during validation and reuse it throughout the operation. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add missing await to assert_throws_async calls in multiple test functions
- Fix assert_encrypt_string to handle empty strings correctly
(indexOf('') always returns 0, not -1)
These tests were incorrectly passing because the async assertions
were not being awaited, causing the test to complete before the
assertion could fail.
Note: Empty content encryption is actually allowed by Asherah,
so these tests pass even with the fixes.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Document all remaining issues found after implementing fixes across branches: - Integer overflow vulnerabilities in size calculations - Stack overflow risk in SCOPED_ALLOCATE - Buffer underflow in AllocationSizeToMaxDataSize - Performance optimization opportunities - Testing gaps and API design issues - Build system improvements This report prioritizes issues by severity and provides specific fixes for each issue identified. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
The stack allocation via alloca() is working as designed: - Default maximum_stack_alloc_size is 2048 bytes (reasonable) - Users can adjust at their own risk - This is an intentional performance optimization Updated report to show only 3 critical issues instead of 4. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Mark issue #10 (Missing Move Semantics) as fixed and add the add-move-optimizations branch to the list of implemented fixes. Updated summary to show 18 remaining issues (down from 19) and list all 7 branches with fixes. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add readonly modifiers to AsherahConfig to prevent mutation - Add string literal types for known enum values (Metastore, KMS, ReplicaReadConsistency) - Export LogHookCallback type for better type safety - Add explicit Promise<void> return types for async setup/shutdown - Maintain backward compatibility by using union types with string These changes improve IDE autocomplete and catch more errors at compile time without breaking existing code.
- Setup/shutdown behavior: double setup prevention, operations after shutdown, rapid cycles - Encryption/decryption behavior: max size data, unicode/special chars, nonce randomization - Concurrent operations: 100 mixed encrypt/decrypt operations in parallel - Partition isolation: verify data encrypted for one partition can't be decrypted with another - Error handling: invalid encrypted data, buffer/string type mismatches - Stack allocation behavior: various sizes including edge cases (negative, very large) - Sync vs async consistency: verify compatible results and error handling These tests focus on behavior rather than implementation details, making them resilient to internal changes while ensuring the API contract is maintained.
ed3846e to
9fdd660
Compare
59801c7 to
afb7151
Compare
Force use of installed Go version (1.24.0) instead of allowing automatic download of Go 1.24.1 which causes version mismatch errors in CI.
Prevent version conflict error when dry-running npm publish since the package.json version is 0.0.0 but published version is 3.0.8.
Fix C++ compilation errors where BeginDecryptFromJson expects a partition_id_length parameter that was not being passed in DecryptSync and DecryptStringSync functions.
Fix arm64 build failure caused by undefined unlikely() macro. The scoped_allocate.h file uses unlikely() but didn't include hints.h where the macro is defined.
The CI npm version requires a tag when the package.json version (0.0.0) is lower than the published version (3.0.8), even for dry-run.
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.
Summary
Test Coverage Added
Setup and Shutdown Behavior (3 tests)
Encryption/Decryption Behavior (5 tests)
Error Handling Behavior (2 tests)
Stack Allocation Behavior (3 tests)
Sync vs Async Consistency (2 tests)
Test Quality
Test plan
🤖 Generated with Claude Code