Description
As an Operator, I want the system to validate each registration packet size before uploading and prevent uploading packets that exceed the configured maximum size limit, So that I am informed when packets are too large, understand why they cannot be uploaded, and can take appropriate action to resolve the issue before attempting upload.
Purpose
To prevent failed uploads due to oversized packets, provide clear error messages to operators about which packets violate size constraints, and improve data transfer efficiency by catching size issues before network transmission.
Pre-requisites
- Packet list/upload screen available in Android Registration Client
- Packet management database tables exist with packet metadata
- Configuration system available to store and retrieve max packet size property
- Existing registration client already has max packet size configuration (can reuse)
- Status column in packet list UI for displaying packet information
- Network/API infrastructure for packet uploads
- Error handling and display mechanisms available
Basic Flow
Step 1: Configuration Property for Maximum Packet Size
-
System has existing configuration property in Desktop Registration Client:
- Property Name:
[mosip.registration.disk_space_size](https://github.com/mosip/mosip-config/blob/2cc684ab38a04fd02a2a91fa2bf7e220535ae4eb/registration-default.properties#L225)
- Default Value: 5 MB (or configured value)
- Scope: Global configuration
- Currently Used By: Desktop Registration Client
-
Android Registration Client reuses SAME property:
- Retrieve property value from mosip_config
- Default value: 5 MB (if not configured)
- Can be configured/updated without code changes
Step 2: Before Upload - Validate Packet Size
When operator clicks "Upload" button:
-
System retrieves configured max packet size:
-
For EACH packet in the upload queue:
packetSize = getPacketFileSize(packetId)
// Returns: actual packet size in bytes
if (packetSize > (maxPacketSize * 1024 * 1024)) {
// Packet exceeds max size
packetStatus = "SIZE_VIOLATION"
packetErrorMessage = "Packet size ({actual}MB) exceeds maximum limit ({max}MB)"
}
-
System performs check BEFORE any network request:
- No API call made for oversized packets
- Validation happens at local device level
- Quick, offline validation
-
System categorizes packets:
- Valid packets: Size ≤ configured limit → Ready to upload
- Oversized packets: Size > configured limit → Cannot upload (show error)
Step 3: Display Size Validation Errors in Packet List Status Column
Status Column Details:
- For Oversized Packets:
Packet size is high
- Clear message: "Cannot upload"
- Disabled from upload selection
---
### Step 4: Validation Before Actual Upload
**Final Validation (During Upload):**
1. User clicks [UPLOAD] button
2. System performs final validation:
for each selectedPacket:
if (packet.fileSize > maxPacketSize) {
throw SizeViolationException(packet)
}
3. If any packet fails validation:
- Abort upload
- Show error: "Cannot upload. {N} packets exceed size limit."
- Keep packets in list with error status
- Do NOT attempt network request
4. Only if ALL selected packets pass validation:
- Proceed with upload API call
- Upload packets to server
- Clear packets from local list on success
### Alternate Flows
**Alternate Flow A1: Configuration Property Not Set**
1. System cannot find 'mosip.registration.disk_space_size' in configuration
2. System uses DEFAULT value: 5 MB
3. Validation proceeds with default limit
**Alternate Flow A2: Configuration Property Invalid**
1. Property value is invalid (not a number, negative, etc.)
2. System logs error: "Invalid max packet size configuration"
3. System uses DEFAULT value: 5 MB
4. Administrator notified to fix configuration
5. System continues with default limit
**Alternate Flow A3: User Changes Configuration**
1. Administrator updates 'mosip.registration.disk_space_size' property
2. New value: 20 MB (instead of 5)
3. System reads new value on next app restart (or config refresh)
4. Packet validation uses NEW limit (20 MB)
5. Previously oversized packets (e.g., 18 MB) now valid
6. Packet status updated: "SIZE VIOLATION" → "Ready"
**Alternate Flow A4: Configuration Changes During App Session**
1. App running with 5 MB limit
2. Administrator changes property to 20 MB via backend
3. Operator clicks "Refresh" on packet list
4. System re-reads configuration
5. Oversized packets re-evaluated with new limit
6. Status column updated for affected packets
**Alternate Flow A7: Packet Size Exactly at Limit**
1. Configured limit: 5 MB
2. Packet size: exactly 5 MB (5,000 KB)
3. System evaluates: size ≤ limit (15 = 15)
4. Packet eligible for upload
### Scenarios
| Scenario | Packet Size | Limit | Expected Status | Action |
|----------|---|---|---|---|
| S1 | 2.5 MB | 5 MB | ✓ Ready | Can upload |
| S2 | 5.0 MB | 5 MB | ✓ Ready | Can upload (exactly at limit) |
| S3 | 5.1 MB | 5 MB | ⚠️ SIZE VIOLATION | Cannot upload |
| S4 | 20 MB | 5 MB | ⚠️ SIZE VIOLATION | Cannot upload |
| S5 | 2.5 MB | 10 MB (new limit) | ✓ Ready | Still valid |
| S6 | 12 MB | 10 MB (changed) | ⚠️ SIZE VIOLATION | Now invalid |
| S7 | 0 bytes | 5 MB | ✓ Ready | Empty packet (valid) |
| S8 | 100 MB | 5 MB | ⚠️ SIZE VIOLATION | Far exceeds limit |
### Error Messages
| Scenario | Error Message | Display Location | User Action |
|---|---|---|---|
| Packet exceeds limit | "Size: 8 MB, Max: 5 MB. Cannot upload." | Status column | Delete or wait for resolution |
| Multiple packets violate | "2 packets exceed size limit. Upload {N} valid packets first." | Dialog | Review oversized packets |
| All packets oversized | "All {N} packets exceed size limit. Cannot upload." | Error dialog | Delete oversized or contact admin |
| Upload attempted with oversized | "Cannot upload. {N} packets still exceed limit. Remove them first." | Error notification | Fix oversized packets |
| Config property missing | "Packet size limit not configured. Using default (5 MB)." | Log/debug | Admin: set property |
| Invalid config value | "Invalid packet size limit configuration. Using default (5 MB)." | Log/warning | Admin: fix property value |
| Size exactly at limit | "Size: 5 MB (at limit). Ready to upload." | Status column | Can proceed |
---
### Data Fields
_No response_
### Business Rules (With Audit)
**BR-001:** Packet size validation MUST use configuration property 'mosip.registration.disk_space_size' from existing Desktop Registration Client configuration (no new property creation)
**BR-002:** Default maximum packet size MUST be 5 MB if property not configured
**BR-003:** Packet size validation MUST happen BEFORE any upload API call (local, offline validation)
**BR-004:** Oversized packets MUST NOT be selected by default in multi-select upload UI
**BR-005:** Oversized packets MUST be clearly identified in status column
**BR-006:** System MUST prevent uploading oversized packets (either by excluding them or failing validation)
**BR-007:** If configuration property changes, validation MUST use new value on next app restart or config refresh
**BR-008:** Packets exactly at size limit (e.g., 5 MB with 5 MB limit) MUST be considered valid
**BR-010:** Size validation failure MUST be logged in AUDIT table with:
* Packet ID
* Actual size
* Configured limit
* Timestamp
* Reason: "Size exceeds configured limit"
**BR-011:** Multiple size validation errors MUST be grouped in UI (show count of violations)
**BR-012:** Operator MUST be able to:
* Upload only valid packets (excluding oversized)
* Delete oversized packets
* View details of oversized packets
* Retry after resolution
### Acceptance Criteria
| Criteria | Verification Method |
|----------|---|
| Config property retrieved correctly | Verify 'mosip.registration.disk_space_size' read from database |
| Size validation happens before upload | No API call made for packets exceeding limit |
| Oversized packets identified | Packets >5 MB (or configured limit) marked as violations |
| Valid packets ready | Packets ≤ 5 MB show "✓ Ready" |
| Error message clear | Operator understands why packet cannot upload |
| Upload excludes oversized | [UPLOAD] button skips violation packets OR fails validation |
| Config change updates validation | New limit applied after restart/refresh |
| Size exactly at limit accepted | 5 MB packet with 5 MB limit is valid |
| Audit logged | AUDIT table contains size validation failure entry |
| Default used if missing | 5 MB default applied if property absent |
| Operators can view details | Click packet → See size comparison dialog |
### Exceptions
| Exception | Handling Strategy |
|-----------|---|
| Packet file not found | Log error; mark packet as "File missing" |
| Cannot read file size | Log error; treat as size unknown; ask operator |
| Network error during upload | If packet passed size check, retry upload |
| User tries to upload oversized | Show error; prevent upload; keep packet in list |
| Size validation timeout | Use cached size value; proceed with caution |
### Documentation
_No response_
### Reference UX
_No response_
### Compatibility
_No response_
### Implementation Details
TBA
### Non-Functional Requirements
| Requirement | Specification |
|------------|---|
| Validation Speed | Size check completes in <100ms per packet |
| Memory Usage | No memory leaks during validation of large packets |
| Accuracy | Size calculation accurate to byte level |
| Configuration Load | Config property loaded once at app start or on refresh |
| UI Responsiveness | Packet list displays quickly even with many packets |
| Accessibility | Status icons have alt text; colors not only indicator |
| Performance | No blocking operations; validation in background if possible |
| Logging | All validation failures logged with complete context |
### Definition of Done
**Implementation:**
- [ ] Packet size validation logic created
- [ ] Configuration property 'mosip.registration.packet.max.size' integrated (reused from Desktop Registration Client)
- [ ] Size validation happens before upload attempt
- [ ] Oversized packets identified and marked
**UI Display:**
- [ ] "Cannot upload. packets exceed size limit " shown for oversized packets
**Operator Actions:**
- [ ] "Upload Ready Packets Only" button excludes oversized packets
**Error Handling:**
- [ ] Upload prevented if any selected packet exceeds limit
- [ ] Clear error message shown: "Cannot upload. packets exceed size limit"
- [ ] Size validation failure logged in AUDIT table
- [ ] Missing config property handled (default applied)
- [ ] Invalid config property handled (default applied)
**Configuration:**
- [ ] Property read from 'mosip.registration.disk_space_size'
- [ ] Default value 5 MB applied if missing
- [ ] Configuration change reflected after app restart/refresh
- [ ] Property value can be modified via backend without code change
**Testing:**
- [ ] Unit tests for size validation logic (>80% coverage)
- [ ] Test valid packets (under limit)
- [ ] Test oversized packets (exceeding limit)
- [ ] Test packets exactly at limit (should be valid)
- [ ] Test default limit (if config missing)
- [ ] Test config property change
- [ ] Manual testing on device
- [ ] Audit logging verified
**Localization & Accessibility:**
- [ ] All messages localized with i18n keys
- [ ] Translations added for all supported languages
- [ ] Warning icons have alt text/content descriptions
- [ ] Status information accessible to screen readers
- [ ] Colors not only indicator of status
**Code Quality:**
- [ ] Code reviewed by 1 senior developer
- [ ] No lint warnings
- [ ] Clean, maintainable code
- [ ] Comprehensive comments
- [ ] Code merged to develop branch
**Documentation:**
- [ ] Implementation documented
- [ ] Configuration property documented
- [ ] Error messages documented
- [ ] Operator manual updated
- [ ] Administrator guide updated (how to change size limit)
Description
As an Operator, I want the system to validate each registration packet size before uploading and prevent uploading packets that exceed the configured maximum size limit, So that I am informed when packets are too large, understand why they cannot be uploaded, and can take appropriate action to resolve the issue before attempting upload.
Purpose
To prevent failed uploads due to oversized packets, provide clear error messages to operators about which packets violate size constraints, and improve data transfer efficiency by catching size issues before network transmission.
Pre-requisites
Basic Flow
Step 1: Configuration Property for Maximum Packet Size
System has existing configuration property in Desktop Registration Client:
[mosip.registration.disk_space_size](https://github.com/mosip/mosip-config/blob/2cc684ab38a04fd02a2a91fa2bf7e220535ae4eb/registration-default.properties#L225)Android Registration Client reuses SAME property:
Step 2: Before Upload - Validate Packet Size
When operator clicks "Upload" button:
System retrieves configured max packet size:
For EACH packet in the upload queue:
System performs check BEFORE any network request:
System categorizes packets:
Step 3: Display Size Validation Errors in Packet List Status Column
Status Column Details:
Packet size is high
for each selectedPacket:
if (packet.fileSize > maxPacketSize) {
throw SizeViolationException(packet)
}