Skip to content
Astera Technology

Why did verified rows vanish after the import rolled back?

Verify the committed state rather than only the writer’s uncommitted view.

Download complete case notes and answer keys ↓

Read the source and its declared rule

The original release requires one committed A row. A same-connection count inside BEGIN sees the newly inserted row even when the run later rolls back. Corrected verification follows COMMIT or ROLLBACK and ties release to an actual successful commit with the required row.

Filled synthetic input
RecordInput JSON
Base input{"insert":true,"commit":false}
Download editable CSV ↓

Compare the actual paths

Bad result says released with count 1 although final target is empty. Correct rolled-back output has count 0 and released false.

Misleading and corrected outputs
PathOutput JSON
Misleading path{"released":true,"verifiedCount":1,"target":[]}
Corrected path{"released":false,"verifiedCount":0,"target":[]}
Download editable CSV ↓
Local Node.js program: 22.23.3 or 24.14.1
import {DatabaseSync} from 'node:sqlite';
import {TextDecoder} from 'node:util';
import {inflateSync} from 'node:zlib';
import {posix} from 'node:path';
import {createHash} from 'node:crypto';
const rows=(db,sql)=>db.prepare(sql).all().map(r=>({...r}));
const failed=(action)=>{try{action();return null;}catch(e){return {code:e.errcode??e.code??e.name};}};

import assert from 'node:assert/strict';
const run=function run(i,corrected=true){
    const db=new DatabaseSync(':memory:');try{db.exec('CREATE TABLE target(id TEXT PRIMARY KEY);BEGIN;');if(i.insert)db.exec("INSERT INTO target VALUES('A');");
      const before=db.prepare('SELECT COUNT(*) AS n FROM target').get().n;db.exec(i.commit?'COMMIT;':'ROLLBACK;');
      const target=rows(db,'SELECT * FROM target');const verifiedCount=corrected?target.length:before;
      return {released:corrected?i.commit&&verifiedCount===1:verifiedCount===1,verifiedCount,target};
    }finally{db.close();}
  };
const cases=[{"label":"misleading base","input":{"insert":true,"commit":false},"expected":{"released":true,"verifiedCount":1,"target":[]},"corrected":false},{"label":"corrected base","input":{"insert":true,"commit":false},"expected":{"released":false,"verifiedCount":0,"target":[]},"corrected":true},{"label":"successful commit evidence","input":{"insert":true,"commit":true},"expected":{"released":true,"verifiedCount":1,"target":[{"id":"A"}]},"corrected":true},{"label":"commit alone does not prove required row","input":{"insert":false,"commit":true},"expected":{"released":false,"verifiedCount":0,"target":[]},"corrected":true}];
for(const test of cases){
  const actual=run(test.input,test.corrected);
  assert.deepEqual(actual,test.expected,test.label);
  console.log(test.label,actual);
}
Download runnable example ↓

Check boundaries before the next load

A successful commit retains A. Committing an empty transaction alone does not establish the required record.

Editable boundary records and expected outputs
CaseInput JSONExpected output JSON
Successful commit with required row{"insert":true,"commit":true}{"released":true,"verifiedCount":1,"target":[{"id":"A"}]}
Commit without a required row{"insert":false,"commit":true}{"released":false,"verifiedCount":0,"target":[]}
Download editable CSV ↓

Can the inside-transaction count certify this rolled-back import?

Show the worked answer

No. It measured provisional state. Final committed-state verification finds zero rows and blocks release.

Related resources