@starci/eslint-canon-be 3.4.42 → 3.4.44
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 +6 -0
- package/feature-thin.mjs +4 -4
- package/idempotency.mjs +240 -44
- package/package.json +1 -1
- package/runtime/knowledge/grammars/index.yaml +102 -0
- package/runtime/knowledge/hfs/canon-pins.yaml +22 -8
- package/runtime/knowledge/hfs/fe-stack.yaml +7 -0
- package/runtime/knowledge/hfs/rules.yaml +133 -83
- package/runtime/knowledge/hfs/slots.yaml +3 -3
- package/runtime/modules/kernel/removed-vocabulary.yaml +29 -0
- package/runtime/scripts/hfs/architecture/config.mjs +8 -8
- package/runtime/scripts/hfs/declaration-shape.mjs +8 -2
- package/runtime/scripts/hfs/rule-catalog.mjs +2 -2
- package/runtime/scripts/hfs/slots.mjs +1 -0
- package/runtime/scripts/hfs/view.mjs +1 -0
- package/runtime/scripts/lib/grammar-lint.mjs +48 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 3.4.44 - 2026-10-26
|
|
4
|
+
- Fixed: R80 delegated claims map arguments over runtime parameters and reject spreads, effects hidden in `const` preparation, protected or replaced helpers, and runner or manager unions containing lookalikes. Private helpers (including `#private`) and independently judged public delivery helpers retain the transaction proof; public overrides preserve the claim's manager binding and prelude restrictions, including widened parameters and arrow properties. Every declared runner and manager origin must match its owner.
|
|
5
|
+
|
|
6
|
+
## 3.4.43 - 2026-10-26
|
|
7
|
+
- Changed: `inbox-dedupe-required` (R80 `BE_INBOX_DEDUPE_MISSING`) accepts a delivery whose one write transaction hands its work to a typed helper: the sole `.transaction(...)` runs on typeorm's `EntityManager` or on a port the `platform/database` owner declares, its arrow callback returns `this.<method>(..., tx, ...)` of the same class (resolved by the checker), and that async helper claims first with the never-reassigned manager parameter and returns on `false`. The database port also runs the inline claim callback. A helper that never claims, claims after other work or under a condition, claims with another manager, a lookalike runner, a callback that hands work to another object or detaches it, and an ignored claim answer stay refused; every form refused before stays refused.
|
|
8
|
+
|
|
3
9
|
## 3.4.42 - 2026-10-26
|
|
4
10
|
- Changed: `operation-table-schemas` and `operation-contract-decidable` leave alone a stub table a spec keeps to itself, but judge one a spec exports (`export const`, `export { }`, `export default`); `rest-route-declared` never counts a table made in a spec as the app's declared table. The same stub table in a production file stays refused.
|
|
5
11
|
- Changed: R95 requires named zod input/output schema exports for every `defineOperations` entry (`operation-table-schemas`) and a canon `OperationValidationPolicy` constructed with the same table on the route body (`operation-route-driven-by-table`). Schema provenance and route binding are proved in both editions, including strict empty inputs, aliases, mismatched tables and local imitations.
|
package/feature-thin.mjs
CHANGED
|
@@ -154,11 +154,11 @@ export const featureThin = {
|
|
|
154
154
|
return injectedNamesOf(classNode).has(member) ? member : null
|
|
155
155
|
}
|
|
156
156
|
|
|
157
|
-
/** True for
|
|
157
|
+
/** True for an imported pure `*.mapper.ts` function, resolved through any facade re-exports to its declaration. */
|
|
158
158
|
const isMapperCall = (callee) => {
|
|
159
|
-
if (callee.type !== "Identifier") return false
|
|
160
|
-
const
|
|
161
|
-
return
|
|
159
|
+
if (callee.type !== "Identifier" || importOf(context, callee) === null) return false
|
|
160
|
+
const declarations = aliasTarget(context, callee)?.getDeclarations() ?? []
|
|
161
|
+
return declarations.length > 0 && declarations.every((declaration) => roleOf(declaration.getSourceFile().fileName) === "mapper")
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
/** True for a call `f(...)` where `f` is imported and its declaration lives outside the feature tier (a function of the modules). */
|
package/idempotency.mjs
CHANGED
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
* - `inbox-dedupe-required` judges every DELIVERY method of a service. Doors (consumers, `SignedWebhook` controllers) are
|
|
10
10
|
* thin (R88): they map the delivery and dispatch one message, so the claim lives in the `*.service.ts` the handler calls,
|
|
11
11
|
* inside its transaction. A delivery method is a public method of a `<name>.service.ts` whose FIRST parameter has an
|
|
12
|
-
* `eventId` property, read by the parameter's TYPE. Its first awaited work is the Inbox claim, directly or
|
|
13
|
-
*
|
|
12
|
+
* `eventId` property, read by the parameter's TYPE. Its first awaited work is the Inbox claim, directly or as the
|
|
13
|
+
* first work of the one write transaction it runs, with that transaction's manager, and the method must return
|
|
14
14
|
* early when the claim answers `false`. A lookalike `Inbox` declared by another owner, a renamed receiver and a
|
|
15
15
|
* property injection are all judged by the receiver's type, so only the real port satisfies the rule; a keyword or a
|
|
16
16
|
* class name never does.
|
|
@@ -20,15 +20,30 @@
|
|
|
20
20
|
* if ((await this.inbox.claim(source, id)) === false) { return }
|
|
21
21
|
* const fresh = await this.inbox.claim(source, id)
|
|
22
22
|
* if (!fresh) return
|
|
23
|
-
* A transaction delivery returns or awaits one transaction as its sole statement
|
|
24
|
-
*
|
|
25
|
-
*
|
|
23
|
+
* A transaction delivery returns or awaits one `.transaction(...)` as its sole statement, on a receiver typed as typeorm's
|
|
24
|
+
* `EntityManager` or as a port the `platform/database` owner declares; the callback's one parameter is typed `EntityManager`.
|
|
25
|
+
* Either the actual selected inline async callback claims with that manager in its first statement, then returns on false,
|
|
26
|
+
* or an arrow callback hands its whole work to one `this.<method>(..., tx, ...)` of the same class, resolved by the checker:
|
|
27
|
+
* that async helper is private or a public delivery method judged in its own right, receives the manager in a never-reassigned
|
|
28
|
+
* `EntityManager` runtime parameter, and prepares only `const` arguments without this/manager access, writes, construction,
|
|
29
|
+
* awaits or calls other than free functions. Its first await is the claim with that parameter at its top level, followed by
|
|
30
|
+
* the return on false:
|
|
31
|
+
* return this.manager.transaction((tx) => this.recordInTransaction(delivery, tx))
|
|
32
|
+
* async recordInTransaction(delivery: Delivery, manager: EntityManager) {
|
|
33
|
+
* const key = keyOf(delivery)
|
|
34
|
+
* if (!(await this.inbox.claim(source, key, manager))) return this.readRepeat(delivery, manager)
|
|
35
|
+
* return this.write(delivery, manager)
|
|
36
|
+
* }
|
|
37
|
+
* No outer work runs after a duplicate. Every runner and manager type origin must match its declared owner; unions with
|
|
38
|
+
* lookalikes, spread handoffs, protected or replaced helpers, and callbacks handing work to another object are refused.
|
|
39
|
+
* Effects hidden inside free functions or getters and helpers called past the first one stay review questions.
|
|
26
40
|
*/
|
|
41
|
+
import ts from "typescript"
|
|
27
42
|
import { hfsOf } from "./lib/hfs.mjs"
|
|
28
|
-
import { walk } from "./lib/ast.mjs"
|
|
43
|
+
import { keyName, walk } from "./lib/ast.mjs"
|
|
29
44
|
import { baseName, isOwnedType, ownerNameOf } from "./lib/ports.mjs"
|
|
30
45
|
import { resolveVariable } from "./lib/transactions.mjs"
|
|
31
|
-
import {
|
|
46
|
+
import { typeOrigins, typed } from "./lib/types.mjs"
|
|
32
47
|
import { mutationIdempotent } from "./lib/client-idempotency.mjs"
|
|
33
48
|
|
|
34
49
|
/** The `Inbox` port of `platform/inbox`. */
|
|
@@ -87,8 +102,25 @@ const hasPriorEffect = (expression, call) => {
|
|
|
87
102
|
return found
|
|
88
103
|
}
|
|
89
104
|
|
|
90
|
-
/**
|
|
91
|
-
const
|
|
105
|
+
/** A transaction port the `platform/database` owner declares: a receiver typed by that owner, never by its name. */
|
|
106
|
+
const isDatabasePort = (context, node) => {
|
|
107
|
+
const hfs = hfsOf(context)
|
|
108
|
+
const origins = typeOrigins(context, node)
|
|
109
|
+
return origins.length > 0 && origins.every((origin) =>
|
|
110
|
+
origin.module === null && hfs.tierOf(origin.file) === "platform" && ownerNameOf(hfs, origin.file) === "database")
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/** Every declared alternative must be TypeORM's manager: one genuine union member cannot vouch for a lookalike. */
|
|
114
|
+
const isEntityManager = (context, node) => {
|
|
115
|
+
const origins = typeOrigins(context, node)
|
|
116
|
+
return origins.length > 0 && origins.every((origin) => origin.name === "EntityManager" && origin.module === "typeorm")
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/** TypeScript erases a `this` parameter, so only these parameters receive call arguments at runtime. */
|
|
120
|
+
const runtimeParams = (method) => method.value.params.filter((param) => !(param.type === "Identifier" && param.name === "this"))
|
|
121
|
+
|
|
122
|
+
/** The callback a sole, returned or awaited `.transaction(...)` runs on an EntityManager or the database port, and its manager parameter. */
|
|
123
|
+
const soleTransactionCallback = (context, body) => {
|
|
92
124
|
if (body.body.length !== 1) return null
|
|
93
125
|
const outer = body.body[0]
|
|
94
126
|
const expression = outer.type === "ReturnStatement" ? outer.argument
|
|
@@ -96,41 +128,191 @@ const transactionClaim = (context, body) => {
|
|
|
96
128
|
const call = expression?.type === "AwaitExpression" ? expression.argument : expression
|
|
97
129
|
const callee = call?.callee
|
|
98
130
|
if (call?.type !== "CallExpression" || callee.type !== "MemberExpression" || callee.computed
|
|
99
|
-
|| callee.property.type !== "Identifier" || callee.property.name !== "transaction"
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
131
|
+
|| callee.property.type !== "Identifier" || callee.property.name !== "transaction" || hasPriorEffect(call, call)) return null
|
|
132
|
+
let callback = null
|
|
133
|
+
if (isEntityManager(context, callee.object)) {
|
|
134
|
+
// TypeORM runs arg0 when it is a function, otherwise arg1. Never accept a later, ignored callback.
|
|
135
|
+
const isolation = call.arguments[0]
|
|
136
|
+
callback = call.arguments.length === 1 ? isolation
|
|
137
|
+
: call.arguments.length === 2 && isolation.type === "Literal"
|
|
138
|
+
&& ["READ UNCOMMITTED", "READ COMMITTED", "REPEATABLE READ", "SERIALIZABLE"].includes(isolation.value)
|
|
139
|
+
? call.arguments[1] : null
|
|
140
|
+
} else if (isDatabasePort(context, callee.object) && call.arguments.length === 1) callback = call.arguments[0]
|
|
141
|
+
if (!callback || !["ArrowFunctionExpression", "FunctionExpression"].includes(callback.type) || callback.params.length !== 1) return null
|
|
109
142
|
const manager = callback.params[0]
|
|
110
|
-
if (manager.type !== "Identifier" || !
|
|
111
|
-
|
|
143
|
+
if (manager.type !== "Identifier" || !isEntityManager(context, manager)) return null
|
|
144
|
+
return { callback, manager }
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/** True when `argument` is the identifier bound to the parameter `param`; with `unwritten`, that parameter is also never reassigned. */
|
|
148
|
+
const isParameter = (context, argument, param, { unwritten = false } = {}) => {
|
|
149
|
+
const binding = resolveVariable(context.sourceCode, param)
|
|
150
|
+
const argumentBinding = argument?.type === "Identifier" ? resolveVariable(context.sourceCode, argument) : null
|
|
151
|
+
return !!binding && binding.defs[0]?.name === param && argumentBinding === binding
|
|
152
|
+
&& !(unwritten && binding.references.some((reference) => reference.isWrite()))
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/** The statement of a block that holds its first await as the claim it tests, stores or awaits; null when that await sits deeper. */
|
|
156
|
+
const claimStatement = (block) => {
|
|
157
|
+
const awaited = firstAwait(block)
|
|
112
158
|
const parent = awaited?.parent
|
|
113
159
|
const statement = parent?.type === "VariableDeclarator" && parent.init === awaited
|
|
114
160
|
&& parent.parent.declarations.length === 1 ? parent.parent
|
|
115
161
|
: ["UnaryExpression", "BinaryExpression"].includes(parent?.type) ? parent.parent
|
|
116
162
|
: parent?.type === "ExpressionStatement" ? parent : null
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
if (!
|
|
123
|
-
|
|
124
|
-
return
|
|
163
|
+
return statement?.parent === block ? { awaited, statement } : null
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/** The claim that opens the inline async callback with its own manager, as its first statement. */
|
|
167
|
+
const inlineClaim = (context, { callback, manager }) => {
|
|
168
|
+
if (!callback.async || callback.body.type !== "BlockStatement") return null
|
|
169
|
+
const found = claimStatement(callback.body)
|
|
170
|
+
if (!found || found.statement !== callback.body.body[0]) return null
|
|
171
|
+
const claim = found.awaited.argument
|
|
172
|
+
if (claim?.type !== "CallExpression" || !isParameter(context, claim.arguments[2], manager) || hasPriorEffect(found.statement, claim)) return null
|
|
173
|
+
return found.awaited
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/** The `this.<method>(...)` call an arrow callback hands its whole work to: its expression body, or its sole returned or awaited statement. */
|
|
177
|
+
const handedCall = (callback) => {
|
|
178
|
+
if (callback.type !== "ArrowFunctionExpression") return null
|
|
179
|
+
let expression = callback.body
|
|
180
|
+
if (expression.type === "BlockStatement") {
|
|
181
|
+
const [sole] = expression.body
|
|
182
|
+
if (expression.body.length !== 1) return null
|
|
183
|
+
expression = sole.type === "ReturnStatement" ? sole.argument
|
|
184
|
+
: sole.type === "ExpressionStatement" && sole.expression.type === "AwaitExpression" ? sole.expression : null
|
|
185
|
+
}
|
|
186
|
+
const call = expression?.type === "AwaitExpression" ? expression.argument : expression
|
|
187
|
+
const callee = call?.callee
|
|
188
|
+
return call?.type === "CallExpression" && callee.type === "MemberExpression" && !callee.computed
|
|
189
|
+
&& callee.object.type === "ThisExpression" && ["Identifier", "PrivateIdentifier"].includes(callee.property.type) ? call : null
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/** Argument preparation cannot start instance or transactional work before the inbox claim. */
|
|
193
|
+
const preparesArguments = (context, statement, manager) => {
|
|
194
|
+
if (statement.type !== "VariableDeclaration" || statement.kind !== "const") return false
|
|
195
|
+
let safe = true
|
|
196
|
+
walk(statement, (node) => {
|
|
197
|
+
if (node.type === "ThisExpression" || (node.type === "Identifier" && isParameter(context, node, manager))
|
|
198
|
+
|| ["AwaitExpression", "NewExpression", "AssignmentExpression", "UpdateExpression"].includes(node.type)
|
|
199
|
+
|| (node.type === "CallExpression" && node.callee.type !== "Identifier")) safe = false
|
|
200
|
+
}, { intoFunctions: false })
|
|
201
|
+
return safe
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/** An assignment anywhere in the class can replace the method that the checker resolved for the handoff. */
|
|
205
|
+
const replacesHelper = (classBody, helper) => {
|
|
206
|
+
let replaced = false
|
|
207
|
+
walk(classBody, (node) => {
|
|
208
|
+
if (node.type !== "AssignmentExpression") return
|
|
209
|
+
const target = node.left
|
|
210
|
+
if (target.type === "MemberExpression" && target.object.type === "ThisExpression"
|
|
211
|
+
&& (!target.computed || target.property.type === "Literal")
|
|
212
|
+
&& (target.property.type === "PrivateIdentifier") === (helper.key.type === "PrivateIdentifier")
|
|
213
|
+
&& keyName(target.property) === keyName(helper.key)) replaced = true
|
|
214
|
+
})
|
|
215
|
+
return replaced
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/** The helper body must claim first with its unchanged runtime manager, after only argument preparation. */
|
|
219
|
+
const helperClaim = (context, helper, param) => {
|
|
220
|
+
if (!helper.value?.async || helper.value.body?.type !== "BlockStatement"
|
|
221
|
+
|| param?.type !== "Identifier" || !isEntityManager(context, param)) return null
|
|
222
|
+
const body = helper.value.body
|
|
223
|
+
const found = claimStatement(body)
|
|
224
|
+
if (!found) return null
|
|
225
|
+
const before = body.body.slice(0, body.body.indexOf(found.statement))
|
|
226
|
+
if (before.some((statement) => !preparesArguments(context, statement, param))) return null
|
|
227
|
+
const claim = found.awaited.argument
|
|
228
|
+
if (claim?.type !== "CallExpression" || !isParameter(context, claim.arguments[2], param, { unwritten: true })
|
|
229
|
+
|| hasPriorEffect(found.statement, claim)) return null
|
|
230
|
+
return found.awaited
|
|
125
231
|
}
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* The claim of a typed helper the callback delegates to: a method of the delivery's own class, resolved by the checker, that receives
|
|
235
|
+
* the callback's manager, awaits nothing before the claim, claims with that parameter at its top level and runs no statement but `const`
|
|
236
|
+
* argument preparation before it.
|
|
237
|
+
*/
|
|
238
|
+
const delegatedClaim = (context, delivery, { callback, manager }) => {
|
|
239
|
+
const call = handedCall(callback)
|
|
240
|
+
if (!call || call.arguments.some((argument) => argument.type === "SpreadElement") || hasPriorEffect(call, call)) return null
|
|
241
|
+
const position = call.arguments.findIndex((argument) => argument.type === "Identifier" && argument.name === manager.name)
|
|
242
|
+
if (position < 0 || !isParameter(context, call.arguments[position], manager)) return null
|
|
243
|
+
const { checker, toTs } = typed(context)
|
|
244
|
+
const declarations = checker.getSymbolAtLocation(toTs(call.callee.property))?.getDeclarations?.() ?? []
|
|
245
|
+
const helper = declarations.length === 1
|
|
246
|
+
? delivery.parent.body.find((member) => member.type === "MethodDefinition" && toTs(member) === declarations[0]) : undefined
|
|
247
|
+
if (!helper || helper === delivery || helper.kind !== "method" || helper.static || !helper.value.async || !helper.value.body) return null
|
|
248
|
+
const params = runtimeParams(helper)
|
|
249
|
+
// A public delivery contract carries its claim and manager obligations into every override.
|
|
250
|
+
if (helper.accessibility === "protected" || (helper.accessibility !== "private" && helper.key.type !== "PrivateIdentifier"
|
|
251
|
+
&& (!params[0] || !isDeliveryParam(context, params[0]))) || replacesHelper(delivery.parent, helper)) return null
|
|
252
|
+
return helperClaim(context, helper, params[position])
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/** The first awaited claim of a delivery that runs as one transaction: inline in its callback, or in the typed helper that callback delegates to. */
|
|
256
|
+
const transactionClaim = (context, delivery) => {
|
|
257
|
+
const transaction = soleTransactionCallback(context, delivery.value.body)
|
|
258
|
+
if (!transaction) return null
|
|
259
|
+
return inlineClaim(context, transaction) ?? delegatedClaim(context, delivery, transaction)
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/** A delivery's type, including a union alternative, exposes the sender's `eventId`. */
|
|
263
|
+
const hasEventId = (checker, type) =>
|
|
264
|
+
(type.isUnion() ? type.types : [type]).some((part) => checker.getPropertyOfType(part, "eventId") !== undefined)
|
|
265
|
+
|
|
126
266
|
/** Whether a parameter's type has an `eventId` property: the shape of a delivery. */
|
|
127
267
|
const isDeliveryParam = (context, param) => {
|
|
128
268
|
const target = param.type === "TSParameterProperty" ? param.parameter : param.type === "AssignmentPattern" ? param.left : param
|
|
129
269
|
const { checker, toTs } = typed(context)
|
|
130
270
|
const tsNode = toTs(target)
|
|
131
271
|
if (!tsNode) return false
|
|
132
|
-
|
|
133
|
-
|
|
272
|
+
return hasEventId(checker, checker.getTypeAtLocation(tsNode))
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/** The runtime parameter the declared signature's first awaited claim uses, including declarations in another source file. */
|
|
276
|
+
const claimedManagerPosition = (checker, signature) => {
|
|
277
|
+
let awaited = null
|
|
278
|
+
const visit = (node) => {
|
|
279
|
+
if (ts.isAwaitExpression(node) && (!awaited || node.end < awaited.end)) awaited = node
|
|
280
|
+
ts.forEachChild(node, (child) => { if (!ts.isFunctionLike(child)) visit(child) })
|
|
281
|
+
}
|
|
282
|
+
const body = signature.getDeclaration()?.body
|
|
283
|
+
if (body) visit(body)
|
|
284
|
+
const claim = awaited?.expression
|
|
285
|
+
if (!claim || !ts.isCallExpression(claim) || !ts.isPropertyAccessExpression(claim.expression)
|
|
286
|
+
|| claim.expression.name.text !== "claim" || !claim.arguments[2]) return -1
|
|
287
|
+
const manager = checker.getSymbolAtLocation(claim.arguments[2])
|
|
288
|
+
return manager ? signature.parameters.indexOf(manager) : -1
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/** An override preserves inherited delivery and transaction-manager obligations even when it widens its own parameter. */
|
|
292
|
+
const inheritedDelivery = (context, method) => {
|
|
293
|
+
const name = keyName(method.key)
|
|
294
|
+
const result = { delivery: false, managers: new Set() }
|
|
295
|
+
if (name === null) return result
|
|
296
|
+
const { checker, toTs } = typed(context)
|
|
297
|
+
const location = toTs(method)
|
|
298
|
+
const seen = new Set()
|
|
299
|
+
const visit = (type) => {
|
|
300
|
+
if (seen.has(type)) return
|
|
301
|
+
seen.add(type)
|
|
302
|
+
const member = checker.getPropertyOfType(type, name)
|
|
303
|
+
const signatures = member ? checker.getTypeOfSymbolAtLocation(member, location).getCallSignatures() : []
|
|
304
|
+
for (const signature of signatures) {
|
|
305
|
+
const param = signature.parameters[0]
|
|
306
|
+
if (!param || !hasEventId(checker, checker.getTypeOfSymbolAtLocation(param, location))) continue
|
|
307
|
+
result.delivery = true
|
|
308
|
+
const manager = claimedManagerPosition(checker, signature)
|
|
309
|
+
if (manager >= 0) result.managers.add(manager)
|
|
310
|
+
}
|
|
311
|
+
for (const base of checker.getBaseTypes(type) ?? []) visit(base)
|
|
312
|
+
}
|
|
313
|
+
const owner = checker.getTypeAtLocation(toTs(method.parent.parent))
|
|
314
|
+
for (const base of checker.getBaseTypes(owner) ?? []) visit(base)
|
|
315
|
+
return result
|
|
134
316
|
}
|
|
135
317
|
|
|
136
318
|
/** A service method that takes a delivery claims the event through the shared inbox before it acts. */
|
|
@@ -151,23 +333,37 @@ export const inboxDedupeRequired = {
|
|
|
151
333
|
if (!baseName(filename).endsWith(".service.ts") || !slot || slot.startsWith("be.tests.")) return {}
|
|
152
334
|
// The event bus publishes events (their shape carries an `eventId`) and its runtime claims the inbox before a consumer runs: no delivery method here.
|
|
153
335
|
if (slot.startsWith("be.platform") && ownerNameOf(hfs, filename) === "event-bus") return {}
|
|
336
|
+
const judgeClaim = (node, inherited) => {
|
|
337
|
+
const body = node.value?.body
|
|
338
|
+
let awaited = body?.type === "BlockStatement" ? transactionClaim(context, node) ?? firstAwait(body) : null
|
|
339
|
+
if (inherited.managers.size > 0) {
|
|
340
|
+
const params = node.value?.params ? runtimeParams(node) : []
|
|
341
|
+
if (![...inherited.managers].every((position) => helperClaim(context, node, params[position]) === awaited)) awaited = null
|
|
342
|
+
}
|
|
343
|
+
const call = awaited?.argument
|
|
344
|
+
const claims = call?.type === "CallExpression"
|
|
345
|
+
&& call.callee.type === "MemberExpression"
|
|
346
|
+
&& !call.callee.computed
|
|
347
|
+
&& call.callee.property.type === "Identifier"
|
|
348
|
+
&& call.callee.property.name === "claim"
|
|
349
|
+
&& call.arguments.length >= 2
|
|
350
|
+
&& isInboxType(context, call.callee.object)
|
|
351
|
+
if (!claims) context.report({ node: node.key, messageId: "noClaim" })
|
|
352
|
+
else if (!returnsOnFalse(awaited)) context.report({ node: node.key, messageId: "noEarlyReturn" })
|
|
353
|
+
}
|
|
154
354
|
return {
|
|
155
355
|
MethodDefinition(node) {
|
|
156
356
|
if (node.kind !== "method" || node.static || node.key.type === "PrivateIdentifier" || !node.value.body) return
|
|
157
357
|
if (node.accessibility === "private" || node.accessibility === "protected") return
|
|
158
|
-
const first = node
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
&& call.arguments.length >= 2
|
|
168
|
-
&& isInboxType(context, call.callee.object)
|
|
169
|
-
if (!claims) context.report({ node: node.key, messageId: "noClaim" })
|
|
170
|
-
else if (!returnsOnFalse(awaited)) context.report({ node: node.key, messageId: "noEarlyReturn" })
|
|
358
|
+
const first = runtimeParams(node)[0]
|
|
359
|
+
const inherited = inheritedDelivery(context, node)
|
|
360
|
+
if (!(first && isDeliveryParam(context, first)) && !inherited.delivery) return
|
|
361
|
+
judgeClaim(node, inherited)
|
|
362
|
+
},
|
|
363
|
+
PropertyDefinition(node) {
|
|
364
|
+
if (node.static || node.key.type === "PrivateIdentifier" || node.accessibility === "private" || node.accessibility === "protected") return
|
|
365
|
+
const inherited = inheritedDelivery(context, node)
|
|
366
|
+
if (inherited.delivery) judgeClaim(node, inherited)
|
|
171
367
|
},
|
|
172
368
|
}
|
|
173
369
|
},
|
package/package.json
CHANGED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
schema: starci/knowledge-source@1
|
|
2
|
+
id: grammars
|
|
3
|
+
title: Grammar families
|
|
4
|
+
purpose: |
|
|
5
|
+
Catalog of authored UI Grammar families. Inventory only — not a default-family rule.
|
|
6
|
+
The selected design specification names the applicable installed family. The app binds that choice
|
|
7
|
+
explicitly in sides.fe.grammar; the catalog resolves its lint package and component contract.
|
|
8
|
+
A missing or ambiguous family never silently resolves to a family. DNA snapshots describe the
|
|
9
|
+
observed implementation; they do not install packages or prove current rendered behavior.
|
|
10
|
+
appliesTo:
|
|
11
|
+
- grammar
|
|
12
|
+
provenance:
|
|
13
|
+
limitations: |
|
|
14
|
+
Component names, tokens and gap tables describe the reference family at observation time.
|
|
15
|
+
Verify actual package identity/version, exported types, CSS and renderer source in the selected
|
|
16
|
+
repository before using snapshot APIs or gaps. Record current source references in the selected
|
|
17
|
+
.starciwork node; an old source census is not current UAT evidence. The current public consumer
|
|
18
|
+
entry observed for FE work is @starci/grammar/common — confirm installed exports before import.
|
|
19
|
+
The `common` entry is a DNA snapshot of that semantic entry and nothing more: it declares no palette,
|
|
20
|
+
no family boundary and no composition playbook, because the entry itself ships none of them.
|
|
21
|
+
guidance:
|
|
22
|
+
- id: catalog-not-default
|
|
23
|
+
requirement: |
|
|
24
|
+
Do not treat this catalog as selecting a default Grammar family. Family choice belongs to the
|
|
25
|
+
current design specification and its explicit sides.fe.grammar declaration.
|
|
26
|
+
rationale: |
|
|
27
|
+
Silent fallback to StarCi would invent product direction and override an absent/ambiguous design.
|
|
28
|
+
- id: verify-before-use
|
|
29
|
+
requirement: |
|
|
30
|
+
Before applying snapshot APIs or recorded gaps, inspect the selected repository's package
|
|
31
|
+
identity/version, exported types, CSS and renderer source.
|
|
32
|
+
rationale: |
|
|
33
|
+
Snapshots are historical; installed exports may differ. Inventing missing APIs is forbidden.
|
|
34
|
+
- id: ui-owns-universal
|
|
35
|
+
requirement: |
|
|
36
|
+
Common semantics, renderer anatomy, state and accessibility remain owned by knowledge/ui.
|
|
37
|
+
A family owns its scoped visual realization and promoted idioms; the product owns its facts,
|
|
38
|
+
content, routes and approved composition.
|
|
39
|
+
Apply FE-RULE-OWNERSHIP in knowledge/patterns/fe/index.yaml when placing requirements and checks.
|
|
40
|
+
rationale: |
|
|
41
|
+
Keeps universal UI law separate from family-scoped DNA and product composition.
|
|
42
|
+
topics:
|
|
43
|
+
- id: common
|
|
44
|
+
path: common/DNA.yaml
|
|
45
|
+
title: Common Grammar — DNA
|
|
46
|
+
summary: |
|
|
47
|
+
Generated DNA snapshot of the `@starci/grammar/common` public entry: custom properties,
|
|
48
|
+
the 110 renderers of its registry, their classes, stamped rule ids and recorded gaps. The DNA owns the observed package
|
|
49
|
+
version and source inventory. Common supplies anatomy, not colour. The snapshot is drift-checked.
|
|
50
|
+
- id: starci
|
|
51
|
+
path: starci/index.yaml
|
|
52
|
+
title: StarCi Core Grammar
|
|
53
|
+
summary: |
|
|
54
|
+
Historical snapshot of the StarCi Core family — DNA, idioms, playbook (including composing the
|
|
55
|
+
0.5.0 forms, overlays and navigation chrome) and family boundaries.
|
|
56
|
+
- id: offset-pop
|
|
57
|
+
path: offset-pop/index.yaml
|
|
58
|
+
title: Offset Pop Grammar
|
|
59
|
+
summary: |
|
|
60
|
+
Snapshot of the product-neutral Offset Pop family — cream canvas, ink outline plus hard offset
|
|
61
|
+
shadow, one pink decision accent with a text-safe accent for text — with DNA, idioms, a
|
|
62
|
+
mobile-first playbook for playful learning or consumer apps, and family boundaries including two
|
|
63
|
+
decisions flagged for the family owner.
|
|
64
|
+
families:
|
|
65
|
+
- id: common
|
|
66
|
+
title: common
|
|
67
|
+
componentContract:
|
|
68
|
+
package: '@starci/grammar'
|
|
69
|
+
entry: '@starci/grammar/common'
|
|
70
|
+
styleEntry: '@starci/grammar/common.css'
|
|
71
|
+
peers: [react, '@heroui/react', '@xyflow/react']
|
|
72
|
+
packageSnapshot: common/DNA.yaml
|
|
73
|
+
scope: |
|
|
74
|
+
DNA snapshot only. This catalog carries no Common-side family boundary, idiom set or composition
|
|
75
|
+
playbook: `@starci/grammar/common` is the semantic/props entry every visual family is defined over
|
|
76
|
+
(`defineGrammarFamily`), not a family that ships a palette, so `authority`, `reusableStyle`,
|
|
77
|
+
`productComposition` and `index` have nothing to name here. Universal semantics, renderer anatomy,
|
|
78
|
+
state and accessibility remain owned by knowledge/ui.
|
|
79
|
+
- id: starci
|
|
80
|
+
title: starci
|
|
81
|
+
contractRef: common
|
|
82
|
+
lint:
|
|
83
|
+
package: '@starci/eslint-grammar-starci'
|
|
84
|
+
factory: starciGrammarConfig
|
|
85
|
+
prefix: starci-grammar
|
|
86
|
+
authority: starci/family.yaml
|
|
87
|
+
packageSnapshot: starci/DNA.yaml
|
|
88
|
+
reusableStyle: starci/idioms.yaml
|
|
89
|
+
productComposition: starci/playbook.yaml
|
|
90
|
+
index: starci/index.yaml
|
|
91
|
+
- id: offset-pop
|
|
92
|
+
title: offset-pop
|
|
93
|
+
contractRef: common
|
|
94
|
+
lint:
|
|
95
|
+
package: '@starci/eslint-grammar-offset-pop'
|
|
96
|
+
factory: offsetPopGrammarConfig
|
|
97
|
+
prefix: starci-grammar
|
|
98
|
+
authority: offset-pop/family.yaml
|
|
99
|
+
packageSnapshot: offset-pop/DNA.yaml
|
|
100
|
+
reusableStyle: offset-pop/idioms.yaml
|
|
101
|
+
productComposition: offset-pop/playbook.yaml
|
|
102
|
+
index: offset-pop/index.yaml
|
|
@@ -21,30 +21,44 @@ pins:
|
|
|
21
21
|
install: registry
|
|
22
22
|
side: fe
|
|
23
23
|
source: packages/heroicons/package.json
|
|
24
|
-
why: 'StarCi custom Heroicons-compatible cuts; eslint-
|
|
24
|
+
why: 'StarCi custom Heroicons-compatible cuts; eslint-grammar-starci (icon.mjs) admits @starci/heroicons/24/outline and /16/solid as icon sources, so an app that uses them gets this exact version.'
|
|
25
25
|
'@starci/grammar':
|
|
26
|
-
version: 0.12.
|
|
26
|
+
version: 0.12.3
|
|
27
27
|
group: starci
|
|
28
28
|
install: registry
|
|
29
29
|
side: fe
|
|
30
30
|
source: packages/grammar/package.json
|
|
31
31
|
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.'
|
|
32
32
|
'@starci/eslint-canon-be':
|
|
33
|
-
version: 3.4.
|
|
33
|
+
version: 3.4.44
|
|
34
34
|
group: starci
|
|
35
35
|
install: registry
|
|
36
36
|
side: be
|
|
37
37
|
source: packages/eslint/be/package.json
|
|
38
38
|
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.'
|
|
39
39
|
'@starci/eslint-canon-fe':
|
|
40
|
-
version:
|
|
40
|
+
version: 9.0.0
|
|
41
41
|
group: starci
|
|
42
42
|
install: registry
|
|
43
43
|
side: fe
|
|
44
44
|
source: packages/eslint/fe/package.json
|
|
45
45
|
why: 'the front-end ESLint canon: `loadHfs(import.meta.url)` of fe/eslint.config.mjs finds the app-root hfs.json (kind app) and gives every linted file the view of the fe 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; the front end has no tests (FE_NO_TESTS R97 in hfs) and no-vietnamese-in-source (R91) applies.'
|
|
46
|
+
'@starci/eslint-grammar-starci':
|
|
47
|
+
version: 0.12.3
|
|
48
|
+
group: starci
|
|
49
|
+
install: registry
|
|
50
|
+
side: fe
|
|
51
|
+
source: packages/eslint/grammar-starci/package.json
|
|
52
|
+
why: 'the StarCi Grammar component API lint, versioned with @starci/grammar; front ends compose this family package with the universal FE canon.'
|
|
53
|
+
'@starci/eslint-grammar-offset-pop':
|
|
54
|
+
version: 0.12.3
|
|
55
|
+
group: starci
|
|
56
|
+
install: registry
|
|
57
|
+
side: fe
|
|
58
|
+
source: packages/eslint/grammar-offset-pop/package.json
|
|
59
|
+
why: 'the Offset Pop Grammar component API lint, versioned with @starci/grammar; its shared component contract comes from the StarCi family lint without copying rules.'
|
|
46
60
|
'@starci/stylelint-canon':
|
|
47
|
-
version: 2.0.
|
|
61
|
+
version: 2.0.12
|
|
48
62
|
group: starci
|
|
49
63
|
install: registry
|
|
50
64
|
side: fe
|
|
@@ -77,14 +91,14 @@ pins:
|
|
|
77
91
|
source: packages/test-world/package.json
|
|
78
92
|
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.'
|
|
79
93
|
'@starci/cli':
|
|
80
|
-
version: 1.7.
|
|
94
|
+
version: 1.7.35
|
|
81
95
|
group: starci
|
|
82
96
|
install: registry
|
|
83
97
|
side: both
|
|
84
98
|
source: packages/cli/package.json
|
|
85
99
|
why: 'the only StarCi command package; product repositories install it for starci app, while @starci/hfs remains its pinned transitive implementation.'
|
|
86
100
|
'@starci/hfs':
|
|
87
|
-
version: 4.7.
|
|
101
|
+
version: 4.7.35
|
|
88
102
|
group: starci
|
|
89
103
|
install: registry
|
|
90
104
|
side: both
|
|
@@ -380,7 +394,7 @@ pins:
|
|
|
380
394
|
version: 2.2.0
|
|
381
395
|
group: ui
|
|
382
396
|
side: fe
|
|
383
|
-
why: 'the base of the one application icon set (fe-stack icons, with @starci/heroicons for the glyphs it lacks); eslint-
|
|
397
|
+
why: 'the base of the one application icon set (fe-stack icons, with @starci/heroicons for the glyphs it lacks); eslint-grammar-starci (icon.mjs) admits @heroicons/react/24/outline and /16/solid.'
|
|
384
398
|
'@dicebear/core':
|
|
385
399
|
version: 10.4.0
|
|
386
400
|
group: ui
|
|
@@ -237,6 +237,13 @@ concerns:
|
|
|
237
237
|
pattern: FE-LINT
|
|
238
238
|
forbids: []
|
|
239
239
|
why: the canon lint and format configuration.
|
|
240
|
+
- id: grammar-lint
|
|
241
|
+
tier: opt
|
|
242
|
+
packages: ['@starci/eslint-grammar-starci', '@starci/eslint-grammar-offset-pop']
|
|
243
|
+
home: [fe.source-root-pinned]
|
|
244
|
+
pattern: FE-RULE-OWNERSHIP
|
|
245
|
+
forbids: []
|
|
246
|
+
why: The selected Grammar family's lint package runs beside the universal front-end canon; the family catalog declares the package and factory.
|
|
240
247
|
- id: auth-supabase
|
|
241
248
|
tier: opt
|
|
242
249
|
packages: ['@supabase/supabase-js', '@supabase/ssr']
|