Preheat your oven to 375°F (190°C). Bring a large pot of generously salted water to a boil.
In a small bowl, stir together 1/4 cup of the olive oil with the minced shallot, tomato paste, sliced garlic, rosemary, red pepper flakes, and sugar.
On a large baking sheet, toss the halved cherry tomatoes with the dressing. Season generously with salt and pepper, then spread them in an even layer.
On a second baking sheet, toss the rinsed white beans with the remaining 2 tablespoons of olive oil. Season generously with salt and pepper.
Roast the tomatoes and beans for about 25 minutes, stirring halfway through, until the tomatoes have slumped and released their juices and the beans are golden and slightly crispy.
While the vegetables roast, cook the pasta in the boiling water according to package directions until al dente. Before draining, reserve 1 cup of the starchy pasta water. Drain the pasta.
Transfer the roasted tomatoes and beans to the empty pasta pot. Pour 1/4 cup of the reserved pasta water onto the sheet pan that held the tomatoes. Use a flexible spatula to scrape up all the browned bits from the bottom of the pan. Pour this flavorful liquid into the pot with the tomatoes and beans. Repeat with another 1/4 cup of pasta water on the same sheet pan.
Add the drained pasta to the pot along with a final drizzle of olive oil. Stir vigorously over low heat for 1-2 minutes, adding more pasta water a splash at a time, until the pasta is glossy and well coated in a sauce.
Season to taste with additional salt and pepper. Divide among shallow bowls and top generously with grated Parmesan or pecorino cheese, if desired. Serve immediately.