refactor: remove self-learning and the optimizer package (P1.4)
Self-learning is excluded from the community edition (ADR-0004); the project owner reworks it separately. Cost tracking stays. - agent: delete behaviour evolution (evolve-schema, iterative GEPA, compose-evolution, evolution gates, orchestrator and deploy), improvement and correction detection, AgentLearning, the eval-dataset builder, optimization-capture and the agent_insights tool. Secret detection moves from eval-dataset to secret-patterns. The LLM wiring keeps only the Haiku adapter and judge call used by skill audit and hygiene, so @ax-llm/ax is now declared by agent instead of server. - server: delete /api/evolution/*, the evolution and optimizer services, GEPA expansion of the first chat message, the prompt_optimization and monthly_assessment jobs, the idle-session reviewer and its session-reviewer persona, prompt injection of past corrections and thumbs-down recorded as correction signals. Existing job rows of the removed types are ignored, not deleted. - core: delete OptimizationLogStore; stop re-exporting the improvement signal and evolution run stores. - web: delete the Evolution screen and the two job types in the automation editor. - delete packages/optimizer. Also logs UF-027 (self-learning loops read data nothing collects) and UF-028 (the Settings prompt-shape choice is ignored by chat).
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
|
||||
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
|
||||
import {
|
||||
loadSystemPrompt,
|
||||
loadSystemPromptWithOverrides,
|
||||
assertOverridesReachActiveSpec,
|
||||
loadSkills,
|
||||
} from '../src/prompt-loader.js';
|
||||
import * as fs from 'node:fs';
|
||||
@@ -68,7 +67,6 @@ describe('Prompt Loader', () => {
|
||||
});
|
||||
});
|
||||
|
||||
// ── H-08 G2 — override-aware loader ──────────────────────────
|
||||
describe('loadSystemPromptWithOverrides', () => {
|
||||
it('returns baseline when no overrides exist', () => {
|
||||
const composed = loadSystemPromptWithOverrides(tmpDir);
|
||||
@@ -86,55 +84,17 @@ describe('Prompt Loader', () => {
|
||||
expect(composed.userPromptMd).toBe('hello from user');
|
||||
});
|
||||
|
||||
it('applies behavioral-spec overrides into the active spec', () => {
|
||||
it('ignores override files left on disk by earlier versions', () => {
|
||||
const overrideDir = path.join(tmpDir, 'behavioral-overrides');
|
||||
fs.mkdirSync(overrideDir, { recursive: true });
|
||||
fs.writeFileSync(
|
||||
path.join(overrideDir, 'coreLoop.json'),
|
||||
JSON.stringify({
|
||||
section: 'coreLoop',
|
||||
text: 'CUSTOM CORE LOOP CONTENT FOR TEST',
|
||||
deployedAt: new Date().toISOString(),
|
||||
}),
|
||||
JSON.stringify({ section: 'coreLoop', text: 'STALE OVERRIDE TEXT', deployedAt: new Date().toISOString() }),
|
||||
);
|
||||
|
||||
const composed = loadSystemPromptWithOverrides(tmpDir);
|
||||
const flattened = Object.values(composed.behavioralSpec).join('\n');
|
||||
expect(flattened).toContain('CUSTOM CORE LOOP CONTENT FOR TEST');
|
||||
});
|
||||
});
|
||||
|
||||
describe('assertOverridesReachActiveSpec', () => {
|
||||
it('is quiet when no overrides are deployed', () => {
|
||||
const warnSpy = vi.spyOn(console, 'warn').mockImplementation(() => {});
|
||||
const composed = loadSystemPromptWithOverrides(tmpDir);
|
||||
assertOverridesReachActiveSpec(tmpDir, composed.behavioralSpec);
|
||||
expect(warnSpy).not.toHaveBeenCalled();
|
||||
warnSpy.mockRestore();
|
||||
});
|
||||
|
||||
it('warns when disk has overrides but activeSpec does not contain them', () => {
|
||||
const overrideDir = path.join(tmpDir, 'behavioral-overrides');
|
||||
fs.mkdirSync(overrideDir, { recursive: true });
|
||||
fs.writeFileSync(
|
||||
path.join(overrideDir, 'coreLoop.json'),
|
||||
JSON.stringify({
|
||||
section: 'coreLoop',
|
||||
text: 'UNIQUE MARKER STRING FOR G2 TEST — LONG ENOUGH TO MATCH',
|
||||
deployedAt: new Date().toISOString(),
|
||||
}),
|
||||
);
|
||||
|
||||
const warnSpy = vi.spyOn(console, 'warn').mockImplementation(() => {});
|
||||
// Simulate using the BARE loader — activeSpec is the compile-time
|
||||
// baseline with no overrides folded in.
|
||||
const fakeActiveSpec = loadSystemPromptWithOverrides(path.join(tmpDir, 'nothing')).behavioralSpec;
|
||||
assertOverridesReachActiveSpec(tmpDir, fakeActiveSpec);
|
||||
|
||||
expect(warnSpy).toHaveBeenCalled();
|
||||
const message = warnSpy.mock.calls[0]?.[0] as string;
|
||||
expect(message).toContain('coreLoop');
|
||||
warnSpy.mockRestore();
|
||||
expect(flattened).not.toContain('STALE OVERRIDE TEXT');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user