Whoever wins will have the task of steering Canada amid domestic and foreign policy constraints