Repository navigation
feat(openai-ads): add hashing configuration toggle - #2864
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
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. Comment |
|
👋 I'm rudder-devbox. I opened this PR from a Linear ticket. Mention |
There was a problem hiding this comment.
🔵 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 Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
|
@rudder-devbox please address the following review feedback on this PR:
After the changes, re-run |
|
Removed the cloud-only prerequisite so |
|
Knowledge distillation completed |
|
@rudder-devbox small update to item 2 of my previous comment — use this
All other items in the previous comment stand. |
|
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:
Pushed in 886ccba3c467b77a49305c159b98441bdad5b216. |
|
Knowledge distillation completed |
## 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]>
What are the changes introduced in this PR?
Adds a default-on
isHashRequiredsetting 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
truedefault. 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
rudder-sdk-js#<PR>, rolled out ☐rudder-hugo#<PR>, published ☐Apply the
blocked: dependency-rolloutlabel 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
isHashRequireddefaults totruewhen 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 informationalredirectgenerator limitation remains.npx jest test/validation.test.ts --runInBand- passed, 6,497 tests.rudder-hugodocumentation 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.Developer checklist
rudder-hugodependency described above.Reviewer checklist