Skip to content

Conversation

@Matterfull
Copy link

@Matterfull Matterfull commented May 19, 2025

return nil, fmt.Errorf("unable to parse endpoint url template: %v", err)
}

bidder := &MatterfullAdapter{

Choose a reason for hiding this comment

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

You can call this simply "adapter", the MatterfullAdapter identification is already supplied by the package name. As you have it, referencing your adapter from outside the package would be MatterfullAdapter.MatterfullAdapter which looks a little redundant. See example below:

  package foo

  type adapter struct {
    endpoint string
  }
  
  func  Builder(bidderName openrtb_ext.BidderName, config config.Adapter, server config.Server) (adapters.Bidder, error) {
    return &adapter{endpoint: "https://www.foo.com"}, nil
  }

@github-actions
Copy link

Code coverage summary

Note:

  • Prebid team doesn't anticipate tests covering code paths that might result in marshal and unmarshal errors
  • Coverage summary encompasses all commits leading up to the latest one, 93e1c5f

matterfull

Refer here for heat map coverage report

github.com/prebid/prebid-server/v3/adapters/matterfull/matterfull.go:23:	MakeRequests		83.3%
github.com/prebid/prebid-server/v3/adapters/matterfull/matterfull.go:53:	getImpressionsInfo	100.0%
github.com/prebid/prebid-server/v3/adapters/matterfull/matterfull.go:83:	validateImpression	100.0%
github.com/prebid/prebid-server/v3/adapters/matterfull/matterfull.go:91:	compatImpression	100.0%
github.com/prebid/prebid-server/v3/adapters/matterfull/matterfull.go:99:	compatBannerImpression	100.0%
github.com/prebid/prebid-server/v3/adapters/matterfull/matterfull.go:118:	getImpressionExt	85.7%
github.com/prebid/prebid-server/v3/adapters/matterfull/matterfull.go:134:	buildAdapterRequest	83.3%
github.com/prebid/prebid-server/v3/adapters/matterfull/matterfull.go:159:	createBidRequest	75.0%
github.com/prebid/prebid-server/v3/adapters/matterfull/matterfull.go:180:	buildEndpointURL	100.0%
github.com/prebid/prebid-server/v3/adapters/matterfull/matterfull.go:186:	MakeBids		84.2%
github.com/prebid/prebid-server/v3/adapters/matterfull/matterfull.go:220:	getMediaTypeForImpID	100.0%
github.com/prebid/prebid-server/v3/adapters/matterfull/matterfull.go:230:	Builder			100.0%
total:										(statements)		89.7%

@github-actions
Copy link

Code coverage summary

Note:

  • Prebid team doesn't anticipate tests covering code paths that might result in marshal and unmarshal errors
  • Coverage summary encompasses all commits leading up to the latest one, 8164201

matterfull

Refer here for heat map coverage report

github.com/prebid/prebid-server/v3/adapters/matterfull/matterfull.go:23:	MakeRequests		83.3%
github.com/prebid/prebid-server/v3/adapters/matterfull/matterfull.go:53:	getImpressionsInfo	100.0%
github.com/prebid/prebid-server/v3/adapters/matterfull/matterfull.go:83:	validateImpression	100.0%
github.com/prebid/prebid-server/v3/adapters/matterfull/matterfull.go:91:	compatImpression	100.0%
github.com/prebid/prebid-server/v3/adapters/matterfull/matterfull.go:99:	compatBannerImpression	100.0%
github.com/prebid/prebid-server/v3/adapters/matterfull/matterfull.go:118:	getImpressionExt	85.7%
github.com/prebid/prebid-server/v3/adapters/matterfull/matterfull.go:134:	buildAdapterRequest	83.3%
github.com/prebid/prebid-server/v3/adapters/matterfull/matterfull.go:159:	createBidRequest	75.0%
github.com/prebid/prebid-server/v3/adapters/matterfull/matterfull.go:180:	buildEndpointURL	100.0%
github.com/prebid/prebid-server/v3/adapters/matterfull/matterfull.go:186:	MakeBids		84.2%
github.com/prebid/prebid-server/v3/adapters/matterfull/matterfull.go:220:	getMediaTypeForImpID	100.0%
github.com/prebid/prebid-server/v3/adapters/matterfull/matterfull.go:230:	Builder			100.0%
total:										(statements)		89.7%

@bsardo bsardo added the adapter label Jun 4, 2025
@bsardo
Copy link
Collaborator

bsardo commented Jun 13, 2025

@ShriprasadM can you please review?

@Matterfull
Copy link
Author

@ShriprasadM Hi! Can you please tell me the status of our adapter and what we need to do next?

@Matterfull
Copy link
Author

@ShriprasadM Please let us know if you need anything from our side in order to complete the review.

// MakeRequests prepares request information for prebid-server core
func (adapter *adapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) {
errs := make([]error, 0, len(request.Imp))
if len(request.Imp) == 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

While I appreciate the defensive programming, this check is not necessary. Adapters will always be called with at least one impression.

Copy link
Author

Choose a reason for hiding this comment

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

Fixed

errors = append(errors, err)
continue
}
if res[*impExt] == nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

This line may not be necessary, as append will create a slice if it's nil. Can you try removing this check?

"description": "A schema which validates params accepted by the Matterfull adapter",
"type": "object",
"properties": {
"pubid": {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be pid to match the required field?

return nil
}

func getImpressionExt(imp *openrtb2.Imp) (*openrtb_ext.ExtImpMatterfull, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider returning a value type instead of a reference to simplify the map key in the context above. It's a good approach in Go to stick with value types by default and only move to pointers if it needs to be modified or is very large.

@github-actions
Copy link

Code coverage summary

Note:

  • Prebid team doesn't anticipate tests covering code paths that might result in marshal and unmarshal errors
  • Coverage summary encompasses all commits leading up to the latest one, 51aeccd

matterfull

Refer here for heat map coverage report

github.com/prebid/prebid-server/v3/adapters/matterfull/matterfull.go:22:	MakeRequests		80.0%
github.com/prebid/prebid-server/v3/adapters/matterfull/matterfull.go:49:	getImpressionsInfo	100.0%
github.com/prebid/prebid-server/v3/adapters/matterfull/matterfull.go:74:	compatImpression	100.0%
github.com/prebid/prebid-server/v3/adapters/matterfull/matterfull.go:82:	compatBannerImpression	100.0%
github.com/prebid/prebid-server/v3/adapters/matterfull/matterfull.go:101:	getImpressionExt	85.7%
github.com/prebid/prebid-server/v3/adapters/matterfull/matterfull.go:117:	buildAdapterRequest	83.3%
github.com/prebid/prebid-server/v3/adapters/matterfull/matterfull.go:142:	createBidRequest	75.0%
github.com/prebid/prebid-server/v3/adapters/matterfull/matterfull.go:163:	buildEndpointURL	100.0%
github.com/prebid/prebid-server/v3/adapters/matterfull/matterfull.go:169:	MakeBids		84.2%
github.com/prebid/prebid-server/v3/adapters/matterfull/matterfull.go:203:	getMediaTypeForImpID	100.0%
github.com/prebid/prebid-server/v3/adapters/matterfull/matterfull.go:213:	Builder			100.0%
total:										(statements)		88.6%

@ShriprasadM
Copy link
Contributor

@ShriprasadM Please let us know if you need anything from our side in order to complete the review.

@Matterfull : Was busy with some other work. I will look into this today

@Matterfull
Copy link
Author

@ShriprasadM Do we have any updates?

resImps := make([]openrtb2.Imp, 0, len(imps))
res := make(map[openrtb_ext.ExtImpMatterfull][]openrtb2.Imp)

for _, imp := range imps {
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: avoid shallow copies of imps in a loop.

Suggested change
for _, imp := range imps {
for imp := range iterutil.SliceValuePointers(imps) {

Copy link
Author

Choose a reason for hiding this comment

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

Can you please help me with this situation, I can't import iterutil because the folder name and package name are different.

Copy link
Author

Choose a reason for hiding this comment

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

image image image image

Copy link
Author

Choose a reason for hiding this comment

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

@scr-oath Can you please help with this question?

Copy link
Author

Choose a reason for hiding this comment

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

@MaksymTeqBlaze Can you please assist with the question?

Copy link
Contributor

@scr-oath scr-oath Jul 21, 2025

Choose a reason for hiding this comment

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

UPDATE #4447 is merged now, please merge latest with your fork/branch and it should work now.

Comment on lines 192 to 193
for i := 0; i < len(seatBid.Bid); i++ {
bid := seatBid.Bid[i]
bidResponse.Bids = append(bidResponse.Bids, &adapters.TypedBid{
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: Can you comment why you need a copy of the seatBid? Is it being altered in some way? Could you use iterutils.SliceValuePointers to get the pointer to the bid that's in the seatBid.Bid without needing the shallow-copy?

Copy link
Author

Choose a reason for hiding this comment

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

You are right, a copy of seatBid is not needed here, I will rework it to use iterutils.SliceValuePointers.


// getMediaTypeForImp figures out which media type this bid is for
func getMediaTypeForImpID(impID string, imps []openrtb2.Imp) openrtb_ext.BidType {
for _, imp := range imps {
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: Do you need shallow copies of the imps here? Can you use iterutils.SliceValuePointers

@Matterfull Matterfull requested a review from scr-oath July 15, 2025 07:25
@bsardo bsardo assigned MaksymTeqBlaze and unassigned ShriprasadM Jul 15, 2025
return "", err
}
if bidExt.Prebid != nil {
return openrtb_ext.ParseBidType(string(bidExt.Prebid.Type))

Choose a reason for hiding this comment

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

Consider this as a suggestion. Prebid server expects the media type to be explicitly set in the adapter response. Therefore, recommends implementing a pattern where the adapter server sets the MType field in the response to accurately determine the media type for the impression.

@Matterfull
Copy link
Author

@scr-oath I fixed the errors according to the last code review. Tell me, I think I incorrectly brought to the current version of the repository and pushed.

Copy link
Contributor

@scr-oath scr-oath left a comment

Choose a reason for hiding this comment

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

Hmm… I started to review changes in other adapters and then realized - is this merged properly? Why are we picking up other changes and not merely changes to the materfull adapter?

bidderResponse.Currency = bidResponse.Cur
}

for _, seatBid := range bidResponse.SeatBid {
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: Please avoid deep copies; consider using iterutil.SlicePointerValues here

Note that an iterator over a slice is merely assigned the value of each element and, since each is a (large) struct, it's less work to use the pointer. The iterutil helps with this.

Suggested change
for _, seatBid := range bidResponse.SeatBid {
for seatBid := range iterutil.SlicePointerValues(bidResponse.SeatBid) {

Comment on lines 77 to 78
for i := range seatBid.Bid {
bid := seatBid.Bid[i]
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: You can also use iterutil here for both of these lines and, in fact, what you have here is still a copy. I'm not sure if that was intended or not - but you are shallow copying the element in this assignment.

Copy link
Author

Choose a reason for hiding this comment

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

Outdated comment from another commit. Not relevant now.

bidExt, bidExtErr := getBidExt(bid.Ext)
if bidExtErr != nil {
errs = append(errs, &errortypes.FailedToUnmarshal{
Message: fmt.Errorf("bid ext, err: %w", bidExtErr).Error(),
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion (style):
Use %w to wrap errors only when you need to return or propagate an error type, allowing callers to use errors.Is/errors.As for error inspection. Here, since the formatted error message is being converted to a string (not returned as an error), %v is more appropriate. Wrapping with %w is only meaningful in functions that return an error value.

Reference: https://golang.org/pkg/fmt/#hdr-Printing

Example:

// Good: wrapping when returning an error
return fmt.Errorf("context: %w", err)

// Good: using %v when embedding error in a string
Message: fmt.Sprintf("bid ext, err: %v", bidExtErr)

suggestion - why do this and not merely Sprintf?

Suggested change
Message: fmt.Errorf("bid ext, err: %w", bidExtErr).Error(),
Message: fmt.Sprintf("bid ext, err: %v", bidExtErr),

Copy link
Author

Choose a reason for hiding this comment

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

Outdated comment from another commit. Not relevant now.

Comment on lines 17 to 19
if err != nil {
t.Fatalf("Builder returned unexpected error %v", err)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Please use testify

Suggested change
if err != nil {
t.Fatalf("Builder returned unexpected error %v", err)
}
require.NoError(t, "Builder returned unexpected error")

Copy link
Author

Choose a reason for hiding this comment

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

Outdated comment from another commit. Not relevant now.

Comment on lines 195 to 200
if imp.Video != nil {
bidType = openrtb_ext.BidTypeVideo
}
if imp.Audio != nil {
bidType = openrtb_ext.BidTypeAudio
switch {
case imp.Native != nil:
return openrtb_ext.BidTypeNative
case imp.Audio != nil:
return openrtb_ext.BidTypeAudio
case imp.Video != nil:
return openrtb_ext.BidTypeVideo
Copy link
Contributor

Choose a reason for hiding this comment

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

question: why are these diffs showing up? Is there some way this could be merged with main so that the files diffed here are only your changes?

Copy link
Author

@Matterfull Matterfull Jul 25, 2025

Choose a reason for hiding this comment

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

@scr-oath
I don't know what to do in this situation, I downloaded the changes from the master to my branch, because I needed the current version of the utilities, and all the commits that were during this time appeared. Tell me, maybe I should recreate the pull request from the current version?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'll pull this down and take a look… FYI, I enjoy using https://github.com/git-up/GitUp which is a great tool to visualize local branches…

Copy link
Contributor

@scr-oath scr-oath Jul 25, 2025

Choose a reason for hiding this comment

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

Hmm… These files don't show up in its view of the diff… I wonder why GH is getting confused…

image

Copy link
Contributor

@scr-oath scr-oath Jul 25, 2025

Choose a reason for hiding this comment

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

:copilot: says:

git fetch origin
git merge origin/master
# or alternatively:
# git rebase origin/master
git push --force-with-lease

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please try that? @Matterfull ?

Copy link
Author

Choose a reason for hiding this comment

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

Already fixed.

return "", err
}
if bidExt.Prebid != nil {
return openrtb_ext.ParseBidType(string(bidExt.Prebid.Type))

Choose a reason for hiding this comment

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

Consider this as a suggestion. Prebid server expects the media type to be explicitly set in the adapter response. Therefore, recommends implementing a pattern where the adapter server sets the MType field in the response to accurately determine the media type for the impression.

Copy link
Author

Choose a reason for hiding this comment

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

Outdated comment from another commit. Not relevant now.

@Matterfull
Copy link
Author

@scr-oath We have checked and responded to all previous tasks to improve the adapter. The latest found defects have been fixed. Please review the code again.

@Matterfull
Copy link
Author

@scr-oath Please check our latest changes.

@Matterfull
Copy link
Author

@scr-oath Can you please tell us what to do next?

@scr-oath scr-oath self-requested a review September 8, 2025 22:07
Comment on lines 85 to 88
bannerCopy := *imp.Banner
banner := &bannerCopy
//As banner.w/h are required fields for Matterfull platform - take the first format entry
if banner.W == nil || banner.H == nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: no need to copy unless you need to; move these into the if block

Suggested change
bannerCopy := *imp.Banner
banner := &bannerCopy
//As banner.w/h are required fields for Matterfull platform - take the first format entry
if banner.W == nil || banner.H == nil {
//As banner.w/h are required fields for Matterfull platform - take the first format entry
if banner.W == nil || banner.H == nil {
bannerCopy := *imp.Banner
banner := &bannerCopy

@bsardo bsardo assigned hhhjort and unassigned MaksymTeqBlaze Sep 9, 2025
@github-actions
Copy link

Code coverage summary

Note:

  • Prebid team doesn't anticipate tests covering code paths that might result in marshal and unmarshal errors
  • Coverage summary encompasses all commits leading up to the latest one, 3a93383

matterfull

Refer here for heat map coverage report

github.com/prebid/prebid-server/v3/adapters/matterfull/matterfull.go:23:	MakeRequests		80.0%
github.com/prebid/prebid-server/v3/adapters/matterfull/matterfull.go:49:	getImpressionsInfo	100.0%
github.com/prebid/prebid-server/v3/adapters/matterfull/matterfull.go:74:	compatImpression	100.0%
github.com/prebid/prebid-server/v3/adapters/matterfull/matterfull.go:82:	compatBannerImpression	100.0%
github.com/prebid/prebid-server/v3/adapters/matterfull/matterfull.go:99:	getImpressionExt	85.7%
github.com/prebid/prebid-server/v3/adapters/matterfull/matterfull.go:115:	buildAdapterRequest	83.3%
github.com/prebid/prebid-server/v3/adapters/matterfull/matterfull.go:140:	createBidRequest	72.7%
github.com/prebid/prebid-server/v3/adapters/matterfull/matterfull.go:158:	buildEndpointURL	100.0%
github.com/prebid/prebid-server/v3/adapters/matterfull/matterfull.go:164:	MakeBids		83.3%
github.com/prebid/prebid-server/v3/adapters/matterfull/matterfull.go:196:	getMediaTypeForImpID	100.0%
github.com/prebid/prebid-server/v3/adapters/matterfull/matterfull.go:206:	Builder			100.0%
total:										(statements)		88.3%

@Matterfull
Copy link
Author

@hhhjort @scr-oath We have released the changes, can you please check them?

hhhjort
hhhjort previously approved these changes Sep 22, 2025
Copy link
Collaborator

@hhhjort hhhjort left a comment

Choose a reason for hiding this comment

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

LGTM

}
var bidResp openrtb2.BidResponse
if err := jsonutil.Unmarshal(response.Body, &bidResp); err != nil {
msg = fmt.Sprintf("Bad server response: %d", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

It doesn't look like err is an integer (%d)

func Builder(bidderName openrtb_ext.BidderName, config config.Adapter, server config.Server) (adapters.Bidder, error) {
urlTemplate, err := template.New("endpointTemplate").Parse(config.Endpoint)
if err != nil {
return nil, fmt.Errorf("unable to parse endpoint url template: %v", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

When wrapping another err, use %w

Suggested change
return nil, fmt.Errorf("unable to parse endpoint url template: %v", err)
return nil, fmt.Errorf("unable to parse endpoint url template: %w", err)

Copy link
Contributor

@scr-oath scr-oath left a comment

Choose a reason for hiding this comment

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

🤖 Reviewed by Claude Code

Summary

The Matterfull adapter implementation is well-structured and follows Prebid Server patterns correctly. However, there are 3 critical issues that must be fixed before merging, along with some style improvements.

Critical Issues ⚠️

  1. Memory Safety: Direct mutation of input prebidBidRequest can cause side effects for other adapters
  2. Error Handling: Only accepting exactly 1 SeatBid is too restrictive - real SSPs return 0 (no bids) or multiple SeatBids
  3. String Formatting Bug: Using %d for error formatting will cause runtime issues

Build Failures 🔨

The test failures you're seeing are likely related to the analytics module, not your adapter code. However, the above fixes will make your adapter more robust.

Strengths ✅

  • Good test coverage (88.3%)
  • Proper impression grouping by publisher ID
  • Correct banner format handling
  • Appropriate error types used
  • Follows standard Prebid adapter patterns

Next Steps

  1. Fix the 3 critical issues highlighted in the line comments
  2. Address the style issues (variable naming, typo)
  3. The adapter should then be ready for merge

Great work overall! The core functionality is solid, just needs these safety improvements.

}

func createBidRequest(prebidBidRequest *openrtb2.BidRequest, params *openrtb_ext.ExtImpMatterfull, imps []openrtb2.Imp) *openrtb2.BidRequest {
prebidBidRequest.Imp = imps
Copy link
Contributor

Choose a reason for hiding this comment

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

🤖 Reviewed by Claude Code

Critical: Memory Safety Issue

This directly mutates the input prebidBidRequest, which can cause side effects for other adapters processing the same request. You need to create a deep copy first:

func createBidRequest(prebidBidRequest *openrtb2.BidRequest, params *openrtb_ext.ExtImpMatterfull, imps []openrtb2.Imp) *openrtb2.BidRequest {
    // Create a deep copy to avoid mutating the original request
    reqCopy := *prebidBidRequest
    newBidRequest := &reqCopy
    newBidRequest.Imp = imps
    
    if newBidRequest.Site != nil {
        siteCopy := *newBidRequest.Site
        newBidRequest.Site = &siteCopy
        newBidRequest.Site.Publisher = nil
        newBidRequest.Site.Domain = ""
    }
    if newBidRequest.App != nil {
        appCopy := *newBidRequest.App
        newBidRequest.App = &appCopy
        newBidRequest.App.Publisher = nil
    }
    return newBidRequest
}

msg = fmt.Sprintf("Bad server response: %d", err)
return nil, []error{&errortypes.BadServerResponse{Message: msg}}
}
if len(bidResp.SeatBid) != 1 {
Copy link
Contributor

Choose a reason for hiding this comment

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

🤖 Reviewed by Claude Code

Critical: Inflexible Error Handling

This code only accepts exactly 1 SeatBid, but real SSPs often return:

  • 0 SeatBids (no bids available) - should return nil, nil
  • Multiple SeatBids (multiple demand sources) - should process all

Fix:

if len(bidResp.SeatBid) == 0 {
    return nil, nil // No bids
}

bidResponse := adapters.NewBidderResponse()
for _, seatBid := range bidResp.SeatBid {
    for bid := range iterutil.SlicePointerValues(seatBid.Bid) {
        bidResponse.Bids = append(bidResponse.Bids, &adapters.TypedBid{
            Bid:     bid,
            BidType: getMediaTypeForImpID(bid.ImpID, internalRequest.Imp),
        })
    }
}
return bidResponse, nil

}
var bidResp openrtb2.BidResponse
if err := jsonutil.Unmarshal(response.Body, &bidResp); err != nil {
msg = fmt.Sprintf("Bad server response: %d", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

🤖 Reviewed by Claude Code

Bug: Incorrect String Formatting

Using %d format specifier for an error type will cause formatting issues. Use %s or %v:

msg = fmt.Sprintf("Bad server response: %s", err)

or better yet:

msg = fmt.Sprintf("Bad server response: %v", err)

Message: err.Error(),
}
}
var MatterfullExt openrtb_ext.ExtImpMatterfull
Copy link
Contributor

Choose a reason for hiding this comment

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

🤖 Reviewed by Claude Code

Style: Variable Naming Convention

Variable names in Go should follow camelCase convention:

var matterfullExt openrtb_ext.ExtImpMatterfull
if err := jsonutil.Unmarshal(bidderExt.Bidder, &matterfullExt); err != nil {
    return openrtb_ext.ExtImpMatterfull{}, &errortypes.BadInput{
        Message: err.Error(),
    }
}
return matterfullExt, nil

return prebidBidRequest
}

// Builds enpoint url based on adapter-specific pub settings from imp.ext
Copy link
Contributor

Choose a reason for hiding this comment

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

🤖 Reviewed by Claude Code

Typo in Comment

// Builds endpoint url based on adapter-specific pub settings from imp.ext

(missing "d" in "endpoint")

@github-actions
Copy link

Code coverage summary

Note:

  • Prebid team doesn't anticipate tests covering code paths that might result in marshal and unmarshal errors
  • Coverage summary encompasses all commits leading up to the latest one, 4b5350a

matterfull

Refer here for heat map coverage report

github.com/prebid/prebid-server/v3/adapters/matterfull/matterfull.go:23:	MakeRequests		80.0%
github.com/prebid/prebid-server/v3/adapters/matterfull/matterfull.go:49:	getImpressionsInfo	100.0%
github.com/prebid/prebid-server/v3/adapters/matterfull/matterfull.go:74:	compatImpression	100.0%
github.com/prebid/prebid-server/v3/adapters/matterfull/matterfull.go:82:	compatBannerImpression	100.0%
github.com/prebid/prebid-server/v3/adapters/matterfull/matterfull.go:99:	getImpressionExt	85.7%
github.com/prebid/prebid-server/v3/adapters/matterfull/matterfull.go:115:	buildAdapterRequest	83.3%
github.com/prebid/prebid-server/v3/adapters/matterfull/matterfull.go:140:	createBidRequest	76.9%
github.com/prebid/prebid-server/v3/adapters/matterfull/matterfull.go:163:	buildEndpointURL	100.0%
github.com/prebid/prebid-server/v3/adapters/matterfull/matterfull.go:169:	MakeBids		81.2%
github.com/prebid/prebid-server/v3/adapters/matterfull/matterfull.go:203:	getMediaTypeForImpID	100.0%
github.com/prebid/prebid-server/v3/adapters/matterfull/matterfull.go:213:	Builder			100.0%
total:										(statements)		88.3%

@Matterfull
Copy link
Author

@scr-oath We've taken all your suggestions for improving code quality and made the final changes. Could you please review the code? We hope this will be the last one before the merge.

@Matterfull
Copy link
Author

@scr-oath @hhhjort Hello, we're waiting for our pull request to be merged. Can you give us some feedback on where we are in this process and when we'll have it ready?

Copy link
Contributor

@scr-oath scr-oath left a comment

Choose a reason for hiding this comment

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

Comprehensive review of the Matterfull adapter implementation using golang-pro and code-reviewer agents.

Summary

Found 3 critical issues and 4 high-priority issues that should be addressed before merging.

Critical Issues (Must Fix) 🔴

  1. Typo in JSON schema (static/bidder-params/matterfull.json:3)

    • "Metterfull" should be "Matterfull"
  2. Email domain inconsistency (static/bidder-info/matterfull.yaml:7)

    • Email uses @bematterfull.com but bidder is matterfull
    • Please verify correct email domain
  3. Endpoint URL mismatch

    • YAML config: https://prebid.matterfull.co/
    • Tests use: http://us.matterfull.co/
    • Need to align these or document regional endpoints

High Priority Issues (Should Fix) 🟡

  1. Error handling loses partial results (adapters/matterfull/matterfull.go:36-45)

    • When one publisher fails, function returns nil for ALL results
    • Should continue instead of return nil, errs
  2. Missing runtime validation

    • Add runtime check for empty pid like other adapters
  3. Potential state mutation (adapters/matterfull/matterfull.go:90)

    • Shallow copy doesn't prevent slice mutation
    • Add comment or deep copy remaining formats
  4. Unused parameter (adapters/matterfull/matterfull.go:115)

    • params only used for URL building
    • Either remove or document why unused

Medium Priority 📋

  1. Use traditional iteration instead of iterutil.SlicePointerValues
  2. Fix comment formatting (line 60)
  3. Type/field naming inconsistency
  4. Missing package documentation

Positive Observations ⭐

  • ✅ Good test coverage
  • ✅ Proper use of error types
  • ✅ Correct impression grouping
  • ✅ Template-based endpoints

See detailed review document: PR_4343_REVIEW.md in the conductor workspace.

Copy link
Contributor

@scr-oath scr-oath left a comment

Choose a reason for hiding this comment

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

CRITICAL - Error Handling Bug

adapters/matterfull/matterfull.go:40

When building requests for multiple publishers, if one fails, this returns nil for ALL results, discarding previously successful requests:

if err != nil {
    errs = append(errs, err)
    return nil, errs  // ❌ Loses all previous successful requests
}

Fix: Change to continue to return partial results:

if err != nil {
    errs = append(errs, err)
    continue  // ✅ Continue processing other publishers
}

This way if 3 publishers succeed and 1 fails, you return the 3 successful requests with 1 error, which is the expected prebid-server behavior.

Copy link
Contributor

@scr-oath scr-oath left a comment

Choose a reason for hiding this comment

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

State Mutation Issue

adapters/matterfull/matterfull.go:90

The shallow copy doesn't prevent slice mutation:

banner.Format = banner.Format[1:]  // Modifies backing array

Issue: bannerCopy := *imp.Banner creates a shallow copy. The banner.Format slice shares the underlying array with the original impression.

Options:

  1. Deep copy remaining formats:
if len(banner.Format) > 1 {
    banner.Format = append([]openrtb2.Format{}, banner.Format[1:]...)
} else {
    banner.Format = nil
}
  1. Or add explanatory comment (as LunaMedia does):
// Create a copy of the banner, since imp is a shallow copy of the original.

Copy link
Contributor

@scr-oath scr-oath left a comment

Choose a reason for hiding this comment

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

Typo in JSON Schema

static/bidder-params/matterfull.json:3

"title": "Metterfull Adapter Params",  // ❌ Should be "Matterfull"

Please fix the typo.

Copy link
Contributor

@scr-oath scr-oath left a comment

Choose a reason for hiding this comment

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

Email Domain Inconsistency

static/bidder-info/matterfull.yaml:7

maintainer:
  email: "[email protected]"  # ❌ bematterfull vs matterfull

The email uses @bematterfull.com domain while the bidder is named matterfull.

Please verify:

  • Is this the correct email domain?
  • Or should it match the bidder name?
  • Is there a relationship between bematterfull and matterfull that should be documented?

scr-oath

This comment was marked as off-topic.

- Typo in JSON schema;
- Endpoint URL mismatch;
- Error handling loses partial results;
- Missing runtime validation;
- Potential state mutation;
- Unused parameter.
@github-actions
Copy link

Code coverage summary

Note:

  • Prebid team doesn't anticipate tests covering code paths that might result in marshal and unmarshal errors
  • Coverage summary encompasses all commits leading up to the latest one, 7313f83

matterfull

Refer here for heat map coverage report

github.com/prebid/prebid-server/v3/adapters/matterfull/matterfull.go:23:	MakeRequests		80.0%
github.com/prebid/prebid-server/v3/adapters/matterfull/matterfull.go:49:	getImpressionsInfo	100.0%
github.com/prebid/prebid-server/v3/adapters/matterfull/matterfull.go:74:	compatImpression	100.0%
github.com/prebid/prebid-server/v3/adapters/matterfull/matterfull.go:82:	compatBannerImpression	80.0%
github.com/prebid/prebid-server/v3/adapters/matterfull/matterfull.go:112:	getImpressionExt	77.8%
github.com/prebid/prebid-server/v3/adapters/matterfull/matterfull.go:136:	buildAdapterRequest	83.3%
github.com/prebid/prebid-server/v3/adapters/matterfull/matterfull.go:161:	createBidRequest	76.9%
github.com/prebid/prebid-server/v3/adapters/matterfull/matterfull.go:184:	buildEndpointURL	100.0%
github.com/prebid/prebid-server/v3/adapters/matterfull/matterfull.go:190:	MakeBids		81.2%
github.com/prebid/prebid-server/v3/adapters/matterfull/matterfull.go:224:	getMediaTypeForImpID	100.0%
github.com/prebid/prebid-server/v3/adapters/matterfull/matterfull.go:234:	Builder			100.0%
total:										(statements)		85.3%

@Matterfull
Copy link
Author

@scr-oath. We checked our mail and it is absolutely correct. [email protected].

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.

8 participants