Skip to content

Support v.function() validators - #182

Merged
reeceyang merged 1 commit into
mainfrom
ry/function-validator
Nov 21, 2026
Merged

reeceyang merged 1 commit into
mainfrom
ry/function-validator

Conversation

@reeceyang

Copy link
Copy Markdown
Contributor

Support v.function().

🤖 Generated with Claude Code

@pkg-pr-new

pkg-pr-new Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/convex-test@182

commit: 8447259

@reeceyang
reeceyang marked this pull request as ready for review November 20, 2026 23:50
@reeceyang
reeceyang force-pushed the ry/function-validator branch from 5ceae06 to a814254 Compare November 20, 2026 23:50
@reeceyang
reeceyang force-pushed the ry/function-validator branch from a814254 to 8447259 Compare November 20, 2026 23:52

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

1 issue found and verified against the latest diff

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="index.ts">

<violation number="1" location="index.ts:1431">
P2: This accepts malformed function handles such as `function://bad`, which later cannot be parsed by `parseFunctionHandle`; validate the complete `function://<component>;<udf>` shape rather than only checking the prefix.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread index.ts
return;
}
case "function": {
if (typeof value !== "string" || !value.startsWith("function://")) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2: This accepts malformed function handles such as function://bad, which later cannot be parsed by parseFunctionHandle; validate the complete function://<component>;<udf> shape rather than only checking the prefix.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At index.ts, line 1431:

<comment>This accepts malformed function handles such as `function://bad`, which later cannot be parsed by `parseFunctionHandle`; validate the complete `function://<component>;<udf>` shape rather than only checking the prefix.</comment>

<file context>
@@ -1426,6 +1427,14 @@ function validateValidator(validator: ValidatorJSON, value: any) {
       return;
     }
+    case "function": {
+      if (typeof value !== "string" || !value.startsWith("function://")) {
+        throw new Error(
+          `Validator error: Expected \`v.function()\`, got \`${value}\``,
</file context>
Suggested change
if (typeof value !== "string" || !value.startsWith("function://")) {
if (
typeof value !== "string" ||
!/^function:\/\/[^;]*;[^;]+$/.test(value)
) {

@reeceyang
reeceyang merged commit 422499c into main Nov 21, 2026
3 checks passed
@github-actions github-actions Bot mentioned this pull request Nov 21, 2026
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.

2 participants