Repository layout
.
├── src/ application code; also the root of the Lambda artifact
├── tests/ pytest suite (unit/ and integration/), AWS mocked with moto
├── scripts/ one-off operational scripts
├── docs/ this Antora component
├── template.yaml SAM template: RulesApi, API and worker functions, IAM, environment mapping
├── samconfig.toml SAM config environments: dev and prod
├── Makefile every developer, CI and SAM build command
├── pyproject.toml, uv.lock dependencies (uv) and tool configuration (ruff, complexipy, mypy, pytest, coverage)
└── .github/ CI and deploy workflows, shared setup action
Source packages
src/ is the import root: modules are imported by bare name (from settings import get_settings), both in
Lambda and in tests. make check-names fails if an installed distribution shadows one of these names.
| Package | Responsibility |
|---|---|
|
Lambda entry points |
|
Flask app factory ( |
|
Stage, stream and action classes: |
|
Rule engine, rule, template and history services, events service |
|
Event and rule models, operators, selectors, resolvers, action registry and action fields |
|
DynamoDB access compatible with the existing tables; table schemas used by the moto tests |
|
AWS clients (SNS, Kinesis, Firehose, EventBridge), internal Payability APIs, Segment, search |
|
Environment settings ( |
|
Logging and Sentry, configured once per cold start |
Dependencies point inwards: handlers and web use services and pipeline, which use domain,
persistence and integrations. domain doesn’t import from web or handlers.
Tests
| Path | Scope |
|---|---|
|
Models, operators, utils, pipeline building blocks, stage 1 parsing |
|
API namespaces, CRUD against moto DynamoDB, the rule engine with mocked HTTP, handlers, route layout |
|
Test environment (no AWS access, secrets from environment variables) and shared fixtures |
|
moto resources, mocked authentication, sample rules and events |
tests/ is a regular package (it has init.py) because pyb-flask-utils and the EventLogger SDK both
install a top-level tests package into site-packages.