@bjornpagen/bumbledb 0.11.0 → 0.12.2

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.
@@ -15,9 +15,9 @@
15
15
  * SETS — no order or limit exists anywhere; hosts sort. The `Prepared`
16
16
  * VALUE itself (no lifecycle, GC-reclaimed plan) lives in `#db.ts`.
17
17
  */
18
- import type { FactValue, QueryParam } from "#native.ts";
19
- import type { FindColumn } from "#query/atom.ts";
20
- import type { ParamEntry } from "#query/scope.ts";
18
+ import type { FactValue, QueryParam } from "../native.js";
19
+ import type { FindColumn } from "./atom.js";
20
+ import type { ParamEntry } from "./scope.js";
21
21
  /**
22
22
  * Marshals the typed params object to the bridge's positional arguments,
23
23
  * in registry order (= the lowering's dense `ParamId`s). A missing entry
@@ -29,11 +29,11 @@
29
29
  * {@link JoinOk} with its runtime twin {@link fieldJoins}, and the
30
30
  * record-folding helpers `Params` and `Row` inference ride.
31
31
  */
32
- import type { AnyClosed } from "#closed.ts";
33
- import type { AnyField, Infer } from "#fields.ts";
34
- import type { ClassLookup, ClassRecordOf, SchemaClasses } from "#law.ts";
35
- import type { QueryParam } from "#native.ts";
36
- import type { AnyRelation, RelationFields } from "#relation.ts";
32
+ import type { AnyClosed } from "../closed.js";
33
+ import type { AnyField, Infer } from "../fields.js";
34
+ import type { ClassLookup, ClassRecordOf, SchemaClasses } from "../law.js";
35
+ import type { QueryParam } from "../native.js";
36
+ import type { AnyRelation, RelationFields } from "../relation.js";
37
37
  /**
38
38
  * The runtime discriminant of query term values. Host literals (bigints,
39
39
  * strings, interval objects) never carry it, so "is this position a term
@@ -12,12 +12,21 @@
12
12
  * fields are optional on insert input (omit-to-mint) and present on read
13
13
  * (resupply-to-preserve-identity), typed exactly.
14
14
  */
15
- import { type AnyField, type Infer } from "#fields.ts";
16
- import { type LiteralSetSpec } from "#spec.ts";
15
+ import { type AnyField, type Infer } from "./fields.js";
16
+ import { type LiteralSetSpec } from "./spec.js";
17
17
  /** Flattens an intersection into one displayed object type (hover legibility). */
18
18
  type Flatten<T> = {
19
19
  [K in keyof T]: T[K];
20
20
  };
21
+ /**
22
+ * An optional property that may be omitted OR explicitly `undefined`.
23
+ * `Partial<T>` under `exactOptionalPropertyTypes` is omit-only (`key?: T`),
24
+ * which rejects `key: T | undefined` — insert must accept both (omit-to-mint,
25
+ * and a host binding that is already `bigint | undefined`).
26
+ */
27
+ type ExactOptional<T> = {
28
+ [K in keyof T]?: T[K] | undefined;
29
+ };
21
30
  /**
22
31
  * Resolves a whole `where()` selection against the declared fields, in the
23
32
  * selection's written order (macro parity: σ is spelled, not sorted). An
@@ -99,9 +108,10 @@ type FreshKeys<R extends AnyRelation> = {
99
108
  /**
100
109
  * The inferred row object type of a relation as INSERTED: fresh fields
101
110
  * optional — omitted, the engine mints; supplied, identity is preserved
102
- * (the ETL resupply idiom).
111
+ * (the ETL resupply idiom). Explicit `undefined` is the same as omit
112
+ * (`exactOptionalPropertyTypes`: `id?: bigint | undefined`, not omit-only).
103
113
  */
104
- type InsertFact<R extends AnyRelation> = Flatten<Omit<Fact<R>, FreshKeys<R>> & Partial<Pick<Fact<R>, FreshKeys<R>>>>;
114
+ type InsertFact<R extends AnyRelation> = Flatten<Omit<Fact<R>, FreshKeys<R>> & ExactOptional<Pick<Fact<R>, FreshKeys<R>>>>;
105
115
  /**
106
116
  * Declares one relation: `relation("Account", { id: u64.fresh,
107
117
  * holder: u64, kind: Kind.id, ... })` — every field is a pure-structure
@@ -1 +1 @@
1
- {"version":3,"file":"relation.d.ts","sourceRoot":"","sources":["../src/relation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,EAAE,KAAK,QAAQ,EAAsD,KAAK,KAAK,EAAa,MAAM,YAAY,CAAA;AACrH,OAAO,EAAE,KAAK,cAAc,EAAmC,MAAM,UAAU,CAAA;AAE/E,kFAAkF;AAClF,KAAK,OAAO,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAA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M,CAAC,GAAG,CAAC,YAAY,IAAI,qDAAqD,CAAC,CAAA;QACxF,CAAC;QACD,OAAO,MAAM,CAAC,MAAM,CAAC;YACpB,QAAQ,EAAE,KAAK;YACf,SAAS,EAAE,gBAAgB,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;SACrE,CAAC,CAAA;IACH,CAAC;IACD,MAAM,KAAK,GAA2B,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAA;IAC1E,MAAM,CAAC,KAAK,GAAG,KAAK,CAAA;IACpB,OAAO,KAAK,CAAA;AACb,CAAC;AAiBD,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,CAAA"}
package/dist/schema.d.ts CHANGED
@@ -8,10 +8,10 @@
8
8
  * DELIBERATELY left to the engine's `SchemaError` at `Db.create` — the
9
9
  * same judge, the same two-boundary split as Rust.
10
10
  */
11
- import type { AnyClosed } from "#closed.ts";
12
- import { type ClassesOf, type LawfulStatements, type SchemaClasses } from "#law.ts";
13
- import type { AnyRelation } from "#relation.ts";
14
- import { type Statement } from "#statements.ts";
11
+ import type { AnyClosed } from "./closed.js";
12
+ import { type ClassesOf, type LawfulStatements, type SchemaClasses } from "./law.js";
13
+ import type { AnyRelation } from "./relation.js";
14
+ import { type Statement } from "./statements.js";
15
15
  /** One member of a schema's relation record. */
16
16
  type SchemaRelation = AnyRelation | AnyClosed;
17
17
  /** The relation record a schema is generic over — what `Db` and queries key on. */
@@ -33,10 +33,10 @@
33
33
  * `Db.create`/`Db.open` (the two-boundary split, engine as final
34
34
  * authority).
35
35
  */
36
- import { type BoundsOnTarget, type CapacityWeight, type CapacityWindow, type UnitDimensionBan, type UnitWindowBan, type WeightOnSource } from "#capacity.ts";
37
- import { type AnyFace, type FaceData, type SameArity, type SameShapes } from "#face.ts";
38
- import type { AnyRelation, RelationFields } from "#relation.ts";
39
- import { type CapacityWindowSpec, type WeightSpec } from "#spec.ts";
36
+ import { type BoundsOnTarget, type CapacityWeight, type CapacityWindow, type UnitDimensionBan, type UnitWindowBan, type WeightOnSource } from "./capacity.js";
37
+ import { type AnyFace, type FaceData, type SameArity, type SameShapes } from "./face.js";
38
+ import type { AnyRelation, RelationFields } from "./relation.js";
39
+ import { type CapacityWindowSpec, type WeightSpec } from "./spec.js";
40
40
  /** A `key()` statement's runtime description — owner and projection carried at exact types. */
41
41
  interface KeyData<R extends AnyRelation, Projection extends readonly string[]> {
42
42
  readonly kind: "key";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bjornpagen/bumbledb",
3
- "version": "0.11.0",
3
+ "version": "0.12.2",
4
4
  "description": "Type-theoretic TypeScript SDK for the bumbledb embedded relational engine",
5
5
  "type": "module",
6
6
  "exports": {
@@ -12,7 +12,8 @@
12
12
  "imports": {
13
13
  "#test/*.ts": "./test/*.ts",
14
14
  "#*.ts": {
15
- "types": "./src/*.ts",
15
+ "bumbledb-src": "./src/*.ts",
16
+ "types": "./dist/*.d.ts",
16
17
  "default": "./dist/*.js"
17
18
  }
18
19
  },
@@ -53,7 +54,7 @@
53
54
  },
54
55
  "private": false,
55
56
  "optionalDependencies": {
56
- "@bjornpagen/bumbledb-darwin-arm64": "0.11.0"
57
+ "@bjornpagen/bumbledb-darwin-arm64": "0.12.2"
57
58
  },
58
59
  "scripts": {
59
60
  "build": "node scripts/build.ts",
package/src/db.ts CHANGED
@@ -100,56 +100,88 @@ interface OffendingFact<Rels extends SchemaRelations> {
100
100
  }
101
101
 
102
102
  /**
103
- * One violated statement of a rejected commit, as a typed value.
104
- * `statement` is the IDENTICAL SDK statement value the schema declared —
105
- * consumers `===`-match it against their own constants; it is `undefined`
106
- * exactly for the engine-materialized fresh-implied and closed auto-keys,
107
- * which have no declared spelling (`schema()` rejects an explicit
108
- * duplicate of them). `canonical` is the ENGINE's rendering of the
109
- * violated materialized statement — for a `mirrors` statement BOTH
110
- * materialized slots render as the one `==` utterance in the written
111
- * orientation (identical strings; the engine's `render.rs` renders each
112
- * partner of a mirrored pair as the `==` spelling, never a bare `<=`
113
- * direction). `direction` (`sourceUnsatisfied` | `targetRequired`) and
114
- * `measure` are the containment/capacity form payloads, passed through
115
- * from the engine VERBATIM (`measure` the capacity form's witnessed group
116
- * total — u128-wide, crossing whole as bigint, C3) `direction` is
117
- * relative to the violated SLOT's
118
- * own orientation, so for a `mirrors` statement it alone cannot say which
119
- * side of the `==` was violated: the slot identity is carried by
120
- * `orientation`, present exactly for `mirrors` slots — `written` is the
121
- * `source <= target` slot as the statement was spelled, `mirrored` the
122
- * engine-materialized `target <= source` partner.
103
+ * Shared body of every violation arm: the engine's canonical rendering and
104
+ * the cited facts. `statement` is NOT here its presence is the
105
+ * discriminant. Implied auto-keys have no SDK spelling (`statement` is
106
+ * the value `undefined`); every declared form carries the IDENTICAL
107
+ * statement value the schema declared (consumers `===`-match it).
108
+ */
109
+ type ViolationBody<Rels extends SchemaRelations> = {
110
+ readonly canonical: string
111
+ readonly facts: readonly OffendingFact<Rels>[]
112
+ }
113
+
114
+ /**
115
+ * A functionality violation of an engine-materialized fresh-implied or
116
+ * closed auto-key. These slots have no declared spelling (`schema()`
117
+ * rejects an explicit duplicate); `statement` is present and `undefined`.
118
+ */
119
+ type ImpliedKeyViolation<Rels extends SchemaRelations> = ViolationBody<Rels> & {
120
+ readonly kind: "functionality"
121
+ readonly statement: undefined
122
+ }
123
+
124
+ /**
125
+ * A functionality violation of a declared `key()` statement. `statement`
126
+ * is the IDENTICAL SDK value the schema declared.
127
+ */
128
+ type DeclaredKeyViolation<Rels extends SchemaRelations> = ViolationBody<Rels> & {
129
+ readonly kind: "functionality"
130
+ readonly statement: Statement
131
+ }
132
+
133
+ /**
134
+ * A containment violation of a declared `contained()` statement (no
135
+ * `orientation` — that property exists exactly on {@link MirrorViolation}).
136
+ */
137
+ type ContainmentViolation<Rels extends SchemaRelations> = ViolationBody<Rels> & {
138
+ readonly kind: "containment"
139
+ readonly statement: Statement
140
+ readonly direction: "sourceUnsatisfied" | "targetRequired"
141
+ }
142
+
143
+ /**
144
+ * A containment violation of one slot of a declared `mirrors()` statement.
145
+ * BOTH materialized slots render as the one `==` utterance in the written
146
+ * orientation (identical `canonical` strings; the engine's `render.rs`
147
+ * never emits a bare `<=` for a mirrored pair). `direction` is relative
148
+ * to the violated SLOT's own orientation, so it alone cannot say which
149
+ * side of the `==` was violated: `written` is the `source <= target` slot
150
+ * as the statement was spelled, `mirrored` the engine-materialized
151
+ * `target <= source` partner.
152
+ */
153
+ type MirrorViolation<Rels extends SchemaRelations> = ViolationBody<Rels> & {
154
+ readonly kind: "containment"
155
+ readonly statement: Statement
156
+ readonly direction: "sourceUnsatisfied" | "targetRequired"
157
+ readonly orientation: "written" | "mirrored"
158
+ }
159
+
160
+ /**
161
+ * A capacity violation of a declared `capacity()` statement. `measure` is
162
+ * the engine's witnessed group total — u128-wide, crossing whole as
163
+ * bigint (C3: truncation is unrepresentable).
164
+ */
165
+ type CapacityViolation<Rels extends SchemaRelations> = ViolationBody<Rels> & {
166
+ readonly kind: "capacity"
167
+ readonly statement: Statement
168
+ readonly measure: bigint
169
+ }
170
+
171
+ /**
172
+ * One violated statement of a rejected commit, as a typed value. The
173
+ * arms are a true discriminant: `statement === undefined` is exactly the
174
+ * implied-auto-key arm; every declared form carries `Statement` (not
175
+ * `Statement | undefined`, not an omit-optional). `canonical` is the
176
+ * ENGINE's rendering. `direction` / `measure` pass through from the
177
+ * engine VERBATIM.
123
178
  */
124
179
  type Violation<Rels extends SchemaRelations> =
125
- | {
126
- readonly kind: "functionality"
127
- readonly statement?: Statement
128
- readonly canonical: string
129
- readonly facts: readonly OffendingFact<Rels>[]
130
- }
131
- | {
132
- readonly kind: "containment"
133
- readonly statement?: Statement
134
- readonly canonical: string
135
- readonly direction: "sourceUnsatisfied" | "targetRequired"
136
- readonly facts: readonly OffendingFact<Rels>[]
137
- }
138
- | {
139
- readonly kind: "containment"
140
- readonly statement?: Statement
141
- readonly canonical: string
142
- readonly direction: "sourceUnsatisfied" | "targetRequired"
143
- readonly orientation: "written" | "mirrored"
144
- readonly facts: readonly OffendingFact<Rels>[]
145
- }
146
- | {
147
- readonly kind: "capacity"
148
- readonly statement?: Statement
149
- readonly canonical: string
150
- readonly measure: bigint
151
- readonly facts: readonly OffendingFact<Rels>[]
152
- }
180
+ | ImpliedKeyViolation<Rels>
181
+ | DeclaredKeyViolation<Rels>
182
+ | ContainmentViolation<Rels>
183
+ | MirrorViolation<Rels>
184
+ | CapacityViolation<Rels>
153
185
 
154
186
  /**
155
187
  * The abandoned arm of a write result (ruled 2026-07-23, R10): present in
@@ -451,18 +483,28 @@ interface PrimaryKey {
451
483
  }
452
484
 
453
485
  /**
454
- * One materialized-statement slot as the SDK mirrors it: the form tag, the
455
- * SDK statement value that lowered to it (`undefined` for the
456
- * engine-materialized implied keys), and for functionality forms — the
457
- * key's owner and projection (what keyed point reads resolve through).
486
+ * One materialized-statement slot as the SDK mirrors it. Implied auto-keys
487
+ * omit `statement` (the engine owns those slots); every declared form
488
+ * carries the SDK value that lowered to it. Functionality forms also
489
+ * carry the key's owner and projection (what keyed point reads resolve
490
+ * through).
458
491
  */
492
+ type ImpliedKeyEntry = {
493
+ readonly kind: "functionality"
494
+ readonly owner: string
495
+ readonly projection: readonly string[]
496
+ }
497
+
498
+ type DeclaredKeyEntry = {
499
+ readonly kind: "functionality"
500
+ readonly statement: Statement
501
+ readonly owner: string
502
+ readonly projection: readonly string[]
503
+ }
504
+
459
505
  type StatementEntry =
460
- | {
461
- readonly kind: "functionality"
462
- readonly statement?: Statement
463
- readonly owner: string
464
- readonly projection: readonly string[]
465
- }
506
+ | ImpliedKeyEntry
507
+ | DeclaredKeyEntry
466
508
  | { readonly kind: "containment"; readonly statement: Statement }
467
509
  | { readonly kind: "mirrors"; readonly statement: Statement; readonly orientation: "written" | "mirrored" }
468
510
  | { readonly kind: "capacity"; readonly statement: Statement }
@@ -841,16 +883,24 @@ function openDb<Rels extends SchemaRelations>(handle: DbHandle, theory: Schema<R
841
883
  throw errors.new(`bumbledb violation cites unknown statement id ${wire.statementId}`)
842
884
  }
843
885
  const facts = Object.freeze(wire.facts.map(offendingFactOf))
844
- const statement = entry.statement
845
886
  const canonical = wire.canonical
846
887
  if (entry.kind === "functionality") {
847
- return Object.freeze({ kind: "functionality", statement, canonical, facts })
888
+ if (!("statement" in entry)) {
889
+ return Object.freeze({ kind: "functionality", statement: undefined, canonical, facts })
890
+ }
891
+ return Object.freeze({ kind: "functionality", statement: entry.statement, canonical, facts })
848
892
  }
849
893
  if (entry.kind === "capacity") {
850
894
  if (wire.kind !== "capacity") {
851
895
  throw errors.new(`bumbledb violation ${wire.statementId} is a capacity slot without a measure`)
852
896
  }
853
- return Object.freeze({ kind: "capacity", statement, canonical, measure: wire.measure, facts })
897
+ return Object.freeze({
898
+ kind: "capacity",
899
+ statement: entry.statement,
900
+ canonical,
901
+ measure: wire.measure,
902
+ facts
903
+ })
854
904
  }
855
905
  if (wire.kind !== "containment") {
856
906
  throw errors.new(`bumbledb violation ${wire.statementId} is a containment slot without a direction`)
@@ -858,14 +908,20 @@ function openDb<Rels extends SchemaRelations>(handle: DbHandle, theory: Schema<R
858
908
  if (entry.kind === "mirrors") {
859
909
  return Object.freeze({
860
910
  kind: "containment",
861
- statement,
911
+ statement: entry.statement,
862
912
  canonical,
863
913
  direction: wire.direction,
864
914
  orientation: entry.orientation,
865
915
  facts
866
916
  })
867
917
  }
868
- return Object.freeze({ kind: "containment", statement, canonical, direction: wire.direction, facts })
918
+ return Object.freeze({
919
+ kind: "containment",
920
+ statement: entry.statement,
921
+ canonical,
922
+ direction: wire.direction,
923
+ facts
924
+ })
869
925
  }
870
926
 
871
927
  /**
@@ -877,7 +933,7 @@ function openDb<Rels extends SchemaRelations>(handle: DbHandle, theory: Schema<R
877
933
  */
878
934
  function declaredKeyOf(relation: AnyRelation, statement: Statement): PrimaryKey {
879
935
  const statementId = tables.statements.findIndex(function byIdentity(candidate) {
880
- return candidate.statement === statement
936
+ return "statement" in candidate && candidate.statement === statement
881
937
  })
882
938
  const entry = tables.statements[statementId]
883
939
  if (entry === undefined) {
@@ -1466,9 +1522,14 @@ const Db = Object.freeze({
1466
1522
  export type {
1467
1523
  Abandon,
1468
1524
  AbandonedArm,
1525
+ CapacityViolation,
1526
+ ContainmentViolation,
1469
1527
  DeclaredKeyFact,
1528
+ DeclaredKeyViolation,
1470
1529
  DeltaBuild,
1530
+ ImpliedKeyViolation,
1471
1531
  MemberRelation,
1532
+ MirrorViolation,
1472
1533
  OffendingFact,
1473
1534
  Prepared,
1474
1535
  ReadScope,
package/src/index.ts CHANGED
@@ -7,13 +7,13 @@
7
7
  * statement algebra with `schema()` and `SchemaSpec` lowering (PRD-06), the `Db`
8
8
  * runtime (exclusive-lock stores, transactions, typed violations, scoped
9
9
  * snapshot reads, one-shot `write`/`writeFrom` with `abandon` — PRD-07, zero
10
- * closables), the query surface (Datalog as values, kysely-shaped:
10
+ * closables), the query surface (kysely-shaped:
11
11
  * `query(S).rule(r => { const { id, name } = v(Holder); return r.match(Holder, { id, name }).find({ name }) })` —
12
12
  * variables minted by `v()` and joined by OBJECT REFERENCE (reuse is the
13
13
  * join), the head a `find` RECORD whose keys name the answer columns
14
14
  * (renames are real), params still STRING-named, plus negation,
15
15
  * conditions, aggregates, and interiors / one linear rec via
16
- * `q.interior` / `q.recursive` —
16
+ * `q.interior` / `q.reach` —
17
17
  * `db.prepare` as a plain value; the comparison/connective builders are
18
18
  * also free exports, and the free names `eq`/`not`/`and`/`or` collide with
19
19
  * common host identifiers — import aliasing is the answer; the SDK does
@@ -51,9 +51,14 @@ export { closed } from "#closed.ts"
51
51
  export type {
52
52
  Abandon,
53
53
  AbandonedArm,
54
+ CapacityViolation,
55
+ ContainmentViolation,
54
56
  DeclaredKeyFact,
57
+ DeclaredKeyViolation,
55
58
  DeltaBuild,
59
+ ImpliedKeyViolation,
56
60
  MemberRelation,
61
+ MirrorViolation,
57
62
  OffendingFact,
58
63
  Prepared,
59
64
  ReadScope,
@@ -132,6 +137,7 @@ export type {
132
137
  Query,
133
138
  QueryData,
134
139
  QueryParams,
140
+ QueryReachStart,
135
141
  QueryRelation,
136
142
  QueryRow,
137
143
  QueryRuleChain,
package/src/native.ts CHANGED
@@ -73,14 +73,23 @@ type QueryParam = TaggedValue | { readonly kind: "set"; readonly values: readonl
73
73
  /**
74
74
  * The IR mirror (`bumbledb::ir`, 1:1): relations, fields, interiors, and
75
75
  * params by NUMERIC id — the SDK resolves names through the manifest and
76
- * sends ids; the bridge never sees names in queries.
76
+ * sends ids; the bridge never sees names in queries. Q1 is a tagged sum:
77
+ * CQ carries no rec; Reach carries `rec` by value.
77
78
  */
78
- interface QueryIr {
79
- readonly interiors: readonly InteriorIr[]
80
- readonly rec: RecIr | null
81
- readonly head: readonly HeadTermIr[]
82
- readonly rules: readonly RuleIr[]
83
- }
79
+ type QueryIr =
80
+ | {
81
+ readonly kind: "cq"
82
+ readonly interiors: readonly InteriorIr[]
83
+ readonly head: readonly HeadTermIr[]
84
+ readonly rules: readonly RuleIr[]
85
+ }
86
+ | {
87
+ readonly kind: "reach"
88
+ readonly interiors: readonly InteriorIr[]
89
+ readonly rec: RecIr
90
+ readonly head: readonly HeadTermIr[]
91
+ readonly rules: readonly RuleIr[]
92
+ }
84
93
 
85
94
  /** One named interior: the head shape its rules align against, and the rules. */
86
95
  interface InteriorIr {
@@ -88,7 +97,7 @@ interface InteriorIr {
88
97
  readonly rules: readonly RuleIr[]
89
98
  }
90
99
 
91
- /** The optional linear rec: shared head, base arms, rec arms. */
100
+ /** The linear rec on a Reach query: shared head, base arms, rec arms. */
92
101
  interface RecIr {
93
102
  readonly head: readonly HeadTermIr[]
94
103
  readonly base: readonly RuleIr[]
package/src/query/atom.ts CHANGED
@@ -207,7 +207,7 @@ interface RecHead {
207
207
  }
208
208
 
209
209
  /**
210
- * The optional linear rec's runtime description — identity keys the dense
210
+ * The linear rec's runtime description — identity keys the dense
211
211
  * `InteriorId` (`interiors.length`) at lowering. Base and rec arms are
212
212
  * nonempty by type and sealed in one assignment.
213
213
  */