fix(harmony): align isFirstTime and rollback mechanism with android/ios#585
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthrough
ChangesFirst-load marker and rollback flag
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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
harmony/pushy/src/main/ets/UpdateContext.tsOops! Something went wrong! :( ESLint: 8.57.1 Error: .eslintrc.js » 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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
harmony/pushy/src/main/ets/UpdateContext.ts (1)
245-249: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winReset
ignoreRollbackbefore the unchanged-state return.Line 249 is unreachable when
nextState.changedis false, so a statictruevalue can leak across a normal same-binary sync. Move the reset before the early return.Proposed fix
const nextState = NativePatchCore.syncStateWithBinaryVersion( packageVersion, buildTime, currentState, ); + UpdateContext.ignoreRollback = false; if (!nextState.changed) { return; } - UpdateContext.ignoreRollback = false;🤖 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/UpdateContext.ts` around lines 245 - 249, In UpdateContext, the ignoreRollback reset is placed after the early return in the nextState.changed check, so it never runs for unchanged-state updates; move the UpdateContext.ignoreRollback = false reset to before the if (!nextState.changed) return path inside the relevant UpdateContext flow so same-binary sync always clears the flag.
🤖 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.
Inline comments:
In `@harmony/pushy/src/main/ets/UpdateContext.ts`:
- Around line 390-394: The first-load marker is being written separately from
the launch state in UpdateContext, so a failure between the two writes can leave
first-time state consumed without the JS-visible marker. Update the persistence
flow around persistState(launchState) and firstLoadMarked so both values are
committed in the same preference flush, using the existing UpdateContext
launch-state persistence path and the firstLoadMarked key together.
---
Outside diff comments:
In `@harmony/pushy/src/main/ets/UpdateContext.ts`:
- Around line 245-249: In UpdateContext, the ignoreRollback reset is placed
after the early return in the nextState.changed check, so it never runs for
unchanged-state updates; move the UpdateContext.ignoreRollback = false reset to
before the if (!nextState.changed) return path inside the relevant UpdateContext
flow so same-binary sync always clears the flag.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 06da63f4-25bd-4303-9da9-53502645a1bd
📒 Files selected for processing (2)
harmony/pushy/src/main/ets/PushyTurboModule.tsharmony/pushy/src/main/ets/UpdateContext.ts
Summary by CodeRabbit