@dogfood-lab/verify 1.4.0 → 1.6.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 +9 -3
- package/cli.js +447 -0
- package/index.js +50 -11
- package/package.json +8 -1
- package/parse-rejection.js +146 -0
- package/validators/policy.js +83 -3
- package/validators/provenance-gitlab.test.js +375 -0
- package/validators/provenance-registry.test.js +56 -0
- package/validators/provenance.js +331 -31
- package/validators/repo-binding.js +92 -0
- package/validators/repo-binding.test.js +118 -0
- package/validators/schema.js +8 -17
- package/validators/steps.js +5 -1
package/validators/schema.js
CHANGED
|
@@ -27,23 +27,14 @@ import { validatePayload } from '@dogfood-lab/schemas';
|
|
|
27
27
|
* @returns {{ valid: boolean, errors: string[] }}
|
|
28
28
|
*/
|
|
29
29
|
export function validateSubmissionSchema(submission) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
// routed through `VALIDATOR_FAULT_*` — `getValidator` returned a plain
|
|
39
|
-
// object and the call site special-cased its `__loadError` key. The
|
|
40
|
-
// post-H3 path is cleaner: a thrown error here propagates up to
|
|
41
|
-
// runValidator which already wraps thrown validators in
|
|
42
|
-
// `VALIDATOR_FAULT_SCHEMA` (D1B-003 humanization). Same operator-
|
|
43
|
-
// facing prefix, just routed through the lawful seam instead of a
|
|
44
|
-
// sentinel. No catch — propagate.
|
|
45
|
-
throw e;
|
|
46
|
-
}
|
|
30
|
+
// The canonical compile path can throw at compileSchema time if the schema
|
|
31
|
+
// file is unreadable or malformed (Ajv compile fault). We deliberately do
|
|
32
|
+
// NOT catch it here: a thrown error propagates up to runValidator in
|
|
33
|
+
// verify/index.js, which wraps thrown validators in `VALIDATOR_FAULT_SCHEMA`
|
|
34
|
+
// (D1B-003 humanization). Pre-H3 this fault was surfaced via a `{ __loadError }`
|
|
35
|
+
// sentinel the call site special-cased; routing the throw through the lawful
|
|
36
|
+
// runValidator seam yields the same operator-facing prefix without the sentinel.
|
|
37
|
+
const result = validatePayload('recordSubmission', submission);
|
|
47
38
|
|
|
48
39
|
if (result.valid) {
|
|
49
40
|
return { valid: true, errors: [] };
|
package/validators/steps.js
CHANGED
|
@@ -52,8 +52,12 @@ export function validateStepResults(scenarioResult) {
|
|
|
52
52
|
|
|
53
53
|
// A scenario cannot be "pass" if any step is "fail" or "blocked"
|
|
54
54
|
if (verdict === 'pass') {
|
|
55
|
+
// Guard `s != null` to match the two sibling loops above: a null element is
|
|
56
|
+
// already reported as malformed there, and dereferencing `s.status` here
|
|
57
|
+
// would throw a TypeError that runValidator misclassifies as an operational
|
|
58
|
+
// VALIDATOR_FAULT_STEPS instead of a submission-bad signal (verify-B-004).
|
|
55
59
|
const failingSteps = step_results.filter(
|
|
56
|
-
s => s.status === 'fail' || s.status === 'blocked'
|
|
60
|
+
s => s != null && (s.status === 'fail' || s.status === 'blocked')
|
|
57
61
|
);
|
|
58
62
|
if (failingSteps.length > 0) {
|
|
59
63
|
const ids = failingSteps.map(s => s.step_id).join(', ');
|