fix: five defects found while rewriting the docs (UF-061 to UF-065)
- Key messages named a Settings > API Keys tab that does not exist; they now point at Settings > Models (UF-061). - The connector suggestion looked for vault.db, which never exists; it now checks the vault for a connector entry (UF-062). - /config and /preferences were registered with a leading slash and never matched (UF-063). - Pins and documents were written under ~/.waggle whatever the data directory; they now use the server's data directory (UF-064). - The Windows uninstaller named a Data & Privacy page that does not exist (UF-065).
This commit is contained in:
51
packages/server/tests/local/pins-documents-data-dir.test.ts
Normal file
51
packages/server/tests/local/pins-documents-data-dir.test.ts
Normal file
@@ -0,0 +1,51 @@
|
||||
import { afterEach, describe, expect, it } from 'vitest';
|
||||
import Fastify, { type FastifyInstance } from 'fastify';
|
||||
import fs from 'node:fs';
|
||||
import os from 'node:os';
|
||||
import path from 'node:path';
|
||||
import { documentRoutes } from '../../src/local/routes/documents.js';
|
||||
import { pinRoutes } from '../../src/local/routes/pins.js';
|
||||
|
||||
/** UF-064: pins and documents follow the server's data directory, not ~/.waggle. */
|
||||
describe('pins and documents storage', () => {
|
||||
let server: FastifyInstance;
|
||||
let dataDir: string;
|
||||
|
||||
async function buildServer(): Promise<FastifyInstance> {
|
||||
dataDir = fs.mkdtempSync(path.join(os.tmpdir(), 'waggle-pins-docs-'));
|
||||
const instance = Fastify({ logger: false });
|
||||
instance.decorate('localConfig', { dataDir } as never);
|
||||
await instance.register(pinRoutes);
|
||||
await instance.register(documentRoutes);
|
||||
await instance.ready();
|
||||
return instance;
|
||||
}
|
||||
|
||||
afterEach(async () => {
|
||||
await server?.close();
|
||||
fs.rmSync(dataDir, { recursive: true, force: true });
|
||||
});
|
||||
|
||||
it('writes pins.json and documents.json under the configured data directory', async () => {
|
||||
server = await buildServer();
|
||||
|
||||
const pin = await server.inject({
|
||||
method: 'POST',
|
||||
url: '/api/workspaces/ws-one/pins',
|
||||
payload: { messageContent: 'Keep this', messageRole: 'assistant' },
|
||||
});
|
||||
expect(pin.statusCode).toBeLessThan(300);
|
||||
const doc = await server.inject({
|
||||
method: 'POST',
|
||||
url: '/api/workspaces/ws-one/documents',
|
||||
payload: { name: 'plan', path: '/tmp/plan.md' },
|
||||
});
|
||||
expect(doc.statusCode).toBeLessThan(300);
|
||||
|
||||
expect(fs.existsSync(path.join(dataDir, 'workspaces', 'ws-one', 'pins.json'))).toBe(true);
|
||||
expect(fs.existsSync(path.join(dataDir, 'workspaces', 'ws-one', 'documents.json'))).toBe(true);
|
||||
|
||||
const list = await server.inject({ method: 'GET', url: '/api/workspaces/ws-one/pins' });
|
||||
expect(list.json().pins).toHaveLength(1);
|
||||
});
|
||||
});
|
||||
@@ -275,5 +275,21 @@ describe('Proactive Handlers', () => {
|
||||
const result = await suggestCapabilities(ctx);
|
||||
expect(result).toBeNull();
|
||||
});
|
||||
|
||||
it('suggests connectors only while none is connected (UF-062)', async () => {
|
||||
fs.mkdirSync(path.join(tmpDir, 'skills', 'research-skill'), { recursive: true });
|
||||
const ws = wsManager.create({ name: 'Busy Project', group: 'Test' });
|
||||
for (let i = 0; i < 51; i++) {
|
||||
await memory.remember({ scope: workspaceScope(ws.id), text: `Distinct memory number ${i}` });
|
||||
}
|
||||
const entries = [{ name: 'anthropic', updatedAt: '2026-11-01T00:00:00.000Z' }];
|
||||
const ctx = { ...makeContext(), vault: { list: () => entries } };
|
||||
|
||||
const withoutConnector = await suggestCapabilities(ctx);
|
||||
expect(withoutConnector?.actionUrl).toBe('/connectors');
|
||||
|
||||
entries.push({ name: 'connector:github', updatedAt: '2026-11-01T00:00:00.000Z' });
|
||||
expect(await suggestCapabilities(ctx)).toBeNull();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user