I had someone run a constant hot to a new fan so it could operate with a remote. They left the old wiring inside the ceiling and it’s still contacted to a shared switch that operates other lights. The old wiring has nuts and electrical tape on the ends. When I turn on the lights I can see from a voltage meter that the old wires are hot. I only noticed this when I took the fan down to do some painting around the base. The wiring is inside the metal box that is part of the fan mount.
Is this safe and the correct procedure and is it to code?