I tried the wall test with workstations by sticking Nitwits into boats and slowly edging them towards a workstation behind a wall and only stopping when they acquire the profession. They still seem to find it behind walls (unlike the beds), but the range seems to be less than 10 blocks (8 at a guess) - I've tested a few and none seemed to notice the workstation further than that. With beds, I think the range is under 15 (I've had 14 blocks a couple of times) - I kept placing beds 1 block closer to night-standing villagers starting from 30 blocks away with 5 second time gaps to allow the path finding system to update until the villager ran towards it. I have reason to believe those are the ranges. Also, the path finding system is lagged, so if I were to summon a villager outside of a village and then drive them in by boat, they would at first run away from the village, and then, after some time, turn around and run back (my point is that it seems to take some time to update, which is why the incremental time gap between placing beds and moving villagers closer to workstations was necessary).
One thing that thew me off was that baby villagers noticed the beds further and before the standing adult villagers did - there were two babies that spawned and did that but I couldn't check further since no other baby villagers spawned naturally in other worlds I created.
In a newly generated village, there seem to often be villagers that stay outside at night because there are not enough beds in the village, or they are simply too far away. Build a wall between a villager standing outside at night, then place a bed behind the wall, out of the villager's line of sight. The villager will not see it. Remove the wall, and then either immediately or within a few seconds, the villager travels to the bed. The villagers used in the test were all pre-generated villagers. Villagers summoned from spawn eggs could see past walls and found the hidden beds, but the long range issue still applied.
Recreating the bug has failed in the following circumstances: 1) when the villager couldn't move when it spawned in a slab ceiling in mid air, 2) when a villager seemed to be stuck to a potted cactus next to the bell in the centre of a village and 3) the bed was too far away, although the distance was actually quite short (approx. 20 blocks away). The first two were in desert villages. Number 3 can happen in any. With beds that are considered too far away by the villager, the wall test fails - there are empty, pre-generated beds in a village at night but some villagers as still standing outside (removing house walls does not fix the issue).
Yes, the problem still prevails in the latest 1.14 release:
[media]Yes, my villagers seem to also gravitate towards corners and stay there all night without sleeping. Whether that's because the path finding system genuinely believes that they can fit between diagonal blocks or some other reason, but they definitely recognise doors, and should use them as opposed to congregating into diagonal corners.
Whilst this issue can easily be fixed by filling in the corners, this happens naturally with some naturally generated villages, such as the Savanna, which is an inconvenience since the village looks nice and it would be unfortunate to mess with it and ruin it with extra blocks.
Here's an example:
[media][media]
Villagers who are not spawned by players (pre-generated villagers) still have this problem, so for survival players, this issue is not resolved. However, the villagers that are spawned by the player, i.e. with a spawn egg, are much better at path finding to a far away bed at night, and so for them, the issue is resolved. Pre-generated villagers, however, are still broken and will freeze/cease to move at night. They will remain in the same spot until morning without attempting to search for a bed. This is the case in 1.14.4 pre 2. I have not yet checked whether villagers that are spawned using spawn eggs retain their pathfinding abilities on following nights or if they soon adopt the same behaviours as pre-generated villagers the following nights.
[media]