Skip to content

Lasso Bid Adapter: fix meta.secondaryCatIds/advertiserDomains field mapping - #15565

Open
sujanchalla0510 wants to merge 2 commits into
prebid:masterfrom
sujanchalla0510:fix/lasso-adapter-meta-field-mapping
Open

Lasso Bid Adapter: fix meta.secondaryCatIds/advertiserDomains field mapping#15565
sujanchalla0510 wants to merge 2 commits into
prebid:masterfrom
sujanchalla0510:fix/lasso-adapter-meta-field-mapping

Conversation

@sujanchalla0510

Copy link
Copy Markdown

Summary

modules/lassoBidAdapter.js's interpretResponse() builds meta.secondaryCatIds and meta.advertiserDomains from response.bid.cat / response.bid.advertiserDomains:

https://github.com/prebid/Prebid.js/blob/master/modules/lassoBidAdapter.js#L124-L129

meta: {
  secondaryCatIds: response.bid.cat,
  advertiserDomains: response.bid.advertiserDomains,
  advertiserName: response.meta.advertiserName,
  mediaType: response.bid.mediaType
}

but the adapter's own response shape (confirmed by its own test fixture) carries cat and advertiserDomains under a top-level response.meta object, a sibling of response.bid — not a property of it. The adjacent advertiserName field on the very next line already reads correctly from response.meta.advertiserName, which is the internal-consistency tell that this was a copy/paste slip rather than an intentional shape.

response.bid (per the request payload the endpoint returns — price, w, h, crid, ad, mediaType) never carries cat or advertiserDomains, so meta.secondaryCatIds and meta.advertiserDomains resolve to undefined on every real bid response, unconditionally — not an edge case gated on some optional field being absent, just a wrong root object.

Why the existing test didn't catch this: the test's own response fixture already puts cat: [...] and advertiserDomains: [...] under body.meta (the real, correct wire shape), so the fixture itself never masked anything about the server contract. What masked the bug was the assertion:

https://github.com/prebid/Prebid.js/blob/master/test/spec/modules/lassoBidAdapter_spec.js#L394-L395

const result = spec.interpretResponse(serverResponse);
expect(Object.keys(result[0])).to.deep.equal(Object.keys(expectedResponse));

This only compares the set of keys present on the result, never the values. meta: { secondaryCatIds: undefined, advertiserDomains: undefined, ... } still has the same keys as the expected object, so the assertion passed despite both fields silently resolving to undefined.

Fix

Read both fields from response.meta, matching the already-correct pattern used for advertiserName two lines below.

Verification

Extended the existing interpretResponse test to also assert full deep.equal on the response object (in addition to the pre-existing key-set check), so a wrong source path is actually caught going forward.

Verified by reverting only modules/lassoBidAdapter.js (keeping the updated test) and re-running: the new assertion fails against the unfixed code with

-    "advertiserDomains": [undefined]
+    "advertiserDomains": ["lassomarketing.io"]
-    "secondaryCatIds": [undefined]
+    "secondaryCatIds": ["1", "2", "3", "4"]

Restoring the fix makes it pass.

  • npx gulp lint --files modules/lassoBidAdapter.js,test/spec/modules/lassoBidAdapter_spec.js: clean, no changes needed.
  • npx gulp test-only --file test/spec/modules/lassoBidAdapter_spec.js: 36/36 passing.
  • npx gulp test-only (full suite, all 8 chunks): all passing (no new failures).

Scope

Single, narrowly-scoped bugfix to one adapter file plus its test spec — no other behavior changes.

🤖 Generated with Claude Code

…apping

interpretResponse() read secondaryCatIds and advertiserDomains from
response.bid.cat / response.bid.advertiserDomains, but the adapter's
own server response shape (per its test fixture, and consistent with
how the adjacent advertiserName field is correctly read two lines
below) carries these under a top-level response.meta object, sibling
to response.bid -- not as properties of response.bid. response.bid
never has cat/advertiserDomains keys, so every real bid response
produces meta.secondaryCatIds/meta.advertiserDomains equal to
undefined, unconditionally.

The existing interpretResponse test's own fixture already puts these
fields under body.meta (matching the real wire format), but the
assertion only compared Object.keys(result[0]) against
Object.keys(expectedResponse) -- a keys-only structural check that
never inspects values, so it passed even though every affected field
resolved to undefined.

Fix: read both fields from response.meta, matching the pattern
already used for advertiserName. Extended the existing test to also
assert deep equality of the full response object, not just its key
set, so a wrong source path is actually caught going forward.

Verified by reverting only modules/lassoBidAdapter.js (keeping the
updated test): the new deep-equal assertion fails against the
unfixed code with
  -    "advertiserDomains": [undefined]
  +    "advertiserDomains": ["lassomarketing.io"]
  -    "secondaryCatIds": [undefined]
  +    "secondaryCatIds": ["1", "2", "3", "4"]
Restoring the fix makes it pass.

gulp lint: clean. gulp test-only (all 8 chunks): passing, no
failures.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NFth3sHBrJbHuFeA8Cegdc
@barecheck

barecheck Bot commented Sep 1, 2026

Copy link
Copy Markdown

Barecheck - Code coverage report

Total: 91.28%

Your code coverage diff: 0.00% ▴

Uncovered files and lines
FileLines
modules/lassoBidAdapter.js21, 89-90, 109, 137, 159

Comment thread modules/lassoBidAdapter.js Outdated
meta: {
secondaryCatIds: response.bid.cat,
advertiserDomains: response.bid.advertiserDomains,
secondaryCatIds: response.meta.cat,

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.

please add the fallback to the original place so the team working on the server response can move it around if they need to and have publishers that have upgraded to whenever this is released agnostic to the location

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Good point — done. interpretResponse now reads response.meta.cat/response.meta.advertiserDomains first, but falls back to the original response.bid.cat/response.bid.advertiserDomains location if the server response doesn't carry them under meta. That way the mapping stays agnostic to wherever the server response places these fields going forward, and publishers on either response shape keep working. Added a test case (should fall back to response.bid.cat/advertiserDomains when response.meta does not carry them) that exercises the fallback path — confirmed it fails without the fallback and passes with it. Pushed in 10f2e2c.

@patmmccann
patmmccann removed the request for review from gwhigs September 1, 2026 16:54
…serDomains location

Per review feedback, keep reading secondaryCatIds/advertiserDomains from
response.meta.cat/advertiserDomains first, but fall back to the original
response.bid.cat/response.bid.advertiserDomains location if the server
response doesn't carry them under meta. This keeps interpretResponse
agnostic to where the server team places these fields, so publishers on
either response shape keep working.
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.

2 participants