@starci/eslint-canon-be 3.3.0 → 3.4.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.
- package/CHANGELOG.md +15 -0
- package/README.md +2 -2
- package/app-composition.mjs +348 -3
- package/authorization.mjs +68 -2
- package/builders.mjs +2 -2
- package/config-owner.mjs +44 -15
- package/default-deny.mjs +80 -9
- package/edge-hardening.mjs +139 -0
- package/feature-thin.mjs +78 -2
- package/function-budget.mjs +49 -0
- package/health-ready.mjs +539 -0
- package/index.mjs +37 -0
- package/infra-owner.mjs +3 -0
- package/jwt-alg.mjs +45 -0
- package/lib/subject-values.mjs +55 -0
- package/lib/unit-spec.mjs +0 -3
- package/lib/webhook-handoff-inbox.mjs +260 -0
- package/lib/webhook-handoff-intake.mjs +140 -0
- package/lib/why.mjs +13 -0
- package/module-shape.mjs +147 -51
- package/operations.mjs +165 -1
- package/package.json +1 -1
- package/realtime.mjs +59 -22
- package/resilience.mjs +45 -14
- package/runtime/knowledge/hfs/canon-pins.yaml +11 -11
- package/runtime/knowledge/hfs/fe-stack.yaml +22 -1
- package/runtime/knowledge/hfs/rules.yaml +3401 -152
- package/runtime/knowledge/hfs/slots.yaml +344 -62
- package/runtime/knowledge/patterns/fe/folder.yaml +1 -0
- package/runtime/knowledge/sonar-gate.yaml +1 -1
- package/runtime/modules/models/runtimes.yaml +1 -1
- package/runtime/packages/hfs/templates/app/package-scripts/package.json +1 -0
- package/runtime/scripts/api/git/lib.mjs +3 -0
- package/runtime/scripts/api/git/merge-base.mjs +9 -0
- package/runtime/scripts/api/git/recorded-lines.mjs +54 -8
- package/runtime/scripts/hfs/architecture/backend-app-files.mjs +1 -8
- package/runtime/scripts/hfs/architecture/backend.mjs +2 -7
- package/runtime/scripts/hfs/architecture/client-reaches-server.mjs +6 -3
- package/runtime/scripts/hfs/architecture/dead-exports-bindings.mjs +149 -0
- package/runtime/scripts/hfs/architecture/dead-exports.mjs +9 -41
- package/runtime/scripts/hfs/architecture/default-deny.mjs +8 -6
- package/runtime/scripts/hfs/architecture/frontend-world.mjs +1 -1
- package/runtime/scripts/hfs/architecture/function-spec-providers.mjs +153 -0
- package/runtime/scripts/hfs/architecture/hfs.mjs +3 -3
- package/runtime/scripts/hfs/architecture/module-per-transport.mjs +28 -13
- package/runtime/scripts/hfs/architecture/next-data-inference.mjs +176 -0
- package/runtime/scripts/hfs/architecture/next-data-symbols.mjs +26 -0
- package/runtime/scripts/hfs/architecture/next-data.mjs +31 -23
- package/runtime/scripts/hfs/architecture/reachability.mjs +14 -0
- package/runtime/scripts/hfs/architecture/register-once.mjs +2 -2
- package/runtime/scripts/hfs/architecture/source-names.mjs +48 -3
- package/runtime/scripts/hfs/architecture/supabase-ast.mjs +211 -11
- package/runtime/scripts/hfs/architecture/supabase-be.mjs +1 -1
- package/runtime/scripts/hfs/architecture/supabase.mjs +59 -21
- package/runtime/scripts/hfs/architecture/surface.mjs +2 -1
- package/runtime/scripts/hfs/architecture/tiers.mjs +3 -3
- package/runtime/scripts/hfs/architecture/unit-spec-providers.mjs +8 -2
- package/runtime/scripts/hfs/declaration-shape.mjs +39 -3
- package/runtime/scripts/hfs/edition-slots.mjs +2 -2
- package/runtime/scripts/hfs/manifest-shape.mjs +67 -7
- package/runtime/scripts/hfs/project-rule.mjs +3 -1
- package/runtime/scripts/hfs/rule-catalog.mjs +156 -11
- package/runtime/scripts/hfs/rule-params-shape.mjs +22 -10
- package/runtime/scripts/hfs/rules/secrets.mjs +13 -0
- package/runtime/scripts/hfs/slot-imports.mjs +18 -5
- package/runtime/scripts/hfs/slots.mjs +1 -0
- package/runtime/scripts/lib/env.mjs +20 -0
- package/runtime/scripts/lib/event-contract.mjs +107 -0
- package/runtime/scripts/lib/json-clone.mjs +61 -0
- package/runtime/scripts/lib/list.mjs +4 -0
- package/runtime/scripts/lib/secret-patterns.mjs +60 -5
- package/runtime/scripts/lib/stack-services.mjs +1 -1
- package/runtime/scripts/lib/ts-analysis.mjs +5 -2
- package/runtime/scripts/lib/ts-ast.mjs +27 -2
- package/service-isolation.mjs +3 -0
- package/size-budget.mjs +9 -5
- package/third-party-owner.mjs +149 -0
- package/transport.mjs +11 -29
- package/unit-spec.mjs +270 -84
- package/webhooks.mjs +169 -0
package/resilience.mjs
CHANGED
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
* - `no-hand-rolled-retry` (R81 `BE_HAND_ROLLED_RETRY`): a loop that catches an error and waits before trying
|
|
9
9
|
* again re-implements retry by hand, outside `platform/retry`'s bounded, jittered, abortable helper.
|
|
10
10
|
*
|
|
11
|
-
* A
|
|
11
|
+
* A config held in a variable or returned by a helper proves its deadline through its type.
|
|
12
12
|
*/
|
|
13
13
|
import ts from "typescript"
|
|
14
|
-
import { keyName, walk } from "./lib/ast.mjs"
|
|
14
|
+
import { keyName, staticText, walk } from "./lib/ast.mjs"
|
|
15
15
|
import { hfsOf } from "./lib/hfs.mjs"
|
|
16
16
|
import { isOwnedBy } from "./lib/ports.mjs"
|
|
17
17
|
import { isPackageType, isTypeNamed, typed } from "./lib/types.mjs"
|
|
@@ -25,11 +25,48 @@ const HTTP_CLIENT_TYPES = Object.freeze([["AxiosInstance", "axios"], ["AxiosStat
|
|
|
25
25
|
/** Whether the node's TYPE is an outbound HTTP client (an axios instance or the Nest `HttpService`), whatever it is called. */
|
|
26
26
|
const isHttpClient = (context, node) => HTTP_CLIENT_TYPES.some(([name, pkg]) => isPackageType(context, node, name, pkg))
|
|
27
27
|
|
|
28
|
-
const hasKey = (objectNode, names) =>
|
|
29
|
-
objectNode.properties.some((property) => property.type === "Property" && names.includes(keyName(property.key)))
|
|
30
|
-
|
|
31
28
|
const hasSpread = (objectNode) => objectNode.properties.some((property) => property.type === "SpreadElement")
|
|
32
29
|
|
|
30
|
+
/** A deadline value cannot be absent in any branch of its type. */
|
|
31
|
+
const mayBeAbsent = (type) => type.isUnion()
|
|
32
|
+
? type.types.some(mayBeAbsent)
|
|
33
|
+
: (type.flags & (ts.TypeFlags.Undefined | ts.TypeFlags.Null | ts.TypeFlags.Void)) !== 0
|
|
34
|
+
|
|
35
|
+
/** A non-literal config promises a present deadline in every possible branch, including a generic's constraint. */
|
|
36
|
+
const typeHasDeadline = (checker, type, atNode, names) => {
|
|
37
|
+
if ((type.flags & ts.TypeFlags.TypeParameter) !== 0) {
|
|
38
|
+
const constraint = checker.getBaseConstraintOfType(type)
|
|
39
|
+
return Boolean(constraint && constraint !== type) && typeHasDeadline(checker, constraint, atNode, names)
|
|
40
|
+
}
|
|
41
|
+
if (type.isUnion()) return type.types.every((part) => typeHasDeadline(checker, part, atNode, names))
|
|
42
|
+
if ((type.flags & (ts.TypeFlags.Any | ts.TypeFlags.Unknown | ts.TypeFlags.Never)) !== 0 || mayBeAbsent(type)) return false
|
|
43
|
+
return names.some((name) => {
|
|
44
|
+
const property = checker.getPropertyOfType(type, name)
|
|
45
|
+
if (!property || (property.flags & ts.SymbolFlags.Optional) !== 0) return false
|
|
46
|
+
const valueType = checker.getTypeOfSymbolAtLocation(property, atNode)
|
|
47
|
+
return !mayBeAbsent(valueType) && (valueType.flags & (ts.TypeFlags.Any | ts.TypeFlags.Unknown | ts.TypeFlags.Never)) === 0
|
|
48
|
+
})
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** Literal keys state a deadline directly; other configs must prove it with a required, present typed member. */
|
|
52
|
+
const hasDeadline = (context, config, names) => {
|
|
53
|
+
if (!config) return false
|
|
54
|
+
const { checker, toTs } = typed(context)
|
|
55
|
+
if (config.type === "ObjectExpression" && !hasSpread(config)) {
|
|
56
|
+
return names.some((name) => {
|
|
57
|
+
const property = config.properties.findLast((entry) => entry.type === "Property"
|
|
58
|
+
&& (entry.computed ? staticText(entry.key) : keyName(entry.key)) === name)
|
|
59
|
+
if (!property) return false
|
|
60
|
+
let expression = property.value
|
|
61
|
+
while (["TSAsExpression", "TSTypeAssertion", "TSNonNullExpression", "TSSatisfiesExpression"].includes(expression.type)) expression = expression.expression
|
|
62
|
+
const value = toTs(expression)
|
|
63
|
+
return Boolean(value) && !mayBeAbsent(checker.getTypeAtLocation(value))
|
|
64
|
+
})
|
|
65
|
+
}
|
|
66
|
+
const configNode = toTs(config)
|
|
67
|
+
return Boolean(configNode) && typeHasDeadline(checker, checker.getTypeAtLocation(configNode), configNode, names)
|
|
68
|
+
}
|
|
69
|
+
|
|
33
70
|
/** Every outbound HTTP call carries a deadline. */
|
|
34
71
|
export const httpNeedsTimeout = {
|
|
35
72
|
meta: {
|
|
@@ -53,11 +90,7 @@ export const httpNeedsTimeout = {
|
|
|
53
90
|
const { callee } = node
|
|
54
91
|
if (callee.type === "Identifier" && callee.name === "fetch") {
|
|
55
92
|
const init = node.arguments[1]
|
|
56
|
-
if (!init) {
|
|
57
|
-
context.report({ node, messageId: "fetchNoSignal" })
|
|
58
|
-
} else if (init.type === "ObjectExpression" && !hasSpread(init) && !hasKey(init, ["signal"])) {
|
|
59
|
-
context.report({ node, messageId: "fetchNoSignal" })
|
|
60
|
-
}
|
|
93
|
+
if (!hasDeadline(context, init, ["signal"])) context.report({ node, messageId: "fetchNoSignal" })
|
|
61
94
|
return
|
|
62
95
|
}
|
|
63
96
|
if (callee.type !== "MemberExpression" || callee.computed || callee.property.type !== "Identifier") return
|
|
@@ -66,7 +99,7 @@ export const httpNeedsTimeout = {
|
|
|
66
99
|
const receiver = callee.object.type === "Identifier" ? callee.object.name : "client"
|
|
67
100
|
if (method === "create" && isPackageType(context, callee.object, "AxiosStatic", "axios")) {
|
|
68
101
|
const config = node.arguments[0]
|
|
69
|
-
if (!
|
|
102
|
+
if (!hasDeadline(context, config, ["timeout", "signal"])) {
|
|
70
103
|
context.report({ node, messageId: "createNoTimeout" })
|
|
71
104
|
}
|
|
72
105
|
return
|
|
@@ -74,9 +107,7 @@ export const httpNeedsTimeout = {
|
|
|
74
107
|
if (!HTTP_METHODS.has(method)) return
|
|
75
108
|
const configAt = method === "request" ? 0 : ["post", "put", "patch"].includes(method) ? 2 : 1
|
|
76
109
|
const config = node.arguments[configAt]
|
|
77
|
-
if (config
|
|
78
|
-
context.report({ node, messageId: "clientNoTimeout", data: { call: `${receiver}.${method}` } })
|
|
79
|
-
} else if (config.type === "ObjectExpression" && !hasSpread(config) && !hasKey(config, ["timeout", "signal"])) {
|
|
110
|
+
if (!hasDeadline(context, config, ["timeout", "signal"])) {
|
|
80
111
|
context.report({ node, messageId: "clientNoTimeout", data: { call: `${receiver}.${method}` } })
|
|
81
112
|
}
|
|
82
113
|
},
|
|
@@ -29,14 +29,14 @@ pins:
|
|
|
29
29
|
source: packages/grammar/package.json
|
|
30
30
|
why: 'the grammar front ends read: the brand layer sets `--font-sans` and `--font-mono` and the grammar reads them; it carries the Input tel kind, the copyable and read-only Input, the IconButton disclosure props and count badge, ChatBubble, FillViewport, Textarea mentions and Enter-to-send, the leading PrimaryRailLayout rail, the plate-less Image, ListRow, the soft Alert, Progress steps, the floating primary IconButton, FlowGraph, the STATE-8 loading views and the bordered selectable TagGroup chips. The runtime source version wins for a @starci package.'
|
|
31
31
|
'@starci/eslint-canon-be':
|
|
32
|
-
version: 3.
|
|
32
|
+
version: 3.4.0
|
|
33
33
|
group: starci
|
|
34
34
|
install: registry
|
|
35
35
|
side: be
|
|
36
36
|
source: packages/eslint/be/package.json
|
|
37
37
|
why: 'the back-end ESLint canon: `loadHfs(import.meta.url)` of be/eslint.config.mjs finds the app-root hfs.json (kind app) and gives every linted file the view of the be side, and the project graph is built per side; its bundled runtime copies (slots, canon-pins, failure codes, the architecture machine) put .starcistacks and .sops.yaml at the app root; `starciBeConfig({ hfs: loadHfs(import.meta.url) })` is the typed factory and the BE-CONVENTION laws are its rules.'
|
|
38
38
|
'@starci/eslint-canon-fe':
|
|
39
|
-
version: 8.
|
|
39
|
+
version: 8.4.0
|
|
40
40
|
group: starci
|
|
41
41
|
install: registry
|
|
42
42
|
side: fe
|
|
@@ -62,28 +62,28 @@ pins:
|
|
|
62
62
|
side: both
|
|
63
63
|
source: packages/prettier-config/package.json
|
|
64
64
|
'@starci/jest-preset':
|
|
65
|
-
version: 2.
|
|
65
|
+
version: 2.3.0
|
|
66
66
|
group: starci
|
|
67
67
|
install: registry
|
|
68
68
|
side: be
|
|
69
69
|
source: packages/jest-preset/package.json
|
|
70
70
|
why: 'the Jest preset of a back end: the world runner runs up to min(--maxWorkers, slots) world files at once, each in its own process bound to one data slot of the test world (STARCI_TEST_WORLD_SLOT), and reads test-world state protocol 2 only: it pairs exactly with @starci/test-world, and any other state file is JEST_PRESET_WORLD_PAIR_MISMATCH. The unit run writes the lcov Sonar and Codecov import (services only); the integration, e2e and contract projects run every spec file in a worker process of its own (world-runner.cjs), so a process-global framework registry (@nestjs/graphql type metadata) never leaks between e2e files; it ships the unit kit (mockEntityManager, fakeTransaction, fakeIds, FakeClock, Outcome matchers) and the recordingOutbox claim side.'
|
|
71
71
|
'@starci/test-world':
|
|
72
|
-
version: 1.2.
|
|
72
|
+
version: 1.2.2
|
|
73
73
|
group: starci
|
|
74
74
|
install: registry
|
|
75
75
|
side: be
|
|
76
76
|
source: packages/test-world/package.json
|
|
77
77
|
why: 'the shared e2e library of every back end (R47, R48), a devDependency of every back end: the warm stack behind toxiproxy, the network-edge fakes, the Nest boot, the typed useTestWorld handle, useSandbox for contract specs and the outage lock. Kafka is real own infra (the one digest-pinned apache/kafka KRaft image, a broker listener and proxy per slot, slot-prefixed topics, consumer groups and client ids) and Postgres is schema-per-context (a schema and a login role per context in a shared database). Each worker has its own data slot (<ns>_w<k>) with its own databases, Keycloak realm, leased Redis DB, bucket/collection/topic prefixes, fakes host, toxiproxy proxies and outage lock; a run provisions min(jest workers, workers cap, default 2) slots, and state file protocol 2 pairs exactly with @starci/jest-preset (TEST_WORLD_PAIR_MISMATCH otherwise). A modules world boots real peer apps beside its modules, world.apps.<name>.during(fn) is the outage of a peer app, w.keycloak.clientSecret(client) answers the run-generated secret of a confidential realm client, world.keycloak.events/sessions read the realm user events and live sessions, world.infra.postgresql.connection(name) takes one database connection down while the others serve, and world.resolve and scope.resolve take any Nest token. Every path a declaration names (`stack`, seeds, the realm, Dockerfiles) resolves from the app root (the directory of hfs.json); the globalSetup registers the path aliases as TypeScript resolves them. Its CLI main is exported at ./cli for starci app stack.'
|
|
78
78
|
'@starci/cli':
|
|
79
|
-
version: 1.
|
|
79
|
+
version: 1.4.0
|
|
80
80
|
group: starci
|
|
81
81
|
install: registry
|
|
82
82
|
side: both
|
|
83
83
|
source: packages/cli/package.json
|
|
84
84
|
why: 'the only StarCi command package; product repositories install it for starci app, while @starci/hfs remains its pinned transitive implementation.'
|
|
85
85
|
'@starci/hfs':
|
|
86
|
-
version: 4.
|
|
86
|
+
version: 4.4.0
|
|
87
87
|
group: starci
|
|
88
88
|
install: registry
|
|
89
89
|
side: both
|
|
@@ -180,7 +180,7 @@ pins:
|
|
|
180
180
|
side: be
|
|
181
181
|
# --- framework
|
|
182
182
|
next:
|
|
183
|
-
version: 16.
|
|
183
|
+
version: 16.4.2
|
|
184
184
|
group: framework
|
|
185
185
|
side: fe
|
|
186
186
|
react:
|
|
@@ -206,7 +206,7 @@ pins:
|
|
|
206
206
|
group: framework
|
|
207
207
|
side: be
|
|
208
208
|
'@nestjs/platform-express':
|
|
209
|
-
version: 11.2.
|
|
209
|
+
version: 11.2.7
|
|
210
210
|
group: framework
|
|
211
211
|
side: be
|
|
212
212
|
'@nestjs/testing':
|
|
@@ -316,7 +316,7 @@ pins:
|
|
|
316
316
|
side: fe
|
|
317
317
|
why: 'the codegen preset of the front-end wire types (fe-stack codegen); the latest registry version on 2026-10-13.'
|
|
318
318
|
'axios':
|
|
319
|
-
version: 1.
|
|
319
|
+
version: 1.20.0
|
|
320
320
|
group: framework
|
|
321
321
|
side: fe
|
|
322
322
|
why: 'the REST client of the front end for uploads, presigned URLs and auth endpoints (fe-stack rest); version read from the starci-academy package-lock on 2026-10-13.'
|
|
@@ -465,12 +465,12 @@ pins:
|
|
|
465
465
|
version: 13.4.5
|
|
466
466
|
group: framework
|
|
467
467
|
side: be
|
|
468
|
-
why: 'the GraphQL transport of every back end (be.transport.graphql) that the front end calls; the ecommerce-app resolution on 2026-10-13.'
|
|
468
|
+
why: 'the GraphQL transport of every back end (be.transport.graphql) that the front end calls; the ecommerce-app resolution on 2026-10-13. Stays on 13.x for alpha.18: the npm-audit advisory fixed by 14.0.3 (semver major) is a documented accepted exception, upgrade deferred to alpha.19 (owner ruling graphql-13-advisory-accepted-until-a19, 2026-10-16).'
|
|
469
469
|
'@nestjs/apollo':
|
|
470
470
|
version: 13.4.5
|
|
471
471
|
group: framework
|
|
472
472
|
side: be
|
|
473
|
-
why: 'the Apollo driver of @nestjs/graphql; the ecommerce-app resolution on 2026-10-13.'
|
|
473
|
+
why: 'the Apollo driver of @nestjs/graphql; the ecommerce-app resolution on 2026-10-13. Stays on 13.x with @nestjs/graphql (accepted advisory, major deferred to alpha.19).'
|
|
474
474
|
'@apollo/server':
|
|
475
475
|
version: 5.5.1
|
|
476
476
|
group: framework
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
schema: starci/fe-stack@1
|
|
2
2
|
purpose: >-
|
|
3
|
-
The front-end stack of every app, lite and full alike (owner ruling 2026-10-13, R212 case-2): for each common front-end concern the
|
|
3
|
+
The front-end stack of every app, lite and full alike (owner ruling 2026-10-13, R212 case-2 (owner:lite-production-swarm), with the Work boundary amended by ruling:R212/case-4): for each common front-end concern the
|
|
4
4
|
ONE canonical library, its HFS home (slot ids of knowledge/hfs/slots.yaml), the pattern id that teaches it
|
|
5
5
|
(knowledge/patterns/fe/*.yaml) and the alternatives a front end never depends on or imports. Versions live in
|
|
6
6
|
knowledge/hfs/canon-pins.yaml only. `tier: core` packages are installed by every scaffold; `opt` packages are added when a feature
|
|
@@ -219,3 +219,24 @@ concerns:
|
|
|
219
219
|
pattern: FE-LINT
|
|
220
220
|
forbids: []
|
|
221
221
|
why: the canon lint and format configuration.
|
|
222
|
+
- id: auth-supabase
|
|
223
|
+
tier: opt
|
|
224
|
+
packages: ['@supabase/supabase-js', '@supabase/ssr']
|
|
225
|
+
home: [fe.modules.auth]
|
|
226
|
+
pattern: FE-AUTH
|
|
227
|
+
forbids: []
|
|
228
|
+
why: the lite auth provider client and PKCE server cookie adapter, confined to modules/auth; data still goes through the back end.
|
|
229
|
+
- id: framework-support
|
|
230
|
+
tier: opt
|
|
231
|
+
packages: [server-only, rxjs]
|
|
232
|
+
home: [fe.source-root-pinned]
|
|
233
|
+
pattern: FE-ROUTE
|
|
234
|
+
forbids: []
|
|
235
|
+
why: the Next server boundary marker and Apollo peer support used by canonical workspaces.
|
|
236
|
+
- id: tool-support
|
|
237
|
+
tier: opt
|
|
238
|
+
packages: ['@types/node', '@types/react', '@types/react-dom', '@starci/tsconfig', '@starci/stylelint-canon', '@tailwindcss/postcss', postcss-value-parser, stylelint, eslint-plugin-react-hooks]
|
|
239
|
+
home: [fe.tool-config]
|
|
240
|
+
pattern: FE-LINT
|
|
241
|
+
forbids: []
|
|
242
|
+
why: the compiler, CSS and lint support packages of the canonical front-end configs.
|