@objectstack/lint 17.0.0 → 17.2.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.
@@ -35,7 +35,13 @@ interface AuthoringFinding {
35
35
  rule: string;
36
36
  /** Human-readable location, e.g. `object "leave_request"`. */
37
37
  where: string;
38
- /** Config path, e.g. `objects[3].sharingModel`. */
38
+ /**
39
+ * Config path, e.g. `objects[3].sharingModel`. Positional as RULES emit it;
40
+ * on the runtime gate's wire surface the top-level collection index of a
41
+ * collection-resident finding is rewritten to the entry's NAME
42
+ * (`objects.acme_invoice.sharingModel`) — see `nameKeyFindingPath` in
43
+ * `runtime-gate.ts` (#10064).
44
+ */
39
45
  path: string;
40
46
  /** What is wrong. */
41
47
  message: string;
@@ -117,6 +123,19 @@ type AuthoringRuleInputTier = 'normalized' | 'parsed';
117
123
  interface AuthoringRuleContext {
118
124
  /** ADR-0080 SDUI component manifest, when the project ships one. */
119
125
  sduiManifest?: unknown;
126
+ /**
127
+ * [#9313] The singular metadata type of the per-write snapshot being judged
128
+ * — set by the runtime publish gate (`runtime-gate.ts`) on every gated
129
+ * write, ABSENT on the three CLI commands (`runAuthoringRules` never sets
130
+ * it). Exists for the one entry that is itself a registry: the
131
+ * reference-integrity suite dispatches its MEMBERS by this
132
+ * (`ReferenceIntegrityRule.runtimeTypes`), because the entry-level
133
+ * `runtimeTypes` can only say which writes reach the suite, not which
134
+ * members can judge a partial per-write snapshot without inventing
135
+ * findings. No other rule reads it, and none should without the same
136
+ * argument.
137
+ */
138
+ runtimeWriteType?: string;
120
139
  }
121
140
  interface AuthoringRule {
122
141
  /** The exported function's name — the id the wiring guard asserts on. */
@@ -252,7 +271,8 @@ type AnyRec = Record<string, unknown>;
252
271
  * from this shape and keeps the two from drifting. The set is deliberately
253
272
  * BOUNDED to what the runtime-wired rules actually read (measured, not
254
273
  * projected): the three cross-collection security rules compare
255
- * objects × permissions × books, and nothing on the runtime surface reads
274
+ * objects × permissions × books, `validateWidgetBindings` resolves widget
275
+ * bindings against datasets (#7529), and nothing on the runtime surface reads
256
276
  * `positions` / `apps` — so those are NOT carried. Widening the snapshot is a
257
277
  * one-key edit here plus a `CONTEXT_STACK_KEYS` entry, made when a rule that
258
278
  * reads the collection actually crosses the wall, never in advance.
@@ -288,7 +308,81 @@ interface RuntimeStackContext {
288
308
  * the differential for every other write type.
289
309
  */
290
310
  books?: readonly unknown[];
311
+ /**
312
+ * The live dataset declarations (stack key `datasets`).
313
+ *
314
+ * [#7529] The resolution universe `validateWidgetBindings` links a widget's
315
+ * `dataset` / `dimensions` / `values` against. Without it a per-write
316
+ * dashboard snapshot holds no datasets at all, so every widget on a fully
317
+ * legitimate board reads as dangling — measured as 3 phantom
318
+ * `widget-dataset-unknown` errors on a 3-widget board bound to a real
319
+ * dataset, vs 0 with the collection carried (and the genuinely dangling
320
+ * binding still yields exactly its 1 true error). Carrying it in BOTH
321
+ * passes also cancels dataset-level findings (`measure-aggregate-incoherent`
322
+ * is judged per dataset, independent of any widget) in the differential, so
323
+ * a stored dataset's pre-existing condition is not this write's to answer
324
+ * for (#4463 D4).
325
+ */
326
+ datasets?: readonly unknown[];
291
327
  }
328
+ /**
329
+ * Which package a write belongs to, and what that package is allowed to reach.
330
+ *
331
+ * [#9612] The maintainer's ruling, verbatim, is the product decision this type
332
+ * exists for:
333
+ *
334
+ * > 大客户(420 个对象),就不应该出现在一个软件包中啊,这就是划分软件包的价值。
335
+ * > 客户开发开发,校验是否也应该基于软件包
336
+ * > 当然这里面要考虑系统对象
337
+ *
338
+ * A tenant that has grown to 420 objects is not ONE package — it is many — and
339
+ * judging one package's write against all 420 is validating against the wrong
340
+ * unit, not merely validating slowly. A package's declared `dependencies`
341
+ * bound what it MAY reference, so `package + declared deps + platform/system`
342
+ * is a closure the platform computes EXACTLY rather than estimates. That is
343
+ * what separates this from "narrow to whatever the rule can be proven to
344
+ * reach", which was considered and refused: a per-rule proof is a second
345
+ * opinion that drifts the moment a rule changes.
346
+ *
347
+ * ⛔ Absent — or carrying a package whose dependency declaration cannot be
348
+ * read — narrows NOTHING. The whole collection is handed over, exactly as
349
+ * before. The fallback direction is deliberate and is the opposite of a size
350
+ * threshold: an unknown provenance buys MORE validation input, never less, so
351
+ * the gate never stops judging (the #9798 / #9261 / ADR-0110 D3 fail-open
352
+ * shape this card was explicitly forbidden from re-creating).
353
+ */
354
+ interface RuntimePackageScope {
355
+ /** The package the written item belongs to. */
356
+ packageId: string;
357
+ /**
358
+ * Every OTHER package this one may reference — the transitive closure of the
359
+ * written package's declared `dependencies`. Resolved by the host, which is
360
+ * the side that holds the package registry; this module only reads the set.
361
+ */
362
+ dependencies: readonly string[];
363
+ }
364
+ /**
365
+ * `objects` reduced to the written item's package closure (#9612).
366
+ *
367
+ * An object survives when ANY of these holds — the four limbs are the closure
368
+ * the ruling names, and each one is load-bearing:
369
+ *
370
+ * 1. it is a **platform / system object** ({@link isSystemObject}, imported
371
+ * rather than re-decided). ⛔ Unconditional: a package legitimately
372
+ * references `sys_*` objects it never declares a dependency on, and a
373
+ * closure that dropped them would manufacture "unresolved reference"
374
+ * findings that describe nothing — the false-positive class PR #7886
375
+ * already paid for on the `permissions` collection;
376
+ * 2. it carries **no package provenance** — a tenant-authored overlay row.
377
+ * Nothing declares what such a row may reference, so nothing bounds it and
378
+ * it is kept. Conservative by construction;
379
+ * 3. it belongs to the **written package** itself;
380
+ * 4. it belongs to one of that package's **declared dependencies**.
381
+ *
382
+ * Pure, allocation-light, and total: a non-object member is kept rather than
383
+ * inspected, because deciding it is not this function's job.
384
+ */
385
+ declare function narrowObjectsToPackageClosure(objects: readonly unknown[], scope: RuntimePackageScope | undefined): readonly unknown[];
292
386
  /** One rule's verdict at the runtime surface, carrying which rule produced it. */
293
387
  interface RuntimeGateResult {
294
388
  /** Findings the written item ADDED, severity `error` — the reason to refuse the write. */
@@ -351,6 +445,12 @@ declare function buildRuntimeWriteSnapshots(args: {
351
445
  item: unknown;
352
446
  /** Live resolution context from the host runtime. */
353
447
  context?: RuntimeStackContext;
448
+ /**
449
+ * [#9612] The written item's package and what it may reach. Omitted — or
450
+ * carrying a package whose dependencies the host could not read — hands the
451
+ * rules the WHOLE `objects` collection, exactly as before.
452
+ */
453
+ packageScope?: RuntimePackageScope;
354
454
  }): {
355
455
  baseline: AnyRec;
356
456
  candidate: AnyRec;
@@ -372,8 +472,14 @@ declare function runRuntimeAuthoringRules(args: {
372
472
  item: unknown;
373
473
  /** Live resolution context from the host runtime. */
374
474
  context?: RuntimeStackContext;
475
+ /**
476
+ * [#9612] The written item's package closure. Omit to judge against the
477
+ * whole collection — the pre-#9612 behaviour, and the behaviour every caller
478
+ * that cannot state a package keeps.
479
+ */
480
+ packageScope?: RuntimePackageScope;
375
481
  /** ADR-0080 SDUI manifest, when the host has one. */
376
482
  sduiManifest?: unknown;
377
483
  }): RuntimeGateResult;
378
484
 
379
- export { AUTHORING_COMMANDS as A, EXPRESSION_INVALID as E, type RuntimeGateResult as R, AUTHORING_RULES as a, AUTHORING_SURFACES as b, type AuthoringCommand as c, type AuthoringFinding as d, type AuthoringRule as e, type AuthoringRuleContext as f, type AuthoringRuleInputTier as g, type AuthoringRuleRun as h, type AuthoringRuleTier as i, type AuthoringSeverity as j, type AuthoringSurface as k, type RuntimeStackContext as l, authoringRulesFor as m, buildRuntimeWriteSnapshots as n, runRuntimeAuthoringRules as o, runtimeAuthoringRulesFor as p, runtimeGatedTypes as q, runAuthoringRules as r, splitBySeverity as s, stackKeyForType as t };
485
+ export { AUTHORING_COMMANDS as A, EXPRESSION_INVALID as E, type RuntimeGateResult as R, AUTHORING_RULES as a, AUTHORING_SURFACES as b, type AuthoringCommand as c, type AuthoringFinding as d, type AuthoringRule as e, type AuthoringRuleContext as f, type AuthoringRuleInputTier as g, type AuthoringRuleRun as h, type AuthoringRuleTier as i, type AuthoringSeverity as j, type AuthoringSurface as k, type RuntimePackageScope as l, type RuntimeStackContext as m, authoringRulesFor as n, buildRuntimeWriteSnapshots as o, narrowObjectsToPackageClosure as p, runRuntimeAuthoringRules as q, runAuthoringRules as r, runtimeAuthoringRulesFor as s, runtimeGatedTypes as t, splitBySeverity as u, stackKeyForType as v };
@@ -35,7 +35,13 @@ interface AuthoringFinding {
35
35
  rule: string;
36
36
  /** Human-readable location, e.g. `object "leave_request"`. */
37
37
  where: string;
38
- /** Config path, e.g. `objects[3].sharingModel`. */
38
+ /**
39
+ * Config path, e.g. `objects[3].sharingModel`. Positional as RULES emit it;
40
+ * on the runtime gate's wire surface the top-level collection index of a
41
+ * collection-resident finding is rewritten to the entry's NAME
42
+ * (`objects.acme_invoice.sharingModel`) — see `nameKeyFindingPath` in
43
+ * `runtime-gate.ts` (#10064).
44
+ */
39
45
  path: string;
40
46
  /** What is wrong. */
41
47
  message: string;
@@ -117,6 +123,19 @@ type AuthoringRuleInputTier = 'normalized' | 'parsed';
117
123
  interface AuthoringRuleContext {
118
124
  /** ADR-0080 SDUI component manifest, when the project ships one. */
119
125
  sduiManifest?: unknown;
126
+ /**
127
+ * [#9313] The singular metadata type of the per-write snapshot being judged
128
+ * — set by the runtime publish gate (`runtime-gate.ts`) on every gated
129
+ * write, ABSENT on the three CLI commands (`runAuthoringRules` never sets
130
+ * it). Exists for the one entry that is itself a registry: the
131
+ * reference-integrity suite dispatches its MEMBERS by this
132
+ * (`ReferenceIntegrityRule.runtimeTypes`), because the entry-level
133
+ * `runtimeTypes` can only say which writes reach the suite, not which
134
+ * members can judge a partial per-write snapshot without inventing
135
+ * findings. No other rule reads it, and none should without the same
136
+ * argument.
137
+ */
138
+ runtimeWriteType?: string;
120
139
  }
121
140
  interface AuthoringRule {
122
141
  /** The exported function's name — the id the wiring guard asserts on. */
@@ -252,7 +271,8 @@ type AnyRec = Record<string, unknown>;
252
271
  * from this shape and keeps the two from drifting. The set is deliberately
253
272
  * BOUNDED to what the runtime-wired rules actually read (measured, not
254
273
  * projected): the three cross-collection security rules compare
255
- * objects × permissions × books, and nothing on the runtime surface reads
274
+ * objects × permissions × books, `validateWidgetBindings` resolves widget
275
+ * bindings against datasets (#7529), and nothing on the runtime surface reads
256
276
  * `positions` / `apps` — so those are NOT carried. Widening the snapshot is a
257
277
  * one-key edit here plus a `CONTEXT_STACK_KEYS` entry, made when a rule that
258
278
  * reads the collection actually crosses the wall, never in advance.
@@ -288,7 +308,81 @@ interface RuntimeStackContext {
288
308
  * the differential for every other write type.
289
309
  */
290
310
  books?: readonly unknown[];
311
+ /**
312
+ * The live dataset declarations (stack key `datasets`).
313
+ *
314
+ * [#7529] The resolution universe `validateWidgetBindings` links a widget's
315
+ * `dataset` / `dimensions` / `values` against. Without it a per-write
316
+ * dashboard snapshot holds no datasets at all, so every widget on a fully
317
+ * legitimate board reads as dangling — measured as 3 phantom
318
+ * `widget-dataset-unknown` errors on a 3-widget board bound to a real
319
+ * dataset, vs 0 with the collection carried (and the genuinely dangling
320
+ * binding still yields exactly its 1 true error). Carrying it in BOTH
321
+ * passes also cancels dataset-level findings (`measure-aggregate-incoherent`
322
+ * is judged per dataset, independent of any widget) in the differential, so
323
+ * a stored dataset's pre-existing condition is not this write's to answer
324
+ * for (#4463 D4).
325
+ */
326
+ datasets?: readonly unknown[];
291
327
  }
328
+ /**
329
+ * Which package a write belongs to, and what that package is allowed to reach.
330
+ *
331
+ * [#9612] The maintainer's ruling, verbatim, is the product decision this type
332
+ * exists for:
333
+ *
334
+ * > 大客户(420 个对象),就不应该出现在一个软件包中啊,这就是划分软件包的价值。
335
+ * > 客户开发开发,校验是否也应该基于软件包
336
+ * > 当然这里面要考虑系统对象
337
+ *
338
+ * A tenant that has grown to 420 objects is not ONE package — it is many — and
339
+ * judging one package's write against all 420 is validating against the wrong
340
+ * unit, not merely validating slowly. A package's declared `dependencies`
341
+ * bound what it MAY reference, so `package + declared deps + platform/system`
342
+ * is a closure the platform computes EXACTLY rather than estimates. That is
343
+ * what separates this from "narrow to whatever the rule can be proven to
344
+ * reach", which was considered and refused: a per-rule proof is a second
345
+ * opinion that drifts the moment a rule changes.
346
+ *
347
+ * ⛔ Absent — or carrying a package whose dependency declaration cannot be
348
+ * read — narrows NOTHING. The whole collection is handed over, exactly as
349
+ * before. The fallback direction is deliberate and is the opposite of a size
350
+ * threshold: an unknown provenance buys MORE validation input, never less, so
351
+ * the gate never stops judging (the #9798 / #9261 / ADR-0110 D3 fail-open
352
+ * shape this card was explicitly forbidden from re-creating).
353
+ */
354
+ interface RuntimePackageScope {
355
+ /** The package the written item belongs to. */
356
+ packageId: string;
357
+ /**
358
+ * Every OTHER package this one may reference — the transitive closure of the
359
+ * written package's declared `dependencies`. Resolved by the host, which is
360
+ * the side that holds the package registry; this module only reads the set.
361
+ */
362
+ dependencies: readonly string[];
363
+ }
364
+ /**
365
+ * `objects` reduced to the written item's package closure (#9612).
366
+ *
367
+ * An object survives when ANY of these holds — the four limbs are the closure
368
+ * the ruling names, and each one is load-bearing:
369
+ *
370
+ * 1. it is a **platform / system object** ({@link isSystemObject}, imported
371
+ * rather than re-decided). ⛔ Unconditional: a package legitimately
372
+ * references `sys_*` objects it never declares a dependency on, and a
373
+ * closure that dropped them would manufacture "unresolved reference"
374
+ * findings that describe nothing — the false-positive class PR #7886
375
+ * already paid for on the `permissions` collection;
376
+ * 2. it carries **no package provenance** — a tenant-authored overlay row.
377
+ * Nothing declares what such a row may reference, so nothing bounds it and
378
+ * it is kept. Conservative by construction;
379
+ * 3. it belongs to the **written package** itself;
380
+ * 4. it belongs to one of that package's **declared dependencies**.
381
+ *
382
+ * Pure, allocation-light, and total: a non-object member is kept rather than
383
+ * inspected, because deciding it is not this function's job.
384
+ */
385
+ declare function narrowObjectsToPackageClosure(objects: readonly unknown[], scope: RuntimePackageScope | undefined): readonly unknown[];
292
386
  /** One rule's verdict at the runtime surface, carrying which rule produced it. */
293
387
  interface RuntimeGateResult {
294
388
  /** Findings the written item ADDED, severity `error` — the reason to refuse the write. */
@@ -351,6 +445,12 @@ declare function buildRuntimeWriteSnapshots(args: {
351
445
  item: unknown;
352
446
  /** Live resolution context from the host runtime. */
353
447
  context?: RuntimeStackContext;
448
+ /**
449
+ * [#9612] The written item's package and what it may reach. Omitted — or
450
+ * carrying a package whose dependencies the host could not read — hands the
451
+ * rules the WHOLE `objects` collection, exactly as before.
452
+ */
453
+ packageScope?: RuntimePackageScope;
354
454
  }): {
355
455
  baseline: AnyRec;
356
456
  candidate: AnyRec;
@@ -372,8 +472,14 @@ declare function runRuntimeAuthoringRules(args: {
372
472
  item: unknown;
373
473
  /** Live resolution context from the host runtime. */
374
474
  context?: RuntimeStackContext;
475
+ /**
476
+ * [#9612] The written item's package closure. Omit to judge against the
477
+ * whole collection — the pre-#9612 behaviour, and the behaviour every caller
478
+ * that cannot state a package keeps.
479
+ */
480
+ packageScope?: RuntimePackageScope;
375
481
  /** ADR-0080 SDUI manifest, when the host has one. */
376
482
  sduiManifest?: unknown;
377
483
  }): RuntimeGateResult;
378
484
 
379
- export { AUTHORING_COMMANDS as A, EXPRESSION_INVALID as E, type RuntimeGateResult as R, AUTHORING_RULES as a, AUTHORING_SURFACES as b, type AuthoringCommand as c, type AuthoringFinding as d, type AuthoringRule as e, type AuthoringRuleContext as f, type AuthoringRuleInputTier as g, type AuthoringRuleRun as h, type AuthoringRuleTier as i, type AuthoringSeverity as j, type AuthoringSurface as k, type RuntimeStackContext as l, authoringRulesFor as m, buildRuntimeWriteSnapshots as n, runRuntimeAuthoringRules as o, runtimeAuthoringRulesFor as p, runtimeGatedTypes as q, runAuthoringRules as r, splitBySeverity as s, stackKeyForType as t };
485
+ export { AUTHORING_COMMANDS as A, EXPRESSION_INVALID as E, type RuntimeGateResult as R, AUTHORING_RULES as a, AUTHORING_SURFACES as b, type AuthoringCommand as c, type AuthoringFinding as d, type AuthoringRule as e, type AuthoringRuleContext as f, type AuthoringRuleInputTier as g, type AuthoringRuleRun as h, type AuthoringRuleTier as i, type AuthoringSeverity as j, type AuthoringSurface as k, type RuntimePackageScope as l, type RuntimeStackContext as m, authoringRulesFor as n, buildRuntimeWriteSnapshots as o, narrowObjectsToPackageClosure as p, runRuntimeAuthoringRules as q, runAuthoringRules as r, runtimeAuthoringRulesFor as s, runtimeGatedTypes as t, splitBySeverity as u, stackKeyForType as v };