[PR #85] [MERGED] fix: filter out invalid repository values in /api/repo-urls endpoint #84

Closed
opened 2026-10-27 21:09:26 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Comfy-Org/Comfy-PR/pull/85
Author: @snomiao
Created: 10/9/2025
Status: ✅ Merged
Merged: 10/9/2025
Merged by: @snomiao

Base: main ← Head: sno-debug-repo-urls-endpoint


📝 Commits (2)

  • ad641a0 fix: filter out invalid repository values in /api/repo-urls endpoint
  • 83031dc Merge branch 'main' into sno-debug-repo-urls-endpoint

📊 Changes

2 files changed (+62 additions, -0 deletions)

View changed files

➕ app/api/router.test.ts (+61 -0)
📝 app/api/router.ts (+1 -0)

📄 Description

Summary

  • Fixed the /api/repo-urls endpoint which was failing with "Output validation failed" error
  • Added a filter to ensure only valid string repository URLs are returned (filtering out undefined, null, and empty strings)
  • Added comprehensive test coverage for the filtering logic

Test plan

  • Added unit tests in app/api/router.test.ts with 3 test cases
  • All tests pass locally
  • Verify endpoint works on production after deployment

Root Cause

The endpoint was returning data from MongoDB that included documents with invalid repository values (undefined, null, or empty strings), which failed the Zod output validation z.array(z.string()).

Solution

Added a filter step to the sflow pipeline: .filter((repo) => typeof repo === "string" && repo.length > 0)

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Comfy-Org/Comfy-PR/pull/85 **Author:** [@snomiao](https://github.com/snomiao) **Created:** 10/9/2025 **Status:** ✅ Merged **Merged:** 10/9/2025 **Merged by:** [@snomiao](https://github.com/snomiao) **Base:** `main` ← **Head:** `sno-debug-repo-urls-endpoint` --- ### 📝 Commits (2) - [`ad641a0`](https://github.com/Comfy-Org/Comfy-PR/commit/ad641a0673687f7918ba29a099826d606f7c082c) fix: filter out invalid repository values in /api/repo-urls endpoint - [`83031dc`](https://github.com/Comfy-Org/Comfy-PR/commit/83031dcdb00616f3af8ebe5594760deda3d8c0b8) Merge branch 'main' into sno-debug-repo-urls-endpoint ### 📊 Changes **2 files changed** (+62 additions, -0 deletions) <details> <summary>View changed files</summary> ➕ `app/api/router.test.ts` (+61 -0) 📝 `app/api/router.ts` (+1 -0) </details> ### 📄 Description ## Summary - Fixed the `/api/repo-urls` endpoint which was failing with "Output validation failed" error - Added a filter to ensure only valid string repository URLs are returned (filtering out `undefined`, `null`, and empty strings) - Added comprehensive test coverage for the filtering logic ## Test plan - [x] Added unit tests in `app/api/router.test.ts` with 3 test cases - [x] All tests pass locally - [ ] Verify endpoint works on production after deployment ## Root Cause The endpoint was returning data from MongoDB that included documents with invalid `repository` values (undefined, null, or empty strings), which failed the Zod output validation `z.array(z.string())`. ## Solution Added a filter step to the sflow pipeline: `.filter((repo) => typeof repo === "string" && repo.length > 0)` 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-27 21:09:26 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Comfy-Org/Comfy-PR#84
No description provided.