gitoria
All repositories: gitoria
2.9 KB
// Cross-compat phase A step 3: after the Zig port mutated the JS-written db// (compat_driver.zig mutate_a: insert id=5, update id=0 age->31, delete id=3),// the REAL JS mpackdb re-opens the files and asserts everything.// compact:false so JS reads the Zig-written data/meta/index/idxstate files// AS-IS (this exercises JS parsing Zig-persisted index files).//// Run: MPACKDB=/tmp/mpackdb-run node verify_a.mjs /tmp/compat/users_aimport { pathToFileURL } from 'url';const MOD = process.env.MPACKDB || '/tmp/mpackdb-run';const { default: MPackDB } = await import(pathToFileURL(MOD + '/src/MPackDB.js'));const dbfile = process.argv[2];if (!dbfile) throw new Error('usage: verify_a.mjs <dbfile>');let failures = 0;const check = (label, cond) => {console.log(`${cond ? 'PASS' : 'FAIL'}: ${label}`);if (!cond) failures++;};const db = new MPackDB(dbfile, { primaryKey: '*id', indexes: ['email', '*age'], compact: false });// Zig-inserted record, found via primary key index (Zig-written index file)const [ziggy] = await db.find(5);check('Zig-inserted id=5 found by pk', !!ziggy);check('id=5 name', ziggy?.name === 'Ziggy Stardust');check('id=5 email', ziggy?.email === '[email protected]');check('id=5 tags array', Array.isArray(ziggy?.tags) && ziggy.tags.join(',') === 'zig,native');// Zig-updated record: age changed, Date survived byte-exactconst [alice] = await db.find(0);check('id=0 found', !!alice);check('id=0 age updated by Zig to 31', alice?.age === 31);check('id=0 unicode name intact', alice?.name === 'Alice Ünicode ✓');check('id=0 created is a Date', alice?.created instanceof Date);check('id=0 created ms exact', +alice?.created === 1721996422123);check('id=0 nested profile.theme null', alice?.profile?.theme === null);check('id=0 balance float', alice?.balance === 1234.56);// Zig-deleted record invisibleconst gone = await db.find(3);check('Zig-deleted id=3 invisible', gone.length === 0);// JS-deleted record still invisibleconst gone2 = await db.find(2);check('JS-deleted id=2 still invisible', gone2.length === 0);// Secondary index lookup through Zig-written email index fileconst viaEmail = await db.find(r => true, { index: { field: 'email', value: '[email protected]' } });check('email index lookup finds Zig record', viaEmail.length === 1 && viaEmail[0].id === 5);// Numeric range on Zig-written age indexconst inRange = await db.find(null, { index: { field: 'age', from: 28, to: 45 } });check('age range [28,45] = {31, 28} two records', inRange.length === 2);// Insert continues the id sequence from Zig-persisted metaconst id6 = await db.insert({ name: 'PostZig', email: '[email protected]', age: 50 });check('JS insert after Zig continues sequence (id=6)', id6 === 6);const big = await db.find(1);check('id=1 big number preserved', big[0]?.big === 5000000000);await db.close();console.log(failures === 0 ? 'JS verify_a: ALL PASS' : `JS verify_a: ${failures} FAILURES`);process.exit(failures === 0 ? 0 : 1);
Branches
- f1-broken-json
- f2-api-bugs
- gp-gate-ports
- heap-revert
- hl25-records
- ident-chooser-selector
- mainmain branch
- p51-public-pr-reads
- records-1112
- s25-no-session-on-login-error
- v59
- w52-person-approval
- w52b-approval-followup
- w52c-header-phone
- w53-pulls-speed-pr
- w54-repo-rename-pr
- w55-rename-org
- w56-owner-members
- w62-pr-close
- w63-force-push
- w64-org-slash
Latest commits
- 5b0b4b9ereadme-cache gate: use the security gate's ports when no own ports are givenmre
- bc8f20d9gitoria#25: re-vendor Hybriel c09538bb with the W141 render cache, cache the homepage per commit, add the readme-cache gatemre
- 9feebbd3Re-vendor Hybriel to ded47c13 (W145: Firefox start script fix)mre
- 28ed41e5gitoria#24: one sign-in comes from hl:web batch 20, the /session/share workaround is gonemre
- 3b2669e4gs: drop the unbuildable legacy check, fix pwa fetchmre
- 2a2fdd77gs: C2 check before cookie experimentsmre
- 76e0587aWIP gs 2mre
- a80da7bdWIP gs: security gate for lazy sessions, g24 browser checksmre
- 23fb05d8re-vendor Hybriel aaa39e69 (hl:web batch 20: login emit and Sessions.mint, tab follows a login, signed-in session cookie wins among duplicates and is re-issued with the Domain, W85 faster render, lazy sessions)mre
- a0727ca3ident#31: the selector's sign-in returns to the page the user started on (return attribute = the login callback with next), gate checkmre
- a06975f9gitoria: a gap between your name and Log out in the phone header (they touched); gate checks itmre
- 32ba9d59gitoria: leave the host-only cookie experiment out of the browser gate (gitoria#24 is a separate mission)mre
- 43ad2bcfgitoria header: the selector alone plus your name and Log out as before the theme missions; tests follow (WIP: host-only cookie experiment fails)mre
- ac2c4e3fident selector back in the header (creator 2026-10-24): selector top right signed in and out on phone and desktop, no second Log in button, new gate checks (WIP: gates not re-run after the last edits)mre
- b279f536theme: sync from layouts 4994037 (list rows stack, td word-keep, heading code, edited tap target)mre
- 2b01515ctests/ticketskit: a failed start kills the tickets server (own process group); stop() kills the groupmre
- 109cfc5ctests/ticketskit: keep the rotated session cookie of the tickets login (tickets ST2 session rotation)mre
- 7eb6be27sessions last 99 years (creator 2026-10-23: logins never expire; only sign out ends them)mre
- b3911918reports/MG-mobile.md: 404 fixed, rebased gatesMG
- 9da65b42tests/browser.mjs: 404 checks (host, no hydration wait)MG