mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 21:04:23 +01:00
Complete Ralph to Loop rename across entire codebase
Rename all Ralph references to Loop including types, services, hooks, filenames, KV keys, API routes, frontend components, tests, and docs. Key changes: - Types: RalphState → LoopState, RalphConfig → LoopConfig - Services: ralph.ts → loop.ts with worktree field (inverted from inPlace) - KV keys: ralph: → loop:, ralph-session: → loop-session: - API routes: /ralph/* → /loop/* - Frontend: useLoopStatus, RepoLoopList, getLoopStatus, cancelLoop - Config backward compatibility: accepts both loop and ralph (prefers loop) - Automatic KV migration on plugin startup - memory-plan-execute keeps inPlace parameter (different semantics) Fixes critical bugs found in code review: - Backend /loop/cancel route using wrong ralph: KV prefix - Frontend error messages still referencing Ralph - Log message consistency
This commit is contained in:
1 parent
00489d9901
commit
2c4a9c9257
31 files changed
+789
-745
No files matched your search
@@ -63,7 +63,7 @@ import { getRepoById } from '../../src/db/queries'
|
||||
const mockResolveProjectId = resolveProjectId as ReturnType<typeof vi.fn>
|
||||
const mockGetRepoById = getRepoById as ReturnType<typeof vi.fn>
|
||||
|
||||
describe('Memory Routes - Ralph Status', () => {
|
||||
describe('Memory Routes - Loop Status', () => {
|
||||
let memoryApp: ReturnType<typeof createMemoryRoutes>
|
||||
let testDb: any
|
||||
|
||||
@@ -77,9 +77,9 @@ describe('Memory Routes - Ralph Status', () => {
|
||||
memoryApp = createMemoryRoutes(testDb)
|
||||
})
|
||||
|
||||
describe('GET /ralph/status', () => {
|
||||
describe('GET /loop/status', () => {
|
||||
it('should return 400 when repoId query param is missing', async () => {
|
||||
const req = new Request('http://localhost/ralph/status')
|
||||
const req = new Request('http://localhost/loop/status')
|
||||
const res = await memoryApp.fetch(req)
|
||||
|
||||
expect(res.status).toBe(400)
|
||||
@@ -88,7 +88,7 @@ describe('Memory Routes - Ralph Status', () => {
|
||||
})
|
||||
|
||||
it('should return 400 when repoId is not a valid number', async () => {
|
||||
const req = new Request('http://localhost/ralph/status?repoId=abc')
|
||||
const req = new Request('http://localhost/loop/status?repoId=abc')
|
||||
const res = await memoryApp.fetch(req)
|
||||
|
||||
expect(res.status).toBe(400)
|
||||
@@ -99,7 +99,7 @@ describe('Memory Routes - Ralph Status', () => {
|
||||
it('should return 200 with empty loops when repo is not found in DB', async () => {
|
||||
mockGetRepoById.mockReturnValue(null)
|
||||
|
||||
const req = new Request('http://localhost/ralph/status?repoId=1')
|
||||
const req = new Request('http://localhost/loop/status?repoId=1')
|
||||
const res = await memoryApp.fetch(req)
|
||||
|
||||
expect(res.status).toBe(200)
|
||||
@@ -122,7 +122,7 @@ describe('Memory Routes - Ralph Status', () => {
|
||||
})
|
||||
mockResolveProjectId.mockResolvedValue(null)
|
||||
|
||||
const req = new Request('http://localhost/ralph/status?repoId=1')
|
||||
const req = new Request('http://localhost/loop/status?repoId=1')
|
||||
const res = await memoryApp.fetch(req)
|
||||
|
||||
expect(res.status).toBe(200)
|
||||
@@ -147,7 +147,7 @@ describe('Memory Routes - Ralph Status', () => {
|
||||
mockResolveProjectId.mockResolvedValue('test-project-id')
|
||||
mockListKv.mockReturnValue([
|
||||
{
|
||||
key: 'ralph:test-worktree',
|
||||
key: 'loop:test-worktree',
|
||||
data: {
|
||||
active: true,
|
||||
sessionId: 'session-123',
|
||||
@@ -168,7 +168,7 @@ describe('Memory Routes - Ralph Status', () => {
|
||||
},
|
||||
])
|
||||
|
||||
const req = new Request('http://localhost/ralph/status?repoId=1')
|
||||
const req = new Request('http://localhost/loop/status?repoId=1')
|
||||
const res = await memoryApp.fetch(req)
|
||||
|
||||
expect(res.status).toBe(200)
|
||||
@@ -235,7 +235,7 @@ describe('Memory Routes - Ralph Status', () => {
|
||||
},
|
||||
])
|
||||
|
||||
const req = new Request('http://localhost/ralph/status?repoId=1')
|
||||
const req = new Request('http://localhost/loop/status?repoId=1')
|
||||
const res = await memoryApp.fetch(req)
|
||||
|
||||
expect(res.status).toBe(200)
|
||||
@@ -249,12 +249,12 @@ describe('Memory Routes - Ralph Status', () => {
|
||||
throw new Error('Database error')
|
||||
})
|
||||
|
||||
const req = new Request('http://localhost/ralph/status?repoId=1')
|
||||
const req = new Request('http://localhost/loop/status?repoId=1')
|
||||
const res = await memoryApp.fetch(req)
|
||||
|
||||
expect(res.status).toBe(500)
|
||||
const json = await res.json() as Record<string, unknown>
|
||||
expect(json.error).toBe('Failed to get Ralph status')
|
||||
expect(json.error).toBe('Failed to get Loop')
|
||||
})
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user