Skip to content

fix: address review feedback from #170#171

Open
benminer wants to merge 3 commits into
mainfrom
fix/pr-170-review-feedback
Open

fix: address review feedback from #170#171
benminer wants to merge 3 commits into
mainfrom
fix/pr-170-review-feedback

Conversation

@benminer
Copy link
Copy Markdown
Collaborator

Summary

Addresses retroactive review comments from #170:

  • Delete placeholder test files for removed resources (the describe('removed') stubs were noise with temporal references)
  • Reject storefront persona in Scope3Client constructor at runtime — prevents silent misconfiguration
  • Remove [key: string]: unknown index signatures from CreateCampaignInput and UpdateCampaignInput to restore type safety
  • Add response validation via campaignSchemas.response to create and update methods (matching get)
  • Type autoSelectProducts, getMediaBuyStatus, getProducts return values using shapes from the OpenAPI spec instead of Record<string, unknown>

Test plan

  • tsc --noEmit passes
  • 27 test suites, 418 tests pass
  • Prettier and ESLint clean
  • CI passes

- Delete placeholder test files for removed resources instead of stubs
- Reject storefront persona in Scope3Client constructor at runtime
- Remove index signatures from CreateCampaignInput/UpdateCampaignInput
- Add response validation to campaigns create/update methods
- Type autoSelectProducts, getMediaBuyStatus, getProducts responses
  using shapes from OpenAPI spec
@benminer benminer requested a review from a team May 27, 2026 17:51
Comment thread src/types/index.ts
salesAgentId: string;
groupId: string;
groupName: string;
cpm?: number;
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.

this type is missing fields from AutoSelectProductsResponse in buyer.ts. selectedProducts items need budget: number (required) and pricingOptionId?: string. top level is also missing budgetContext: { campaignBudget, totalAllocated, remainingBudget, currency }, productCount: number, and previouslySelectedCount?: number

Comment thread src/types/index.ts
budget?: number;
pricingOptionId?: string;
pricingModel?: string;
}
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.

missing fields vs CampaignProductEntry in the schema: selectedAt: string (required), searchContext?: { id: string; brief: string }, and mediaBuys: Array<{ MediaBuyId: string; Status: string; name: string }> (also required)

Comment thread src/types/index.ts Outdated
| 'ACTIVE'
| 'PAUSED'
| 'COMPLETED'
| 'CANCELED';
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.

FAILED, REJECTED, and ARCHIVED are in the MediaBuyStatus schema but missing here

Comment thread src/types/index.ts
Status: string;
startTime?: string;
endTime?: string;
}>;
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.

no corresponding exported schema for this in buyer.ts - looks hand-rolled. if it's based on the campaign response's mediaBuys field, it should reuse that shape rather than being a standalone interface

Comment thread src/resources/campaigns.ts Outdated
): Promise<ApiResponse<Record<string, unknown>>> {
return this.adapter.request<ApiResponse<Record<string, unknown>>>(
data?: {
refine?: Array<Record<string, unknown>>;
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.

RefinementItem is already defined in the types - using it here would give callers actual type safety instead of Record<string, unknown>

- AutoSelectProductsResult: add budget (required), pricingOptionId,
  budgetContext, productCount, previouslySelectedCount
- CampaignProductEntry: add selectedAt (required), searchContext,
  mediaBuys (required)
- MediaBuyStatusValue: add FAILED, REJECTED, ARCHIVED
- CampaignMediaBuyStatus: match GetAdcpStatusOutput schema shape
  (campaign_id, media_buys with full status fields, agents_queried, errors)
- Add RefinementItem discriminated union type, use in autoSelectProducts
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