Skip to content

feat(openai-ads): add hashing configuration toggle - #2864

Merged
ItsSudip merged 3 commits into
mainfrom
harness/INT-7432-feat-openai-ads-add-hashing-con-1447d4b7
Oct 26, 2026
Merged

ItsSudip merged 3 commits into
mainfrom
harness/INT-7432-feat-openai-ads-add-hashing-con-1447d4b7

Conversation

@rudder-devbox

@rudder-devbox rudder-devbox Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

What are the changes introduced in this PR?

Adds a default-on isHashRequired setting to the OpenAI Ads destination for cloud and web device-mode connections. The checkbox appears under Configuration settings → Event settings, explains the pre-hashed user fields and anonymous-ID fallback behavior, is retained by workspace-config and device-mode filtering, and is validated as a boolean.

What is the related Linear task?

Resolves INT-7432

Please explain the objectives of your changes below

This change exposes the configuration for optional OpenAI Ads hashing across cloud and web device mode while preserving hashing for existing destinations through a true default. It adds valid fixtures for both boolean states and rejects non-boolean values.

The feature must not be considered complete until matching OpenAI Ads documentation is updated in rudder-hugo. Documentation must explain that disabling hashing requires email, phone number, first name, last name, and user ID to be normalized and pre-hashed, while RudderStack hashes anonymous ID automatically when user ID is absent; the setting applies to both cloud and web device mode.

Runtime dependencies

  • Cloud transformer: rudder-transformer#5718, rolled out ☐
  • Web device mode: rudder-sdk-js#<PR>, rolled out ☐
  • Documentation: rudder-hugo#<PR>, published ☐

Apply the blocked: dependency-rollout label until transformer and SDK support are fully rolled out and the required documentation is published.

Any changes to existing capabilities/behaviour, mention the reason & what are the changes ?

Adds an opt-out for OpenAI Ads hashing in both cloud and web device mode. Existing destinations remain unchanged because isHashRequired defaults to true when omitted. When disabled, email, phone number, first name, last name, and user ID must already be normalized and SHA-256 hashed; unhashed values are rejected. When user ID is absent, RudderStack hashes anonymous ID automatically.

Any new dependencies introduced with this change?

N/A

Any new checks got introduced or modified in test suites. Please explain the changes.

Added destination validation fixtures for isHashRequired: true, isHashRequired: false, and rejection of string values.

Validation

  • npm run format - passed.
  • npm run check:schema:destination openai_ads - passed with no schema diff; the existing informational redirect generator limitation remains.
  • npx jest test/validation.test.ts --runInBand - passed, 6,497 tests.
  • Confirmed the schema remains unchanged by the visibility, label, and footer-note update.

⚠️ Known Issues

  • End-to-end runtime verification was skipped because this repository is configuration-only and the paired runtimes are released separately.
  • The required rudder-hugo documentation is not included and must land before release; it must document pre-hashed user fields, the automatically hashed anonymous-ID fallback, normalization responsibilities, and both cloud and web device-mode behavior.
  • Replace the SDK and documentation PR placeholders and keep the dependency-rollout block in place until all runtime dependencies are rolled out and the documentation is published.

Developer checklist

  • My code follows the style guidelines of this project
  • No breaking changes are being introduced.
  • All related docs linked with the PR?
  • All changes manually tested?
  • Any documentation changes needed with this change? - Required rudder-hugo dependency described above.
  • I have executed schemaGenerator tests and updated schema if needed
  • Are sensitive fields marked as secret in definition config? - No new sensitive field.
  • My test cases and placeholders use only masked/sample values for sensitive fields
  • Is the PR limited to 10 file changes & one task?

Reviewer checklist

  • Is the type of change in the PR title appropriate as per the changes?
  • Verified that there are no credentials or confidential data exposed with the changes.

Copilot AI balanced review requested due to automatic review settings October 22, 2026 17:34
@coderabbitai

coderabbitai Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 93fdde81-ea58-469c-885d-9bbf429622c7

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@rudder-devbox

rudder-devbox Bot commented Oct 22, 2026

Copy link
Copy Markdown
Contributor Author

👋 I'm rudder-devbox. I opened this PR from a Linear ticket.

Mention @devbox or @rudder-devbox and I'll act on it — on a top-level PR comment,
in a review summary, or on an inline comment on the diff. Without a mention I won't see it.

Copilot AI 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.

🔵 Needs a closer look

Human verification is needed to confirm the required transformer rollout and customer documentation publication before clearing the dependency block.

No open issues 🎉

What changed in this PR

Adds the configuration support for optional OpenAI Ads cloud-mode hashing, with isHashRequired defaulting to true.

Changes:

  • Adds a cloud-only hashing checkbox and retains the setting in destination configuration filtering.
  • Defines boolean validation and fixtures for enabled, disabled, and invalid values.
  • Records hashing behavior and guidance for preserving the event-mapping schema during generation.
File Description
test/​data/​validation/​destinations/​openai_ads.json Tests both boolean states and rejects string values.
src/​configurations/​destinations/​openai_ads/​ui-config.json Adds the default-on, cloud-only hashing checkbox.
src/​configurations/​destinations/​openai_ads/​schema.json Defines the boolean setting with a true default.
src/​configurations/​destinations/​openai_ads/​db-config.json Retains the setting in configuration key lists.
.agents/​knowledge/​patterns.md Documents preservation of the hand-maintained redirect schema.
.agents/​knowledge/​conventions.md Records toggle scope, behavior, and documentation requirements.

Review effort: Balanced

@codecov

codecov Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (6a01eb8) to head (886ccba).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #2864   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            2         2           
  Lines          133       133           
  Branches        26        26           
=========================================
  Hits           133       133           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ItsSudip

Copy link
Copy Markdown
Member

@rudder-devbox please address the following review feedback on this PR:

  1. Support device mode — remove the cloud-only prerequisite
    isHashRequired will be honored by web device mode as well (rudder-sdk-js OpenAI Ads integration), not only by the cloud transformer. Remove the preRequisites block (connectionModes.cloud: true) from the isHashRequired checkbox in ui-config.json so the toggle is available for both cloud and web device-mode connections.
    Also update the INT-7432 note in .agents/knowledge/conventions.md — drop the "supported only by cloud-mode transformer delivery" / "web-device-only configurations do not expose an unsupported toggle" guidance and the "cloud-only scope" docs requirement.

  2. Add a footerNote to the checkbox
    Same pattern as requireHash in google_adwords_enhanced_conversions:

    When enabled, RudderStack normalizes and SHA-256 hashes email, phone number, first name, last name, and external ID (userId, or anonymousId when userId is absent) before sending them to OpenAI Ads. Disable this only if you send all of these values already normalized and SHA-256 hashed — events with unhashed values will be rejected.

  3. Label casing
    Change Enable Hashing to Enable hashing to match the sentence case of the other fields in this group (Default currency, Default action source).

  4. PR description
    Replace the rudder-transformer#<PR> placeholder with fix(openai_ads): honor destination hashing configuration rudder-transformer#5718, and add the rudder-sdk-js device-mode change as a runtime dependency (placeholder until that PR exists). Update the "changes to existing capabilities" section and the docs requirement to cover both cloud and web device mode.

After the changes, re-run npm run check:schema:destination openai_ads and npx jest test/validation.test.ts and confirm both pass.

Copilot AI balanced review requested due to automatic review settings October 23, 2026 06:25
@rudder-devbox

rudder-devbox Bot commented Oct 23, 2026

Copy link
Copy Markdown
Contributor Author

Removed the cloud-only prerequisite so isHashRequired is available for both cloud and web device-mode connections, changed the label to Enable hashing, and added the requested footer explaining normalization, all five identifiers, and the anonymousId fallback. Updated the INT-7432 repository guidance and the PR description with rudder-transformer#5718, the pending rudder-sdk-js dependency, and shared cloud/device-mode documentation requirements. npm run check:schema:destination openai_ads passed with no schema diff, and npx jest test/validation.test.ts --runInBand passed all 6,497 tests. Commit 1d9ec13

@rudder-devbox

rudder-devbox Bot commented Oct 23, 2026

Copy link
Copy Markdown
Contributor Author

Knowledge distillation completed

Copilot AI 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.

🔵 Needs a closer look

Safe release depends on confirming transformer and web SDK rollouts and publication of the required customer documentation.

No open issues 🎉

Review effort: Balanced

@ItsSudip

Copy link
Copy Markdown
Member

@rudder-devbox small update to item 2 of my previous comment — use this footerNote text instead (the anonymous ID is now hashed automatically when hashing is disabled):

When enabled, RudderStack normalizes and SHA-256 hashes email, phone number, first name, last name, and user ID before sending them to OpenAI Ads. Disable this only if you send these values already normalized and SHA-256 hashed — unhashed values are rejected. When no user ID is present, RudderStack hashes the anonymous ID automatically.

All other items in the previous comment stand.

Copilot AI balanced review requested due to automatic review settings October 23, 2026 09:22
@rudder-devbox

rudder-devbox Bot commented Oct 23, 2026

Copy link
Copy Markdown
Contributor Author

Updated the checkbox footer with the revised anonymous-ID behavior and aligned the repository guidance and PR description: email, phone, names, and user ID must be pre-hashed when hashing is disabled, while a fallback anonymous ID is hashed automatically.

Validation passed:

  • npm run check:schema:destination openai_ads
  • npx jest test/validation.test.ts --runInBand (6,497 tests)

Pushed in 886ccba3c467b77a49305c159b98441bdad5b216.

@rudder-devbox

rudder-devbox Bot commented Oct 23, 2026

Copy link
Copy Markdown
Contributor Author

Knowledge distillation completed

Copilot AI 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.

🔵 Needs a closer look

Safe release requires human confirmation of transformer and SDK rollouts and publication of the required customer documentation.

No open issues 🎉

Review effort: Balanced

@ItsSudip
ItsSudip marked this pull request as ready for review October 23, 2026 10:36
@ItsSudip
ItsSudip requested a review from a team as a code owner October 23, 2026 10:36
@ItsSudip
ItsSudip merged commit 39667f8 into main Oct 26, 2026
19 checks passed
@ItsSudip
ItsSudip deleted the harness/INT-7432-feat-openai-ads-add-hashing-con-1447d4b7 branch October 26, 2026 03:44
ItsSudip pushed a commit to rudderlabs/rudder-transformer that referenced this pull request Oct 26, 2026
## What are the changes introduced in this PR?

OpenAI Ads cloud transformations now honor destination-level
`isHashRequired`. Hashing remains enabled when the setting is absent,
while disabling it accepts valid pre-hashed customer identifiers and
lowercases them before delivery.

When hashing is disabled and `userId` is absent, the SDK-generated
`anonymousId` fallback is handled separately: an existing SHA-256 digest
passes through lowercased, while a plain value is normalized and hashed
through the existing external-ID path. Audience hashing consistency
metrics also carry the real workspace and destination identifiers.

The transformer passes only plain destination metadata through the
OpenAI Ads builder. The descriptor required by `processAudienceRecord`
is constructed at the utility call boundary, and hash-format recognition
is shared with audience consistency validation.

Focused unit and component coverage verifies enabled, disabled, and
default behavior, all supported hashed identifiers, anonymous-ID
fallback handling, mixed/plain input rejection, metric attribution, and
the shared hash-format predicate.

## What is the related Linear task?

Resolves INT-7432

## Please explain the objectives of your changes below

Allow customers that hash OpenAI Ads identifiers upstream to disable
transformer hashing without changing the existing default behavior. The
matching destination configuration is provided by
[rudder-integrations-config#2864](rudderlabs/rudder-integrations-config#2864).

### Any changes to existing capabilities/behaviour, mention the reason &
what are the changes ?

When `isHashRequired` is `false`, email, phone number, first name, last
name, and `userId` must already be normalized and SHA-256 hashed; plain
values remain rejected. Pre-hashed values are emitted as lowercase
hexadecimal strings. If `userId` is absent, RudderStack automatically
normalizes and hashes a plain `anonymousId` fallback, or lowercases and
passes through an already-hashed fallback. An absent or `true` setting
retains the existing normalization and hashing behavior.

### Any new dependencies introduced with this change?

N/A

### Any new generic utility introduced or modified. Please explain the
changes.

Exposes `isAlreadyHashed(value, hashingType)` from the shared audience
utility and uses it in both hashing-consistency validation and the
OpenAI Ads anonymous-ID fallback decision. The shared digest regex
remains the single definition of an already-hashed value.

### Any technical or performance related pointers to consider with the
change?

OpenAI Ads passes `workspaceId` and `destinationId` as plain metadata
through its builder. `processHashedUserPayload` constructs the
destination descriptor only where `processAudienceRecord` is called,
preserving the uppercase `OPENAI_ADS` metric series without leaking the
audience utility input shape through the transformer.

## Validation

- `npm run lint` - passed
- `npm test --
--testPathPattern="src/v0/(destinations/openai_ads/routerTransform|util/audienceUtils).test.ts"
--no-coverage --runInBand` - passed, 120 tests
- `npm run test:ts -- component --destination=openai_ads` - passed, 14
tests
- `./node_modules/.bin/tsc --noEmit -p tsconfig.test.json` - passed
- Full secret-path regeneration passed; OpenAI Ads still derives only
`headers.Authorization`, and the aggregate artifact remains unchanged
- `git diff --check` - passed
- Simplification pass reused the existing plaintext and SHA-256 fixtures
across the new helper cases and consistency tests

## ⚠️ Known Issues

- End-to-end runtime verification was skipped because the local stack
uses a SHA-pinned transformer image and cannot source-exercise this
change.
- Web device-mode support for `isHashRequired` will follow in
[rudder-sdk-js#3295](rudderlabs/rudder-sdk-js#3295).
- Release remains dependent on the matching integrations-config rollout
and required `rudder-hugo` documentation covering pre-hashed customer
identifiers, automatic anonymous-ID fallback hashing, normalization
responsibilities, and both cloud and web device-mode behavior.

<hr>

### Developer checklist

- [x] My code follows the style guidelines of this project
- [x] **No breaking changes are being introduced.**
- [ ] All related docs linked with the PR?
- [ ] All changes manually tested?
- [x] Any documentation changes needed with this change? Required
`rudder-hugo` dependency described above.
- [x] Is the PR limited to 10 file changes?
- [x] Is the PR limited to one linear task?
- [x] Are relevant unit and component test-cases added in **new
readability format**?

### Reviewer checklist

- [ ] Is the type of change in the PR title appropriate as per the
changes?
- [ ] Verified that there are no credentials or confidential data
exposed with the changes.

---------

Co-authored-by: tech-infra-rudderstack <[email protected]>
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.

3 participants