Skip to content

Optimize partition ID validation and eliminate redundant string length calls#147

Merged
jgowdy-godaddy merged 1 commit intomainfrom
partition-id-optimization
Mar 4, 2026
Merged

Optimize partition ID validation and eliminate redundant string length calls#147
jgowdy-godaddy merged 1 commit intomainfrom
partition-id-optimization

Conversation

@jgowdy-godaddy
Copy link
Collaborator

Summary

  • Add RequireParameterStringWithLength to get string and UTF-8 length in a single N-API call
  • Add optional utf8_length parameter to CobhanBufferNapi constructor and StringToAllocationSize to avoid redundant GetUtf8StringLength calls when length is already known
  • Pass pre-calculated partition_id_length through all encrypt/decrypt code paths (sync/async, stack/heap)
  • Add empty partition ID validation with clear error messages
  • Add 4 tests for empty partition ID rejection (encrypt/decrypt × sync/async)

Test plan

  • All 57 tests pass locally (53 existing + 4 new)
  • Lint clean on modified files
  • CI passes

…h calls

- Add RequireParameterStringWithLength to get string and UTF-8 length in one N-API call
- Add optional utf8_length parameter to CobhanBufferNapi constructor and StringToAllocationSize
- Pass pre-calculated partition_id_length through all encrypt/decrypt code paths
- Add empty partition ID validation with clear error messages
- Add 4 tests for empty partition ID rejection (encrypt/decrypt × sync/async)
@jgowdy-godaddy jgowdy-godaddy merged commit 0c1f7d9 into main Mar 4, 2026
1 of 2 checks passed
@jgowdy-godaddy jgowdy-godaddy deleted the partition-id-optimization branch March 4, 2026 19:55
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