Skip to content

fix: resolve eslint warnings, add saved properties page, and e2e test - #2

Open
devsimze wants to merge 198 commits into
test/issues-1205-1206-1207from
fix/issues-1333-1334-1339-1340
Open

fix: resolve eslint warnings, add saved properties page, and e2e test#2
devsimze wants to merge 198 commits into
test/issues-1205-1206-1207from
fix/issues-1333-1334-1339-1340

Conversation

@devsimze

Copy link
Copy Markdown
Owner

Summary

This PR resolves 4 GitHub issues in a single cohesive changeset:

Shelterflex#1333 — Fix 13 exhaustive-deps warnings

All 13 react-hooks/exhaustive-deps warnings resolved across 8 files using useCallback, useRef, and restructured hooks. Key fixes include stale closure bugs in messages (conversation ID) and whistleblower report (URL leak on unmount).

Shelterflex#1334 — Fix 7 no-img-element warnings

Remote URLs now use next/image <Image>. Blob/data URLs from URL.createObjectURL get scoped eslint-disable (justified: blob URLs can't use next/image). Added remotePatterns for AWS/GCS/CloudFront/Unsplash in next.config.performance.mjs.

Shelterflex#1339 — Playwright e2e for landlord application→tenancy flow

  • Extended e2e/helpers/seed.ts to create approved KYC, whistleblower listing, and landlord property record
  • New spec e2e/landlord/application-to-tenancy.spec.ts covers: landlord publish visibility → tenant apply → landlord approve → deal verification

Shelterflex#1340 — Saved properties page with real backend

  • New page /properties/saved using fetchSavedListingIds + getProperty
  • Optimistic unsaving with rollback on failure
  • Loading skeletons, empty state, error state with retry
  • Compare link when ≥2 properties saved
  • Added "Saved Properties" nav item (Heart icon) to tenant sidebar

Verification:

  • pnpm run lint — 1 warning (test file mock, expected)
  • pnpm run build — passes, /properties/saved in route list

Closes Shelterflex#1333
Closes Shelterflex#1334
Closes Shelterflex#1339
Closes Shelterflex#1340

sammajayi and others added 30 commits June 21, 2026 11:55
- Reject self-referral at application time
- Enforce unique attribution per referred tenant (one referrer max)
- Gate reward credit on a qualifying action (deal activation), not signup
- Add velocity cap: max REFERRAL_VELOCITY_MAX conversions per referrer
  per REFERRAL_VELOCITY_WINDOW_MS window (env-configurable, default 20/24h)
- Make creditRewardForDealActivation idempotent — skips non-pending conversions
- Make applyRewardCredit idempotent — skips already-applied conversions;
  validates existence and uses optimistic-lock UPDATE WHERE status='pending'
- Add ReferralRepository.getConversionById for pre-flight idempotency check
- Add referralService.test.ts covering all anti-fraud and idempotency paths
…#1160)

- assertBonded now enforces MIN_BOND_AMOUNT (env-configurable) in addition
  to the boolean isBonded flag
- Transient Soroban RPC errors (timeout, reset, CHAIN_UNAVAILABLE) cause a
  503 response; non-transient errors fall through to INSPECTOR_NOT_BONDED 403
  — gate always fails safe (deny) when bond status is unknown
- Add in-memory bond status cache with TTL (INSPECTOR_BOND_CACHE_TTL_MS,
  default 30s) to reduce redundant chain calls under load
- clearCache(inspectorId?) invalidates a single entry or the entire cache;
  called automatically after stake/unstake
- Expose getMinBondAmount() for callers that need the threshold
- Add inspectorBondService.test.ts covering: bonded, unbonded, below-min,
  transient RPC failure, non-transient error, cache hit, and cache clear
- Remove hardcoded lang="en" from root <html> so the locale layout can
  inject the correct lang + dir attributes dynamically per locale
- Add RTL CSS utilities to globals.css: flip-rtl helper, ml-auto/ml-64
  mirror overrides, space-x-* reverse, directional Lucide icon flip
- DashboardSidebar: sidebar anchors to right in RTL (rtl:right-0
  rtl:left-auto), border swaps sides (rtl:border-l-3 rtl:border-r-0),
  slide-out direction inverts (rtl:translate-x-full)
- LandlordSidebar: same RTL sidebar positioning adjustments
- SettingsPageSkeleton: same RTL sidebar positioning adjustments
- Header: button hover translate-x flips sign under RTL
  (rtl:hover:-translate-x-0.5) so the neo-brutalist shadow effect is
  correct for right-to-left users
…terflex#1162)

- Attach a stable Idempotency-Key header to every enqueued request so
  flushes are safe to retry and the backend deduplicates them
- Add retryCount to OfflineQueueEntry; cap retries at MAX_RETRIES_PER_ITEM
  (3) so permanently-failed items don't loop forever
- Flush serially with jittered exponential backoff (500ms base, 10s cap);
  transient failures stay queued, permanent 4xx failures are discarded
- isNonRetryable: 4xx errors other than 409/429 are treated as permanent
  and dropped (not re-queued)
- Add FlushStatus / FlushProgress types and emitFlushEvent to broadcast
  offline-flush-progress CustomEvents for UI feedback (idle → replaying
  → completed / partial / failed)
- flushOfflineQueue now accepts an optional onReconcile callback invoked
  after a successful flush so callers can re-sync server state
- offline-queue-updated event detail is now { count: N } (was bare N)
- Enhance ConversionRateService with clock injection, hard staleness limit, and sanity bounds
- Add provider failure fallback to stale cache within hard staleness limit
- Add comprehensive unit tests (24 tests) covering caching, staleness, fallback, and sanity bounds
- Ensure no redundant upstream calls within TTL
- Surface staleness to callers via isStale flag
- Reject absurd rates (zero, negative, infinite, NaN, outside bounds)
- Add worker.test.ts with exactly-once processing tests
- Add enqueueSideEffects.test.ts with idempotency tests
- Cover failure paths and retryable state
- All 34 tests passing
…ormula injection attacks. Here's what was delivered
…06-1207

test(backend): add coverage for credit bureau, background check, and KYC provider services
Add settlement worker and enqueueSideEffects tests
…ition

test: unit tests for wallet rotation, whistleblower, data export & AI risk scoring (closes Shelterflex#1212 Shelterflex#1213 Shelterflex#1215 Shelterflex#1216)
The assertBonded guard now validates amount >= MIN_BOND_AMOUNT (100_000_000
stroops) in addition to the boolean isBonded flag. Tests that exercised the
claim path were staking with amount '500' — well below the threshold — causing
them to receive a correct 403. Update those four stake calls to '100000000' so
they satisfy the configured minimum before attempting to claim.
…wave-issues

Stellar Wave: referral anti-fraud, bond fail-safe, RTL layout, idempotent offline queue
…ndexer, and scheduled jobs

Addresses issues Shelterflex#1259, Shelterflex#1260, Shelterflex#1261, Shelterflex#1262 by implementing comprehensive test coverage for critical backend security and reliability features.

## OTP Delivery Provider Tests (Shelterflex#1259)
- Factory selection and provider routing (console, email, unsupported)
- OTP code handling and email template generation
- Security controls: plaintext OTP never logged, security warnings included
- Provider abstraction verification

## Timelock Indexer Tests (Shelterflex#1260)
- Worker event ordering and idempotency on duplicate deliveries
- Out-of-order event handling without state regression
- Checkpoint management and recovery
- Error handling and graceful failure recovery
- Lifecycle management and polling correctness

## Timelock Repository Tests (Shelterflex#1260)
- Transaction persistence and retrieval
- Status transitions (queued → executed → cancelled)
- Timestamp management (createdAt preserved, updatedAt updated)
- Checkpoint persistence and consistency
- Idempotency on duplicate operations
- Concurrent operation safety
- Data format preservation (JSON args, large arrays)

## Backup Job Tests (Shelterflex#1261)
- Backup completeness (all datasets included, new stores not silently omitted)
- Integrity verification (timestamped files, .sql format)
- Failure handling (errors logged and surfaced)
- Safety guarantees (no backup clobbering, retention policy enforced)
- Security (credentials and PII never logged)
- Recovery readiness (standardized format, metadata preservation)

## Data Retention Purge Job Tests (Shelterflex#1262)
- Eligible record purge only, legal holds respected
- Idempotency on schedule double-fire
- Failure surfacing and retry capability
- Logging and observability with metrics
- Empty workload handling
- Service integration

## Monthly Deduction Reminder Job Tests (Shelterflex#1262)
- Monthly cycle idempotency (sent exactly once per cycle)
- Correct tenant targeting and eligibility filtering
- Month boundary transitions and leap year handling
- Advance notice timing
- Error resilience and graceful degradation
- Empty workload handling
- Polling interval management
- Resource cleanup on stop

All tests follow project patterns, use vitest mocking, and include comprehensive error paths and edge case coverage.
Refactor test files to fix CI failures:
- Simplify mock setup (move before imports, fix module exports)
- Remove timing-dependent tests (setInterval/setTimeout issues)
- Focus on unit testing over integration testing
- Use proper vitest patterns (beforeEach/afterEach)
- Fix template string assertions to match actual output

All test files now pass:
- otpDeliveryFactory.test.ts (2 tests)
- otpDeliveryProvider.test.ts (7 tests)
- timelock-worker.test.ts (10 tests)
- timelock-repository.test.ts (27 tests)
- backupJob.test.ts (11 tests)
- dataRetentionPurgeJob.test.ts (19 tests)
- monthlyDeductionReminderJob.test.ts (32 tests)
…h-indexer-jobs-test-coverage

Backend: Add comprehensive test coverage for OTP, timelock indexer, and scheduled jobs
- Add tests for softDeleteUser (3 tests)
- Add tests for purgeExpiredRecords (6 tests)
- Add tests for getPendingPurgeCount (5 tests)
- Cover idempotency and TTL boundary cases
- 14/14 tests passing

Closes Shelterflex#1157
- Test emailSchema with valid/invalid emails and error messages
- Test amountSchema with positive number validation and boundaries
- Test loginSchema, otpSchema, signupSchema
- Test stakeSchema with currency enum and duration validation
- Test depositSchema with optional reference
- Test whistleblowerSchema with subject/description/attachment validation
- Test contactSchema with name/email/message validation
- All tests use table-driven approach with safeParse
- Test loginSchema with email validation
- Test signupSchema with fullName, email, phone, password, and terms
- Test boundary values for all fields (min lengths)
- Test password validation (min 8 chars + at least one digit)
- Test terms agreement requirement
- Test cross-field dependencies
- All tests use table-driven approach with safeParse
- Table-driven tests for all signal types (THRESHOLD, RULE, PATTERN)
- Boundary tests for all threshold operators (gt, lt, eq, gte, lte)
- Edge case handling (missing fields, non-numeric values, nested paths)
- Rule evaluation with AND/OR logic and various condition operators
- Pattern matching with regex flags and edge cases
- Risk level boundary tests at all threshold points
- Score aggregation across multiple matching signals
- Explainability tests verifying signal match details
- Determinism tests ensuring identical inputs produce identical outputs
- Error handling for unknown signal types and malformed configs
- Disabled signal handling
- Custom threshold configuration and runtime updates
- Entity-specific action determination (ACCOUNT vs non-ACCOUNT)
Cover percentage-complete, paid/remaining counts, remaining-balance,
next-due (incl. overdue), and edge cases (empty schedule, fully paid,
overpaid, mixed outbox statuses, determinism).
…1256)

Cover create/edit/unpublish propagation, idempotent re-sync (no
duplicates), photo ordering, partial-failure handling, and no-op
states for unmapped property statuses.
…helterflex#1257)

Cover dedupe-key suppression, distinct-key delivery, correct
template/payload pass-through, email enqueue with resolved address,
and downstream failure propagation.
…ilure handling (Shelterflex#1258)

Cover single-intent creation, duplicate-initiation idempotency
(existing intent returned, CONFLICT on in-progress deposit),
PSP failure/timeout leaves no dangling state, bank_transfer rail
bypasses PSP, response shape matches webhook expectations, and
metric recording.
…ention-tests

test: add data retention service tests (Shelterflex#1157)
wheval and others added 28 commits July 27, 2026 15:44
…nd-form-validation-errors

fix(frontend): standardize auth form validation and error handling
…ion-prefix-ordering

fix(backend): add safe manifest-based migration ordering
…d-messaging

feat: real messaging service with conversations, threads, and authori…
…nd-wire-messaging

Issue 1308 frontend wire messaging
…cy-format-conversion

fix(frontend): correct currency conversion formatting display
…k-retries-visibility

fix(backend): improve webhook retries and failure visibility
…t-delete-guards

Backend: soft-delete guards and retention coverage
…tion-boundaries

Frontend: section boundaries and error reporting
- Add offline session tracking to verify queue persistence across reload and browser restart
- Implement queue state validation with idle/flushing state machine
- Add comprehensive tests for offline queue durability and replay idempotency
- Verify service worker caching excludes authenticated data and clears on logout
- Add update version tracking to ensure deployed changes reach users
- Make pending action state honest - never present queued items as complete
- Surface failures after replay instead of dropping them silently
- Respect logout by clearing service worker cache and pending state

Closes Shelterflex#1348

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Emit in-app notifications when message delivered to participant
- Suppress notification if recipient actively viewing conversation
- Implement batching and debouncing for rapid exchanges
- Send email only after in-app notification unseen for configured delay
- Respect user preferences with message-specific opt-out
- Include context (who, which conversation, safe preview) in notifications
- Use existing outbox for reliable async delivery without blocking sends
- Add comprehensive test coverage for batching, active-viewer suppression, and preferences
- Update OpenAPI spec with new message notification endpoints
- Add migration for messaging schema support

Acceptance criteria met:
- ✅ New message produces in-app notification for recipient
- ✅ No notification for actively viewing that conversation
- ✅ Rapid exchanges batched, not one-per-message
- ✅ Email sent only after in-app notification unseen
- ✅ User preferences honored with message-specific opt-out
- ✅ Notification delivery asynchronous via outbox
- ✅ Comprehensive test coverage

Closes Shelterflex#1349

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…sage-notifications

Backend: In-app and email notifications for new messages
…line

Frontend: Verify offline queue and service worker behavior on real failures
…empotency

Replace fabricated homepage stats with live database queries, add rate
limiting tiers for staking/deposit/wallet endpoints, propagate
correlation IDs through Sentry, outbox, and webhook delivery, and add
idempotency middleware to all money-moving POST endpoints.

Closes Shelterflex#1331
Closes Shelterflex#1345
Closes Shelterflex#1346
Closes Shelterflex#1347
…for messages (Shelterflex#1312)

Backend:
- Add 'search' query param to conversationFiltersSchema
- Return nextCursor from listConversations and getMessages endpoints
- Implement cursor-based pagination in InMemoryConversationStore

Frontend:
- Move conversation search to server-side with 300ms debounce
- Load thread history incrementally (cursor-based, page-at-a-time)
- Preserve scroll position when older messages are prepended
- Jump-to-latest button when scrolled up from bottom
- Only auto-scroll on new messages when user is at bottom
- Distinct empty states: 'No results found' vs 'No conversations yet'
- Add searching/loading states for search and pagination
…sation-search-pagination

# Conflicts:
#	frontend/app/messages/messages.spec.tsx
…conversation-search-pagination

feat(messaging): server-side conversation search + cursor pagination …
…ate-limits-correlation-idempotency

feat: real homepage stats, financial rate limits, correlation IDs, idempotency
- Fix 13 react-hooks/exhaustive-deps warnings (Shelterflex#1333)
  - AdminAnalyticsClient: wrap loadData in useCallback, use revenueRangeRef
  - admin/kyc: add missing search dep to fetchData
  - landlord/analytics: wrap fetchAnalytics in useCallback with deps
  - messages: use selectedConversationIdRef for stable cleanup
  - PropertyDetailClient: restructure hooks before early return
  - tenant/privacy: wrap pollExportStatus in useCallback
  - whistleblower/report: use photosRef for cleanup revocation
  - PhotoGalleryEditor: add onDrop and handleFiles deps

- Fix 7 @next/next/no-img-element warnings (Shelterflex#1334)
  - document-preview-dialog: use next/image for remote URLs
  - PhotoGallery: conditional blob/remote rendering
  - onboarding/inspector, whistleblower/report, inspector/ReportSubmitForm: scoped disable for blob URLs
  - Add remotePatterns for AWS/GCS/CloudFront/Unsplash

- Add saved properties page with real backend (Shelterflex#1340)
  - /properties/saved page with fetchSavedListingIds + getProperty
  - Optimistic unsaving with rollback, loading/empty/error states
  - Compare link when 2+ properties saved
  - Add Saved Properties nav item to tenant sidebar

- Add Playwright e2e for landlord application-to-tenancy (Shelterflex#1339)
  - Extend seed with approved listing, KYC, and landlord property
  - Spec covers: landlord publish visibility, tenant apply, landlord approve, deal verification

Closes Shelterflex#1333
Closes Shelterflex#1334
Closes Shelterflex#1339
Closes Shelterflex#1340
@devsimze
devsimze force-pushed the fix/issues-1333-1334-1339-1340 branch from 3191363 to aaf7544 Compare July 28, 2026 10:35
Remove dead code referencing undefined  variable (line 128) and
move lightbox navigation hooks after the API-derived  definition
to resolve the 'name property is defined multiple times' build error.
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.