devcontour-harness 0.1.0-alpha.42 → 0.1.0-alpha.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -2
- package/docs/architecture.md +38 -3
- package/docs/contracts.md +10 -2
- package/docs/release-notes/0.1.0-alpha.43.md +40 -0
- package/docs/release-notes/0.1.0-alpha.44.md +44 -0
- package/docs/upgrade.md +65 -17
- package/lib/contracts/cli.d.ts +48 -4
- package/lib/contracts/events.d.ts +60 -5
- package/lib/contracts/events.js +16 -1
- package/lib/contracts/execution.d.ts +37 -0
- package/lib/contracts/execution.js +20 -0
- package/lib/contracts/published.d.ts +28 -2
- package/lib/contracts/report.d.ts +8 -0
- package/lib/contracts/report.js +7 -1
- package/lib/contracts/result.d.ts +2 -0
- package/lib/contracts/result.js +6 -0
- package/lib/control/harness.d.ts +5 -0
- package/lib/engine/engine.d.ts +36 -3
- package/lib/engine/engine.js +117 -16
- package/lib/engine/joint-runner.d.ts +2 -0
- package/lib/engine/joint-runner.js +13 -3
- package/lib/environment/isolation.d.ts +1 -1
- package/lib/environment/isolation.js +38 -4
- package/lib/report/compute.js +3 -0
- package/lib/report/document.js +1 -1
- package/lib/storage/document.d.ts +2 -0
- package/lib/testing/store-contract.d.ts +8 -2
- package/lib/testing/store-contract.js +56 -1
- package/lib/verification/joint.d.ts +179 -1
- package/lib/verification/joint.js +23 -3
- package/package.json +1 -1
- package/schemas/execution-document.schema.json +4 -0
- package/schemas/joint-verification.schema.json +4 -0
- package/schemas/run-event.schema.json +96 -0
- package/schemas/value-report.schema.json +20 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { digestOf, HarnessError, } from "../contracts/index.js";
|
|
1
|
+
import { digestOf, HarnessError, WORKSPACE_OWNER, } from "../contracts/index.js";
|
|
2
2
|
/**
|
|
3
3
|
* Совместная проверка закреплённой комбинации SHA репозиториев.
|
|
4
4
|
*
|
|
@@ -38,8 +38,17 @@ export function jointSpecDigest(view, workIds) {
|
|
|
38
38
|
}
|
|
39
39
|
/** Один и тот же набор поручений — один предмет проверки, независимо от порядка. */
|
|
40
40
|
export const sameWorks = (a, b) => JSON.stringify([...a].sort()) === JSON.stringify([...b].sort());
|
|
41
|
-
/**
|
|
42
|
-
|
|
41
|
+
/**
|
|
42
|
+
* Проверка, прерванная до результата gates (остановка хоста, потеря
|
|
43
|
+
* владения): без evidence она не говорит ничего о комбинации и предел не тратит.
|
|
44
|
+
*/
|
|
45
|
+
export const jointInterrupted = (v) => v.status === 'failed' && v.interrupted === true && v.evidence.length === 0;
|
|
46
|
+
/**
|
|
47
|
+
* Окно бюджета набора: проверки, не закрытые принятием хоста и не снятые
|
|
48
|
+
* явным сбросом (`joint-budget-resets`). Checkpoints доверенного хоста
|
|
49
|
+
* проверяются целиком.
|
|
50
|
+
*/
|
|
51
|
+
export function jointBudgetWindow(view, workIds, checkpoints) {
|
|
43
52
|
const invalid = () => {
|
|
44
53
|
throw new HarnessError('INVALID_INPUT', 'Невалидная принятая граница бюджета совместных проверок');
|
|
45
54
|
};
|
|
@@ -73,8 +82,19 @@ export function jointBudgetAttempts(view, workIds, checkpoints) {
|
|
|
73
82
|
settled.add(id);
|
|
74
83
|
}
|
|
75
84
|
}
|
|
85
|
+
for (const { value } of view.locals('joint-budget-resets', WORKSPACE_OWNER))
|
|
86
|
+
if (sameWorks(value.workIds, workIds))
|
|
87
|
+
for (const id of value.settledVerificationIds)
|
|
88
|
+
settled.add(id);
|
|
76
89
|
return view.verifications().filter((v) => sameWorks(v.workIds, workIds) && !settled.has(v.id));
|
|
77
90
|
}
|
|
91
|
+
/**
|
|
92
|
+
* Проверки набора, тратящие его предел: окно бюджета без прерванных до
|
|
93
|
+
* результата gates. Прерванная после evidence и отказ gate тратят.
|
|
94
|
+
*/
|
|
95
|
+
export function jointBudgetAttempts(view, workIds, checkpoints) {
|
|
96
|
+
return jointBudgetWindow(view, workIds, checkpoints).filter((v) => !jointInterrupted(v));
|
|
97
|
+
}
|
|
78
98
|
/** Gates совместной проверки в порядке их зависимостей. */
|
|
79
99
|
export function orderedWorkspaceGates(gates) {
|
|
80
100
|
const byId = new Map(gates.map((g) => [g.id, g]));
|
package/package.json
CHANGED
|
@@ -2656,6 +2656,10 @@
|
|
|
2656
2656
|
"error": {
|
|
2657
2657
|
"type": "string",
|
|
2658
2658
|
"maxLength": 4000
|
|
2659
|
+
},
|
|
2660
|
+
"interrupted": {
|
|
2661
|
+
"type": "boolean",
|
|
2662
|
+
"const": true
|
|
2659
2663
|
}
|
|
2660
2664
|
},
|
|
2661
2665
|
"required": [
|
|
@@ -2674,6 +2678,98 @@
|
|
|
2674
2678
|
],
|
|
2675
2679
|
"additionalProperties": false
|
|
2676
2680
|
},
|
|
2681
|
+
{
|
|
2682
|
+
"type": "object",
|
|
2683
|
+
"properties": {
|
|
2684
|
+
"apiVersion": {
|
|
2685
|
+
"type": "string",
|
|
2686
|
+
"const": "devcontour-harness/v1alpha1"
|
|
2687
|
+
},
|
|
2688
|
+
"seq": {
|
|
2689
|
+
"type": "integer",
|
|
2690
|
+
"exclusiveMinimum": 0,
|
|
2691
|
+
"maximum": 9007199254740991
|
|
2692
|
+
},
|
|
2693
|
+
"at": {
|
|
2694
|
+
"type": "string",
|
|
2695
|
+
"format": "date-time",
|
|
2696
|
+
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
|
|
2697
|
+
},
|
|
2698
|
+
"graphId": {
|
|
2699
|
+
"type": "string",
|
|
2700
|
+
"pattern": "^[A-Za-z0-9_-]{1,80}$"
|
|
2701
|
+
},
|
|
2702
|
+
"workId": {
|
|
2703
|
+
"type": "string",
|
|
2704
|
+
"pattern": "^[A-Za-z0-9_-]{1,80}$"
|
|
2705
|
+
},
|
|
2706
|
+
"runId": {
|
|
2707
|
+
"type": "string",
|
|
2708
|
+
"minLength": 1,
|
|
2709
|
+
"maxLength": 200
|
|
2710
|
+
},
|
|
2711
|
+
"attempt": {
|
|
2712
|
+
"type": "integer",
|
|
2713
|
+
"exclusiveMinimum": 0,
|
|
2714
|
+
"maximum": 9007199254740991
|
|
2715
|
+
},
|
|
2716
|
+
"type": {
|
|
2717
|
+
"type": "string",
|
|
2718
|
+
"const": "joint.budget-reset"
|
|
2719
|
+
},
|
|
2720
|
+
"payload": {
|
|
2721
|
+
"type": "object",
|
|
2722
|
+
"properties": {
|
|
2723
|
+
"resetId": {
|
|
2724
|
+
"type": "string",
|
|
2725
|
+
"minLength": 1,
|
|
2726
|
+
"maxLength": 200
|
|
2727
|
+
},
|
|
2728
|
+
"workIds": {
|
|
2729
|
+
"maxItems": 500,
|
|
2730
|
+
"type": "array",
|
|
2731
|
+
"items": {
|
|
2732
|
+
"type": "string",
|
|
2733
|
+
"pattern": "^[A-Za-z0-9_-]{1,80}$"
|
|
2734
|
+
}
|
|
2735
|
+
},
|
|
2736
|
+
"by": {
|
|
2737
|
+
"type": "string",
|
|
2738
|
+
"enum": [
|
|
2739
|
+
"operator",
|
|
2740
|
+
"host"
|
|
2741
|
+
]
|
|
2742
|
+
},
|
|
2743
|
+
"settled": {
|
|
2744
|
+
"type": "integer",
|
|
2745
|
+
"minimum": 0,
|
|
2746
|
+
"maximum": 9007199254740991
|
|
2747
|
+
},
|
|
2748
|
+
"reasonLength": {
|
|
2749
|
+
"type": "integer",
|
|
2750
|
+
"minimum": 0,
|
|
2751
|
+
"maximum": 9007199254740991
|
|
2752
|
+
}
|
|
2753
|
+
},
|
|
2754
|
+
"required": [
|
|
2755
|
+
"resetId",
|
|
2756
|
+
"workIds",
|
|
2757
|
+
"by",
|
|
2758
|
+
"settled",
|
|
2759
|
+
"reasonLength"
|
|
2760
|
+
],
|
|
2761
|
+
"additionalProperties": false
|
|
2762
|
+
}
|
|
2763
|
+
},
|
|
2764
|
+
"required": [
|
|
2765
|
+
"apiVersion",
|
|
2766
|
+
"seq",
|
|
2767
|
+
"at",
|
|
2768
|
+
"type",
|
|
2769
|
+
"payload"
|
|
2770
|
+
],
|
|
2771
|
+
"additionalProperties": false
|
|
2772
|
+
},
|
|
2677
2773
|
{
|
|
2678
2774
|
"type": "object",
|
|
2679
2775
|
"properties": {
|
|
@@ -1065,6 +1065,26 @@
|
|
|
1065
1065
|
],
|
|
1066
1066
|
"additionalProperties": false
|
|
1067
1067
|
},
|
|
1068
|
+
"jointResets": {
|
|
1069
|
+
"type": "object",
|
|
1070
|
+
"properties": {
|
|
1071
|
+
"operator": {
|
|
1072
|
+
"type": "integer",
|
|
1073
|
+
"minimum": 0,
|
|
1074
|
+
"maximum": 9007199254740991
|
|
1075
|
+
},
|
|
1076
|
+
"host": {
|
|
1077
|
+
"type": "integer",
|
|
1078
|
+
"minimum": 0,
|
|
1079
|
+
"maximum": 9007199254740991
|
|
1080
|
+
}
|
|
1081
|
+
},
|
|
1082
|
+
"required": [
|
|
1083
|
+
"operator",
|
|
1084
|
+
"host"
|
|
1085
|
+
],
|
|
1086
|
+
"additionalProperties": false
|
|
1087
|
+
},
|
|
1068
1088
|
"baseMovesBound": {
|
|
1069
1089
|
"type": "string",
|
|
1070
1090
|
"const": "lower"
|