Skip to content

refactor(arch-09): introduce BuildMetadataProperties — decouple build provenance from dd.* namespace - #9

Merged
ff-team-sobrado merged 1 commit into
mainfrom
feat/arch-09-followup-build-metadata-properties
May 5, 2026
Merged

refactor(arch-09): introduce BuildMetadataProperties — decouple build provenance from dd.* namespace#9
ff-team-sobrado merged 1 commit into
mainfrom
feat/arch-09-followup-build-metadata-properties

Conversation

@ff-team-sobrado

Copy link
Copy Markdown
Contributor

Summary

ARCH-09-followup-2 (Task #18) — second concrete refactor from the
ARCH-09 audit. Replaces four scattered @Value injection sites
(two on each of PaymentIntentSucceededHandler and
PaymentIntentFailedHandler) with a single typed
BuildMetadataProperties bean.

Mirrors the InvestmentPaymentProperties shape established here in
PR #6 (and WaitlistProperties on sobrado-site-api) — the canonical
Micronaut idiom for grouped configuration the ARCH-09 audit
established for every future Lambda.

Companion MR on pii-ingestion (pii-ingestion!4) applies the same
refactor to DynamoDbInvestorIbanStore; this PR is the larger of the
pair (two consumers, four @Value sites).

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 two concerns: the Datadog APM
"version" tag and Sobrado's build provenance.

Post-refactor the YAML binds build.version and build.git-sha to
the 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 on feat/arch-09-followup-build-metadata-properties.
  • PaymentIntentSucceededHandlerTest — both ctor sites (default
    setUp + degraded-mode test) updated; introduces LAMBDA_VERSION
    / GIT_SHA constants + newBuildMetadata helper.
  • PaymentIntentFailedHandlerTest — same shape, mirrored helper.
  • CI verify pipeline green (Gradle build + tests).
  • CI build-image pipeline green (GraalVM native image still builds
    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

  • pii-ingestion: !4 (same shape; 1 consumer).

… 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>
@ff-team-sobrado
ff-team-sobrado merged commit 95d6252 into main May 5, 2026
4 checks passed
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