When using a stage snap that has a different base (i.e. building a base: core18 nodejs snap using node from the 10/stable track) there will not be access to the glibc from the core base snap and the snap fails to run with apparmor denials like below:
since snapcraft unpacks stage snaps, it can surely also check what base a stage snap uses, it should then fail the build or at least warn that you can not combine stage snaps with the chosen base.
I believe a warning is better suited than an error. It is possible that the contents inside of the staged snap are statically built or they could be a script and will run just fine on a different base.
Why it needs to get done
This will help developers creating snaps be aware at build time why their snap may fail to work. It can also help catch issues at build time where a staged snap was upgraded to a new core but the base snap doing the import was not.
What needs to get done
c/p from https://forum.snapcraft.io/t/snapcraft-should-fail-or-warn-when-using-a-stage-snap-with-different-base/21228
I believe a warning is better suited than an error. It is possible that the contents inside of the staged snap are statically built or they could be a script and will run just fine on a different base.
Why it needs to get done
This will help developers creating snaps be aware at build time why their snap may fail to work. It can also help catch issues at build time where a staged snap was upgraded to a new core but the base snap doing the import was not.