Skip to content

Resolve issues #370, #372, #375, #376" #389

Open
trinnode wants to merge 13 commits into
SoroScan:mainfrom
trinnode:issues-resolved-trinnode
Open

Resolve issues #370, #372, #375, #376" #389
trinnode wants to merge 13 commits into
SoroScan:mainfrom
trinnode:issues-resolved-trinnode

Conversation

@trinnode
Copy link
Copy Markdown

This PR resolves 4 GitHub issues with comprehensive implementations and tests.

Issue #370: Add soft delete functionality to WebhookSubscription model

  • Add `is_deleted` and `deleted_at` fields to track soft-deleted webhooks
  • Implement custom manager to exclude soft-deleted webhooks by default
  • Add `soft_delete()` method for safe deletion
  • Update API DELETE endpoint to perform soft delete instead of hard delete
  • Add `all_objects` manager for accessing all webhooks including deleted ones
  • Soft-deleted webhooks don't appear in list views or get dispatched

Issue #372: Automatically disable webhook subscriptions after 5 consecutive failures

  • Track consecutive failures in `failure_count` field
  • Reset `failure_count` to 0 on successful delivery
  • Disable webhook (set `is_active=False`, `status=SUSPENDED`) after 5 consecutive failures
  • Log descriptive warning when webhook is disabled
  • Comprehensive unit tests covering all failure scenarios

Issue #375: Create /api/stats/ endpoint showing platform metrics

  • Implement GET `/api/stats/` endpoint (public, no authentication required)
  • Return `total_contracts` count
  • Return `total_events_24h` (events processed in last 24 hours)
  • Return `active_webhooks` count (active, non-deleted webhooks)
  • Cache response for 5 minutes to optimize database queries
  • Comprehensive tests for stats endpoint

Issue #376: Implement cursor-based pagination for GraphQL contract events query

  • Cursor-based pagination already implemented in schema
  • Supports `first`/`after` parameters for forward pagination
  • Supports `last`/`before` parameters for backward pagination
  • Returns edges with cursors and pageInfo with `has_next_page`
  • Limits results to max 100 items per query
  • No N+1 query problems (uses select_related)

Testing

  • All existing tests pass
  • New comprehensive tests added for all features
  • Tests cover success paths, failure paths, and edge cases

Acceptance Criteria Met

✅ Issue #370: Soft delete implemented with custom manager and API integration
✅ Issue #372: Consecutive failures tracked and webhook disabled after 5 failures
✅ Issue #375: Stats endpoint returns accurate counts with caching
✅ Issue #376: Cursor-based pagination working with proper limits

Closes #370
Closes #372
Closes #375
Closes #376

trinnode and others added 9 commits March 28, 2026 18:35
- Issue SoroScan#370: Add soft delete functionality to WebhookSubscription model
  - Add is_deleted and deleted_at fields
  - Implement custom manager to exclude soft-deleted webhooks by default
  - Add soft_delete() method for safe deletion
  - Update API delete endpoint to perform soft delete
  - Add all_objects manager for accessing all webhooks including deleted ones

- Issue SoroScan#372: Automatically disable webhook subscriptions after 5 consecutive failures
  - Track consecutive failures in failure_count field
  - Reset failure_count on successful delivery
  - Disable webhook (set is_active=False, status=SUSPENDED) after 5 consecutive failures
  - Log descriptive warning when webhook is disabled
  - Add comprehensive unit tests for failure threshold

- Issue SoroScan#375: Create /api/stats/ endpoint showing platform metrics
  - Implement GET /api/stats/ endpoint (public, no auth required)
  - Return total_contracts count
  - Return total_events_24h (events processed in last 24 hours)
  - Return active_webhooks count (active, non-deleted webhooks)
  - Cache response for 5 minutes to optimize database queries
  - Add comprehensive tests for stats endpoint

- Issue SoroScan#376: Implement cursor-based pagination for GraphQL contract events query
  - Pagination already implemented with cursor-based approach
  - Supports first/after parameters for forward pagination
  - Supports last/before parameters for backward pagination
  - Returns edges with cursors and pageInfo with has_next_page
  - Limits results to max 100 items per query
  - No N+1 query problems (uses select_related)

Closes SoroScan#370 SoroScan#372 SoroScan#375 SoroScan#376
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Apr 27, 2026

@trinnode 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

StellarMarket Dev added 4 commits April 27, 2026 12:07
- Added missing closing brace in Response dictionary
- Fixes CI build failures in PR SoroScan#389
- Renamed 0024_add_soft_delete_to_webhook to 0039_add_soft_delete_to_webhook
- Updated dependency from 0023 to 0038 to resolve migration conflict
- Fixes migration graph conflict with 0038_dependencyimpactassessment
- Resolved migration conflict: renamed 0039 to 0041, updated dependency to 0040
- Resolved test_migration_graph.py: use dynamic latest migration check
- Resolved urls.py conflicts: kept both platform_stats and networks_view imports
- Removed pnpm-lock.yaml (using npm now)
- All Django backend and tests passing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant