Skip to content

[DO NOT MERGE] PM-4062 default ai config#71

Open
vas3a wants to merge 2 commits intodevelopfrom
PM-4062_ai-config
Open

[DO NOT MERGE] PM-4062 default ai config#71
vas3a wants to merge 2 commits intodevelopfrom
PM-4062_ai-config

Conversation

@vas3a
Copy link
Collaborator

@vas3a vas3a commented Feb 26, 2026

This pull request introduces significant improvements to how default reviewers and AI review configurations are handled during challenge creation. It refactors the process to separate member reviewer and AI reviewer logic, introduces new helper methods for applying and creating AI review configs, and replaces the aiWorkflowId field with aiConfigTemplateId throughout the codebase and database schema. Additionally, it adds configuration for the reviews API and makes minor test fixture corrections.

  • Refactored challenge creation to use new helper methods: applyDefaultMemberReviewersForChallengeCreation and applyDefaultAIConfigForChallengeCreation, which separately handle member and AI reviewers, improving clarity and extensibility. AI review configurations are created via the reviews API only when reviewers are not provided explicitly.

  • Renamed the aiWorkflowId field to aiConfigTemplateId in the DefaultChallengeReviewer model and throughout the codebase, including validation schemas, normalization logic, and API payloads. This aligns the naming with the new AI review template-based approach.

  • Added REVIEWS_API_URL to configuration files and environment variable templates to support dynamic endpoint configuration for the reviews API. (config/default.js, docs/dev.env, docs/prod.env). NOTE we need to make sure this exists in prod.

Test and Fixture Corrections:

  • Fixed a test data typo by changing the track name from 'DEVELOP' to 'DEVELOPMENT' to match expected values. Also included a missing import in a unit test file. (test/testHelper.js, test/unit/ChallengeService.test.js)

NOTE: Auth0 scopes need to be updated for v6 Challenge API in prod

…emplateId and attach default ai config when creating a challenge
@vas3a vas3a requested review from jmgasper and kkartunov February 26, 2026 07:05
{ isMachine: true, sub: 'sub', userId: 'testuser' },
challengeData,
config.M2M_FULL_ACCESS_TOKEN
config.M2M_FULL_ACCESS_TOKEN || 'test-token'

Choose a reason for hiding this comment

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

[❗❗ security]
Using a default token 'test-token' when config.M2M_FULL_ACCESS_TOKEN is not set could lead to unexpected behavior in production environments. Consider ensuring that this fallback is only used in test environments to prevent security issues.

const result = await service.createChallenge(
{ isMachine: true, sub: 'sub', userId: 'testuser' },
challengeData,
config.M2M_FULL_ACCESS_TOKEN || 'test-token'

Choose a reason for hiding this comment

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

[❗❗ security]
Using a default token 'test-token' when config.M2M_FULL_ACCESS_TOKEN is not set could lead to unexpected behavior in production environments. Consider ensuring that this fallback is only used in test environments to prevent security issues.

const result = await service.createChallenge(
{ isMachine: true, sub: 'sub', userId: 'testuser' },
challengeData,
config.M2M_FULL_ACCESS_TOKEN || 'test-token'

Choose a reason for hiding this comment

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

[❗❗ security]
Using a default token 'test-token' when config.M2M_FULL_ACCESS_TOKEN is not set could lead to unexpected behavior in production environments. Consider ensuring that this fallback is only used in test environments to prevent security issues.

Copy link
Contributor

@kkartunov kkartunov left a comment

Choose a reason for hiding this comment

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

@vas3a please regenrate the prisma client to include the update in this PR so other clients get it...

@kkartunov kkartunov changed the title PM-4062 default ai config [DO NOT MERGE] PM-4062 default ai config Feb 26, 2026
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