Component layer
Everything under components/ wraps an external system. Tasks
(Domain model: processes & tasks) and endpoint handlers (API overview) compose these
clients; they never call requests or boto3 directly.
Inventory
| Area | Modules | Page |
|---|---|---|
Au10tix identity documents |
|
|
Entrust / Onfido identity verification |
|
|
HubSpot CRM sync |
|
|
Supplier event stream (internal EventLogger) |
|
|
Thomson Reuters CLEAR |
|
|
AWS: DynamoDB, S3, SWF, EventBridge |
|
|
Payability internal services |
|
|
Auth and permissions |
|
|
Cross-cutting helpers |
|
AWS services used
| Service | Wrapped by | Documented in |
|---|---|---|
DynamoDB |
|
|
S3 |
|
|
SWF |
|
|
EventBridge |
|
|
Secrets Manager |
|
|
CloudWatch |
|
Where clients are instantiated
Worker (swf_app.py) builds one TaskFactory at startup with every client injected, shared
across all five polling threads:
task_factory = TaskFactory(
s3_client=S3Client(),
thomson_reuters_client=ThomsonReutersClient(),
au10tix_client=Au10tixClient(),
b2b_task_manager=B2BTaskManager(),
b2b_documents=PYBDocuments(),
task_execution_table=TaskExecutionTable(),
final_status_table=FinalStatusTable(ChangelogTable()),
tool_table=ToolTable(ChangelogTable()),
event_bridge_client=EventBridgeClient(),
retry_client=Retry(total=20),
payability_internal_api=PayabilityInternalAPI(),
entrust_client=EntrustClient(),
hubspot_client=HubSpotClient(),
supplier_event_logger=SupplierEventLogger()
)
Web API handlers construct the clients they need per request. execute_task.py builds a full
TaskFactory (including entrust_client, hubspot_client and supplier_event_logger, all
needed for the Entrust reprocess path);
get_task_result.py and delete_task_results.py build partial factories — enough for the
process steps they touch.
|
A partial |
The worker’s Retry(total=20) versus the API’s default Retry() (total=10, delay=10) is
deliberate: vendor polling happens on the worker, where waiting is free.
Rules for new clients
-
One module (or package) per external system, under
components/. -
Read configuration from
config.config.settingsonly — neveros.getenv. -
Reuse a
requests.Sessionand set explicit timeouts; usecomponents/retry/or anHTTPAdapterretry for polling. -
Raise on failure (
raise_for_status()), and where the upstream body carries the reason, surface it in the exception message — see the_raise_with_bodyhelper inpayability_internal_api.py. -
Inject the client through
TaskFactoryrather than constructing it inside a task. -
Document it here and in Settings & secrets reference if it needs new settings or secrets.