mirror of
https://github.com/sdwolf4103/opencode-working-memory.git
synced 2026-06-02 06:19:36 +02:00
fix: unify all memory quality rules in single module
This commit is contained in:
@@ -136,6 +136,23 @@ test("decision must be future-facing rule, not completed implementation note", (
|
||||
assert.equal(assessMemoryQuality({ type: "decision", text: "Added semantic merge tests in the previous wave", source: "compaction" }).accepted, false);
|
||||
});
|
||||
|
||||
test("shared quality gate owns extractor low-quality syntax rejections", () => {
|
||||
const rejected = [
|
||||
{ type: "project" as const, text: "fix: add new feature" },
|
||||
{ type: "reference" as const, text: "modified src/plugin.ts" },
|
||||
{ type: "reference" as const, text: "function buildCompactionPrompt(privateContext: string): string" },
|
||||
{ type: "reference" as const, text: "GET /api/sessions" },
|
||||
];
|
||||
|
||||
for (const entry of rejected) {
|
||||
assert.equal(
|
||||
assessMemoryQuality({ ...entry, source: "compaction" }).accepted,
|
||||
false,
|
||||
`${entry.type}: ${entry.text}`,
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
test("explicit memories bypass extraction quality gate", () => {
|
||||
const entries = extractExplicitMemories("remember: Wave 1 completed successfully and all tests passed");
|
||||
assert.equal(entries.length, 1);
|
||||
|
||||
@@ -15,12 +15,12 @@ import {
|
||||
workspaceMemoryExactKey,
|
||||
workspaceMemoryIdentityKey,
|
||||
redactCredentials,
|
||||
isProjectSnapshotViolation,
|
||||
runMigrationP0Cleanup,
|
||||
loadWorkspaceMemory,
|
||||
saveWorkspaceMemory,
|
||||
updateWorkspaceMemoryWithAccounting,
|
||||
} from "../src/workspace-memory.ts";
|
||||
import { isProgressSnapshotViolation } from "../src/memory-quality.ts";
|
||||
import { reviewerCurrent28Fixture, expectedAcceptedFixtureIds } from "./fixtures/memory-quality-current-28.ts";
|
||||
|
||||
function entry(id: string, text: string, type: LongTermMemoryEntry["type"] = "decision"): LongTermMemoryEntry {
|
||||
@@ -890,13 +890,13 @@ test("redactCredentials is idempotent and also redacts rationale text", () => {
|
||||
assert.equal(migrated.entries[0].rationale, "password: [REDACTED]");
|
||||
});
|
||||
|
||||
test("isProjectSnapshotViolation detects wave progress and avoids limit context false positives", () => {
|
||||
assert.equal(isProjectSnapshotViolation("1237 tests pass, 226 suites"), true);
|
||||
assert.equal(isProjectSnapshotViolation("USB 同步:37 個文件"), true);
|
||||
assert.equal(isProjectSnapshotViolation("Waves 1-5 已完成,Wave 6 deferred"), true);
|
||||
test("shared progress snapshot rule detects wave progress and avoids limit context false positives", () => {
|
||||
assert.equal(isProgressSnapshotViolation("1237 tests pass, 226 suites"), true);
|
||||
assert.equal(isProgressSnapshotViolation("USB 同步:37 個文件"), true);
|
||||
assert.equal(isProgressSnapshotViolation("Waves 1-5 已完成,Wave 6 deferred"), true);
|
||||
|
||||
assert.equal(isProjectSnapshotViolation("Upload limit is 10 files"), false);
|
||||
assert.equal(isProjectSnapshotViolation("Project supports 5 test suites"), false);
|
||||
assert.equal(isProgressSnapshotViolation("Upload limit is 10 files"), false);
|
||||
assert.equal(isProgressSnapshotViolation("Project supports 5 test suites"), false);
|
||||
});
|
||||
|
||||
test("runMigrationP0Cleanup marks only non-explicit project snapshots and runs once", () => {
|
||||
|
||||
Reference in New Issue
Block a user