Merge branch 'dev' into onboarding-auth-page-preview-interactivity-fix

This commit is contained in:
Armaan Jain 2026-07-02 17:20:54 -07:00 committed by GitHub
commit b40271e50d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 80 additions and 2 deletions

View File

@ -579,6 +579,7 @@ function createTablesStateFromMigrations(migrations: readonly BulldozerDatabaseM
}
export type BulldozerDatabase = {
getDebugInfo(): any,
listTables(): BulldozerDatabaseTableDescriptor[],
debugPiledriverSnapshot?(): Promise<PiledriverDatabaseDebugSnapshot>,
debugLowLevelSnapshot?(): Promise<LowLevelDatabaseDebugSnapshot>,
@ -641,6 +642,18 @@ export function declareBulldozerDatabase(piledriverDatabase: PiledriverDatabase,
};
return {
getDebugInfo() {
return {
backend: "bulldozer",
constructorArguments: { piledriverDatabase, options },
piledriverDatabase,
rootKey,
getRoot,
setRoot,
tablesState,
currentOperation,
};
},
listTables: () => Object.entries(tablesState.tables).map(([tableId, tableState]) => ({
tableId,
inputTableIds: { ...tableState.inputTableIds },

View File

@ -1,6 +1,7 @@
export type DatabaseSeq = (readonly (string | number)[] & { __brand: "hexclave-low-level-kv-store-seq" });
export type Database = {
getDebugInfo(): any,
/**
* Returns a promise that resolves once it is guaranteed that queries made from this database client will see the
* given seq.

View File

@ -127,8 +127,15 @@ export function declareInMemoryLowLevelDatabase(dbId: string): LowLevelDatabase
return result;
};
return {
getDebugInfo() {
return {
backend: "in-memory",
constructorArguments: { dbId },
inMemoryLowLevelKvStores,
debugEntriesByStoreId,
};
},
declareKvDump(dumpId) {
return declareInMemoryLowLevelKvStoreOrDump("dump", JSON.stringify([dbId, dumpId]));
},

View File

@ -38,6 +38,16 @@ function createSlowSetDatabase() {
},
};
const db: LowLevelDatabase = {
getDebugInfo() {
return {
backend: "slow-set-test",
releaseSets,
setCallCount,
committed,
seqToPromise,
initialSeq,
};
},
declareKvStore: () => store,
declareKvDump: () => {
throw new Error("not implemented");

View File

@ -243,6 +243,23 @@ export function declareInstantAvailabilityLowLevelDatabase(wrapped: LowLevelData
};
return {
getDebugInfo() {
return {
backend: "instant-availability",
constructorArguments: { wrapped, options },
wrapped,
dbId,
maxPendingSeqRecords,
initialSeq,
seqRecords,
createdSeqRecords,
underlyingAvailableSeqRecords,
pendingSeqRecords,
currentWriteGateOperation,
pendingSeqRecordsChanged,
cacheMaps,
};
},
declareKvStore(id) {
return declareStoreOrDump(wrapped.declareKvStore(id) as LowLevelKvStore & LowLevelKvDump);
},

View File

@ -243,6 +243,21 @@ export function declareLmdbLowLevelDatabase(options: { path: string, dbId?: stri
};
return {
getDebugInfo() {
return {
backend: "lmdb",
constructorArguments: options,
dbId,
simulateReadMissDelayMs,
root,
meta,
currentVersion,
debugEntriesByStoreId,
seqToAvailability,
seqToDurability,
initialSeq,
};
},
declareKvDump(dumpId) {
return declareLmdbLowLevelKvStoreOrDump("dump", dumpId);
},

View File

@ -287,6 +287,20 @@ export function declarePiledriverDatabase(lowLevelDb: LowLevelDatabase, options:
};
return {
getDebugInfo() {
return {
backend: "piledriver",
constructorArguments: { lowLevelDb, options },
lowLevelDb,
rootStore,
heapDump,
heapObjectsByObject,
heapObjectsByHeapKeyBase64,
heapObjectsByHeapKeyFinalizer,
heapKeysAndSeqByHeapObjects,
heapReadCacheDisabled: options.disableHeapReadCache === true,
};
},
async getRootObject(key): Promise<{ object: PiledriverObject, seq: DatabaseSeq }> {
return await traceSpan("bulldozer-js.piledriver.getRootObject", async () => {
const { buffer, seq: rootSeq } = await rootStore.get(key);

View File

@ -76,8 +76,9 @@ const bulldozerDb = declareBulldozerDatabase(
}),
{ migrations: schema.migrations },
);
await traceSpan("bulldozer-js.applyRemainingMigrations", async () => await bulldozerDb.applyRemainingMigrations());
(globalThis as any).bulldozerDb = bulldozerDb;
console.log(`Stored bulldozerDb in globalThis for pid ${process.pid}. Run \`kill -USR1 ${process.pid} && node inspect 127.0.0.1:9229\` and then \`exec("globalThis.bulldozerDb")\` to inspect it.`);
await traceSpan("bulldozer-js.applyRemainingMigrations", async () => await bulldozerDb.applyRemainingMigrations());
function jsonResponse(body: unknown, init?: ResponseInit) {
return new Response(JSON.stringify(body), {