cModeExitFormat '!' handling in config file merge

We have a configuration with an example schema as follows

bridge default
 allowed-vlan 1,100
 vlan 100
  name VLAN100
  dhcp binding 00:11:22:33:44:55
   interface phy-1_1_1
 interface phy-1_1_1
  mode access
  access vlan 100

i.e. the interface leaf exists within dhcp submode and also outside. When we are merging the configuration snippet,

confd_load: 670: maapi_load_config(sock, tid, flags, abspath(argv[0])) failed: external error (19):
syntax error: "mode" is an invalid value.
Error: on line 153:   mode access

So it appears that the two ‘!’ after interface leaf in dhcp mode, not exiting from the dhcp submode. Thus it is running the mode access command within dhcp submode itself and hence leading to the error.

If we replace those two ! with exit then merge works.

Did anyone face similar issue?

Yes - the C-style is notoriously ambiguous. If you need to stick with it, i.e. you cannot switch to the J-style or XML, then you have to be careful with your data model or you need to employ workarounds like this.