Skip to content

Fix ORM invalid ID lookups - #308

Merged
zbeyens merged 2 commits into
mainfrom
codex/fix-invalid-orm-id-lookups
Jul 29, 2026
Merged

Fix ORM invalid ID lookups#308
zbeyens merged 2 commits into
mainfrom
codex/fix-invalid-orm-id-lookups

Conversation

@zbeyens

@zbeyens zbeyens commented Jul 29, 2026

Copy link
Copy Markdown
Member
  • Auto release

🐛 Fixes ➖ N/A
🟢 95-100% confidence

Phase 🧪 Tests 🌐 Browser
Reproduced 🔴 invalid primary and relation IDs reject with the production db.get decode error ➖ N/A
Verified 🟢 15 focused tests + bun check ➖ N/A

✅ Outcome

  • Malformed or wrong-table primary IDs behave as missing records.
  • One relations resolve to null; many-through relations omit invalid targets; filtered through counts ignore them.
  • A patch changeset ships the corrected kitcn/orm behavior.

⚠️ Caveat

  • convex-test masks the production raw-ID rejection, so the regression boundary explicitly models production while existing real-Convex valid-ID tests remain in the focused run.
  • The full gate exposed upstream shadcn lucide-react fixture drift; generated snapshots were refreshed through fixtures:sync.

🏗️ Design

  • Chosen layer: one table-aware ORM _getById owner used by all four affected direct reads.
  • Why not caller validation: middleware and handlers should not duplicate Convex table-ID rules.
  • Why not broader changes: raw Convex db.get, vector-provider hits, and the public API contract are outside this bug.

🧪 Verified

  • bun vitest packages/kitcn/src/orm/query-invalid-id.vitest.ts packages/kitcn/src/orm/mutation-id-fast-path.vitest.ts --run
  • bun --cwd packages/kitcn typecheck
  • bun --cwd packages/kitcn build
  • bun lint:fix
  • bun check
  • Autoreview: clean, 0 findings

@vercel

vercel Bot commented Jul 29, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
better-convex Ready Ready Preview Jul 29, 2026 9:18pm

Request Review

@changeset-bot

changeset-bot Bot commented Jul 29, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 67cf078

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
kitcn Patch
@kitcn/resend Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@zbeyens
zbeyens merged commit 65a331b into main Jul 29, 2026
5 checks passed
@zbeyens
zbeyens deleted the codex/fix-invalid-orm-id-lookups branch July 29, 2026 22:48
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.

1 participant