Skip to content

feat(PM-4199): Persist challenge context in review schema#6

Closed
hentrymartin wants to merge 14 commits intodevelopfrom
pm-4199
Closed

feat(PM-4199): Persist challenge context in review schema#6
hentrymartin wants to merge 14 commits intodevelopfrom
pm-4199

Conversation

@hentrymartin
Copy link
Copy Markdown

What's in this PR?

  • This PR persists the challenge context in review schema

Ticket link - https://topcoder.atlassian.net/browse/PM-4199

@kkartunov kkartunov requested a review from Copilot March 19, 2026 15:04
@kkartunov
Copy link
Copy Markdown
Contributor

rejected

@kkartunov kkartunov closed this Mar 19, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Persists a unified challenge context into the Topcoder Review API as part of the challenge context workflow, using M2M authentication.

Changes:

  • Added a workflow step to upsert (create-or-update) challenge review context via the Review API.
  • Updated Auth0/M2M-related configuration and test mocks.
  • Adjusted CI workflow branch filters.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
src/utils/middleware/resourceIdMiddleware.ts Removes stray blank lines in middleware for cleaner formatting.
src/utils/middleware/resourceIdMiddleware.test.ts Extends logger mocks to include debug for updated logging expectations.
src/utils/auth/index.ts Tweaks Auth0 M2M configuration (adds env fallbacks) and modifies a comment.
src/mastra/workflows/challenge/challenge-context-workflow.ts Implements Review API persistence (POST-then-PUT on conflict) and wires it into the workflow.
src/config/m2m.config.ts Adds an Auth0 M2M domain config value with a default.
.circleci/config.yml Adds pm-4199 branch to CircleCI workflow filters.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread src/utils/auth/index.ts

export const apiAuthLayer = new CompositeAuth([
// TC Member Auth0 JWTs
// // TC Member Auth0 JWTs
Comment thread src/utils/auth/index.ts
Comment on lines +12 to +13
domain: process.env.AUTH0_M2M_DOMAIN ?? 'topcoder-dev.auth0.com',
audience: process.env.AUTH0_M2M_AUDIENCE ?? 'https://m2m.topcoder-dev.com/',
Comment thread src/utils/auth/index.ts

export const apiAuthLayer = new CompositeAuth([
// TC Member Auth0 JWTs
// // TC Member Auth0 JWTs
Comment on lines +575 to +581
if (createRes.status !== 409) {
const createErrorBody = await createRes.text().catch(() => '<failed to read body>');
tcAILogger.error(
`[challenge-context:review-api] Failed to create challenge review context for challenge ${challengeId} (HTTP ${createRes.status}) — body: ${createErrorBody}`,
);
return;
}
Comment on lines +600 to +605
if (!updateRes.ok) {
tcAILogger.error(
`[challenge-context:review-api] Failed to update challenge review context for challenge ${challengeId} (HTTP ${updateRes.status})`,
);
return;
}
Comment on lines +538 to +541
const m2mService = new M2MService();

async function upsertChallengeReviewContext(context: UnifiedChallengeContext): Promise<void> {
const challengeId = context.challengeId;
Comment thread src/config/m2m.config.ts
proxyUrl: process.env.M2M_AUTH_PROXY_SERVER_URL ?? 'https://auth0proxy.topcoder-dev.com/token',
clientId: process.env.M2M_AUTH_CLIENT_ID,
clientSecret: process.env.M2M_AUTH_CLIENT_SECRET,
AUTH0_M2M_DOMAIN: process.env.AUTH0_M2M_DOMAIN ?? 'topcoder-dev.auth0.com',
Comment thread .circleci/config.yml
Comment on lines 64 to +67
branches:
only:
- develop
- pm-4199
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.

3 participants