superset setup

This commit is contained in:
John Yeo
2026-01-21 12:54:09 +00:00
parent 4326e3e332
commit b73a060a5d
5 changed files with 144 additions and 21 deletions

View File

@@ -1,4 +1,3 @@
{
"setup": [],
"teardown": []
"setup": ["./.superset/setup.sh"]
}

131
.superset/setup.sh Executable file
View File

@@ -0,0 +1,131 @@
#!/bin/zsh
set -e
echo "Starting Superset workspace setup for Autumn..."
# Check for Bun
if ! command -v bun &> /dev/null; then
echo "Error: Bun is not installed."
echo "Please install Bun from https://bun.sh"
exit 1
fi
echo "Bun found: $(bun --version)"
# Determine root path - use SUPERSET_ROOT_PATH if set, otherwise use git root
if [ -n "$SUPERSET_ROOT_PATH" ]; then
ROOT_PATH="$SUPERSET_ROOT_PATH"
else
# Fallback for manual testing - go up two directories from .superset/workspace
ROOT_PATH="$(cd "$(dirname "$0")/.." && pwd)"
fi
echo "Root path: $ROOT_PATH"
# Install dependencies
echo "Installing dependencies..."
bun install
# Copy .env files from root repo
echo "Copying .env files from root repository..."
# Copy all .env* files from server/
if [ -d "$ROOT_PATH/server" ]; then
mkdir -p server
for env_file in "$ROOT_PATH/server"/.env*; do
if [ -f "$env_file" ]; then
filename=$(basename "$env_file")
cp "$env_file" "server/$filename"
echo "Copied server/$filename"
fi
done
else
echo "Warning: $ROOT_PATH/server directory not found"
fi
# Copy all .env* files from vite/
if [ -d "$ROOT_PATH/vite" ]; then
mkdir -p vite
for env_file in "$ROOT_PATH/vite"/.env*; do
if [ -f "$env_file" ]; then
filename=$(basename "$env_file")
cp "$env_file" "vite/$filename"
echo "Copied vite/$filename"
fi
done
else
echo "Warning: $ROOT_PATH/vite directory not found"
fi
# Copy all .env* files from shared/
if [ -d "$ROOT_PATH/shared" ]; then
mkdir -p shared
for env_file in "$ROOT_PATH/shared"/.env*; do
if [ -f "$env_file" ]; then
filename=$(basename "$env_file")
cp "$env_file" "shared/$filename"
echo "Copied shared/$filename"
fi
done
else
echo "Warning: $ROOT_PATH/shared directory not found"
fi
# Copy all .sh files from root
echo "Copying shell scripts from root repository..."
for sh_file in "$ROOT_PATH"/*.sh; do
if [ -f "$sh_file" ]; then
filename=$(basename "$sh_file")
# Skip conductor-setup.sh itself
if [ "$filename" != "conductor-setup.sh" ]; then
cp "$sh_file" "$filename"
chmod +x "$filename"
echo "Copied $filename"
fi
fi
done
# Copy all .sh files from server/
echo "Copying shell scripts from server directory..."
if [ -d "$ROOT_PATH/server" ]; then
mkdir -p server
for sh_file in "$ROOT_PATH/server"/*.sh; do
if [ -f "$sh_file" ]; then
filename=$(basename "$sh_file")
cp "$sh_file" "server/$filename"
chmod +x "server/$filename"
echo "Copied server/$filename"
fi
done
else
echo "Warning: $ROOT_PATH/server directory not found"
fi
# Copy all .sh files from server/shell/
echo "Copying shell scripts from server/shell directory..."
if [ -d "$ROOT_PATH/server/shell" ]; then
mkdir -p server/shell
for sh_file in "$ROOT_PATH/server/shell"/*.sh; do
if [ -f "$sh_file" ]; then
filename=$(basename "$sh_file")
cp "$sh_file" "server/shell/$filename"
chmod +x "server/shell/$filename"
echo "Copied server/shell/$filename"
fi
done
else
echo "Warning: $ROOT_PATH/server/shell directory not found"
fi
# Copy drizzle migration files
if [ -d "$ROOT_PATH/shared/drizzle" ]; then
echo "Copying database migration files..."
mkdir -p shared/drizzle
cp -r "$ROOT_PATH/shared/drizzle/"* shared/drizzle/
echo "Copied migration files"
fi
echo "Workspace setup complete!"
echo ""
echo "Next: Start the development server with 'bun run dev:bun'"

View File

@@ -78,9 +78,8 @@ export const refreshCacheMiddleware = async (
if (c.res.status < 200 || c.res.status >= 300) return;
const ctx = c.get("ctx");
const { skipCacheDeletion } = ctx;
if (skipCacheDeletion) return;
if (ctx.testOptions?.skipCacheDeletion) return;
const pathname = new URL(c.req.url).pathname.replace("/v1", "");
const method = c.req.method;
@@ -90,7 +89,7 @@ export const refreshCacheMiddleware = async (
matchRoute({ url: pathname, method, pattern }),
);
if (pathMatch && !skipCacheDeletion) {
if (pathMatch) {
const customerId = c.req.param("customer_id");
if (customerId) {
await deleteCachedFullCustomer({

View File

@@ -1,7 +1,6 @@
import { CreateFeatureSchema, type Feature, FeatureType } from "@autumn/shared";
import type { AutumnContext } from "@/honoUtils/HonoEnv.js";
import { JobName } from "@/queue/JobName.js";
import { addTaskToQueue } from "@/queue/queueUtils.js";
import { workflows } from "@/queue/workflows.js";
import { generateId } from "@/utils/genUtils.js";
import { FeatureService } from "../FeatureService.js";
import {
@@ -64,13 +63,10 @@ export const createFeature = async ({
});
if (!skipGenerateDisplay) {
await addTaskToQueue({
jobName: JobName.GenerateFeatureDisplay,
payload: {
featureId: feature.id,
orgId: ctx.org.id,
env: ctx.env,
},
await workflows.triggerGenerateFeatureDisplay({
featureId: feature.id,
orgId: ctx.org.id,
env: ctx.env,
});
}

View File

@@ -8,6 +8,7 @@ import {
import type { AutumnContext } from "@/honoUtils/HonoEnv.js";
import { JobName } from "@/queue/JobName.js";
import { addTaskToQueue } from "@/queue/queueUtils.js";
import { workflows } from "@/queue/workflows.js";
import RecaseError from "@/utils/errorUtils.js";
import { FeatureService } from "../FeatureService.js";
import {
@@ -173,13 +174,10 @@ export const updateFeature = async ({
// Queue display generation if name changed
if (isChangingName && updatedFeature) {
await addTaskToQueue({
jobName: JobName.GenerateFeatureDisplay,
payload: {
featureId: updatedFeature.id,
orgId: ctx.org.id,
env: ctx.env,
},
await workflows.triggerGenerateFeatureDisplay({
featureId: updatedFeature.id,
orgId: ctx.org.id,
env: ctx.env,
});
}