Skip to content

Resolve benchmark workflows for seed#2006

Merged
ravikiranvm merged 3 commits intomainfrom
ops-3751
Feb 25, 2026
Merged

Resolve benchmark workflows for seed#2006
ravikiranvm merged 3 commits intomainfrom
ops-3751

Conversation

@ravikiranvm
Copy link
Copy Markdown
Contributor

@ravikiranvm ravikiranvm commented Feb 25, 2026

Fixes OPS-3751.

Additional Notes

This PR adds a helper method to return paths for benchmark workflows from the catalog for a given provider and user chosen workflow ids.

The next step would be to import the flows using these paths.

@linear
Copy link
Copy Markdown

linear Bot commented Feb 25, 2026

@ravikiranvm ravikiranvm marked this pull request as ready for review February 25, 2026 06:27
Copilot AI review requested due to automatic review settings February 25, 2026 06:27
Copy link
Copy Markdown
Contributor

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

Adds a benchmark workflow “catalog resolver” to map provider/workflow IDs to on-disk JSON workflow definitions, primarily to support benchmark seeding.

Changes:

  • Introduces catalog-resolver helpers to resolve workflow JSON file paths (including seed-specific orchestration ordering).
  • Adds provider manifest mapping orchestrator/cleanup workflow IDs.
  • Copies workflows-catalog/**/* into the server-api build output and adds unit tests for the resolver.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
packages/server/api/src/app/benchmark/catalog-resolver.ts New resolver that builds file paths for workflow catalog JSON files.
packages/server/api/src/app/benchmark/catalog-manifests.ts Adds provider→manifest mapping for orchestrator/cleanup workflow IDs.
packages/server/api/test/unit/benchmark/catalog-resolver.test.ts Unit tests covering unsupported provider, missing files, empty inputs, and seed ordering.
packages/server/api/project.json Ensures workflow catalog JSON assets are included in build output.

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

Comment on lines +40 to +43
): ResolvedWorkflowPath[] {
const catalogDir = getCatalogDir(provider);
const result: ResolvedWorkflowPath[] = [];
for (const id of workflowIds) {
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

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

resolveWorkflowPaths builds paths from untrusted provider/id values using path.join(catalogDir, ${id}.json). If either contains path separators or .., this can resolve outside the workflows catalog directory (path traversal) and allow probing/reading arbitrary files when the returned filePath is later used. Validate provider via getCatalogManifest() inside resolveWorkflowPaths, and reject/normalize id values (e.g., forbid //\\ and .., or path.resolve + ensure the resolved path stays under catalogDir).

Suggested change
): ResolvedWorkflowPath[] {
const catalogDir = getCatalogDir(provider);
const result: ResolvedWorkflowPath[] = [];
for (const id of workflowIds) {
): ResolvedWorkflowPath[] {
// Validate provider against the known catalog manifests.
getCatalogManifest(provider);
const catalogDir = getCatalogDir(provider);
const result: ResolvedWorkflowPath[] = [];
for (const id of workflowIds) {
// Reject workflow IDs that could lead to path traversal or invalid filenames.
if (id.includes('/') || id.includes('\\') || id.includes('..')) {
throwValidationError(`Invalid workflow id: ${id}`);
}

Copilot uses AI. Check for mistakes.
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.

Valid finding: the traversal concern is legit, the provider concern is less so, but still doesn't hurt to act on it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Okay

Comment thread packages/server/api/src/app/benchmark/catalog-resolver.ts
Comment thread packages/server/api/src/app/benchmark/catalog-manifests.ts
Comment thread packages/server/api/test/unit/benchmark/catalog-resolver.test.ts
Comment thread packages/server/api/src/app/benchmark/catalog-manifests.ts Outdated
Comment thread packages/server/api/src/app/benchmark/catalog-manifests.ts Outdated
Comment thread packages/server/api/src/app/benchmark/catalog-resolver.ts
@sonarqubecloud
Copy link
Copy Markdown

provider: string,
subWorkflowIds: string[],
): ResolvedWorkflowPath[] {
if (subWorkflowIds.length === 0) {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I might move this validation later to another function when we have a proper service file for this endpoint. Keeping it here for now

@ravikiranvm ravikiranvm merged commit 35f728e into main Feb 25, 2026
21 checks passed
@ravikiranvm ravikiranvm deleted the ops-3751 branch February 25, 2026 15:09
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.

4 participants