[NO-REF] - update PIA module with API and A/B test parameters - #484
Open
vladconstructor wants to merge 4 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Product Insights Agent (PIA) client to support additional request/query parameters used for experiments and response formatting, and aligns the public TypeScript types and module tests with the new capabilities.
Changes:
- Add support in PIA URL construction for
testCells(asef-*query params) and additional request parameters:features,feature_variants,pre_filter_expression,guard, andfmt_options. - Extend
pia.d.tsparameter types via a sharedPiaBaseParametersand add typing forpreFilterExpressionandfmtOptions. - Add/extend PIA module specs to cover newly supported parameters.
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
src/types/pia.d.ts |
Extends PIA parameter typings (base params + new fields like preFilterExpression / fmtOptions). |
src/modules/pia.js |
Adds query param wiring for experiments (testCells) and new PIA request parameters. |
spec/src/modules/pia.js |
Adds tests for the new query parameter behaviors (needs stronger assertions/coverage). |
Suppressed comments (1)
spec/src/modules/pia.js:332
- For parity with other tests in this file, the new
featurestest should assert the parsed value (not just the key), andfmtOptionsbehavior is currently untested despite being added to the request builder.
it('Should pass features as query parameters when provided', function () {
this.timeout(10000);
const features = { pia_v2: true };
const { agent: { pia } } = new ConstructorIO({
apiKey: piaApiKey,
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| return pia.getSuggestedQuestions(validItemId, { featureVariants }).then(() => { | ||
| const requestedUrlParams = helpers.extractUrlParamsFromFetch(fetchSpy); | ||
|
|
||
| expect(requestedUrlParams).to.have.property('feature_variants'); |
Comment on lines
+176
to
+189
| it('Should pass pre_filter_expression as a query parameter when provided', () => { | ||
| const preFilterExpression = { brand: 'apple' }; | ||
| const { agent: { pia } } = new ConstructorIO({ | ||
| apiKey: piaApiKey, | ||
| fetch: fetchSpy, | ||
| }); | ||
|
|
||
| return pia.getSuggestedQuestions(validItemId, { preFilterExpression }).then(() => { | ||
| const requestedUrlParams = helpers.extractUrlParamsFromFetch(fetchSpy); | ||
|
|
||
| expect(requestedUrlParams).to.have.property('pre_filter_expression'); | ||
| }); | ||
| }); | ||
|
|
| return pia.getSuggestedQuestions(validItemId, { features }).then(() => { | ||
| const requestedUrlParams = helpers.extractUrlParamsFromFetch(fetchSpy); | ||
|
|
||
| expect(requestedUrlParams).to.have.property('features'); |
v-i-s-h-n-u-ps
approved these changes
Aug 20, 2026
12 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.