Skip to content

feat(0026): wire enrichment Lambda into CDK + gate the lambda bin#65

Merged
karczuRF merged 2 commits into
developfrom
feat/0026_enrichment-lambda-cdk
Jun 29, 2026
Merged

feat(0026): wire enrichment Lambda into CDK + gate the lambda bin#65
karczuRF merged 2 commits into
developfrom
feat/0026_enrichment-lambda-cdk

Conversation

@karczuRF

Copy link
Copy Markdown
Collaborator

Summary

Authors the production EventBridge cron Lambda for the close_usd / volume_quote_usd enrichment pass and packages the worker like its siblings — prepare-only, no deploy (Option 1 of the 0026 remaining-work split).

  • Infra (CDK): EnrichmentRule (rate(1 hour)) + worker Function + IAM role + error alarm + log group in eventbridge-stack.ts via the shared createWorkerLambda helper, mirroring oracle/cleanup/supply. Adds enrichment to the schedule config type, its validation, and production.json.
  • Crate (packaging): gates the Lambda bin behind a lambda feature (required-features) so default builds stay lean, matching the sibling workers. The entrypoint now builds the mTLS client via prices_clickhouse::mtls::client_from_lambda_env (CH_DOMAIN + MTLS_SECRET_NAME) instead of a plain CLICKHOUSE_URL client; the prior fixture-prototype Lambda mode is dropped (the prototype lives on as enrichment-cli). Adds ChEnrichmentPass::with_client; url-based new() is kept for the integration tests.
  • CI: adds -p enrichment-worker to the cargo lambda build matrix.

Verification (local)

  • Default + --features lambda builds clean; 24 unit + 2 e2e pass; clippy/fmt clean; cargo lambda build produces the bootstrap.
  • Infra lint/build/typecheck green, and cdk synth succeeds — the template carries the rule (rate(1 hour) → function), function (mTLS env contract + CLICKHOUSE_*, 512 MB / 300 s / arm64), IAM role, error alarm, and log group.

Scope / deferred

Closes the EventBridge-Lambda-exists + CDK/IAM ACs at the code+synth level. Still deferred: the custom EnrichmentRowsRemainingAtVolumeZero metric + CloudWatch publish + dashboard (task 0056), the one-shot historical mode, and the actual deploy + live backfill credibility check — all out of scope under prepare-not-deploy. Task 0026 stays active.

karczuRF added 2 commits June 29, 2026 14:04
Author the production EventBridge cron Lambda for the close_usd /
volume_quote_usd enrichment pass (prepare-only; no deploy):

- infra: EnrichmentRule (rate(1 hour)) + worker Function + IAM role + error
  alarm in eventbridge-stack via the shared createWorkerLambda helper, matching
  the oracle/cleanup/supply pattern. Add `enrichment` to the schedule config
  type, its validation, and production.json. `cdk synth` produces the rule,
  function, role, error alarm and log group.
- crate: gate the Lambda bin behind a `lambda` feature (required-features) so
  default builds stay lean, mirroring the sibling workers. The entrypoint now
  builds the mTLS client via prices_clickhouse::mtls::client_from_lambda_env
  (CH_DOMAIN + MTLS_SECRET_NAME) instead of a plain CLICKHOUSE_URL client. Add
  ChEnrichmentPass::with_client for the pre-built client; the url-based new()
  stays for the integration tests.
- ci: add -p enrichment-worker to the cargo lambda build matrix.

Custom EnrichmentRowsRemainingAtVolumeZero metric + alarm and the CloudWatch
publish remain for the observability task (0056) / Option 2. 24 unit + 2 e2e
pass; default + lambda-feature build clean; cargo-lambda bootstrap builds;
infra lint/build/typecheck + cdk synth green.
@karczuRF karczuRF merged commit 7ef794c into develop Jun 29, 2026
3 checks passed
@karczuRF karczuRF deleted the feat/0026_enrichment-lambda-cdk branch June 29, 2026 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant