Skip to content

Conversation

@james00012
Copy link
Contributor

@james00012 james00012 commented Dec 19, 2025

Summary

  • Fixes execution hang when scanning accounts with large resource counts (e.g., 72,000+ SNS topics)
  • When resource count exceeds 500, displays a summary table (counts by resource type and region) instead of listing each resource individually
  • Users can still get the complete list using --output json

The Problem

pterm table rendering has O(n²) complexity - it iterates all rows multiple times for column width calculation and rendering. With 72,000+ resources, this causes the tool to hang at the "Found AWS Resources" stage.

The Fix

  • Added MaxResourcesForDetailedTable = 500 threshold
  • When exceeded, render a compact summary table showing counts by type/region
  • Display a warning message directing users to --output json for full details
  • Applied to both AWS and GCP resource rendering

Example Output (when > 500 resources)

⚠ Found 72000 resources (exceeds display limit of 500). Showing summary by resource type.
ℹ Use --output json to get the complete list of resources.

┌───────────────┬────────────┬───────┐
│ Resource Type │ Region     │ Count │
├───────────────┼────────────┼───────┤
│ SNS Topic     │ us-east-1  │ 72000 │
└───────────────┴────────────┴───────┘

Test plan

  • Code compiles successfully
  • All existing UI tests pass
  • Manual test with large resource count

Fixes #980

When resource count exceeds 500, display a summary table (counts by
resource type and region) instead of listing each resource individually.
This prevents pterm table rendering from hanging due to O(n²) complexity
with very large datasets (e.g., 72,000+ SNS topics).

Users can still get the complete list using --output json.

Fixes #980
@james00012 james00012 marked this pull request as ready for review December 21, 2025 04:49
@james00012 james00012 requested a review from denis256 as a code owner December 21, 2025 04:49
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.

Execution hangs due to printing of resources with a high amount of resources

2 participants