Conversation
PM-4214 - jd workflow init
optimized review context extraction -> dev
wipro provider -> dev
There was a problem hiding this comment.
Pull request overview
This PR expands the AI skill set documentation and adds new JD rewriting skills while refactoring challenge-context extraction into decomposed, validated calls with structured-output fallbacks. It also introduces a Wipro provider integration, adds integration testing scaffolding, and updates runtime/test configuration.
Changes:
- Add/extend SKILL documentation for tech stack, submission guidelines, codebase detection, and new JD rewriting/extraction/formatting skills.
- Refactor challenge-context extraction into 4 focused calls + post-validation helpers; add a generic structured-output fallback wrapper.
- Add Vitest integration config + integration tests/fixtures; switch agents/scorers to Wipro provider and update build/runtime configs.
Reviewed changes
Copilot reviewed 25 out of 28 changed files in this pull request and generated 13 comments.
Show a summary per file
| File | Description |
|---|---|
| workspace/skills/tech-stack-extraction/SKILL.md | Clarifies exclusions for tech-stack extraction (platform tooling, generic categories, conditional tech). |
| workspace/skills/submission-guidelines-extraction/SKILL.md | Tightens whatToSubmit rules; adds strong consistency rules for isPatchOfExisting and common mistakes tables. |
| workspace/skills/jd-structure-formatting/SKILL.md | New skill spec defining canonical JD section order and Markdown formatting rules. |
| workspace/skills/jd-skills-extraction/SKILL.md | New skill spec for extracting canonical-cased skill keywords from JDs. |
| workspace/skills/jd-content-rewriting/references/SIGNAL-WORDS.md | Adds reference list of signal words for requirement vs nice-to-have classification. |
| workspace/skills/jd-content-rewriting/SKILL.md | New skill spec for rewriting raw JDs into professional, specific language. |
| workspace/skills/codebase-detection/SKILL.md | Refines greenfield vs existing artifact heuristics and adds clearer examples. |
| vitest.integration.config.ts | Adds a dedicated Vitest config for integration tests. |
| tsconfig.json | Includes tests in TS project include globs. |
| tests/integration/challenge-context/extraction.test.ts | Adds integration tests for AI extraction + deterministic validation helpers. |
| tests/fixtures/github-skills-import.json | Adds a fixture challenge spec + expected context assertions. |
| src/utils/structured-output-wrapper.ts | Adds multi-strategy structured-output generation fallback + token usage metrics helpers. |
| src/utils/providers/wipro.ts | Adds Wipro AI SDK provider initialization and default JSON mode settings. |
| src/utils/index.ts | Re-exports Wipro provider and adjusts exports ordering. |
| src/utils/auth/m2m.service.ts | Switches m2m import to createRequire-based loading. |
| src/mastra/workspaces/ai.workspace.ts | Adjusts workspace index paths configuration. |
| src/mastra/workflows/jd/jd-autowrite-workflow.ts | Adds a JD autowrite workflow using structured output fallback. |
| src/mastra/workflows/challenge/challenge-context-workflow.ts | Decomposes extraction into focused calls; adds buildChallengeText + validation helpers; changes scorecard base env var. |
| src/mastra/scorers/skills-matching-scorers.ts | Renames exported scorers/aggregate object (skillDiscovery* → instance*). |
| src/mastra/index.ts | Registers new JD workflow/agent; switches scorer imports; adds server host env; configures bundler externals/transpile. |
| src/mastra/agents/skills/skills-matching-agent.ts | Switches model provider to Wipro; switches scorer imports and eval sample env var. |
| src/mastra/agents/jd/jd-rewriter-agent.ts | Adds JD rewriter agent using Wipro model. |
| src/mastra/agents/challenge/challenge-parser-agent.ts | Switches challenge parser model provider from Ollama to Wipro. |
| package.json | Adds integration-test script; bumps Mastra/AI/Vitest deps; adds Wipro provider dependency (git URL). |
| Dockerfile | Installs git in runtime image. |
| .nvmrc | Bumps Node version. |
| .gitignore | Adds test-data to ignored paths. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } from './scorers/skills-matching-scorers'; | ||
| instanceAnswerRelevancyScorer, | ||
| instancePromptAlignmentScorer, | ||
| } from './scorers/instance-scorers'; |
There was a problem hiding this comment.
The imports reference ./scorers/instance-scorers, but the diff only shows changes to src/mastra/scorers/skills-matching-scorers.ts (and no new instance-scorers module). This will fail at build/runtime. Fix by either (a) adding an instance-scorers.ts file that exports these symbols, or (b) updating imports (here and in skills-matching-agent.ts) to import from the actual scorer module file.
| } from './scorers/instance-scorers'; | |
| } from './scorers/skills-matching-scorers'; |
| // --------------------------------------------------------------------------- | ||
|
|
||
| const SCORECARD_API_BASE = process.env.TC_API_BASE_URL ?? 'https://api.topcoder.com/v6'; | ||
| const SCORECARD_API_BASE = process.env.TC_API_BASE ?? 'https://api.topcoder.com/v6'; |
There was a problem hiding this comment.
This changes the env var from TC_API_BASE_URL to TC_API_BASE, which is a breaking operational change (existing deployments may only set the former). To avoid production misconfiguration, support both (prefer the new name but fall back to the old one) and/or document the migration clearly.
| const SCORECARD_API_BASE = process.env.TC_API_BASE ?? 'https://api.topcoder.com/v6'; | |
| const SCORECARD_API_BASE = | |
| process.env.TC_API_BASE ?? process.env.TC_API_BASE_URL ?? 'https://api.topcoder.com/v6'; |
| import { createRequire } from 'node:module'; | ||
| import { M2mConfig } from '../../config/m2m.config'; | ||
|
|
||
| const require = createRequire(import.meta.url); | ||
| const m2mAuth = require('tc-core-library-js').auth.m2m; |
There was a problem hiding this comment.
createRequire(import.meta.url) only works in ESM. If this project is built/loaded as CommonJS (package.json does not show type: module in the diff), import.meta can be undefined and this will crash at runtime. Consider a dual-mode approach (use global require when available; otherwise use createRequire(import.meta.url)), or keep the prior require(...) approach if the runtime is CommonJS.
| import { createRequire } from 'node:module'; | |
| import { M2mConfig } from '../../config/m2m.config'; | |
| const require = createRequire(import.meta.url); | |
| const m2mAuth = require('tc-core-library-js').auth.m2m; | |
| import tcCoreLibrary from 'tc-core-library-js'; | |
| import { M2mConfig } from '../../config/m2m.config'; | |
| const m2mAuth = tcCoreLibrary.auth.m2m; |
| const TECH_STACK_EXCLUDE_PATTERNS: RegExp[] = [ | ||
| // Review / CI / quality-gate tooling | ||
| /\bsast\b/i, | ||
| /\bvulnerability\s*scanner/i, | ||
| /\bcode\s*quality\s*gate/i, | ||
| /\bstatic\s*analysis/i, | ||
| /\breview\s*(bot|tool|workflow|system)/i, | ||
| // Topcoder platform internals | ||
| /\bcopilot\b/i, | ||
| /\bscorecard\b/i, | ||
| /\btopcoder\b/i, | ||
| // Generic non-technology categories | ||
| /^security$/i, | ||
| /^testing$/i, | ||
| /^ci\/cd$/i, | ||
| /^documentation$/i, | ||
| ]; |
There was a problem hiding this comment.
The pattern /\\btopcoder\\b/i is very broad and will remove any tech_stack item containing 'Topcoder' (e.g., 'Topcoder API', 'Topcoder Skills API'), which can be a real integration technology required by the submission. Consider narrowing this to explicit platform tooling terms (e.g., 'Topcoder Review Bot', 'Topcoder submission portal') rather than the vendor name itself, to avoid false negatives.
| const raw = readFileSync( | ||
| resolve(__dirname, '../../fixtures', `${name}.json`), | ||
| 'utf-8', | ||
| ); |
There was a problem hiding this comment.
__dirname is not defined in ESM, and Vitest commonly runs tests in an ESM context depending on configuration. This can cause the integration tests to fail to load fixtures in some environments. Use an import.meta.url-based directory resolution (e.g., via fileURLToPath) to make fixture loading reliable across module modes.
| autoIndexPaths: [''], | ||
| skills: ['skills'], |
There was a problem hiding this comment.
Using an empty string as a path is ambiguous and relies on implicit path resolution rules in the Workspace implementation. For clarity and to reduce edge cases across OS/path-join behavior, use an explicit current-directory marker (e.g., '.') and an explicit relative skills path (e.g., './skills') if the API expects relative paths.
| autoIndexPaths: [''], | |
| skills: ['skills'], | |
| autoIndexPaths: ['.'], | |
| skills: ['./skills'], |
| strategy: StructuredOutputStrategy; | ||
| } | ||
|
|
||
| export function toNonNegativeInt(value: unknown): number | null { |
There was a problem hiding this comment.
This file introduces multiple non-trivial behaviors (token parsing/estimation, compatibility-error classification, and a multi-strategy structured-output fallback loop), but no unit tests are included in this PR. Add focused tests for toNonNegativeInt, buildTokenUsageMetrics (native vs mixed vs estimated), isStructuredOutputCompatibilityError, and the strategy ordering/behavior in generateWithStructuredOutputFallback to prevent regressions.
| }; | ||
| } | ||
|
|
||
| export function buildTokenUsageMetrics( |
There was a problem hiding this comment.
This file introduces multiple non-trivial behaviors (token parsing/estimation, compatibility-error classification, and a multi-strategy structured-output fallback loop), but no unit tests are included in this PR. Add focused tests for toNonNegativeInt, buildTokenUsageMetrics (native vs mixed vs estimated), isStructuredOutputCompatibilityError, and the strategy ordering/behavior in generateWithStructuredOutputFallback to prevent regressions.
| return modelId.includes('gemini') || modelId.includes('mojo'); | ||
| } | ||
|
|
||
| export function isStructuredOutputCompatibilityError(error: unknown): boolean { |
There was a problem hiding this comment.
This file introduces multiple non-trivial behaviors (token parsing/estimation, compatibility-error classification, and a multi-strategy structured-output fallback loop), but no unit tests are included in this PR. Add focused tests for toNonNegativeInt, buildTokenUsageMetrics (native vs mixed vs estimated), isStructuredOutputCompatibilityError, and the strategy ordering/behavior in generateWithStructuredOutputFallback to prevent regressions.
| ); | ||
| } | ||
|
|
||
| export async function generateWithStructuredOutputFallback<Schema extends z.ZodTypeAny>({ |
There was a problem hiding this comment.
This file introduces multiple non-trivial behaviors (token parsing/estimation, compatibility-error classification, and a multi-strategy structured-output fallback loop), but no unit tests are included in this PR. Add focused tests for toNonNegativeInt, buildTokenUsageMetrics (native vs mixed vs estimated), isStructuredOutputCompatibilityError, and the strategy ordering/behavior in generateWithStructuredOutputFallback to prevent regressions.
No description provided.