Salt eggplant. Toss cubes with 1 tsp salt. Rest 20 min. Rinse and pat dry.
Brown eggplant. Heat 2–3 tbsp oil in a wide pan. Sauté eggplant until golden and tender. Remove.
Sauté base. Add 2 tbsp oil. Cook onion and celery 5–6 min. Add garlic 30 sec.
Make sauce. Stir in tomatoes. Simmer 5–7 min to thicken.
Finish caponata. Add eggplant, olives, capers, vinegar, sugar, oregano, chili. Season. Simmer 5 min. Adjust vinegar/sugar for agrodolce. Rest 10 min off heat.
Cook pasta. Boil rigatoni in salted water until al dente. Reserve ½ cup pasta water. Drain.
Combine. Toss pasta with caponata. Add a splash of pasta water and a drizzle of oil to coat.
Serve. Top with basil (and pine nuts or ricotta salata, if using). Enjoy warm or at room temperature.