@lovrozagar/oat 0.10.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -2006
- package/dist/cli.js +283 -59
- package/dist/config/define-config.d.ts +8 -0
- package/dist/config/define-config.d.ts.map +1 -1
- package/dist/config/define-config.js.map +1 -1
- package/dist/config/validate.d.ts +12 -0
- package/dist/config/validate.d.ts.map +1 -0
- package/dist/config/validate.js +86 -0
- package/dist/config/validate.js.map +1 -0
- package/dist/conformance/effects.d.ts +9 -0
- package/dist/conformance/effects.d.ts.map +1 -0
- package/dist/conformance/effects.js +276 -0
- package/dist/conformance/effects.js.map +1 -0
- package/dist/conformance/expected-failures.d.ts +18 -0
- package/dist/conformance/expected-failures.d.ts.map +1 -0
- package/dist/conformance/expected-failures.js +48 -0
- package/dist/conformance/expected-failures.js.map +1 -0
- package/dist/conformance/feature-gate.d.ts +7 -0
- package/dist/conformance/feature-gate.d.ts.map +1 -0
- package/dist/conformance/feature-gate.js +428 -0
- package/dist/conformance/feature-gate.js.map +1 -0
- package/dist/conformance/fuzz.d.ts +108 -0
- package/dist/conformance/fuzz.d.ts.map +1 -0
- package/dist/conformance/fuzz.js +246 -0
- package/dist/conformance/fuzz.js.map +1 -0
- package/dist/conformance/leaks.d.ts +10 -0
- package/dist/conformance/leaks.d.ts.map +1 -0
- package/dist/conformance/leaks.js +23 -0
- package/dist/conformance/leaks.js.map +1 -0
- package/dist/conformance/pool.d.ts +49 -0
- package/dist/conformance/pool.d.ts.map +1 -0
- package/dist/conformance/pool.js +75 -0
- package/dist/conformance/pool.js.map +1 -0
- package/dist/conformance/rate-limit.d.ts +7 -0
- package/dist/conformance/rate-limit.d.ts.map +1 -0
- package/dist/conformance/rate-limit.js +372 -0
- package/dist/conformance/rate-limit.js.map +1 -0
- package/dist/conformance/scope.d.ts +15 -0
- package/dist/conformance/scope.d.ts.map +1 -0
- package/dist/conformance/scope.js +78 -0
- package/dist/conformance/scope.js.map +1 -0
- package/dist/conformance/seed-contract.d.ts +11 -0
- package/dist/conformance/seed-contract.d.ts.map +1 -0
- package/dist/conformance/seed-contract.js +680 -0
- package/dist/conformance/seed-contract.js.map +1 -0
- package/dist/conformance/shapes.d.ts +35 -0
- package/dist/conformance/shapes.d.ts.map +1 -0
- package/dist/conformance/shapes.js +162 -0
- package/dist/conformance/shapes.js.map +1 -0
- package/dist/conformance/specs.d.ts +21 -0
- package/dist/conformance/specs.d.ts.map +1 -0
- package/dist/conformance/specs.js +306 -0
- package/dist/conformance/specs.js.map +1 -0
- package/dist/conformance/suite.d.ts +209 -0
- package/dist/conformance/suite.d.ts.map +1 -0
- package/dist/conformance/suite.js +1538 -0
- package/dist/conformance/suite.js.map +1 -0
- package/dist/conformance/unique.d.ts +7 -0
- package/dist/conformance/unique.d.ts.map +1 -0
- package/dist/conformance/unique.js +586 -0
- package/dist/conformance/unique.js.map +1 -0
- package/dist/conformance/worker.d.ts +3 -0
- package/dist/conformance/worker.d.ts.map +1 -0
- package/dist/conformance/worker.js +27 -0
- package/dist/conformance/worker.js.map +1 -0
- package/dist/index.d.ts +8 -3
- package/dist/index.js +5 -2
- package/dist/reference/defects.d.ts +71 -1
- package/dist/reference/defects.d.ts.map +1 -1
- package/dist/reference/defects.js +74 -8
- package/dist/reference/defects.js.map +1 -1
- package/dist/reference/dialect.d.ts +6 -4
- package/dist/reference/dialect.d.ts.map +1 -1
- package/dist/reference/dialect.js +1 -0
- package/dist/reference/dialect.js.map +1 -1
- package/dist/reference/http.d.ts +17 -25
- package/dist/reference/http.d.ts.map +1 -1
- package/dist/reference/http.js +574 -224
- package/dist/reference/http.js.map +1 -1
- package/dist/reference/listing.d.ts +51 -0
- package/dist/reference/listing.d.ts.map +1 -0
- package/dist/reference/listing.js +256 -0
- package/dist/reference/listing.js.map +1 -0
- package/dist/reference/model.d.ts +35 -1
- package/dist/reference/model.d.ts.map +1 -1
- package/dist/reference/model.js +42 -0
- package/dist/reference/model.js.map +1 -1
- package/dist/reference/query.d.ts +132 -43
- package/dist/reference/query.d.ts.map +1 -1
- package/dist/reference/query.js +397 -315
- package/dist/reference/query.js.map +1 -1
- package/dist/reference/shapes.d.ts +60 -0
- package/dist/reference/shapes.d.ts.map +1 -0
- package/dist/reference/shapes.js +142 -0
- package/dist/reference/shapes.js.map +1 -0
- package/dist/reference/spec.d.ts +9 -2
- package/dist/reference/spec.d.ts.map +1 -1
- package/dist/reference/spec.js +291 -71
- package/dist/reference/spec.js.map +1 -1
- package/dist/reference/store-api.d.ts +14 -43
- package/dist/reference/store-api.d.ts.map +1 -1
- package/dist/reference/store-api.js +8 -58
- package/dist/reference/store-api.js.map +1 -1
- package/dist/reference/stores/memory.d.ts +12 -15
- package/dist/reference/stores/memory.d.ts.map +1 -1
- package/dist/reference/stores/memory.js +22 -70
- package/dist/reference/stores/memory.js.map +1 -1
- package/dist/reference/stores/postgres.d.ts +11 -23
- package/dist/reference/stores/postgres.d.ts.map +1 -1
- package/dist/reference/stores/postgres.js +53 -334
- package/dist/reference/stores/postgres.js.map +1 -1
- package/dist/reference/stores/sql-compile.d.ts +36 -0
- package/dist/reference/stores/sql-compile.d.ts.map +1 -0
- package/dist/reference/stores/sql-compile.js +95 -0
- package/dist/reference/stores/sql-compile.js.map +1 -0
- package/dist/reference/stores/sqlite.d.ts +12 -27
- package/dist/reference/stores/sqlite.d.ts.map +1 -1
- package/dist/reference/stores/sqlite.js +54 -355
- package/dist/reference/stores/sqlite.js.map +1 -1
- package/dist/report/console.d.ts.map +1 -1
- package/dist/report/console.js +23 -9
- package/dist/report/console.js.map +1 -1
- package/dist/report/matrix.d.ts +2 -0
- package/dist/report/matrix.d.ts.map +1 -1
- package/dist/report/matrix.js +63 -10
- package/dist/report/matrix.js.map +1 -1
- package/dist/report/render.d.ts +10 -1
- package/dist/report/render.d.ts.map +1 -1
- package/dist/report/render.js +75 -13
- package/dist/report/render.js.map +1 -1
- package/dist/runtime/async.d.ts +16 -3
- package/dist/runtime/async.d.ts.map +1 -1
- package/dist/runtime/async.js +24 -19
- package/dist/runtime/async.js.map +1 -1
- package/dist/runtime/auth.d.ts +8 -9
- package/dist/runtime/auth.d.ts.map +1 -1
- package/dist/runtime/auth.js +60 -62
- package/dist/runtime/auth.js.map +1 -1
- package/dist/runtime/body.d.ts +15 -3
- package/dist/runtime/body.d.ts.map +1 -1
- package/dist/runtime/body.js +61 -12
- package/dist/runtime/body.js.map +1 -1
- package/dist/runtime/check-costs.d.ts +15 -0
- package/dist/runtime/check-costs.d.ts.map +1 -0
- package/dist/runtime/check-costs.js +114 -0
- package/dist/runtime/check-costs.js.map +1 -0
- package/dist/runtime/check-ids.d.ts +15 -0
- package/dist/runtime/check-ids.d.ts.map +1 -0
- package/dist/runtime/check-ids.js +140 -0
- package/dist/runtime/check-ids.js.map +1 -0
- package/dist/runtime/checks.d.ts +88 -20
- package/dist/runtime/checks.d.ts.map +1 -1
- package/dist/runtime/checks.js +3288 -1947
- package/dist/runtime/checks.js.map +1 -1
- package/dist/runtime/client.d.ts +112 -0
- package/dist/runtime/client.d.ts.map +1 -1
- package/dist/runtime/client.js +271 -39
- package/dist/runtime/client.js.map +1 -1
- package/dist/runtime/cookies.d.ts +16 -2
- package/dist/runtime/cookies.d.ts.map +1 -1
- package/dist/runtime/cookies.js +83 -22
- package/dist/runtime/cookies.js.map +1 -1
- package/dist/runtime/exchanges.d.ts +4 -5
- package/dist/runtime/exchanges.d.ts.map +1 -1
- package/dist/runtime/exchanges.js +33 -55
- package/dist/runtime/exchanges.js.map +1 -1
- package/dist/runtime/exit.d.ts +40 -0
- package/dist/runtime/exit.d.ts.map +1 -0
- package/dist/runtime/exit.js +48 -0
- package/dist/runtime/exit.js.map +1 -0
- package/dist/runtime/feature-gate.d.ts +0 -9
- package/dist/runtime/feature-gate.d.ts.map +1 -1
- package/dist/runtime/feature-gate.js +0 -21
- package/dist/runtime/feature-gate.js.map +1 -1
- package/dist/runtime/finding.d.ts +49 -8
- package/dist/runtime/finding.d.ts.map +1 -1
- package/dist/runtime/finding.js +51 -8
- package/dist/runtime/finding.js.map +1 -1
- package/dist/runtime/fixture.d.ts +35 -28
- package/dist/runtime/fixture.d.ts.map +1 -1
- package/dist/runtime/fixture.js +92 -731
- package/dist/runtime/fixture.js.map +1 -1
- package/dist/runtime/generate.d.ts +63 -0
- package/dist/runtime/generate.d.ts.map +1 -0
- package/dist/runtime/generate.js +635 -0
- package/dist/runtime/generate.js.map +1 -0
- package/dist/runtime/headers.d.ts +6 -0
- package/dist/runtime/headers.d.ts.map +1 -0
- package/dist/runtime/headers.js +16 -0
- package/dist/runtime/headers.js.map +1 -0
- package/dist/runtime/path.d.ts +7 -0
- package/dist/runtime/path.d.ts.map +1 -0
- package/dist/runtime/path.js +44 -0
- package/dist/runtime/path.js.map +1 -0
- package/dist/runtime/payloads.d.ts +2 -0
- package/dist/runtime/payloads.d.ts.map +1 -1
- package/dist/runtime/payloads.js +2 -1
- package/dist/runtime/payloads.js.map +1 -1
- package/dist/runtime/rate-limit.d.ts +6 -4
- package/dist/runtime/rate-limit.d.ts.map +1 -1
- package/dist/runtime/rate-limit.js +22 -33
- package/dist/runtime/rate-limit.js.map +1 -1
- package/dist/runtime/redact.d.ts +24 -0
- package/dist/runtime/redact.d.ts.map +1 -0
- package/dist/runtime/redact.js +98 -0
- package/dist/runtime/redact.js.map +1 -0
- package/dist/runtime/run.d.ts +34 -2
- package/dist/runtime/run.d.ts.map +1 -1
- package/dist/runtime/run.js +374 -138
- package/dist/runtime/run.js.map +1 -1
- package/dist/runtime/runs.d.ts +5 -0
- package/dist/runtime/runs.d.ts.map +1 -1
- package/dist/runtime/runs.js +7 -1
- package/dist/runtime/runs.js.map +1 -1
- package/dist/runtime/teardown.d.ts +17 -4
- package/dist/runtime/teardown.d.ts.map +1 -1
- package/dist/runtime/teardown.js +49 -16
- package/dist/runtime/teardown.js.map +1 -1
- package/dist/runtime/transcript.d.ts +34 -2
- package/dist/runtime/transcript.d.ts.map +1 -1
- package/dist/runtime/transcript.js +119 -24
- package/dist/runtime/transcript.js.map +1 -1
- package/dist/runtime/unique.d.ts +2 -11
- package/dist/runtime/unique.d.ts.map +1 -1
- package/dist/runtime/unique.js +27 -53
- package/dist/runtime/unique.js.map +1 -1
- package/dist/runtime/validate.d.ts +13 -2
- package/dist/runtime/validate.d.ts.map +1 -1
- package/dist/runtime/validate.js +51 -31
- package/dist/runtime/validate.js.map +1 -1
- package/dist/runtime/wait.d.ts +2 -1
- package/dist/runtime/wait.d.ts.map +1 -1
- package/dist/runtime/wait.js +2 -36
- package/dist/runtime/wait.js.map +1 -1
- package/dist/runtime/world.d.ts +24 -1
- package/dist/runtime/world.d.ts.map +1 -1
- package/dist/runtime/world.js +101 -26
- package/dist/runtime/world.js.map +1 -1
- package/dist/spec/collection.d.ts +8 -2
- package/dist/spec/collection.d.ts.map +1 -1
- package/dist/spec/collection.js +47 -7
- package/dist/spec/collection.js.map +1 -1
- package/dist/spec/extensions.d.ts +11 -1
- package/dist/spec/extensions.d.ts.map +1 -1
- package/dist/spec/extensions.js +10 -2
- package/dist/spec/extensions.js.map +1 -1
- package/dist/spec/graph.d.ts +46 -0
- package/dist/spec/graph.d.ts.map +1 -1
- package/dist/spec/graph.js +175 -11
- package/dist/spec/graph.js.map +1 -1
- package/dist/spec/load.d.ts +25 -5
- package/dist/spec/load.d.ts.map +1 -1
- package/dist/spec/load.js +160 -59
- package/dist/spec/load.js.map +1 -1
- package/dist/spec/query-capabilities.d.ts +4 -0
- package/dist/spec/query-capabilities.d.ts.map +1 -1
- package/dist/spec/query-capabilities.js +6 -0
- package/dist/spec/query-capabilities.js.map +1 -1
- package/dist/spec/schema.d.ts +20 -0
- package/dist/spec/schema.d.ts.map +1 -0
- package/dist/spec/schema.js +118 -0
- package/dist/spec/schema.js.map +1 -0
- package/dist/spec/tag-schema.d.ts +12 -0
- package/dist/spec/tag-schema.d.ts.map +1 -0
- package/dist/spec/tag-schema.js +144 -0
- package/dist/spec/tag-schema.js.map +1 -0
- package/dist/spec/types.js +17 -1
- package/dist/spec/types.js.map +1 -1
- package/docs/api.md +59 -0
- package/docs/assumptions.md +99 -0
- package/docs/checks.md +183 -0
- package/docs/commands.md +214 -0
- package/docs/configuration.md +650 -0
- package/docs/model.md +184 -0
- package/docs/reference-defects.md +94 -0
- package/docs/reports.md +211 -0
- package/docs/tags.md +403 -0
- package/package.json +3 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feature-gate.d.ts","sourceRoot":"","sources":["../../src/runtime/feature-gate.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"feature-gate.d.ts","sourceRoot":"","sources":["../../src/runtime/feature-gate.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAEtD,8FAA8F;AAC9F,eAAO,MAAM,mBAAmB,MAAM,CAAA;AAEtC,wBAAgB,6BAA6B,CAC5C,EAAE,EAAE,IAAI,CAAC,cAAc,EAAE,aAAa,CAAC,EACvC,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,OAAO,GACX,OAAO,CAYT;AAED,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,IAAI,CAAC,cAAc,EAAE,aAAa,CAAC,EAAE,IAAI,EAAE,OAAO,GAAG,MAAM,CAQlG;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAK7E"}
|
|
@@ -44,25 +44,4 @@ export function featureGateVars(body) {
|
|
|
44
44
|
return null;
|
|
45
45
|
return vars;
|
|
46
46
|
}
|
|
47
|
-
/**
|
|
48
|
-
* A gate 403 still has to match the documented error schema. Coverage is "this 403 is
|
|
49
|
-
* expected"; it is not a free pass for an undeclared body.
|
|
50
|
-
*/
|
|
51
|
-
export function reportFeatureGateSchemaDrift(findings, validator, op, raw, exchange, entity) {
|
|
52
|
-
if (raw === undefined)
|
|
53
|
-
return;
|
|
54
|
-
if (!validator.documents(raw, exchange.status))
|
|
55
|
-
return;
|
|
56
|
-
const result = validator.validate(op.operationId, raw, exchange.status, exchange.responseBody);
|
|
57
|
-
if (result.ok)
|
|
58
|
-
return;
|
|
59
|
-
if (findings.findings.some((finding) => finding.check === "schema.error-response-matches-document" &&
|
|
60
|
-
finding.entity === entity &&
|
|
61
|
-
finding.evidence.some((prior) => prior.seq === exchange.seq))) {
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
findings.spec("schema.error-response-matches-document", entity, `${exchange.status} error body does not match its documented schema`, `${op.operationId} returned ${exchange.status} with a body that fails the schema the ` +
|
|
65
|
-
`document declares for it: ${result.errors.join("; ")}. Clients that parse errors ` +
|
|
66
|
-
"from the spec will not understand this response.", [exchange]);
|
|
67
|
-
}
|
|
68
47
|
//# sourceMappingURL=feature-gate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feature-gate.js","sourceRoot":"","sources":["../../src/runtime/feature-gate.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"feature-gate.js","sourceRoot":"","sources":["../../src/runtime/feature-gate.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,8FAA8F;AAC9F,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,CAAA;AAEtC,MAAM,UAAU,6BAA6B,CAC5C,EAAuC,EACvC,MAAc,EACd,IAAa;IAEb,IAAI,EAAE,CAAC,WAAW,KAAK,IAAI;QAAE,OAAO,KAAK,CAAA;IACzC,IAAI,MAAM,KAAK,mBAAmB;QAAE,OAAO,KAAK,CAAA;IAChD,IAAI,IAAI,KAAK,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAA;IAC3D,MAAM,IAAI,GAAI,IAAgC,CAAC,IAAI,CAAA;IACnD,IAAI,IAAI,KAAK,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I,OAAO,IAAI,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAA;IAC1D,OAAO,IAA+B,CAAA;AACvC,CAAC"}
|
|
@@ -20,6 +20,41 @@ export interface Finding {
|
|
|
20
20
|
/** Operations this finding judges. Absent on run-level findings (teardown, network, pacing). */
|
|
21
21
|
operations?: string[];
|
|
22
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* Whether a finding is a root cause — what fails a run. Coverage gaps and blocks are what oat
|
|
25
|
+
* could not look at, not what it found. The console, the reports, the matrix and the exit code
|
|
26
|
+
* all ask this one question.
|
|
27
|
+
*/
|
|
28
|
+
export declare function isRootCause(finding: {
|
|
29
|
+
verdict: Verdict | string;
|
|
30
|
+
}): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* How one run of a check ended. `run` returns one on every path, so a check cannot fall silent:
|
|
33
|
+
* it either asserted the property, reported a finding, could not reach a verdict, or stood down
|
|
34
|
+
* because what it tests is not there — and the last two say why.
|
|
35
|
+
*/
|
|
36
|
+
export type Outcome = {
|
|
37
|
+
kind: "asserted";
|
|
38
|
+
note?: string;
|
|
39
|
+
} | {
|
|
40
|
+
kind: "finding";
|
|
41
|
+
verdict: Verdict;
|
|
42
|
+
} | {
|
|
43
|
+
kind: "unresolved";
|
|
44
|
+
reason: string;
|
|
45
|
+
} | {
|
|
46
|
+
kind: "stood-down";
|
|
47
|
+
reason: string;
|
|
48
|
+
};
|
|
49
|
+
/** The property was tested and held — or, if the check reported along the way, did not. */
|
|
50
|
+
export declare const ASSERTED: Outcome;
|
|
51
|
+
/**
|
|
52
|
+
* The property held, and how the backend behaved is worth saying — a policy the document leaves
|
|
53
|
+
* open, such as whether unknown query parameters are rejected or ignored.
|
|
54
|
+
*/
|
|
55
|
+
export declare function asserted(note: string): Outcome;
|
|
56
|
+
/** The check does not apply here after all: what it tests is absent, for `reason`. */
|
|
57
|
+
export declare function standDown(reason: string): Outcome;
|
|
23
58
|
/**
|
|
24
59
|
* A check that ran, could not reach a verdict, and stopped.
|
|
25
60
|
*
|
|
@@ -40,7 +75,13 @@ export declare class FindingCollector {
|
|
|
40
75
|
#private;
|
|
41
76
|
readonly findings: Finding[];
|
|
42
77
|
readonly inconclusive: Inconclusive[];
|
|
43
|
-
constructor(findings?: Finding[], inconclusive?: Inconclusive[], operations?: readonly string[]);
|
|
78
|
+
constructor(findings?: Finding[], inconclusive?: Inconclusive[], operations?: readonly string[], owner?: string);
|
|
79
|
+
/**
|
|
80
|
+
* A view that accepts findings only under `check`. Each check runs against one, so a check
|
|
81
|
+
* cannot report under another's id: a finding filed under the wrong id is proven by the wrong
|
|
82
|
+
* defect, and suppresses the wrong dependents.
|
|
83
|
+
*/
|
|
84
|
+
ownedBy(check: string): FindingCollector;
|
|
44
85
|
/**
|
|
45
86
|
* A view over the same findings that attributes everything it records to `operations`.
|
|
46
87
|
*
|
|
@@ -54,13 +95,13 @@ export declare class FindingCollector {
|
|
|
54
95
|
* `return ctx.findings.unresolved(...)` at the point it gives up, which keeps the reason
|
|
55
96
|
* beside the condition that caused it rather than in a comment.
|
|
56
97
|
*/
|
|
57
|
-
unresolved(check: string, entity: string, reason: string):
|
|
58
|
-
report(finding: Finding):
|
|
59
|
-
backend(check: string, entity: string, summary: string, detail: string, evidence: Exchange[], fixture?: string):
|
|
60
|
-
security(check: string, entity: string, summary: string, detail: string, evidence: Exchange[], fixture?: string):
|
|
61
|
-
spec(check: string, entity: string, summary: string, detail: string, evidence: Exchange[], fixture?: string):
|
|
62
|
-
gap(check: string, entity: string, summary: string, detail: string, fixture?: string):
|
|
63
|
-
blocked(check: string, entity: string, summary: string, cause: string, evidence?: Exchange[]):
|
|
98
|
+
unresolved(check: string, entity: string, reason: string): Outcome;
|
|
99
|
+
report(finding: Finding): Outcome;
|
|
100
|
+
backend(check: string, entity: string, summary: string, detail: string, evidence: Exchange[], fixture?: string): Outcome;
|
|
101
|
+
security(check: string, entity: string, summary: string, detail: string, evidence: Exchange[], fixture?: string): Outcome;
|
|
102
|
+
spec(check: string, entity: string, summary: string, detail: string, evidence: Exchange[], fixture?: string): Outcome;
|
|
103
|
+
gap(check: string, entity: string, summary: string, detail: string, fixture?: string): Outcome;
|
|
104
|
+
blocked(check: string, entity: string, summary: string, cause: string, evidence?: Exchange[]): Outcome;
|
|
64
105
|
checks(): string[];
|
|
65
106
|
byVerdict(verdict: Verdict): Finding[];
|
|
66
107
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"finding.d.ts","sourceRoot":"","sources":["../../src/runtime/finding.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAE3C,MAAM,MAAM,OAAO,GAAG,aAAa,GAAG,UAAU,GAAG,UAAU,GAAG,WAAW,GAAG,cAAc,GAAG,SAAS,CAAA;AAExG,MAAM,WAAW,OAAO;IACvB,gGAAgG;IAChG,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,OAAO,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,QAAQ,EAAE,CAAA;IACpB,qEAAqE;IACrE,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,iEAAiE;IACjE,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,gGAAgG;IAChG,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;CACrB;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,YAAY;IAC5B,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,2DAA2D;IAC3D,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;CACrB;AAOD,qBAAa,gBAAgB;;IAC5B,QAAQ,CAAC,QAAQ,EAAE,OAAO,EAAE,CAAA;IAC5B,QAAQ,CAAC,YAAY,EAAE,YAAY,EAAE,CAAA;
|
|
1
|
+
{"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EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAAE,EACpB,OAAO,CAAC,EAAE,MAAM,GACd,OAAO;IAIV,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO;IAI9F,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,GAAE,QAAQ,EAAO,GAAG,OAAO;IAW1G,MAAM,IAAI,MAAM,EAAE;IAIlB,SAAS,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,EAAE;CAGtC"}
|
package/dist/runtime/finding.js
CHANGED
|
@@ -3,6 +3,27 @@
|
|
|
3
3
|
* from what the evidence shows, which is what lets the report collapse cascades and lets the
|
|
4
4
|
* conformance suite assert "exactly this defect was detected".
|
|
5
5
|
*/
|
|
6
|
+
/**
|
|
7
|
+
* Whether a finding is a root cause — what fails a run. Coverage gaps and blocks are what oat
|
|
8
|
+
* could not look at, not what it found. The console, the reports, the matrix and the exit code
|
|
9
|
+
* all ask this one question.
|
|
10
|
+
*/
|
|
11
|
+
export function isRootCause(finding) {
|
|
12
|
+
return finding.verdict !== "COVERAGE_GAP" && finding.verdict !== "BLOCKED";
|
|
13
|
+
}
|
|
14
|
+
/** The property was tested and held — or, if the check reported along the way, did not. */
|
|
15
|
+
export const ASSERTED = Object.freeze({ kind: "asserted" });
|
|
16
|
+
/**
|
|
17
|
+
* The property held, and how the backend behaved is worth saying — a policy the document leaves
|
|
18
|
+
* open, such as whether unknown query parameters are rejected or ignored.
|
|
19
|
+
*/
|
|
20
|
+
export function asserted(note) {
|
|
21
|
+
return { kind: "asserted", note };
|
|
22
|
+
}
|
|
23
|
+
/** The check does not apply here after all: what it tests is absent, for `reason`. */
|
|
24
|
+
export function standDown(reason) {
|
|
25
|
+
return { kind: "stood-down", reason };
|
|
26
|
+
}
|
|
6
27
|
function withFixture(finding, fixture) {
|
|
7
28
|
if (fixture === undefined || fixture === "")
|
|
8
29
|
return finding;
|
|
@@ -12,10 +33,25 @@ export class FindingCollector {
|
|
|
12
33
|
findings;
|
|
13
34
|
inconclusive;
|
|
14
35
|
#operations;
|
|
15
|
-
|
|
36
|
+
#owner;
|
|
37
|
+
constructor(findings = [], inconclusive = [], operations, owner) {
|
|
16
38
|
this.findings = findings;
|
|
17
39
|
this.inconclusive = inconclusive;
|
|
18
40
|
this.#operations = operations;
|
|
41
|
+
this.#owner = owner;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* A view that accepts findings only under `check`. Each check runs against one, so a check
|
|
45
|
+
* cannot report under another's id: a finding filed under the wrong id is proven by the wrong
|
|
46
|
+
* defect, and suppresses the wrong dependents.
|
|
47
|
+
*/
|
|
48
|
+
ownedBy(check) {
|
|
49
|
+
return new FindingCollector(this.findings, this.inconclusive, this.#operations, check);
|
|
50
|
+
}
|
|
51
|
+
#own(check) {
|
|
52
|
+
if (this.#owner !== undefined && check !== this.#owner) {
|
|
53
|
+
throw new Error(`check "${this.#owner}" tried to report under "${check}"`);
|
|
54
|
+
}
|
|
19
55
|
}
|
|
20
56
|
/**
|
|
21
57
|
* A view over the same findings that attributes everything it records to `operations`.
|
|
@@ -25,7 +61,7 @@ export class FindingCollector {
|
|
|
25
61
|
* shared "current check" would attribute one check's finding to another.
|
|
26
62
|
*/
|
|
27
63
|
attributed(operations) {
|
|
28
|
-
return new FindingCollector(this.findings, this.inconclusive, operations);
|
|
64
|
+
return new FindingCollector(this.findings, this.inconclusive, operations, this.#owner);
|
|
29
65
|
}
|
|
30
66
|
#stamp() {
|
|
31
67
|
return this.#operations === undefined ? {} : { operations: [...this.#operations] };
|
|
@@ -36,26 +72,33 @@ export class FindingCollector {
|
|
|
36
72
|
* beside the condition that caused it rather than in a comment.
|
|
37
73
|
*/
|
|
38
74
|
unresolved(check, entity, reason) {
|
|
75
|
+
this.#own(check);
|
|
39
76
|
this.inconclusive.push({ check, entity, reason, ...this.#stamp() });
|
|
40
|
-
return
|
|
77
|
+
return { kind: "unresolved", reason };
|
|
41
78
|
}
|
|
42
79
|
report(finding) {
|
|
80
|
+
this.#own(finding.check);
|
|
43
81
|
this.findings.push(finding.operations === undefined ? { ...finding, ...this.#stamp() } : finding);
|
|
82
|
+
if (finding.verdict === "COVERAGE_GAP")
|
|
83
|
+
return standDown(finding.summary);
|
|
84
|
+
if (finding.verdict === "BLOCKED")
|
|
85
|
+
return { kind: "unresolved", reason: finding.summary };
|
|
86
|
+
return { kind: "finding", verdict: finding.verdict };
|
|
44
87
|
}
|
|
45
88
|
backend(check, entity, summary, detail, evidence, fixture) {
|
|
46
|
-
this.report(withFixture({ check, detail, entity, evidence, summary, verdict: "BACKEND_BUG" }, fixture));
|
|
89
|
+
return this.report(withFixture({ check, detail, entity, evidence, summary, verdict: "BACKEND_BUG" }, fixture));
|
|
47
90
|
}
|
|
48
91
|
security(check, entity, summary, detail, evidence, fixture) {
|
|
49
|
-
this.report(withFixture({ check, detail, entity, evidence, summary, verdict: "SECURITY" }, fixture));
|
|
92
|
+
return this.report(withFixture({ check, detail, entity, evidence, summary, verdict: "SECURITY" }, fixture));
|
|
50
93
|
}
|
|
51
94
|
spec(check, entity, summary, detail, evidence, fixture) {
|
|
52
|
-
this.report(withFixture({ check, detail, entity, evidence, summary, verdict: "SPEC_BUG" }, fixture));
|
|
95
|
+
return this.report(withFixture({ check, detail, entity, evidence, summary, verdict: "SPEC_BUG" }, fixture));
|
|
53
96
|
}
|
|
54
97
|
gap(check, entity, summary, detail, fixture) {
|
|
55
|
-
this.report(withFixture({ check, detail, entity, evidence: [], summary, verdict: "COVERAGE_GAP" }, fixture));
|
|
98
|
+
return this.report(withFixture({ check, detail, entity, evidence: [], summary, verdict: "COVERAGE_GAP" }, fixture));
|
|
56
99
|
}
|
|
57
100
|
blocked(check, entity, summary, cause, evidence = []) {
|
|
58
|
-
this.report({
|
|
101
|
+
return this.report({
|
|
59
102
|
check,
|
|
60
103
|
detail: `blocked by ${cause}`,
|
|
61
104
|
entity,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"finding.js","sourceRoot":"","sources":["../../src/runtime/finding.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"finding.js","sourceRoot":"","sources":["../../src/runtime/finding.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAsBH;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,OAAsC;IACjE,OAAO,OAAO,CAAC,OAAO,KAAK,cAAc,IAAI,OAAO,CAAC,OAAO,KAAK,SAAS,CAAA;AAC3E,CAAC;AAaD,2FAA2F;AAC3F,MAAM,CAAC,MAAM,QAAQ,GAAY,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAA;AAEpE;;;GAGG;AACH,MAAM,UAAU,QAAQ,CAAC,IAAY;IACpC,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,CAAA;AAClC,CAAC;AAED,sFAAsF;AACtF,MAAM,UAAU,SAAS,CAAC,MAAc;IACvC,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,CAAA;AACtC,CAAC;AAmBD,SAAS,WAAW,CAAC,OAAgB,EAAE,OAAgB;IACtD,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,EAAE;QAAE,OAAO,OAAO,CAAA;IAC3D,OAAO,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE,CAAA;AAC/B,CAAC;AAED,MAAM,OAAO,gBAAgB;IACnB,QAAQ,CAAW;IACnB,YAAY,CAAgB;IAC5B,WAAW,CAA+B;IAC1C,MAAM,CAAoB;IAEnC,YACC,WAAsB,EAAE,EACxB,eAA+B,EAAE,EACjC,U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EhB,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,EAAE,OAAO,CAAC,CAAC,CAAA;IAC5G,CAAC;IAED,GAAG,CAAC,KAAa,EAAE,MAAc,EAAE,OAAe,EAAE,MAAc,EAAE,OAAgB;QACnF,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,EAAE,OAAO,CAAC,CAAC,CAAA;IACpH,CAAC;IAED,OAAO,CAAC,KAAa,EAAE,MAAc,EAAE,OAAe,EAAE,KAAa,EAAE,WAAuB,EAAE;QAC/F,OAAO,IAAI,CAAC,MAAM,CAAC;YAClB,KAAK;YACL,MAAM,EAAE,cAAc,KAAK,EAAE;YAC7B,MAAM;YACN,QAAQ;YACR,OAAO;YACP,OAAO,EAAE,SAAS;SAClB,CAAC,CAAA;IACH,CAAC;IAED,MAAM;QACL,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAA;IAC9D,CAAC;IAED,SAAS,CAAC,OAAgB;QACzB,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,KAAK,OAAO,CAAC,CAAA;IAC1D,CAAC;CACD"}
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Schema-driven fixture generation.
|
|
2
|
+
* Schema-driven fixture generation: the discriminating cohort.
|
|
3
3
|
*
|
|
4
4
|
* Valid-random data cannot test a query engine: `ilike` needs a substring, `order` needs a total
|
|
5
|
-
* order, escaping needs metacharacters. oat seeds a *
|
|
6
|
-
*
|
|
5
|
+
* order, escaping needs metacharacters. oat seeds a *cohort* — one record per variant, each shaped
|
|
6
|
+
* so some query assertion has signal — and derives everything from a seed so a failing run is
|
|
7
7
|
* exactly reproducible.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
9
|
+
* The values themselves come from `generate.ts`, the one place oat invents data, from the request
|
|
10
|
+
* schema as `spec/schema.ts` normalizes it. Every body is checked against that schema before it
|
|
11
|
+
* leaves; one that cannot be made valid is a gap naming the operation and the field, never a
|
|
12
|
+
* request the document forbids.
|
|
12
13
|
*/
|
|
13
|
-
|
|
14
|
+
import { type Variant } from "./generate.ts";
|
|
15
|
+
export type { Variant } from "./generate.ts";
|
|
16
|
+
export { isVacuous } from "./generate.ts";
|
|
14
17
|
export declare const COHORT: readonly Variant[];
|
|
15
18
|
/** Deterministic PRNG — same seed, same cohort, every run. */
|
|
16
19
|
export declare function mulberry32(seed: number): () => number;
|
|
@@ -19,39 +22,43 @@ export interface CohortMember {
|
|
|
19
22
|
variant: Variant;
|
|
20
23
|
body: Record<string, unknown>;
|
|
21
24
|
}
|
|
22
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* Thrown when no valid body can be built for an operation. The pointer names the field; the
|
|
27
|
+
* reason says why — and the fix is `hooks.resolveInput`, which can supply what the schema cannot.
|
|
28
|
+
*/
|
|
23
29
|
export declare class FixtureOverflow extends Error {
|
|
24
30
|
readonly operationId: string;
|
|
25
31
|
readonly pointer: string;
|
|
26
|
-
|
|
32
|
+
readonly reason?: string | undefined;
|
|
33
|
+
constructor(operationId: string, pointer: string, reason?: string | undefined);
|
|
27
34
|
}
|
|
28
35
|
export declare function overflowFrom(error: unknown, operationId: string, pointer?: string): FixtureOverflow;
|
|
29
36
|
export declare function isOverflowError(error: unknown): boolean;
|
|
37
|
+
export interface CohortOptions {
|
|
38
|
+
/** Recursive schemas the document refers to as `oat-defs#/$defs/<name>`. */
|
|
39
|
+
defs?: Record<string, Schema>;
|
|
40
|
+
/** Per-run token for values that must not collide with an earlier run's. */
|
|
41
|
+
nonce?: string;
|
|
42
|
+
/** Top-level fields whose values must be distinct across runs too — the x-unique columns. */
|
|
43
|
+
distinct?: ReadonlySet<string>;
|
|
44
|
+
}
|
|
45
|
+
/** One body per variant, each valid for the schema — or a `FixtureOverflow` naming what is not. */
|
|
46
|
+
export declare function buildCohort(bodySchema: Schema | boolean, seed: number, variants?: readonly Variant[], operationId?: string, options?: CohortOptions): CohortMember[];
|
|
30
47
|
/**
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* When the document cannot express two distinct values, extra variants are dropped and the
|
|
34
|
-
* caller records a gap.
|
|
35
|
-
*/
|
|
36
|
-
export declare function ensureDistinctUniqueValues(members: CohortMember[], sets: string[][], schema: Schema | boolean): {
|
|
37
|
-
members: CohortMember[];
|
|
38
|
-
gap: string | null;
|
|
39
|
-
};
|
|
40
|
-
export declare function buildCohort(bodySchema: Schema | boolean, seed: number, variants?: readonly Variant[], operationId?: string): CohortMember[];
|
|
41
|
-
/**
|
|
42
|
-
* One create body, or a gap if a required field cannot be honoured.
|
|
43
|
-
*
|
|
44
|
-
* Optional fields that cannot match `format`/`pattern` are omitted. Required ones must not fall
|
|
45
|
-
* back to `"Quarterly Report N"` — that is what 400s every email/handle/url field.
|
|
48
|
+
* One body, with the required fields that could not be made rather than an exception — for
|
|
49
|
+
* callers that report each gap themselves. Optional fields that cannot be made are left out.
|
|
46
50
|
*/
|
|
47
51
|
export declare function generateBody(bodySchema: Schema | boolean, variant: Variant, rand: () => number, index: number, operationId?: string): {
|
|
48
52
|
body: Record<string, unknown>;
|
|
49
53
|
missingRequired: string[];
|
|
50
54
|
};
|
|
51
55
|
/**
|
|
52
|
-
*
|
|
53
|
-
*
|
|
56
|
+
* Makes unique-set tuples differ across cohort members, by drawing new values from each
|
|
57
|
+
* column's schema. When the document cannot express two distinct values — a two-value enum and
|
|
58
|
+
* seven members — the extra members are dropped and the caller records a gap.
|
|
54
59
|
*/
|
|
55
|
-
export declare function
|
|
56
|
-
|
|
60
|
+
export declare function ensureDistinctUniqueValues(members: CohortMember[], sets: string[][], schema: Schema | boolean, options?: CohortOptions): {
|
|
61
|
+
members: CohortMember[];
|
|
62
|
+
gap: string | null;
|
|
63
|
+
};
|
|
57
64
|
//# sourceMappingURL=fixture.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fixture.d.ts","sourceRoot":"","sources":["../../src/runtime/fixture.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"fixture.d.ts","sourceRoot":"","sources":["../../src/runtime/fixture.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EAAE,KAAK,OAAO,EAAuB,MAAM,eAAe,CAAA;AAGjE,YAAY,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAEzC,eAAO,MAAM,MAAM,EAAE,SAAS,OAAO,EAQpC,CAAA;AAED,8DAA8D;AAC9D,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,MAAM,CAQrD;AAED,KAAK,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;AAErC,MAAM,WAAW,YAAY;IAC5B,OAAO,EAAE,OAAO,CAAA;IAChB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC7B;AAED;;;GAGG;AACH,qBAAa,eAAgB,SAAQ,KAAK;IAExC,QAAQ,CAAC,WAAW,EAAE,MAAM;IAC5B,QAAQ,CAAC,OAAO,EAAE,MAAM;IACxB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM;gBAFf,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,MAAM,YAAA;CASzB;AA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