Tailf validation for a config item does not kick in

I have a config srgb and srlb configs which take preconfigured label blocks (consists of lower bound and upper bound). For these, we have a validation checking if the configured label block is already been used for different srgb or srlb, if yes it throws an error.

ABove validation works fine if we configure different srgbs or srlbs in seperate commits. But if a user configues SRGB1 and SRLB1 with same label block block1 in same commit, validation does not work.

Example config

label block block1
lower-bound x1
uppder-bound x2
end

srgb srgb1
id srgb1
label-blocks [block1]

srgb srlb1
id srlb1
label-block [block1]

above sample config does not go throw with seperate commits due to tailf validation. But it validation does not kick in if the both config is committed in same commit.

Is there a way to block this happening in single commit through validation?

The primary way of validating configuration is to validate the new configuration, i.e. the configuration as it would be in CDB if the transaction would be successfully committed.

That would automatically be the case if you are using a “must” expression to do the validation.

Here I assume you are using a tailf:validate statement to do the validtion in your application that implement the validation point callback.

You then need use MAAPI to access the new configuration. If you use the CDB API you will access the configuration as it was before the new transaction.
Use for example examples.confd/validate/c_dependency/more_a_than_b.c as a reference