[PR #28] [MERGED] [Issue #26] Search fix. #219

Closed
opened 2026-02-15 17:16:21 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/openclaw/clawhub/pull/28
Author: @aaronn
Created: 1/24/2026
Status: Merged
Merged: 1/24/2026
Merged by: @steipete

Base: mainHead: bugfix/search


📝 Commits (1)

📊 Changes

1 file changed (+1 additions, -1 deletions)

View changed files

📝 convex/search.ts (+1 -1)

📄 Description

I noticed search results weren't returning on web yesterday and Claude Code identified the following problem:

  const skill = await ctx.db.get(embedding.skillId)
  if (skill?.softDeletedAt) return null
  const [version, ownerHandle] = await Promise.all([
    ctx.db.get(embedding.versionId),
    getOwnerHandle(skill.ownerUserId),  // ← Here
  ])

The bug: The code checks if (skill?.softDeletedAt) return null, but this only returns early if the skill exists AND is soft-deleted. If skill is null or undefined (which can happen if the skill was deleted from the database), the check passes through because null?.softDeletedAt evaluates to undefined (falsy).

Then on the next line, it tries to access skill.ownerUserId, which will throw an error if skill is null/undefined.

Future Tests?

While full integration tests require a bit more infrastructure, in the future it might be worth having one endpoint test that returns a known result and doesn't return a soft-deleted result. I have filed this as an issue: https://github.com/clawdbot/clawdhub/issues/29


🔄 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/openclaw/clawhub/pull/28 **Author:** [@aaronn](https://github.com/aaronn) **Created:** 1/24/2026 **Status:** ✅ Merged **Merged:** 1/24/2026 **Merged by:** [@steipete](https://github.com/steipete) **Base:** `main` ← **Head:** `bugfix/search` --- ### 📝 Commits (1) - [`bbd517e`](https://github.com/openclaw/clawhub/commit/bbd517e5b59e3c19e67eb9210191ac4b8928820c) fix search ### 📊 Changes **1 file changed** (+1 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `convex/search.ts` (+1 -1) </details> ### 📄 Description I noticed search results weren't returning on web yesterday and Claude Code identified the following problem: ``` const skill = await ctx.db.get(embedding.skillId) if (skill?.softDeletedAt) return null const [version, ownerHandle] = await Promise.all([ ctx.db.get(embedding.versionId), getOwnerHandle(skill.ownerUserId), // ← Here ]) ``` The bug: The code checks if (skill?.softDeletedAt) return null, but this only returns early if the skill exists AND is soft-deleted. If skill is null or undefined (which can happen if the skill was deleted from the database), the check passes through because null?.softDeletedAt evaluates to undefined (falsy). Then on the next line, it tries to access skill.ownerUserId, which will throw an error if skill is null/undefined. ## Future Tests? While full integration tests require a bit more infrastructure, in the future it might be worth having one endpoint test that returns a known result and doesn't return a soft-deleted result. I have filed this as an issue: https://github.com/clawdbot/clawdhub/issues/29 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-15 17:16:21 -05:00
yindo closed this issue 2026-02-15 17:16:21 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: openclaw/clawhub#219