Skip to content

Feat/upload scan error ux - #744

Open
Abdulmajeed82 wants to merge 4 commits into
OpenLedger-Foundation:mainfrom
Abdulmajeed82:feat/upload-scan-error-ux
Open

Feat/upload scan error ux#744
Abdulmajeed82 wants to merge 4 commits into
OpenLedger-Foundation:mainfrom
Abdulmajeed82:feat/upload-scan-error-ux

Conversation

@Abdulmajeed82

Copy link
Copy Markdown

Closes #656

Abdulmajeed82 and others added 4 commits August 29, 2026 18:23
Implements dedicated unit tests for isBatchCancelEligible and isBatchRepayEligible
helpers as requested in OpenLedger-Foundation#670. Previously these functions were only exercised
indirectly through the SME dashboard toolbar integration tests.

Test coverage includes:
- Cancel eligibility: listed vs funded status rules (6 tests)
- Repay eligibility: before/after due date comparison (7 tests)
- Timezone boundaries: UTC midnight, UTC offsets, and absolute instants (3 tests)

All acceptance criteria met:
- Both cancel and repay branches fully covered with 16 passing tests
- Due-date timezone edges thoroughly tested with millisecond precision
- pending_mint behavior documented in inline comments
- No production code changes required

Closes OpenLedger-Foundation#670
Implements complete intended destination flow for protected routes:

- ConnectWalletGuard now captures current pathname as intended destination
  when accessing protected routes (/invoice/create, /dashboard/sme, /dashboard/investor)
  while disconnected, unless an explicit redirectTo query param is provided

- Respects explicit redirectTo query param as highest priority for redirection

- After wallet connection, user is redirected to the intended destination

- Intended destination is cleared after one use to prevent redirect loops

- Modal is closed before navigation to provide smooth UX

Changes:
- components/layout/ConnectWalletGuard.tsx: Enhanced IntendedDestinationSetter
  to capture current pathname for protected routes
- hooks/useWallet.ts: Improved connectWallet() to include fallback logic,
  clear modal, and clear destination after use
- e2e/connect-wallet-intended-destination.spec.ts: Added comprehensive E2E
  test coverage for the guard flow, connection, and redirect scenarios

Acceptance Criteria:
✅ Disconnected visit to /invoice/create returns there after connect
✅ redirectTo query param is respected
✅ Destination is cleared after one use (no redirect loops)
✅ No redirect loop guaranteed by clearing after navigation
✅ E2E covers the happy path: guard → connect → lands on create

Closes OpenLedger-Foundation#661
- Add VirusScanRejectionError and UploadError classes to lib/ipfs.ts to differentiate error types
- Enhance xhrUpload() to parse VirusTotal scan details and throw appropriate error class
- Update app/invoice/create/page.tsx error handling to display scan rejection messages
- Add comprehensive unit tests for parseUploadRejection() (20 tests covering scan vs generic errors)
- Add unit tests for VirusScanRejectionError and UploadError classes (4 tests)
- Add i18n translations for virus-scan rejection messages in all supported languages
- Verify no file contents are logged in error traces
- Error messages distinguish between security rejections and generic upload failures
@drips-wave

drips-wave Bot commented Aug 29, 2026

Copy link
Copy Markdown

@Abdulmajeed82 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

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.

Surface virus-scan rejection reasons in invoice upload UI

1 participant