@objectstack/lint 17.0.0 → 17.1.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.
@@ -252,7 +252,8 @@ type AnyRec = Record<string, unknown>;
252
252
  * from this shape and keeps the two from drifting. The set is deliberately
253
253
  * BOUNDED to what the runtime-wired rules actually read (measured, not
254
254
  * projected): the three cross-collection security rules compare
255
- * objects × permissions × books, and nothing on the runtime surface reads
255
+ * objects × permissions × books, `validateWidgetBindings` resolves widget
256
+ * bindings against datasets (#7529), and nothing on the runtime surface reads
256
257
  * `positions` / `apps` — so those are NOT carried. Widening the snapshot is a
257
258
  * one-key edit here plus a `CONTEXT_STACK_KEYS` entry, made when a rule that
258
259
  * reads the collection actually crosses the wall, never in advance.
@@ -288,7 +289,81 @@ interface RuntimeStackContext {
288
289
  * the differential for every other write type.
289
290
  */
290
291
  books?: readonly unknown[];
292
+ /**
293
+ * The live dataset declarations (stack key `datasets`).
294
+ *
295
+ * [#7529] The resolution universe `validateWidgetBindings` links a widget's
296
+ * `dataset` / `dimensions` / `values` against. Without it a per-write
297
+ * dashboard snapshot holds no datasets at all, so every widget on a fully
298
+ * legitimate board reads as dangling — measured as 3 phantom
299
+ * `widget-dataset-unknown` errors on a 3-widget board bound to a real
300
+ * dataset, vs 0 with the collection carried (and the genuinely dangling
301
+ * binding still yields exactly its 1 true error). Carrying it in BOTH
302
+ * passes also cancels dataset-level findings (`measure-aggregate-incoherent`
303
+ * is judged per dataset, independent of any widget) in the differential, so
304
+ * a stored dataset's pre-existing condition is not this write's to answer
305
+ * for (#4463 D4).
306
+ */
307
+ datasets?: readonly unknown[];
291
308
  }
309
+ /**
310
+ * Which package a write belongs to, and what that package is allowed to reach.
311
+ *
312
+ * [#9612] The maintainer's ruling, verbatim, is the product decision this type
313
+ * exists for:
314
+ *
315
+ * > 大客户(420 个对象),就不应该出现在一个软件包中啊,这就是划分软件包的价值。
316
+ * > 客户开发开发,校验是否也应该基于软件包
317
+ * > 当然这里面要考虑系统对象
318
+ *
319
+ * A tenant that has grown to 420 objects is not ONE package — it is many — and
320
+ * judging one package's write against all 420 is validating against the wrong
321
+ * unit, not merely validating slowly. A package's declared `dependencies`
322
+ * bound what it MAY reference, so `package + declared deps + platform/system`
323
+ * is a closure the platform computes EXACTLY rather than estimates. That is
324
+ * what separates this from "narrow to whatever the rule can be proven to
325
+ * reach", which was considered and refused: a per-rule proof is a second
326
+ * opinion that drifts the moment a rule changes.
327
+ *
328
+ * ⛔ Absent — or carrying a package whose dependency declaration cannot be
329
+ * read — narrows NOTHING. The whole collection is handed over, exactly as
330
+ * before. The fallback direction is deliberate and is the opposite of a size
331
+ * threshold: an unknown provenance buys MORE validation input, never less, so
332
+ * the gate never stops judging (the #9798 / #9261 / ADR-0110 D3 fail-open
333
+ * shape this card was explicitly forbidden from re-creating).
334
+ */
335
+ interface RuntimePackageScope {
336
+ /** The package the written item belongs to. */
337
+ packageId: string;
338
+ /**
339
+ * Every OTHER package this one may reference — the transitive closure of the
340
+ * written package's declared `dependencies`. Resolved by the host, which is
341
+ * the side that holds the package registry; this module only reads the set.
342
+ */
343
+ dependencies: readonly string[];
344
+ }
345
+ /**
346
+ * `objects` reduced to the written item's package closure (#9612).
347
+ *
348
+ * An object survives when ANY of these holds — the four limbs are the closure
349
+ * the ruling names, and each one is load-bearing:
350
+ *
351
+ * 1. it is a **platform / system object** ({@link isSystemObject}, imported
352
+ * rather than re-decided). ⛔ Unconditional: a package legitimately
353
+ * references `sys_*` objects it never declares a dependency on, and a
354
+ * closure that dropped them would manufacture "unresolved reference"
355
+ * findings that describe nothing — the false-positive class PR #7886
356
+ * already paid for on the `permissions` collection;
357
+ * 2. it carries **no package provenance** — a tenant-authored overlay row.
358
+ * Nothing declares what such a row may reference, so nothing bounds it and
359
+ * it is kept. Conservative by construction;
360
+ * 3. it belongs to the **written package** itself;
361
+ * 4. it belongs to one of that package's **declared dependencies**.
362
+ *
363
+ * Pure, allocation-light, and total: a non-object member is kept rather than
364
+ * inspected, because deciding it is not this function's job.
365
+ */
366
+ declare function narrowObjectsToPackageClosure(objects: readonly unknown[], scope: RuntimePackageScope | undefined): readonly unknown[];
292
367
  /** One rule's verdict at the runtime surface, carrying which rule produced it. */
293
368
  interface RuntimeGateResult {
294
369
  /** Findings the written item ADDED, severity `error` — the reason to refuse the write. */
@@ -351,6 +426,12 @@ declare function buildRuntimeWriteSnapshots(args: {
351
426
  item: unknown;
352
427
  /** Live resolution context from the host runtime. */
353
428
  context?: RuntimeStackContext;
429
+ /**
430
+ * [#9612] The written item's package and what it may reach. Omitted — or
431
+ * carrying a package whose dependencies the host could not read — hands the
432
+ * rules the WHOLE `objects` collection, exactly as before.
433
+ */
434
+ packageScope?: RuntimePackageScope;
354
435
  }): {
355
436
  baseline: AnyRec;
356
437
  candidate: AnyRec;
@@ -372,8 +453,14 @@ declare function runRuntimeAuthoringRules(args: {
372
453
  item: unknown;
373
454
  /** Live resolution context from the host runtime. */
374
455
  context?: RuntimeStackContext;
456
+ /**
457
+ * [#9612] The written item's package closure. Omit to judge against the
458
+ * whole collection — the pre-#9612 behaviour, and the behaviour every caller
459
+ * that cannot state a package keeps.
460
+ */
461
+ packageScope?: RuntimePackageScope;
375
462
  /** ADR-0080 SDUI manifest, when the host has one. */
376
463
  sduiManifest?: unknown;
377
464
  }): RuntimeGateResult;
378
465
 
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 };
466
+ 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 };
@@ -252,7 +252,8 @@ type AnyRec = Record<string, unknown>;
252
252
  * from this shape and keeps the two from drifting. The set is deliberately
253
253
  * BOUNDED to what the runtime-wired rules actually read (measured, not
254
254
  * projected): the three cross-collection security rules compare
255
- * objects × permissions × books, and nothing on the runtime surface reads
255
+ * objects × permissions × books, `validateWidgetBindings` resolves widget
256
+ * bindings against datasets (#7529), and nothing on the runtime surface reads
256
257
  * `positions` / `apps` — so those are NOT carried. Widening the snapshot is a
257
258
  * one-key edit here plus a `CONTEXT_STACK_KEYS` entry, made when a rule that
258
259
  * reads the collection actually crosses the wall, never in advance.
@@ -288,7 +289,81 @@ interface RuntimeStackContext {
288
289
  * the differential for every other write type.
289
290
  */
290
291
  books?: readonly unknown[];
292
+ /**
293
+ * The live dataset declarations (stack key `datasets`).
294
+ *
295
+ * [#7529] The resolution universe `validateWidgetBindings` links a widget's
296
+ * `dataset` / `dimensions` / `values` against. Without it a per-write
297
+ * dashboard snapshot holds no datasets at all, so every widget on a fully
298
+ * legitimate board reads as dangling — measured as 3 phantom
299
+ * `widget-dataset-unknown` errors on a 3-widget board bound to a real
300
+ * dataset, vs 0 with the collection carried (and the genuinely dangling
301
+ * binding still yields exactly its 1 true error). Carrying it in BOTH
302
+ * passes also cancels dataset-level findings (`measure-aggregate-incoherent`
303
+ * is judged per dataset, independent of any widget) in the differential, so
304
+ * a stored dataset's pre-existing condition is not this write's to answer
305
+ * for (#4463 D4).
306
+ */
307
+ datasets?: readonly unknown[];
291
308
  }
309
+ /**
310
+ * Which package a write belongs to, and what that package is allowed to reach.
311
+ *
312
+ * [#9612] The maintainer's ruling, verbatim, is the product decision this type
313
+ * exists for:
314
+ *
315
+ * > 大客户(420 个对象),就不应该出现在一个软件包中啊,这就是划分软件包的价值。
316
+ * > 客户开发开发,校验是否也应该基于软件包
317
+ * > 当然这里面要考虑系统对象
318
+ *
319
+ * A tenant that has grown to 420 objects is not ONE package — it is many — and
320
+ * judging one package's write against all 420 is validating against the wrong
321
+ * unit, not merely validating slowly. A package's declared `dependencies`
322
+ * bound what it MAY reference, so `package + declared deps + platform/system`
323
+ * is a closure the platform computes EXACTLY rather than estimates. That is
324
+ * what separates this from "narrow to whatever the rule can be proven to
325
+ * reach", which was considered and refused: a per-rule proof is a second
326
+ * opinion that drifts the moment a rule changes.
327
+ *
328
+ * ⛔ Absent — or carrying a package whose dependency declaration cannot be
329
+ * read — narrows NOTHING. The whole collection is handed over, exactly as
330
+ * before. The fallback direction is deliberate and is the opposite of a size
331
+ * threshold: an unknown provenance buys MORE validation input, never less, so
332
+ * the gate never stops judging (the #9798 / #9261 / ADR-0110 D3 fail-open
333
+ * shape this card was explicitly forbidden from re-creating).
334
+ */
335
+ interface RuntimePackageScope {
336
+ /** The package the written item belongs to. */
337
+ packageId: string;
338
+ /**
339
+ * Every OTHER package this one may reference — the transitive closure of the
340
+ * written package's declared `dependencies`. Resolved by the host, which is
341
+ * the side that holds the package registry; this module only reads the set.
342
+ */
343
+ dependencies: readonly string[];
344
+ }
345
+ /**
346
+ * `objects` reduced to the written item's package closure (#9612).
347
+ *
348
+ * An object survives when ANY of these holds — the four limbs are the closure
349
+ * the ruling names, and each one is load-bearing:
350
+ *
351
+ * 1. it is a **platform / system object** ({@link isSystemObject}, imported
352
+ * rather than re-decided). ⛔ Unconditional: a package legitimately
353
+ * references `sys_*` objects it never declares a dependency on, and a
354
+ * closure that dropped them would manufacture "unresolved reference"
355
+ * findings that describe nothing — the false-positive class PR #7886
356
+ * already paid for on the `permissions` collection;
357
+ * 2. it carries **no package provenance** — a tenant-authored overlay row.
358
+ * Nothing declares what such a row may reference, so nothing bounds it and
359
+ * it is kept. Conservative by construction;
360
+ * 3. it belongs to the **written package** itself;
361
+ * 4. it belongs to one of that package's **declared dependencies**.
362
+ *
363
+ * Pure, allocation-light, and total: a non-object member is kept rather than
364
+ * inspected, because deciding it is not this function's job.
365
+ */
366
+ declare function narrowObjectsToPackageClosure(objects: readonly unknown[], scope: RuntimePackageScope | undefined): readonly unknown[];
292
367
  /** One rule's verdict at the runtime surface, carrying which rule produced it. */
293
368
  interface RuntimeGateResult {
294
369
  /** Findings the written item ADDED, severity `error` — the reason to refuse the write. */
@@ -351,6 +426,12 @@ declare function buildRuntimeWriteSnapshots(args: {
351
426
  item: unknown;
352
427
  /** Live resolution context from the host runtime. */
353
428
  context?: RuntimeStackContext;
429
+ /**
430
+ * [#9612] The written item's package and what it may reach. Omitted — or
431
+ * carrying a package whose dependencies the host could not read — hands the
432
+ * rules the WHOLE `objects` collection, exactly as before.
433
+ */
434
+ packageScope?: RuntimePackageScope;
354
435
  }): {
355
436
  baseline: AnyRec;
356
437
  candidate: AnyRec;
@@ -372,8 +453,14 @@ declare function runRuntimeAuthoringRules(args: {
372
453
  item: unknown;
373
454
  /** Live resolution context from the host runtime. */
374
455
  context?: RuntimeStackContext;
456
+ /**
457
+ * [#9612] The written item's package closure. Omit to judge against the
458
+ * whole collection — the pre-#9612 behaviour, and the behaviour every caller
459
+ * that cannot state a package keeps.
460
+ */
461
+ packageScope?: RuntimePackageScope;
375
462
  /** ADR-0080 SDUI manifest, when the host has one. */
376
463
  sduiManifest?: unknown;
377
464
  }): RuntimeGateResult;
378
465
 
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 };
466
+ 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 };