Skip to content

Commit c618b9c

Browse files
authored
fix(miner): add orb-export to the doctor and migrate store lists (#8318) (#8470)
status.ts's storeIntegrityChecks and migrate-cli.ts's STORES are both meant to enumerate every durable local SQLite store in the package -- each file's own comment says to keep it in sync with the other. Both listed the same sixteen stores, but orb-export.sqlite3 (the opt-in Orb telemetry export's per-instance HMAC secret and export cursor, #4277/#5681) was never added when it shipped. The effect: a corrupted orb-export.sqlite3 was invisible to `loopover-miner doctor`'s per-store integrity sweep, and `loopover-miner migrate` never brought it up to date, unlike every other store the package ships. Same gap class already fixed for policy-doc-cache (#7238), ranked-candidates + deny-hook-synthesis (#8008/#8036), and four earlier omissions (#6768). Adds the store to both lists using each list's existing entry shape (no restructuring): ["orb-export", resolveOrbExportDbPath(env)] in status.ts and { name, resolveDbPath, open } in migrate-cli.ts. Both resolver/opener signatures already match the sibling entries, so no casts are needed. Updates the two tests that pin the lists exactly -- the migrate test's store-name array (now seventeen, same order) and the doctor test's store-integrity check names -- and adds a #8318 regression assertion beside the existing #6768/#8008 ones.
1 parent d09fbe2 commit c618b9c

4 files changed

Lines changed: 14 additions & 1 deletion

File tree

packages/loopover-miner/lib/migrate-cli.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import { initPolicyVerdictCacheStore, resolvePolicyVerdictCacheDbPath } from "./
2727
import { initPolicyDocCacheStore, resolvePolicyDocCacheDbPath } from "./policy-doc-cache.js";
2828
import { initRankedCandidatesStore, resolveRankedCandidatesDbPath } from "./ranked-candidates.js";
2929
import { initDenyHookSynthesisStore, resolveDenyHookSynthesisDbPath } from "./deny-hook-synthesis.js";
30+
import { openOrbExportStore, resolveOrbExportDbPath } from "./orb-export.js";
3031

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

@@ -80,6 +81,9 @@ const STORES: MigrateStoreDescriptor[] = [
8081
{ name: "policy-doc-cache", resolveDbPath: resolvePolicyDocCacheDbPath, open: initPolicyDocCacheStore },
8182
{ name: "ranked-candidates", resolveDbPath: resolveRankedCandidatesDbPath, open: initRankedCandidatesStore },
8283
{ name: "deny-hook-synthesis", resolveDbPath: resolveDenyHookSynthesisDbPath, open: initDenyHookSynthesisStore },
84+
// #8318: orb-export.sqlite3 (the opt-in Orb telemetry export's HMAC secret + cursor, #4277/#5681) is a
85+
// durable local store like every entry above, but was never added when it shipped.
86+
{ name: "orb-export", resolveDbPath: resolveOrbExportDbPath, open: openOrbExportStore },
8387
];
8488

8589
/** Read a store file's stamped schema version without ever creating it -- matches checkStoreIntegrity's

packages/loopover-miner/lib/status.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import { resolvePolicyVerdictCacheDbPath } from "./policy-verdict-cache.js";
3131
import { resolvePolicyDocCacheDbPath } from "./policy-doc-cache.js";
3232
import { resolveRankedCandidatesDbPath } from "./ranked-candidates.js";
3333
import { resolveDenyHookSynthesisDbPath } from "./deny-hook-synthesis.js";
34+
import { resolveOrbExportDbPath } from "./orb-export.js";
3435

3536
// Slim laptop-mode CLI commands (#2288): `status` (what's installed + where local state lives) and `doctor` (is
3637
// this laptop set up correctly). Both are read-only and 100% local — no repo-scanning, no coding-agent invocation,
@@ -381,6 +382,9 @@ function storeIntegrityChecks(env: Record<string, string | undefined>): DoctorCh
381382
["policy-doc-cache", resolvePolicyDocCacheDbPath(env)],
382383
["ranked-candidates", resolveRankedCandidatesDbPath(env)],
383384
["deny-hook-synthesis", resolveDenyHookSynthesisDbPath(env)],
385+
// #8318: orb-export.sqlite3 (the opt-in Orb telemetry export's HMAC secret + cursor, #4277/#5681) is a
386+
// durable local store like every entry above, but was never added when it shipped.
387+
["orb-export", resolveOrbExportDbPath(env)],
384388
];
385389
return stores.map(([name, dbPath]) => checkStoreIntegrity(`store-integrity:${name}`, dbPath));
386390
}

test/unit/miner-migrate-cli.test.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ const STORE_NAMES = [
3434
"policy-doc-cache",
3535
"ranked-candidates",
3636
"deny-hook-synthesis",
37+
"orb-export",
3738
];
3839

3940
afterEach(() => {
@@ -42,7 +43,7 @@ afterEach(() => {
4243
});
4344

4445
describe("loopover-miner migrate (#4871)", () => {
45-
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", () => {
46+
it("covers the exact same seventeen stores doctor's store-integrity sweep covers, in the same order, and skips every one when nothing has been created yet", () => {
4647
const env = tempEnv();
4748
const results = runMigrateChecks(env);
4849

@@ -51,6 +52,9 @@ describe("loopover-miner migrate (#4871)", () => {
5152
expect(STORE_NAMES).toEqual(expect.arrayContaining(["governor-state", "attempt-log", "replay-snapshot", "worktree-allocator"]));
5253
// REGRESSION (#8008): ranked-candidates and deny-hook-synthesis were likewise omitted from both lists.
5354
expect(STORE_NAMES).toEqual(expect.arrayContaining(["ranked-candidates", "deny-hook-synthesis"]));
55+
// REGRESSION (#8318): orb-export.sqlite3 (the opt-in Orb telemetry export's HMAC secret + cursor) was
56+
// never added to either list when it shipped, so a corrupted store was invisible to doctor and migrate.
57+
expect(STORE_NAMES).toEqual(expect.arrayContaining(["orb-export"]));
5458
for (const result of results) {
5559
expect(result.ok).toBe(true);
5660
expect(result.status).toBe("skipped");

test/unit/miner-status.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ describe("loopover-miner status/doctor (#2288)", () => {
145145
"store-integrity:policy-doc-cache",
146146
"store-integrity:ranked-candidates",
147147
"store-integrity:deny-hook-synthesis",
148+
"store-integrity:orb-export",
148149
]);
149150
// REGRESSION (#6768): doctor previously omitted these four durable local stores from the integrity sweep.
150151
expect(checks.map((check) => check.name)).toEqual(

0 commit comments

Comments
 (0)