A synthetic code base of the fictional company Acme for testing ProtoMap: 240 gRPC services with 1816 methods in 12 domains, and 6572 protobuf messages with 28558 fields, many nested several levels deep.
It is generated, with the seven other protomap-test-* repositories, from one catalog of Acme's APIs by
shell/scripts/fixtures generate in protomap-source. Do not edit it by hand: the generator refuses to overwrite
edited files. The repositories own disjoint domains and call each other's services, so each holds copies of the protobuf
files it needs from the others, byte for byte as their owners have them.
The Python 3.12+ package under src/acme_data separates each domain's transport handlers, workflows,
typed mappers, ports, and SQLAlchemy repositories. A provider container supplies clients and database sessions. The
acme-data entry point registers all 240 services on a grpc.aio server behind identity authentication, starts the
event bus consumer, and drains work on shutdown. Separate reconciliation, streaming index, and admin programs call
the same APIs. Domain packages vary between class handlers, mixins, dataclass services, and module-level operations.
Create a virtualenv with python3 -m venv .venv, then run .venv/bin/python -m pip install -e '.[dev]'.
The PEP 517/660 build backend runs python -m grpc_tools.protoc on the vendored proto/ files and packages the
_pb2, _pb2_grpc, and .pyi files from ignored build/generated/; generated bindings are not committed.
Run .venv/bin/python tools/build_proto.py after editing a proto, .venv/bin/python -m mypy for type checks, and
.venv/bin/python -m unittest discover -s tests for runtime contract checks. ACME_MESH, ACME_LISTEN,
ACME_DATABASE_URL, and ACME_SERVICE_TOKEN, the credential of the server's own calls, configure deployment; the
local database is ignored db.sqlite3. Verification builds the
editable package, compiles every module, imports application and generated modules, checks types, exercises every
handler with populated protobuf messages, and tests a real loopback gRPC server and database writes.
The domains are datahub, metrics, analytics, forecasting, recommendations, datasets, pipelines,
labeling, modelregistry, featurestore, anomalies, lineage. It calls services of appointments, assets,
audiences, audit, authorization, banking, budgeting, campaigns, careplans, cart, catalog,
certificates, chat, checkout, configuration, content, corporateevents, customers, deliveries, devices,
dispatch, documents, driverapp, drivers, edgegateway, employees, expenses, featureflags, fleet,
forms, fraud, fuel, fulfillment, giftcards, helpdesk, identity, insurance, invoicing, itsm,
keymanagement, learning, ledger, lending, localization, loyalty, maintenance, media, messaging,
notifications, onboarding, orders, patientapp, patients, payments, payroll, personalization,
prescriptions, pricing, procurement, promotions, ratelimiting, recruiting, reviews, risk, routing,
scheduling, search, secrets, sellers, subscriptions, suppliers, surveys, telehealth, telematics,
timekeeping, travel, treasury, warehousing, webhooks, workplaces, yards too.
expected.json lists what scanning the repository must find: every handler, every call a handler or a program makes,
and every field-level flow from where a handler has data to where a call or its response takes it, each tagged with the
shape of the code that makes it. Its schema is documented in shell/fixtures/oracle.py of protomap-source, and
shell/scripts/fixtures verify checks a scan against it.
The code mixes in, on purpose, what makes static analysis of real code bases hard. Flows by pattern:
| Pattern | Flows |
|---|---|
any_envelope |
600 |
async_generator_each |
204 |
asyncio_gather |
1575 |
callable_object |
585 |
closure_loop |
218 |
contextvars |
741 |
copy_merge |
615 |
dataclass_mapper |
589 |
dict_roundtrip |
638 |
dynamic_getattr |
652 |
echo |
2606 |
event_bus |
729 |
injected_stub |
632 |
json_roundtrip |
558 |
kwargs_builder |
559 |
loop_each |
201 |
module_handler |
1026 |
monkeypatch_hook |
620 |
oneof_branch |
682 |
partial_callback |
527 |
port_adapter |
664 |
program_batch |
48 |
program_stream |
27 |
retry_decorator |
1583 |
streaming_generator |
655 |
stub_registry |
567 |
validated_model |
523 |
workflow_chain |
631 |
Flows whose values pass through something on their way, by what:
| Transform | Flows |
|---|---|
any_pack_unpack |
417 |
contextvars |
556 |
copy_merge |
421 |
domain_model |
409 |
protobuf_dict |
442 |
protobuf_json |
387 |
validated_model |
359 |
which_oneof |
489 |
Calls by pattern:
| Pattern | Calls |
|---|---|
any_envelope |
122 |
async_generator_each |
57 |
asyncio_gather |
362 |
callable_object |
120 |
closure_loop |
57 |
contextvars |
125 |
copy_merge |
131 |
dataclass_mapper |
120 |
dict_roundtrip |
130 |
dynamic_getattr |
131 |
event_bus |
147 |
event_worker |
147 |
injected_stub |
128 |
json_roundtrip |
116 |
kwargs_builder |
119 |
loop_each |
58 |
module_handler |
214 |
monkeypatch_hook |
131 |
oneof_branch |
131 |
partial_callback |
109 |
port_adapter |
139 |
program_batch |
24 |
program_cli |
12 |
program_stream |
18 |
retry_decorator |
342 |
streaming_generator |
181 |
stub_registry |
116 |
validated_model |
107 |
workflow_chain |
130 |