any actually good solution for preventing the player from falling off ledges?

its not gonna be that big, but even if it was i would be ok with it being a tedious process. the problem is (as i listed in the original post) that ledges can become walkable paths and walkable paths can become ledges when the player uses the main mechanic of the game which is to be able to swap the positions of certain chunks of the world and also rotate them, making new paths and breaking others. this means that manually placed collision will not work. and as i stated, dinamically generating collision doesnt seem easy either. maybe if i could use some sort of boolean logic and mark where i want “air” instead of where i want collision i could follow that aproach