Skip to content

Create release-test fixture dirs with mktemp (PROF-16478) - #940

Open
rkennke wants to merge 2 commits into
mainfrom
rkennke/PROF-16478-release-test-mktemp
Open

rkennke wants to merge 2 commits into
mainfrom
rkennke/PROF-16478-release-test-mktemp

Conversation

@rkennke

@rkennke rkennke commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?:

Creates the fixture directories in test_release_automation.sh with mktemp -d instead of $TEMP_DIR/<name>-$RANDOM. A failed mktemp now makes the helper return non-zero, so setup stops instead of continuing with an empty path.

Motivation:

release-automation-tests failed on #937 for a reason unrelated to that PR (job). One run creates 10 remotes and 10 work trees with $RANDOM names. Two names collided (work-10350), so git init reused an existing repo, git remote add origin failed, and the job exited 128. The chance is about 0.14% per run, but each occurrence is a false red that someone has to diagnose.

Additional Notes:

  • The .git suffix on the bare remote's name is dropped. BSD/macOS mktemp only replaces trailing Xs, and a bare repo works without the suffix.
  • || return 1 matters because setup_remote/setup_work run inside $(...), where set -e is off. Without it, a failed mktemp would leave the path empty, and git -C "" would act on the invoking checkout. mktemp is the only new failure point. The old $RANDOM path could never be empty.
  • Out of scope: other failing commands inside these helpers (git init, cp, git push) are still swallowed for the same $(...) reason. This was already true before this change. shopt -s inherit_errexit would close it suite-wide, but it changes failure behavior for every command substitution in the script, so it deserves its own change.
  • Agentic review: /code-review (medium) on both commits. The first round's findings on the empty-path case are fixed in the second commit. The re-review raised only the pre-existing inherit_errexit gap above. No Critical/High findings are open.

How to test the change?:

Check Result
.github/scripts/tests/test_release_automation.sh locally passed (54 groups)
bash -n on the script passed
mktemp failure inside $(f) under set -euo pipefail aborts the caller passed (probe, exit 1)
shellcheck blocked locally (not installed); runs in release-automation-tests

The collision itself is too rare to reproduce on demand. The fix removes its cause: mktemp -d creates each directory atomically under a unique name.

For Datadog employees:

  • If this PR touches code that signs or publishes builds or packages, or handles
    credentials of any kind, I've requested a security review (run the dd:platform-security-review
    skill, or file a request via the PSEC review form).
    bewaire also runs automatically on every PR.
  • This PR doesn't touch any of that.
  • JIRA: PROF-16478

🤖 Generated with Claude Code

rkennke and others added 2 commits November 4, 2026 21:49
setup_remote and setup_work named their directories with $RANDOM. A run
creates ten of each, so two names can collide: git init then reuses an
existing repo, remote add fails, and the job exits 128. mktemp -d gives
each fixture a unique directory.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Both helpers run inside $(...), where errexit is off. A failed mktemp
would leave the path empty, and git -C "" would then act on the
invoking checkout. Return non-zero so the caller's assignment fails.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@rkennke
rkennke requested a review from a team as a code owner November 4, 2026 21:57
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-04T21:59:51.578529Z 1249b5a PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@datadog-datadog-prod-us1-2 datadog-datadog-prod-us1-2 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.

Bits Code Review: PASS

More details

Atomic fixture directory creation removes random-name collisions, and explicit failure returns prevent setup from continuing with an empty path when mktemp fails.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Bits Code Review · Commit 1249b5a

@dd-octo-sts

dd-octo-sts Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Scan-Build Report

User:runner@runnervm48cm3
Working Directory:/home/runner/work/java-profiler/java-profiler/ddprof-lib/src/test/make
Command Line:make -j4 all
Clang Version:Ubuntu clang version 18.1.3 (1ubuntu1)
Date:Wed Nov 4 22:11:28 2026

Bug Summary

Bug TypeQuantityDisplay?
All Bugs2
Logic error
Dereference of null pointer1
Unused code
Dead initialization1

Reports

Bug Group Bug Type ▾ File Function/Method Line Path Length
Unused codeDead initializationreferenceChains.cppapplyOomRamp4971
Logic errorDereference of null pointerperfEvents_linux.cppunregisterThread72026

@dd-octo-sts

dd-octo-sts Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

CI Test Results

Run: #41920831693 | Commit: 2020aa3 | Duration: 20m 53s (longest job)

✅ All 32 test jobs passed

Status Overview

JDK glibc-aarch64/debug glibc-amd64/debug musl-aarch64/debug musl-amd64/debug
8 - ✅ - -
8-ibm - ✅ - -
8-j9 ✅ ✅ - -
8-librca - - ✅ ✅
8-orcl - ✅ - -
11 - ✅ - -
11-j9 ✅ ✅ - -
11-librca - - ✅ ✅
17 ✅ ✅ - -
17-graal ✅ ✅ - -
17-j9 ✅ ✅ - -
17-librca - - ✅ ✅
21 ✅ ✅ - -
21-graal ✅ ✅ - -
21-librca - - ✅ ✅
25 ✅ ✅ - -
25-graal ✅ ✅ - -
25-librca - - ✅ ✅

Legend: ✅ passed | ❌ failed | ⚪ skipped | 🚫 cancelled

Summary: Total: 32 | Passed: 32 | Failed: 0


Updated: 2026-11-04 22:21:21 UTC

This branch has not been deployed

No deployments
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