Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/loopover-miner/lib/migrate-cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import { openWorktreeAllocator, resolveWorktreeAllocatorDbPath } from "./worktre
import { initContributionProfileCache, resolveContributionProfileCacheDbPath } from "./contribution-profile-cache.js";
import { initPolicyVerdictCacheStore, resolvePolicyVerdictCacheDbPath } from "./policy-verdict-cache.js";
import { initPolicyDocCacheStore, resolvePolicyDocCacheDbPath } from "./policy-doc-cache.js";
import { initRankedCandidatesStore, resolveRankedCandidatesDbPath } from "./ranked-candidates.js";
import { initDenyHookSynthesisStore, resolveDenyHookSynthesisDbPath } from "./deny-hook-synthesis.js";

const MIGRATE_USAGE = "Usage: loopover-miner migrate [--json]";

Expand Down Expand Up @@ -76,6 +78,8 @@ const STORES: MigrateStoreDescriptor[] = [
},
{ name: "policy-verdict-cache", resolveDbPath: resolvePolicyVerdictCacheDbPath, open: initPolicyVerdictCacheStore },
{ name: "policy-doc-cache", resolveDbPath: resolvePolicyDocCacheDbPath, open: initPolicyDocCacheStore },
{ name: "ranked-candidates", resolveDbPath: resolveRankedCandidatesDbPath, open: initRankedCandidatesStore },
{ name: "deny-hook-synthesis", resolveDbPath: resolveDenyHookSynthesisDbPath, open: initDenyHookSynthesisStore },
];

/** Read a store file's stamped schema version without ever creating it -- matches checkStoreIntegrity's
Expand Down
4 changes: 4 additions & 0 deletions packages/loopover-miner/lib/status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ import { resolveWorktreeAllocatorDbPath } from "./worktree-allocator.js";
import { resolveContributionProfileCacheDbPath } from "./contribution-profile-cache.js";
import { resolvePolicyVerdictCacheDbPath } from "./policy-verdict-cache.js";
import { resolvePolicyDocCacheDbPath } from "./policy-doc-cache.js";
import { resolveRankedCandidatesDbPath } from "./ranked-candidates.js";
import { resolveDenyHookSynthesisDbPath } from "./deny-hook-synthesis.js";

// Slim laptop-mode CLI commands (#2288): `status` (what's installed + where local state lives) and `doctor` (is
// this laptop set up correctly). Both are read-only and 100% local — no repo-scanning, no coding-agent invocation,
Expand Down Expand Up @@ -376,6 +378,8 @@ function storeIntegrityChecks(env: Record<string, string | undefined>): DoctorCh
["contribution-profile", resolveContributionProfileCacheDbPath(env)],
["policy-verdict-cache", resolvePolicyVerdictCacheDbPath(env)],
["policy-doc-cache", resolvePolicyDocCacheDbPath(env)],
["ranked-candidates", resolveRankedCandidatesDbPath(env)],
["deny-hook-synthesis", resolveDenyHookSynthesisDbPath(env)],
];
return stores.map(([name, dbPath]) => checkStoreIntegrity(`store-integrity:${name}`, dbPath));
}
Expand Down
6 changes: 5 additions & 1 deletion test/unit/miner-migrate-cli.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ const STORE_NAMES = [
"contribution-profile",
"policy-verdict-cache",
"policy-doc-cache",
"ranked-candidates",
"deny-hook-synthesis",
];

afterEach(() => {
Expand All @@ -40,13 +42,15 @@ afterEach(() => {
});

describe("loopover-miner migrate (#4871)", () => {
it("covers the exact same fourteen stores doctor's store-integrity sweep covers, in the same order, and skips every one when nothing has been created yet", () => {
it("covers the exact same sixteen stores doctor's store-integrity sweep covers, in the same order, and skips every one when nothing has been created yet", () => {
const env = tempEnv();
const results = runMigrateChecks(env);

expect(results.map((result) => result.name)).toEqual(STORE_NAMES);
// REGRESSION (#6768): these four durable stores were previously omitted from both migrate and doctor.
expect(STORE_NAMES).toEqual(expect.arrayContaining(["governor-state", "attempt-log", "replay-snapshot", "worktree-allocator"]));
// REGRESSION (#8008): ranked-candidates and deny-hook-synthesis were likewise omitted from both lists.
expect(STORE_NAMES).toEqual(expect.arrayContaining(["ranked-candidates", "deny-hook-synthesis"]));
for (const result of results) {
expect(result.ok).toBe(true);
expect(result.status).toBe("skipped");
Expand Down
6 changes: 6 additions & 0 deletions test/unit/miner-status.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ describe("loopover-miner status/doctor (#2288)", () => {
"store-integrity:contribution-profile",
"store-integrity:policy-verdict-cache",
"store-integrity:policy-doc-cache",
"store-integrity:ranked-candidates",
"store-integrity:deny-hook-synthesis",
]);
// REGRESSION (#6768): doctor previously omitted these four durable local stores from the integrity sweep.
expect(checks.map((check) => check.name)).toEqual(
Expand All @@ -152,6 +154,10 @@ describe("loopover-miner status/doctor (#2288)", () => {
"store-integrity:worktree-allocator",
]),
);
// REGRESSION (#8008): ranked-candidates and deny-hook-synthesis were likewise omitted from the sweep.
expect(checks.map((check) => check.name)).toEqual(
expect.arrayContaining(["store-integrity:ranked-candidates", "store-integrity:deny-hook-synthesis"]),
);
expect(runDoctor([], env, cwd)).toBe(0);
expect(log).toHaveBeenCalled();
});
Expand Down