@quereus/store 4.3.1 → 4.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/README.md +486 -436
  2. package/dist/src/common/bytes.d.ts +4 -1
  3. package/dist/src/common/bytes.d.ts.map +1 -1
  4. package/dist/src/common/bytes.js +23 -2
  5. package/dist/src/common/bytes.js.map +1 -1
  6. package/dist/src/common/cached-kv-store.d.ts.map +1 -1
  7. package/dist/src/common/cached-kv-store.js +6 -13
  8. package/dist/src/common/cached-kv-store.js.map +1 -1
  9. package/dist/src/common/encoding.d.ts +69 -26
  10. package/dist/src/common/encoding.d.ts.map +1 -1
  11. package/dist/src/common/encoding.js +292 -230
  12. package/dist/src/common/encoding.js.map +1 -1
  13. package/dist/src/common/index.d.ts +1 -1
  14. package/dist/src/common/index.d.ts.map +1 -1
  15. package/dist/src/common/index.js +1 -1
  16. package/dist/src/common/index.js.map +1 -1
  17. package/dist/src/common/key-builder.d.ts +5 -1
  18. package/dist/src/common/key-builder.d.ts.map +1 -1
  19. package/dist/src/common/key-builder.js +30 -2
  20. package/dist/src/common/key-builder.js.map +1 -1
  21. package/dist/src/common/kv-store.d.ts +1 -1
  22. package/dist/src/common/memory-store.d.ts.map +1 -1
  23. package/dist/src/common/memory-store.js +21 -6
  24. package/dist/src/common/memory-store.js.map +1 -1
  25. package/dist/src/common/serialization.d.ts.map +1 -1
  26. package/dist/src/common/serialization.js +6 -3
  27. package/dist/src/common/serialization.js.map +1 -1
  28. package/dist/src/common/store-module.d.ts +293 -26
  29. package/dist/src/common/store-module.d.ts.map +1 -1
  30. package/dist/src/common/store-module.js +1543 -612
  31. package/dist/src/common/store-module.js.map +1 -1
  32. package/dist/src/common/store-table.d.ts +515 -36
  33. package/dist/src/common/store-table.d.ts.map +1 -1
  34. package/dist/src/common/store-table.js +873 -100
  35. package/dist/src/common/store-table.js.map +1 -1
  36. package/dist/src/common/transaction.d.ts +8 -5
  37. package/dist/src/common/transaction.d.ts.map +1 -1
  38. package/dist/src/common/transaction.js +32 -5
  39. package/dist/src/common/transaction.js.map +1 -1
  40. package/dist/src/testing/kv-conformance.d.ts +47 -0
  41. package/dist/src/testing/kv-conformance.d.ts.map +1 -0
  42. package/dist/src/testing/kv-conformance.js +418 -0
  43. package/dist/src/testing/kv-conformance.js.map +1 -0
  44. package/package.json +17 -5
@@ -13,6 +13,7 @@
13
13
  * - Catalog store: __catalog__ - DDL metadata keyed by {schema}.{table}
14
14
  */
15
15
  import type { Database, TableSchema, TableIndexSchema, VirtualTableModule, BaseModuleConfig, BestAccessPlanRequest, BestAccessPlanResult, ModuleCapabilities, SchemaChangeInfo, Schema, MappingAdvertisement, ViewSchema, MaintainedTableSchema, BackingHost, LensDeploymentSnapshot } from '@quereus/quereus';
16
+ import type { EffectiveRowSource } from '@quereus/quereus';
16
17
  import type { KVStore, KVStoreProvider } from './kv-store.js';
17
18
  import type { StoreEventEmitter } from './events.js';
18
19
  import { TransactionCoordinator } from './transaction.js';
@@ -51,6 +52,13 @@ export type LensDeploymentListener = (db: Database, logicalSchemaName: string, s
51
52
  export interface StoreModuleConfig extends BaseModuleConfig {
52
53
  /** Collation for text keys. Default: 'NOCASE'. */
53
54
  collation?: 'BINARY' | 'NOCASE';
55
+ /**
56
+ * Serialized-byte budget for a single index-build write batch (see
57
+ * {@link StoreModule.buildIndexEntries}). Set from the `max_batch_bytes`
58
+ * module arg; a missing / non-positive value falls back to
59
+ * {@link DEFAULT_MAX_BATCH_BYTES}. Module-wide, not per-index.
60
+ */
61
+ maxBatchBytes?: number;
54
62
  /** Additional platform-specific options. */
55
63
  [key: string]: unknown;
56
64
  }
@@ -341,8 +349,17 @@ export declare class StoreModule implements VirtualTableModule<StoreTable, Store
341
349
  private getOrReconnectTable;
342
350
  /**
343
351
  * Creates an index on a store-backed table.
352
+ *
353
+ * `rows` — an {@link EffectiveRowSource} supplied by a wrapper module (the isolation
354
+ * layer) — replaces this module's own rows as the set the UNIQUE duplicate check judges.
355
+ * When present the check runs UP FRONT, before `getIndexStore` opens the index-store
356
+ * directory, so a rejection leaves no directory behind; and `buildIndexEntries` then
357
+ * populates the physical index from this module's own (committed) rows with its in-pass
358
+ * dup check disabled. Those two row sets legitimately differ — the wrapper's transaction
359
+ * may have deleted a committed duplicate — and an index entry with no live row behind it
360
+ * is harmless (see the entry-resolution note in `buildIndexEntries`).
344
361
  */
345
- createIndex(db: Database, schemaName: string, tableName: string, indexSchema: TableIndexSchema): Promise<void>;
362
+ createIndex(db: Database, schemaName: string, tableName: string, indexSchema: TableIndexSchema, rows?: EffectiveRowSource): Promise<void>;
346
363
  /**
347
364
  * Drops an index on a store-backed table.
348
365
  *
@@ -355,11 +372,26 @@ export declare class StoreModule implements VirtualTableModule<StoreTable, Store
355
372
  /**
356
373
  * Build index entries for all existing rows in a table.
357
374
  *
375
+ * `dataEntries` is the row stream to index. Callers choose its visibility:
376
+ * `createIndex` passes the table's EFFECTIVE stream (committed + pending, so
377
+ * an open transaction's rows are indexed too), while `rebuildSecondaryIndexes`
378
+ * passes the raw committed stream — it runs immediately after an ALTER has
379
+ * re-encoded the data store in place, and any pending ops still address the
380
+ * pre-ALTER key bytes.
381
+ *
358
382
  * For UNIQUE indexes, performs an in-pass duplicate check (honoring partial
359
383
  * predicates and SQL NULL semantics: multiple NULLs are allowed) and throws
360
384
  * CONSTRAINT before any entries are written. Mirrors the memory module's
361
385
  * populateNewIndex so `CREATE UNIQUE INDEX` over duplicated data fails
362
- * atomically.
386
+ * atomically. `skipDuplicateCheck` suppresses it: `createIndex` sets it when a
387
+ * wrapper module supplied the rows to judge, having already validated them (see
388
+ * {@link validateUniqueIndexOverRows}). Judging `dataEntries` too would reject a
389
+ * committed duplicate the wrapper's transaction has already deleted.
390
+ *
391
+ * `normalizers` MUST be the owning connection's `db.getKeyNormalizerResolver()` —
392
+ * the same resolver `StoreTable.encodeOptions` carries. A rebuild that resolved
393
+ * collations any other way would re-encode the PK suffix under different bytes than
394
+ * the table writes at maintenance time, silently corrupting the index.
363
395
  */
364
396
  private buildIndexEntries;
365
397
  /**
@@ -370,35 +402,194 @@ export declare class StoreModule implements VirtualTableModule<StoreTable, Store
370
402
  * COLLATE` on a PK member (a PK column's key collation changes). Shared by both
371
403
  * arms so the clear-then-rebuild stays identical. `schema` must already be the
372
404
  * post-ALTER schema (its `primaryKeyDefinition` + column collations drive the new
373
- * PK-suffix encoding via {@link buildIndexEntries}).
405
+ * PK-suffix encoding via {@link buildIndexEntries}). `normalizers` is the owning
406
+ * connection's `db.getKeyNormalizerResolver()` — see {@link buildIndexEntries}.
407
+ *
408
+ * NOTE: reads the data store committed-only and writes the index stores outside the
409
+ * coordinator. Sound only because both callers (the two re-key arms) call
410
+ * {@link ddlCommitPendingOps} first, so "committed" is "everything live". A caller
411
+ * that skips that flush would rebuild an index missing its transaction's pending rows.
374
412
  */
375
413
  private rebuildSecondaryIndexes;
376
414
  /**
377
- * Validates the existing rows in `dataStore` against a UNIQUE constraint,
378
- * throwing `CONSTRAINT` on the first duplicate before any schema mutation.
379
- * Used by `ADD CONSTRAINT UNIQUE` (validate against the current collation) and
380
- * by `SET COLLATE` (pass an `updatedSchema` whose altered column carries the
381
- * NEW collation, so the dedup is performed under it). Mirrors the duplicate
382
- * detection in {@link buildIndexEntries}: a `seen` Set keyed on a per-column
383
- * collation-aware signature of the constrained values, with SQL NULL semantics
384
- * (a row with any NULL constrained value never counts as a duplicate) and the
385
- * partial `predicate` honored.
415
+ * Validates `rows` against a UNIQUE constraint, throwing `CONSTRAINT` on the first
416
+ * duplicate before any schema mutation. Used by `ADD CONSTRAINT UNIQUE` (validate
417
+ * against the current collation) and by `SET COLLATE` (pass an `updatedSchema` whose
418
+ * altered column carries the NEW collation, so the dedup is performed under it).
419
+ * Mirrors the duplicate detection in {@link buildIndexEntries}: a `seen` Set keyed on
420
+ * a per-column collation-aware signature of the constrained values, with SQL NULL
421
+ * semantics (a row with any NULL constrained value never counts as a duplicate) and
422
+ * the partial `predicate` honored.
423
+ *
424
+ * `rows` MUST be the rows the DDL-issuing connection can SEE. Ordinarily that is this
425
+ * table's EFFECTIVE stream (committed rows merged with the open transaction's own
426
+ * pending puts/deletes — `StoreTable.iterateEffectiveEntries`, adapted by
427
+ * {@link rowsFromEntries}); when a wrapper module holds the pending rows outside this
428
+ * module it hands them down as an `EffectiveRowSource` instead. Either way, a
429
+ * committed-only stream would let a duplicate inserted earlier in the same transaction
430
+ * slip past validation and land in the table once the transaction commits.
386
431
  *
387
432
  * No index store is written — store UNIQUE enforcement is a full-scan over
388
433
  * `uniqueConstraints` at write time. The signature is built by
389
- * {@link serializeRowKey} with one normalizer per constrained column drawn from
390
- * `tableSchema.columns[idx].collation`, so a per-column NOCASE/RTRIM collation
391
- * is honored (matching write-time `compareSqlValues` enforcement). Residual: a
392
- * custom comparator-only collation has no string normalizer and falls back to
393
- * BINARY for the dedup (see docs/schema.md store-collation note).
434
+ * {@link serializeRowKey} with one normalizer per constrained column, resolved from
435
+ * `tableSchema.columns[idx].collation` through the connection's
436
+ * `db.getKeyNormalizerResolver()`, so a per-column collation registered with
437
+ * `db.registerCollation` is honored (matching write-time `compareSqlValues`
438
+ * enforcement). A comparator-only collation raises: rows that cannot be bucketed
439
+ * cannot be deduped. Columns whose declared type can never hold text take the
440
+ * identity normalizer and so never raise.
394
441
  */
395
442
  private validateUniqueOverExistingRows;
396
443
  /**
397
- * Alters an existing store table's structure (ADD/DROP/RENAME COLUMN).
398
- * Performs eager row migration for ADD and DROP, schema-only update for RENAME.
399
- * Returns the updated TableSchema for the engine to register.
444
+ * Index-shaped twin of {@link validateUniqueOverExistingRows}, used by
445
+ * {@link createIndex} when a wrapper module supplies the rows to judge. Dedupes on the
446
+ * index's own columns under the index column's COLLATE (falling back to the table
447
+ * column's), so it enforces exactly what `buildIndexEntries`' suppressed in-pass check
448
+ * would have — over the wrapper's rows instead of this module's committed ones.
449
+ */
450
+ private validateUniqueIndexOverRows;
451
+ /**
452
+ * Flush the module's buffered writes before a DDL operation that physically
453
+ * rewrites or relocates storage.
454
+ *
455
+ * Such a DDL cannot honor the coordinator's buffer: pending ops are
456
+ * `(keyBytes, valueBytes, store)` triples computed at DML time under the
457
+ * PRE-DDL schema, and every physical rewrite (`StoreTable.rekeyRows` /
458
+ * `migrateRows`, the provider's directory move) reads and writes the COMMITTED
459
+ * store directly. Replaying stale-schema ops over the rewritten store on the
460
+ * eventual commit corrupts, loses, or misfiles those rows. So an `ALTER TABLE`
461
+ * that touches storage is effectively DDL-committing on a store-backed table:
462
+ * flush NOW, before the first physical read, so the rewrite sees every live row
463
+ * and there is nothing left to replay afterwards.
464
+ *
465
+ * Consequences, both deliberate:
466
+ * - The coordinator is module-wide, so this commits the WHOLE module
467
+ * transaction — every table's pending ops, not just the altered/renamed
468
+ * table's — in one all-or-nothing batch. An ALTER cannot half-commit some
469
+ * sibling tables.
470
+ * - Validation running AFTER this point (e.g. `rekeyRows`' duplicate-key pass,
471
+ * which must see pending rows because a pending insert can itself be the
472
+ * duplicate) throws with the enclosing transaction already flushed. The store
473
+ * stays unmutated — only the transaction is gone. Validation that does NOT
474
+ * need pending rows belongs before the call, so the transaction survives it.
475
+ *
476
+ * Subsequent `commit()` calls on the same coordinator are no-ops
477
+ * (`inTransaction` is cleared), which keeps the enclosing transaction safe.
478
+ * The savepoint stack is cleared too, so a later `ROLLBACK TO` / `RELEASE` that
479
+ * the engine still broadcasts warns and degrades rather than throwing — see
480
+ * `TransactionCoordinator.rollbackToSavepoint`, which mirrors the memory
481
+ * module's identical posture.
482
+ */
483
+ private ddlCommitPendingOps;
484
+ /**
485
+ * Alters an existing store table's structure. Resolves the table, captures the
486
+ * pre-alter schema, and dispatches to the per-change-type `alter*` helper below;
487
+ * the helper does the arm's work (row migration, physical re-key, constraint
488
+ * validation, DDL persist) and returns the updated TableSchema for the engine to
489
+ * register. The shared preamble (schema subscription, reconnect, not-found throw,
490
+ * `defaultNotNull`) lives here so every arm sees the same resolved state.
491
+ */
492
+ alterTable(db: Database, schemaName: string, tableName: string, change: SchemaChangeInfo, rows?: EffectiveRowSource): Promise<TableSchema>;
493
+ /**
494
+ * Build / tear down the physical index stores backing implicit UNIQUE indexes
495
+ * (`_uc_*`) after an ALTER, by diffing the implicit-index NAMES of the old vs new
496
+ * constraint sets:
497
+ * - a name newly PRESENT (ADD CONSTRAINT UNIQUE, or the target half of a
498
+ * RENAME CONSTRAINT / rename of an unnamed UC's column) has its physical store
499
+ * populated from this module's effective rows;
500
+ * - a name newly ABSENT (DROP CONSTRAINT UNIQUE, or the source half of a rename)
501
+ * has its store torn down, so a later re-ADD does not reopen stale entries.
502
+ *
503
+ * The SCHEMA entry itself is materialized/removed by `withImplicitUniqueIndexes`
504
+ * on the arm's `table.updateSchema`; only the physical store needs this. Runs after
505
+ * every ALTER but is a no-op whenever the implicit-index name set is unchanged
506
+ * (incl. PK / collation / data-type ALTERs, whose same-name physical re-encode is
507
+ * already done by {@link rebuildSecondaryIndexes}).
508
+ *
509
+ * `oldSchema` carries the pre-ALTER `uniqueConstraints` (its `.indexes` may be
510
+ * de-materialized — the diff reads `uniqueConstraints`, not `.indexes`).
511
+ *
512
+ * NOTE: the build populates from THIS module's own effective rows (committed + this
513
+ * transaction's pending), never a wrapper's — mirroring `createIndex`. Under the
514
+ * isolation layer the wrapper's rows are what ADD CONSTRAINT's validation judged;
515
+ * the physical index legitimately fills from this module's committed rows and an
516
+ * entry with no live row behind it is harmless (both readers resolve to the live
517
+ * row). Duplicates were already rejected by `validateUniqueOverExistingRows` (ADD)
518
+ * or cannot exist (RENAME leaves data unchanged), so the in-pass check is skipped.
519
+ */
520
+ private reconcileImplicitUniqueIndexStores;
521
+ /**
522
+ * The physical index-store names a table owns for DROP / RENAME TABLE to relocate
523
+ * or reclaim: the MATERIALIZED index set — every explicit `CREATE INDEX` PLUS the
524
+ * hidden `_uc_*` realizing each plain UNIQUE. Reading only `getSchema().indexes`
525
+ * (the engine-facing schema, which carries no `_uc_*`) would strand a `_uc_*` store
526
+ * on disk after DROP TABLE, and — worse — after RENAME TABLE leave the renamed
527
+ * table seeking a freshly-created EMPTY `_uc_*` store, silently accepting a
528
+ * duplicate of a pre-rename row. Prefers the cached StoreTable's own materialized
529
+ * schema; falls back to materializing the schema-manager copy when the instance is
530
+ * already gone.
531
+ */
532
+ private materializedIndexNames;
533
+ /** Close + delete the physical store of an implicit UNIQUE index. Mirrors `dropIndex`. */
534
+ private tearDownImplicitUniqueIndexStore;
535
+ /**
536
+ * ADD COLUMN arm of {@link alterTable}: append the new column, eagerly migrate
537
+ * each row (literal or per-row backfill), and persist. Behavior-preserving
538
+ * extraction of the former `switch` arm.
539
+ */
540
+ private alterAddColumn;
541
+ /** DROP COLUMN arm of {@link alterTable}: drop the column slot, reindex PK / indexes /
542
+ * UNIQUE, migrate rows, and persist. Behavior-preserving extraction. */
543
+ private alterDropColumn;
544
+ /** RENAME COLUMN arm of {@link alterTable}: schema-only rewrite (columns, indexes, self-FK,
545
+ * in-place predicate / CHECK AST rewrite) and persist. Behavior-preserving extraction. */
546
+ private alterRenameColumn;
547
+ /** ALTER PRIMARY KEY arm of {@link alterTable}: physically re-key the data store, rebuild
548
+ * secondary indexes, and persist. Behavior-preserving extraction. */
549
+ private alterPrimaryKeyChange;
550
+ /** ADD CONSTRAINT arm of {@link alterTable}: validate existing rows as the constraint kind
551
+ * (UNIQUE / FOREIGN KEY / CHECK) requires, then persist. Behavior-preserving extraction. */
552
+ private alterAddConstraint;
553
+ /** DROP CONSTRAINT arm of {@link alterTable}: schema-only catalog rewrite dropping a named
554
+ * constraint, then persist. Behavior-preserving extraction. */
555
+ private alterDropConstraint;
556
+ /** RENAME CONSTRAINT arm of {@link alterTable}: schema-only rename of a named constraint,
557
+ * then persist. A renamed named-UNIQUE changes its implicit `_uc_*` index name, so
558
+ * `reconcileImplicitUniqueIndexStores` (run after this arm) MOVES the physical store —
559
+ * tears down the old-named store and rebuilds the new-named one from effective rows. */
560
+ private alterRenameConstraint;
561
+ /** ALTER COLUMN arm of {@link alterTable}: change one attribute (NOT NULL / data type /
562
+ * default / collation), running the physical re-key + existing-row re-validation the
563
+ * collation / PK paths require, then persist. Behavior-preserving extraction. */
564
+ private alterColumnChange;
565
+ /**
566
+ * SET NOT NULL / DROP NOT NULL sub-branch of {@link alterColumnChange}. Returns the
567
+ * new column schema, or null when the column is already in the desired nullability
568
+ * (the pre-refactor `return oldSchema` no-op). The NULL-backfill probe and rewrite
569
+ * order (throw-only probe before {@link ddlCommitPendingOps}) is unchanged.
570
+ *
571
+ * `rows` is the wrapper-supplied effective row source (the isolation overlay). When present,
572
+ * the reject-vs-backfill decision scans it instead of `table.rowsWithNullAtIndex`: behind the
573
+ * isolation layer the issuer's pending inserts live in the wrapper's overlay, not this store,
574
+ * so the store's own count would miss them and wrongly accept the ALTER. The committed-store
575
+ * `mapRowsAtIndex` backfill is unchanged — the overlay-resident pending rows are the isolation
576
+ * layer's job (its overlay migration), this store only owns its committed rows.
577
+ */
578
+ private alterColumnSetNotNull;
579
+ /**
580
+ * SET DATA TYPE sub-branch of {@link alterColumnChange}. Returns the retyped column
581
+ * schema. When the physical type changes, a throw-only convert pass over the live
582
+ * rows precedes {@link ddlCommitPendingOps} and the rewrite — order unchanged.
400
583
  */
401
- alterTable(db: Database, schemaName: string, tableName: string, change: SchemaChangeInfo): Promise<TableSchema>;
584
+ private alterColumnSetDataType;
585
+ /**
586
+ * SET COLLATE sub-branch of {@link alterColumnChange}. Returns the recollated column
587
+ * schema with `collationChanged` set when the collation bytes actually change (a bare
588
+ * metadata flip keeps it false), or null when the column is already explicit in the
589
+ * desired collation (the pre-refactor `return oldSchema` no-op). Synchronous — no
590
+ * row scan happens here; the caller runs the re-validation / re-key the flag gates.
591
+ */
592
+ private alterColumnSetCollation;
402
593
  /**
403
594
  * Rename a store-backed table.
404
595
  *
@@ -410,6 +601,29 @@ export declare class StoreModule implements VirtualTableModule<StoreTable, Store
410
601
  * against the moved directories.
411
602
  */
412
603
  renameTable(db: Database, schemaName: string, oldName: string, newName: string): Promise<void>;
604
+ /**
605
+ * Second phase of a two-phase RENAME TABLE (see {@link renameTable}). The engine calls
606
+ * this at the END of ALTER TABLE ... RENAME TO — AFTER its `propagateTableRename` has
607
+ * rewritten every dependent object that named `oldName` and enqueued their corrective
608
+ * catalog writes onto {@link persistQueue}. `renameTable` deliberately left `oldName`'s
609
+ * catalog entry in place; here we drain those dependent writes to durability and only
610
+ * THEN drop the old entry. During the window both entries coexist on disk, so every
611
+ * dependent resolves against one of them and every intermediate catalog set rehydrates
612
+ * into a working database.
613
+ *
614
+ * The old-entry delete rides `persistQueue` behind the dependents' already-enqueued
615
+ * writes (FIFO), so it can only run after them, and the drain below awaits the whole
616
+ * chain. Errors are swallowed+logged (the {@link enqueuePersist} contract): a failed
617
+ * delete leaves the old entry present — a visible, droppable orphan, strictly safer
618
+ * than a dependent stranded against a vanished table.
619
+ *
620
+ * NOTE: full cross-table atomicity — bundling this old-entry delete together with every
621
+ * dependent rewrite into one `provider.beginAtomicBatch` commit — would eliminate even
622
+ * the transient two-entry window (and the physical-move orphan `renameTableStores`
623
+ * leaves), but only on atomic providers, and the dependent set is known only to the
624
+ * engine post-propagate. That is the atomic-provider hardening path; out of scope here.
625
+ */
626
+ finalizeRename(_db: Database, schemaName: string, oldName: string, _newName: string): Promise<void>;
413
627
  /**
414
628
  * Modern access planning interface.
415
629
  *
@@ -423,12 +637,48 @@ export declare class StoreModule implements VirtualTableModule<StoreTable, Store
423
637
  * (via `StoreTable.buildPKRangeBounds`) encodes the LT/LE/GT/GE bounds under the
424
638
  * same per-column key collations the data keys use and iterates that
425
639
  * seek-start/early-termination window. The window is a SUPERSET, so the post-fetch
426
- * row filter still reproduces the exact collation semantics and a comparator-only
427
- * collation with no byte encoder safely falls back to a full scan. Mirrors the
428
- * memory module's advertisement.
640
+ * row filter still reproduces the exact collation semantics. (A collation that cannot
641
+ * key at all never reaches a PK column: `StoreTable`'s constructor rejects it at DDL
642
+ * time.) Mirrors the memory module's advertisement.
643
+ *
644
+ * The seek/ordering claims are additionally gated on the key collation being
645
+ * ORDER-PRESERVING — byte order and comparator order must coincide, or the seek would
646
+ * under-fetch and the ordering advertisement would elide a Sort it must not. That gate
647
+ * needs the connection's collation registry, hence `db` is threaded down.
429
648
  */
430
- getBestAccessPlan(_db: Database, tableInfo: TableSchema, request: BestAccessPlanRequest): BestAccessPlanResult;
649
+ getBestAccessPlan(db: Database, tableInfo: TableSchema, request: BestAccessPlanRequest): BestAccessPlanResult;
431
650
  private computeBestAccessPlan;
651
+ /**
652
+ * Build the access plan for one secondary index against `request`, or null when
653
+ * the index is not usable for this predicate.
654
+ *
655
+ * Usable = a contiguous leading-prefix EQ on the index columns (an index seek /
656
+ * point), or a LT/LE/GT/GE range on the LEADING index column. These mirror the
657
+ * two windows {@link StoreTable.analyzeIndexAccess} can build.
658
+ *
659
+ * **Collation-safety guard against under-fetch.** The store's index-column
660
+ * window is encoded under the table key collation K, but `matchesFilters`
661
+ * compares under the COLUMN's declared collation. Marking a filter handled drops
662
+ * the residual Filter, so the K-window must be a guaranteed SUPERSET of the
663
+ * qualifying rows. That holds only when K is coarser-or-equal to the column's
664
+ * declared collation. To stay provably safe with minimal logic we mark the
665
+ * covered filters handled — setting `indexName` + `seekColumns` — only when every
666
+ * seek column is non-text, OR its declared collation equals K, OR (K = NOCASE
667
+ * while the column is BINARY, i.e. K strictly coarser). Otherwise we return a
668
+ * cost-only plan (cheaper cost, filters unhandled, residual retained — correct,
669
+ * just not sped up). K itself always keys: `StoreTable`'s constructor rejects a
670
+ * table whose key encoding would need a collation it cannot resolve to a normalizer.
671
+ *
672
+ * NOTE: the coarser-K relaxation is sound for EQUALITY only. A RANGE window equates
673
+ * memcmp of K-normalized bytes with C's comparator order, which a merely coarser K does
674
+ * not give — under K = NOCASE and C = BINARY, 'K' (U+212A) is `> 'z'` yet keys as 'k',
675
+ * before 'z'. So the range arm demands `C === K` *and* K's `orderPreserving` assertion,
676
+ * via the shared {@link keyOrderMatchesCollation}; `StoreTable.analyzeIndexAccess`
677
+ * declines the same windows, so the two decisions cannot disagree. The cost is that a
678
+ * default-K (NOCASE) table with an index on a plain BINARY text column loses its index
679
+ * RANGE seek and falls back to the cost-only plan; EQ seeks are unchanged.
680
+ */
681
+ private tryIndexAccessPlan;
432
682
  /**
433
683
  * Compute the PK-ordering advertisement for a scan-style plan. Returns the
434
684
  * `providesOrdering` / `monotonicOn` / `supportsAsofRight` fields for a plan
@@ -452,12 +702,19 @@ export declare class StoreModule implements VirtualTableModule<StoreTable, Store
452
702
  *
453
703
  * Returns an empty object when there is no PK (heap-only table) — without a
454
704
  * leading key column there is no natural emit order.
705
+ *
706
+ * Every claim here is about the PHYSICAL key-byte order the store iterates in, but the
707
+ * consumers of `providesOrdering` / `monotonicOn` reason in the columns' COLLATION order.
708
+ * `orderPreservingPrefix` (from {@link pkOrderPreservingPrefixLength}) is how many leading
709
+ * PK members those two orders provably agree on: the advertisement is truncated to that
710
+ * prefix, and voided entirely when even the leading member disagrees — otherwise the
711
+ * absorb-Sort rule would elide a Sort and hand the caller byte-ordered rows.
455
712
  */
456
713
  private buildPkOrderingAdvertisement;
457
714
  /**
458
715
  * Get or create a data store for a table.
459
716
  */
460
- getStore(tableKey: string, _config: StoreTableConfig): Promise<KVStore>;
717
+ getStore(schemaName: string, tableName: string, _config: StoreTableConfig): Promise<KVStore>;
461
718
  /**
462
719
  * Get or create an index store for a table.
463
720
  */
@@ -517,6 +774,16 @@ export declare class StoreModule implements VirtualTableModule<StoreTable, Store
517
774
  * the compare-write in `persistCatalogIfChanged` relies on.
518
775
  */
519
776
  private buildCatalogEntry;
777
+ /**
778
+ * Encode a bundle of persisted schema text (DDL) for the catalog store.
779
+ *
780
+ * Guards the FULL text, not just the object's name: a lone surrogate anywhere in it — a
781
+ * quoted column name, a `default '…'` string literal, a `check` constraint's string
782
+ * constant — would otherwise fold to U+FFFD under `TextEncoder` and read back as
783
+ * different schema text than what was created. This does not rely on the catalog-key
784
+ * builders' identifier guard having already caught it; it catches it independently.
785
+ */
786
+ private encodeCatalogDDL;
520
787
  /**
521
788
  * Save table DDL (bundled with its secondary index DDL) to the catalog store.
522
789
  */
@@ -1 +1 @@
1
- {"version":3,"file":"store-module.d.ts","sourceRoot":"","sources":["../../../src/common/store-module.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EACX,QAAQ,EAER,WAAW,EACX,gBAAgB,EAEhB,kBAAkB,EAClB,gBAAgB,EAChB,qBAAqB,EACrB,oBAAoB,EAGpB,kBAAkB,EAClB,gBAAgB,EAEhB,MAAM,EACN,oBAAoB,EAEpB,UAAU,EACV,qBAAqB,EACrB,WAAW,EACX,sBAAsB,EACtB,MAAM,kBAAkB,CAAC;AAI1B,OAAO,KAAK,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAE1D,OAAO,EAAE,UAAU,EAA0B,KAAK,gBAAgB,EAAE,KAAK,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAoBpH;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IACjC,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,MAAM,EAAE,gBAAgB,EAAE,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,KAAK,CAAC;CACb;AAED;;;;;;GAMG;AACH,MAAM,MAAM,sBAAsB,GAAG,CACpC,EAAE,EAAE,QAAQ,EACZ,iBAAiB,EAAE,MAAM,EACzB,QAAQ,EAAE,sBAAsB,KAC5B,IAAI,GAAG,OAAO,CAA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