feat: LLM diagram modification + comprehensive code review#1
Merged
Conversation
Stream A (code cleanup): - Remove immer dependency, convert console.log → createLogger() - Extract shared LLM modules (providers, jsonParser, fallbackTemplates, rateLimitHeaders) - Add parser pipeline JSDoc documentation - Add rateLimiter tests Stream B (auth system): - NextAuth.js v5 with JWT sessions, Credentials + Google + GitHub OAuth - Prisma schema: User, Account, Session, Diagram, DiagramVersion models - Auth API routes, register endpoint, Edge Middleware - Login/Register UI, UserMenu component, SessionProvider - Diagram CRUD API with auto-save hook - User dashboard with diagram management - Admin user management with role change Infrastructure Knowledge Graph (all 5 phases + GPT feedback improvements): - 18 source files, 15 test files, 489 tests - LLM security controls, change risk assessor, gold set benchmarks - Zod migration, LLM call metrics 65 test files, 1,975 tests passing. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Phase 1 (Critical): - A-1: Delete unused IKG Phase 4-5 code (~7,732 lines, 17 files) - B-1: Fix PluginContext updateTrigger anti-pattern - C-1: Add Zod validation to API routes (parse, llm) Phase 2 (Quality): - A-2: Delete deprecated code (parsePrompt, getAnimationEngine) - A-3: Replace unsafe type assertions with runtime validation, structuredClone - B-2: Split usePromptParser (419→137 lines + 3 specialized hooks) - C-2: Migrate 110 hardcoded colors to zinc design tokens Phase 3 (Optimization): - A-4: Remove unused jsdom devDep, enable vitest fileParallelism - B-3: Split PluginManager (481→323) and SecurityAuditPanel (465→130) Result: 49 files changed, ~356 insertions, ~8,859 deletions All 57 test files pass (1,660 tests), 0 TypeScript errors. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
dizzikim-dev
added a commit
that referenced
this pull request
Feb 23, 2026
Replace in-memory Map rate limiter with a store abstraction supporting both Redis (Upstash) and in-memory backends. Redis persists rate limit state across serverless cold starts, closing the #1 security gap. Key changes: - Add RateLimitStoreInterface with InMemoryRateLimitStore and RedisRateLimitStore - Factory auto-selects Redis when UPSTASH_REDIS_REST_URL is configured - Fail-closed: production (VERCEL=true) rejects requests if Redis fails (503) - Dev mode: falls back to in-memory silently - All rate limit functions now async (checkRateLimit, clearRateLimit, etc.) - All 7 caller sites updated to await async rate limit calls - 34 tests covering both stores, Redis mock operations, and fail-closed behavior - Type declarations for @upstash/redis (stub until package installed) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/api/modify엔드포인트 및 파서 파이프라인 (contextBuilder, diffApplier, responseValidator, prompts)Key Changes (132 files, +23,501 / -1,638)
New Features:
/api/modify— LLM-based diagram modification with diff application/api/auth,/api/diagrams,/api/admin— Auth & CRUD API routes/dashboard), Admin (/admin/users), Auth pages (/auth/login,/auth/register)Refactoring (Code Review):
usePromptParser(419→137 lines) into 3 hooks (useLocalParser, useLLMModifier, useParserContext)JSON.parse(JSON.stringify())withstructuredClone()parsePrompt(),getAnimationEngine(), jsdom devDepTest plan
npx tsc --noEmit— 0 TypeScript errorsnpx vitest run— 57 test files, 1,660 tests passing🤖 Generated with Claude Code