feat(PM-4199): Persist challenge context in review schema#6
Closed
hentrymartin wants to merge 14 commits intodevelopfrom
Closed
feat(PM-4199): Persist challenge context in review schema#6hentrymartin wants to merge 14 commits intodevelopfrom
hentrymartin wants to merge 14 commits intodevelopfrom
Conversation
Contributor
|
rejected |
There was a problem hiding this comment.
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.
|
|
||
| export const apiAuthLayer = new CompositeAuth([ | ||
| // TC Member Auth0 JWTs | ||
| // // TC Member Auth0 JWTs |
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/', |
|
|
||
| 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; |
| 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 on lines
64
to
+67
| branches: | ||
| only: | ||
| - develop | ||
| - pm-4199 |
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.
What's in this PR?
Ticket link - https://topcoder.atlassian.net/browse/PM-4199