Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/adr/0021-analytics-dataset-semantic-layer.md
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ The ADR's `DatasetSchema` / `DimensionSchema` / `MeasureSchema` are all taken: `

- **Rendering is in the sibling repo `objectui`**, not here — Dashboard/Report renderers, `useReportData`, builders, the `data-objectstack` adapter. Any field change is a **two-repo change** + a `.objectui-sha` bump.
- **`ReportSchema` (pivot) has no runtime executor** — `plugin-reports` is a separate saved-query/CSV emailer; pivoting happens entirely client-side in `useReportData.ts`.
- **Registration touches 4 surfaces**, not 1: `kernel/metadata-type-schemas.ts`, `kernel/metadata-plugin.zod.ts` (enum + `DEFAULT_METADATA_TYPE_REGISTRY`, `loadOrder` < report/dashboard), `shared/metadata-collection.zod.ts` (`MAP_SUPPORTED_FIELDS` + `PLURAL_TO_SINGULAR`), `objectql/engine.ts` `metadataArrayKeys` (**two** lists, L806 + L961).
- **Registration touches 4 surfaces**, not 1: `kernel/metadata-type-schemas.ts`, `kernel/metadata-plugin.zod.ts` (enum + `DEFAULT_METADATA_TYPE_REGISTRY`, `loadOrder` < report/dashboard), `shared/metadata-collection.zod.ts` (`MAP_SUPPORTED_FIELDS` + `PLURAL_TO_SINGULAR`), `objectql/engine.ts` `metadataArrayKeys` (**two** lists).
- **Migration scope:** 7 reports (2 files) + 64 widgets (4 files; heaviest `chart-gallery.dashboard.ts` = 38) + 2 chart-views (2 files) = **8 source files, two inline shapes**. Tests to rewrite: `view.test.ts` (214) + `dashboard.test.ts` (146) + `report.test.ts` (51) + `report-service.test.ts` + `view-expand.test.ts` + 3 example integration tests. No JSON/seed instance data. JSON-schema regenerates via `pnpm gen:schema`.

### Resolved decisions (gate everything) — decided 2026-05-31 on the AI-author / human-review criterion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ better-sqlite3** with a **single-connection pool** (SQLite is single-writer).

`engine.transaction()` threads the open transaction into the driver options of
the *top-level* write via `buildDriverOptions` (`engine.ts`, which even warns
about this deadlock around L1811). But internal reads/writes performed **during**
about this deadlock). But internal reads/writes performed **during**
a write — FK / reference checks, hook `api` calls, any helper query — do **not**
all reuse the transaction's connection. Such a query asks the pool for a
connection, the pool is exhausted (the transaction holds the only one), and it
Expand All @@ -54,11 +54,11 @@ that transaction's connection.

- `driver-sql` already has the right *local* pattern for nested work:
`getNextSequenceValue` uses `runner = parentTrx ?? this.knex` and opens a
savepoint on the parent transaction (`sql-driver.ts` L561-563). The gap is
savepoint on the parent transaction (`sql-driver.ts`). The gap is
that this discipline isn't applied *globally* to every engine→driver call.
- `driver-sql` already implements a **persistent, atomic sequence**
(`SEQUENCES_TABLE` + `getNextSequenceValue` with `forUpdate` + seed-from-max,
L548-600). See "Autonumber (#1603)" below — this is mostly already solved at
(`SEQUENCES_TABLE` + `getNextSequenceValue` with `forUpdate` + seed-from-max).
See "Autonumber (#1603)" below — this is mostly already solved at
the driver level.

---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Sources: `packages/triggers/trigger-record-change/src/record-change-trigger.ts`
ObjectQL has an ambient-transaction store (ADR-0034, `AsyncLocalStorage` in `objectql/src/engine.ts`). Within an unbroken async chain on the same engine, internal data ops *inherit* the open transaction. One might therefore hope a before-flow's CRUD nodes join the triggering write's transaction. They do not, for two compounding reasons:

1. **Errors are swallowed before they can roll anything back.** The trigger's `try/catch` is the outermost frame around the flow; a failing flow write never propagates to the transaction boundary, so rollback is structurally impossible — independent of ALS.
2. **The flow path does not thread the transaction explicitly**, and ALS is fragile here: it does **not** survive `setImmediate`/deferred-promise boundaries (the documented sandbox-runner limitation in `engine.ts`, ~L3217). Any atomicity would be *accidental* (inline before-path only) and *untested* — not a guarantee an author may rely on.
2. **The flow path does not thread the transaction explicitly**, and ALS is fragile here: it does **not** survive `setImmediate`/deferred-promise boundaries (the documented sandbox-runner limitation in `engine.ts`). Any atomicity would be *accidental* (inline before-path only) and *untested* — not a guarantee an author may rely on.

The net is a **silent** contract violation: an author who writes a before-flow to normalize a field or block a save gets a flow that runs, changes nothing on the triggering record, cannot stop the write, and reports success. Nothing fails; the wrong thing just quietly happens.

Expand Down
Loading