I am working on a relatively large Phoenix LiveView codebase where a shared LiveComponent is used across many pages.
Recently, I needed to add a new assign to this component as part of a feature update. However, this component is deeply nested and reused in many places, sometimes indirectly through other components or templates.
The challenge is verifying that this new assign is correctly passed and propagated everywhere the component is used.
Manually opening and checking every page is not practical due to the scale of the codebase.
My questions are:
How do you typically verify assign propagation in such situations?
Are there recommended patterns or testing strategies for this?
Do you rely on specific tooling, conventions, or automated checks?
For example, I am considering approaches like:
Adding runtime checks or warnings when required assigns are missing
Writing tests at the component level, but I’m unsure how to ensure coverage across all usages
Refactoring the component API to make missing assigns fail fast
I would appreciate any practical advice or experiences from similar situations.
If you need it passed explicitly as an attribute you can wrap the <.live_component> in a function component to make use if attr/slot macros and their compile time validations. Still needs you to go through the codebase once to replace existing usages, but would help for the future. This doesn‘t help for data the live components gets through e.g. send_update though.
Just for validation, you can set up a named process in your supervision tree and have your live component send a message to it whenever it receives the assigns you’re interested in. You can send whatever metadata you want, like the ID. so it’s easy for you to validate everything is correct. The named process can log, write to a file, or whatever reporting method you prefer.
You won’t need to go through every page manually if you have extensive and reliable test suite. You’ll be able to spot problems in the named process’ reporting.