require
valid_item: attached item as l_i and then l_i.valid_for_insert or l_i.valid_for_update
why do I have an unknown identifier here with l_i??!!!
Try with
valid_item: attached item as l_i and then (l_i.valid_for_insert or l_i.valid_for_update)
Note you can also do
item_set: attached item as l_i
valid_item: l_i.valid_for_insert or l_i.valid_for_update
you can reuse the object test local variable l_i
from a previous precondition.