@gate-forge/core 0.10.4 → 0.11.1
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/dist/classifier/bind.d.ts +2 -2
- package/dist/classifier/bind.d.ts.map +1 -1
- package/dist/classifier/classify.d.ts +2 -2
- package/dist/classifier/classify.d.ts.map +1 -1
- package/dist/classifier/classify.js.map +1 -1
- package/dist/config/index.d.ts +286 -3
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +109 -0
- package/dist/config/index.js.map +1 -1
- package/dist/index.d.ts +51 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +40 -6
- package/dist/index.js.map +1 -1
- package/dist/policy/business-rules.d.ts +143 -0
- package/dist/policy/business-rules.d.ts.map +1 -0
- package/dist/policy/business-rules.js +314 -0
- package/dist/policy/business-rules.js.map +1 -0
- package/dist/policy/evaluate.d.ts +8 -0
- package/dist/policy/evaluate.d.ts.map +1 -1
- package/dist/policy/index.d.ts +1 -0
- package/dist/policy/index.d.ts.map +1 -1
- package/dist/policy/index.js +1 -0
- package/dist/policy/index.js.map +1 -1
- package/dist/schemas/business-rules.d.ts +215 -0
- package/dist/schemas/business-rules.d.ts.map +1 -0
- package/dist/schemas/business-rules.js +227 -0
- package/dist/schemas/business-rules.js.map +1 -0
- package/dist/schemas/classification-policy.d.ts +74 -11
- package/dist/schemas/classification-policy.d.ts.map +1 -1
- package/dist/schemas/classification-policy.js +62 -28
- package/dist/schemas/classification-policy.js.map +1 -1
- package/dist/schemas/scan-config.d.ts +94 -0
- package/dist/schemas/scan-config.d.ts.map +1 -0
- package/dist/schemas/scan-config.js +101 -0
- package/dist/schemas/scan-config.js.map +1 -0
- package/dist/schemas/test-catalog.d.ts +12 -12
- package/dist/schemas/test-map.d.ts +4 -4
- package/dist/schemas/verdict.d.ts +4 -0
- package/dist/schemas/verdict.d.ts.map +1 -1
- package/dist/schemas/verdict.js +13 -0
- package/dist/schemas/verdict.js.map +1 -1
- package/dist/testing/gate-runner.d.ts +2 -2
- package/dist/testing/gate-runner.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Owner-declared BUSINESS RULES (plan 2026-10-05 §4 D1/D2) and the test
|
|
3
|
+
* type table that decides what proof each rule's declared test type
|
|
4
|
+
* requires.
|
|
5
|
+
*
|
|
6
|
+
* Two deliberate separations:
|
|
7
|
+
* - A RULE is a DECLARATION, never an obligation. It has no detector
|
|
8
|
+
* resource, no contract namespace and no verifier; it is graded by a
|
|
9
|
+
* pure evaluator over the run's SEALED facts (see `policy/business-rules.ts`).
|
|
10
|
+
* Nothing here mints an obligation id.
|
|
11
|
+
* - The TYPE TABLE is DATA, one row per supported `test:` value. Proof
|
|
12
|
+
* strength follows the type, and a weaker kind never satisfies a
|
|
13
|
+
* stronger one. Adding a type later is one row plus its honest proof
|
|
14
|
+
* level, never a change to the evaluator.
|
|
15
|
+
*
|
|
16
|
+
* The claim id per case is `business-rule:<ruleId>/<caseId>`, which
|
|
17
|
+
* satisfies the existing `<resourceId>:<contract>` shape so the sidecar
|
|
18
|
+
* schema is unchanged — the sidecar stores it under the SAME `claims`
|
|
19
|
+
* list it already uses for obligations.
|
|
20
|
+
*
|
|
21
|
+
* YAML parsing stays in the CLI (the existing core/CLI split); this
|
|
22
|
+
* module speaks validated plain data only.
|
|
23
|
+
*/
|
|
24
|
+
import { z } from 'zod';
|
|
25
|
+
/** The claim namespace every business-rule case id lives in. */
|
|
26
|
+
export declare const BUSINESS_RULE_NAMESPACE = "business-rule";
|
|
27
|
+
/**
|
|
28
|
+
* The claim id one case is mapped by: `business-rule:<ruleId>/<caseId>`.
|
|
29
|
+
* Deterministic and stable, so a sidecar entry survives a re-order of
|
|
30
|
+
* `cases:` and the evaluator can join bindings to cases by string.
|
|
31
|
+
*/
|
|
32
|
+
export declare function businessRuleClaimId(ruleId: string, caseId: string): string;
|
|
33
|
+
/** Whether one claim id belongs to the business-rule namespace. */
|
|
34
|
+
export declare function isBusinessRuleClaimId(claimId: string): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* The `<ruleId>/<caseId>` pair a business-rule claim id carries, or null
|
|
37
|
+
* when the id is not a business-rule claim or carries no case part.
|
|
38
|
+
*/
|
|
39
|
+
export declare function parseBusinessRuleClaimId(claimId: string): {
|
|
40
|
+
ruleId: string;
|
|
41
|
+
caseId: string;
|
|
42
|
+
} | null;
|
|
43
|
+
/** The test types this release ships. More are one table row each. */
|
|
44
|
+
export declare const BUSINESS_RULE_TEST_TYPES: readonly ["e2e", "pytest"];
|
|
45
|
+
/** Union of the supported rule test types. */
|
|
46
|
+
export type BusinessRuleTestType = (typeof BUSINESS_RULE_TEST_TYPES)[number];
|
|
47
|
+
/** One declared observable consequence of a rule (typically both sides). */
|
|
48
|
+
export declare const BusinessRuleCaseSchema: z.ZodObject<{
|
|
49
|
+
id: z.ZodString;
|
|
50
|
+
describe: z.ZodString;
|
|
51
|
+
}, z.core.$strict>;
|
|
52
|
+
/** Inferred business-rule-case shape. */
|
|
53
|
+
export type BusinessRuleCase = z.infer<typeof BusinessRuleCaseSchema>;
|
|
54
|
+
/**
|
|
55
|
+
* Ranking-only hints for `tests suggest`. They NEVER grade: a hint can
|
|
56
|
+
* promote a candidate, never prove anything, and a rule with no hints
|
|
57
|
+
* behaves exactly like a rule with them.
|
|
58
|
+
*/
|
|
59
|
+
export declare const BusinessRuleHintsSchema: z.ZodObject<{
|
|
60
|
+
routes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
61
|
+
globs: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
62
|
+
}, z.core.$strict>;
|
|
63
|
+
/** Inferred business-rule-hints shape. */
|
|
64
|
+
export type BusinessRuleHints = z.infer<typeof BusinessRuleHintsSchema>;
|
|
65
|
+
/**
|
|
66
|
+
* One owner-declared business rule. Every field is a DECLARATION: it
|
|
67
|
+
* changes the trusted policy digest (the rule lives in the owner-answers
|
|
68
|
+
* document) and therefore can never be self-approved by an agent.
|
|
69
|
+
*/
|
|
70
|
+
export declare const BusinessRuleSchema: z.ZodObject<{
|
|
71
|
+
id: z.ZodString;
|
|
72
|
+
title: z.ZodString;
|
|
73
|
+
describe: z.ZodOptional<z.ZodString>;
|
|
74
|
+
subject: z.ZodOptional<z.ZodString>;
|
|
75
|
+
test: z.ZodDefault<z.ZodEnum<{
|
|
76
|
+
e2e: "e2e";
|
|
77
|
+
pytest: "pytest";
|
|
78
|
+
}>>;
|
|
79
|
+
enforcement: z.ZodDefault<z.ZodEnum<{
|
|
80
|
+
block: "block";
|
|
81
|
+
advisory: "advisory";
|
|
82
|
+
}>>;
|
|
83
|
+
advisoryReason: z.ZodOptional<z.ZodString>;
|
|
84
|
+
cases: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
85
|
+
id: z.ZodString;
|
|
86
|
+
describe: z.ZodString;
|
|
87
|
+
}, z.core.$strict>>>;
|
|
88
|
+
hints: z.ZodOptional<z.ZodObject<{
|
|
89
|
+
routes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
90
|
+
globs: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
91
|
+
}, z.core.$strict>>;
|
|
92
|
+
}, z.core.$strict>;
|
|
93
|
+
/** Inferred business-rule shape. */
|
|
94
|
+
export type BusinessRule = z.infer<typeof BusinessRuleSchema>;
|
|
95
|
+
/**
|
|
96
|
+
* The `rules:` section. Duplicate rule ids are an ambiguity, not a
|
|
97
|
+
* last-one-wins: two rules with one id cannot be graded deterministically.
|
|
98
|
+
*/
|
|
99
|
+
export declare const BusinessRulesSchema: z.ZodArray<z.ZodObject<{
|
|
100
|
+
id: z.ZodString;
|
|
101
|
+
title: z.ZodString;
|
|
102
|
+
describe: z.ZodOptional<z.ZodString>;
|
|
103
|
+
subject: z.ZodOptional<z.ZodString>;
|
|
104
|
+
test: z.ZodDefault<z.ZodEnum<{
|
|
105
|
+
e2e: "e2e";
|
|
106
|
+
pytest: "pytest";
|
|
107
|
+
}>>;
|
|
108
|
+
enforcement: z.ZodDefault<z.ZodEnum<{
|
|
109
|
+
block: "block";
|
|
110
|
+
advisory: "advisory";
|
|
111
|
+
}>>;
|
|
112
|
+
advisoryReason: z.ZodOptional<z.ZodString>;
|
|
113
|
+
cases: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
114
|
+
id: z.ZodString;
|
|
115
|
+
describe: z.ZodString;
|
|
116
|
+
}, z.core.$strict>>>;
|
|
117
|
+
hints: z.ZodOptional<z.ZodObject<{
|
|
118
|
+
routes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
119
|
+
globs: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
120
|
+
}, z.core.$strict>>;
|
|
121
|
+
}, z.core.$strict>>;
|
|
122
|
+
/** Inferred business-rules section shape. */
|
|
123
|
+
export type BusinessRules = z.infer<typeof BusinessRulesSchema>;
|
|
124
|
+
/** The case id a rule without `cases:` uses. */
|
|
125
|
+
export declare const IMPLICIT_CASE_ID = "default";
|
|
126
|
+
/**
|
|
127
|
+
* The rule's cases with the implicit `default` case materialized. Pure:
|
|
128
|
+
* a rule that declares cases returns exactly those, in order.
|
|
129
|
+
*/
|
|
130
|
+
export declare function casesOf(rule: BusinessRule): BusinessRuleCase[];
|
|
131
|
+
/**
|
|
132
|
+
* The owners-answers document's RULE section: `rules:` is optional and
|
|
133
|
+
* an ABSENT section means the feature is off — byte-identical findings,
|
|
134
|
+
* report and digests to a release without it (plan invariant 1).
|
|
135
|
+
*/
|
|
136
|
+
export declare const BusinessRulePolicySchema: z.ZodObject<{
|
|
137
|
+
rules: z.ZodArray<z.ZodObject<{
|
|
138
|
+
id: z.ZodString;
|
|
139
|
+
title: z.ZodString;
|
|
140
|
+
describe: z.ZodOptional<z.ZodString>;
|
|
141
|
+
subject: z.ZodOptional<z.ZodString>;
|
|
142
|
+
test: z.ZodDefault<z.ZodEnum<{
|
|
143
|
+
e2e: "e2e";
|
|
144
|
+
pytest: "pytest";
|
|
145
|
+
}>>;
|
|
146
|
+
enforcement: z.ZodDefault<z.ZodEnum<{
|
|
147
|
+
block: "block";
|
|
148
|
+
advisory: "advisory";
|
|
149
|
+
}>>;
|
|
150
|
+
advisoryReason: z.ZodOptional<z.ZodString>;
|
|
151
|
+
cases: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
152
|
+
id: z.ZodString;
|
|
153
|
+
describe: z.ZodString;
|
|
154
|
+
}, z.core.$strict>>>;
|
|
155
|
+
hints: z.ZodOptional<z.ZodObject<{
|
|
156
|
+
routes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
157
|
+
globs: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
158
|
+
}, z.core.$strict>>;
|
|
159
|
+
}, z.core.$strict>>;
|
|
160
|
+
}, z.core.$strict>;
|
|
161
|
+
/** Inferred business-rule-policy section shape. */
|
|
162
|
+
export type BusinessRulePolicy = z.infer<typeof BusinessRulePolicySchema>;
|
|
163
|
+
/**
|
|
164
|
+
* One row of the TYPE TABLE (plan D2). `acceptedKinds` is closed-world:
|
|
165
|
+
* a binding of any other kind is `wrong-type`, never quietly accepted,
|
|
166
|
+
* and a no-weaker-kind rule means a row never inherits another row's
|
|
167
|
+
* kinds.
|
|
168
|
+
*/
|
|
169
|
+
export interface BusinessRuleTypeRow {
|
|
170
|
+
/** The `test:` value this row answers to. */
|
|
171
|
+
readonly id: BusinessRuleTestType;
|
|
172
|
+
/** Human label used in every message and starter test. */
|
|
173
|
+
readonly label: string;
|
|
174
|
+
/** The runner every accepted test must execute under. */
|
|
175
|
+
readonly runner: string;
|
|
176
|
+
/** Test kinds that may satisfy this type (closed-world). */
|
|
177
|
+
readonly acceptedKinds: readonly string[];
|
|
178
|
+
/** Proof channel per accepted kind, named in the report. */
|
|
179
|
+
readonly kindChannels: Readonly<Record<string, string>>;
|
|
180
|
+
/** The channel named when the row's tests all carry the same one. */
|
|
181
|
+
readonly defaultChannel: string;
|
|
182
|
+
/**
|
|
183
|
+
* True when the proof additionally requires the run's WITNESSED suite
|
|
184
|
+
* for the type's runner (`diagnostics.suites[].witnessed`). A pytest
|
|
185
|
+
* rule without one stays `unproven` — no weaker labelled proof.
|
|
186
|
+
*/
|
|
187
|
+
readonly requiresWitnessedSuite: boolean;
|
|
188
|
+
/** What `next` prints as the starter test for this type. */
|
|
189
|
+
readonly starter: 'playwright' | 'pytest';
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* THE type table: one row per supported `test:` value. Proof strength
|
|
193
|
+
* follows the type, and a weaker kind is never accepted by a stronger
|
|
194
|
+
* row — `e2e` is never satisfied by `api-e2e`, `server-e2e`, `unit`, a
|
|
195
|
+
* mocked spec, or a test that did not run.
|
|
196
|
+
*/
|
|
197
|
+
export declare const BUSINESS_RULE_TYPE_TABLE: Readonly<Record<BusinessRuleTestType, BusinessRuleTypeRow>>;
|
|
198
|
+
/** The type table as a deterministic list (sorted by type id). */
|
|
199
|
+
export declare function businessRuleTypeRows(): BusinessRuleTypeRow[];
|
|
200
|
+
/**
|
|
201
|
+
* The per-case status the evaluator reports. `satisfied` carries the
|
|
202
|
+
* proof channel in its label (`satisfied (observe)`), because "satisfied"
|
|
203
|
+
* read as "the rule holds" is exactly the overclaim invariant 6 forbids.
|
|
204
|
+
*/
|
|
205
|
+
export declare const BUSINESS_RULE_CASE_STATUSES: readonly ["unmapped", "wrong-type", "unproven", "failing", "satisfied"];
|
|
206
|
+
/** Union of the per-case statuses. */
|
|
207
|
+
export type BusinessRuleCaseStatus = (typeof BUSINESS_RULE_CASE_STATUSES)[number];
|
|
208
|
+
/**
|
|
209
|
+
* The `rules:` key as it appears in the owner-answers document, named
|
|
210
|
+
* once so the loader, the migrator and the init template cannot drift.
|
|
211
|
+
*/
|
|
212
|
+
export declare const BUSINESS_RULES_KEY = "rules";
|
|
213
|
+
/** The `schemaVersion` every engine document carries. */
|
|
214
|
+
export declare const BusinessRuleSchemaVersionField: z.ZodLiteral<1>;
|
|
215
|
+
//# sourceMappingURL=business-rules.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"business-rules.d.ts","sourceRoot":"","sources":["../../src/schemas/business-rules.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,gEAAgE;AAChE,eAAO,MAAM,uBAAuB,kBAAkB,CAAC;AAEvD;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAE1E;AAED,mEAAmE;AACnE,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAE9D;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAMnG;AAQD,sEAAsE;AACtE,eAAO,MAAM,wBAAwB,4BAA6B,CAAC;AAEnE,8CAA8C;AAC9C,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE7E,4EAA4E;AAC5E,eAAO,MAAM,sBAAsB;;;kBAOxB,CAAC;AAEZ,yCAAyC;AACzC,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE;;;;GAIG;AACH,eAAO,MAAM,uBAAuB;;;kBAOzB,CAAC;AAEZ,0CAA0C;AAC1C,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAExE;;;;GAIG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;kBAoD3B,CAAC;AAEL,oCAAoC;AACpC,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,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CAqB/F,CAAC;AAEH,kEAAkE;AAClE,wBAAgB,oBAAoB,IAAI,mBAAmB,EAAE,CAE5D;AAED;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,yEAA0E,CAAC;AAEnH,sCAAsC;AACtC,MAAM,MAAM,sBAAsB,GAAG,CAAC,OAAO,2BAA2B,CAAC,CAAC,MAAM,CAAC,CAAC;AAElF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,UAAU,CAAC;AAE1C,yDAAyD;AACzD,eAAO,MAAM,8BAA8B,iBAAqB,CAAC"}
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Owner-declared BUSINESS RULES (plan 2026-10-05 §4 D1/D2) and the test
|
|
3
|
+
* type table that decides what proof each rule's declared test type
|
|
4
|
+
* requires.
|
|
5
|
+
*
|
|
6
|
+
* Two deliberate separations:
|
|
7
|
+
* - A RULE is a DECLARATION, never an obligation. It has no detector
|
|
8
|
+
* resource, no contract namespace and no verifier; it is graded by a
|
|
9
|
+
* pure evaluator over the run's SEALED facts (see `policy/business-rules.ts`).
|
|
10
|
+
* Nothing here mints an obligation id.
|
|
11
|
+
* - The TYPE TABLE is DATA, one row per supported `test:` value. Proof
|
|
12
|
+
* strength follows the type, and a weaker kind never satisfies a
|
|
13
|
+
* stronger one. Adding a type later is one row plus its honest proof
|
|
14
|
+
* level, never a change to the evaluator.
|
|
15
|
+
*
|
|
16
|
+
* The claim id per case is `business-rule:<ruleId>/<caseId>`, which
|
|
17
|
+
* satisfies the existing `<resourceId>:<contract>` shape so the sidecar
|
|
18
|
+
* schema is unchanged — the sidecar stores it under the SAME `claims`
|
|
19
|
+
* list it already uses for obligations.
|
|
20
|
+
*
|
|
21
|
+
* YAML parsing stays in the CLI (the existing core/CLI split); this
|
|
22
|
+
* module speaks validated plain data only.
|
|
23
|
+
*/
|
|
24
|
+
import { z } from 'zod';
|
|
25
|
+
import { SchemaVersionField } from './common.js';
|
|
26
|
+
/** The claim namespace every business-rule case id lives in. */
|
|
27
|
+
export const BUSINESS_RULE_NAMESPACE = 'business-rule';
|
|
28
|
+
/**
|
|
29
|
+
* The claim id one case is mapped by: `business-rule:<ruleId>/<caseId>`.
|
|
30
|
+
* Deterministic and stable, so a sidecar entry survives a re-order of
|
|
31
|
+
* `cases:` and the evaluator can join bindings to cases by string.
|
|
32
|
+
*/
|
|
33
|
+
export function businessRuleClaimId(ruleId, caseId) {
|
|
34
|
+
return `${BUSINESS_RULE_NAMESPACE}:${ruleId}/${caseId}`;
|
|
35
|
+
}
|
|
36
|
+
/** Whether one claim id belongs to the business-rule namespace. */
|
|
37
|
+
export function isBusinessRuleClaimId(claimId) {
|
|
38
|
+
return claimId.startsWith(`${BUSINESS_RULE_NAMESPACE}:`);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* The `<ruleId>/<caseId>` pair a business-rule claim id carries, or null
|
|
42
|
+
* when the id is not a business-rule claim or carries no case part.
|
|
43
|
+
*/
|
|
44
|
+
export function parseBusinessRuleClaimId(claimId) {
|
|
45
|
+
if (!isBusinessRuleClaimId(claimId))
|
|
46
|
+
return null;
|
|
47
|
+
const rest = claimId.slice(`${BUSINESS_RULE_NAMESPACE}:`.length);
|
|
48
|
+
const slash = rest.lastIndexOf('/');
|
|
49
|
+
if (slash <= 0 || slash === rest.length - 1)
|
|
50
|
+
return null;
|
|
51
|
+
return { ruleId: rest.slice(0, slash), caseId: rest.slice(slash + 1) };
|
|
52
|
+
}
|
|
53
|
+
/** Rule ids are stable, filesystem- and URL-safe slugs. */
|
|
54
|
+
const RULE_ID = /^[a-z0-9][a-z0-9._-]*$/;
|
|
55
|
+
/** Case ids follow the same rule inside their rule. */
|
|
56
|
+
const CASE_ID = /^[a-z0-9][a-z0-9._-]*$/;
|
|
57
|
+
/** The test types this release ships. More are one table row each. */
|
|
58
|
+
export const BUSINESS_RULE_TEST_TYPES = ['e2e', 'pytest'];
|
|
59
|
+
/** One declared observable consequence of a rule (typically both sides). */
|
|
60
|
+
export const BusinessRuleCaseSchema = z
|
|
61
|
+
.object({
|
|
62
|
+
/** Case id, unique inside its rule; joined as `<ruleId>/<caseId>`. */
|
|
63
|
+
id: z.string().regex(CASE_ID, 'case id must match [a-z0-9][a-z0-9._-]*'),
|
|
64
|
+
/** What the case says must be observed; required (a case with no words cannot be reviewed). */
|
|
65
|
+
describe: z.string().trim().min(1),
|
|
66
|
+
})
|
|
67
|
+
.strict();
|
|
68
|
+
/**
|
|
69
|
+
* Ranking-only hints for `tests suggest`. They NEVER grade: a hint can
|
|
70
|
+
* promote a candidate, never prove anything, and a rule with no hints
|
|
71
|
+
* behaves exactly like a rule with them.
|
|
72
|
+
*/
|
|
73
|
+
export const BusinessRuleHintsSchema = z
|
|
74
|
+
.object({
|
|
75
|
+
/** URL path globs the proving test is expected to send. */
|
|
76
|
+
routes: z.array(z.string().min(1)).optional(),
|
|
77
|
+
/** Repo-relative file globs the proving test is expected to live in. */
|
|
78
|
+
globs: z.array(z.string().min(1)).optional(),
|
|
79
|
+
})
|
|
80
|
+
.strict();
|
|
81
|
+
/**
|
|
82
|
+
* One owner-declared business rule. Every field is a DECLARATION: it
|
|
83
|
+
* changes the trusted policy digest (the rule lives in the owner-answers
|
|
84
|
+
* document) and therefore can never be self-approved by an agent.
|
|
85
|
+
*/
|
|
86
|
+
export const BusinessRuleSchema = z
|
|
87
|
+
.object({
|
|
88
|
+
/** Stable rule id; unique in the document. */
|
|
89
|
+
id: z.string().regex(RULE_ID, 'rule id must match [a-z0-9][a-z0-9._-]*'),
|
|
90
|
+
/** The rule in the owner's own words (required: a rule with no title cannot be reviewed). */
|
|
91
|
+
title: z.string().trim().min(1),
|
|
92
|
+
/** Optional longer prose; the title stays the one-line statement. */
|
|
93
|
+
describe: z.string().trim().min(1).optional(),
|
|
94
|
+
/** Optional resource name; validated against the run's inventory (never proof). */
|
|
95
|
+
subject: z.string().trim().min(1).optional(),
|
|
96
|
+
/** Which kind of test must prove it. `e2e` is the default. */
|
|
97
|
+
test: z.enum(BUSINESS_RULE_TEST_TYPES).default('e2e'),
|
|
98
|
+
/** `block` (default) or `advisory`; advisory findings never reach the exit code. */
|
|
99
|
+
enforcement: z.enum(['block', 'advisory']).default('block'),
|
|
100
|
+
/** REQUIRED iff `enforcement: advisory` — an advisory with no reason hides itself. */
|
|
101
|
+
advisoryReason: z.string().trim().min(1).optional(),
|
|
102
|
+
/** Observable cases; absent means the single implicit case `default`. */
|
|
103
|
+
cases: z.array(BusinessRuleCaseSchema).min(1).optional(),
|
|
104
|
+
/** Ranking-only hints for `tests suggest`. */
|
|
105
|
+
hints: BusinessRuleHintsSchema.optional(),
|
|
106
|
+
})
|
|
107
|
+
.strict()
|
|
108
|
+
.superRefine((rule, ctx) => {
|
|
109
|
+
if (rule.enforcement === 'advisory' && rule.advisoryReason === undefined) {
|
|
110
|
+
ctx.addIssue({
|
|
111
|
+
code: 'custom',
|
|
112
|
+
path: ['advisoryReason'],
|
|
113
|
+
message: "rule '" + rule.id + "' is advisory but declares no advisoryReason: an advisory rule must say why it does not block",
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
if (rule.enforcement === 'block' && rule.advisoryReason !== undefined) {
|
|
117
|
+
ctx.addIssue({
|
|
118
|
+
code: 'custom',
|
|
119
|
+
path: ['advisoryReason'],
|
|
120
|
+
message: "rule '" + rule.id + "' blocks but declares advisoryReason: the reason belongs on an advisory rule only",
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
const seen = new Set();
|
|
124
|
+
for (let index = 0; index < (rule.cases ?? []).length; index += 1) {
|
|
125
|
+
const id = rule.cases?.[index]?.id;
|
|
126
|
+
if (id === undefined)
|
|
127
|
+
continue;
|
|
128
|
+
if (seen.has(id)) {
|
|
129
|
+
ctx.addIssue({
|
|
130
|
+
code: 'custom',
|
|
131
|
+
path: ['cases', index, 'id'],
|
|
132
|
+
message: `duplicate case id '${id}' in rule '${rule.id}'`,
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
seen.add(id);
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
/**
|
|
139
|
+
* The `rules:` section. Duplicate rule ids are an ambiguity, not a
|
|
140
|
+
* last-one-wins: two rules with one id cannot be graded deterministically.
|
|
141
|
+
*/
|
|
142
|
+
export const BusinessRulesSchema = z
|
|
143
|
+
.array(BusinessRuleSchema)
|
|
144
|
+
.superRefine((rules, ctx) => {
|
|
145
|
+
const seen = new Set();
|
|
146
|
+
for (let index = 0; index < rules.length; index += 1) {
|
|
147
|
+
const id = rules[index]?.id;
|
|
148
|
+
if (id === undefined)
|
|
149
|
+
continue;
|
|
150
|
+
if (seen.has(id)) {
|
|
151
|
+
ctx.addIssue({
|
|
152
|
+
code: 'custom',
|
|
153
|
+
path: [index, 'id'],
|
|
154
|
+
message: `duplicate business rule id '${id}' — every rule must be separately addressable`,
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
seen.add(id);
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
/** The case id a rule without `cases:` uses. */
|
|
161
|
+
export const IMPLICIT_CASE_ID = 'default';
|
|
162
|
+
/**
|
|
163
|
+
* The rule's cases with the implicit `default` case materialized. Pure:
|
|
164
|
+
* a rule that declares cases returns exactly those, in order.
|
|
165
|
+
*/
|
|
166
|
+
export function casesOf(rule) {
|
|
167
|
+
if (rule.cases !== undefined && rule.cases.length > 0)
|
|
168
|
+
return [...rule.cases];
|
|
169
|
+
return [{ id: IMPLICIT_CASE_ID, describe: rule.title }];
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* The owners-answers document's RULE section: `rules:` is optional and
|
|
173
|
+
* an ABSENT section means the feature is off — byte-identical findings,
|
|
174
|
+
* report and digests to a release without it (plan invariant 1).
|
|
175
|
+
*/
|
|
176
|
+
export const BusinessRulePolicySchema = z
|
|
177
|
+
.object({
|
|
178
|
+
/** Owner-declared business rules. */
|
|
179
|
+
rules: z.array(BusinessRuleSchema),
|
|
180
|
+
})
|
|
181
|
+
.strict();
|
|
182
|
+
/**
|
|
183
|
+
* THE type table: one row per supported `test:` value. Proof strength
|
|
184
|
+
* follows the type, and a weaker kind is never accepted by a stronger
|
|
185
|
+
* row — `e2e` is never satisfied by `api-e2e`, `server-e2e`, `unit`, a
|
|
186
|
+
* mocked spec, or a test that did not run.
|
|
187
|
+
*/
|
|
188
|
+
export const BUSINESS_RULE_TYPE_TABLE = Object.freeze({
|
|
189
|
+
e2e: Object.freeze({
|
|
190
|
+
id: 'e2e',
|
|
191
|
+
label: 'e2e',
|
|
192
|
+
runner: 'playwright',
|
|
193
|
+
acceptedKinds: Object.freeze(['browser-e2e', 'observed-e2e']),
|
|
194
|
+
kindChannels: Object.freeze({ 'browser-e2e': 'engine', 'observed-e2e': 'observe' }),
|
|
195
|
+
defaultChannel: 'observe',
|
|
196
|
+
requiresWitnessedSuite: false,
|
|
197
|
+
starter: 'playwright',
|
|
198
|
+
}),
|
|
199
|
+
pytest: Object.freeze({
|
|
200
|
+
id: 'pytest',
|
|
201
|
+
label: 'pytest',
|
|
202
|
+
runner: 'pytest',
|
|
203
|
+
acceptedKinds: Object.freeze(['unit', 'integration', 'server-e2e']),
|
|
204
|
+
kindChannels: Object.freeze({ unit: 'execution', integration: 'execution', 'server-e2e': 'execution' }),
|
|
205
|
+
defaultChannel: 'execution',
|
|
206
|
+
requiresWitnessedSuite: true,
|
|
207
|
+
starter: 'pytest',
|
|
208
|
+
}),
|
|
209
|
+
});
|
|
210
|
+
/** The type table as a deterministic list (sorted by type id). */
|
|
211
|
+
export function businessRuleTypeRows() {
|
|
212
|
+
return [...BUSINESS_RULE_TEST_TYPES].sort().map((id) => BUSINESS_RULE_TYPE_TABLE[id]);
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* The per-case status the evaluator reports. `satisfied` carries the
|
|
216
|
+
* proof channel in its label (`satisfied (observe)`), because "satisfied"
|
|
217
|
+
* read as "the rule holds" is exactly the overclaim invariant 6 forbids.
|
|
218
|
+
*/
|
|
219
|
+
export const BUSINESS_RULE_CASE_STATUSES = ['unmapped', 'wrong-type', 'unproven', 'failing', 'satisfied'];
|
|
220
|
+
/**
|
|
221
|
+
* The `rules:` key as it appears in the owner-answers document, named
|
|
222
|
+
* once so the loader, the migrator and the init template cannot drift.
|
|
223
|
+
*/
|
|
224
|
+
export const BUSINESS_RULES_KEY = 'rules';
|
|
225
|
+
/** The `schemaVersion` every engine document carries. */
|
|
226
|
+
export const BusinessRuleSchemaVersionField = SchemaVersionField;
|
|
227
|
+
//# sourceMappingURL=business-rules.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"business-rules.js","sourceRoot":"","sources":["../../src/schemas/business-rules.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD,gEAAgE;AAChE,MAAM,CAAC,MAAM,uBAAuB,GAAG,eAAe,CAAC;AAEvD;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,MAAc,EAAE,MAAc;IAChE,OAAO,GAAG,uBAAuB,IAAI,MAAM,IAAI,MAAM,EAAE,CAAC;AAC1D,CAAC;AAED,mEAAmE;AACnE,MAAM,UAAU,qBAAqB,CAAC,OAAe;IACnD,OAAO,OAAO,CAAC,UAAU,CAAC,GAAG,uBAAuB,GAAG,CAAC,CAAC;AAC3D,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,wBAAwB,CAAC,OAAe;IACtD,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC;QAAE,OAAO,IAAI,CAAC;IACjD,MAAM,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,uBAAuB,GAAG,CAAC,MAAM,CAAC,CAAC;IACjE,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IACpC,IAAI,KAAK,IAAI,CAAC,IA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AAC"}
|
|
@@ -124,13 +124,55 @@ export declare const CoverageRuleSchema: z.ZodObject<{
|
|
|
124
124
|
/** Inferred coverage-rule shape. */
|
|
125
125
|
export type CoverageRule = z.infer<typeof CoverageRuleSchema>;
|
|
126
126
|
/**
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
* the
|
|
127
|
+
* One owner-declared PLANE rule list — the `planes:` section of the
|
|
128
|
+
* answers document (0.11.0, was `.gateforge/planes.json`). The section
|
|
129
|
+
* keeps the document shape it always had (`{ rules: [...] }`) so
|
|
130
|
+
* `gateforge migrate` is a pure text move, but the RULES themselves stay
|
|
131
|
+
* validated by the pack that applies them (one validation source, the
|
|
132
|
+
* same fail-closed reader that has always guarded them): this schema
|
|
133
|
+
* rejects a wrong document SHAPE and the owning reader rejects a wrong
|
|
134
|
+
* rule. Absent = no plane channel, byte-identical to today.
|
|
135
|
+
*/
|
|
136
|
+
export declare const PlanesSectionSchema: z.ZodObject<{
|
|
137
|
+
rules: z.ZodArray<z.ZodUnknown>;
|
|
138
|
+
}, z.core.$strict>;
|
|
139
|
+
/** Inferred `planes:` section shape. */
|
|
140
|
+
export type PlanesSection = z.infer<typeof PlanesSectionSchema>;
|
|
141
|
+
/**
|
|
142
|
+
* One owner-declared ENDPOINT-CAPABILITY rule list — the `endpoints:`
|
|
143
|
+
* section of the answers document (0.11.0, was `.gateforge/endpoints.json`).
|
|
144
|
+
* Same posture as {@link PlanesSectionSchema}: shape here, rules validated
|
|
145
|
+
* by the endpoint compiler that applies them.
|
|
146
|
+
*/
|
|
147
|
+
export declare const EndpointsSectionSchema: z.ZodObject<{
|
|
148
|
+
rules: z.ZodArray<z.ZodUnknown>;
|
|
149
|
+
}, z.core.$strict>;
|
|
150
|
+
/** Inferred `endpoints:` section shape. */
|
|
151
|
+
export type EndpointsSection = z.infer<typeof EndpointsSectionSchema>;
|
|
152
|
+
/**
|
|
153
|
+
* Repo-root-relative location of the ONE owner-answers document. Named
|
|
154
|
+
* once, in the package that owns the document, so every diagnostic that
|
|
155
|
+
* has to point the owner at a declaration — the refusals, the migrator,
|
|
156
|
+
* the packs — names the same path.
|
|
157
|
+
*/
|
|
158
|
+
export declare const OWNER_ANSWERS_PATH = ".gateforge/classification-policy.yml";
|
|
159
|
+
/**
|
|
160
|
+
* The classification-policy document: the ONE owner-answers file
|
|
161
|
+
* (`.gateforge/classification-policy.yml`, name kept by owner decision).
|
|
162
|
+
* Since 0.11.0 it holds every owner answer — trusted internal
|
|
163
|
+
* entry-point categories, organization internal rules, exact lifecycle
|
|
164
|
+
* disables, delete semantics, plane rules, endpoint capabilities, and
|
|
165
|
+
* the owner's business `rules:`.
|
|
166
|
+
*
|
|
167
|
+
* The SCANNER settings (`scanRoots`, `coverage`, `declarations`,
|
|
168
|
+
* `volatileFields`) MOVED OUT to `.gateforge.yml` under `scan:`, next to
|
|
169
|
+
* the other machine-wide declarations. They are no longer accepted here:
|
|
170
|
+
* a repository still carrying them fails closed naming `gateforge
|
|
171
|
+
* migrate` rather than silently running on a setting the engine cannot
|
|
172
|
+
* see.
|
|
130
173
|
*/
|
|
131
174
|
export declare const ClassificationPolicySchema: z.ZodObject<{
|
|
132
175
|
schemaVersion: z.ZodLiteral<1>;
|
|
133
|
-
scanRoots: z.ZodArray<z.ZodString>;
|
|
134
176
|
trustedInternalEntryPoints: z.ZodArray<z.ZodObject<{
|
|
135
177
|
category: z.ZodString;
|
|
136
178
|
patterns: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
@@ -164,14 +206,35 @@ export declare const ClassificationPolicySchema: z.ZodObject<{
|
|
|
164
206
|
archiveFields: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
165
207
|
reason: z.ZodString;
|
|
166
208
|
}, z.core.$strict>>>;
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
209
|
+
planes: z.ZodOptional<z.ZodObject<{
|
|
210
|
+
rules: z.ZodArray<z.ZodUnknown>;
|
|
211
|
+
}, z.core.$strict>>;
|
|
212
|
+
endpoints: z.ZodOptional<z.ZodObject<{
|
|
213
|
+
rules: z.ZodArray<z.ZodUnknown>;
|
|
214
|
+
}, z.core.$strict>>;
|
|
215
|
+
rules: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
216
|
+
id: z.ZodString;
|
|
217
|
+
title: z.ZodString;
|
|
218
|
+
describe: z.ZodOptional<z.ZodString>;
|
|
219
|
+
subject: z.ZodOptional<z.ZodString>;
|
|
220
|
+
test: z.ZodDefault<z.ZodEnum<{
|
|
221
|
+
e2e: "e2e";
|
|
222
|
+
pytest: "pytest";
|
|
223
|
+
}>>;
|
|
224
|
+
enforcement: z.ZodDefault<z.ZodEnum<{
|
|
225
|
+
block: "block";
|
|
226
|
+
advisory: "advisory";
|
|
227
|
+
}>>;
|
|
228
|
+
advisoryReason: z.ZodOptional<z.ZodString>;
|
|
229
|
+
cases: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
230
|
+
id: z.ZodString;
|
|
231
|
+
describe: z.ZodString;
|
|
232
|
+
}, z.core.$strict>>>;
|
|
233
|
+
hints: z.ZodOptional<z.ZodObject<{
|
|
234
|
+
routes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
235
|
+
globs: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
236
|
+
}, z.core.$strict>>;
|
|
172
237
|
}, z.core.$strict>>>;
|
|
173
|
-
declarations: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
174
|
-
volatileFields: z.ZodArray<z.ZodString>;
|
|
175
238
|
}, z.core.$strict>;
|
|
176
239
|
/** Inferred classification-policy shape. */
|
|
177
240
|
export type ClassificationPolicy = z.infer<typeof ClassificationPolicySchema>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"classification-policy.d.ts","sourceRoot":"","sources":["../../src/schemas/classification-policy.ts"],"names":[],"mappings":"AAAA;;;;;;;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