- .wob v3: class records carry an index tail (flags bit0 = unique, col_cnt, columns) -- @table(index:[a,b]) entries plus one unique single-column entry per @unique field; loader validates columns in range and scalar/Text-kinded; emitter validates the declarations (unknown column, un-indexable kind => diagnostic) - engine: db_index hash multimap per table, built from the class table at first touch, maintained ONLY inside wo_row_insert/ wo_row_remove; unique checks re-compare actual column values (a hash is a hint); replay re-indexes via wo_row_raw_commit AFTER slots are filled, so recovered tables carry their indexes - WO_T_UNIQUE = 10; a violating insert is un-applied whole (bitmap, hash, count, and the never-observable id reclaimed) and traps catchably -- the employee SEED-DUP pattern - wo_row_insert gains err_kind so db.c maps UNIQUE/OOM/other to the right trap; test images and the runner's loader mirror speak v3 - fixtures: trap/db-unique-violation (code 10 exact) and run/db-unique-catch (catchable dup, composite index accepts duplicates, next id dense after a refusal) - gates: oop-e2e 73/0, all 15 runtime suites, woc-test green, log-watcher 7/0 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
12 lines
391 B
Text
12 lines
391 B
Text
-- iteration 9 Task 4: a duplicate insert into a @unique column traps with
|
|
-- the unique-violation code (WO_T_UNIQUE = 10), raised at the engine's row
|
|
-- choke point. Uncaught here on purpose: the trap code is the assertion.
|
|
class Account {
|
|
email: Text @unique
|
|
balance: Int
|
|
}
|
|
|
|
fn main() {
|
|
insert Account { email: "a@x", balance: 100 }
|
|
insert Account { email: "a@x", balance: 200 }
|
|
}
|