release: v0.6.0 — 完全移除 IndexedDB,自研 KVStore 事务存储引擎(多key原子写/快照日志恢复/CRC自愈)+ KVStoreEngine + 旧库迁移工具 + 10万级压力验证 + 崩溃注入e2e
CI / test (20.x) (push) Successful in 10m53s
CI / test (22.x) (push) Successful in 10m47s
CI / test (24.x) (push) Successful in 10m42s
CI / e2e (push) Successful in 10m27s
CI / test (18.x) (push) Successful in 11m1s

This commit is contained in:
thzxx
2026-08-10 13:56:04 +08:00
parent 2668bd47cf
commit 24b3ca1079
74 changed files with 8016 additions and 7688 deletions
+11 -8
View File
@@ -2,11 +2,14 @@
* v0.4.1 测试 — AriaEngine 外键级联 + clearAll 重置
*/
import 'fake-indexeddb/auto';
import { AriaEngine } from '../src/engine/aria/index';
import { installOPFSMock } from './helpers/opfs-mock';
beforeEach(() => { installOPFSMock(new Map()); });
const mkEngine = async (name: string): Promise<AriaEngine> => {
const e = new AriaEngine({ storageBackend: 'indexeddb', walSyncMode: 'full' });
const e = new AriaEngine({ storageBackend: 'opfs', walSyncMode: 'full' });
await e.open(`cascade-${name}-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`, 1);
return e;
};
@@ -126,7 +129,7 @@ describe('[v0.4.1] AriaEngine clearAll', () => {
test('clearAll 后重启(模拟刷新)无残留数据', async () => {
const name = `clr2-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
let e = new AriaEngine({ storageBackend: 'indexeddb', walSyncMode: 'full' });
let e = new AriaEngine({ storageBackend: 'opfs', walSyncMode: 'full' });
await e.open(name, 1);
await e.createTable({ name: 't', columns: { id: { type: 'string', primaryKey: true } } });
await e.insert('t', [{ id: '1' }]);
@@ -134,7 +137,7 @@ describe('[v0.4.1] AriaEngine clearAll', () => {
await e.close();
// 重新打开(模拟页面刷新):不应有残留表
e = new AriaEngine({ storageBackend: 'indexeddb', walSyncMode: 'full' });
e = new AriaEngine({ storageBackend: 'opfs', walSyncMode: 'full' });
await e.open(name, 1);
expect(await e.getTableNames()).toHaveLength(0);
await e.close();
@@ -159,7 +162,7 @@ describe('[v0.4.1] AriaEngine ALTER TABLE', () => {
test('ALTER 持久化:重启后 schema 与行一致', async () => {
const name = `alt2-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
let e = new AriaEngine({ storageBackend: 'indexeddb', walSyncMode: 'full' });
let e = new AriaEngine({ storageBackend: 'opfs', walSyncMode: 'full' });
await e.open(name, 1);
await e.createTable({ name: 'users', columns: { id: { type: 'string', primaryKey: true }, name: { type: 'string' } } });
await e.insert('users', [{ id: '1', name: 'Alice' }]);
@@ -168,7 +171,7 @@ describe('[v0.4.1] AriaEngine ALTER TABLE', () => {
await e.alterTable('users', 'DROP', { name: 'phone', type: 'string' });
await e.close();
e = new AriaEngine({ storageBackend: 'indexeddb', walSyncMode: 'full' });
e = new AriaEngine({ storageBackend: 'opfs', walSyncMode: 'full' });
await e.open(name, 1);
const schema = await e.getTableSchema('users');
expect(Object.keys(schema!.columns)).not.toContain('phone');
@@ -179,7 +182,7 @@ describe('[v0.4.1] AriaEngine ALTER TABLE', () => {
test('ALTER 模拟崩溃(不 close)重启:schema 与行一致', async () => {
const name = `alt3-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
let e = new AriaEngine({ storageBackend: 'indexeddb', walSyncMode: 'full' });
let e = new AriaEngine({ storageBackend: 'opfs', walSyncMode: 'full' });
await e.open(name, 1);
await e.createTable({ name: 'users', columns: { id: { type: 'string', primaryKey: true }, name: { type: 'string' } } });
await e.insert('users', [{ id: '1', name: 'Alice' }]);
@@ -188,7 +191,7 @@ describe('[v0.4.1] AriaEngine ALTER TABLE', () => {
await e.alterTable('users', 'DROP', { name: 'phone', type: 'string' });
// 不 close,模拟崩溃
e = new AriaEngine({ storageBackend: 'indexeddb', walSyncMode: 'full' });
e = new AriaEngine({ storageBackend: 'opfs', walSyncMode: 'full' });
await e.open(name, 1);
const schema = await e.getTableSchema('users');
expect(Object.keys(schema!.columns)).not.toContain('phone');