To make the sauce, combine tomatoes and half their juice, carrot, onion, and basil in a saucepan. Bring to a boil and immediately reduce to a simmer. Cook over medium-low heat for 45 minutes with the cover partially askew, stirring occasionally. Tomatoes should simmer gently, or they will overcook and lose their clear flavor. Let mixture cool somewhat, then pass it through a food mill or strainer, which will remove all seeds and make a perfect purée of all the vegetables. (A food processor is not a substitute for a food mill, because it will not remove seeds and fibrous parts of vegetables.) Season purée with oil and set aside.
Meanwhile, to make the filling, place ricotta in a sieve to drain off excess moisture, about 30 minutes.
Thoroughly wash spinach to remove any sand, then discard any yellow or discolored leaves and all stems. Steam spinach, or cook in boiling salted water to cover, until tender but not overcooked. If boiled, drain well, reserving water the spinach has cooked over, then squeeze as much water as you can from spinach. Chop spinach finely; it is best to do this by hand. If you are using a food processor, be careful not to turn spinach to mush.
Meanwhile, to cook the pasta, add enough cold water to reserved spinach water to make 6 quarts and bring to a rapid boil. Add the 1½ tablespoons salt and pasta and cook for 15 minutes. Drain. Refresh pasta with cold water to prevent it from sticking together. Set aside.
To finish filling, beat egg with drained ricotta until smooth, then mix in spinach and remaining filling ingredients. Preheat the oven to 375°. Smear the bottom of a 10- by 14-inch baking pan with 2 to 3 tablespoons of the sauce. Using a teaspoon, stuff pasta shells with filling. They should be generously full but not so stuffed that they are wide open. Place stuffed pasta in pan and drizzle sauce over all.
Sprinkle with parmigiano, cover with foil, and bake until sauce is bubbly, 20 to 30 minutes. Serve immediately.