auto-claude: subtask-1-1 - Create rate_limits table migration in Supabase
This commit is contained in:
@@ -0,0 +1,227 @@
|
|||||||
|
{
|
||||||
|
"base_commands": [
|
||||||
|
".",
|
||||||
|
"[",
|
||||||
|
"[[",
|
||||||
|
"ag",
|
||||||
|
"awk",
|
||||||
|
"basename",
|
||||||
|
"bash",
|
||||||
|
"bc",
|
||||||
|
"break",
|
||||||
|
"cat",
|
||||||
|
"cd",
|
||||||
|
"chmod",
|
||||||
|
"clear",
|
||||||
|
"cmp",
|
||||||
|
"column",
|
||||||
|
"comm",
|
||||||
|
"command",
|
||||||
|
"continue",
|
||||||
|
"cp",
|
||||||
|
"curl",
|
||||||
|
"cut",
|
||||||
|
"date",
|
||||||
|
"df",
|
||||||
|
"diff",
|
||||||
|
"dig",
|
||||||
|
"dirname",
|
||||||
|
"du",
|
||||||
|
"echo",
|
||||||
|
"egrep",
|
||||||
|
"env",
|
||||||
|
"eval",
|
||||||
|
"exec",
|
||||||
|
"exit",
|
||||||
|
"expand",
|
||||||
|
"export",
|
||||||
|
"expr",
|
||||||
|
"false",
|
||||||
|
"fd",
|
||||||
|
"fgrep",
|
||||||
|
"file",
|
||||||
|
"find",
|
||||||
|
"fmt",
|
||||||
|
"fold",
|
||||||
|
"gawk",
|
||||||
|
"gh",
|
||||||
|
"git",
|
||||||
|
"grep",
|
||||||
|
"gunzip",
|
||||||
|
"gzip",
|
||||||
|
"head",
|
||||||
|
"help",
|
||||||
|
"host",
|
||||||
|
"iconv",
|
||||||
|
"id",
|
||||||
|
"jobs",
|
||||||
|
"join",
|
||||||
|
"jq",
|
||||||
|
"kill",
|
||||||
|
"killall",
|
||||||
|
"less",
|
||||||
|
"let",
|
||||||
|
"ln",
|
||||||
|
"ls",
|
||||||
|
"lsof",
|
||||||
|
"man",
|
||||||
|
"mkdir",
|
||||||
|
"mktemp",
|
||||||
|
"more",
|
||||||
|
"mv",
|
||||||
|
"nl",
|
||||||
|
"paste",
|
||||||
|
"pgrep",
|
||||||
|
"ping",
|
||||||
|
"pkill",
|
||||||
|
"popd",
|
||||||
|
"printenv",
|
||||||
|
"printf",
|
||||||
|
"ps",
|
||||||
|
"pushd",
|
||||||
|
"pwd",
|
||||||
|
"read",
|
||||||
|
"readlink",
|
||||||
|
"realpath",
|
||||||
|
"reset",
|
||||||
|
"return",
|
||||||
|
"rev",
|
||||||
|
"rg",
|
||||||
|
"rm",
|
||||||
|
"rmdir",
|
||||||
|
"sed",
|
||||||
|
"seq",
|
||||||
|
"set",
|
||||||
|
"sh",
|
||||||
|
"shuf",
|
||||||
|
"sleep",
|
||||||
|
"sort",
|
||||||
|
"source",
|
||||||
|
"split",
|
||||||
|
"stat",
|
||||||
|
"tail",
|
||||||
|
"tar",
|
||||||
|
"tee",
|
||||||
|
"test",
|
||||||
|
"time",
|
||||||
|
"timeout",
|
||||||
|
"touch",
|
||||||
|
"tr",
|
||||||
|
"tree",
|
||||||
|
"true",
|
||||||
|
"type",
|
||||||
|
"uname",
|
||||||
|
"unexpand",
|
||||||
|
"uniq",
|
||||||
|
"unset",
|
||||||
|
"unzip",
|
||||||
|
"watch",
|
||||||
|
"wc",
|
||||||
|
"wget",
|
||||||
|
"whereis",
|
||||||
|
"which",
|
||||||
|
"whoami",
|
||||||
|
"xargs",
|
||||||
|
"yes",
|
||||||
|
"yq",
|
||||||
|
"zip",
|
||||||
|
"zsh"
|
||||||
|
],
|
||||||
|
"stack_commands": [
|
||||||
|
"ar",
|
||||||
|
"clang",
|
||||||
|
"clang++",
|
||||||
|
"cmake",
|
||||||
|
"composer",
|
||||||
|
"dive",
|
||||||
|
"docker",
|
||||||
|
"docker-buildx",
|
||||||
|
"docker-compose",
|
||||||
|
"dockerfile",
|
||||||
|
"eslint",
|
||||||
|
"g++",
|
||||||
|
"gcc",
|
||||||
|
"ipython",
|
||||||
|
"jupyter",
|
||||||
|
"ld",
|
||||||
|
"make",
|
||||||
|
"meson",
|
||||||
|
"next",
|
||||||
|
"ninja",
|
||||||
|
"nm",
|
||||||
|
"node",
|
||||||
|
"notebook",
|
||||||
|
"npm",
|
||||||
|
"npx",
|
||||||
|
"objdump",
|
||||||
|
"pdb",
|
||||||
|
"php",
|
||||||
|
"pip",
|
||||||
|
"pip3",
|
||||||
|
"pipx",
|
||||||
|
"pnpm",
|
||||||
|
"pnpx",
|
||||||
|
"pudb",
|
||||||
|
"python",
|
||||||
|
"python3",
|
||||||
|
"react-scripts",
|
||||||
|
"strip",
|
||||||
|
"ts-node",
|
||||||
|
"tsc",
|
||||||
|
"tsx",
|
||||||
|
"vitest"
|
||||||
|
],
|
||||||
|
"script_commands": [
|
||||||
|
"bun",
|
||||||
|
"npm",
|
||||||
|
"pnpm",
|
||||||
|
"yarn"
|
||||||
|
],
|
||||||
|
"custom_commands": [],
|
||||||
|
"detected_stack": {
|
||||||
|
"languages": [
|
||||||
|
"python",
|
||||||
|
"javascript",
|
||||||
|
"typescript",
|
||||||
|
"php",
|
||||||
|
"c"
|
||||||
|
],
|
||||||
|
"package_managers": [
|
||||||
|
"pnpm"
|
||||||
|
],
|
||||||
|
"frameworks": [
|
||||||
|
"nextjs",
|
||||||
|
"react",
|
||||||
|
"vitest",
|
||||||
|
"eslint"
|
||||||
|
],
|
||||||
|
"databases": [],
|
||||||
|
"infrastructure": [
|
||||||
|
"docker"
|
||||||
|
],
|
||||||
|
"cloud_providers": [],
|
||||||
|
"code_quality_tools": [],
|
||||||
|
"version_managers": []
|
||||||
|
},
|
||||||
|
"custom_scripts": {
|
||||||
|
"npm_scripts": [
|
||||||
|
"dev",
|
||||||
|
"build",
|
||||||
|
"start",
|
||||||
|
"lint",
|
||||||
|
"build:images",
|
||||||
|
"generate:images",
|
||||||
|
"generate:images:dry",
|
||||||
|
"test",
|
||||||
|
"test:coverage"
|
||||||
|
],
|
||||||
|
"make_targets": [],
|
||||||
|
"poetry_scripts": [],
|
||||||
|
"cargo_aliases": [],
|
||||||
|
"shell_scripts": []
|
||||||
|
},
|
||||||
|
"project_dir": "C:\\Users\\damja\\WebstormProjects\\Portfolio",
|
||||||
|
"created_at": "2026-01-22T15:28:38.237190",
|
||||||
|
"project_hash": "c4ad399e16be367eb4e6b076fe1d9ee3",
|
||||||
|
"inherited_from": "C:\\Users\\damja\\WebstormProjects\\Portfolio"
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
"active": true,
|
||||||
|
"spec": "017-replace-in-memory-rate-limiter-with-persistent-sol",
|
||||||
|
"state": "planning",
|
||||||
|
"subtasks": {
|
||||||
|
"completed": 0,
|
||||||
|
"total": 0,
|
||||||
|
"in_progress": 1,
|
||||||
|
"failed": 0
|
||||||
|
},
|
||||||
|
"phase": {
|
||||||
|
"current": "Database Setup",
|
||||||
|
"id": null,
|
||||||
|
"total": 2
|
||||||
|
},
|
||||||
|
"workers": {
|
||||||
|
"active": 0,
|
||||||
|
"max": 1
|
||||||
|
},
|
||||||
|
"session": {
|
||||||
|
"number": 2,
|
||||||
|
"started_at": "2026-01-25T06:23:53.972774"
|
||||||
|
},
|
||||||
|
"last_update": "2026-01-25T06:29:27.619539"
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
{
|
||||||
|
"sandbox": {
|
||||||
|
"enabled": true,
|
||||||
|
"autoAllowBashIfSandboxed": true
|
||||||
|
},
|
||||||
|
"permissions": {
|
||||||
|
"defaultMode": "acceptEdits",
|
||||||
|
"allow": [
|
||||||
|
"Read(./**)",
|
||||||
|
"Write(./**)",
|
||||||
|
"Edit(./**)",
|
||||||
|
"Glob(./**)",
|
||||||
|
"Grep(./**)",
|
||||||
|
"Read(C:\\Users\\damja\\WebstormProjects\\Portfolio\\.auto-claude\\worktrees\\tasks\\017-replace-in-memory-rate-limiter-with-persistent-sol/**)",
|
||||||
|
"Write(C:\\Users\\damja\\WebstormProjects\\Portfolio\\.auto-claude\\worktrees\\tasks\\017-replace-in-memory-rate-limiter-with-persistent-sol/**)",
|
||||||
|
"Edit(C:\\Users\\damja\\WebstormProjects\\Portfolio\\.auto-claude\\worktrees\\tasks\\017-replace-in-memory-rate-limiter-with-persistent-sol/**)",
|
||||||
|
"Glob(C:\\Users\\damja\\WebstormProjects\\Portfolio\\.auto-claude\\worktrees\\tasks\\017-replace-in-memory-rate-limiter-with-persistent-sol/**)",
|
||||||
|
"Grep(C:\\Users\\damja\\WebstormProjects\\Portfolio\\.auto-claude\\worktrees\\tasks\\017-replace-in-memory-rate-limiter-with-persistent-sol/**)",
|
||||||
|
"Read(C:\\Users\\damja\\WebstormProjects\\Portfolio\\.auto-claude\\worktrees\\tasks\\017-replace-in-memory-rate-limiter-with-persistent-sol\\.auto-claude\\specs\\017-replace-in-memory-rate-limiter-with-persistent-sol/**)",
|
||||||
|
"Write(C:\\Users\\damja\\WebstormProjects\\Portfolio\\.auto-claude\\worktrees\\tasks\\017-replace-in-memory-rate-limiter-with-persistent-sol\\.auto-claude\\specs\\017-replace-in-memory-rate-limiter-with-persistent-sol/**)",
|
||||||
|
"Edit(C:\\Users\\damja\\WebstormProjects\\Portfolio\\.auto-claude\\worktrees\\tasks\\017-replace-in-memory-rate-limiter-with-persistent-sol\\.auto-claude\\specs\\017-replace-in-memory-rate-limiter-with-persistent-sol/**)",
|
||||||
|
"Read(C:\\Users\\damja\\WebstormProjects\\Portfolio\\.auto-claude/**)",
|
||||||
|
"Write(C:\\Users\\damja\\WebstormProjects\\Portfolio\\.auto-claude/**)",
|
||||||
|
"Edit(C:\\Users\\damja\\WebstormProjects\\Portfolio\\.auto-claude/**)",
|
||||||
|
"Glob(C:\\Users\\damja\\WebstormProjects\\Portfolio\\.auto-claude/**)",
|
||||||
|
"Grep(C:\\Users\\damja\\WebstormProjects\\Portfolio\\.auto-claude/**)",
|
||||||
|
"Bash(*)",
|
||||||
|
"WebFetch(*)",
|
||||||
|
"WebSearch(*)",
|
||||||
|
"mcp__context7__resolve-library-id(*)",
|
||||||
|
"mcp__context7__get-library-docs(*)",
|
||||||
|
"mcp__graphiti-memory__search_nodes(*)",
|
||||||
|
"mcp__graphiti-memory__search_facts(*)",
|
||||||
|
"mcp__graphiti-memory__add_episode(*)",
|
||||||
|
"mcp__graphiti-memory__get_episodes(*)",
|
||||||
|
"mcp__graphiti-memory__get_entity_edge(*)"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -82,3 +82,6 @@ supabase/.temp/
|
|||||||
|
|
||||||
# Source images (originals before optimization)
|
# Source images (originals before optimization)
|
||||||
source-images/
|
source-images/
|
||||||
|
|
||||||
|
# Auto Claude data directory
|
||||||
|
.auto-claude/
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
-- Create rate_limits table for persistent rate limiting
|
||||||
|
-- This replaces the in-memory Map-based rate limiter
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS rate_limits (
|
||||||
|
-- Unique identifier (typically IP address)
|
||||||
|
identifier TEXT NOT NULL,
|
||||||
|
|
||||||
|
-- Number of requests in the current time window
|
||||||
|
count INTEGER NOT NULL DEFAULT 1,
|
||||||
|
|
||||||
|
-- Start of the rate limit window (for sliding window algorithm)
|
||||||
|
window_start TIMESTAMPTZ NOT NULL,
|
||||||
|
|
||||||
|
-- Timestamp when the record was created
|
||||||
|
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||||
|
|
||||||
|
-- Timestamp when the record was last updated
|
||||||
|
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||||
|
|
||||||
|
-- Primary key ensures one record per identifier per time window
|
||||||
|
PRIMARY KEY (identifier, window_start)
|
||||||
|
);
|
||||||
|
|
||||||
|
-- Index for fast lookups by identifier and window_start
|
||||||
|
-- This is critical for rate limiting performance
|
||||||
|
CREATE INDEX IF NOT EXISTS idx_rate_limits_identifier_window
|
||||||
|
ON rate_limits(identifier, window_start DESC);
|
||||||
|
|
||||||
|
-- Index for cleanup queries (to remove old rate limit records)
|
||||||
|
CREATE INDEX IF NOT EXISTS idx_rate_limits_window_start
|
||||||
|
ON rate_limits(window_start);
|
||||||
|
|
||||||
|
-- Add a comment to the table
|
||||||
|
COMMENT ON TABLE rate_limits IS 'Stores rate limiting data for API endpoints. Each record tracks request counts within a time window for a specific identifier (typically IP address).';
|
||||||
|
|
||||||
|
-- Add comments to columns for documentation
|
||||||
|
COMMENT ON COLUMN rate_limits.identifier IS 'Unique identifier for the client (typically IP address)';
|
||||||
|
COMMENT ON COLUMN rate_limits.count IS 'Number of requests made in the current time window';
|
||||||
|
COMMENT ON COLUMN rate_limits.window_start IS 'Start timestamp of the rate limit window';
|
||||||
|
COMMENT ON COLUMN rate_limits.created_at IS 'Timestamp when this record was first created';
|
||||||
|
COMMENT ON COLUMN rate_limits.updated_at IS 'Timestamp when this record was last updated';
|
||||||
Reference in New Issue
Block a user