The winner for this specific application (measuring angles on robot arms for inverse kinematics) is the 6mm hollow D-shaft potentiometer from P3 America:
Despite the simple and unassuming construction this family of pots gives pretty detailed absolute angle readings rivaling those of a hall-effect sensor at really wide 340 degree angles, while fitting inside a robot arm in their entirety, without being seen. Also they are $15 each.
I had to file a square opening in the arm bones for the cable to pass through, but it doesn't seem like a big deal because it modified wall geometry in just one small spot rather than having me drill a big hole right through the rotation center of each joint (you can always make holes bigger, but not the other way around).
This was the only potentiometer I found that was big enough to accept a 6mm shaft, yet small enough to fit inside of something else without being seen. Note that the D-shaft is not 5.4mm on the "flatted" portion like standard robot parts (from GoBilda, RobotShop, or ServoCity), it's actually smaller, so I had to file the opening to fit in a 6mm D-shaft, but oh well.
Also note that it doesn't have physical contact "leads", rather they are just simple PCB traces. Any wires you solder to the traces get fatigued very fast and break off easily, so I am using a shrinkwrap cover here combined with electrical tape to create a make-shift wire protector. The shitty leads along with flimsy plastic construction are the only thumbs-down issues with this pot. It would be incredibly cool if P3 America made one like this, but without ears, all-metal, with super nice pre-soldered leads that have a rubber wire protector built in.
Lastly, it is pictured here with the mounting "ears" forcibly removed by using pliers, which did not affect its function. So I suppose this product makes up for its weak construction by having the capability to be "re-skinned" by stripping away pieces and replacing them with other cooler-looking pieces while it still works.
Now for the other contenders, most of which are way more expensive and hard to fit anywhere, while producing readings with a very similar precision. Runner up - the hall-effect potentiometer with analog output, also from P3 America:
Very accurate readings, especially with regard to linearity, but not that different than the cheap and simple pot reviewed above. The magnet fits perfectly on a 6mm round shaft or D-shaft, but I would have to drill a counter-sink into one of the arm bones to accept a part of the magnet (the one pictured here), while drilling the outer joint of the other arm bone straight through (with a pretty huge drill bit) to fit the body. Once I did all that, I would still have to fixate the joint with a hub on one end, and the joint would only be secured from one side with the rotating shaft (the other side would have the magnet). On the plus side, the leads are not only strong, but also are a micro-JST connector that can be disconnected. Overall strong construction even though it's plastic, and part of the "barrel" could be sawed off to fit into a tighter space, thus there is still capacity for "re-skinning". Small enough to fit into most designs without being seen.
Next up is JT-30 absolute encoder from DigiKey (5V and 12V logic available):
Incredibly smooth motion, very light despite sweet all-metal construction, perfectly standard 6mm D-shaft that fits all robot parts. Not only does it have strong, protected leads, but actually ships with shielded audio-grade cable built-in. The same cable I bought separately to use specifically for potentiometers so that my readings don't jump around too much. The downside is that the body is still pretty big so it cannot be concealed, and the shaft cannot be removed to be replaced with a longer shaft. That severely restricts where you can place them, since somehow you need to connect this shaft to the shaft that the robot arm rotates on.
Next we have MA-3 from US Digital:
Very nice all-metal construction, silky-smooth motion, and disconnect-able JST leads, easy to place by screwing it in, but the body is too long to be concealed. It would be better if it was a larger diameter and shorter. The shaft is 1/8" (no 6mm option unless you order custom) and can not be replaced with a longer shaft, which means you have to find a way to connect it to the rotation shaft of the arm bone. Too bad! I hear they can be custom-ordered with shafts of different diameters and lengths, but it would require a huge order quantity.
Then we have this $5 long-shaft linear potentiometer from eBay, likely made in India (Vishay, etc):
The body is large enough that it cannot be concealed, and strong enough construction that it cannot be re-skinned (any attempts at modification would just destroy it, believe me, I tried). The shaft is 1/8" which would require re-drilling a 6mm shaft to 1/8 (again, hard to make a hole smaller if I decided to undo). On the positive, the construction is very strong, the long shaft can be sawed off if needed and function as the actual rotation shaft of the robot arm. The contacts are fairly nice and won't be fatigued easily.
If you were wondering what's inside of these, here you go :)
Last one that's worth mentioning is AndyMark AM-4179:
This is another luxury hall-effect absolute encoder (about $40 each) but too big for many human or animal-sized robot limbs. I will try it out on the robot torso since I still need a way to track the rotation of the entire upper body.
It's a little flimsy but easy to mount if you have the space and very easy to conceal, again, if the joint has a large enough diameter because it's so low-profile. There are complaints in the comments that the magnet can break easily but it is available for purchase separately so if you're serious about these maybe order an extra magnet.