Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/contributor_actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- description: 'Combined store Tests (vector+storage)'
- description: 'Memory Tests'
- description: 'RAG Tests'
- description: 'Tool Builder Tests'

steps:
- name: Checkout repo
uses: actions/checkout@v5
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { openai } from '@ai-sdk/openai';
import { createTool } from '@mastra/core';
import { Agent } from '@mastra/core/agent';
import { createTool } from '@mastra/core/tools';
import { MCPClient } from '@mastra/mcp';
import { z } from 'zod';
import { weatherTool } from '../tools/weather';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,32 @@ describe('Template Workflow Integration Tests', () => {
// Note: AI discovery is non-deterministic and may return either export names (e.g., csvToQuestionsWorkflow)
// or filename-based IDs (e.g., csv-to-questions-workflow), so we check for either naming convention
const expectedPatterns = [
{ dir: 'src/mastra/agents', patterns: ['csvQuestionAgent.ts', 'csv-question-agent.ts'] },
{
dir: 'src/mastra/agents',
// Template has csv-summarization-agent.ts and text-question-agent.ts;
// AI discovery may return export names or filename-based IDs,
// and convertNaming adapts to the target project's convention
patterns: [
'csvSummarizationAgent.ts',
'csv-summarization-agent.ts',
'textQuestionAgent.ts',
'text-question-agent.ts',
'csvQuestionAgent.ts',
'csv-question-agent.ts',
],
},
{
dir: 'src/mastra/tools',
// AI discovery may return export name (csvFetcherTool) or filename-based ID (download-csv-tool),
// and convertNaming then adapts to the target project's convention
patterns: ['csvFetcherTool.ts', 'csv-fetcher-tool.ts', 'download-csv-tool.ts', 'downloadCsvTool.ts'],
patterns: [
'csvFetcherTool.ts',
'csv-fetcher-tool.ts',
'download-csv-tool.ts',
'downloadCsvTool.ts',
'generateQuestionsFromTextTool.ts',
'generate-questions-from-text-tool.ts',
],
},
{
dir: 'src/mastra/workflows',
Expand Down Expand Up @@ -287,8 +307,8 @@ describe('Template Workflow Integration Tests', () => {
it('should validate git history shows proper template integration', async () => {
// Check git log for template commits
const gitLog = exec('git log --oneline', targetRepo);
// The copy step always creates this commit
expect(gitLog).toContain('feat(template): copy 7 files from csv-to-questions@');
// The copy step always creates this commit (file count varies based on conflicts)
expect(gitLog).toMatch(/feat\(template\): copy \d+ files from csv-to-questions@/);
// These commits are created by AI agents and may not always appear (non-deterministic)
// - feat(template): resolve conflicts for csv-to-questions@
// - fix(template): resolve validation errors for csv-to-questions@
Expand Down
14 changes: 8 additions & 6 deletions packages/core/src/agent/message-list/tests/message-list.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1136,16 +1136,17 @@ describe('MessageList', () => {
format: 2,
parts: [
{ type: 'text', text: 'Here is an image URL:' },
{
expect.objectContaining({
data: 'https://example.com/image.jpg',
filename: 'image.jpg',
mimeType: 'image/jpeg',
type: 'file',
},
}),
],
},
threadId,
resourceId,
} satisfies MastraDBMessage,
},
]);
});

Expand Down Expand Up @@ -1174,16 +1175,17 @@ describe('MessageList', () => {
format: 2,
parts: [
{ type: 'text', text: 'Here is another image URL:' },
{
expect.objectContaining({
type: 'file',
data: 'https://example.com/another-image.png',
filename: 'another-image.png',
mimeType: 'image/png',
},
}),
],
},
threadId,
resourceId,
} satisfies MastraDBMessage,
},
]);
});

Expand Down
2 changes: 0 additions & 2 deletions packages/core/src/evals/run/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -474,8 +474,6 @@ describe('runEvals', () => {
target: workflow,
});

console.log(`result`, JSON.stringify(result, null, 2));

// Verify the experiment result includes step scorer results
expect(result.scores.steps?.[`test-step`]?.[`step-scorer`]).toBe(0.8);
expect(result.scores.workflow?.toxicity).toBe(0.9);
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/evals/run/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -350,12 +350,12 @@ async function runScorers(
const stepScorerResults: Record<string, any> = {};
for (const [stepId, stepScorers] of Object.entries(scorers.steps)) {
const stepResult = targetResult.scoringData.stepResults?.[stepId];
if (stepResult?.status === 'success' && stepResult.payload && stepResult.output) {
if (stepResult?.status === 'success' && stepResult.output !== undefined) {
const stepResults: Record<string, any> = {};
for (const scorer of stepScorers) {
try {
const score = await scorer.run({
input: stepResult.payload,
input: stepResult.payload !== undefined ? stepResult.payload : targetResult.scoringData.input,
Comment on lines 357 to +358
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

are we sure this is correct?

output: stepResult.output,
groundTruth: item.groundTruth,
requestContext: item.requestContext,
Expand Down