Skip to content

fix(codegen): make procedure names merge-local - #471

Merged
zbeyens merged 2 commits into
mainfrom
codex/466-procedure-name-codegen
Sep 15, 2026
Merged

zbeyens merged 2 commits into
mainfrom
codex/466-procedure-name-codegen

Conversation

@zbeyens

@zbeyens zbeyens commented Sep 15, 2026 •

Copy link
Copy Markdown
Member
  • Auto release

🐛 Fixes #466

🧭 Task plan: docs/plans/466-fix-procedure-name-codegen-merge-conflicts.md

🟢 95-100% confidence

✅ Outcome

Generated procedure-name lookup entries occupy independent physical lines, so unrelated same-module additions no longer rewrite the whole module entry. A stale lookup for a known module emits one actionable warning instead of silently losing procedure identity.

⚠️ Caveat

Convex function bundles hard-code process.env.NODE_ENV to production, including local development. The stale-map warning is therefore always-on for this impossible state and deduplicated once per module; modules absent from the generated lookup remain silent.

🏗️ Design

The CLI serializer owns diff locality, while the server lookup boundary owns stale-state diagnosis. Exact generated positions remain the identity mechanism because a procedure builder does not know its eventual export binding and Convex registration does not expose a function-name symbol at construction time.

No public API, type signature, export, dependency, or Convex entry import graph changes. Includes regenerated fixtures and a kitcn patch changeset.

🧪 Verified

Phase 🧪 Tests 🌐 Browser
Reproduced 🔴 Two procedures emitted on one physical line; stale same-module miss warned 0 times ➖ N/A
Verified 🟢 Focused cases pass; 132 owning tests and full bun check pass ➖ N/A

bun --cwd packages/kitcn build, bun typecheck, bun lint:fix, fixture sync/check, zero slop delta, changeset status, and dirty-local autoreview all pass. Autoreview reported no accepted/actionable findings.

@changeset-bot

changeset-bot Bot commented Sep 15, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 3140474

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

@vercel

vercel Bot commented Sep 15, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
better-convex Ready Ready Preview Sep 15, 2026 3:16pm UTC

Request Review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bc59c3cd3c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

.join('\n');

return ` ${JSON.stringify(file)}: [${items}],`;
return ` ${JSON.stringify(file)}: [\n${items}\n ],`;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Make concurrent same-gap additions independently mergeable

When two branches each add a procedure at the same insertion point in this array—commonly when both append after the existing last export—their generated lines are both inserted immediately before the same ], anchor, so a three-way Git merge still conflicts. Emitting one entry per line only localizes that conflict and does not satisfy the independently mergeable outcome; the added test checks physical line count but never exercises a merge. Add a three-way merge regression and use a representation or generation strategy that gives concurrent additions independent anchors.

AGENTS.md reference: AGENTS.md:L10-L10

Useful? React with 👍 / 👎.

Comment on lines +230 to +232
const entry = findBestEntry(entries, location);
if (!entry) {
warnAboutStaleLookup(relativeFilePath, location);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid warning for intentionally omitted procedures

When a module contains at least one generated procedure plus a procedure export prefixed with _, constructing the private procedure reaches this branch and emits the always-on stale-state warning even after a successful codegen run. parseModuleRuntime intentionally skips every underscore-prefixed export (codegen.ts:2137-2138), so no matching lookup entry can ever be generated and the suggested remediation cannot resolve the warning. Distinguish intentionally unregistered procedures from genuinely stale lookup misses before warning.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-15T15:19:33.153937Z bc59c3c PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@zbeyens
zbeyens merged commit 04346ae into main Sep 15, 2026
6 checks passed
@zbeyens
zbeyens deleted the codex/466-procedure-name-codegen branch September 15, 2026 15:56

This branch was successfully deployed

1 active deployment
Preview — 31404745 Deployed Sep 15, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant