Skip to content

fix(android): close hash and random-access files before settling - #158

Closed
OskarEichler wants to merge 1 commit into
birdofpreyru:masterfrom
OskarEichler:codex/rnfs-android-hash-write
Closed

fix(android): close hash and random-access files before settling#158
OskarEichler wants to merge 1 commit into
birdofpreyru:masterfrom
OskarEichler:codex/rnfs-android-hash-write

Conversation

@OskarEichler

@OskarEichler OskarEichler commented Aug 27, 2026

Copy link
Copy Markdown

Fixes

Close hash/read and random-access write handles before promise completion. Preserve the original error when closing also fails, and avoid double-close paths. Replace a per-call six-entry hash-algorithm map and per-byte String.format with direct dispatch and hexadecimal character lookup. Accept extensionless raw-resource names; preserve existing extension-based routing and document it.

Compatibility / observable changes

No public signatures, algorithms or digest output change. Close failures now reject instead of resolving first or escaping after settlement. Extensionless names resolve through res/raw rather than throwing a substring-index error.

Verification

Actual Kotlin method bodies with real temporary file data and instrumented I/O constructors: all six digest algorithms at 0, 1, 255 and 20,000 bytes match Java MessageDigest/HexFormat; append/random-access writes cover success, write failure, close failure and combined errors. Thirty of 33 baseline lifetime/error checks fail; all 33 fixed cases pass. Four actual resource-name mapping cases pass (one baseline failure). Fewer formatting/map allocations follow directly from the code change; no app-wide speedup is claimed.

Shared checks and limits

Combined upstream lint/TypeScript and whitespace checks pass. Full Android Kotlin compilation against RN 0.87.1 and all six Apple implementation compilations against the iOS Simulator SDK pass. No checked-in tests/specs changed; diagnostic harnesses live outside the repository. Simulated/native-API-double checks are not physical-device verification. Consumer pin 99772cc: immutable install/lint, both Android Debug flavors and both iOS Simulator schemes pass. All 72 installed non-metadata files match reviewed source/build artifacts. JS/declarations are unchanged from the preceding verified pin, which passed four Metro bundles, 13 web builds and four extensions. Windows runtime and physical devices remain unverified.

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