Skip to content

Core: fpd validation library#15333

Open
mkomorski wants to merge 9 commits into
masterfrom
mkomorski/fpd-validation-library
Open

Core: fpd validation library#15333
mkomorski wants to merge 9 commits into
masterfrom
mkomorski/fpd-validation-library

Conversation

@mkomorski

@mkomorski mkomorski commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

Type of change

  • Feature

Description of change

This PR extracts the FPD validation logic from validationFpdModule into a shared library under libraries/fpdUtils/. The validation code is no longer tied to a single module and can be reused by other parts of Prebid — including bid adapters — that need to validate ortb2 first-party data.

The same library is also integrated into the debugging module. When bids are intercepted, FPD validation runs against bidRequest.ortb2 and invalid fields are reported via console warnings, which helps developers spot FPD issues during local testing without relying on a live bidder response.

validationFpdModule remains responsible for running validation at auction time via the FPD pipeline; it now delegates to the shared library instead of owning the validation implementation.

Other information

fixes #14968

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

Whoa there partner! This project is migrating to typescript. Consider changing the new JS files to TS, with well-defined types for what interacts with the prebid public API (for example: bid params and configuration). Thanks!

  • libraries/fpdUtils/pubcidOptout.js
  • libraries/fpdUtils/validateFpd.js
  • modules/debugging/fpdValidation.js

Tread carefully! This PR adds 2 linter errors (possibly disabled through directives):

  • libraries/fpdUtils/validateFpd.js (+1 error)
  • modules/debugging/fpdValidation.js (+1 error)

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

Some adapters in this PR do not follow Prebid naming conventions.

  • Module debugging defines prebid code debugging, which conflicts with:
    • prebid code debugging defined in module prebid-core

@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: f4a7a41802

ℹ️ 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 on lines +20 to +22
function fpdWarn(...args) {
// eslint-disable-next-line no-console
console.warn(...args);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Use Prebid logging for FPD validation warnings

When validationFpdModule sees invalid ortb2 on a normal publisher page, this helper now calls console.warn directly, whereas the extracted code previously used logWarn. That bypasses Prebid's debug gating and auctionDebug emission, so validation warnings become unconditional console noise in production and listeners no longer receive the standard warning event; route these warnings through logWarn or an injectable logger instead.

Useful? React with 👍 / 👎.

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

Whoa there partner! This project is migrating to typescript. Consider changing the new JS files to TS, with well-defined types for what interacts with the prebid public API (for example: bid params and configuration). Thanks!

  • libraries/fpdUtils/pubcidOptout.js
  • libraries/fpdUtils/validateFpd.js
  • modules/debugging/fpdValidation.js

Tread carefully! This PR adds 2 linter errors (possibly disabled through directives):

  • libraries/fpdUtils/validateFpd.js (+1 error)
  • modules/debugging/fpdValidation.js (+1 error)

@barecheck

barecheck Bot commented Jul 9, 2026

Copy link
Copy Markdown

Barecheck - Code coverage report

Total: 96.58%

Your code coverage diff: 0.00% ▴

Uncovered files and lines
FileLines
libraries/fpdUtils/validateFpd.ts109-110
modules/debugging/debugging.js52-53, 131
src/config.ts87-88, 145, 192, 396, 463, 476-477, 522-523, 636
src/debugging.js30-31, 118
test/spec/modules/debugging_mod_spec.js48, 623

@mkomorski
mkomorski requested a review from dgirardi July 9, 2026 14:11
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

Whoa there partner! This project is migrating to typescript. Consider changing the new JS files to TS, with well-defined types for what interacts with the prebid public API (for example: bid params and configuration). Thanks!

  • libraries/fpdUtils/pubcidOptout.js
  • libraries/fpdUtils/validateFpd.js
  • modules/debugging/fpdValidation.js

Tread carefully! This PR adds 2 linter errors (possibly disabled through directives):

  • libraries/fpdUtils/validateFpd.js (+1 error)
  • modules/debugging/fpdValidation.js (+1 error)

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

Some adapters in this PR do not follow Prebid naming conventions.

  • Module debugging defines prebid code debugging, which conflicts with:
    • prebid code debugging defined in module prebid-core

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

This PR introduces changes that may not work on all browsers. According to Babel, the following polyfills may be needed, and they are not automatically included:

  • Changes to libraries/fpdUtils/validateFpd.js may need:
    • es.array.push
    • es.iterator.constructor
    • es.iterator.filter
    • es.iterator.for-each
    • es.iterator.reduce
    • esnext.iterator.constructor
    • esnext.iterator.filter
    • esnext.iterator.for-each
    • esnext.iterator.reduce

The best way to address this is to provide good test coverage, as normal PR checks run unit tests on older browsers.

Comment thread libraries/fpdUtils/pubcidOptout.js Outdated

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

can we keep new files in ts pls?

@github-actions

Copy link
Copy Markdown

Whoa there partner! This project is migrating to typescript. Consider changing the new JS files to TS, with well-defined types for what interacts with the prebid public API (for example: bid params and configuration). Thanks!

  • modules/debugging/fpdValidation.js

Tread carefully! This PR adds 1 linter error (possibly disabled through directives):

  • modules/debugging/fpdValidation.js (+1 error)

@github-actions

Copy link
Copy Markdown

Some adapters in this PR do not follow Prebid naming conventions.

  • Module debugging defines prebid code debugging, which conflicts with:
    • prebid code debugging defined in module prebid-core

@github-actions

Copy link
Copy Markdown

This PR introduces changes that may not work on all browsers. According to Babel, the following polyfills may be needed, and they are not automatically included:

  • Changes to libraries/fpdUtils/validateFpd.ts may need:
    • es.array.push
    • es.iterator.constructor
    • es.iterator.filter
    • es.iterator.for-each
    • es.iterator.reduce
    • esnext.iterator.constructor
    • esnext.iterator.filter
    • esnext.iterator.for-each
    • esnext.iterator.reduce

The best way to address this is to provide good test coverage, as normal PR checks run unit tests on older browsers.

@github-actions

Copy link
Copy Markdown

This PR includes an adapter whose code does not match its file name. Bid adapter modules should be named <bidderCode>BidAdapter, userId <userIdCode>IdSystem, RTD <rtdCode>RtdProvider, and analytics <analyticsCode>AnalyticsAdapter.

@github-actions

Copy link
Copy Markdown

Some adapters in this PR do not follow Prebid naming conventions.

  • Module debugging defines prebid code debugging, which conflicts with:
    • prebid code debugging defined in module prebid-core

@github-actions

github-actions Bot commented Jul 14, 2026

Copy link
Copy Markdown

This PR introduces changes that may not work on all browsers. According to Babel, the following polyfills may be needed, and they are not automatically included:

  • Changes to libraries/fpdUtils/validateFpd.ts may need:
    • es.array.push
    • es.iterator.constructor
    • es.iterator.filter
    • es.iterator.for-each
    • es.iterator.reduce
    • esnext.iterator.constructor
    • esnext.iterator.filter
    • esnext.iterator.for-each
    • esnext.iterator.reduce
  • Changes to modules/debugging/fpdValidation.ts may need:
    • es.iterator.constructor
    • es.iterator.for-each
    • esnext.iterator.constructor
    • esnext.iterator.for-each

The best way to address this is to provide good test coverage, as normal PR checks run unit tests on older browsers.

@mkomorski
mkomorski requested a review from patmmccann July 14, 2026 14:31
Comment thread modules/debugging/fpdValidation.ts Outdated
}
}

export function validateInterceptedBidFpd(bidRequest) {

@dgirardi dgirardi Jul 14, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

My understanding is that currently the FPD validation module can be useful to check your setup, but once you found / fixed any issues there's no point to leaving it in production, hence why we want it as part of debugging. That way you could just turn debugging on temporarily to find any issues.

I am not sure about doing it as part of bid interception:

  • to do that kind of check you would need to intercept all bids and most issues would be duplicated for each one. Even then there may be some FPD that doesn't run through the validation (if for example some bidders do not run on every auction).
  • if you are intercepting bids for other reasons (and you don't know or care about FPD) it may also be surprising to see them being modified, you don't typically expect troubleshooting tools to change the behavior of the thing they're troubleshooting.

IMO this should do something similar to the module, running on global config and bidderConfig rather than bids, and not modify it (which could be achieved just by cloning it, although the wording of the logs it generates may need to be adjusted as well).

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

validation in debugging

3 participants