FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix(worker): throw when an environment-data key cannot be converted to a string by adrian-niculescu · Pull Request #2066 · NativeScript/android · GitHub

Repository navigation

fix(worker): throw when an environment-data key cannot be converted to a string - #2066

Open
adrian-niculescu wants to merge 1 commit into
NativeScript:feat/worker-threadsfrom
adrian-niculescu:fix/environment-data-key-conversion
Open

adrian-niculescu wants to merge 1 commit into
NativeScript:feat/worker-threadsfrom
adrian-niculescu:fix/environment-data-key-conversion

Conversation

adrian-niculescu commented Oct 6, 2026 •
edited by coderabbitai Bot
Loading

Copy link
Copy Markdown
Contributor

setEnvironmentData(key, value) with a key whose toString() throws does not throw. It stores the value under the empty-string key instead, replacing whatever was there, and getEnvironmentData(key) and setEnvironmentData(key) read or delete that unrelated entry.

Both callbacks convert the key with a helper that swallows a throwing toString() and returns an empty string. They now convert it with a checked ToString and return with the exception pending, so it reaches the caller. Keys stay stringified, as the shared stringifies keys spec expects. A symbol key now throws a TypeError, as any string conversion of a symbol does, rather than mapping to the empty-string key.

Stacked on #2043; the same fix for iOS is NativeScript/ios#492. The throwing-key spec fails on that branch and passes here, a second spec keeps a key with an embedded NUL distinct from its prefix, and the full device suite passes.

Summary by CodeRabbit

  • Bug Fixes
    • Environment-data keys containing null characters are now kept distinct from their prefixes, and deleting a key no longer affects its prefix.
    • Errors raised while converting keys to strings now propagate correctly when setting or retrieving environment data.

coderabbitai Bot commented Oct 6, 2026 •
edited
Loading

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info ⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 680df5d4-5369-4648-9bd4-2df5f8d29cc2
📥 Commits

Reviewing files that changed from the base of the PR and between 42a8bcf and 1e23b14.

📒 Files selected for processing (2)
  • test-app/app/src/main/assets/app/tests/testMessaging.js
  • test-app/runtime/src/main/cpp/Messaging.cpp

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.


📝 Walkthrough

Walkthrough

Environment-data callbacks now convert keys with V8 in the current context and stop if conversion fails. Regression tests cover NUL-containing keys, deletion, and exceptions thrown during key conversion.

Changes

Environment-data key handling

Layer / File(s) Summary
Key conversion and regression coverage
test-app/runtime/src/main/cpp/Messaging.cpp, test-app/app/src/main/assets/app/tests/testMessaging.js
The set and get callbacks use V8 key conversion and return when conversion fails. Tests cover keys containing NUL, deletion, and exceptions from toString.

Priority: ⚪ Not assessed

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 1e23b

Failed key conversions now reach callers instead of accessing the empty-string entry, and the reviewed changes show no material merge risk.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: environment-data key conversion errors now propagate to the caller.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1 🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

A rabbit taps a key with care
V8 converts it in its lair
NUL keys keep their values true
Exceptions pass right through
The prefix stays, the tests are done
The rabbit hops beneath the sun

Comment @coderabbitai help to get the list of available commands.

…o a string

setEnvironmentData and getEnvironmentData converted the key with a helper that swallows a throwing toString() and returns an empty string, so such a key silently read, overwrote or deleted the unrelated empty-string entry. The conversion is checked now and the exception reaches the caller.

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

coderabbitai Bot commented Oct 6, 2026 •
edited
Loading

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

This branch has not been deployed

No deployments
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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant


Back | FazBrowse Home | New Git URL