refactor(compaction): isolate retained labels (#5405)