[PR #188] [MERGED] fix: resolve MetaCollection initialization error and add CI typecheck #187

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

📋 Pull Request Information

Original PR: https://github.com/Comfy-Org/Comfy-PR/pull/188
Author: @snomiao
Created: 4/3/2026
Status: ✅ Merged
Merged: 4/3/2026
Merged by: @snomiao

Base: main ← Head: sno-fix-gh-tasks


📝 Commits (4)

  • 1bfd6c9 fix: resolve MetaCollection initialization error and add CI lint/typecheck
  • 60bd101 Update .husky/pre-commit
  • d8210b0 Update src/db/TaskMeta.ts
  • 36c5cf4 fix: resolve pre-existing oxlint no-explicit-any errors

📊 Changes

6 files changed (+41 additions, -22 deletions)

View changed files

📝 .github/workflows/test.yaml (+2 -0)
📝 .husky/pre-commit (+3 -3)
📝 app/tasks/gh-design/gh-design.ts (+13 -11)
📝 app/tasks/gh-design/slackPendingLock.spec.ts (+3 -2)
📝 scripts/cleanup-slack-dupes.ts (+5 -5)
📝 src/db/TaskMeta.ts (+15 -1)

📄 Description

Problem

bun app/tasks/run-gh-tasks.ts crashes with:

ReferenceError: Cannot access 'MetaCollection' before initialization.
  at /run/gh-bugcop/gh-bugcop.tsx:107:37

Root Cause

src/db/TaskMeta.ts had a top-level await _TaskMeta.createIndex(...) that blocked module initialization. When gh-bugcop.tsx imports MetaCollection, the export is still in the temporal dead zone because the top-level await hasn't resolved yet.

Fix

  1. src/db/TaskMeta.ts: Replace top-level await createIndex() with lazy initialization — the index is created on first $upsert/save call instead of at import time.
  2. app/tasks/gh-design/gh-design.ts: Fix pre-existing type error (task._id on union type).

Prevention

  1. .husky/pre-commit: Fix shebang (sh instead of bun) and run bun run typecheck (tsgo) before every commit.
  2. .github/workflows/test.yaml: Add bun run check (tsgo + oxlint + oxfmt) step to CI so PRs are checked.

🔄 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/188 **Author:** [@snomiao](https://github.com/snomiao) **Created:** 4/3/2026 **Status:** ✅ Merged **Merged:** 4/3/2026 **Merged by:** [@snomiao](https://github.com/snomiao) **Base:** `main` ← **Head:** `sno-fix-gh-tasks` --- ### 📝 Commits (4) - [`1bfd6c9`](https://github.com/Comfy-Org/Comfy-PR/commit/1bfd6c9245b9a36ebed1fd3fee51f24ec129cbb5) fix: resolve MetaCollection initialization error and add CI lint/typecheck - [`60bd101`](https://github.com/Comfy-Org/Comfy-PR/commit/60bd1018ba11d60165c52689826e91c51953bed5) Update .husky/pre-commit - [`d8210b0`](https://github.com/Comfy-Org/Comfy-PR/commit/d8210b05bdc1a173ec9ffcf88973749612f3c60b) Update src/db/TaskMeta.ts - [`36c5cf4`](https://github.com/Comfy-Org/Comfy-PR/commit/36c5cf4441c7596bc48001821b8e0b16f3ef48e6) fix: resolve pre-existing oxlint no-explicit-any errors ### 📊 Changes **6 files changed** (+41 additions, -22 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/test.yaml` (+2 -0) 📝 `.husky/pre-commit` (+3 -3) 📝 `app/tasks/gh-design/gh-design.ts` (+13 -11) 📝 `app/tasks/gh-design/slackPendingLock.spec.ts` (+3 -2) 📝 `scripts/cleanup-slack-dupes.ts` (+5 -5) 📝 `src/db/TaskMeta.ts` (+15 -1) </details> ### 📄 Description ## Problem `bun app/tasks/run-gh-tasks.ts` crashes with: ``` ReferenceError: Cannot access 'MetaCollection' before initialization. at /run/gh-bugcop/gh-bugcop.tsx:107:37 ``` ## Root Cause `src/db/TaskMeta.ts` had a top-level `await _TaskMeta.createIndex(...)` that blocked module initialization. When `gh-bugcop.tsx` imports `MetaCollection`, the export is still in the temporal dead zone because the top-level await hasn't resolved yet. ## Fix 1. **`src/db/TaskMeta.ts`**: Replace top-level `await createIndex()` with lazy initialization — the index is created on first \$upsert/save call instead of at import time. 2. **`app/tasks/gh-design/gh-design.ts`**: Fix pre-existing type error (`task._id` on union type). ## Prevention 3. **`.husky/pre-commit`**: Fix shebang (`sh` instead of `bun`) and run `bun run typecheck` (tsgo) before every commit. 4. **`.github/workflows/test.yaml`**: Add `bun run check` (tsgo + oxlint + oxfmt) step to CI so PRs are checked. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-27 21:10:24 +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#187
No description provided.