@starci/eslint-canon-be 3.19.0 → 3.19.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.
- package/CHANGELOG.md +31 -23
- package/README.md +1 -1
- package/dist/app-composition.js +1 -1
- package/dist/connections.js +1 -1
- package/dist/entity-base.js +2 -2
- package/dist/feature-thin.js +1 -1
- package/dist/function-budget.js +1 -1
- package/dist/lib/hfs-view.d.ts +5 -0
- package/dist/lib/runtime-root.d.ts +1 -1
- package/dist/lib/runtime-root.js +1 -1
- package/dist/lib/types.d.ts +1 -1
- package/dist/lib/types.js +1 -1
- package/dist/lib/webhook-handoff-intake.js +1 -1
- package/dist/module-shape.d.ts +2 -2
- package/dist/module-shape.js +3 -3
- package/dist/operations.js +2 -2
- package/dist/schema-authority.js +66 -2
- package/dist/spec-quality.js +1 -1
- package/dist/test-world.js +1 -1
- package/dist/webhooks.js +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 3.19.2 - 2026-11-07
|
|
4
|
+
|
|
5
|
+
- A patch: peers `@starci/hfs` ~6.0.0. Comments, rule docs and messages cite rules by their ids and carry no ruling history.
|
|
6
|
+
|
|
7
|
+
## 3.19.1 - 2026-11-05
|
|
8
|
+
|
|
9
|
+
- Added (HR-CORE-BE-3, R34 `BE_SCHEMA_AUTHORITY`, `no-runtime-schema`): a root-package file hfs.json `sides.be.ddlRenderers` lists (`{ path, reason }`, app-root relative, a `*` only in the file name; the hfs runtime merges it into `ruleParams.ddlRenderers`) may hold DDL text, so the renderer `cli entities plan --write` uses to write NEW migration files is no longer flagged. It may only build and return the text: in that file a database client import (typeorm, pg, ...) is refused (`rendererClient`) and so is a `.query/.execute/.exec/.raw/.unsafe` call (`rendererExecutes`); DDL text in any other file, including the rest of the same package and every file of the be side, is still refused; and a file that is neither the cli nor a root package and imports (or re-exports) a symbol the renderer declares, directly or through a package barrel, is refused (`rendererImported`; type-only imports are not). Needs @starci/hfs 5.13.2.
|
|
10
|
+
|
|
3
11
|
## 3.19.0 - 2026-11-05
|
|
4
12
|
|
|
5
|
-
- Changed
|
|
13
|
+
- Changed: the canon reads the @starci/hfs runtime (slots, rule catalog, canon pins, failure codes, the architecture machine) from the installed hfs at run time, which it peers by `~5.13.0`, and bundles no copy; `runtime/` keeps only the project graph rule, the jsdoc and sonar helpers and the package-scripts template. The stale forks it kept (slots 3.13.0) are gone, so it lints with the manifest hfs ships.
|
|
6
14
|
|
|
7
15
|
## 3.18.4 - 2026-11-05
|
|
8
16
|
|
|
9
|
-
- Changed: the runtime copy of the canon pins gives the Grammar family its same-minor range
|
|
17
|
+
- Changed: the runtime copy of the canon pins gives the Grammar family its same-minor range and names `@starci/hfs` 5.12.0 and the Grammar family 0.22.0; the runtime copy of R15 reads the range.
|
|
10
18
|
|
|
11
19
|
## 3.18.3 - 2026-11-05
|
|
12
20
|
|
|
@@ -66,7 +74,7 @@
|
|
|
66
74
|
|
|
67
75
|
## 3.16.0 - 2026-11-04
|
|
68
76
|
|
|
69
|
-
- Changed: `schema-place` (R304) lets any file of a root workspace package (tier `package`: `packages/<name>/`, slots `app.packages` and `app.module-registry`) import `zod`, since its node, block and vocabulary contracts are zod schemas; a door or `dto/` folder there still answers to `class-validator`, a `<name>.schema.ts` there still never shares a file with `class-validator` or a GraphQL type, and `schema-bounded` holds unchanged
|
|
77
|
+
- Changed: `schema-place` (R304) lets any file of a root workspace package (tier `package`: `packages/<name>/`, slots `app.packages` and `app.module-registry`) import `zod`, since its node, block and vocabulary contracts are zod schemas; a door or `dto/` folder there still answers to `class-validator`, a `<name>.schema.ts` there still never shares a file with `class-validator` or a GraphQL type, and `schema-bounded` holds unchanged. Spec: `src/packages-config.spec.ts`.
|
|
70
78
|
- Changed: the runtime copies carry the landed-migration db rules, the module shape of `be.integrations.passport` in the package slot manifest and the canon pins of `@starci/hfs` 5.8.0.
|
|
71
79
|
|
|
72
80
|
## 3.15.5 - 2026-11-04
|
|
@@ -180,7 +188,7 @@
|
|
|
180
188
|
|
|
181
189
|
## 3.11.6 - 2026-11-01
|
|
182
190
|
|
|
183
|
-
- Changed: the bundled rule catalog states the R61 status law as the
|
|
191
|
+
- Changed: the bundled rule catalog states the R61 status law as the status pair rule.
|
|
184
192
|
- Changed: the bundled canon pins name @starci/grammar 0.20.2, eslint-grammar-core and eslint-grammar-offset-pop 0.20.2, eslint-canon-be 3.11.6, eslint-canon-fe 9.8.5, stylelint-canon 2.4.0 and hfs 4.16.5 (RELEASE_VERSION_NOT_BUMPED: the previous versions are on npm). No rule changes.
|
|
185
193
|
|
|
186
194
|
## 3.11.5 - 2026-11-01
|
|
@@ -216,7 +224,7 @@
|
|
|
216
224
|
|
|
217
225
|
## 3.10.0 - 2026-10-31
|
|
218
226
|
|
|
219
|
-
- Added: `ai-virtual-key-name` (R344 `BE_AI_VIRTUAL_KEY`): inside `integrations/ai` every `<env>.secret(...)` names exactly `STARCI_AI_KEY`, as a literal: the one virtual key the ai-router gateway mounts and every client uses; the custody owner `integrations/ai-gateway` passes the gateway no `adminToken`, since it exposes no admin API
|
|
227
|
+
- Added: `ai-virtual-key-name` (R344 `BE_AI_VIRTUAL_KEY`): inside `integrations/ai` every `<env>.secret(...)` names exactly `STARCI_AI_KEY`, as a literal: the one virtual key the ai-router gateway mounts and every client uses; the custody owner `integrations/ai-gateway` passes the gateway no `adminToken`, since it exposes no admin API. Exported: `VIRTUAL_KEY_VARIABLE`.
|
|
220
228
|
- Changed: the bundled runtime copies follow @starci/hfs 4.13.2 (R344 in the catalog and on the `be.integrations` slot) and the canon pins name the lint cohort eslint-canon-be 3.10.0, eslint-canon-fe 9.6.5, eslint-grammar-core and eslint-grammar-offset-pop 0.16.5.
|
|
221
229
|
|
|
222
230
|
## 3.9.4 - 2026-10-31
|
|
@@ -226,9 +234,9 @@
|
|
|
226
234
|
## 3.9.3 - 2026-10-31
|
|
227
235
|
|
|
228
236
|
- Changed: the bundled canon pins name the 0.16.3 cohort (@starci/grammar, eslint-grammar-core and eslint-grammar-offset-pop 0.16.3, eslint-canon-fe 9.6.3, eslint-canon-be 3.9.3, stylelint-canon 2.3.0, jest-preset 2.6.0, hfs 4.13.0); ChatWorkspace and PaneLayout are removed with no alias; PaneGrid and Pane are the one generic pane grid: grammar names are generic.
|
|
229
|
-
- Added: `entity-extends-base` (R342 `BE_ENTITY_EXTENDS_BASE`, `src/entity-base.ts`, BE-PERSISTENCE-3
|
|
237
|
+
- Added: `entity-extends-base` (R342 `BE_ENTITY_EXTENDS_BASE`, `src/entity-base.ts`, BE-PERSISTENCE-3), both editions: an `@Entity` class that declares a database-set `created_at` or `updated_at` itself (`@CreateDateColumn`, `@UpdateDateColumn`, or a `@Column` on those names, or on `createdAt` / `updatedAt`, with `insert: false`, `update: false` or a `default`) and, beside both, the generated uuid `id` is refused; the finding names `UuidAbstractEntity` or `AbstractEntity` of `@modules/platform/database` as the base to extend. A timestamp the application sets (a plain `@Column`) and the base file `platform/database/abstract.entity.ts` are not judged. Spec: `src/entity-base.spec.ts`.
|
|
230
238
|
- Changed: the bundled rule catalog adds R342 and the failure codes add `BE_ENTITY_EXTENDS_BASE`.
|
|
231
|
-
- Added: the lint result cache of `starci app check
|
|
239
|
+
- Added: the lint result cache of `starci app check`: `crossFileInputs`, the files and folders each rule reads beyond the linted file (git-history inputs; third-party-owner walks the integrations only for integration files; an fs-audit spec proves every rule declares what it reads), and the `projectGraph` export the cache keys a file's lint record on.
|
|
232
240
|
|
|
233
241
|
## 3.9.2 - 2026-10-31
|
|
234
242
|
|
|
@@ -293,7 +301,7 @@
|
|
|
293
301
|
## 3.8.11 - 2026-10-29
|
|
294
302
|
|
|
295
303
|
- Fixed: `source-suffix` (BE_SOURCE_FORM, R89) admits the one file a file slot names by its path, read from the slot manifest: the lite entity registry `src/modules/platform/database/entities.ts` (slot `be.platform.database.entities`) was refused for having no role suffix.
|
|
296
|
-
- Changed: `no-raw-sql` (R334) exempts its two raw SQL owners by side-relative folder (`RAW_SQL_OWNERS`: `src/modules/platform/database/` and `src/tests/world/`) and keeps refusing raw SQL in integration and e2e specs, builders and fixtures; its messages send a spec author to entities on `world.db.<connection>` or a named world helper. `callDbFunction` with a listed function is allowed in specs as in domain code
|
|
304
|
+
- Changed: `no-raw-sql` (R334) exempts its two raw SQL owners by side-relative folder (`RAW_SQL_OWNERS`: `src/modules/platform/database/` and `src/tests/world/`) and keeps refusing raw SQL in integration and e2e specs, builders and fixtures; its messages send a spec author to entities on `world.db.<connection>` or a named world helper. `callDbFunction` with a listed function is allowed in specs as in domain code.
|
|
297
305
|
- Fixed: the edition gate (`pluginForEdition`) reads the rule catalog in full too, so a rule whose catalog entries name only lite is inactive in full: `no-raw-sql` (R334, `editions: [lite]`) no longer fires on a full app, whose SQL law is R36. Full used to return every rule without reading the catalog.
|
|
298
306
|
- Changed: the bundled canon pins name hfs 4.11.12, eslint-canon-be 3.8.11, eslint-canon-fe 9.5.13 and the Grammar family 0.15.24.
|
|
299
307
|
|
|
@@ -332,7 +340,7 @@
|
|
|
332
340
|
## 3.8.2 - 2026-10-29
|
|
333
341
|
|
|
334
342
|
- Added: R336 `BE_EVENT_BUS_LITE_SHAPE` (`src/event-bus-lite.ts`, contexts/code/be/event-bus.md BE-EVENT-BUS-6), lite only: `event-dedupe-key` refuses an event class of `src/modules/events/**` whose payload type has no `dedupeKey` (a literal, `EventPayload`, or an interface or alias of the file that declares it or extends `EventPayload`), and `event-subscription-static` refuses a `subscribe(queue, consumer, options?)` whose queue is not a `*_TOPIC_QUEUE` constant imported from `@modules/platform/event-bus` or whose options are not a literal object. Spec: `src/event-bus-lite.spec.ts`.
|
|
335
|
-
- Changed: the bundled slot manifest 3.13.0 admits `pgmq` in `ruleParams.db.extensions` (the lite event bus
|
|
343
|
+
- Changed: the bundled slot manifest 3.13.0 admits `pgmq` in `ruleParams.db.extensions` (the lite event bus), retires `ruleParams.db.queueOutbox` and `sides.be.queueOutbox` with the pg_cron half of R258, lists `public.event_bus_send`, `public.event_bus_read`, `public.event_bus_archive`, `public.event_bus_bury`, `public.event_bus_dead_letters` and `public.event_bus_requeue` in place of `public.event_bus_write` in `ruleParams.be.dbFunctions`, and moves slot `app.db.image` to `.starcistacks/images/db/Dockerfile` (admitted by the lite `app.starcistacks` allows); the bundled rule catalog keeps R258 `DB_PGMQ_DECLARED` as the event-bus law, retires `DB_CRON_OWNED` and adds R336 `BE_EVENT_BUS_LITE_SHAPE`; the bundled canon pins name hfs 4.11.3, eslint-canon-be 3.8.2, eslint-canon-fe 9.5.4 and the Grammar family 0.15.15. Spec `src/lite-event-bus-template.spec.ts` lints the lite pgmq event-bus templates of @starci/hfs with `no-raw-sql` (R334).
|
|
336
344
|
|
|
337
345
|
## 3.8.1 - 2026-10-29
|
|
338
346
|
|
|
@@ -343,12 +351,12 @@
|
|
|
343
351
|
|
|
344
352
|
## 3.8.0 - 2026-10-29
|
|
345
353
|
|
|
346
|
-
- Added: `jobs-scheduler-owner` (R335 `BE_JOBS_SCHEDULER_OWNER
|
|
354
|
+
- Added: `jobs-scheduler-owner` (R335 `BE_JOBS_SCHEDULER_OWNER`): only `platform/jobs/job-tick.service.ts`, its spec and `jobs.module.ts` import `@nestjs/schedule` or `cron`, the `Cron`, `Interval` and `Timeout` decorators are refused everywhere, and a `job-tick.service.ts` must call `advisoryXactLock` and `callDbFunction(..., "job_tick_claim", ...)`. `infra-import-owner` (R90) reads `@nestjs/schedule` and `cron` as owned by `platform/jobs` from the bundled manifest.
|
|
347
355
|
- Changed: the bundled slot manifest 3.11.0 adds the managed lite slot `app.db.image` (`db/Dockerfile`), narrows `ruleParams.db.extensions` to what the official postgres image plus pgvector carries (pgcrypto, pg_trgm, vector, uuid-ossp, unaccent, btree_gist; no pgmq, pg_cron, pg_net or supabase_vault) and gives `@nestjs/schedule` and `cron` one owner, `platform/jobs`, in `infraOwners`; the bundled rule catalog adds R335 `BE_JOBS_SCHEDULER_OWNER` and its R250 and R276 laws name the platform/jobs tick and the db image; the bundled canon pins name hfs 4.11.0, eslint-canon-be 3.8.0, eslint-canon-fe 9.5.2 and the Grammar family 0.15.13 and pin `@nestjs/schedule` 6.1.3 (CommonJS on the Nest 11 line) and `cron` 4.4.0.
|
|
348
356
|
|
|
349
357
|
## 3.7.1 - 2026-10-29
|
|
350
358
|
|
|
351
|
-
- Changed: the entity registry (persistence.md BE-PERSISTENCE-3
|
|
359
|
+
- Changed: the entity registry (persistence.md BE-PERSISTENCE-3): the bundled slot manifest 3.10.0 adds the lite slot `be.platform.database.entities`, the entity registry (slot fields `role: entity-registry` and `importedBy`, validated by the manifest shape); the bundled architecture machine reads it (`architecture/entity-registry.mjs`): `tier-direction` (R26 `BE_TIER_DIRECTION`) admits the registry's import of a domain or platform capability's `index.ts` that binds only that capability's `<c>Entities`, and `owner-export-bypass` (R30 `ARCH_OWNER_EXPORT_BYPASS`) admits a direct import of the registry from the files `importedBy` names (`apps/*/src/compose/*.ts`, `apps/*/src/app.module.ts`, `src/tests/world/**`); every other import of either shape stays refused, and full has no registry. `import-owner-entry` (R30) admits the deep path `@modules/platform/database/entities` from the same importers only. Spec: `src/entity-registry.spec.ts`.
|
|
352
360
|
- Changed: the bundled canon pins name hfs 4.10.1, eslint-canon-be 3.7.1, eslint-canon-fe 9.5.1 and the Grammar family 0.15.12.
|
|
353
361
|
- Changed: the owner-cycle check (R27 `ARCH_OWNER_CYCLE`) counts the entity registry as a unit of its own, not part of `platform/database`, so naming every `<c>Entities` closes no cycle among capabilities while any other platform/database file importing a domain still does (spec in `src/entity-registry.spec.ts`); the bundled rule catalog's R26 and R30 laws name the entity registry.
|
|
354
362
|
|
|
@@ -421,7 +429,7 @@
|
|
|
421
429
|
|
|
422
430
|
## 3.4.57 - 2026-10-27
|
|
423
431
|
|
|
424
|
-
- Changed: the bundled runtime copy follows the two
|
|
432
|
+
- Changed: the bundled runtime copy follows the two Grammar families: the Grammar catalog declares `core` and `offset-pop` only, and the canon pins follow the harness packages. The spec fixture app selects `core`. No rule changes.
|
|
425
433
|
|
|
426
434
|
## 3.4.56 - 2026-10-27
|
|
427
435
|
|
|
@@ -429,7 +437,7 @@
|
|
|
429
437
|
|
|
430
438
|
## 3.4.55 - 2026-10-26
|
|
431
439
|
|
|
432
|
-
- Changed: the bundled runtime copies and canon pins move with the alpha.31 cohort (light push gate
|
|
440
|
+
- Changed: the bundled runtime copies and canon pins move with the alpha.31 cohort (light push gate).
|
|
433
441
|
|
|
434
442
|
## 3.4.54 - 2026-10-26
|
|
435
443
|
|
|
@@ -497,7 +505,7 @@
|
|
|
497
505
|
- Changed: the bundled rule catalog and slot manifest name the specs that moved into this package (they drive its rules and fixtures and now pass from its own clean install); 3.4.35 was published with the old spec paths and is superseded.
|
|
498
506
|
|
|
499
507
|
## 3.4.35 - 2026-10-23
|
|
500
|
-
- Changed: `BE_AMBIENT_ID` has no exemption for the test world (
|
|
508
|
+
- Changed: `BE_AMBIENT_ID` has no exemption for the test world (a loosening is always red); the world asks the injected `Ids` port like everything else.
|
|
501
509
|
- Changed: the bundled canon pins select @starci/hfs 4.7.28 and @starci/cli 1.7.28.
|
|
502
510
|
|
|
503
511
|
## 3.4.34 - 2026-10-23
|
|
@@ -512,7 +520,7 @@
|
|
|
512
520
|
## 3.4.31 - 2026-10-23
|
|
513
521
|
- Changed: the `spec-no-skip` rule text says nothing skips, the contract layer included: a missing sandbox is a failing test of `sandbox.describe` from `@starci/test-world` 1.2.3.
|
|
514
522
|
- Changed: the bundled canon pins select @starci/hfs 4.7.24 and @starci/cli 1.7.24.
|
|
515
|
-
- Changed: no Sonar way rule is left to the server (
|
|
523
|
+
- Changed: no Sonar way rule is left to the server (no loosening): S3403 `different-types-comparison`, S3800 `function-return-type`, S3782 `argument-type` and S6582 `@typescript-eslint/prefer-optional-chain` run at error, `unicorn/consistent-function-scoping` runs with its default options (arrow functions included). S7785 (top-level await) is recorded as not applicable to a CommonJS back end (`SONAR_WAY_NOT_APPLICABLE`).
|
|
516
524
|
- Added: the `@typescript-eslint/no-unsafe-assignment`, `-member-access`, `-call`, `-return` and `-argument` rules at error.
|
|
517
525
|
|
|
518
526
|
## 3.4.30 - 2026-10-22
|
|
@@ -603,15 +611,15 @@
|
|
|
603
611
|
|
|
604
612
|
## 3.4.1 - 2026-10-17
|
|
605
613
|
|
|
606
|
-
- Changed: the bundled runtime copies follow the runtime of 1.0.0-alpha.19
|
|
607
|
-
- Fixed (R263 `BE_WEBHOOK_SCOPE`, a18.1 NIVO requests G and J): a third-party OAuth redirect (a GET route with `PublicReason.AuthHandshake` on a path that is not a webhook or events path) is no longer judged as a webhook door
|
|
614
|
+
- Changed: the bundled runtime copies follow the runtime of 1.0.0-alpha.19: the failure codes, the slot manifest (`exampleNa`) and the rule catalog (`specNa`, `exampleNa`) carry the removal of the runtime's own specs; package behavior is unchanged.
|
|
615
|
+
- Fixed (R263 `BE_WEBHOOK_SCOPE`, a18.1 NIVO requests G and J): a third-party OAuth redirect (a GET route with `PublicReason.AuthHandshake` on a path that is not a webhook or events path) is no longer judged as a webhook door; a call on a domain receipt port (no base class, constructor of platform ports only, one of them the Inbox) inside the receipt transaction is the inbox record and not processing; an intake that does process the delivery is now reported with its own `intake` finding instead of the signed-metadata text.
|
|
608
616
|
- Known gaps (planned for alpha.19, Nest lifecycle conformance): no enforcer yet for exactly one validation pipe per app, for interceptors limited to logging, timeout and serialization and registered once, or for the absence of authentication middleware. Templates and examples conform today: one `APP_PIPE`, no interceptor, security-headers middleware only.
|
|
609
617
|
- Added: `no-guard-injects-guard` (R41 `BE_DEFAULT_DENY`, a18 lifecycle conformance): a guard class (implements `CanActivate` or named `...Guard`) has no constructor parameter that is another guard (a `...Guard` or `CanActivate` type, `Type<CanActivate>`, or `@Inject(SomeGuard)`); the app registers `RateLimitGuard`, `OriginGuard`, `CredentialGuard` and `AuthGuard` as four global `APP_GUARD`s and `@Credential({ kind })` selects the credential behavior.
|
|
610
|
-
- Added: R278 `BE_REST_DOOR_EVIDENCE` / `BE_REST_ROUTE_UNDECLARED` accept a credential-guarded route
|
|
618
|
+
- Added: R278 `BE_REST_DOOR_EVIDENCE` / `BE_REST_ROUTE_UNDECLARED` accept a credential-guarded route: `@Credential({ kind: "<literal>" })` from the domain identity capability on the route or controller, with the capability declaring a `CredentialGuard implements CanActivate`, resolved by TypeScript symbol. A local decorator, another `@UseGuards` guard and a computed kind still fail.
|
|
611
619
|
- Fixed (R281 `BE_SPEC_FORM_ALL_ROLES`, a18 NIVO request A): `spec-infra-double-from-kit` judges a function subject by the callable subset of the sibling's exports (constants, enums, `export ... from` re-exports and overload signatures no longer disable the check; overloads collapse to the implementation); a value-object subject (an undecorated class whose constructor parameters carry no injection token) may be built with `new` (`spec-no-new-subject`, `spec-builds-with-testing-module`, and `useValue: new Subject(...)` in `spec-infra-double-from-kit`) while a decorated or token-injected class stays mandatory; a member of a kit `mock<T>()` object (`mock<{ open: F }>().open`) counts as a kit double.
|
|
612
620
|
|
|
613
621
|
## 3.4.0 - 2026-10-15
|
|
614
|
-
- Added: `module-definition-required` (R295 `BE_MODULE_DEFINITION_MISSING
|
|
622
|
+
- Added: `module-definition-required` (R295 `BE_MODULE_DEFINITION_MISSING`): every `<x>.module.ts` of a feature, capability or projection has a sibling `<x>.module-definition.ts` and `<x>.options.ts`, its class extends the `ConfigurableModuleClass` of that definition, and a module of the product is listed in an `imports` array only as `X.register(...)`.
|
|
615
623
|
- Changed: `capability-module-shape` judges the definition of every module: the representative module of a capability keeps `.setExtras({ isGlobal: false }, ...)` and the one `register` override; a sub-module, feature, transport module or cli group builds `.setClassMethodName("register").build()` and overrides nothing. A module definition in a feature is no longer refused.
|
|
616
624
|
|
|
617
625
|
## 3.3.1 - 2026-10-15
|
|
@@ -624,7 +632,7 @@
|
|
|
624
632
|
- Changed: the bundled architecture machine carries `HFS_DUPLICATE_CODE` canon-shape exclusions, staged dead-export consumers and the `<app>.env.ts` role.
|
|
625
633
|
|
|
626
634
|
|
|
627
|
-
- Added: law `app-composition` (R245 and R246
|
|
635
|
+
- Added: law `app-composition` (R245 and R246). `app-options-composition-free` (`BE_APP_OPTIONS_COMPOSITION`) keeps `apps/<app>/src/<app>.options.ts` to env-derived options and port bindings (provider maps such as `{ approvalGate: X }`): an array that lists a `*Module` class, a `X.register(...)`/`forRoot(...)`/`registerQueue(...)` call, a `*SchedulerOf(...)`/`*Queue(...)` entry or a spread of such a list, and an `imports`, `modules`, `schedulers` or `processors` array are refused, pointing to `compose/<area>.ts`. `app-file-budget` (`BE_APP_COMPOSITION_BUDGET`) holds `main.ts` (80), `<app>.options.ts` (200), `compose/<area>.ts` (120) and `app.module.ts` (250) to the `budget` of their app slot; the budget is absolute. The role of an app file is the slot entry it matches (`lib/app-roles.mjs`), never a path list.
|
|
628
636
|
- Changed: `is-global-only-in-app` accepts `isGlobal: true` in the composition groups `apps/<app>/src/compose/<area>.ts` (they are part of the app root), and the bundled architecture machine reads an app's root and its groups as one composition (register-once, module-per-transport, the connection and context maps).
|
|
629
637
|
- Changed: carry the runtime mirror of HFS manifest 3.1.0 (rule catalog 3.1.0) and the canon pins of eslint-canon-fe 8.2.17, HFS 4.3.0 and CLI 1.2.16.
|
|
630
638
|
|
|
@@ -638,7 +646,7 @@
|
|
|
638
646
|
|
|
639
647
|
## 3.2.17 - 2026-10-13
|
|
640
648
|
|
|
641
|
-
- Changed: the bundled canon-pins copy carries `@heroicons/react` 2.2.0 and `@starci/heroicons` 0.3.3 in place of `@phosphor-icons/react` (the heroicons family is the one icon set
|
|
649
|
+
- Changed: the bundled canon-pins copy carries `@heroicons/react` 2.2.0 and `@starci/heroicons` 0.3.3 in place of `@phosphor-icons/react` (the heroicons family is the one icon set) and the pins of eslint-canon-fe 8.2.16, HFS 4.2.15 and CLI 1.2.15. ESLint rule implementations are unchanged.
|
|
642
650
|
|
|
643
651
|
## 3.2.16 - 2026-10-13
|
|
644
652
|
|
|
@@ -807,7 +815,7 @@
|
|
|
807
815
|
- Added: the Operations law (R95 `BE_OPERATION_CONTRACT`, `operations.mjs`): `operation-contract-decidable` refuses an `OperationContract` whose input or output is `any`, `unknown`, `Record<string, unknown>`, an unbound generic, a function or a standard-library class, or whose refusal codes are not a closed union of string literals; `operation-route-driven-by-table` requires a route that takes `OperationRequest<Table>` or answers `OperationReply<Table>` to do both, of one table. The canon types are recognised by where they are declared (the platform capability `operations`).
|
|
808
816
|
- Changed: `no-non-ascii-source` (R89) folds each line to NFC before it looks for a Vietnamese letter, so a decomposed spelling is caught like the precomposed one, and it exempts the i18n fixtures slot `be.tests.fixtures.i18n` (`src/tests/fixtures/i18n/`) beside the message-catalog slots; a test title, an identifier and a string in any other spec or fixture are still refused. The detection is `scripts/lib/language.mjs`, shipped in `runtime/`.
|
|
809
817
|
|
|
810
|
-
- Changed: the messages and header of `tests-no-override` and `tests-infra-only-in-world` (`test-world.mjs`) follow
|
|
818
|
+
- Changed: the messages and header of `tests-no-override` and `tests-infra-only-in-world` (`test-world.mjs`) follow R47: a service of the repository's own stack runs real and is failed on purpose through `world.infra.<service>`, only an external SaaS is a network fake (`world.fake.<provider>`). Detection is unchanged.
|
|
811
819
|
- Breaking: one configuration, `export default starciBeConfig({ hfs: loadHfs(import.meta.url) })`. The factory is async
|
|
812
820
|
(ESLint awaits it), turns typed linting on for every `.ts/.mts/.cts/.js/.mjs/.cjs` (`parserOptions.projectService`),
|
|
813
821
|
ignores only `dist/`, `coverage/`, `node_modules/`, borrows `@typescript-eslint/{consistent-type-assertions (never),
|
|
@@ -903,7 +911,7 @@ Round 3 back-end rules (catalog R78 to R82), each with RuleTester specs and a wh
|
|
|
903
911
|
|
|
904
912
|
- New: `user-copy-through-catalog` (R78 `BE_USER_COPY_LITERAL`, new law `user-copy`): a literal exception message, a `subject`/`title`/`body`/`text`/`message` property of a `notify`/`send`/`publish` call, or a `message`/`description`/`title` property of a `transport/` response comes from the per-capability messages catalog through the typed `MessageCatalog` port; a short code-shaped literal (`UPPER_SNAKE`, a bare word) and a template literal are left alone. `no-ambient-clock` (R79 `BE_AMBIENT_CLOCK`, new law `temporal`): `Date.now()`, a bare `new Date()` and `performance.now()` are read only inside `platform/clock`; `new Date(value)` built from a value the caller already holds is exempt. `inbox-dedupe-required` (R80 `BE_INBOX_DEDUPE_MISSING`, new law `idempotency`): a `@Public()` webhook controller and an outbox/queue consumer (`<event>.consumer.ts`) show a reference to an inbox or dedupe port before they act. `no-hand-rolled-retry` (R81 `BE_HAND_ROLLED_RETRY`, in `resilience`): a `for`, `while` or `do...while` loop that both catches an error and calls something shaped like a delay (`sleep`, `delay`, `wait`, `backoff`, `setTimeout`) goes through `platform/retry`; a polling loop with no `catch` is exempt, same as `no-query-in-loop` exempts a polling `while`. `no-external-call-in-transaction` (R82 `BE_TRANSACTION_EXTERNAL_CALL`, in `data-access`): `fetch`, an HTTP client call or any method of a `*Client`/`*Sdk` receiver does not run inside `.transaction(async (tx) => ...)`.
|
|
905
913
|
- Slot manifest (`knowledge/hfs/slots.yaml`, no version bump, additions stamped `since: 1.0.0`): `be.domain.messages` (`src/modules/{domain,integrations}/<capability>/messages/`) and `be.feature.messages` (`src/features/<feature>/messages/`), each an optional per-capability or per-feature vi/en catalog; `be.platform`'s required instances gain `clock` (the injected `Clock` port) and `i18n` (the `MessageCatalog` port); `be.domain` and `be.feature` allow a `messages/` folder.
|
|
906
|
-
- Deferred (
|
|
914
|
+
- Deferred (no rule): floating promises; core `no-await-in-loop` is not adopted.
|
|
907
915
|
|
|
908
916
|
## 1.5.0 - 2026-09-30
|
|
909
917
|
|
package/README.md
CHANGED
|
@@ -38,7 +38,7 @@ A sample, not the list:
|
|
|
38
38
|
| Area | What the rules hold |
|
|
39
39
|
|---|---|
|
|
40
40
|
| **Errors** | A `catch` rethrows, calls a method on a `Logger` receiver (typed, from `platform/logging`) or returns an outcome carrying its cause; a `DomainError` subclass lives only in `errors/<capability>.error.ts` of its owner, and that file is one code enum, one `Record<Code, ErrorKind>` table and one empty class; a `throw` throws a `DomainError`, never a bare `Error`, a framework exception or a platform error out of a domain; a root workspace package throws the error base its `package.json` declares (`starci.errorBase`) (`catch-must-account`, `error-home`, `throw-domain-error`, `error-family-shape`) |
|
|
41
|
-
| **Schema authority** | Migrations only: every DataSource or TypeORM options object states the literal `synchronize: false` (found by the contextual type), no `migrationsRun`, no DDL string outside a migration, no entity glob; no `@Entity` type reachable from a transport signature, a handler `execute`, a contract or a message, and no GraphQL or validator import in an entity file (`no-runtime-schema`, `no-entity-in-contract`) |
|
|
41
|
+
| **Schema authority** | Migrations only: every DataSource or TypeORM options object states the literal `synchronize: false` (found by the contextual type), no `migrationsRun`, no DDL string outside a migration (but the renderer files hfs.json `sides.be.ddlRenderers` declares, which only build and return DDL text and are not reachable from run-time code), no entity glob; no `@Entity` type reachable from a transport signature, a handler `execute`, a contract or a message, and no GraphQL or validator import in an entity file (`no-runtime-schema`, `no-entity-in-contract`) |
|
|
42
42
|
| **Config and secrets** | `process.env` (any form) is allowed in the `platform/config` file declaring `EnvSource`, the test world (slot `be.tests.world`) and the app bootstrap roles `apps/<app>/src/main.ts` and its matching `<app>.env.ts`; only those two app roles may read `EnvSource` or capability parse helpers. Compose groups and `<app>.options.ts` never read `process.env` or `EnvSource`. `@nestjs/config` and `dotenv` are forbidden config paths. A function exported by a `<capability>.config.ts` keeps its existing name and is called only from these bootstrap roles, its own config file or spec, the test world and a provider contract spec (`config-parsed-in-main`). Secrets use `EnvSource.secret()`: `<NAME>_FILE` takes priority for `.starcistacks` custody, and plain `<NAME>` is read only when the file key is absent; a declared file supplies exact contents and an empty or unreadable path fails startup without fallback. No default of any kind for a value typed `Secret` or `Url`; secrets compare with `timingSafeEqual` (`no-direct-env-read`, `config-parsed-in-main`, `no-secret-default`, `secret-compare-timing-safe`) |
|
|
43
43
|
| **Model calls** (R326, R327, R344) | Every model call goes through the `@starci/ai-router` gateway: an upstream provider key variable (`PROVIDER_KEY_VARIABLES` of `src/ai-gateway.ts`, with its `_FILE` twin) is named only in the gateway's custody owner `integrations/ai-gateway`, specs and the test world included; code builds only `ChatOpenAI` and `OpenAIEmbeddings` of `@langchain/openai`, each from an inline options object whose `configuration.baseURL` is read from a `<c>.options.ts` type and whose `apiKey` is a `platform/config` `Secret` revealed; `integrations/ai` reads exactly `STARCI_AI_KEY`, the one virtual key of every client, and the custody owner passes the gateway no `adminToken`. Which owner may import LangChain, `openai`, a provider SDK or an agent framework is the infrastructure table (`provider-key-custody`, `ai-client-through-gateway`, `ai-virtual-key-name`, `infra-import-owner`) |
|
|
44
44
|
| **Ambient ids** (R142) | `randomUUID` of Node's crypto (named, namespace or global), the `v1`, `v4`, `v6` and `v7` generators of `uuid`, `nanoid` and `ulid` are used only inside `platform/ids`, specs included: code asks the injected `Ids` port and a spec provides `fakeIds()`; the generators are found by the module they are imported from, never by a local name (`no-ambient-id`) |
|
package/dist/app-composition.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The rules that hold the composition files of a back-end app (catalog R245 `BE_APP_OPTIONS_COMPOSITION`, R265
|
|
3
3
|
* `BE_COMPOSITION_UNTYPED` and R246
|
|
4
|
-
* `BE_APP_COMPOSITION_BUDGET
|
|
4
|
+
* `BE_APP_COMPOSITION_BUDGET`). An app's `src/` holds five roles, named by the entries of its `be.app.*` slot (`lib/app-roles.mjs`):
|
|
5
5
|
* `main.ts`, `app.module.ts`, `<app>.env.ts`, `<app>.options.ts` and the composition groups `compose/<area>.ts`.
|
|
6
6
|
*
|
|
7
7
|
* - `app-options-composition-free` (`BE_APP_OPTIONS_COMPOSITION`) keeps `<app>.env.ts` to typed, fail-fast environment
|
package/dist/connections.js
CHANGED
|
@@ -27,7 +27,7 @@ const RAW_CONNECTION_CALLS = new Set(["InjectEntityManager", "InjectDataSource",
|
|
|
27
27
|
const FUNCTION_LIKE = new Set(["ArrowFunctionExpression", "FunctionExpression", "CallExpression"]);
|
|
28
28
|
/** Whether a file may build connections: the platform database capability and the cli app. */
|
|
29
29
|
const mayBuildConnections = (hfs, file) => inDatabaseCapability(hfs, file) || inCli(hfs, file);
|
|
30
|
-
/** `new DataSource(` also in the test world (`src/tests/world`), which owns the shared test infrastructure
|
|
30
|
+
/** `new DataSource(` also in the test world (`src/tests/world`), which owns the shared test infrastructure. */
|
|
31
31
|
const mayConstructDataSource = (hfs, file) => mayBuildConnections(hfs, file) || inTestWorld(hfs, file);
|
|
32
32
|
/** The connection whose name a string literal spells, or undefined. */
|
|
33
33
|
const connectionNamed = (hfs, node) => node?.type === "Literal" && typeof node.value === "string" ? connectionsOf(hfs).find((connection) => connection.name === node.value) : undefined;
|
package/dist/entity-base.js
CHANGED
|
@@ -84,8 +84,8 @@ export const entityExtendsBase = {
|
|
|
84
84
|
docs: { description: "An @Entity class does not repeat created_at / updated_at (or the generated uuid id beside them); it extends AbstractEntity or UuidAbstractEntity of @modules/platform/database." },
|
|
85
85
|
schema: [],
|
|
86
86
|
messages: {
|
|
87
|
-
timestamp: `\`{{entity}}\` maps \`{{column}}\` itself. Columns every table shares are inherited, never repeated (BE-PERSISTENCE-3
|
|
88
|
-
key: `\`{{entity}}\` maps the generated uuid \`id\` beside \`created_at\` and \`updated_at\` itself. Columns every table shares are inherited, never repeated (BE-PERSISTENCE-3
|
|
87
|
+
timestamp: `\`{{entity}}\` maps \`{{column}}\` itself. Columns every table shares are inherited, never repeated (BE-PERSISTENCE-3): extend \`{{base}}\` imported from \`${DATABASE_MODULE}\` and drop this property. A table whose timestamps the application sets, or that lacks one of them, extends nothing and maps its own with a plain \`@Column\`.`,
|
|
88
|
+
key: `\`{{entity}}\` maps the generated uuid \`id\` beside \`created_at\` and \`updated_at\` itself. Columns every table shares are inherited, never repeated (BE-PERSISTENCE-3): extend \`${UUID_BASE_ENTITY}\` imported from \`${DATABASE_MODULE}\` and drop the three properties.`,
|
|
89
89
|
},
|
|
90
90
|
},
|
|
91
91
|
create(context) {
|
package/dist/feature-thin.js
CHANGED
|
@@ -306,7 +306,7 @@ const isCqrsDataConstructor = (context, node) => {
|
|
|
306
306
|
/**
|
|
307
307
|
* `registerEnumType(...)` of `@nestjs/graphql` at module top level of a `<name>.type.ts` file of the GraphQL transport slot
|
|
308
308
|
* (`be.transport.graphql`). It declares a schema enum: `starci app emit` loads only the resolver, scalar and `include` module files, so the
|
|
309
|
-
* registration must sit in a file the resolver imports, and the `.type.ts` is that file (
|
|
309
|
+
* registration must sit in a file the resolver imports, and the `.type.ts` is that file (docs/microservices.md#r264).
|
|
310
310
|
* The same call in any other role or slot, or nested in a function, stays executable logic.
|
|
311
311
|
*/
|
|
312
312
|
const isEnumRegistration = (context, hfs, node, role) => role === "type"
|
package/dist/function-budget.js
CHANGED
|
@@ -10,7 +10,7 @@ export const functionLineBudget = {
|
|
|
10
10
|
},
|
|
11
11
|
},
|
|
12
12
|
create(context) {
|
|
13
|
-
//
|
|
13
|
+
// A manifest without `ruleParams.functionLines` gets the cap of 80 lines.
|
|
14
14
|
const max = hfsOf(context).ruleParams.functionLines ?? 80;
|
|
15
15
|
if (!Number.isInteger(max) || max < 1)
|
|
16
16
|
throw new RangeError("ruleParams.functionLines must be a positive integer");
|
package/dist/lib/hfs-view.d.ts
CHANGED
|
@@ -114,6 +114,11 @@ export interface HfsRuleParams {
|
|
|
114
114
|
readonly file: string;
|
|
115
115
|
readonly reason: string;
|
|
116
116
|
}[];
|
|
117
|
+
/** The root-package files that render DDL text only to return it, app-root-relative with a reason (hfs.json `sides.be.ddlRenderers`). */
|
|
118
|
+
readonly ddlRenderers?: readonly {
|
|
119
|
+
readonly path: string;
|
|
120
|
+
readonly reason: string;
|
|
121
|
+
}[];
|
|
117
122
|
}
|
|
118
123
|
/** The frozen view of one side of an app. */
|
|
119
124
|
export interface HfsView {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
export declare const PACKAGE_ROOT: string;
|
|
3
3
|
/**
|
|
4
4
|
* The runtime of the installed @starci/hfs (its peer, a same-minor range): the slot manifest, the rule catalog, the canon pins and the architecture
|
|
5
|
-
* machine are read from it at run time, never from a copy bundled here, so an hfs data change releases hfs alone
|
|
5
|
+
* machine are read from it at run time, never from a copy bundled here, so an hfs data change releases hfs alone.
|
|
6
6
|
*/
|
|
7
7
|
export declare const RUNTIME_ROOT: string;
|
|
8
8
|
/** The files this package keeps of its own in runtime/ (the project graph rule, the jsdoc and sonar helpers, the package-scripts template). */
|
package/dist/lib/runtime-root.js
CHANGED
|
@@ -9,7 +9,7 @@ import { fileURLToPath } from "node:url";
|
|
|
9
9
|
export const PACKAGE_ROOT = join(dirname(fileURLToPath(import.meta.url)), "..", "..");
|
|
10
10
|
/**
|
|
11
11
|
* The runtime of the installed @starci/hfs (its peer, a same-minor range): the slot manifest, the rule catalog, the canon pins and the architecture
|
|
12
|
-
* machine are read from it at run time, never from a copy bundled here, so an hfs data change releases hfs alone
|
|
12
|
+
* machine are read from it at run time, never from a copy bundled here, so an hfs data change releases hfs alone.
|
|
13
13
|
*/
|
|
14
14
|
export const RUNTIME_ROOT = join(dirname(createRequire(import.meta.url).resolve("@starci/hfs/package.json")), "runtime");
|
|
15
15
|
/** The files this package keeps of its own in runtime/ (the project graph rule, the jsdoc and sonar helpers, the package-scripts template). */
|
package/dist/lib/types.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Type-aware helpers: a rule asks what a node IS (its TypeScript type and where that type is declared), never what it
|
|
3
3
|
* is called. `starciBeConfig` turns typed linting on for every file (`parserOptions.projectService`), so these
|
|
4
4
|
* helpers refuse to run without the program instead of falling back to a name match: a rule that silently degrades to
|
|
5
|
-
* a heuristic is
|
|
5
|
+
* a heuristic is a loophole.
|
|
6
6
|
*/
|
|
7
7
|
import ts from "typescript";
|
|
8
8
|
import type { ParserServicesWithTypeInformation } from "@typescript-eslint/utils";
|
package/dist/lib/types.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Type-aware helpers: a rule asks what a node IS (its TypeScript type and where that type is declared), never what it
|
|
3
3
|
* is called. `starciBeConfig` turns typed linting on for every file (`parserOptions.projectService`), so these
|
|
4
4
|
* helpers refuse to run without the program instead of falling back to a name match: a rule that silently degrades to
|
|
5
|
-
* a heuristic is
|
|
5
|
+
* a heuristic is a loophole.
|
|
6
6
|
*/
|
|
7
7
|
import ts from "typescript";
|
|
8
8
|
/**
|
|
@@ -56,7 +56,7 @@ const isBusinessOrigin = (hfs, origin) => {
|
|
|
56
56
|
/**
|
|
57
57
|
* A domain receipt port records a delivery and processes nothing: a class with no base class whose constructor takes only platform
|
|
58
58
|
* ports (and TypeORM), at least one of them the platform `Inbox` (or its `EntityInbox` extension). It cannot reach another domain service or the CQRS buses, so a call
|
|
59
|
-
* on it inside the receipt transaction is the inbox record itself
|
|
59
|
+
* on it inside the receipt transaction is the inbox record itself.
|
|
60
60
|
*/
|
|
61
61
|
const isReceiptPort = (checker, hfs, type) => {
|
|
62
62
|
const declaration = type.getSymbol()?.getDeclarations()?.find(ts.isClassDeclaration);
|
package/dist/module-shape.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export declare const noModuleLet: RuleModule;
|
|
|
16
16
|
/** One `@Module` class per file. */
|
|
17
17
|
export declare const oneModulePerFile: RuleModule;
|
|
18
18
|
/**
|
|
19
|
-
* The shape of a module's definition (BE-CONVENTION 1.2
|
|
19
|
+
* The shape of a module's definition (BE-CONVENTION 1.2): the representative
|
|
20
20
|
* module of a capability builds `new ConfigurableModuleBuilder<XOptions>().setExtras({ isGlobal: false }, ...).build()` and
|
|
21
21
|
* may override only `static register(options: typeof OPTIONS_TYPE): DynamicModule`; every other module (a sub-module, a feature,
|
|
22
22
|
* a transport, a cli group) builds `new ConfigurableModuleBuilder<XOptions>().setClassMethodName("register").build()` and
|
|
@@ -24,7 +24,7 @@ export declare const oneModulePerFile: RuleModule;
|
|
|
24
24
|
*/
|
|
25
25
|
export declare const capabilityModuleShape: RuleModule;
|
|
26
26
|
/**
|
|
27
|
-
* Every Nest module has a module definition and is registered through it
|
|
27
|
+
* Every Nest module has a module definition and is registered through it: its
|
|
28
28
|
* `<x>.module.ts` has a sibling `<x>.module-definition.ts` and `<x>.options.ts`, its class extends the `ConfigurableModuleClass`
|
|
29
29
|
* of that definition, and a module of the product is listed in an `imports` array only as `X.register(...)`, never as a bare
|
|
30
30
|
* class. The `AppModule` of an app root and the test world are composition roots and are not judged here.
|
package/dist/module-shape.js
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* capability's representative module is reached through its `Inject*()` decorators, never by import. One owner may
|
|
13
13
|
* import its own modules (a transport module its feature's application module, a representative its sub-modules);
|
|
14
14
|
* the app composes every owner.
|
|
15
|
-
* - `capability-module-shape` holds the definition of every module
|
|
15
|
+
* - `capability-module-shape` holds the definition of every module: the representative
|
|
16
16
|
* `<c>.module-definition.ts` of a capability is `defineCapabilityModule<XOptions>()` of `@starci/nest-kit` (or a typed
|
|
17
17
|
* `ConfigurableModuleBuilder` with `.setExtras({ isGlobal: false }, ...)` and `.build()`); every other module's definition (a
|
|
18
18
|
* sub-module, a feature, a transport, a cli group) is `defineConfigurableModule<XOptions>()` (or
|
|
@@ -419,7 +419,7 @@ const moduleFileOf = (hfs, filename) => {
|
|
|
419
419
|
return { kind: suffix === ".module.ts" ? "module" : "definition", tier, name, representative };
|
|
420
420
|
};
|
|
421
421
|
/**
|
|
422
|
-
* The shape of a module's definition (BE-CONVENTION 1.2
|
|
422
|
+
* The shape of a module's definition (BE-CONVENTION 1.2): the representative
|
|
423
423
|
* module of a capability builds `new ConfigurableModuleBuilder<XOptions>().setExtras({ isGlobal: false }, ...).build()` and
|
|
424
424
|
* may override only `static register(options: typeof OPTIONS_TYPE): DynamicModule`; every other module (a sub-module, a feature,
|
|
425
425
|
* a transport, a cli group) builds `new ConfigurableModuleBuilder<XOptions>().setClassMethodName("register").build()` and
|
|
@@ -502,7 +502,7 @@ const importsArrayOf = (property) => (!property.computed && keyName(property.key
|
|
|
502
502
|
/** The PascalCase options type name a module file name implies: `sepay-feed-http` gives `SepayFeedHttpOptions`. */
|
|
503
503
|
const optionsTypeOf = (name) => `${name.replace(/(?:^|-)(\w)/g, (_, letter) => letter.toUpperCase())}Options`;
|
|
504
504
|
/**
|
|
505
|
-
* Every Nest module has a module definition and is registered through it
|
|
505
|
+
* Every Nest module has a module definition and is registered through it: its
|
|
506
506
|
* `<x>.module.ts` has a sibling `<x>.module-definition.ts` and `<x>.options.ts`, its class extends the `ConfigurableModuleClass`
|
|
507
507
|
* of that definition, and a module of the product is listed in an `imports` array only as `X.register(...)`, never as a bare
|
|
508
508
|
* class. The `AppModule` of an app root and the test world are composition roots and are not judged here.
|
package/dist/operations.js
CHANGED
|
@@ -490,7 +490,7 @@ const credentialGuardDeclared = (context, decoratorCallee_) => {
|
|
|
490
490
|
return false;
|
|
491
491
|
};
|
|
492
492
|
/**
|
|
493
|
-
* Credential-guarded route (BE_REST_DOOR_EVIDENCE
|
|
493
|
+
* Credential-guarded route (BE_REST_DOOR_EVIDENCE): the route, or its controller class, carries
|
|
494
494
|
* `@Credential({ kind: "<literal>" })` imported from the domain identity capability, and that capability declares a
|
|
495
495
|
* `CredentialGuard implements CanActivate`. A same-named local decorator, a `@UseGuards` of any other guard and a non-literal kind prove nothing.
|
|
496
496
|
*/
|
|
@@ -508,7 +508,7 @@ const credentialGuardEvidence = (context, method) => {
|
|
|
508
508
|
return false;
|
|
509
509
|
};
|
|
510
510
|
/**
|
|
511
|
-
* Event-stream evidence (BE_REST_DOOR_EVIDENCE
|
|
511
|
+
* Event-stream evidence (BE_REST_DOOR_EVIDENCE): the route is an `@Sse` method of `@nestjs/common` inside the sse slot of a
|
|
512
512
|
* realtime channel. It is structural, not a name list: the same `@Sse` anywhere else, or any other route inside the sse slot, proves nothing.
|
|
513
513
|
*/
|
|
514
514
|
const eventStreamEvidence = (context, method) => hfsOf(context).slotOf(context.filename) === SSE_SLOT
|
package/dist/schema-authority.js
CHANGED
|
@@ -13,6 +13,10 @@
|
|
|
13
13
|
* `@Entity` (a per-entity switch is a second authority); a lifecycle hook (`onModuleInit`, `onApplicationBootstrap`) that
|
|
14
14
|
* writes rows through an `EntityManager` or `DataSource` (seeding is a cli command); a DDL statement in any string
|
|
15
15
|
* outside the migrations of `persistence/`; and an entity or migration glob. Only the cli (its migrate and seed commands) runs migrations and seeds.
|
|
16
|
+
* One declared exception: a root-package file hfs.json `sides.be.ddlRenderers` lists (the renderer a cli command uses to write NEW
|
|
17
|
+
* migration files) may hold DDL text, but only to build and return it: in that file a database client import (typeorm, pg, ...) and a
|
|
18
|
+
* `.query/.execute/.raw/.unsafe` call are refused, and a file outside the cli and the root packages that imports a symbol the
|
|
19
|
+
* renderer declares (directly or through a package barrel) is refused, so the text never reaches a run-time path.
|
|
16
20
|
* - `no-entity-in-contract` (R37 `BE_ENTITY_IN_CONTRACT`) keeps ORM entities out of the types that cross a boundary:
|
|
17
21
|
* any type whose declaration carries `@Entity` (from `typeorm`), reached through the type arguments and properties of
|
|
18
22
|
* a transport signature, the `execute` of a handler, or a `*.contracts.ts`, `*.command.ts` or `*.query.ts` file; and
|
|
@@ -21,6 +25,7 @@
|
|
|
21
25
|
* Where a file lives is asked of the slot view (`be.persistence` and its `migrations/` folder, the transport slots),
|
|
22
26
|
* never of a path pattern.
|
|
23
27
|
*/
|
|
28
|
+
import path from "node:path";
|
|
24
29
|
import ts from "typescript";
|
|
25
30
|
import { isTransportSlot } from "./lib/transport-slots.js";
|
|
26
31
|
import { keyName, walk } from "./lib/ast.js";
|
|
@@ -47,6 +52,21 @@ const WRITE_METHODS = new Set(["insert", "save", "upsert", "update", "delete", "
|
|
|
47
52
|
const WRITE_SQL = /\b(?:INSERT\s+INTO|UPDATE\s+\S+\s+SET|DELETE\s+FROM|MERGE\s+INTO)\b/i;
|
|
48
53
|
/** The Nest lifecycle hooks that run at boot in every process that composes the provider. */
|
|
49
54
|
const BOOT_HOOKS = new Set(["onModuleInit", "onApplicationBootstrap"]);
|
|
55
|
+
/** Packages whose import in a DDL renderer would let it run the text it builds. */
|
|
56
|
+
const DATABASE_CLIENTS = ["typeorm", "@nestjs/typeorm", "pg", "pg-promise", "postgres", "slonik", "knex", "kysely", "mysql2", "better-sqlite3", "drizzle-orm"];
|
|
57
|
+
/** Calls that run SQL text. */
|
|
58
|
+
const EXECUTING_CALLS = new Set(["query", "execute", "exec", "raw", "unsafe"]);
|
|
59
|
+
/** Whether `rel` (forward slashes) matches a declared renderer path, a `*` only in the file name. */
|
|
60
|
+
const matchesRenderer = (rel, patterns) => patterns.some((pattern) => {
|
|
61
|
+
const cut = pattern.lastIndexOf("/");
|
|
62
|
+
if (rel.slice(0, cut + 1) !== pattern.slice(0, cut + 1))
|
|
63
|
+
return false;
|
|
64
|
+
const name = pattern.slice(cut + 1);
|
|
65
|
+
const expression = new RegExp(`^${name.split("*").map((part) => part.replace(/[.+?^${}()|[\]\\]/g, "\\$&")).join("[^/]*")}$`);
|
|
66
|
+
return expression.test(rel.slice(cut + 1));
|
|
67
|
+
});
|
|
68
|
+
/** The app-root-relative paths a declaration file can have under this view (a package view is rooted at the app root, the be view one level below). */
|
|
69
|
+
const appRelatives = (hfs, file) => [path.relative(hfs.repoRoot, file), path.relative(path.dirname(hfs.repoRoot), file)].map((text) => text.split(path.sep).join("/"));
|
|
50
70
|
const isFalse = (node) => node?.type === "Literal" && node.value === false;
|
|
51
71
|
/** The text of every string literal and template chunk under `node`. */
|
|
52
72
|
const stringsUnder = (node) => {
|
|
@@ -137,6 +157,9 @@ export const noRuntimeSchema = {
|
|
|
137
157
|
entitySynchronize: "`synchronize` is set in the options of `@Entity`. A per-entity switch is a second schema authority next to the connection's literal `false`; delete the key.",
|
|
138
158
|
bootSeed: "`{{hook}}` writes rows (`{{call}}`), so every process that composes this provider seeds at boot. Seeding is a cli command, run once per connection.",
|
|
139
159
|
ddl: "A schema-changing statement (`CREATE|ALTER|DROP ...`) outside `persistence/migrations/`. Schema-changing SQL belongs in a migration.",
|
|
160
|
+
rendererClient: "A declared DDL renderer imports `{{source}}`, a database client. A renderer only builds DDL text and returns it; the cli writes it as a new migration file and the migrate command runs it.",
|
|
161
|
+
rendererExecutes: "A declared DDL renderer calls `.{{name}}(...)`, which runs SQL text. A renderer only builds and returns DDL; it is never executed at run time.",
|
|
162
|
+
rendererImported: "`{{name}}` is declared in a DDL renderer (hfs.json sides.be.ddlRenderers) and this file is neither the cli nor a root package. DDL text is rendered by the cli entities command and written as a new migration file, never reached from run-time code.",
|
|
140
163
|
glob: "`{{key}}` is found by glob. List the entities and migrations explicitly from each capability's `index.ts` so what runs is what was reviewed.",
|
|
141
164
|
},
|
|
142
165
|
},
|
|
@@ -147,7 +170,46 @@ export const noRuntimeSchema = {
|
|
|
147
170
|
const hfs = hfsOf(context);
|
|
148
171
|
const migration = isMigrationFile(hfs, filename);
|
|
149
172
|
const migrationHost = isMigrationHost(hfs, filename);
|
|
173
|
+
const patterns = (hfs.ruleParams.ddlRenderers ?? []).map((entry) => entry.path);
|
|
174
|
+
const renderer = patterns.length > 0 && matchesRenderer(hfs.relative(filename), patterns);
|
|
175
|
+
// a file may reach a renderer's symbols only from the cli and from the root packages (the renderer's own package, its barrel and specs)
|
|
176
|
+
const mayReachRenderer = renderer || inCli(hfs, filename) || hfs.tierOf(filename) === "package";
|
|
177
|
+
/** Reports an import or re-export of a symbol a declared renderer declares, from a file that may not reach it. */
|
|
178
|
+
const checkRendererImport = (node) => {
|
|
179
|
+
if (patterns.length === 0 || mayReachRenderer || !node.source)
|
|
180
|
+
return;
|
|
181
|
+
if ((node.type === "ImportDeclaration" && node.importKind === "type") || (node.type === "ExportNamedDeclaration" && node.exportKind === "type"))
|
|
182
|
+
return;
|
|
183
|
+
const { checker, toTs } = typed(context);
|
|
184
|
+
const tsNode = toTs(node);
|
|
185
|
+
const specifier = tsNode && (ts.isImportDeclaration(tsNode) || ts.isExportDeclaration(tsNode)) ? tsNode.moduleSpecifier : undefined;
|
|
186
|
+
const moduleSymbol = specifier ? checker.getSymbolAtLocation(specifier) : undefined;
|
|
187
|
+
if (!moduleSymbol)
|
|
188
|
+
return;
|
|
189
|
+
const declaredIn = (symbol) => {
|
|
190
|
+
const target = (symbol.flags & ts.SymbolFlags.Alias) !== 0 ? checker.getAliasedSymbol(symbol) : symbol;
|
|
191
|
+
return (target.declarations ?? []).some((declaration) => matchesRenderer(appRelatives(hfs, declaration.getSourceFile().fileName).find((text) => text.startsWith("packages/")) ?? "", patterns));
|
|
192
|
+
};
|
|
193
|
+
const exported = checker.getExportsOfModule(moduleSymbol);
|
|
194
|
+
const named = node.type === "ImportDeclaration"
|
|
195
|
+
? node.specifiers.filter((item) => !(item.type === "ImportSpecifier" && item.importKind === "type")).flatMap((item) => (item.type === "ImportSpecifier" ? [item.imported.type === "Identifier" ? item.imported.name : String(item.imported.value)] : item.type === "ImportDefaultSpecifier" ? ["default"] : null))
|
|
196
|
+
: node.type === "ExportNamedDeclaration" ? node.specifiers.map((item) => (item.local.type === "Identifier" ? item.local.name : String(item.local.value))) : null;
|
|
197
|
+
const hits = named === null || named.includes(null)
|
|
198
|
+
? exported.filter(declaredIn)
|
|
199
|
+
: exported.filter((symbol) => named.includes(symbol.name) && declaredIn(symbol));
|
|
200
|
+
const first = hits[0];
|
|
201
|
+
if (first)
|
|
202
|
+
context.report({ node, messageId: "rendererImported", data: { name: first.name } });
|
|
203
|
+
};
|
|
150
204
|
return {
|
|
205
|
+
ImportDeclaration(node) {
|
|
206
|
+
if (renderer && DATABASE_CLIENTS.some((client) => String(node.source.value) === client || String(node.source.value).startsWith(`${client}/`))) {
|
|
207
|
+
context.report({ node, messageId: "rendererClient", data: { source: String(node.source.value) } });
|
|
208
|
+
}
|
|
209
|
+
checkRendererImport(node);
|
|
210
|
+
},
|
|
211
|
+
ExportNamedDeclaration: checkRendererImport,
|
|
212
|
+
ExportAllDeclaration: checkRendererImport,
|
|
151
213
|
ObjectExpression(node) {
|
|
152
214
|
if (isOptionsObject(context, node) && !hasKey(node, "synchronize"))
|
|
153
215
|
context.report({ node, messageId: "synchronizeMissing" });
|
|
@@ -196,6 +258,8 @@ export const noRuntimeSchema = {
|
|
|
196
258
|
if (callee.type !== "MemberExpression" || callee.computed || callee.property.type !== "Identifier")
|
|
197
259
|
return;
|
|
198
260
|
const name = callee.property.name;
|
|
261
|
+
if (renderer && EXECUTING_CALLS.has(name))
|
|
262
|
+
context.report({ node, messageId: "rendererExecutes", data: { name } });
|
|
199
263
|
if (SCHEMA_OPERATIONS.has(name)) {
|
|
200
264
|
if (isPackageType(context, callee.object, "DataSource", "typeorm"))
|
|
201
265
|
context.report({ node, messageId: "synchronizeCall", data: { name } });
|
|
@@ -214,11 +278,11 @@ export const noRuntimeSchema = {
|
|
|
214
278
|
}
|
|
215
279
|
},
|
|
216
280
|
Literal(node) {
|
|
217
|
-
if (!migration && typeof node.value === "string" && DDL.test(node.value))
|
|
281
|
+
if (!migration && !renderer && typeof node.value === "string" && DDL.test(node.value))
|
|
218
282
|
context.report({ node, messageId: "ddl" });
|
|
219
283
|
},
|
|
220
284
|
TemplateElement(node) {
|
|
221
|
-
if (!migration && DDL.test(node.value.cooked ?? ""))
|
|
285
|
+
if (!migration && !renderer && DDL.test(node.value.cooked ?? ""))
|
|
222
286
|
context.report({ node, messageId: "ddl" });
|
|
223
287
|
},
|
|
224
288
|
};
|
package/dist/spec-quality.js
CHANGED
|
@@ -124,7 +124,7 @@ export const specNoSourceRead = {
|
|
|
124
124
|
},
|
|
125
125
|
};
|
|
126
126
|
/**
|
|
127
|
-
* R48
|
|
127
|
+
* R48: a unit spec takes its database double from the kit, `mockEntityManager()` (or
|
|
128
128
|
* `fakeTransaction()`) imported from `@starci/jest-preset`. It never builds an ad-hoc `EntityManager`, `QueryRunner`,
|
|
129
129
|
* `DataSource` or query builder, never types a `mock<EntityManager>()` and never takes a double from a repository fixture.
|
|
130
130
|
* Refused in a `*.spec.ts`: a call whose result is one of those typeorm types unless the called function is
|
package/dist/test-world.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The rules that hold the test layout (catalog R47 `BE_TEST_TOPOLOGY
|
|
2
|
+
* The rules that hold the test layout (catalog R47 `BE_TEST_TOPOLOGY`).
|
|
3
3
|
*
|
|
4
4
|
* Unit specs sit beside their subject. Everything else lives under `src/tests/`, one folder per kind:
|
|
5
5
|
* - `world/` the ONLY test infrastructure (slot `be.tests.world`): `global-setup.ts` starts (or attaches to) the stack
|
package/dist/webhooks.js
CHANGED
|
@@ -297,7 +297,7 @@ const routePaths = (context, decorator) => {
|
|
|
297
297
|
return decoratorArguments(decorator).flatMap((argument) => read(toTs(argument)));
|
|
298
298
|
};
|
|
299
299
|
/**
|
|
300
|
-
* A third-party OAuth redirect into the API
|
|
300
|
+
* A third-party OAuth redirect into the API:
|
|
301
301
|
* a GET named `callback` that declares the closed reason `PublicReason.AuthHandshake`. It is a browser redirect with no
|
|
302
302
|
* signature to verify, so it is not a webhook door. A POST, a `webhook` or `events` path, or any other reason is still judged.
|
|
303
303
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@starci/eslint-canon-be",
|
|
3
|
-
"version": "3.19.
|
|
3
|
+
"version": "3.19.2",
|
|
4
4
|
"description": "The StarCi back-end lint canon: every rule its laws publish, gathered as one flat-config plugin.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"node": ">=22.13.0"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"@starci/hfs": "~
|
|
43
|
+
"@starci/hfs": "~6.0.0",
|
|
44
44
|
"eslint": ">=9",
|
|
45
45
|
"typescript": ">=5.9"
|
|
46
46
|
},
|