refactor(arch-09): introduce BuildMetadataProperties — decouple build provenance from dd.* namespace - #9
Merged
ff-team-sobrado merged 1 commit intoMay 5, 2026
Conversation
… provenance from dd.* namespace ARCH-09-followup-2 (Task #18) — second concrete refactor from the audit, companion to the WaitlistProperties lift on sobrado-site-api (#8) and the parallel pii-ingestion change (pii-ingestion!4). Replaces four scattered `@Value` injection sites with a single typed `BuildMetadataProperties` bean. Mirrors the `WaitlistProperties` and `InvestmentPaymentProperties` shape — same canonical Micronaut idiom for grouped configuration the ARCH-09 audit established for every future Lambda. Sites migrated: - `PaymentIntentSucceededHandler` — `${dd.version:unknown}` + `${git.sha:unknown}`. - `PaymentIntentFailedHandler` — same pair. Naming improvement: pre-refactor, the Lambda read the build version through the `dd.*` (Datadog) namespace because Micronaut auto-maps the `DD_VERSION` env var to `dd.version`. That conflated the Datadog APM "version" tag with Sobrado's build provenance. Post-refactor the YAML binds `build.version` and `build.git-sha` to the underlying env vars explicitly: build: version: ${DD_VERSION:unknown} git-sha: ${GIT_SHA:unknown} The env-var contract is preserved byte-for-byte (no infrastructure change required); only the Java-side namespace decouples from the Datadog convention. Future: when a dedicated build-provenance source is wanted (e.g. CI-injected `BUILD_VERSION`), only the YAML changes. Audit-log JSON keys (`lambdaVersion`, `gitSha`) preserved verbatim — no DDB AuditLog row schema change. Tests: - `PaymentIntentSucceededHandlerTest` — both ctor sites (default setUp + degraded-mode test) updated; introduces `LAMBDA_VERSION` / `GIT_SHA` constants + `newBuildMetadata` helper. - `PaymentIntentFailedHandlerTest` — same shape, mirrored helper. Verified locally: `./gradlew test` green. Co-Authored-By: Rui (Tech Lead) <team-sobrado@functorful.com> Co-Authored-By: Rui (Tech Lead) <team-sobrado@functorful.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ARCH-09-followup-2 (Task #18) — second concrete refactor from the
ARCH-09 audit. Replaces four scattered
@Valueinjection sites(two on each of
PaymentIntentSucceededHandlerandPaymentIntentFailedHandler) with a single typedBuildMetadataPropertiesbean.Mirrors the
InvestmentPaymentPropertiesshape established here inPR #6 (and
WaitlistPropertieson sobrado-site-api) — the canonicalMicronaut idiom for grouped configuration the ARCH-09 audit
established for every future Lambda.
Companion MR on pii-ingestion (
pii-ingestion!4) applies the samerefactor to
DynamoDbInvestorIbanStore; this PR is the larger of thepair (two consumers, four
@Valuesites).Naming improvement
Pre-refactor, the Lambda read the build version through the
dd.*(Datadog) namespace because Micronaut auto-maps the
DD_VERSIONenvvar to
dd.version. That conflated two concerns: the Datadog APM"version" tag and Sobrado's build provenance.
Post-refactor the YAML binds
build.versionandbuild.git-shatothe underlying env vars explicitly:
```yaml
build:
version: ${DD_VERSION:unknown}
git-sha: ${GIT_SHA:unknown}
```
The env-var contract is preserved byte-for-byte (no infrastructure
change required); only the Java-side namespace decouples from the
Datadog convention. Future: when a dedicated build-provenance source
is wanted (e.g. CI-injected
BUILD_VERSION), only the YAML changes— application code already reads through the typed bean.
Audit-log JSON keys (
lambdaVersion,gitSha) preserved verbatim —no DDB AuditLog row schema change.
Test plan
./gradlew test— green locally onfeat/arch-09-followup-build-metadata-properties.PaymentIntentSucceededHandlerTest— both ctor sites (defaultsetUp + degraded-mode test) updated; introduces
LAMBDA_VERSION/
GIT_SHAconstants +newBuildMetadatahelper.PaymentIntentFailedHandlerTest— same shape, mirrored helper.with the new YAML key + bean shape).
Diff stat
```
.../config/BuildMetadataProperties.java | 74 ++++++++++++ (new)
.../dispatch/handlers/PaymentIntentFailedHandler.java | 11 +++++++----
.../handlers/PaymentIntentSucceededHandler.java | 11 +++++++----
src/main/resources/application.yml | 9 +++++++++
.../handlers/PaymentIntentFailedHandlerTest.java | 18 ++++++++++++++++--
.../handlers/PaymentIntentSucceededHandlerTest.java | 18 ++++++++++++++++--
```
Companion MR