Skip to content

T1 (#808): softwareUpdateHandler — resumable downloads to .artifacts/#814

Open
GOKULRAJ136 wants to merge 5 commits into
mosip:developfrom
GOKULRAJ136:T1-808-RC
Open

T1 (#808): softwareUpdateHandler — resumable downloads to .artifacts/#814
GOKULRAJ136 wants to merge 5 commits into
mosip:developfrom
GOKULRAJ136:T1-808-RC

Conversation

@GOKULRAJ136

@GOKULRAJ136 GOKULRAJ136 commented Jun 19, 2026

Copy link
Copy Markdown

Refer Story #807
Fixes #808

Summary by CodeRabbit

Release Notes

  • New Features
    • Software updates now support resumable downloads—interrupted transfers can resume from the last point instead of restarting completely. Failed attempts retain partial downloads for subsequent resumption.
    • Disk space is automatically verified before downloads commence to prevent failures due to storage limitations.
    • Enhanced integrity validation ensures downloaded files are complete and uncorrupted.

Summary by CodeRabbit

  • New Features

    • Added resumable downloads for update files, including automatic recovery from interrupted transfers.
    • Expanded approval and registration flows with richer preview, acknowledgement, and pending-approval screens.
    • Added more flexible validation for optional input and test-driven flow configuration.
  • Bug Fixes

    • Improved handling of partial downloads, low disk space, and stale update data.
    • Made UI automation more resilient when screens, buttons, or labels are temporarily unavailable.
    • Updated several registration scenarios to verify preview and acknowledgement content more reliably.

@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@GOKULRAJ136, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 42 minutes and 8 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: f1e79591-3842-47cd-a11a-eb62f3209808

📥 Commits

Reviewing files that changed from the base of the PR and between 09f6fdc and f64770b.

📒 Files selected for processing (3)
  • registration/registration-services/src/main/java/io/mosip/registration/update/ResumableDownloader.java
  • registration/registration-services/src/main/java/io/mosip/registration/update/SoftwareUpdateUtil.java
  • registration/registration-services/src/test/java/io/mosip/registration/test/update/SoftwareUpdateUtilTest.java

Walkthrough

Adds resumable download staging for software updates, routes update handling through staged artifact downloads, expands downloader tests, and updates registration UI automation, scenario flows, and fixtures for preview, acknowledgement, and EOD approval validation.

Changes

Resumable download infrastructure

Layer / File(s) Summary
Resumable downloader core
registration/registration-services/src/main/java/io/mosip/registration/update/ResumableDownloader.java
Defines staged part/meta download handling, resume validation, range parsing, completion checks, disk-space checks, and finalization behavior for resumable HTTP downloads.
Update handler and utility wiring
registration/registration-services/src/main/java/io/mosip/registration/update/SoftwareUpdateUtil.java, registration/registration-services/src/main/java/io/mosip/registration/update/SoftwareUpdateHandler.java
Adds artifact-directory and timeout helpers, wraps resumable download and space checks in checked exceptions, and switches software update handling to staged resumable downloads.
Downloader tests and HTTP harness
registration/registration-services/src/test/java/io/mosip/registration/test/update/SoftwareUpdateUtilTest.java
Adds resumable-download success and failure tests, space-check tests, and the in-process HTTP server helpers used to exercise Range, If-Range, and 416 responses.

Registration UI automation and scenario flow

Layer / File(s) Summary
Shared UI helpers and authentication
registration/registration-test/src/main/java/registrationtest/controls/Alerts.java, registration/registration-test/src/main/java/registrationtest/controls/Buttons.java, registration/registration-test/src/main/java/registrationtest/pages/AuthenticationPage.java, registration/registration-test/src/main/java/registrationtest/pages/LoginPage.java, registration/registration-test/src/main/java/registrationtest/utility/WaitsUtil.java, registration/registration-test/src/main/java/registrationtest/utility/RobotActions.java
Expands wait, robot, alert, login, and authentication helpers with visible-node lookup, native print dismissal, typed node access, and stronger failure-state validation.
WebView validation and page actions
registration/registration-test/src/main/java/registrationtest/pages/WebViewDocument.java, registration/registration-test/src/main/java/registrationtest/pages/BiometricUploadPage.java, registration/registration-test/src/main/java/registrationtest/pages/DemographicPage.java, registration/registration-test/src/main/java/registrationtest/pages/EodApprovalPage.java, registration/registration-test/src/main/java/registrationtest/pages/UpdatePage.java, registration/registration-test/src/main/java/registrationtest/pages/UploadPacketPage.java
Reworks pending-approval, biometric upload, demographic, update, and packet-lookup page objects to support preview, acknowledgement, approval, rejection, and scan validation paths.
Scenario flows, JSON utilities, and fixtures
registration/registration-test/src/main/java/registrationtest/testcases/*.java, registration/registration-test/src/main/java/registrationtest/utility/JsonUtil.java, registration/registration-test/src/main/resources/repository_eng/*.json
Extends registration scenario flows with preview, acknowledgement, and EOD approval verification; adds optional JSON access helpers; and updates repository fixtures with preview and acknowledgement test fields.

Upgrade guidance documents

Layer / File(s) Summary
Agent guidance
AGENTS.md
Adds repository instructions covering build commands, module layout, runtime order, testing, and operational notes.
Upgrade design document
design/registration/registration-upgrade.md
Describes the Java 11 to Java 21 registration-client upgrade plan, launcher split, manifest handling, signature checks, rollback behavior, edge cases, and test matrix.

Sequence Diagram(s)

Not included.

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~90+ minutes

Possibly related issues

  • mosip/registration-client#807: The PR introduces resumable download plumbing and switches SoftwareUpdateHandler to staged artifact downloads, which matches the issue’s update revamp around resumable, manifest-driven downloads.
  • #808: T1: softwareUpdateHandler Changes — Directly matches the switch from lib/ downloads to .artifacts/ with resumable support and restart prompting after downloads complete.

Possibly related PRs

  • mosip/registration-client#763: Both PRs update design/registration/registration-upgrade.md around the Java upgrade and resumable/background artifact download flow.

Suggested reviewers

  • mohanachandran-s
  • anushasunkada
  • ckm007

Poem

🐇 I hop through .part files, then home again,
With Range and If-Range, I dodge the rain.
A gentle alert, a steady UI light,
The bunny downloads through the night.
When approval and previews all pass their test,
This little hare declares: “I’m impressed!”

🚥 Pre-merge checks | ✅ 2 | ❌ 3

❌ Failed checks (3 warnings)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning It covers resumable .artifacts/ downloads, but not the required background progress download flow or the restart-only-after-completion prompt in #808. Add background downloading with progress reporting and delay the restart prompt until every .artifacts/ transfer finishes.
Out of Scope Changes check ⚠️ Warning The PR includes many registration-test, fixture, and design-doc changes that are unrelated to #808's updater/download behavior. Move the UI test, JSON fixture, and documentation work to separate PRs unless they directly support the updater change.
Docstring Coverage ⚠️ Warning Docstring coverage is 11.52% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and matches the main change: resumable softwareUpdateHandler downloads to .artifacts/.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 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
`@registration/registration-services/src/main/java/io/mosip/registration/update/ResumableDownloader.java`:
- Around line 345-351: Add validation in the Artifact constructor to sanitize
the name parameter before using it to construct File paths. At the beginning of
the Artifact constructor, before assigning this.name or creating any File
objects, validate that the name parameter does not contain path separators
(forward slash or backslash) or the parent directory reference (..) sequence. If
validation fails, throw an IllegalArgumentException with a descriptive error
message. This ensures that malicious filenames with path traversal sequences
cannot be used to write files outside the intended targetDir directory.

In
`@registration/registration-services/src/main/java/io/mosip/registration/update/SoftwareUpdateUtil.java`:
- Around line 130-133: Update the throw statement in the IOException catch block
where RegBaseCheckedException with error code "REG-BUILD-005" is constructed to
pass the caught exception (variable e) as the third argument to the
RegBaseCheckedException constructor. The constructor accepts three parameters:
error code, error message, and a Throwable cause. This will preserve the
original IOException in the exception chain for better debugging. Apply the same
fix to the other location (around line 149) where RegBaseCheckedException is
similarly thrown without the cause parameter.
🪄 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: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 6f064773-d274-4a7e-bc11-f465d653a42f

📥 Commits

Reviewing files that changed from the base of the PR and between b76a5cd and 7868b67.

📒 Files selected for processing (4)
  • registration/registration-services/src/main/java/io/mosip/registration/update/ResumableDownloader.java
  • registration/registration-services/src/main/java/io/mosip/registration/update/SoftwareUpdateHandler.java
  • registration/registration-services/src/main/java/io/mosip/registration/update/SoftwareUpdateUtil.java
  • registration/registration-services/src/test/java/io/mosip/registration/test/update/SoftwareUpdateUtilTest.java

…acts/

Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>
Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com>
* @return {@code true} if the file was completed and finalized; {@code false} if the partial was
* found stale/unusable and discarded, so the caller should restart from scratch.
*/
private static boolean attemptDownload(String url, Artifact artifact, boolean allowResume,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@GOKULRAJ136 Instead of writing our implementation for resumable file download, why not use OkHttp3 library which already supports resumable file downloads.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@anushasunkada I did evaluate it.

OkHttp3 doesn't provide resumable downloads as a built-in feature. It simply allows you to set the Range header, which HttpURLConnection already supports. The actual resumable download logic, including persisting the .part file, validating with ETag/If-Range to prevent mixing different versions, handling 200/206/416 responses, verifying Content-Length, and performing an atomic finalization, must be implemented manually regardless of which HTTP client is used.

Additionally, OkHttp is not currently a runtime dependency (it is only used by mockwebserver for tests), so adopting it would introduce a new runtime dependency. ResumableDownloader was intentionally designed to depend only on the JDK and slf4j so that T2 can move it into registration-launcher-common unchanged and share it with _launcher.jar.

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