Skip to content

debug(harmony): log constants returned by getConstants on native side#595

Merged
sunnylqm merged 1 commit into
masterfrom
fix/harmony-constants-logging
Jun 30, 2026
Merged

debug(harmony): log constants returned by getConstants on native side#595
sunnylqm merged 1 commit into
masterfrom
fix/harmony-constants-logging

Conversation

@sunnylqm

@sunnylqm sunnylqm commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

This PR adds a native-side debug log statement to print the exact constants returned by getConstants() inside PushyTurboModule.ts:

logger.debug(TAG, `,getConstants result: ${JSON.stringify(result)}`);

This will help verify what constants are returned by the native side to the JS engine (and check for any synchronization or timing issues in Bridgeless/React Native 0.77 environments).

Summary by CodeRabbit

  • Chores
    • Improved diagnostic logging when retrieving app constants, making it easier to troubleshoot issues with configuration loading.
    • Returned constants behavior remains the same as before.

@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 608ded30-bb70-4144-b311-767f790082db

📥 Commits

Reviewing files that changed from the base of the PR and between 763df2a and dc06843.

📒 Files selected for processing (1)
  • harmony/pushy/src/main/ets/PushyTurboModule.ts

📝 Walkthrough

Walkthrough

PushyTurboModule.getConstants() now stores its constants object in a local result variable, logs the serialized value with logger.info, and returns result.

Changes

getConstants result logging

Layer / File(s) Summary
Add result variable and log
harmony/pushy/src/main/ets/PushyTurboModule.ts
getConstants() assigns the constants object to result, logs JSON.stringify(result) with logger.info, and returns result.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

🐇 I hopped through getConstants bright,
Named result and logged it right.
A tiny trail of JSON gleam,
Then back it goes, a steady stream.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: adding native-side debug logging for getConstants() output.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/harmony-constants-logging

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

harmony/pushy/src/main/ets/PushyTurboModule.ts

Oops! Something went wrong! :(

ESLint: 8.57.1

Error: .eslintrc.js » @react-native/eslint-config#overrides[4]:
Environment key "jest/globals" is unknown

at /node_modules/.pnpm/@eslint+eslintrc@2.1.4/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2079:23
at Array.forEach (<anonymous>)
at ConfigValidator.validateEnvironment (/node_modules/.pnpm/@eslint+eslintrc@2.1.4/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2073:34)
at ConfigValidator.validateConfigArray (/node_modules/.pnpm/@eslint+eslintrc@2.1.4/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2223:18)
at CascadingConfigArrayFactory._finalizeConfigArray (/node_modules/.pnpm/@eslint+eslintrc@2.1.4/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3985:23)
at CascadingConfigArrayFactory.getConfigArrayForFile (/node_modules/.pnpm/@eslint+eslintrc@2.1.4/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3791:21)
at FileEnumerator._iterateFilesWithFile (/node_modules/.pnpm/eslint@8.57.1/node_modules/eslint/lib/cli-engine/file-enumerator.js:368:43)
at FileEnumerator._iterateFiles (/node_modules/.pnpm/eslint@8.57.1/node_modules/eslint/lib/cli-engine/file-enumerator.js:349:25)
at FileEnumerator.iterateFiles (/node_modules/.pnpm/eslint@8.57.1/node_modules/eslint/lib/cli-engine/file-enumerator.js:299:59)
at iterateFiles.next (<anonymous>)

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

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
harmony/pushy/src/main/ets/PushyTurboModule.ts (1)

109-110: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Consider preserving undefined values in the debug log for accurate native-to-JS contract verification.

JSON.stringify drops keys with undefined values, so if rolledBackVersion (or any future field) is undefined, the log output won't match the actual object shape returned to JS. Since this log's purpose is to verify the exact constants contract, consider normalizing undefined to null in the logged object so omitted keys don't mislead investigation:

-    logger.debug(TAG, `,getConstants result: ${JSON.stringify(result)}`);
+    logger.debug(TAG, `,getConstants result: ${JSON.stringify(result, (_k, v) => v === undefined ? null : v)}`);

Or explicitly normalize rolledBackVersion to null when constructing result if that aligns with the Android contract.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@harmony/pushy/src/main/ets/PushyTurboModule.ts` around lines 109 - 110, The
debug log in PushyTurboModule.getConstants is misleading because JSON.stringify
drops undefined fields, so the logged shape may not match the actual JS
contract. Update the getConstants result logging to preserve undefined-vs-null
semantics by normalizing undefined fields (such as rolledBackVersion) to null in
the logged object, or by aligning the returned result shape in getConstants so
the debug output accurately reflects what the native module exposes.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@harmony/pushy/src/main/ets/PushyTurboModule.ts`:
- Around line 109-110: The debug log in PushyTurboModule.getConstants is
misleading because JSON.stringify drops undefined fields, so the logged shape
may not match the actual JS contract. Update the getConstants result logging to
preserve undefined-vs-null semantics by normalizing undefined fields (such as
rolledBackVersion) to null in the logged object, or by aligning the returned
result shape in getConstants so the debug output accurately reflects what the
native module exposes.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ed250bcb-8578-4112-9d5f-18aee4dfee18

📥 Commits

Reviewing files that changed from the base of the PR and between efe638e and 763df2a.

📒 Files selected for processing (1)
  • harmony/pushy/src/main/ets/PushyTurboModule.ts

@sunnylqm sunnylqm force-pushed the fix/harmony-constants-logging branch from 763df2a to dc06843 Compare June 30, 2026 13:03
@sunnylqm sunnylqm merged commit 4e89061 into master Jun 30, 2026
3 checks passed
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