I like software engineering. So much so I don't just do it at work, I do it as a hobby as well. I now have several small open source projects, mostly released under permissive licenses.
Occasionally at work I've had projects that seem quite good fits for these libraries. But I've always been wary of any intellectual property issues or conflicts of interest.
For instance, let's say there's an edge case bug in library X that prevents me completing work project Y. Should I write the bugfix at work, or at home? If at work, do I reserve IP rights? If at home, what if I'm not paid for my overtime?
Similarly, what if my employer's interests conflict with my users' more generally? A hypothetical example would be a backdoor in a library that needs to be highly secure. Another might be a rewrite that is functionally superior but has a stricter license (e.g. GPL). We could fork the code at this point, but my employer might be dismayed to now be maintaining their own branch of the library
My instinct is that it's safer just not to bother, but this does seem a terrible shame. It also seems a dereliction of duty when building an in-house library is expensive. Is it possible to safely negotiate these issues or is it easiest just to keep one's work and personal code separate - even to the detriment of the commercial project? And - can my employer demand that I use my library in one of their projects?