As late as a couple of weeks before the school year starts, but most schools try to figure it out earlier. Spring scores factor in to the central recommendation, and schools are supposed to adjust that to what they know about students (i.e., consult the 3rd-grade teacher) so that the central rec is just a starting point, but there's been variation, there, from school to school. Schools also can move kids in (mostly) or out (if struggling) through the year, mostly after the first quarter.