Bug 1844298 - gecko_taskgraph: assert payload/index builders names are unique r=taskgraph-reviewers,gabriel DONTBUILD

The task transform module keeps registries of payload and index
builders, identified by a "name" string; AFAICT nothing prevents
registering different functions under the same name, which seems
potentially confusing.

Differential Revision: https://phabricator.services.mozilla.com/D183960
This commit is contained in:
Julien Cristau 2023-07-20 07:05:58 +00:00
parent 7a3c472494
commit 7a64e09ef6

View File

@ -291,6 +291,7 @@ def payload_builder(name, schema):
)
def wrap(func):
assert name not in payload_builders, f"duplicate payload builder name {name}"
payload_builders[name] = PayloadBuilder(schema, func)
return func
@ -303,6 +304,7 @@ index_builders = {}
def index_builder(name):
def wrap(func):
assert name not in index_builders, f"duplicate index builder name {name}"
index_builders[name] = func
return func