[PR #87] [MERGED] fix: filter out invalid repository fields before $merge operations #87

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/87
Author: @snomiao
Created: 10/20/2025
Status: ✅ Merged
Merged: 10/20/2025
Merged by: @snomiao

Base: main ← Head: sno-fix-cicd-2025-10-21


📝 Commits (1)

  • 62ae92f fix: filter out invalid repository fields before $merge operations

📊 Changes

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

View changed files

📝 src/makeUpdateTomlLicenseBranch.ts (+3 -0)
📝 src/updateCRNodes.ts (+3 -0)

📄 Description

Summary

Fixes a MongoDB aggregation error that was causing the CI/CD pipeline to fail:

$merge write error: 'on' field 'repository' cannot be missing, null, undefined or an array

Changes

Added validation to filter out documents with invalid repository fields before executing $merge operations in:

  • src/updateCRNodes.ts - when updating registry status flags
  • src/makeUpdateTomlLicenseBranch.ts - when collecting license tasks

The fix adds a .match() stage to ensure the repository field:

  • Exists
  • Is not null
  • Is a string type (not an array)

Root Cause

Some documents in the CNRepos collection have missing, null, or invalid repository field values. When the aggregation pipeline tried to use these as the on field in a $merge operation, MongoDB rejected them causing the pipeline to fail.

Testing

  • Local syntax validation (ESLint/Prettier passed)
  • Code review of similar patterns in the codebase

Fixes: https://github.com/Comfy-Org/Comfy-PR/actions/runs/18632064748/job/53118162200

🤖 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/87 **Author:** [@snomiao](https://github.com/snomiao) **Created:** 10/20/2025 **Status:** ✅ Merged **Merged:** 10/20/2025 **Merged by:** [@snomiao](https://github.com/snomiao) **Base:** `main` ← **Head:** `sno-fix-cicd-2025-10-21` --- ### 📝 Commits (1) - [`62ae92f`](https://github.com/Comfy-Org/Comfy-PR/commit/62ae92f8c39e33e8b2f1c8090f985bd63c39722c) fix: filter out invalid repository fields before $merge operations ### 📊 Changes **2 files changed** (+6 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `src/makeUpdateTomlLicenseBranch.ts` (+3 -0) 📝 `src/updateCRNodes.ts` (+3 -0) </details> ### 📄 Description ## Summary Fixes a MongoDB aggregation error that was causing the CI/CD pipeline to fail: ``` $merge write error: 'on' field 'repository' cannot be missing, null, undefined or an array ``` ## Changes Added validation to filter out documents with invalid `repository` fields before executing `$merge` operations in: - `src/updateCRNodes.ts` - when updating registry status flags - `src/makeUpdateTomlLicenseBranch.ts` - when collecting license tasks The fix adds a `.match()` stage to ensure the `repository` field: - Exists - Is not null - Is a string type (not an array) ## Root Cause Some documents in the `CNRepos` collection have missing, null, or invalid `repository` field values. When the aggregation pipeline tried to use these as the `on` field in a `$merge` operation, MongoDB rejected them causing the pipeline to fail. ## Testing - [x] Local syntax validation (ESLint/Prettier passed) - [x] Code review of similar patterns in the codebase ## Related Issue Fixes: https://github.com/Comfy-Org/Comfy-PR/actions/runs/18632064748/job/53118162200 🤖 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#87
No description provided.