Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/bubble-core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bubblelab/bubble-core",
"version": "0.1.302",
"version": "0.1.303",
"type": "module",
"license": "Apache-2.0",
"main": "./dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/bubble-runtime/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bubblelab/bubble-runtime",
"version": "0.1.302",
"version": "0.1.303",
"type": "module",
"license": "Apache-2.0",
"main": "./dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/bubble-scope-manager/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bubblelab/ts-scope-manager",
"version": "0.1.302",
"version": "0.1.303",
"private": false,
"license": "MIT",
"type": "commonjs",
Expand Down
2 changes: 1 addition & 1 deletion packages/bubble-shared-schemas/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bubblelab/shared-schemas",
"version": "0.1.302",
"version": "0.1.303",
"type": "module",
"license": "Apache-2.0",
"main": "./dist/index.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,17 @@ export const ExecutionSummarySchema = z

export type ExecutionSummary = z.infer<typeof ExecutionSummarySchema>;

// Max length for user-assigned execution labels. Shared between the PATCH
// request schema, the DB-agnostic response schema, and the frontend input
// maxLength attribute so the three sides can't drift apart.
export const MAX_EXECUTION_NAME_LENGTH = 120;

// BubbleFlow execution history item schema
export const bubbleFlowExecutionSchema = z.object({
id: z.number().openapi({ description: 'Execution ID' }),
name: z.string().nullable().optional().openapi({
description: 'User-assigned label for this execution (checkpoint name)',
}),
Comment on lines +183 to +193
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Read-only checks for execution-name persistence and generated/shared-schema updates.

set -euo pipefail

echo "DB schemas / migrations mentioning bubble_flow_executions or execution name:"
rg -n -C3 \
  'bubble_flow_executions|bubbleFlowExecutions|\bname\b' \
  --glob '!node_modules/**' \
  --glob '!dist/**' \
  --glob '!build/**'

echo
echo "API handlers or schemas using MAX_EXECUTION_NAME_LENGTH / execution name:"
rg -n -C3 \
  'MAX_EXECUTION_NAME_LENGTH|execution.*name|name.*execution' \
  --glob '!node_modules/**' \
  --glob '!dist/**' \
  --glob '!build/**'

Repository: bubblelabai/BubbleLab

Length of output: 50379


🏁 Script executed:

# Check the actual schema definition for bubble_flow_executions
cat -n apps/bubblelab-api/src/db/schema-postgres.ts | head -120

Repository: bubblelabai/BubbleLab

Length of output: 5823


🏁 Script executed:

# Search for PATCH schema and MAX_EXECUTION_NAME_LENGTH usage
rg -n "MAX_EXECUTION_NAME_LENGTH" --type ts --type tsx -A 3 -B 1

Repository: bubblelabai/BubbleLab

Length of output: 92


🏁 Script executed:

# Check for PATCH endpoint schema
rg -n "PATCH|patch" apps/bubblelab-api/src --type ts --type tsx -A 5 -B 1 | head -100

Repository: bubblelabai/BubbleLab

Length of output: 92


🏁 Script executed:

# Check for any drizzle migrations that might add the name column
fd -e sql -e ts . apps/bubblelab-api/drizzle-postgres | head -20

Repository: bubblelabai/BubbleLab

Length of output: 1175


🏁 Script executed:

# Check if pnpm build:core was part of the PR or recently run
git log --oneline --all -20 2>/dev/null | grep -i "build:core\|shared.*schema" || echo "Git history not available"

Repository: bubblelabai/BubbleLab

Length of output: 90


🏁 Script executed:

# Check latest migrations for name column addition
cat apps/bubblelab-api/drizzle-postgres/0017_cuddly_kang.sql

Repository: bubblelabai/BubbleLab

Length of output: 441


🏁 Script executed:

# Also check 0016
cat apps/bubblelab-api/drizzle-postgres/0016_add-evaluations-and-execution-logs.sql

Repository: bubblelabai/BubbleLab

Length of output: 989


🏁 Script executed:

# Search for MAX_EXECUTION_NAME_LENGTH more carefully
rg "MAX_EXECUTION_NAME_LENGTH" -n -A 3 -B 1

Repository: bubblelabai/BubbleLab

Length of output: 618


🏁 Script executed:

# Search for PATCH endpoints in API
rg "PATCH|patch.*execut" -n -A 5 -B 2 --glob="apps/bubblelab-api/src/**"

Repository: bubblelabai/BubbleLab

Length of output: 5361


🏁 Script executed:

# Check if build:core is in package.json scripts
cat package.json | grep -A 20 '"scripts"'

Repository: bubblelabai/BubbleLab

Length of output: 2295


🏁 Script executed:

# Read the complete bubbleflow-execution-schema.ts to see the full name field definition
cat packages/bubble-shared-schemas/src/bubbleflow-execution-schema.ts | head -220

Repository: bubblelabai/BubbleLab

Length of output: 7551


🏁 Script executed:

# Also check if there are any execution name PATCH handlers elsewhere
rg -n "execution.*name\|patch.*execution" apps/bubblelab-api/src --glob="**/*.ts" -B 2 -A 5

Repository: bubblelabai/BubbleLab

Length of output: 47


🏁 Script executed:

# Check the dist output of shared-schemas to see if build:core was run
ls -la packages/bubble-shared-schemas/dist/ 2>/dev/null | head -20

Repository: bubblelabai/BubbleLab

Length of output: 47


Wire MAX_EXECUTION_NAME_LENGTH into the schema and back the execution name with persistence, API handler, and migration.

The shared response schema adds a name field for execution labels, but three critical pieces are missing:

  1. Unenforced max length: MAX_EXECUTION_NAME_LENGTH is exported (line 186) but not applied to the name field. The schema should enforce .max(MAX_EXECUTION_NAME_LENGTH) and include maxLength in OpenAPI metadata.

  2. Missing DB column and migration: The bubbleFlowExecutions table has no name column, and no migration adds it. Execution labels cannot persist without backing storage.

  3. No PATCH endpoint: No API handler exists to update execution names. A PATCH endpoint must accept and validate the execution name against MAX_EXECUTION_NAME_LENGTH.

Also, per coding guidelines, run pnpm build:core after modifying shared schemas to regenerate types.

Schema fix: apply max length constraint
-  name: z.string().nullable().optional().openapi({
-    description: 'User-assigned label for this execution (checkpoint name)',
-  }),
+  name: z
+    .string()
+    .max(MAX_EXECUTION_NAME_LENGTH)
+    .nullable()
+    .optional()
+    .openapi({
+      description: 'User-assigned label for this execution (checkpoint name)',
+      maxLength: MAX_EXECUTION_NAME_LENGTH,
+    }),
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// Max length for user-assigned execution labels. Shared between the PATCH
// request schema, the DB-agnostic response schema, and the frontend input
// maxLength attribute so the three sides can't drift apart.
export const MAX_EXECUTION_NAME_LENGTH = 120;
// BubbleFlow execution history item schema
export const bubbleFlowExecutionSchema = z.object({
id: z.number().openapi({ description: 'Execution ID' }),
name: z.string().nullable().optional().openapi({
description: 'User-assigned label for this execution (checkpoint name)',
}),
// Max length for user-assigned execution labels. Shared between the PATCH
// request schema, the DB-agnostic response schema, and the frontend input
// maxLength attribute so the three sides can't drift apart.
export const MAX_EXECUTION_NAME_LENGTH = 120;
// BubbleFlow execution history item schema
export const bubbleFlowExecutionSchema = z.object({
id: z.number().openapi({ description: 'Execution ID' }),
name: z
.string()
.max(MAX_EXECUTION_NAME_LENGTH)
.nullable()
.optional()
.openapi({
description: 'User-assigned label for this execution (checkpoint name)',
maxLength: MAX_EXECUTION_NAME_LENGTH,
}),
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/bubble-shared-schemas/src/bubbleflow-execution-schema.ts` around
lines 183 - 193, The exported MAX_EXECUTION_NAME_LENGTH is defined but not
enforced: update bubbleFlowExecutionSchema to apply
.max(MAX_EXECUTION_NAME_LENGTH) on the name field and add openapi metadata
maxLength: MAX_EXECUTION_NAME_LENGTH; next add a nullable VARCHAR/TEXT `name`
column to the bubbleFlowExecutions table via a new migration that preserves
existing rows and indexes; implement a PATCH handler (e.g., route that updates
execution name by id) that validates input against the same
MAX_EXECUTION_NAME_LENGTH (use the shared schema) and persists to the new
column, and add unit/integration tests for the migration, schema validation, and
PATCH behavior; finally run pnpm build:core to regenerate types after changing
the shared schema.

status: z
.enum(['running', 'success', 'error'])
.openapi({ description: 'Execution status' }),
Expand Down
2 changes: 1 addition & 1 deletion packages/create-bubblelab-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-bubblelab-app",
"version": "0.1.302",
"version": "0.1.303",
"type": "module",
"license": "Apache-2.0",
"description": "Create BubbleLab AI agent applications with one command",
Expand Down
6 changes: 3 additions & 3 deletions packages/create-bubblelab-app/templates/basic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@bubblelab/bubble-core": "^0.1.302",
"@bubblelab/bubble-runtime": "^0.1.302",
"@bubblelab/shared-schemas": "^0.1.302",
"@bubblelab/bubble-core": "^0.1.303",
"@bubblelab/bubble-runtime": "^0.1.303",
"@bubblelab/shared-schemas": "^0.1.303",
"dotenv": "^16.4.5"
},
"devDependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@bubblelab/bubble-core": "^0.1.302",
"@bubblelab/bubble-runtime": "^0.1.302",
"@bubblelab/bubble-core": "^0.1.303",
"@bubblelab/bubble-runtime": "^0.1.303",
"dotenv": "^16.4.5"
},
"devDependencies": {
Expand Down
Loading