        levels=output.get('levels')
        expected_count=sum(len(chapter['steps']) for chapter in case['input']['chapters'])
        if set(output)!={'levels'} or not isinstance(levels,list) or len(levels)!=expected_count or any(type(value) is not int or value not in (0,1) for value in levels):
            return reject_shape('Expected only top-level levels: a flat array of '+str(expected_count)+' integers, each 0 or 1; nested chapters/steps are not silently flattened')
