devcontour-harness 0.1.0-alpha.42 → 0.1.0-alpha.45

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.
Files changed (65) hide show
  1. package/README.md +25 -2
  2. package/docs/architecture.md +38 -3
  3. package/docs/contracts.md +117 -3
  4. package/docs/release-notes/0.1.0-alpha.43.md +40 -0
  5. package/docs/release-notes/0.1.0-alpha.44.md +44 -0
  6. package/docs/release-notes/0.1.0-alpha.45.md +77 -0
  7. package/docs/upgrade.md +107 -17
  8. package/lib/contracts/cli.d.ts +115 -4
  9. package/lib/contracts/cli.js +6 -1
  10. package/lib/contracts/events.d.ts +65 -5
  11. package/lib/contracts/events.js +18 -1
  12. package/lib/contracts/execution.d.ts +76 -0
  13. package/lib/contracts/execution.js +35 -2
  14. package/lib/contracts/policy.d.ts +39 -0
  15. package/lib/contracts/policy.js +64 -0
  16. package/lib/contracts/profiles.d.ts +6 -0
  17. package/lib/contracts/published.d.ts +97 -2
  18. package/lib/contracts/report.d.ts +8 -0
  19. package/lib/contracts/report.js +7 -1
  20. package/lib/contracts/result.d.ts +93 -0
  21. package/lib/contracts/result.js +37 -1
  22. package/lib/contracts/review.d.ts +1 -1
  23. package/lib/control/harness.d.ts +29 -2
  24. package/lib/engine/engine.d.ts +54 -6
  25. package/lib/engine/engine.js +191 -24
  26. package/lib/engine/joint-runner.d.ts +2 -0
  27. package/lib/engine/joint-runner.js +13 -3
  28. package/lib/engine/result.js +7 -3
  29. package/lib/engine/runner.d.ts +8 -0
  30. package/lib/engine/runner.js +91 -3
  31. package/lib/environment/git-trust.js +3 -0
  32. package/lib/environment/isolation.d.ts +1 -1
  33. package/lib/environment/isolation.js +38 -4
  34. package/lib/environment/process.d.ts +2 -0
  35. package/lib/environment/process.js +7 -1
  36. package/lib/explain/state.js +1 -1
  37. package/lib/index.d.ts +1 -0
  38. package/lib/index.js +1 -0
  39. package/lib/integrations/connector/history.js +1 -1
  40. package/lib/integrations/connector/summary.js +2 -1
  41. package/lib/profiles/resolve.d.ts +6 -0
  42. package/lib/projections/attempt.d.ts +4 -2
  43. package/lib/projections/attempt.js +14 -1
  44. package/lib/report/compute.js +7 -3
  45. package/lib/report/document.js +1 -1
  46. package/lib/storage/document.d.ts +28 -2
  47. package/lib/testing/store-contract.d.ts +8 -2
  48. package/lib/testing/store-contract.js +56 -1
  49. package/lib/verification/acceptance.d.ts +12 -0
  50. package/lib/verification/acceptance.js +62 -7
  51. package/lib/verification/applicability.d.ts +134 -0
  52. package/lib/verification/applicability.js +373 -0
  53. package/lib/verification/gates.d.ts +6 -0
  54. package/lib/verification/joint.d.ts +179 -1
  55. package/lib/verification/joint.js +23 -3
  56. package/lib/verification/proof.d.ts +18 -4
  57. package/lib/verification/proof.js +52 -9
  58. package/package.json +1 -1
  59. package/schemas/execution-document.schema.json +77 -1
  60. package/schemas/execution-policy.schema.json +38 -0
  61. package/schemas/joint-verification.schema.json +4 -0
  62. package/schemas/result-envelope.schema.json +138 -2
  63. package/schemas/run-event.schema.json +100 -0
  64. package/schemas/run-result.schema.json +138 -2
  65. package/schemas/value-report.schema.json +20 -0
@@ -114,6 +114,7 @@ export declare const eventPayloads: {
114
114
  passed: z.ZodBoolean;
115
115
  evidenceId: z.ZodString;
116
116
  consumer: z.ZodOptional<z.ZodString>;
117
+ notApplicable: z.ZodOptional<z.ZodLiteral<true>>;
117
118
  recheck: z.ZodOptional<z.ZodObject<{
118
119
  of: z.ZodString;
119
120
  outcome: z.ZodEnum<{
@@ -474,6 +475,21 @@ export declare const eventPayloads: {
474
475
  }>;
475
476
  manifestDigest: z.ZodOptional<z.ZodString>;
476
477
  error: z.ZodOptional<z.ZodString>;
478
+ interrupted: z.ZodOptional<z.ZodLiteral<true>>;
479
+ }, z.core.$strict>;
480
+ /**
481
+ * Явный сброс бюджета совместных проверок набора: `settled` завершённых
482
+ * проверок больше не тратят его предел. Текст причины — в записи сброса.
483
+ */
484
+ readonly 'joint.budget-reset': z.ZodObject<{
485
+ resetId: z.ZodString;
486
+ workIds: z.ZodArray<z.ZodString>;
487
+ by: z.ZodEnum<{
488
+ operator: "operator";
489
+ host: "host";
490
+ }>;
491
+ settled: z.ZodNumber;
492
+ reasonLength: z.ZodNumber;
477
493
  }, z.core.$strict>;
478
494
  /** Политика стала применённой: запуском процесса или операцией reconfigure. */
479
495
  readonly 'policy.applied': z.ZodObject<{
@@ -654,7 +670,7 @@ export declare const runEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
654
670
  workId: z.ZodOptional<z.ZodString>;
655
671
  runId: z.ZodOptional<z.ZodString>;
656
672
  attempt: z.ZodOptional<z.ZodNumber>;
657
- type: z.ZodLiteral<"graph.registered" | "graph.reviewed" | "graph.approved" | "work.ready" | "work.held" | "attempt.claimed" | "attempt.phase" | "attempt.gate" | "attempt.review" | "attempt.stage" | "attempt.liveness" | "attempt.failed" | "attempt.diagnosed" | "attempt.expired" | "attempt.cancelled" | "attempt.recovered" | "work.accepted" | "work.retried" | "work.cancelled" | "work.blocked" | "control.paused" | "control.resumed" | "controller.acquired" | "base.moved" | "controller.released" | "budget.blocked" | "corpus.adopted" | "work.recovery" | "joint.started" | "joint.liveness" | "joint.finished" | "policy.applied" | "policy.reconfigure" | "input.requested" | "input.answered" | "input.applied" | "input.closed" | "input.stale" | "input.delivered" | "attempt.assumptions" | "delivery.pending" | "delivery.delivered" | "delivery.failed" | "delivery.conflict" | "delivery.uncertain">;
673
+ type: z.ZodLiteral<"graph.registered" | "graph.reviewed" | "graph.approved" | "work.ready" | "work.held" | "attempt.claimed" | "attempt.phase" | "attempt.gate" | "attempt.review" | "attempt.stage" | "attempt.liveness" | "attempt.failed" | "attempt.diagnosed" | "attempt.expired" | "attempt.cancelled" | "attempt.recovered" | "work.accepted" | "work.retried" | "work.cancelled" | "work.blocked" | "control.paused" | "control.resumed" | "controller.acquired" | "base.moved" | "controller.released" | "budget.blocked" | "corpus.adopted" | "work.recovery" | "joint.started" | "joint.liveness" | "joint.finished" | "joint.budget-reset" | "policy.applied" | "policy.reconfigure" | "input.requested" | "input.answered" | "input.applied" | "input.closed" | "input.stale" | "input.delivered" | "attempt.assumptions" | "delivery.pending" | "delivery.delivered" | "delivery.failed" | "delivery.conflict" | "delivery.uncertain">;
658
674
  payload: z.ZodObject<{
659
675
  digest: z.ZodString;
660
676
  orders: z.ZodNumber;
@@ -722,6 +738,7 @@ export declare const runEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
722
738
  passed: z.ZodBoolean;
723
739
  evidenceId: z.ZodString;
724
740
  consumer: z.ZodOptional<z.ZodString>;
741
+ notApplicable: z.ZodOptional<z.ZodLiteral<true>>;
725
742
  recheck: z.ZodOptional<z.ZodObject<{
726
743
  of: z.ZodString;
727
744
  outcome: z.ZodEnum<{
@@ -1019,6 +1036,16 @@ export declare const runEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1019
1036
  }>;
1020
1037
  manifestDigest: z.ZodOptional<z.ZodString>;
1021
1038
  error: z.ZodOptional<z.ZodString>;
1039
+ interrupted: z.ZodOptional<z.ZodLiteral<true>>;
1040
+ }, z.core.$strict> | z.ZodObject<{
1041
+ resetId: z.ZodString;
1042
+ workIds: z.ZodArray<z.ZodString>;
1043
+ by: z.ZodEnum<{
1044
+ operator: "operator";
1045
+ host: "host";
1046
+ }>;
1047
+ settled: z.ZodNumber;
1048
+ reasonLength: z.ZodNumber;
1022
1049
  }, z.core.$strict> | z.ZodObject<{
1023
1050
  digest: z.ZodString;
1024
1051
  generation: z.ZodNumber;
@@ -1142,7 +1169,7 @@ export declare const runEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1142
1169
  workId: z.ZodOptional<z.ZodString>;
1143
1170
  runId: z.ZodOptional<z.ZodString>;
1144
1171
  attempt: z.ZodOptional<z.ZodNumber>;
1145
- type: z.ZodLiteral<"graph.registered" | "graph.reviewed" | "graph.approved" | "work.ready" | "work.held" | "attempt.claimed" | "attempt.phase" | "attempt.gate" | "attempt.review" | "attempt.stage" | "attempt.liveness" | "attempt.failed" | "attempt.diagnosed" | "attempt.expired" | "attempt.cancelled" | "attempt.recovered" | "work.accepted" | "work.retried" | "work.cancelled" | "work.blocked" | "control.paused" | "control.resumed" | "controller.acquired" | "base.moved" | "controller.released" | "budget.blocked" | "corpus.adopted" | "work.recovery" | "joint.started" | "joint.liveness" | "joint.finished" | "policy.applied" | "policy.reconfigure" | "input.requested" | "input.answered" | "input.applied" | "input.closed" | "input.stale" | "input.delivered" | "attempt.assumptions" | "delivery.pending" | "delivery.delivered" | "delivery.failed" | "delivery.conflict" | "delivery.uncertain">;
1172
+ type: z.ZodLiteral<"graph.registered" | "graph.reviewed" | "graph.approved" | "work.ready" | "work.held" | "attempt.claimed" | "attempt.phase" | "attempt.gate" | "attempt.review" | "attempt.stage" | "attempt.liveness" | "attempt.failed" | "attempt.diagnosed" | "attempt.expired" | "attempt.cancelled" | "attempt.recovered" | "work.accepted" | "work.retried" | "work.cancelled" | "work.blocked" | "control.paused" | "control.resumed" | "controller.acquired" | "base.moved" | "controller.released" | "budget.blocked" | "corpus.adopted" | "work.recovery" | "joint.started" | "joint.liveness" | "joint.finished" | "joint.budget-reset" | "policy.applied" | "policy.reconfigure" | "input.requested" | "input.answered" | "input.applied" | "input.closed" | "input.stale" | "input.delivered" | "attempt.assumptions" | "delivery.pending" | "delivery.delivered" | "delivery.failed" | "delivery.conflict" | "delivery.uncertain">;
1146
1173
  payload: z.ZodObject<{
1147
1174
  digest: z.ZodString;
1148
1175
  orders: z.ZodNumber;
@@ -1210,6 +1237,7 @@ export declare const runEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1210
1237
  passed: z.ZodBoolean;
1211
1238
  evidenceId: z.ZodString;
1212
1239
  consumer: z.ZodOptional<z.ZodString>;
1240
+ notApplicable: z.ZodOptional<z.ZodLiteral<true>>;
1213
1241
  recheck: z.ZodOptional<z.ZodObject<{
1214
1242
  of: z.ZodString;
1215
1243
  outcome: z.ZodEnum<{
@@ -1507,6 +1535,16 @@ export declare const runEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1507
1535
  }>;
1508
1536
  manifestDigest: z.ZodOptional<z.ZodString>;
1509
1537
  error: z.ZodOptional<z.ZodString>;
1538
+ interrupted: z.ZodOptional<z.ZodLiteral<true>>;
1539
+ }, z.core.$strict> | z.ZodObject<{
1540
+ resetId: z.ZodString;
1541
+ workIds: z.ZodArray<z.ZodString>;
1542
+ by: z.ZodEnum<{
1543
+ operator: "operator";
1544
+ host: "host";
1545
+ }>;
1546
+ settled: z.ZodNumber;
1547
+ reasonLength: z.ZodNumber;
1510
1548
  }, z.core.$strict> | z.ZodObject<{
1511
1549
  digest: z.ZodString;
1512
1550
  generation: z.ZodNumber;
@@ -1660,7 +1698,7 @@ export declare const readRunEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1660
1698
  workId: z.ZodOptional<z.ZodString>;
1661
1699
  runId: z.ZodOptional<z.ZodString>;
1662
1700
  attempt: z.ZodOptional<z.ZodNumber>;
1663
- type: z.ZodLiteral<"graph.registered" | "graph.reviewed" | "graph.approved" | "work.ready" | "work.held" | "attempt.claimed" | "attempt.phase" | "attempt.gate" | "attempt.review" | "attempt.stage" | "attempt.liveness" | "attempt.failed" | "attempt.diagnosed" | "attempt.expired" | "attempt.cancelled" | "attempt.recovered" | "work.accepted" | "work.retried" | "work.cancelled" | "work.blocked" | "control.paused" | "control.resumed" | "controller.acquired" | "base.moved" | "controller.released" | "budget.blocked" | "corpus.adopted" | "work.recovery" | "joint.started" | "joint.liveness" | "joint.finished" | "policy.applied" | "policy.reconfigure" | "input.requested" | "input.answered" | "input.applied" | "input.closed" | "input.stale" | "input.delivered" | "attempt.assumptions" | "delivery.pending" | "delivery.delivered" | "delivery.failed" | "delivery.conflict" | "delivery.uncertain">;
1701
+ type: z.ZodLiteral<"graph.registered" | "graph.reviewed" | "graph.approved" | "work.ready" | "work.held" | "attempt.claimed" | "attempt.phase" | "attempt.gate" | "attempt.review" | "attempt.stage" | "attempt.liveness" | "attempt.failed" | "attempt.diagnosed" | "attempt.expired" | "attempt.cancelled" | "attempt.recovered" | "work.accepted" | "work.retried" | "work.cancelled" | "work.blocked" | "control.paused" | "control.resumed" | "controller.acquired" | "base.moved" | "controller.released" | "budget.blocked" | "corpus.adopted" | "work.recovery" | "joint.started" | "joint.liveness" | "joint.finished" | "joint.budget-reset" | "policy.applied" | "policy.reconfigure" | "input.requested" | "input.answered" | "input.applied" | "input.closed" | "input.stale" | "input.delivered" | "attempt.assumptions" | "delivery.pending" | "delivery.delivered" | "delivery.failed" | "delivery.conflict" | "delivery.uncertain">;
1664
1702
  payload: z.ZodObject<{
1665
1703
  digest: z.ZodString;
1666
1704
  orders: z.ZodNumber;
@@ -1728,6 +1766,7 @@ export declare const readRunEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1728
1766
  passed: z.ZodBoolean;
1729
1767
  evidenceId: z.ZodString;
1730
1768
  consumer: z.ZodOptional<z.ZodString>;
1769
+ notApplicable: z.ZodOptional<z.ZodLiteral<true>>;
1731
1770
  recheck: z.ZodOptional<z.ZodObject<{
1732
1771
  of: z.ZodString;
1733
1772
  outcome: z.ZodEnum<{
@@ -2025,6 +2064,16 @@ export declare const readRunEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
2025
2064
  }>;
2026
2065
  manifestDigest: z.ZodOptional<z.ZodString>;
2027
2066
  error: z.ZodOptional<z.ZodString>;
2067
+ interrupted: z.ZodOptional<z.ZodLiteral<true>>;
2068
+ }, z.core.$strict> | z.ZodObject<{
2069
+ resetId: z.ZodString;
2070
+ workIds: z.ZodArray<z.ZodString>;
2071
+ by: z.ZodEnum<{
2072
+ operator: "operator";
2073
+ host: "host";
2074
+ }>;
2075
+ settled: z.ZodNumber;
2076
+ reasonLength: z.ZodNumber;
2028
2077
  }, z.core.$strict> | z.ZodObject<{
2029
2078
  digest: z.ZodString;
2030
2079
  generation: z.ZodNumber;
@@ -2148,7 +2197,7 @@ export declare const readRunEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
2148
2197
  workId: z.ZodOptional<z.ZodString>;
2149
2198
  runId: z.ZodOptional<z.ZodString>;
2150
2199
  attempt: z.ZodOptional<z.ZodNumber>;
2151
- type: z.ZodLiteral<"graph.registered" | "graph.reviewed" | "graph.approved" | "work.ready" | "work.held" | "attempt.claimed" | "attempt.phase" | "attempt.gate" | "attempt.review" | "attempt.stage" | "attempt.liveness" | "attempt.failed" | "attempt.diagnosed" | "attempt.expired" | "attempt.cancelled" | "attempt.recovered" | "work.accepted" | "work.retried" | "work.cancelled" | "work.blocked" | "control.paused" | "control.resumed" | "controller.acquired" | "base.moved" | "controller.released" | "budget.blocked" | "corpus.adopted" | "work.recovery" | "joint.started" | "joint.liveness" | "joint.finished" | "policy.applied" | "policy.reconfigure" | "input.requested" | "input.answered" | "input.applied" | "input.closed" | "input.stale" | "input.delivered" | "attempt.assumptions" | "delivery.pending" | "delivery.delivered" | "delivery.failed" | "delivery.conflict" | "delivery.uncertain">;
2200
+ type: z.ZodLiteral<"graph.registered" | "graph.reviewed" | "graph.approved" | "work.ready" | "work.held" | "attempt.claimed" | "attempt.phase" | "attempt.gate" | "attempt.review" | "attempt.stage" | "attempt.liveness" | "attempt.failed" | "attempt.diagnosed" | "attempt.expired" | "attempt.cancelled" | "attempt.recovered" | "work.accepted" | "work.retried" | "work.cancelled" | "work.blocked" | "control.paused" | "control.resumed" | "controller.acquired" | "base.moved" | "controller.released" | "budget.blocked" | "corpus.adopted" | "work.recovery" | "joint.started" | "joint.liveness" | "joint.finished" | "joint.budget-reset" | "policy.applied" | "policy.reconfigure" | "input.requested" | "input.answered" | "input.applied" | "input.closed" | "input.stale" | "input.delivered" | "attempt.assumptions" | "delivery.pending" | "delivery.delivered" | "delivery.failed" | "delivery.conflict" | "delivery.uncertain">;
2152
2201
  payload: z.ZodObject<{
2153
2202
  digest: z.ZodString;
2154
2203
  orders: z.ZodNumber;
@@ -2216,6 +2265,7 @@ export declare const readRunEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
2216
2265
  passed: z.ZodBoolean;
2217
2266
  evidenceId: z.ZodString;
2218
2267
  consumer: z.ZodOptional<z.ZodString>;
2268
+ notApplicable: z.ZodOptional<z.ZodLiteral<true>>;
2219
2269
  recheck: z.ZodOptional<z.ZodObject<{
2220
2270
  of: z.ZodString;
2221
2271
  outcome: z.ZodEnum<{
@@ -2513,6 +2563,16 @@ export declare const readRunEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
2513
2563
  }>;
2514
2564
  manifestDigest: z.ZodOptional<z.ZodString>;
2515
2565
  error: z.ZodOptional<z.ZodString>;
2566
+ interrupted: z.ZodOptional<z.ZodLiteral<true>>;
2567
+ }, z.core.$strict> | z.ZodObject<{
2568
+ resetId: z.ZodString;
2569
+ workIds: z.ZodArray<z.ZodString>;
2570
+ by: z.ZodEnum<{
2571
+ operator: "operator";
2572
+ host: "host";
2573
+ }>;
2574
+ settled: z.ZodNumber;
2575
+ reasonLength: z.ZodNumber;
2516
2576
  }, z.core.$strict> | z.ZodObject<{
2517
2577
  digest: z.ZodString;
2518
2578
  generation: z.ZodNumber;
@@ -2657,6 +2717,6 @@ export type RunEventDraft = {
2657
2717
  * остановки очереди), поэтому harness использует те же имена, а не новые.
2658
2718
  * `heartbeat` продлевает сроки и события не создаёт.
2659
2719
  */
2660
- export declare const transactionKinds: readonly ["run.claimed", "heartbeat", "run.heartbeat-failed", "run.phase", "run.context", "run.dependencies", "run.dependency-freshness", "run.consumer-checked", "run.implementation-basis", "run.partial", "run.continuation", "run.model", "run.timing.started", "run.timing.finished", "run.liveness", "evidence.recorded", "reproduction.recorded", "findings.recorded", "task.done", "run.failed", "run.recovered", "recovery.rejected", "runs.expired", "task.retry", "task.cancelled", "task.held", "task.released", "task.hold-transferred", "wait.started", "wait.cleared", "recovery.reserved", "recovery.decided", "recovery.applied", "recovery.interrupted", "scheduler.started", "scheduler.paused", "scheduler.released", "scheduler.error", "scheduler.blockers", "config.started", "config.reconfigured", "config.reconfigure-requested", "config.reconfigure-cleared", "graph.registered", "graph.reviewed", "graph.approved", "delivery.recorded", "workspace.verification.started", "workspace.manifest", "workspace.evidence", "workspace.verified", "workspace.failed", "workspace.liveness", "base.moved", "workflow.updated", "usage.recorded", "checks.recorded", "checks.adopted", "checks.awaiting-operator", "checks.adoption-abandoned", "checks.spike", "input.answered", "input.applied", "input.closed", "input.delivered"];
2720
+ export declare const transactionKinds: readonly ["run.claimed", "heartbeat", "run.heartbeat-failed", "run.phase", "run.context", "run.dependencies", "run.dependency-freshness", "run.consumer-checked", "run.implementation-basis", "run.partial", "run.continuation", "run.model", "run.timing.started", "run.timing.finished", "run.liveness", "evidence.recorded", "reproduction.recorded", "findings.recorded", "task.done", "run.failed", "run.recovered", "recovery.rejected", "runs.expired", "task.retry", "task.cancelled", "task.held", "task.released", "task.hold-transferred", "wait.started", "wait.cleared", "recovery.reserved", "recovery.decided", "recovery.applied", "recovery.interrupted", "scheduler.started", "scheduler.paused", "scheduler.released", "scheduler.error", "scheduler.blockers", "config.started", "config.reconfigured", "config.reconfigure-requested", "config.reconfigure-cleared", "graph.registered", "graph.reviewed", "graph.approved", "delivery.recorded", "workspace.verification.started", "workspace.manifest", "workspace.evidence", "workspace.verified", "workspace.failed", "workspace.liveness", "workspace.budget-reset", "base.moved", "workflow.updated", "usage.recorded", "checks.recorded", "checks.adopted", "checks.awaiting-operator", "checks.adoption-abandoned", "checks.spike", "input.answered", "input.applied", "input.closed", "input.delivered"];
2661
2721
  export type TransactionKind = (typeof transactionKinds)[number];
2662
2722
  export {};
@@ -2,7 +2,7 @@ import { z } from 'zod';
2
2
  import { API_VERSION } from "./version.js";
3
3
  import { digestSchema, gitShaSchema, idSchema, isoTimeSchema, runtimeNameSchema, } from "./primitives.js";
4
4
  import { sourceRefSchema } from "./work.js";
5
- import { activitySchema, failureKindSchema, livenessStateSchema, stallActionSchema, workStatusSchema, } from "./execution.js";
5
+ import { activitySchema, failureKindSchema, jointResetActors, livenessStateSchema, stallActionSchema, workStatusSchema, } from "./execution.js";
6
6
  import { inputFloorSchema, inputRequestSchema } from "./input.js";
7
7
  const inputRequestId = inputRequestSchema.shape.id;
8
8
  const sha = gitShaSchema;
@@ -115,6 +115,8 @@ export const eventPayloads = {
115
115
  passed: z.boolean(),
116
116
  evidenceId: z.string().min(1).max(200),
117
117
  consumer: idSchema.optional(),
118
+ /** Gate с `when.paths` не исполнялся: diff фазы его не задел (не PASS и не провал). */
119
+ notApplicable: z.literal(true).optional(),
118
120
  /** Повтор провала интеграции: повторённая запись и исход. */
119
121
  recheck: z
120
122
  .strictObject({
@@ -262,6 +264,19 @@ export const eventPayloads = {
262
264
  status: z.enum(['passed', 'failed']),
263
265
  manifestDigest: digestSchema.optional(),
264
266
  error: text.optional(),
267
+ /** Прервана до результата gates (остановка, потеря владения): предел не тратит. */
268
+ interrupted: z.literal(true).optional(),
269
+ }),
270
+ /**
271
+ * Явный сброс бюджета совместных проверок набора: `settled` завершённых
272
+ * проверок больше не тратят его предел. Текст причины — в записи сброса.
273
+ */
274
+ 'joint.budget-reset': z.strictObject({
275
+ resetId: z.string().min(1).max(200),
276
+ workIds: z.array(idSchema).max(500),
277
+ by: z.enum(jointResetActors),
278
+ settled: z.number().int().min(0),
279
+ reasonLength: z.number().int().min(0),
265
280
  }),
266
281
  /** Политика стала применённой: запуском процесса или операцией reconfigure. */
267
282
  'policy.applied': z.strictObject({
@@ -464,6 +479,8 @@ export const transactionKinds = [
464
479
  'workspace.verified',
465
480
  'workspace.failed',
466
481
  'workspace.liveness',
482
+ /** Явный сброс бюджета совместных проверок набора (`joint.budget-reset`). */
483
+ 'workspace.budget-reset',
467
484
  /**
468
485
  * Сдвиг ref базы внутри транзакции проверки владения: проверка, синхронный
469
486
  * `git update-ref` и событие `base.moved`; записей нет.
@@ -332,6 +332,7 @@ export declare const evidenceRecordSchema: z.ZodObject<{
332
332
  kind: z.ZodEnum<{
333
333
  review: "review";
334
334
  test: "test";
335
+ "not-applicable": "not-applicable";
335
336
  }>;
336
337
  phase: z.ZodEnum<{
337
338
  candidate: "candidate";
@@ -572,6 +573,18 @@ export declare const evidenceRecordSchema: z.ZodObject<{
572
573
  skippedMore: z.ZodOptional<z.ZodNumber>;
573
574
  }, z.core.$strict>>;
574
575
  checks: z.ZodOptional<z.ZodString>;
576
+ gateBasis: z.ZodOptional<z.ZodString>;
577
+ notApplicable: z.ZodOptional<z.ZodObject<{
578
+ gateDigest: z.ZodString;
579
+ patterns: z.ZodArray<z.ZodString>;
580
+ ranges: z.ZodArray<z.ZodObject<{
581
+ from: z.ZodString;
582
+ to: z.ZodString;
583
+ }, z.core.$strict>>;
584
+ count: z.ZodNumber;
585
+ files: z.ZodArray<z.ZodString>;
586
+ pathsDigest: z.ZodString;
587
+ }, z.core.$strict>>;
575
588
  alreadySatisfied: z.ZodOptional<z.ZodObject<{
576
589
  gates: z.ZodArray<z.ZodString>;
577
590
  evidence: z.ZodString;
@@ -992,6 +1005,7 @@ export declare const attemptStateSchema: z.ZodObject<{
992
1005
  kind: z.ZodEnum<{
993
1006
  review: "review";
994
1007
  test: "test";
1008
+ "not-applicable": "not-applicable";
995
1009
  }>;
996
1010
  phase: z.ZodEnum<{
997
1011
  candidate: "candidate";
@@ -1232,6 +1246,18 @@ export declare const attemptStateSchema: z.ZodObject<{
1232
1246
  skippedMore: z.ZodOptional<z.ZodNumber>;
1233
1247
  }, z.core.$strict>>;
1234
1248
  checks: z.ZodOptional<z.ZodString>;
1249
+ gateBasis: z.ZodOptional<z.ZodString>;
1250
+ notApplicable: z.ZodOptional<z.ZodObject<{
1251
+ gateDigest: z.ZodString;
1252
+ patterns: z.ZodArray<z.ZodString>;
1253
+ ranges: z.ZodArray<z.ZodObject<{
1254
+ from: z.ZodString;
1255
+ to: z.ZodString;
1256
+ }, z.core.$strict>>;
1257
+ count: z.ZodNumber;
1258
+ files: z.ZodArray<z.ZodString>;
1259
+ pathsDigest: z.ZodString;
1260
+ }, z.core.$strict>>;
1235
1261
  alreadySatisfied: z.ZodOptional<z.ZodObject<{
1236
1262
  gates: z.ZodArray<z.ZodString>;
1237
1263
  evidence: z.ZodString;
@@ -2094,6 +2120,26 @@ export declare const reproductionRegistrySchema: z.ZodObject<{
2094
2120
  }, z.core.$strict>>;
2095
2121
  }, z.core.$strict>;
2096
2122
  export declare const MAX_REPRODUCTIONS = 500;
2123
+ /** Кто сбросил бюджет совместных проверок (`joint.budget-reset`). */
2124
+ export declare const jointResetActors: readonly ["operator", "host"];
2125
+ export type JointResetActor = (typeof jointResetActors)[number];
2126
+ /**
2127
+ * Явный сброс бюджета совместных проверок набора (`engine.jointBudgetReset`):
2128
+ * завершённые к этому моменту проверки набора больше не тратят его предел.
2129
+ * Граница — снимок ID этих проверок, а не время: откат часов её не сдвигает.
2130
+ */
2131
+ export declare const jointBudgetResetSchema: z.ZodObject<{
2132
+ id: z.ZodString;
2133
+ at: z.ZodISODateTime;
2134
+ workIds: z.ZodArray<z.ZodString>;
2135
+ reason: z.ZodString;
2136
+ actor: z.ZodEnum<{
2137
+ operator: "operator";
2138
+ host: "host";
2139
+ }>;
2140
+ settledVerificationIds: z.ZodArray<z.ZodString>;
2141
+ }, z.core.$strict>;
2142
+ export type JointBudgetReset = z.infer<typeof jointBudgetResetSchema>;
2097
2143
  export declare const localSchemas: {
2098
2144
  /** Учёт вызовов моделей. */
2099
2145
  readonly usage: z.ZodObject<{
@@ -2808,6 +2854,21 @@ export declare const localSchemas: {
2808
2854
  normalized: z.ZodOptional<z.ZodArray<z.ZodString>>;
2809
2855
  version: z.ZodNumber;
2810
2856
  }, z.core.$strict>;
2857
+ /**
2858
+ * Явные сбросы бюджета совместных проверок (`JointBudgetReset`) по ID сброса,
2859
+ * у `@workspace`. Пишет только `engine.jointBudgetReset`.
2860
+ */
2861
+ readonly 'joint-budget-resets': z.ZodObject<{
2862
+ id: z.ZodString;
2863
+ at: z.ZodISODateTime;
2864
+ workIds: z.ZodArray<z.ZodString>;
2865
+ reason: z.ZodString;
2866
+ actor: z.ZodEnum<{
2867
+ operator: "operator";
2868
+ host: "host";
2869
+ }>;
2870
+ settledVerificationIds: z.ZodArray<z.ZodString>;
2871
+ }, z.core.$strict>;
2811
2872
  };
2812
2873
  export type LocalNamespace = keyof typeof localSchemas;
2813
2874
  export type LocalValue<N extends LocalNamespace> = z.infer<(typeof localSchemas)[N]>;
@@ -2889,6 +2950,7 @@ export declare const jointVerificationStateSchema: z.ZodDiscriminatedUnion<[z.Zo
2889
2950
  }, z.core.$strict>>>;
2890
2951
  manifestDigest: z.ZodOptional<z.ZodString>;
2891
2952
  error: z.ZodString;
2953
+ interrupted: z.ZodOptional<z.ZodLiteral<true>>;
2892
2954
  apiVersion: z.ZodLiteral<"devcontour-harness/v1alpha1">;
2893
2955
  id: z.ZodString;
2894
2956
  startedAt: z.ZodISODateTime;
@@ -3629,6 +3691,7 @@ export declare const executionDocumentSchema: z.ZodObject<{
3629
3691
  kind: z.ZodEnum<{
3630
3692
  review: "review";
3631
3693
  test: "test";
3694
+ "not-applicable": "not-applicable";
3632
3695
  }>;
3633
3696
  phase: z.ZodEnum<{
3634
3697
  candidate: "candidate";
@@ -3869,6 +3932,18 @@ export declare const executionDocumentSchema: z.ZodObject<{
3869
3932
  skippedMore: z.ZodOptional<z.ZodNumber>;
3870
3933
  }, z.core.$strict>>;
3871
3934
  checks: z.ZodOptional<z.ZodString>;
3935
+ gateBasis: z.ZodOptional<z.ZodString>;
3936
+ notApplicable: z.ZodOptional<z.ZodObject<{
3937
+ gateDigest: z.ZodString;
3938
+ patterns: z.ZodArray<z.ZodString>;
3939
+ ranges: z.ZodArray<z.ZodObject<{
3940
+ from: z.ZodString;
3941
+ to: z.ZodString;
3942
+ }, z.core.$strict>>;
3943
+ count: z.ZodNumber;
3944
+ files: z.ZodArray<z.ZodString>;
3945
+ pathsDigest: z.ZodString;
3946
+ }, z.core.$strict>>;
3872
3947
  alreadySatisfied: z.ZodOptional<z.ZodObject<{
3873
3948
  gates: z.ZodArray<z.ZodString>;
3874
3949
  evidence: z.ZodString;
@@ -3962,6 +4037,7 @@ export declare const executionDocumentSchema: z.ZodObject<{
3962
4037
  }, z.core.$strict>>>;
3963
4038
  manifestDigest: z.ZodOptional<z.ZodString>;
3964
4039
  error: z.ZodString;
4040
+ interrupted: z.ZodOptional<z.ZodLiteral<true>>;
3965
4041
  apiVersion: z.ZodLiteral<"devcontour-harness/v1alpha1">;
3966
4042
  id: z.ZodString;
3967
4043
  startedAt: z.ZodISODateTime;
@@ -3,7 +3,7 @@ import { STATE_VERSION } from "./version.js";
3
3
  import { digestSchema, gitShaSchema, idSchema, isoTimeSchema, relativePathSchema, runtimeNameSchema, trimmedText, gateScopeSchema, } from "./primitives.js";
4
4
  import { workGraphSchema, workOrderSchema } from "./work.js";
5
5
  import { contextPinSchema, contextSnapshotSchema } from "./context.js";
6
- import { deliveryStateSchema, gateArtifactFilesSchema, jointActiveSchema, jointFailedSchema, jointPassedSchema, } from "./result.js";
6
+ import { deliveryStateSchema, gateApplicabilitySchema, gateArtifactFilesSchema, jointActiveSchema, jointFailedSchema, jointPassedSchema, } from "./result.js";
7
7
  import { findingStatuses, reviewRecordSchema, reviewRoundSchema } from "./review.js";
8
8
  import { contractDocumentSchema, spikeSchema } from "./checks.js";
9
9
  import { INPUT_LIMITS, inputPolicySchema, inputRequestSchema, recordedAssumptionSchema, } from "./input.js";
@@ -288,7 +288,11 @@ export const evidenceFindingSchema = z.strictObject({
288
288
  export const evidenceRecordSchema = z.strictObject({
289
289
  id: z.string().min(1).max(200),
290
290
  runId: z.string().min(1).max(200),
291
- kind: z.enum(['test', 'review']),
291
+ /**
292
+ * `not-applicable` — gate с `when.paths` не исполнялся: diff фазы его не
293
+ * задел (`notApplicable`). Такая запись всегда `passed: false` и не PASS.
294
+ */
295
+ kind: z.enum(['test', 'review', 'not-applicable']),
292
296
  phase: z.enum(['candidate', 'integration']),
293
297
  sha: gitShaSchema,
294
298
  /** ID gate; для ревью — `independent-review`. */
@@ -331,6 +335,15 @@ export const evidenceRecordSchema = z.strictObject({
331
335
  artifactFiles: gateArtifactFilesSchema.optional(),
332
336
  /** Действующая версия проверок, под которой получено evidence. */
333
337
  checks: digestSchema.optional(),
338
+ /**
339
+ * Основание исполнения gate с `when` (`gateBasis`: определение, ресурсы,
340
+ * окружение, подготовка, изоляция, версия harness) у собственной записи
341
+ * `test` попытки: по нему ищется последний зелёный SHA gate. Нет у gates
342
+ * без `when` и у прежних записей.
343
+ */
344
+ gateBasis: digestSchema.optional(),
345
+ /** Только у записи `not-applicable`: правило и diff, по которым gate не исполнялся. */
346
+ notApplicable: gateApplicabilitySchema.optional(),
334
347
  /**
335
348
  * Ревью попытки без изменений подтвердило, что приёмка уже выполнена на
336
349
  * базе: gates, на которые сослался reviewer, и его основание.
@@ -1033,6 +1046,21 @@ export const reproductionRegistrySchema = z.strictObject({
1033
1046
  items: z.array(reproductionRecordSchema).max(500),
1034
1047
  });
1035
1048
  export const MAX_REPRODUCTIONS = 500;
1049
+ /** Кто сбросил бюджет совместных проверок (`joint.budget-reset`). */
1050
+ export const jointResetActors = ['operator', 'host'];
1051
+ /**
1052
+ * Явный сброс бюджета совместных проверок набора (`engine.jointBudgetReset`):
1053
+ * завершённые к этому моменту проверки набора больше не тратят его предел.
1054
+ * Граница — снимок ID этих проверок, а не время: откат часов её не сдвигает.
1055
+ */
1056
+ export const jointBudgetResetSchema = z.strictObject({
1057
+ id: z.string().min(1).max(200),
1058
+ at: isoTimeSchema,
1059
+ workIds: z.array(idSchema).min(1).max(500),
1060
+ reason: z.string().trim().min(1).max(2000),
1061
+ actor: z.enum(jointResetActors),
1062
+ settledVerificationIds: z.array(z.string().min(1).max(200)).min(1).max(10_000),
1063
+ });
1036
1064
  export const localSchemas = {
1037
1065
  /** Учёт вызовов моделей. */
1038
1066
  usage: callRecordSchema,
@@ -1073,6 +1101,11 @@ export const localSchemas = {
1073
1101
  * отдаёт её в списке без владельца с `owner` и `key` (`executionStoreContract`).
1074
1102
  */
1075
1103
  'input-requests': inputRequestSchema,
1104
+ /**
1105
+ * Явные сбросы бюджета совместных проверок (`JointBudgetReset`) по ID сброса,
1106
+ * у `@workspace`. Пишет только `engine.jointBudgetReset`.
1107
+ */
1108
+ 'joint-budget-resets': jointBudgetResetSchema,
1076
1109
  };
1077
1110
  /* ------------------------------------------------------------------ */
1078
1111
  /* Документ standalone */
@@ -29,6 +29,22 @@ export declare const lifecycleSchema: z.ZodObject<{
29
29
  timeoutMs: z.ZodDefault<z.ZodNumber>;
30
30
  }, z.core.$strict>>;
31
31
  }, z.core.$strict>;
32
+ /**
33
+ * Почему шаблон пути `when.paths` недопустим, или undefined. Шаблон —
34
+ * относительный POSIX-glob от корня репозитория: `**`, `*`, `?` и `{a,b}` без
35
+ * вложенности; без `..`, `.`, пустых сегментов, ведущего `/`, обратной
36
+ * косой черты, отрицания и классов символов.
37
+ */
38
+ export declare function gatePathPatternProblem(pattern: string): string | undefined;
39
+ /**
40
+ * Условие применимости gate задачи: gate исполняется, только когда настоящий
41
+ * diff фазы (из Git, не заявление исполнителя) задевает один из путей или
42
+ * неявный вход gate; иначе пишется запись `not-applicable`, которая не PASS.
43
+ * Необязательное поле без умолчания: политика без него сохраняет digest.
44
+ */
45
+ export declare const gateWhenSchema: z.ZodObject<{
46
+ paths: z.ZodArray<z.ZodString>;
47
+ }, z.core.$strict>;
32
48
  export declare const gateSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
33
49
  kind: z.ZodLiteral<"test">;
34
50
  report: z.ZodObject<{
@@ -36,6 +52,9 @@ export declare const gateSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
36
52
  path: z.ZodString;
37
53
  }, z.core.$strict>;
38
54
  artifacts: z.ZodOptional<z.ZodArray<z.ZodString>>;
55
+ when: z.ZodOptional<z.ZodObject<{
56
+ paths: z.ZodArray<z.ZodString>;
57
+ }, z.core.$strict>>;
39
58
  id: z.ZodString;
40
59
  command: z.ZodArray<z.ZodString>;
41
60
  timeoutMs: z.ZodDefault<z.ZodNumber>;
@@ -52,6 +71,9 @@ export declare const gateSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
52
71
  path: z.ZodString;
53
72
  }, z.core.$strict>>;
54
73
  artifacts: z.ZodOptional<z.ZodArray<z.ZodString>>;
74
+ when: z.ZodOptional<z.ZodObject<{
75
+ paths: z.ZodArray<z.ZodString>;
76
+ }, z.core.$strict>>;
55
77
  id: z.ZodString;
56
78
  command: z.ZodArray<z.ZodString>;
57
79
  timeoutMs: z.ZodDefault<z.ZodNumber>;
@@ -63,6 +85,11 @@ export declare const gateSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
63
85
  resources: z.ZodOptional<z.ZodArray<z.ZodString>>;
64
86
  }, z.core.$strict>], "kind">;
65
87
  export type GatePolicy = z.infer<typeof gateSchema>;
88
+ /**
89
+ * Digest определения gate задачи (с `when`): под ним записывается решение о
90
+ * применимости. Смена команды, путей или любого поля — другой digest.
91
+ */
92
+ export declare const gateDigest: (gate: GatePolicy) => string;
66
93
  /** Группы gates: не больше 100 групп по 100 ссылок, члены — gates или группы (`@имя`). */
67
94
  export declare const gateGroupsSchema: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>;
68
95
  /** Gate совместной проверки: выполняется в дереве `repositoryId`, сохраняет `artifacts`. */
@@ -337,6 +364,9 @@ export declare const repositoryPolicySchema: z.ZodObject<{
337
364
  path: z.ZodString;
338
365
  }, z.core.$strict>;
339
366
  artifacts: z.ZodOptional<z.ZodArray<z.ZodString>>;
367
+ when: z.ZodOptional<z.ZodObject<{
368
+ paths: z.ZodArray<z.ZodString>;
369
+ }, z.core.$strict>>;
340
370
  id: z.ZodString;
341
371
  command: z.ZodArray<z.ZodString>;
342
372
  timeoutMs: z.ZodDefault<z.ZodNumber>;
@@ -353,6 +383,9 @@ export declare const repositoryPolicySchema: z.ZodObject<{
353
383
  path: z.ZodString;
354
384
  }, z.core.$strict>>;
355
385
  artifacts: z.ZodOptional<z.ZodArray<z.ZodString>>;
386
+ when: z.ZodOptional<z.ZodObject<{
387
+ paths: z.ZodArray<z.ZodString>;
388
+ }, z.core.$strict>>;
356
389
  id: z.ZodString;
357
390
  command: z.ZodArray<z.ZodString>;
358
391
  timeoutMs: z.ZodDefault<z.ZodNumber>;
@@ -600,6 +633,9 @@ export declare const executionPolicySchema: z.ZodObject<{
600
633
  path: z.ZodString;
601
634
  }, z.core.$strict>;
602
635
  artifacts: z.ZodOptional<z.ZodArray<z.ZodString>>;
636
+ when: z.ZodOptional<z.ZodObject<{
637
+ paths: z.ZodArray<z.ZodString>;
638
+ }, z.core.$strict>>;
603
639
  id: z.ZodString;
604
640
  command: z.ZodArray<z.ZodString>;
605
641
  timeoutMs: z.ZodDefault<z.ZodNumber>;
@@ -616,6 +652,9 @@ export declare const executionPolicySchema: z.ZodObject<{
616
652
  path: z.ZodString;
617
653
  }, z.core.$strict>>;
618
654
  artifacts: z.ZodOptional<z.ZodArray<z.ZodString>>;
655
+ when: z.ZodOptional<z.ZodObject<{
656
+ paths: z.ZodArray<z.ZodString>;
657
+ }, z.core.$strict>>;
619
658
  id: z.ZodString;
620
659
  command: z.ZodArray<z.ZodString>;
621
660
  timeoutMs: z.ZodDefault<z.ZodNumber>;
@@ -48,20 +48,76 @@ const junitReport = z.strictObject({ type: z.literal('junit'), path: relativePat
48
48
  * Необязательное поле без умолчания: политика без него сохраняет digest.
49
49
  */
50
50
  const gateArtifacts = z.array(relativePathSchema).min(1).max(gateArtifactLimits.paths).optional();
51
+ /**
52
+ * Почему шаблон пути `when.paths` недопустим, или undefined. Шаблон —
53
+ * относительный POSIX-glob от корня репозитория: `**`, `*`, `?` и `{a,b}` без
54
+ * вложенности; без `..`, `.`, пустых сегментов, ведущего `/`, обратной
55
+ * косой черты, отрицания и классов символов.
56
+ */
57
+ export function gatePathPatternProblem(pattern) {
58
+ if (pattern.startsWith('/'))
59
+ return 'шаблон пути не может быть абсолютным';
60
+ if (/[\\\0\[\]]/.test(pattern))
61
+ return 'обратная косая черта, NUL и [] в шаблоне не допускаются';
62
+ if (pattern.startsWith('!'))
63
+ return 'отрицание в шаблоне не поддерживается';
64
+ const body = pattern.endsWith('/') ? pattern.slice(0, -1) : pattern;
65
+ if (body.split('/').some((s) => s === '' || s === '.' || s === '..'))
66
+ return 'шаблон пути без пустых сегментов, . и ..';
67
+ // И внутри вариантов `{}`: `{..,x}` — тот же выход за корень.
68
+ if (body.split(/[/{},]/).some((s) => s === '.' || s === '..'))
69
+ return 'шаблон пути без . и .. и внутри {}';
70
+ let depth = 0;
71
+ for (const c of pattern) {
72
+ if (c === '{' && ++depth > 1)
73
+ return 'вложенные {} в шаблоне не поддерживаются';
74
+ if (c === '}' && --depth < 0)
75
+ return 'непарная } в шаблоне';
76
+ }
77
+ if (depth)
78
+ return 'непарная { в шаблоне';
79
+ return undefined;
80
+ }
81
+ const gatePathPattern = z
82
+ .string()
83
+ .min(1)
84
+ .max(200)
85
+ .superRefine((value, ctx) => {
86
+ const problem = gatePathPatternProblem(value);
87
+ if (problem)
88
+ ctx.addIssue({ code: 'custom', message: problem });
89
+ });
90
+ /**
91
+ * Условие применимости gate задачи: gate исполняется, только когда настоящий
92
+ * diff фазы (из Git, не заявление исполнителя) задевает один из путей или
93
+ * неявный вход gate; иначе пишется запись `not-applicable`, которая не PASS.
94
+ * Необязательное поле без умолчания: политика без него сохраняет digest.
95
+ */
96
+ export const gateWhenSchema = z.strictObject({
97
+ paths: z.array(gatePathPattern).min(1).max(64),
98
+ });
99
+ const gateWhen = gateWhenSchema.optional();
51
100
  export const gateSchema = z.discriminatedUnion('kind', [
52
101
  z.strictObject({
53
102
  ...gateCommon,
54
103
  kind: z.literal('test'),
55
104
  report: junitReport,
56
105
  artifacts: gateArtifacts,
106
+ when: gateWhen,
57
107
  }),
58
108
  z.strictObject({
59
109
  ...gateCommon,
60
110
  kind: z.literal('check'),
61
111
  report: junitReport.optional(),
62
112
  artifacts: gateArtifacts,
113
+ when: gateWhen,
63
114
  }),
64
115
  ]);
116
+ /**
117
+ * Digest определения gate задачи (с `when`): под ним записывается решение о
118
+ * применимости. Смена команды, путей или любого поля — другой digest.
119
+ */
120
+ export const gateDigest = (gate) => digestOf(gate);
65
121
  /** Группы gates: не больше 100 групп по 100 ссылок, члены — gates или группы (`@имя`). */
66
122
  export const gateGroupsSchema = z
67
123
  .record(idSchema, z.array(gateRefSchema).min(1).max(100))
@@ -494,6 +550,14 @@ export function policyIssues(policy) {
494
550
  gateChecks(repo.gates, ['repositories', r, 'gates']);
495
551
  if (!repo.gates.some((g) => g.kind === 'test'))
496
552
  add('INVALID_INPUT', ['repositories', r, 'gates'], 'Нужен хотя бы один test gate с JUnit report');
553
+ // Условие путей: хотя бы один test gate исполняется всегда, и генеративный
554
+ // gate условным не бывает (его seed и отчёт свойств — доказательство).
555
+ else if (!repo.gates.some((g) => g.kind === 'test' && !g.when))
556
+ add('INVALID_INPUT', ['repositories', r, 'gates'], 'Нужен хотя бы один test gate без when: все test gates не могут быть условными');
557
+ repo.gates.forEach((g, i) => {
558
+ if (g.when && g.property)
559
+ add('INVALID_INPUT', ['repositories', r, 'gates', i, 'when'], 'Генеративный gate (property) не может быть условным (when)');
560
+ });
497
561
  for (const group of Object.keys(repo.gateGroups ?? {}))
498
562
  try {
499
563
  expandGateRefs(repo, ['@' + group]);