Skip to content

[PROD RELEASE] - AI Review/Updates & Fixes#7

Merged
kkartunov merged 12 commits intomasterfrom
develop
Mar 26, 2026
Merged

[PROD RELEASE] - AI Review/Updates & Fixes#7
kkartunov merged 12 commits intomasterfrom
develop

Conversation

@kkartunov
Copy link
Copy Markdown
Contributor

No description provided.

@kkartunov kkartunov requested a review from Copilot March 25, 2026 07:38
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

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.

Comment thread src/mastra/index.ts
} from './scorers/skills-matching-scorers';
instanceAnswerRelevancyScorer,
instancePromptAlignmentScorer,
} from './scorers/instance-scorers';
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

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

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.

Suggested change
} from './scorers/instance-scorers';
} from './scorers/skills-matching-scorers';

Copilot uses AI. Check for mistakes.
// ---------------------------------------------------------------------------

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';
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

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

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.

Suggested change
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';

Copilot uses AI. Check for mistakes.
Comment on lines +1 to +5
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;
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

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

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.

Suggested change
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;

Copilot uses AI. Check for mistakes.
Comment on lines +804 to +820
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,
];
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
Comment on lines +44 to +47
const raw = readFileSync(
resolve(__dirname, '../../fixtures', `${name}.json`),
'utf-8',
);
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

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

__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.

Copilot uses AI. Check for mistakes.
Comment on lines +9 to +10
autoIndexPaths: [''],
skills: ['skills'],
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

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

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.

Suggested change
autoIndexPaths: [''],
skills: ['skills'],
autoIndexPaths: ['.'],
skills: ['./skills'],

Copilot uses AI. Check for mistakes.
strategy: StructuredOutputStrategy;
}

export function toNonNegativeInt(value: unknown): number | null {
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
};
}

export function buildTokenUsageMetrics(
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
return modelId.includes('gemini') || modelId.includes('mojo');
}

export function isStructuredOutputCompatibilityError(error: unknown): boolean {
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
);
}

export async function generateWithStructuredOutputFallback<Schema extends z.ZodTypeAny>({
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
@kkartunov kkartunov merged commit 94236f2 into master Mar 26, 2026
4 checks passed
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