Skip to content

fix(agent-data-plane): fail the build when release metadata is missing - #2345

Open
jszwedko wants to merge 4 commits into
mainfrom
jszwedko/fail-on-placeholder-build-metadata
Open

fix(agent-data-plane): fail the build when release metadata is missing#2345
jszwedko wants to merge 4 commits into
mainfrom
jszwedko/fail-on-placeholder-build-metadata

Conversation

@jszwedko

@jszwedko jszwedko commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator

Human Summary

Ensure that the ADP metadata is populated for release builds. This actually caught and fixes an issue with the Windows and AIX builds using the wrong env var name for the build time.

Separately, also caught an issue with the docker image build where it wasn't propagating APP_DEV_BUILD.

AI Summary

saluki-metadata silently substitutes placeholders (unknown, 0.0.0, 0000-00-00 00:00:00) for any APP_* variable a build doesn't supply. That's what makes a bare cargo build work, but it also means a release build whose tooling forgot or misspelled one of those variables ships without anyone noticing — the binary just reports unknown to users and telemetry. Two instances were already live in main, which is what prompted this. Rather than only fixing them, this makes the whole class of bug loud: once a build supplies application identity and declares itself a release build, the build script fails instead of quietly falling back.

This is the first step of a broader cleanup of how ADP's build metadata is plumbed; it's self-contained and doesn't depend on where that lands.

The two live bugs

  • Release images were marked as dev builds. .gitlab/build.yml passes --build-arg APP_DEV_BUILD, but docker/Dockerfile.agent-data-plane never declared a matching ARG, so Docker dropped it and the build script fell back to true. Tagged release images therefore emitted running{version="1.6.0-dev-<sha>"} instead of 1.6.0.
  • Windows binaries had no build time. windows-build-adp.ps1 set APP_BUILD_DATE, but saluki-metadata reads APP_BUILD_**TIME**, and the Windows job sets nothing else — so those binaries reported 0000-00-00 00:00:00.

Why the check isn't keyed on APP_DEV_BUILD alone

APP_DEV_BUILD is set at the workflow level in .gitlab-ci.yml, so on a tag pipeline it's in scope for every job — including the .gitlab/test.yml jobs (unit tests, clippy, miri), which have no rules: and no reason to supply application metadata. Enforcing purely on APP_DEV_BUILD=false would have failed the entire release pipeline. The guard therefore only engages when something actually tried to identify the application, which no test or lint job does. Forgetting a single variable still trips it, since the others remain set.

Also included

Small fixes that keep the guard honest rather than papering over it: the Makefile's dead APP_BUILD_DATE assignments are corrected (the right value already reached cargo via the global export at the top of the file, so these were misleading rather than broken), build-adp-aix.sh now stamps a real timestamp since it defaults to a release build and would otherwise trip the new check, and the build-metadata docs are brought in line with reality.

Test plan

Verified the guard against the full matrix by invoking cargo build -p saluki-metadata with each environment, confirming no false positives on the paths that must keep working:

Scenario Expected Result
Plain dev build, no vars builds builds
Test job on a tag pipeline (APP_DEV_BUILD=false only) builds builds
Test job on a tag + Makefile-exported git hash/build time builds builds
Release build, complete metadata builds builds
Release build, APP_BUILD_TIME forgotten fails fails
Release build, APP_IDENTIFIER misspelled fails fails
Dev build with metadata (non-tag CI) builds builds
  • Failure messages name the specific offending variable (verified for the misspelling case)
  • make -n build-adp confirms the corrected APP_BUILD_TIME reaches cargo
  • Worth confirming on a tag pipeline before this leaves draft, since the release path is the thing being protected

saluki-metadata falls back to placeholder values ("unknown", "0.0.0") for any APP_*
variable a build doesn't supply. That keeps a bare `cargo build` working, but it also
means a release build whose tooling forgot or misspelled one of these variables ships
silently, reporting "unknown" to users and telemetry. Two such cases were already live:
the ADP image build never declared ARG APP_DEV_BUILD, so tagged release images were
marked as dev builds (and emitted a "-dev-<sha>" suffixed version label), and the
Windows build set APP_BUILD_DATE where saluki-metadata reads APP_BUILD_TIME, so Windows
binaries reported no build time at all.

Fix both, then make the class of bug non-silent: once a build supplies application
identity and declares itself a release build, saluki-metadata's build script now fails
if any metadata is still at its placeholder default.

The check is deliberately gated on identity being supplied rather than on APP_DEV_BUILD
alone. APP_DEV_BUILD is set at the workflow level in CI, so on a tag pipeline it is also
present for jobs that only run cargo test/clippy; keying off it alone would have failed
the whole release pipeline.

Also drops the dead APP_BUILD_DATE assignments in the Makefile (the value reached cargo
via the global export at the top of the file, so this was misleading rather than broken),
stamps a real timestamp in the AIX script since it defaults to a release build, and
corrects the build metadata docs.
@dd-octo-sts dd-octo-sts Bot added area/core Core functionality, event model, etc. area/ci CI/CD, automated testing, etc. area/docs Reference documentation. labels Aug 14, 2026
Ten lines was out of step with the rest of the file. Keep only what can't be read off
the code: why placeholders fail, and why the condition isn't APP_DEV_BUILD alone.
@jszwedko
jszwedko marked this pull request as ready for review August 14, 2026 21:22
@jszwedko
jszwedko requested a review from a team as a code owner August 14, 2026 21:22
@pr-commenter

pr-commenter Bot commented Aug 14, 2026

Copy link
Copy Markdown

Binary Size Analysis (Agent Data Plane)

Baseline: 0f47357 · Comparison: cd28248 · diff
Analysis Configuration: stripped binaries · Pass/Fail Threshold: +5%
Sizes: 41.27 MiB (baseline) vs 41.27 MiB (comparison)
Size Change: +0 B (+0.00%)

✅ Binary size difference within threshold

Changes by Module
Module File Size Symbols
anon.dca7d28c8f462601bb81d85101fb8da4.1.llvm.16118334207986262691 +130 B 1
anon.dca7d28c8f462601bb81d85101fb8da4.1.llvm.15312520485987005561 -130 B 1
anon.dca7d28c8f462601bb81d85101fb8da4.4.llvm.16118334207986262691 +114 B 1
anon.dca7d28c8f462601bb81d85101fb8da4.4.llvm.15312520485987005561 -114 B 1
anon.dca7d28c8f462601bb81d85101fb8da4.3.llvm.16118334207986262691 +109 B 1
anon.dca7d28c8f462601bb81d85101fb8da4.3.llvm.15312520485987005561 -109 B 1
anon.dca7d28c8f462601bb81d85101fb8da4.0.llvm.16118334207986262691 +97 B 1
anon.dca7d28c8f462601bb81d85101fb8da4.0.llvm.15312520485987005561 -97 B 1
anon.dca7d28c8f462601bb81d85101fb8da4.2.llvm.16118334207986262691 +95 B 1
anon.dca7d28c8f462601bb81d85101fb8da4.2.llvm.15312520485987005561 -95 B 1
Detailed Symbol Changes
    FILE SIZE        VM SIZE    
 --------------  -------------- 
  [NEW]    +130  [NEW]     +40    anon.dca7d28c8f462601bb81d85101fb8da4.1.llvm.16118334207986262691
  [NEW]    +114  [NEW]     +24    anon.dca7d28c8f462601bb81d85101fb8da4.4.llvm.16118334207986262691
  [NEW]    +109  [NEW]     +19    anon.dca7d28c8f462601bb81d85101fb8da4.3.llvm.16118334207986262691
  [NEW]     +97  [NEW]      +7    anon.dca7d28c8f462601bb81d85101fb8da4.0.llvm.16118334207986262691
  [NEW]     +95  [NEW]      +5    anon.dca7d28c8f462601bb81d85101fb8da4.2.llvm.16118334207986262691
  [DEL]     -95  [DEL]      -5    anon.dca7d28c8f462601bb81d85101fb8da4.2.llvm.15312520485987005561
  [DEL]     -97  [DEL]      -7    anon.dca7d28c8f462601bb81d85101fb8da4.0.llvm.15312520485987005561
  [DEL]    -109  [DEL]     -19    anon.dca7d28c8f462601bb81d85101fb8da4.3.llvm.15312520485987005561
  [DEL]    -114  [DEL]     -24    anon.dca7d28c8f462601bb81d85101fb8da4.4.llvm.15312520485987005561
  [DEL]    -130  [DEL]     -40    anon.dca7d28c8f462601bb81d85101fb8da4.1.llvm.15312520485987005561
  [ = ]       0  [ = ]       0    TOTAL

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6b3c59c987

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread ci/tooling/windows-build-adp.ps1

@datadog-datadog-prod-us1-2 datadog-datadog-prod-us1-2 Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Datadog Autotest: FAIL

Tagged Windows builds still default to development metadata because their container never receives APP_DEV_BUILD; this bypasses the new release guard and preserves the incorrect -dev-<sha> telemetry version on shipped Windows artifacts.

Open Bits AI session

🤖 Datadog Autotest · Commit 6b3c59c · What is Autotest? · @DataDog review to ask questions · Any feedback? Reach out in #autotest

Comment thread lib/saluki-metadata/build.rs
The Windows release build runs inside `docker run` with an explicit -e allowlist, so the
workflow-level APP_DEV_BUILD never reached it. Tagged Windows artifacts were therefore
marked as dev builds, and the new release metadata check skipped them entirely.

Only the release-zip definition gets it (the FIPS variant extends the same definition).
The integration job is deliberately left alone: windows-integration-tests.ps1 supplies
only partial identity, so forwarding the flag there would trip the check on tag pipelines.
The script set only APP_FULL_NAME, APP_SHORT_NAME, and APP_GIT_HASH, leaving the
identifier, version, and build time to fall back to placeholders. That partial set is a
trap now that saluki-metadata rejects placeholder metadata on release builds: the job
would fail the moment anyone forwarded APP_DEV_BUILD into its container.

Fill in the rest, taking the version from ADP's manifest the same way the Makefile does.
@pr-commenter

pr-commenter Bot commented Aug 14, 2026

Copy link
Copy Markdown

Regression Detector (Agent Data Plane)

Run ID: 75fb0cca-f953-42b8-9cfb-6c0fb23df9c8
Baseline: 0f47357a · Comparison: cd28248c · diff

Optimization Goals: ✅ No significant changes detected

Fine details of change detection per experiment (5)

Experiments configured erratic: true are tagged (ignored) and skipped when determining which experiments regressed or improved. Experiments which are detected as erratic at runtime are tagged (erratic) to flag that the run's sample dispersion was high, but their regression / improvement signal still counts.

experiment goal Δ mean % links
quality_gates_rss_dsd_heavy memory ⚪ +0.31 metrics profiles logs
quality_gates_rss_dsd_medium memory ⚪ +0.25 metrics profiles logs
quality_gates_rss_idle memory ⚪ +0.24 metrics profiles logs
quality_gates_rss_dsd_low memory ⚪ +0.05 metrics profiles logs
quality_gates_rss_dsd_ultraheavy memory ⚪ -0.22 metrics profiles logs
Bounds Checks: ✅ Passed (5)
experiment check replicates observed links
quality_gates_rss_dsd_heavy memory_usage 10/10 ✅ 227 MiB ≤ 250 MiB metrics profiles logs
quality_gates_rss_dsd_low memory_usage 10/10 ✅ 51.3 MiB ≤ 60 MiB metrics profiles logs
quality_gates_rss_dsd_medium memory_usage 10/10 ✅ 92.1 MiB ≤ 100 MiB metrics profiles logs
quality_gates_rss_dsd_ultraheavy memory_usage 10/10 ✅ 387 MiB ≤ 420 MiB metrics profiles logs
quality_gates_rss_idle memory_usage 10/10 ✅ 31.8 MiB ≤ 40 MiB metrics profiles logs
Explanation

A change is flagged as a regression when |Δ mean %| > 5.00% in the regressing direction for its optimization goal AND SMP marks the experiment as a regression (is_regression: true). Improvements use the matching criteria for the improving direction. Experiments configured erratic: true (tagged (ignored)) are skipped outright; experiments detected as erratic at runtime (tagged (erratic)) still count, since that flag describes sample dispersion rather than directional certainty. The Δ mean % cell is colored accordingly: 🟢 = improvement, 🔴 = regression, ⚪ = neutral. Reduction in CPU or memory is an improvement; reduction in ingress throughput is a regression. Experiments tagged (no analysis) show ⚠️ n/a: SMP ran them but produced no analysis, usually because a replicate failed and exhausted its retries. Check the SMP report for that experiment's replicate failures.

# Windows PowerShell 5.1 (the default `powershell.exe` in the LTSC2022 build image) doesn't
# have Get-Date's -AsUTC switch (added in PS 7.1). ToUniversalTime() works on both.
$env:APP_BUILD_DATE = (Get-Date).ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ")
$env:APP_BUILD_TIME = (Get-Date).ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ")

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was using the wrong name.

# were ever handed APP_DEV_BUILD=false.
$env:APP_FULL_NAME = "Agent Data Plane"
$env:APP_SHORT_NAME = "data-plane"
$env:APP_IDENTIFIER = "adp"

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sets missing variables.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/ci CI/CD, automated testing, etc. area/core Core functionality, event model, etc. area/docs Reference documentation.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant