@fabrika/check 0.9.0-dev.2 → 0.9.0-dev.21
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/package.json +7 -7
- package/src/ast.ts +69 -6
- package/src/check.ts +148 -44
- package/src/cli.ts +34 -8
- package/src/contract.ts +42 -6
- package/src/dialect.ts +29 -0
- package/src/finding.ts +14 -7
- package/src/index.ts +4 -12
- package/src/inputs.ts +4 -2
- package/src/layout.ts +41 -12
- package/src/limits.ts +13 -3
- package/src/migration-base.ts +85 -0
- package/src/reader/schema.ts +42 -512
- package/src/reader/surface.ts +43 -5
- package/src/reader/value.ts +18 -6
- package/src/resolution.ts +2 -2
- package/src/rules/cloudflare.ts +59 -0
- package/src/rules/compile.ts +32 -0
- package/src/rules/framework.ts +2 -2
- package/src/rules/literal.ts +3 -1
- package/src/rules/migration-history.ts +70 -0
- package/src/rules/migrations.ts +248 -9
- package/src/rules/modules.ts +9 -3
- package/src/rules/platform-migrations.ts +100 -0
- package/src/rules/runtime.ts +45 -14
- package/src/rules/structure.ts +38 -18
- package/src/rules/tests.ts +9 -60
- package/src/rules/types.ts +17 -16
- package/src/source-maps.ts +2 -0
- package/src/trust.ts +8 -4
- package/types/src/ast.d.ts +6 -0
- package/types/src/check.d.ts +3 -0
- package/types/src/contract.d.ts +1 -0
- package/types/src/dialect.d.ts +8 -0
- package/types/src/finding.d.ts +6 -5
- package/types/src/index.d.ts +4 -3
- package/types/src/layout.d.ts +25 -10
- package/types/src/limits.d.ts +12 -2
- package/types/src/migration-base.d.ts +9 -0
- package/types/src/reader/schema.d.ts +5 -2
- package/types/src/reader/value.d.ts +2 -2
- package/types/src/rules/cloudflare.d.ts +9 -0
- package/types/src/rules/compile.d.ts +7 -0
- package/types/src/rules/framework.d.ts +1 -1
- package/types/src/rules/migration-history.d.ts +12 -0
- package/types/src/rules/migrations.d.ts +28 -0
- package/types/src/rules/platform-migrations.d.ts +15 -0
- package/types/src/rules/runtime.d.ts +7 -2
- package/types/src/rules/structure.d.ts +11 -4
- package/types/src/rules/tests.d.ts +6 -14
- package/types/src/rules/types.d.ts +2 -0
- package/src/endpoint-fixtures.ts +0 -221
- package/src/rules/crontab.ts +0 -147
- package/src/rules/isolation.ts +0 -79
- package/src/scaffold-sample.ts +0 -111
- package/src/scaffold.ts +0 -650
- package/types/src/endpoint-fixtures.d.ts +0 -36
- package/types/src/rules/crontab.d.ts +0 -15
- package/types/src/rules/isolation.d.ts +0 -18
- package/types/src/scaffold-sample.d.ts +0 -8
- package/types/src/scaffold.d.ts +0 -28
package/src/rules/structure.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { isBuiltin } from 'node:module'
|
|
2
2
|
import { type AstNode, child, identifierName, staticKey } from '../ast'
|
|
3
|
-
import { type Report, STRUCTURE_HINT_RULE_IDS } from '../finding'
|
|
3
|
+
import { type Finding, type Report, STRUCTURE_HINT_RULE_IDS } from '../finding'
|
|
4
4
|
import {
|
|
5
5
|
CONTRACT_FILE,
|
|
6
6
|
DATABASE_DIR,
|
|
7
7
|
isRelativeSpecifier,
|
|
8
8
|
isSourceFile,
|
|
9
9
|
isTestFile,
|
|
10
|
+
isToolModule,
|
|
10
11
|
resolveRelative,
|
|
11
12
|
SCHEMAS_DIR,
|
|
12
13
|
SCHEMAS_FILE,
|
|
@@ -19,10 +20,9 @@ import {
|
|
|
19
20
|
import type { ModuleReference } from '../references'
|
|
20
21
|
import { type ImportMappings, mappedTargets } from '../resolution'
|
|
21
22
|
import { isTestKit } from './modules'
|
|
22
|
-
import { isGeneratedTestPath } from './tests'
|
|
23
23
|
|
|
24
|
-
/** The rules of the application architecture (docs/reference/application-architecture.md):
|
|
25
|
-
export const STRUCTURE_RULE_IDS = ['spa-server-import', 'layer-import', '
|
|
24
|
+
/** The rules of the application architecture (docs/reference/application-architecture.md): three refusals and the hints. */
|
|
25
|
+
export const STRUCTURE_RULE_IDS = ['spa-server-import', 'layer-import', 'shared-import', ...STRUCTURE_HINT_RULE_IDS] as const
|
|
26
26
|
|
|
27
27
|
type SlicePart = 'endpoints' | 'logic' | 'queries'
|
|
28
28
|
|
|
@@ -57,13 +57,16 @@ export interface StructurePlace {
|
|
|
57
57
|
readonly part: SlicePart | undefined
|
|
58
58
|
/** A test or the generated entrypoint: the structure hints do not apply to it. */
|
|
59
59
|
readonly exempt: boolean
|
|
60
|
+
/** A generated module (`isGeneratedModule`): the hints do not apply to it, the refusals do. */
|
|
61
|
+
readonly generated: boolean
|
|
60
62
|
}
|
|
61
63
|
|
|
62
|
-
export const structurePlace = (file: string, isGeneratedEntry: boolean): StructurePlace => ({
|
|
64
|
+
export const structurePlace = (file: string, isGeneratedEntry: boolean, generated: boolean): StructurePlace => ({
|
|
63
65
|
file,
|
|
64
66
|
slice: sliceOf(file),
|
|
65
67
|
part: slicePart(file),
|
|
66
68
|
exempt: isGeneratedEntry || isTestFile(file),
|
|
69
|
+
generated,
|
|
67
70
|
})
|
|
68
71
|
|
|
69
72
|
/** What the structure rules read beyond one module: every module's references, and how Bun resolves them. */
|
|
@@ -128,12 +131,13 @@ const runtimeClosure = (graph: StructureGraph, start: Targets, descend: (path: s
|
|
|
128
131
|
const isDataPackage = (specifier: string): boolean => specifier === '@fabrika/db' || specifier.startsWith('@fabrika/db/')
|
|
129
132
|
|
|
130
133
|
/** The framework modules logic and queries may import; the rest of `@fabrika/*` is the framework's own composition. */
|
|
131
|
-
const LAYER_PACKAGES: ReadonlySet<string> = new Set(['@fabrika/app', '@fabrika/db'])
|
|
134
|
+
const LAYER_PACKAGES: ReadonlySet<string> = new Set(['@fabrika/app', '@fabrika/app/schema', '@fabrika/db'])
|
|
132
135
|
|
|
133
136
|
/** The framework modules an SPA loads: the typed client, its React hooks, the component kit and its challenge widget. */
|
|
134
137
|
const SPA_PACKAGES: ReadonlySet<string> = new Set([
|
|
135
138
|
'@fabrika/app/client',
|
|
136
139
|
'@fabrika/app/react',
|
|
140
|
+
'@fabrika/app/schema',
|
|
137
141
|
'@fabrika/ui',
|
|
138
142
|
'@fabrika/ui/challenge',
|
|
139
143
|
'@fabrika/ui/styles.css',
|
|
@@ -141,7 +145,7 @@ const SPA_PACKAGES: ReadonlySet<string> = new Set([
|
|
|
141
145
|
])
|
|
142
146
|
|
|
143
147
|
const SPA_ALLOWED =
|
|
144
|
-
'@fabrika/app/client, @fabrika/app/react, @fabrika/ui, @fabrika/ui/challenge, fabrika.contract.ts, src/schemas.ts, modules under src/shared/ and modules under web/; a type-only import of anything else'
|
|
148
|
+
'@fabrika/app/client, @fabrika/app/react, @fabrika/app/schema, @fabrika/ui, @fabrika/ui/challenge, fabrika.contract.ts, src/schemas.ts, modules under src/shared/ and modules under web/; a type-only import of anything else'
|
|
145
149
|
|
|
146
150
|
const isSchemaModule = (path: string): boolean => path === SCHEMAS_FILE || path.startsWith(SCHEMAS_DIR)
|
|
147
151
|
|
|
@@ -168,18 +172,18 @@ const checkSpaReference = (graph: StructureGraph, reference: ModuleReference, ta
|
|
|
168
172
|
if (server !== undefined) report(reference.node, 'spa-server-import', viaMessage(reference, server, 'server code', 'the SPA'), SPA_ALLOWED)
|
|
169
173
|
}
|
|
170
174
|
|
|
171
|
-
/** The
|
|
172
|
-
const
|
|
175
|
+
/** The packages shared code loads, zod's schemas either way; everything else it needs is in other modules of `src/shared/`. */
|
|
176
|
+
const SHARED_PACKAGES: ReadonlySet<string> = new Set(['zod/v4', '@fabrika/app/schema'])
|
|
173
177
|
|
|
174
178
|
/** A shared module runs in the SPA and in every slice, so it loads nothing either side lacks. */
|
|
175
179
|
const checkSharedReference = (reference: ModuleReference, targets: Targets, report: Report): void => {
|
|
176
|
-
const outside = targets.packages.find((specifier) => specifier
|
|
180
|
+
const outside = targets.packages.find((specifier) => !SHARED_PACKAGES.has(specifier)) ?? targets.files.find((path) => !isSharedModule(path))
|
|
177
181
|
if (outside === undefined) return
|
|
178
182
|
report(
|
|
179
183
|
reference.node,
|
|
180
184
|
'shared-import',
|
|
181
185
|
viaMessage(reference, outside, 'outside src/shared/', 'shared code'),
|
|
182
|
-
'zod/v4 and other modules under src/shared/; a type-only import of anything else',
|
|
186
|
+
'zod/v4, @fabrika/app/schema and other modules under src/shared/; a type-only import of anything else',
|
|
183
187
|
)
|
|
184
188
|
}
|
|
185
189
|
|
|
@@ -221,23 +225,39 @@ const checkSliceReference = (place: StructurePlace, reference: ModuleReference,
|
|
|
221
225
|
)
|
|
222
226
|
}
|
|
223
227
|
|
|
228
|
+
/**
|
|
229
|
+
* A `package.json` under `tools/` makes a tool a package, which a workspace or a `file:` dependency lets the application
|
|
230
|
+
* load by its name, past `tool-import`, which judges the files an import resolves to.
|
|
231
|
+
*/
|
|
232
|
+
export const checkToolPackages = (paths: readonly string[]): Finding[] =>
|
|
233
|
+
paths.filter((path) => isToolModule(path) && path.endsWith('/package.json')).map((path) => ({
|
|
234
|
+
file: path,
|
|
235
|
+
line: 1,
|
|
236
|
+
column: 1,
|
|
237
|
+
severity: 'refusal',
|
|
238
|
+
rule: 'tool-import',
|
|
239
|
+
message: `'${path}' makes a developer's tool a package, which the application could load by its name`,
|
|
240
|
+
allowed: "tools/ without a package.json: a tool's dependencies go in the root package.json",
|
|
241
|
+
}))
|
|
242
|
+
|
|
224
243
|
/** The architecture's rules over one module's imports, re-exports and loads, as Bun resolves them for that module. */
|
|
225
244
|
export const checkStructureReferences = (graph: StructureGraph, place: StructurePlace, report: Report): void => {
|
|
226
245
|
for (const reference of graph.referencesOf(place.file)) {
|
|
227
246
|
const targets = referenceTargets(graph, place.file, reference.specifier)
|
|
228
|
-
if (
|
|
247
|
+
if (reference.typeOnly) continue
|
|
248
|
+
const tool = isToolModule(place.file) ? undefined : targets.files.find(isToolModule)
|
|
249
|
+
if (tool !== undefined) {
|
|
229
250
|
report(
|
|
230
251
|
reference.node,
|
|
231
|
-
'
|
|
232
|
-
`'${reference.specifier}'
|
|
233
|
-
'a
|
|
252
|
+
'tool-import',
|
|
253
|
+
`'${reference.specifier}' loads ${tool}, a developer's tool, which nothing outside tools/ loads`,
|
|
254
|
+
'what the application and a tool share under src/ (pure code in src/shared/), imported by the tool',
|
|
234
255
|
)
|
|
235
256
|
}
|
|
236
|
-
if (reference.typeOnly) continue
|
|
237
257
|
if (place.file.startsWith(SPA_DIR) && !place.exempt) checkSpaReference(graph, reference, targets, report)
|
|
238
258
|
if (isSharedModule(place.file) && !place.exempt) checkSharedReference(reference, targets, report)
|
|
239
259
|
if (isLayerModule(place.file)) checkLayerReference(graph, place, reference, targets, report)
|
|
240
|
-
if (place.exempt) continue
|
|
260
|
+
if (place.exempt || place.generated) continue
|
|
241
261
|
if (place.part === 'logic') checkLogicReference(reference, targets, report)
|
|
242
262
|
else if (place.slice !== undefined) checkSliceReference(place, reference, targets, report)
|
|
243
263
|
}
|
|
@@ -276,7 +296,7 @@ const dataAccess = (node: AstNode): string | undefined => {
|
|
|
276
296
|
|
|
277
297
|
/** The architecture's hints at one node: a handler outside `endpoints.ts`, data access outside `endpoints.ts`/`queries.ts`. */
|
|
278
298
|
export const checkStructureNode = (place: StructurePlace, node: AstNode, report: Report): void => {
|
|
279
|
-
if (place.exempt) return
|
|
299
|
+
if (place.exempt || place.generated) return
|
|
280
300
|
const handle = handledProcedure(node)?.handle
|
|
281
301
|
if (handle !== undefined && place.part !== 'endpoints') {
|
|
282
302
|
report(
|
package/src/rules/tests.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { type AstNode, child, children,
|
|
1
|
+
import { type AstNode, child, children, identifierName, memberPath, memberSuffix, staticString, walk } from '../ast'
|
|
2
2
|
import type { Finding, Report } from '../finding'
|
|
3
|
-
import { ENDPOINT_ACCESS_TEST, isRelativeSpecifier, joinRelative, POLICY_TEST_SUFFIX, POLICY_TESTS_DIR, resolveRelative } from '../layout'
|
|
4
3
|
import { declaringScope } from '../scope'
|
|
5
4
|
import { isKey, parseToml } from '../toml'
|
|
6
5
|
import { BUNFIG_FILE } from '../trust'
|
|
@@ -33,7 +32,7 @@ const isAssertionCall = (node: AstNode): boolean => {
|
|
|
33
32
|
const path = memberPath(callee)
|
|
34
33
|
const [root] = path ?? []
|
|
35
34
|
const last = path?.[path.length - 1]
|
|
36
|
-
return root !== undefined && root !== 'expect' && (
|
|
35
|
+
return root !== undefined && root !== 'expect' && (root.startsWith('assert') || (last !== undefined && ASSERTION_NAME.test(last)))
|
|
37
36
|
}
|
|
38
37
|
|
|
39
38
|
/** Whether a test body runs an assertion; a nested function counts only where it is called or passed to a call. */
|
|
@@ -107,50 +106,12 @@ export const checkTestNode = (node: AstNode, ancestors: readonly AstNode[], repo
|
|
|
107
106
|
}
|
|
108
107
|
}
|
|
109
108
|
|
|
110
|
-
/** The first line of a test written by `fabrika db test-scaffold`, followed by the SHA-256 of everything after that line. */
|
|
111
|
-
export const GENERATED_TEST_HEADER = '// @generated by fabrika db test-scaffold sha256:'
|
|
112
|
-
const GENERATED_TEST_MARKER = '// @generated by fabrika db test-scaffold'
|
|
113
|
-
|
|
114
|
-
const sha256 = async (text: string): Promise<string> => {
|
|
115
|
-
const digest = await crypto.subtle.digest('SHA-256', new TextEncoder().encode(text))
|
|
116
|
-
return Array.from(new Uint8Array(digest), (byte) => byte.toString(16).padStart(2, '0')).join('')
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
/** The header `fabrika db test-scaffold` puts on a generated test with this body. */
|
|
120
|
-
export const generatedTestHeader = async (body: string): Promise<string> => `${GENERATED_TEST_HEADER}${await sha256(body)}`
|
|
121
|
-
|
|
122
|
-
export const checkGeneratedTest = async (text: string, comments: readonly Comment[], report: Report): Promise<void> => {
|
|
123
|
-
if (!text.startsWith(GENERATED_TEST_MARKER)) {
|
|
124
|
-
const misplaced = comments.find((comment) => comment.text.includes(GENERATED_TEST_MARKER.slice('// '.length)))
|
|
125
|
-
if (misplaced !== undefined) {
|
|
126
|
-
report(
|
|
127
|
-
misplaced.position,
|
|
128
|
-
'generated-test-hash',
|
|
129
|
-
'the generated-test header is not the first line of the file',
|
|
130
|
-
'the file as fabrika db test-scaffold wrote it',
|
|
131
|
-
)
|
|
132
|
-
}
|
|
133
|
-
return
|
|
134
|
-
}
|
|
135
|
-
const newline = text.indexOf('\n')
|
|
136
|
-
const header = newline === -1 ? text : text.slice(0, newline)
|
|
137
|
-
const body = newline === -1 ? '' : text.slice(newline + 1)
|
|
138
|
-
if (header === (await generatedTestHeader(body))) return
|
|
139
|
-
report(
|
|
140
|
-
{ line: 1, column: 1 },
|
|
141
|
-
'generated-test-hash',
|
|
142
|
-
'this generated test differs from what fabrika db test-scaffold wrote',
|
|
143
|
-
'the file as generated; rerun fabrika db test-scaffold after a table change',
|
|
144
|
-
)
|
|
145
|
-
}
|
|
146
|
-
|
|
147
109
|
/** `[test]` keys that pick other test files, skip some, or let a failing test pass on a later attempt. */
|
|
148
110
|
const SUITE_NARROWING_TEST_KEYS = ['root', 'pathIgnorePatterns', 'retry'] as const
|
|
149
111
|
|
|
150
112
|
/**
|
|
151
|
-
* The `bunfig.toml` of an application must not narrow its own suite
|
|
152
|
-
*
|
|
153
|
-
* subset is reported by the trust rules.
|
|
113
|
+
* The `bunfig.toml` of an application must not narrow its own suite, which the platform build runs. A file outside the
|
|
114
|
+
* TOML subset is reported by the trust rules.
|
|
154
115
|
*/
|
|
155
116
|
export const checkTestSuiteConfig = (text: string): Finding[] => {
|
|
156
117
|
const document = parseToml(text)
|
|
@@ -174,35 +135,23 @@ export const checkTestSuiteConfig = (text: string): Finding[] => {
|
|
|
174
135
|
return findings
|
|
175
136
|
}
|
|
176
137
|
|
|
177
|
-
/** Whether `path` is a file the scaffold generates: a policy isolation test, the endpoint access test, or one with the header. */
|
|
178
|
-
export const isGeneratedTestPath = (path: string, files: ReadonlyMap<string, string>): boolean =>
|
|
179
|
-
path === ENDPOINT_ACCESS_TEST || (path.startsWith(POLICY_TESTS_DIR) && path.endsWith(POLICY_TEST_SUFFIX))
|
|
180
|
-
|| (files.get(path)?.startsWith(GENERATED_TEST_MARKER) ?? false)
|
|
181
|
-
|
|
182
138
|
/**
|
|
183
|
-
* `mock.module(…)` of the test runner
|
|
184
|
-
*
|
|
139
|
+
* `mock.module(…)` of the test runner or a framework package would let application code replace what the test kit runs
|
|
140
|
+
* on; a computed specifier could name either. Refused anywhere in the application.
|
|
185
141
|
*/
|
|
186
|
-
export const checkMockModule = (node: AstNode,
|
|
142
|
+
export const checkMockModule = (node: AstNode, report: Report): void => {
|
|
187
143
|
if (node.type !== 'CallExpression') return
|
|
188
144
|
const callee = child(node, 'callee')
|
|
189
145
|
if (callee === undefined || callee.type !== 'MemberExpression') return
|
|
190
146
|
const suffix = memberPath(callee) ?? memberSuffix(callee)
|
|
191
147
|
if (suffix.length < 2 || suffix[suffix.length - 1] !== 'module' || suffix[suffix.length - 2] !== 'mock') return
|
|
192
|
-
const allowed = 'mock.module of an application module
|
|
148
|
+
const allowed = 'mock.module of an application module, with a literal specifier'
|
|
193
149
|
const specifier = staticString(children(node, 'arguments')[0] ?? undefined)
|
|
194
150
|
if (specifier === undefined) {
|
|
195
151
|
report(node, 'mock-module', 'mock.module with a computed specifier could replace the test runner or the framework', allowed)
|
|
196
152
|
return
|
|
197
153
|
}
|
|
198
154
|
if (specifier === 'bun:test' || specifier.startsWith('@fabrika/')) {
|
|
199
|
-
report(node, 'mock-module', `mock.module('${specifier}') replaces what the
|
|
200
|
-
return
|
|
201
|
-
}
|
|
202
|
-
if (!isRelativeSpecifier(specifier)) return
|
|
203
|
-
const resolved = resolveRelative((path) => files.has(path), file, specifier)
|
|
204
|
-
const targets = resolved.kind === 'file' ? [resolved.path] : resolved.kind === 'missing' ? [joinRelative(file, specifier) ?? ''] : resolved.paths
|
|
205
|
-
if (targets.some((target) => isGeneratedTestPath(target, files))) {
|
|
206
|
-
report(node, 'mock-module', `mock.module('${specifier}') replaces a generated test`, allowed)
|
|
155
|
+
report(node, 'mock-module', `mock.module('${specifier}') replaces what the test kit runs on`, allowed)
|
|
207
156
|
}
|
|
208
157
|
}
|
package/src/rules/types.ts
CHANGED
|
@@ -17,6 +17,7 @@ const admitsAnyString = (type: AstNode): boolean => {
|
|
|
17
17
|
const referencedName = (typeName: AstNode | undefined): string | undefined =>
|
|
18
18
|
typeName?.type === 'TSQualifiedName' ? identifierName(child(typeName, 'right')) : identifierName(typeName)
|
|
19
19
|
|
|
20
|
+
/** `type-assertion` and `any-type`: how a module's own source is written, which a generated module is not held to. */
|
|
20
21
|
export const checkTypeNode = (node: AstNode, report: Report): void => {
|
|
21
22
|
switch (node.type) {
|
|
22
23
|
case 'TSAsExpression':
|
|
@@ -27,22 +28,22 @@ export const checkTypeNode = (node: AstNode, report: Report): void => {
|
|
|
27
28
|
return
|
|
28
29
|
case 'TSAnyKeyword':
|
|
29
30
|
report(node, 'any-type', '`any` switches type checking off', 'the concrete type, or `unknown` narrowed by a check')
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export const checkCapabilityNode = (node: AstNode, report: Report): void => {
|
|
35
|
+
if (node.type !== 'TSTypeReference') return
|
|
36
|
+
const name = referencedName(child(node, 'typeName'))
|
|
37
|
+
if (name === undefined || !CAPABILITIES.has(name)) return
|
|
38
|
+
const typeArguments = child(node, 'typeArguments')
|
|
39
|
+
const parameters = typeArguments === undefined ? [] : children(typeArguments, 'params')
|
|
40
|
+
if (parameters.some((parameter) => parameter !== null && admitsAnyString(parameter))) {
|
|
41
|
+
report(
|
|
42
|
+
node,
|
|
43
|
+
'capability-widening',
|
|
44
|
+
`${name}<string, …> widens a capability to any dimension or action`,
|
|
45
|
+
`${name}<'<dimension>', '<action>'> with literal names`,
|
|
46
|
+
)
|
|
46
47
|
}
|
|
47
48
|
}
|
|
48
49
|
|
package/src/source-maps.ts
CHANGED
|
@@ -144,6 +144,8 @@ export async function uploadSourceMaps(
|
|
|
144
144
|
},
|
|
145
145
|
body: artifact.body,
|
|
146
146
|
signal: AbortSignal.timeout(UPLOAD_TIMEOUT_MS),
|
|
147
|
+
// The bearer and the map must never reach a redirect target; a 3xx is not ok below.
|
|
148
|
+
redirect: 'manual',
|
|
147
149
|
})
|
|
148
150
|
if (response.ok) uploaded++
|
|
149
151
|
else incomplete = true
|
package/src/trust.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import type { Finding } from './finding'
|
|
6
6
|
import { parseJsonc } from './jsonc'
|
|
7
|
-
import { isIgnoredSegment, isRelativeSpecifier, isSourceFile, joinRelative } from './layout'
|
|
7
|
+
import { isIgnoredSegment, isRelativeSpecifier, isSourceFile, isToolModule, joinRelative } from './layout'
|
|
8
8
|
import { isKey, parseToml } from './toml'
|
|
9
9
|
|
|
10
10
|
/** Packages whose exports the reader trusts by name, and the packages they rely on. */
|
|
@@ -141,11 +141,15 @@ function checkTsconfig(path: string, text: string, files: ReadonlyMap<string, st
|
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
-
/**
|
|
144
|
+
/**
|
|
145
|
+
* A test preload must be a checked application file: a skipped or generated one runs unchecked during the build, and a
|
|
146
|
+
* developer's tool is not checked as application code.
|
|
147
|
+
*/
|
|
145
148
|
const isCheckedTestPreload = (target: string): boolean => {
|
|
146
149
|
if (!target.startsWith('./')) return false
|
|
147
150
|
const segments = target.slice(2).split('/')
|
|
148
|
-
return segments[0] !== 'fabrika' &&
|
|
151
|
+
return segments[0] !== 'fabrika' && !isToolModule(target.slice(2))
|
|
152
|
+
&& segments.every((segment) => segment !== '' && segment !== '..' && !isIgnoredSegment(segment))
|
|
149
153
|
&& isSourceFile(target)
|
|
150
154
|
}
|
|
151
155
|
|
|
@@ -180,7 +184,7 @@ function checkBunfig(text: string, report: (needle: string, message: string, all
|
|
|
180
184
|
report(
|
|
181
185
|
at(entry.line),
|
|
182
186
|
'a test preload outside the checked application files runs unchecked in the platform build',
|
|
183
|
-
"'./<path>' of a source file the checker reads, outside fabrika/, dist/, node_modules/ and dot directories",
|
|
187
|
+
"'./<path>' of a source file the checker reads, outside fabrika/, tools/, dist/, node_modules/ and dot directories",
|
|
184
188
|
)
|
|
185
189
|
}
|
|
186
190
|
}
|
package/types/src/ast.d.ts
CHANGED
|
@@ -54,12 +54,18 @@ export declare const unwrap: (node: AstNode) => AstNode;
|
|
|
54
54
|
export declare const memberPath: (node: AstNode) => readonly string[] | undefined;
|
|
55
55
|
/** Whether an `Identifier` denotes a runtime value here, rather than a property name, a key, a label or a type. */
|
|
56
56
|
export declare const isValueReference: (node: AstNode, parent: AstNode | undefined) => boolean;
|
|
57
|
+
/**
|
|
58
|
+
* A node's line and column (from 1), as the parser counts them, for a tree `parseModule` returns: its `loc` is the
|
|
59
|
+
* start of its line (`lineLocations`). A tree parsed any other way has no such `loc` and reads as 1:1.
|
|
60
|
+
*/
|
|
57
61
|
export declare const positionOf: (node: AstNode) => Position;
|
|
58
62
|
/** Visits every node below `root`, depth first, with the chain of its ancestors (nearest last); `'skip'` prunes a subtree. */
|
|
59
63
|
export declare const walk: (root: AstNode, visit: (node: AstNode, ancestors: readonly AstNode[]) => "skip" | undefined | void) => void;
|
|
60
64
|
export declare const utf8Bytes: (text: string) => number;
|
|
61
65
|
/** The nesting depth of the tree below `root`, measured without recursion, so a deep tree cannot exhaust the stack. */
|
|
62
66
|
export declare const nodeDepth: (root: AstNode) => number;
|
|
67
|
+
/** The number of syntax nodes in the tree below `root`, `root` included, counted without recursion. */
|
|
68
|
+
export declare const nodeCount: (root: AstNode) => number;
|
|
63
69
|
export declare const parseModule: (file: string, text: string) => ParseResult;
|
|
64
70
|
/** The sources of a module's import and re-export declarations; `rules/literal.ts` decides which of them are allowed. */
|
|
65
71
|
export declare const importedSpecifiers: (module: ParsedModule) => string[];
|
package/types/src/check.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type Finding } from './finding';
|
|
2
2
|
import type { PackedSet } from './packed';
|
|
3
|
+
import { type MigrationBase } from './rules/migration-history';
|
|
3
4
|
export interface CheckInput {
|
|
4
5
|
/** The application's root directory. */
|
|
5
6
|
readonly root: string;
|
|
@@ -7,6 +8,8 @@ export interface CheckInput {
|
|
|
7
8
|
readonly files?: ReadonlyMap<string, string>;
|
|
8
9
|
/** A local pack whose tarballs `package-replacement` accepts (`fabrika-check --packed`); a deploy build gives none. */
|
|
9
10
|
readonly packed?: PackedSet;
|
|
11
|
+
/** The migrations of a shared branch the tree must still hold unchanged (`fabrika-check`, from git); a deploy build gives none. */
|
|
12
|
+
readonly migrationBase?: MigrationBase;
|
|
10
13
|
}
|
|
11
14
|
export interface ApplicationTree {
|
|
12
15
|
readonly files: ReadonlyMap<string, string>;
|
package/types/src/contract.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { type ParsedModule } from './ast';
|
|
|
5
5
|
import { type Finding } from './finding';
|
|
6
6
|
import { ModuleGraph } from './graph';
|
|
7
7
|
export { ContractError } from '@fabrika/app/contract';
|
|
8
|
+
export { accessTables } from '@fabrika/db/tables';
|
|
8
9
|
export { type Finding, formatFinding } from './finding';
|
|
9
10
|
export { contractReaderInputs } from './inputs';
|
|
10
11
|
export { CONTRACT_FILE, MIGRATIONS_DIR, TABLES_FILE } from './layout';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** The database an application's data layer runs on: SQLite in its Durable Object on Cloudflare (ADR-0065), else Postgres. */
|
|
2
|
+
export type ApplicationDialect = 'postgres' | 'sqlite';
|
|
3
|
+
/**
|
|
4
|
+
* Read statically from `fabrika.config.ts`: SQLite when its default export is a call of the `defineApp` that
|
|
5
|
+
* `@fabrika/provider-cloudflare` exports, the config every Cloudflare application writes. Postgres otherwise,
|
|
6
|
+
* including without a config or when the call's origin is not static.
|
|
7
|
+
*/
|
|
8
|
+
export declare const applicationDialect: (files: ReadonlyMap<string, string>) => ApplicationDialect;
|
package/types/src/finding.d.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import type { AstNode, Position } from './ast';
|
|
2
2
|
/** Rules whose finding fails the check: the framework's forms and platform integrity. */
|
|
3
|
-
export declare const REFUSAL_RULE_IDS: readonly ["parse-error", "literal", "contract", "forbidden-import", "test-only-import", "unchecked-import", "forbidden-global", "raw-sql", "type-assertion", "any-type", "suppression-comment", "capability-widening", "prototype-assignment", "framework-write", "env-read", "public-env", "cross-app-fetch", "url-endpoint", "on-conflict-index", "key-literal", "client-identity", "sensitive-log", "unsafe-html", "dynamic-code", "migration-name", "
|
|
3
|
+
export declare const REFUSAL_RULE_IDS: readonly ["parse-error", "literal", "contract", "forbidden-import", "test-only-import", "unchecked-import", "forbidden-global", "raw-sql", "type-assertion", "any-type", "suppression-comment", "capability-widening", "prototype-assignment", "framework-write", "env-read", "public-env", "cross-app-fetch", "url-endpoint", "on-conflict-index", "access-view-key", "key-literal", "client-identity", "sensitive-log", "unsafe-html", "dynamic-code", "migration-name", "migration-refused", "backup-schema", "migration-edited", "file-column-migration", "package-replacement", "skipped-test", "test-without-assertion", "mock-module", "spa-server-import", "layer-import", "shared-import", "tool-import", "cloudflare-scan", "cloudflare-job-segment", "cloudflare-current-timestamp", "cloudflare-framework-name", "cloudflare-view-trigger"];
|
|
4
4
|
/** Rules that report a step out of the application architecture. */
|
|
5
5
|
export declare const STRUCTURE_HINT_RULE_IDS: readonly ["logic-data-access", "cross-slice-queries", "handler-location", "data-access-location"];
|
|
6
6
|
/**
|
|
7
|
-
* Rules whose findings never fail the check: the architecture's, a `ctx.sql` its site does not declare,
|
|
8
|
-
* `{ member: true }` endpoint of a contract whose external role admits people from outside the organization
|
|
7
|
+
* Rules whose findings never fail the check: the architecture's, a `ctx.sql` its site does not declare, a
|
|
8
|
+
* `{ member: true }` endpoint of a contract whose external role admits people from outside the organization, and a
|
|
9
|
+
* Cloudflare mutation that waits for an outside call inside the object's transaction.
|
|
9
10
|
*/
|
|
10
|
-
export declare const HINT_RULE_IDS: readonly ["logic-data-access", "cross-slice-queries", "handler-location", "data-access-location", "sql-undeclared", "member-admits-external"];
|
|
11
|
-
export declare const RULE_IDS: readonly ["parse-error", "literal", "contract", "forbidden-import", "test-only-import", "unchecked-import", "forbidden-global", "raw-sql", "type-assertion", "any-type", "suppression-comment", "capability-widening", "prototype-assignment", "framework-write", "env-read", "public-env", "cross-app-fetch", "url-endpoint", "on-conflict-index", "key-literal", "client-identity", "sensitive-log", "unsafe-html", "dynamic-code", "migration-name", "
|
|
11
|
+
export declare const HINT_RULE_IDS: readonly ["logic-data-access", "cross-slice-queries", "handler-location", "data-access-location", "sql-undeclared", "member-admits-external", "cloudflare-held-call"];
|
|
12
|
+
export declare const RULE_IDS: readonly ["parse-error", "literal", "contract", "forbidden-import", "test-only-import", "unchecked-import", "forbidden-global", "raw-sql", "type-assertion", "any-type", "suppression-comment", "capability-widening", "prototype-assignment", "framework-write", "env-read", "public-env", "cross-app-fetch", "url-endpoint", "on-conflict-index", "access-view-key", "key-literal", "client-identity", "sensitive-log", "unsafe-html", "dynamic-code", "migration-name", "migration-refused", "backup-schema", "migration-edited", "file-column-migration", "package-replacement", "skipped-test", "test-without-assertion", "mock-module", "spa-server-import", "layer-import", "shared-import", "tool-import", "cloudflare-scan", "cloudflare-job-segment", "cloudflare-current-timestamp", "cloudflare-framework-name", "cloudflare-view-trigger", "logic-data-access", "cross-slice-queries", "handler-location", "data-access-location", "sql-undeclared", "member-admits-external", "cloudflare-held-call"];
|
|
12
13
|
export type RefusalRuleId = (typeof REFUSAL_RULE_IDS)[number];
|
|
13
14
|
export type HintRuleId = (typeof HINT_RULE_IDS)[number];
|
|
14
15
|
export type RuleId = (typeof RULE_IDS)[number];
|
package/types/src/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { type ApplicationTree, checkApplication, type CheckInput, readApplicationTree } from './check';
|
|
2
|
+
export { type ApplicationDialect, applicationDialect } from './dialect';
|
|
2
3
|
export { type Finding, formatFinding, RULE_IDS, type RuleId } from './finding';
|
|
3
|
-
export { CONTRACT_FILE, GENERATED_ENTRY_FILE, MIGRATIONS_DIR, TABLES_FILE
|
|
4
|
+
export { CONFIG_FILE, CONTRACT_FILE, GENERATED_ENTRY_FILE, MIGRATIONS_DIR, TABLES_FILE } from './layout';
|
|
5
|
+
export { readMigrationBase } from './migration-base';
|
|
4
6
|
export { type PackedSet, type PackedTarball, readPackedSet } from './packed';
|
|
5
|
-
export {
|
|
6
|
-
export { ENDPOINT_ACCESS_TEST, ENDPOINT_FIXTURES_FILE, type GeneratedTest, generatedTests, missingEndpointFixtures, POLICY_TESTS_DIR, policyTestPath, scaffoldInputs, } from './scaffold';
|
|
7
|
+
export type { MigrationBase } from './rules/migration-history';
|
package/types/src/layout.d.ts
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
+
import { type ParsedModule } from './ast';
|
|
1
2
|
/** Where an application keeps what the checker reads. Paths are relative to the application root. */
|
|
2
3
|
export declare const CONTRACT_FILE = "fabrika.contract.ts";
|
|
4
|
+
/** The provider-authored application config, whose `defineApp` names the provider. */
|
|
5
|
+
export declare const CONFIG_FILE = "fabrika.config.ts";
|
|
3
6
|
/** The named export of the contract module that holds `defineContract(…)`. */
|
|
4
7
|
export declare const CONTRACT_EXPORT = "contract";
|
|
5
8
|
export declare const TABLES_FILE = "src/db/tables.ts";
|
|
6
9
|
/** The named export of the tables module that holds `defineTables(…)(…)`. */
|
|
7
10
|
export declare const TABLES_EXPORT = "tables";
|
|
8
11
|
export declare const GENERATED_ENTRY_FILE = "fabrika/entry.generated.ts";
|
|
12
|
+
/** Where a Cloudflare deploy stages the SPA mounts' built files (`@fabrika/provider-cloudflare`): build output, never source. */
|
|
13
|
+
export declare const STAGED_ASSETS_DIR = "fabrika/assets/";
|
|
9
14
|
export declare const MIGRATIONS_DIR = "db/migrations/";
|
|
10
|
-
/** Where `fabrika db test-scaffold` writes the policy isolation tests, `<table>.policy-isolation.test.ts`. */
|
|
11
|
-
export declare const POLICY_TESTS_DIR = "src/db/__tests__/";
|
|
12
|
-
export declare const POLICY_TEST_SUFFIX = ".policy-isolation.test.ts";
|
|
13
|
-
/** The generated endpoint access tests; they import `src/app.ts`, whose default export they boot. */
|
|
14
|
-
export declare const ENDPOINT_ACCESS_TEST = "src/__tests__/endpoint-access.test.ts";
|
|
15
|
-
/** The inputs the author gives the endpoint access tests where the scaffold cannot sample one; read, never run. */
|
|
16
|
-
export declare const ENDPOINT_FIXTURES_FILE = "src/__tests__/endpoint-access.fixtures.ts";
|
|
17
|
-
export declare const ZEROPS_FILES: readonly ["zerops.yaml", "zerops.yml"];
|
|
18
15
|
/** The application architecture (docs/reference/application-architecture.md): where each layer's code lives. */
|
|
19
16
|
export declare const VOCABULARY_FILE = "src/vocabulary.ts";
|
|
20
17
|
export declare const APP_KIT_FILE = "src/app-kit.ts";
|
|
21
18
|
/** The shared zod schemas the shell and the SPA import: one module, or a directory of them once it grows. */
|
|
22
19
|
export declare const SCHEMAS_FILE = "src/schemas.ts";
|
|
23
20
|
export declare const SCHEMAS_DIR = "src/schemas/";
|
|
24
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* Pure code the SPA and every slice may import: it loads nothing but `zod/v4`, `@fabrika/app/schema` and other modules of
|
|
23
|
+
* its own directory.
|
|
24
|
+
*/
|
|
25
25
|
export declare const SHARED_DIR = "src/shared/";
|
|
26
|
-
/** `src/db/`: the tables
|
|
26
|
+
/** `src/db/`: the tables and the generated schema; never a slice. */
|
|
27
27
|
export declare const DATABASE_DIR = "src/db/";
|
|
28
28
|
/** A slice is a directory `src/<slice>/` that holds these modules, each optional. */
|
|
29
29
|
export declare const SLICE_ENDPOINTS_FILE = "endpoints.ts";
|
|
@@ -32,13 +32,28 @@ export declare const SLICE_QUERIES_FILE = "queries.ts";
|
|
|
32
32
|
export declare const SPA_DIR = "web/";
|
|
33
33
|
/** The server half of an application: its modules run in the application's process. */
|
|
34
34
|
export declare const SERVER_DIR = "src/";
|
|
35
|
+
/**
|
|
36
|
+
* A developer's tools, such as a command line over the contract: code that runs on a developer's machine and never in
|
|
37
|
+
* the application, so the rules for code that runs there do not apply, and no module outside it may load one.
|
|
38
|
+
*/
|
|
39
|
+
export declare const TOOLS_DIR = "tools/";
|
|
35
40
|
/** Build output, installed packages and tool state are not application source and are never read. */
|
|
36
41
|
export declare const isIgnoredSegment: (segment: string) => boolean;
|
|
42
|
+
/** Whether the checker skips `path` (relative to the root): under a skipped segment, or the staged SPA files. */
|
|
43
|
+
export declare const isSkippedPath: (path: string) => boolean;
|
|
37
44
|
export declare const isSourceFile: (path: string) => boolean;
|
|
38
45
|
export declare const isTestFile: (path: string) => boolean;
|
|
39
46
|
/** A module that runs in the application's server process: under `src/`, not a test. */
|
|
40
47
|
export declare const isServerModule: (path: string) => boolean;
|
|
48
|
+
/** A module under `tools/`, tests included. */
|
|
49
|
+
export declare const isToolModule: (path: string) => boolean;
|
|
41
50
|
export declare const isJsonFile: (path: string) => boolean;
|
|
51
|
+
/**
|
|
52
|
+
* A module a generator writes: named `<name>.gen.<ext>` or `<name>.generated.<ext>`, opening with a comment on its first
|
|
53
|
+
* line, before any statement, that says so (`@generated` or `auto-generated`, in any case). The rules about how source
|
|
54
|
+
* is written do not apply to it; every rule about what it does still does.
|
|
55
|
+
*/
|
|
56
|
+
export declare const isGeneratedModule: (path: string, module: Pick<ParsedModule, "program" | "comments">) => boolean;
|
|
42
57
|
/** Whether the checker reads this file at all. */
|
|
43
58
|
export declare const isCheckedFile: (path: string) => boolean;
|
|
44
59
|
/** Joins a relative specifier onto the importing file's directory; `undefined` when it climbs above the root. */
|
package/types/src/limits.d.ts
CHANGED
|
@@ -4,12 +4,22 @@
|
|
|
4
4
|
* step runs.
|
|
5
5
|
*/
|
|
6
6
|
export declare const CONTRACT_LIMITS: {
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* UTF-8 bytes of `fabrika.contract.ts` and every module it imports, together. Control reads them in a Cloudflare
|
|
9
|
+
* Worker, whose isolate has 128 MB; handler bodies are sliced out before the parse, so they cost bytes, not nodes.
|
|
10
|
+
*/
|
|
8
11
|
readonly sourceBytes: number;
|
|
12
|
+
/** UTF-8 bytes of one module: its own parse is the peak while it is read, and a dense one needs up to 340 times it. */
|
|
13
|
+
readonly moduleBytes: number;
|
|
14
|
+
/**
|
|
15
|
+
* Syntax nodes the reader holds over each graph (the contract's, the tables'), top-level type declarations left out.
|
|
16
|
+
* At this, `sourceBytes` and `schemaNodes` together, Control's read needs a 95 MB heap of its 128 MB isolate.
|
|
17
|
+
*/
|
|
18
|
+
readonly astNodes: 400000;
|
|
9
19
|
/** Nesting of syntax nodes in one module; the contracts in this repository reach 25. */
|
|
10
20
|
readonly astDepth: 128;
|
|
11
21
|
/** Schema nodes once every shared schema is expanded where the contract uses it, over the whole contract. */
|
|
12
|
-
readonly schemaNodes:
|
|
22
|
+
readonly schemaNodes: 60000;
|
|
13
23
|
/** Nesting of one schema: objects, arrays, unions and wrappers. */
|
|
14
24
|
readonly schemaDepth: 32;
|
|
15
25
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { MigrationBase } from './rules/migration-history';
|
|
2
|
+
/**
|
|
3
|
+
* The migrations at the merge base of HEAD and `ref` (the remote's default branch when omitted), compared against
|
|
4
|
+
* the merge base so that migrations the default branch added since the branch forked are not read as deleted.
|
|
5
|
+
* `null` when `root` is in no git work tree; `{ skipped }` when it is but the base cannot be read.
|
|
6
|
+
*/
|
|
7
|
+
export declare const readMigrationBase: (root: string, ref?: string) => Promise<MigrationBase | {
|
|
8
|
+
readonly skipped: string;
|
|
9
|
+
} | null>;
|
|
@@ -1,15 +1,18 @@
|
|
|
1
|
+
import { DataSchema } from '@fabrika/app/schema';
|
|
1
2
|
import { z } from 'zod/v4';
|
|
2
3
|
import type { LiteralValue } from './value';
|
|
4
|
+
/** A schema the reader holds: one it read from a chain, or a framework schema (`signedToken()`, `file()`). */
|
|
5
|
+
export type ReadSchema = DataSchema | z.ZodType;
|
|
3
6
|
export type SchemaStep = {
|
|
4
7
|
readonly factory: string;
|
|
5
8
|
readonly iso: boolean;
|
|
6
9
|
} | {
|
|
7
10
|
readonly method: string;
|
|
8
|
-
readonly receiver:
|
|
11
|
+
readonly receiver: ReadSchema | undefined;
|
|
9
12
|
};
|
|
10
13
|
export type BuiltSchema = {
|
|
11
14
|
readonly ok: true;
|
|
12
|
-
readonly schema:
|
|
15
|
+
readonly schema: DataSchema;
|
|
13
16
|
} | {
|
|
14
17
|
readonly ok: false;
|
|
15
18
|
readonly message: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { z } from 'zod/v4';
|
|
2
1
|
import { type AstNode, type ParsedModule } from '../ast';
|
|
3
2
|
import type { Located, ModuleGraph } from '../graph';
|
|
4
3
|
import type { ReaderProblems } from './problems';
|
|
4
|
+
import { type ReadSchema } from './schema';
|
|
5
5
|
/**
|
|
6
6
|
* The builder kit a call belongs to: `c` of `defineContract` and `l` of its link's `procedures`; `app`, the kit
|
|
7
7
|
* `defineApp` returned; `c` of `app.contract` (`shell`) and `r` of a group, a link or an export (`endpoints`).
|
|
@@ -42,7 +42,7 @@ export type LiteralValue = {
|
|
|
42
42
|
/** `nodes` counts the schema with every shared part expanded, as the artifact will hold it; `depth` its nesting. */
|
|
43
43
|
| {
|
|
44
44
|
readonly kind: 'schema';
|
|
45
|
-
readonly schema:
|
|
45
|
+
readonly schema: ReadSchema;
|
|
46
46
|
readonly nodes: number;
|
|
47
47
|
readonly depth: number;
|
|
48
48
|
/** The chain that built it, factory first (`iso` for `z.iso.*`), across a const and the methods applied to it. */
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ContractArtifact } from '@fabrika/auth-core';
|
|
2
|
+
import type { Finding } from '../finding';
|
|
3
|
+
/**
|
|
4
|
+
* What an application on Cloudflare cannot declare (ADR-0065): a file kind that scans, because no scanner runs there; a
|
|
5
|
+
* job longer than one segment, because the object runs it inside an alarm or a request. And a hint for a mutation that
|
|
6
|
+
* declares an outside call: the object runs one transaction at a time, and the mutation holds it while the call waits
|
|
7
|
+
* (backlog 216 item 7).
|
|
8
|
+
*/
|
|
9
|
+
export declare const checkCloudflareContract: (artifact: ContractArtifact) => Finding[];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Finding } from '../finding';
|
|
2
|
+
/**
|
|
3
|
+
* What the reader refuses of `src/db/tables.ts`, and a contract that does not compile against its policies: Control
|
|
4
|
+
* reads the commit with the same calls and refuses the deploy. `readable` is false while the literal, trust or
|
|
5
|
+
* contract rules report the sources, so a refusal is not reported twice.
|
|
6
|
+
*/
|
|
7
|
+
export declare const checkContractCompiles: (files: ReadonlyMap<string, string>, readable: boolean) => Finding[];
|