[...] And I think the fact that it requires insertion of the :delay at the top is a bug as well, this was not required somewhere in the 6.32 ages but at some point suddenly it was needed.
Totally agree. I too like an idempotent script. But as @pe1chl points out even export then import
ONCEis fraught with problems. So long way from direct support for idempotence. But no shortage of workarounds/hacks.
Wrapping groups of configuration into a function is another approach. I've been trying this in V7 by having a script file with only functions, that I then just import. Since my first import is only functions, no actual configuration, it does nothing (other than expose a set of :global x do={}). Then I have another script that calls a subset of the functions to create/fixup a config – I write each function to be idempotent – instead of trying make a whole script file idempotent.
And with parameters on my functions can do stuff like have another script file that makes 10 functions calls, each with different "vlanid=", that add 10 VLANs (with each function call adding [setting/removing] the associated DHCP server, IP address, FW rules, etc for the VLAN). In my case, I generally start with the assumption the default-configuration is applied (vs no configuration), and have then function to "fix it", this avoid dropping connection when interfaces change and also then QuickSet generally isn't as potential destructive if you leave the "defconf" comments alone (e.g. on the default LAN IP address etc).
Not ideal. But yeah I wanted to avoid all the oddities of import/export myself, since @pe1chl right it's just not easy to even do export then import AND hasn't gotten better with time either...