Skip to content

Conversation

@ramnique
Copy link
Contributor

DO NOT MERGE!

This PR is meant for code-review only

@vercel
Copy link

vercel bot commented Sep 15, 2025

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

Project Deployment Review Updated (UTC)
rowboat Ready Ready Preview, Comment Jan 19, 2026 4:57pm

Request Review

@@ -0,0 +1,47 @@
import crypto from 'crypto';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

wouldn't we lose all images on restart? Why didn't we go with local file storage here?

return parsed.data;
}

export async function createSharedWorkflowFromJson(json: string): Promise<{ id: string; ttlSeconds: number; }>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

  1. there is no user + project auth happening here
  2. Ideally this createSharedId should be part of project.actions.ts where project auth check is also done

return { id, ttlSeconds: DEFAULT_TTL_SECONDS };
}

export async function loadSharedWorkflow(idOrUrl: string): Promise<z.infer<typeof Workflow>> {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

  1. no auth checks in place
  2. this function expects an id or url. What is the url for? When is it used?

@@ -0,0 +1,30 @@
import { NextRequest, NextResponse } from 'next/server';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why is like toggling built as an API route? Shouldn't it have been a server-action? The problem here is that:

  • we are not doing any user auth, instead some x-guest-id - which i'm not sure how thats getting populated
  • this makes it a public endpoint which anyone can spam and fill up the likes collection!

@@ -0,0 +1,57 @@
import { NextRequest, NextResponse } from 'next/server';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

all of these should have been server actions

@@ -0,0 +1,16 @@
import { NextRequest, NextResponse } from 'next/server';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

why not use a server action here?

@@ -0,0 +1,130 @@
import { NextRequest, NextResponse } from 'next/server';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

why not use server actions here?

// Try known extensions in order used by generator
const exts = ['.png', '.jpg', '.webp'];
let foundExt: string | null = null;
for (const ext of exts) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

not a blocker for launch, but this is suboptimal and costly. We should either

  1. know what extension we're dealing with beforehand (through a corresponding database entry), or
  2. remain blind and have s3 metadata return the type during the serve

in any case - we should avoid HEADing each possible type here

authorName: "Rowboat",
authorEmail: undefined,
isAnonymous: false,
workflow: tpl as any,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

A bad side-effect of using json files for templates is that we have now lost zod validation altogether. This is bad. instead, we could have used .ts files to keep validation.

in any case, avoid blindly ingesting any random json w/o ensuring that it is conforming to the workflow spec. We should first ensure that the json passes WorkflowSchema.parse() test. Otherwise this can lead to hard-to-debug issues downstream (when people create projects based on these broken templates)

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.

6 participants