@looply/core 0.5.10 → 0.5.12
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/delivery-settings.d.ts +68 -1
- package/dist/delivery-settings.d.ts.map +1 -1
- package/dist/delivery-settings.js +150 -10
- package/dist/delivery-settings.js.map +1 -1
- package/dist/environment.d.ts +73 -0
- package/dist/environment.d.ts.map +1 -0
- package/dist/environment.js +184 -0
- package/dist/environment.js.map +1 -0
- package/dist/goal.d.ts +21 -1
- package/dist/goal.d.ts.map +1 -1
- package/dist/goal.js +1 -0
- package/dist/goal.js.map +1 -1
- package/dist/ids.d.ts +2 -0
- package/dist/ids.d.ts.map +1 -1
- package/dist/ids.js +2 -0
- package/dist/ids.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/maintenance.d.ts +269 -0
- package/dist/maintenance.d.ts.map +1 -0
- package/dist/maintenance.js +826 -0
- package/dist/maintenance.js.map +1 -0
- package/dist/pursuit-end.d.ts +1 -1
- package/dist/pursuit-end.d.ts.map +1 -1
- package/dist/pursuit-end.js +6 -0
- package/dist/pursuit-end.js.map +1 -1
- package/dist/schedule.d.ts +11 -0
- package/dist/schedule.d.ts.map +1 -1
- package/dist/schedule.js +42 -0
- package/dist/schedule.js.map +1 -1
- package/package.json +1 -1
|
@@ -58,10 +58,34 @@ export declare function validateDeployConfig(x: unknown): {
|
|
|
58
58
|
because: string;
|
|
59
59
|
};
|
|
60
60
|
export declare function describeDeploy(d: DeployConfig | null | undefined): string;
|
|
61
|
+
/**
|
|
62
|
+
* ONE PLACE A MERGED CHANGE GOES — "QA", "production" — with its own deploy step.
|
|
63
|
+
*
|
|
64
|
+
* `environments` supersede the single `deploy` when present (`deploy` stays, meaning one unnamed
|
|
65
|
+
* environment). Deployed in order after the merge. At most one is `test`: the one a tester uses,
|
|
66
|
+
* which is what AutoRyn waits on before it moves a ticket to testing. `url` is where the app is
|
|
67
|
+
* (https only); GitHub's own deployment status may give a better one, which wins.
|
|
68
|
+
*/
|
|
69
|
+
export interface DeployEnvironment {
|
|
70
|
+
name: string;
|
|
71
|
+
test?: boolean;
|
|
72
|
+
url?: string | null;
|
|
73
|
+
deploy: DeployConfig;
|
|
74
|
+
}
|
|
75
|
+
export declare const MAX_ENVIRONMENTS = 5;
|
|
76
|
+
export declare function validateEnvironments(x: unknown): {
|
|
77
|
+
ok: true;
|
|
78
|
+
environments: DeployEnvironment[];
|
|
79
|
+
} | {
|
|
80
|
+
ok: false;
|
|
81
|
+
because: string;
|
|
82
|
+
};
|
|
61
83
|
export interface DeliverySettings {
|
|
62
84
|
deliver: DeliverMode;
|
|
63
85
|
/** Absent: none (or, under `deploy`, the config.yaml release step when one is declared). */
|
|
64
86
|
deploy?: DeployConfig;
|
|
87
|
+
/** Named environments, deployed in order; when present they supersede `deploy`. */
|
|
88
|
+
environments?: DeployEnvironment[];
|
|
65
89
|
}
|
|
66
90
|
export type DeliverySettingsValidation = {
|
|
67
91
|
ok: true;
|
|
@@ -85,8 +109,12 @@ export declare function validateDeliverySettings(x: unknown): DeliverySettingsVa
|
|
|
85
109
|
* deployed — merged, and the project's declared release step finished
|
|
86
110
|
* deploy-failed — merged, and the release step failed
|
|
87
111
|
* not-pushed — nothing left this machine (`note` says why)
|
|
112
|
+
* blocked — NOT merged, and Looply will not merge it — not on green checks, not on
|
|
113
|
+
* "Approve and ship": the pull request carries another goal's commits that are
|
|
114
|
+
* not merged into the base yet (`note` names them). Re-examined every pass; it
|
|
115
|
+
* unblocks by itself once that work is merged, or the branch is rebuilt without it.
|
|
88
116
|
*/
|
|
89
|
-
export declare const BRANCH_DELIVERY_STATES: readonly ["pushed", "pr-open", "waiting-checks", "checks-failed", "merged", "deployed", "deploy-failed", "not-pushed"];
|
|
117
|
+
export declare const BRANCH_DELIVERY_STATES: readonly ["pushed", "pr-open", "waiting-checks", "checks-failed", "merged", "deployed", "deploy-failed", "not-pushed", "blocked"];
|
|
90
118
|
export type BranchDeliveryState = (typeof BRANCH_DELIVERY_STATES)[number];
|
|
91
119
|
export interface BranchDeliveryReport {
|
|
92
120
|
state: BranchDeliveryState;
|
|
@@ -110,7 +138,46 @@ export interface BranchDeliveryReport {
|
|
|
110
138
|
ok: boolean;
|
|
111
139
|
detail: string;
|
|
112
140
|
} | null;
|
|
141
|
+
/** Where the merged commit is, per environment — absent when no environment is configured. */
|
|
142
|
+
environments?: EnvStatus[];
|
|
113
143
|
}
|
|
144
|
+
/**
|
|
145
|
+
* WHERE ONE ENVIRONMENT STANDS, TRUTHFULLY.
|
|
146
|
+
*
|
|
147
|
+
* waiting — not deployed, and nothing has started (not merged yet, or Looply does not deploy it)
|
|
148
|
+
* deploying — a deploy of this commit is in progress (GitHub says so, or the step is running)
|
|
149
|
+
* deployed — ONLY from a real result: a GitHub deployment status `success` for this commit in
|
|
150
|
+
* this environment, a `push` deploy whose git push exited 0, or a `run` step that
|
|
151
|
+
* exited 0. A merge alone is never "deployed".
|
|
152
|
+
* failed — the deploy of this commit failed (`detail` says how)
|
|
153
|
+
* unconfirmed — merged, and the merge should deploy it, but nothing has confirmed that it did
|
|
154
|
+
*
|
|
155
|
+
* `kind` is absent for a deploy; other rows (a preview, an app release) name theirs.
|
|
156
|
+
*/
|
|
157
|
+
export declare const ENV_STATES: readonly ["waiting", "deploying", "deployed", "failed", "unconfirmed"];
|
|
158
|
+
export type EnvState = (typeof ENV_STATES)[number];
|
|
159
|
+
export declare const ENV_ROW_KINDS: readonly ["deploy", "preview", "app-release"];
|
|
160
|
+
export type EnvRowKind = (typeof ENV_ROW_KINDS)[number];
|
|
161
|
+
export interface EnvStatus {
|
|
162
|
+
kind?: EnvRowKind;
|
|
163
|
+
name: string;
|
|
164
|
+
test: boolean;
|
|
165
|
+
state: EnvState;
|
|
166
|
+
/** The commit this row is about (the merge commit), or null before there is one. */
|
|
167
|
+
sha: string | null;
|
|
168
|
+
/** When the state was last established (ISO), or null. */
|
|
169
|
+
at: string | null;
|
|
170
|
+
/** Where the app is — GitHub's environment_url when it gave one, else the configured url. */
|
|
171
|
+
url: string | null;
|
|
172
|
+
detail: string | null;
|
|
173
|
+
}
|
|
174
|
+
export declare function validateEnvStatus(x: unknown): {
|
|
175
|
+
ok: true;
|
|
176
|
+
row: EnvStatus;
|
|
177
|
+
} | {
|
|
178
|
+
ok: false;
|
|
179
|
+
because: string;
|
|
180
|
+
};
|
|
114
181
|
/** A report a machine sent, checked once, the same way on both sides. */
|
|
115
182
|
export declare function validateBranchDeliveryReport(x: unknown): {
|
|
116
183
|
ok: true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delivery-settings.d.ts","sourceRoot":"","sources":["../src/delivery-settings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,eAAO,MAAM,aAAa,2CAA4C,CAAC;AACvE,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAEzD,qDAAqD;AACrD,eAAO,MAAM,oBAAoB,EAAE,WAAkB,CAAC;AAEtD,wBAAgB,aAAa,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,WAAW,CAE1D;AAED,0CAA0C;AAC1C;;;;;;;;;GASG;AACH,eAAO,MAAM,YAAY,mDAAoD,CAAC;AAC9E,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC;AACvD,MAAM,MAAM,YAAY,GACpB;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAChB;IAAE,IAAI,EAAE,eAAe,CAAA;CAAE,GACzB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAChD;IAAE,IAAI,EAAE,KAAK,CAAA;CAAE,CAAC;AAKpB,wBAAgB,oBAAoB,CAAC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IAC7F,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAID,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,OAAO,GAAG;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,GAAG,EAAE,SAAS,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAiC3G;AAKD,yEAAyE;AACzE,wBAAgB,4BAA4B,CAC1C,CAAC,EAAE,OAAO,GACT;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,oBAAoB,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAgE7E"}
|
|
@@ -23,11 +23,13 @@
|
|
|
23
23
|
* `branch-delivery.ts` and nothing here can loosen them.
|
|
24
24
|
*/
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.BRANCH_DELIVERY_STATES = exports.DEPLOY_KINDS = exports.DEFAULT_DELIVER_MODE = exports.DELIVER_MODES = void 0;
|
|
26
|
+
exports.ENV_ROW_KINDS = exports.ENV_STATES = exports.BRANCH_DELIVERY_STATES = exports.MAX_ENVIRONMENTS = exports.DEPLOY_KINDS = exports.DEFAULT_DELIVER_MODE = exports.DELIVER_MODES = void 0;
|
|
27
27
|
exports.isDeliverMode = isDeliverMode;
|
|
28
28
|
exports.validateDeployConfig = validateDeployConfig;
|
|
29
29
|
exports.describeDeploy = describeDeploy;
|
|
30
|
+
exports.validateEnvironments = validateEnvironments;
|
|
30
31
|
exports.validateDeliverySettings = validateDeliverySettings;
|
|
32
|
+
exports.validateEnvStatus = validateEnvStatus;
|
|
31
33
|
exports.validateBranchDeliveryReport = validateBranchDeliveryReport;
|
|
32
34
|
exports.DELIVER_MODES = ['pr', 'merge', 'deploy', 'off'];
|
|
33
35
|
/** Push and open a pull request; a person merges. */
|
|
@@ -81,6 +83,48 @@ function describeDeploy(d) {
|
|
|
81
83
|
return `push the merged commit to ${d.branch} on ${d.remote}`;
|
|
82
84
|
return "run the release step the project's .looply/config.yaml declares";
|
|
83
85
|
}
|
|
86
|
+
exports.MAX_ENVIRONMENTS = 5;
|
|
87
|
+
function validateEnvironments(x) {
|
|
88
|
+
if (!Array.isArray(x))
|
|
89
|
+
return { ok: false, because: 'must be a list of { name, deploy, test?, url? }' };
|
|
90
|
+
if (x.length > exports.MAX_ENVIRONMENTS)
|
|
91
|
+
return { ok: false, because: `at most ${exports.MAX_ENVIRONMENTS} environments` };
|
|
92
|
+
const out = [];
|
|
93
|
+
const names = new Set();
|
|
94
|
+
for (const [i, e] of x.entries()) {
|
|
95
|
+
if (typeof e !== 'object' || e === null || Array.isArray(e))
|
|
96
|
+
return { ok: false, because: `environment ${i + 1} must be an object` };
|
|
97
|
+
const o = e;
|
|
98
|
+
for (const k of Object.keys(o))
|
|
99
|
+
if (!['name', 'test', 'url', 'deploy'].includes(k))
|
|
100
|
+
return { ok: false, because: `"${k}" is not part of an environment` };
|
|
101
|
+
const name = o['name'];
|
|
102
|
+
if (typeof name !== 'string' || name.trim().length < 1 || name.length > 40)
|
|
103
|
+
return { ok: false, because: `environment ${i + 1}: name must be 1–40 characters` };
|
|
104
|
+
if (names.has(name.trim().toLowerCase()))
|
|
105
|
+
return { ok: false, because: `environment "${name}" is named twice` };
|
|
106
|
+
names.add(name.trim().toLowerCase());
|
|
107
|
+
const test = o['test'];
|
|
108
|
+
if (test !== undefined && typeof test !== 'boolean')
|
|
109
|
+
return { ok: false, because: `environment "${name}": test must be true or false` };
|
|
110
|
+
const url = o['url'];
|
|
111
|
+
if (url !== undefined && url !== null && (typeof url !== 'string' || url.length > MAX_URL || !/^https:\/\/[^\s]+$/.test(url))) {
|
|
112
|
+
return { ok: false, because: `environment "${name}": url must be an https address` };
|
|
113
|
+
}
|
|
114
|
+
const d = validateDeployConfig(o['deploy']);
|
|
115
|
+
if (!d.ok)
|
|
116
|
+
return { ok: false, because: `environment "${name}": deploy ${d.because}` };
|
|
117
|
+
out.push({
|
|
118
|
+
name: name.trim(),
|
|
119
|
+
...(test === true ? { test: true } : {}),
|
|
120
|
+
...(typeof url === 'string' ? { url } : {}),
|
|
121
|
+
deploy: d.deploy,
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
if (out.filter((e) => e.test === true).length > 1)
|
|
125
|
+
return { ok: false, because: 'at most one environment is the test environment' };
|
|
126
|
+
return { ok: true, environments: out };
|
|
127
|
+
}
|
|
84
128
|
/** The one rule the server applies on write and the machine on read. */
|
|
85
129
|
function validateDeliverySettings(x) {
|
|
86
130
|
if (typeof x !== 'object' || x === null || Array.isArray(x)) {
|
|
@@ -88,18 +132,27 @@ function validateDeliverySettings(x) {
|
|
|
88
132
|
}
|
|
89
133
|
const o = x;
|
|
90
134
|
for (const k of Object.keys(o)) {
|
|
91
|
-
if (k !== 'deliver' && k !== 'deploy')
|
|
92
|
-
return { ok: false, key: k, because: 'is not a delivery setting (only "deliver" and "
|
|
135
|
+
if (k !== 'deliver' && k !== 'deploy' && k !== 'environments') {
|
|
136
|
+
return { ok: false, key: k, because: 'is not a delivery setting (only "deliver", "deploy" and "environments" are)' };
|
|
137
|
+
}
|
|
93
138
|
}
|
|
94
139
|
if (!isDeliverMode(o['deliver'])) {
|
|
95
140
|
return { ok: false, key: 'deliver', because: `must be one of: ${exports.DELIVER_MODES.join(', ')}` };
|
|
96
141
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
142
|
+
const settings = { deliver: o['deliver'] };
|
|
143
|
+
if (o['deploy'] !== undefined && o['deploy'] !== null) {
|
|
144
|
+
const d = validateDeployConfig(o['deploy']);
|
|
145
|
+
if (!d.ok)
|
|
146
|
+
return { ok: false, key: 'deploy', because: d.because };
|
|
147
|
+
settings.deploy = d.deploy;
|
|
148
|
+
}
|
|
149
|
+
if (o['environments'] !== undefined && o['environments'] !== null) {
|
|
150
|
+
const v = validateEnvironments(o['environments']);
|
|
151
|
+
if (!v.ok)
|
|
152
|
+
return { ok: false, key: 'environments', because: v.because };
|
|
153
|
+
settings.environments = v.environments;
|
|
154
|
+
}
|
|
155
|
+
return { ok: true, settings };
|
|
103
156
|
}
|
|
104
157
|
/**
|
|
105
158
|
* WHERE A FINISHED GOAL'S BRANCH GOT TO — recorded on the goal so a person (and
|
|
@@ -113,6 +166,10 @@ function validateDeliverySettings(x) {
|
|
|
113
166
|
* deployed — merged, and the project's declared release step finished
|
|
114
167
|
* deploy-failed — merged, and the release step failed
|
|
115
168
|
* not-pushed — nothing left this machine (`note` says why)
|
|
169
|
+
* blocked — NOT merged, and Looply will not merge it — not on green checks, not on
|
|
170
|
+
* "Approve and ship": the pull request carries another goal's commits that are
|
|
171
|
+
* not merged into the base yet (`note` names them). Re-examined every pass; it
|
|
172
|
+
* unblocks by itself once that work is merged, or the branch is rebuilt without it.
|
|
116
173
|
*/
|
|
117
174
|
exports.BRANCH_DELIVERY_STATES = [
|
|
118
175
|
'pushed',
|
|
@@ -123,7 +180,66 @@ exports.BRANCH_DELIVERY_STATES = [
|
|
|
123
180
|
'deployed',
|
|
124
181
|
'deploy-failed',
|
|
125
182
|
'not-pushed',
|
|
183
|
+
'blocked',
|
|
126
184
|
];
|
|
185
|
+
/**
|
|
186
|
+
* WHERE ONE ENVIRONMENT STANDS, TRUTHFULLY.
|
|
187
|
+
*
|
|
188
|
+
* waiting — not deployed, and nothing has started (not merged yet, or Looply does not deploy it)
|
|
189
|
+
* deploying — a deploy of this commit is in progress (GitHub says so, or the step is running)
|
|
190
|
+
* deployed — ONLY from a real result: a GitHub deployment status `success` for this commit in
|
|
191
|
+
* this environment, a `push` deploy whose git push exited 0, or a `run` step that
|
|
192
|
+
* exited 0. A merge alone is never "deployed".
|
|
193
|
+
* failed — the deploy of this commit failed (`detail` says how)
|
|
194
|
+
* unconfirmed — merged, and the merge should deploy it, but nothing has confirmed that it did
|
|
195
|
+
*
|
|
196
|
+
* `kind` is absent for a deploy; other rows (a preview, an app release) name theirs.
|
|
197
|
+
*/
|
|
198
|
+
exports.ENV_STATES = ['waiting', 'deploying', 'deployed', 'failed', 'unconfirmed'];
|
|
199
|
+
exports.ENV_ROW_KINDS = ['deploy', 'preview', 'app-release'];
|
|
200
|
+
const MAX_ENV_ROWS = 20;
|
|
201
|
+
function validateEnvStatus(x) {
|
|
202
|
+
if (typeof x !== 'object' || x === null || Array.isArray(x))
|
|
203
|
+
return { ok: false, because: 'must be an object' };
|
|
204
|
+
const o = x;
|
|
205
|
+
const kind = o['kind'];
|
|
206
|
+
if (kind !== undefined && kind !== null && (typeof kind !== 'string' || !exports.ENV_ROW_KINDS.includes(kind))) {
|
|
207
|
+
return { ok: false, because: `kind must be one of: ${exports.ENV_ROW_KINDS.join(', ')}` };
|
|
208
|
+
}
|
|
209
|
+
const name = o['name'];
|
|
210
|
+
if (typeof name !== 'string' || name.length < 1 || name.length > 40)
|
|
211
|
+
return { ok: false, because: 'name must be 1–40 characters' };
|
|
212
|
+
if (typeof o['test'] !== 'boolean')
|
|
213
|
+
return { ok: false, because: 'test must be true or false' };
|
|
214
|
+
const state = o['state'];
|
|
215
|
+
if (typeof state !== 'string' || !exports.ENV_STATES.includes(state))
|
|
216
|
+
return { ok: false, because: `state must be one of: ${exports.ENV_STATES.join(', ')}` };
|
|
217
|
+
const sha = o['sha'] ?? null;
|
|
218
|
+
if (sha !== null && (typeof sha !== 'string' || !/^[0-9a-f]{7,64}$/.test(sha)))
|
|
219
|
+
return { ok: false, because: 'sha must be a hex commit id' };
|
|
220
|
+
const at = o['at'] ?? null;
|
|
221
|
+
if (at !== null && (typeof at !== 'string' || at.length > 40 || Number.isNaN(Date.parse(at))))
|
|
222
|
+
return { ok: false, because: 'at must be an ISO time' };
|
|
223
|
+
const url = o['url'] ?? null;
|
|
224
|
+
if (url !== null && (typeof url !== 'string' || url.length > MAX_URL || !/^https:\/\/[^\s]+$/.test(url)))
|
|
225
|
+
return { ok: false, because: 'url must be an https address' };
|
|
226
|
+
const detail = o['detail'] ?? null;
|
|
227
|
+
if (detail !== null && (typeof detail !== 'string' || detail.length > MAX_NOTE))
|
|
228
|
+
return { ok: false, because: `detail must be a string of at most ${MAX_NOTE} characters` };
|
|
229
|
+
return {
|
|
230
|
+
ok: true,
|
|
231
|
+
row: {
|
|
232
|
+
...(typeof kind === 'string' ? { kind: kind } : {}),
|
|
233
|
+
name,
|
|
234
|
+
test: o['test'],
|
|
235
|
+
state: state,
|
|
236
|
+
sha: sha,
|
|
237
|
+
at: at,
|
|
238
|
+
url: url,
|
|
239
|
+
detail: detail,
|
|
240
|
+
},
|
|
241
|
+
};
|
|
242
|
+
}
|
|
127
243
|
const MAX_NOTE = 600;
|
|
128
244
|
const MAX_URL = 400;
|
|
129
245
|
/** A report a machine sent, checked once, the same way on both sides. */
|
|
@@ -176,9 +292,33 @@ function validateBranchDeliveryReport(x) {
|
|
|
176
292
|
}
|
|
177
293
|
deploy = { kind: r['kind'], ok: r['ok'], detail: r['detail'] };
|
|
178
294
|
}
|
|
295
|
+
let environments;
|
|
296
|
+
const envs = o['environments'];
|
|
297
|
+
if (envs !== undefined && envs !== null) {
|
|
298
|
+
if (!Array.isArray(envs) || envs.length > MAX_ENV_ROWS)
|
|
299
|
+
return { ok: false, because: `environments must be a list of at most ${MAX_ENV_ROWS} rows` };
|
|
300
|
+
environments = [];
|
|
301
|
+
for (const [i, e] of envs.entries()) {
|
|
302
|
+
const v = validateEnvStatus(e);
|
|
303
|
+
if (!v.ok)
|
|
304
|
+
return { ok: false, because: `environments[${i}]: ${v.because}` };
|
|
305
|
+
environments.push(v.row);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
179
308
|
return {
|
|
180
309
|
ok: true,
|
|
181
|
-
report: {
|
|
310
|
+
report: {
|
|
311
|
+
state: state,
|
|
312
|
+
branch,
|
|
313
|
+
base,
|
|
314
|
+
pullRequestUrl: url,
|
|
315
|
+
mode,
|
|
316
|
+
note,
|
|
317
|
+
dependsOn,
|
|
318
|
+
mergeSha,
|
|
319
|
+
deploy,
|
|
320
|
+
...(environments === undefined ? {} : { environments }),
|
|
321
|
+
},
|
|
182
322
|
};
|
|
183
323
|
}
|
|
184
324
|
//# sourceMappingURL=delivery-settings.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delivery-settings.js","sourceRoot":"","sources":["../src/delivery-settings.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;;;AAQH,sCAEC;AAwBD,oDAiBC;AAED,wCAKC;AAaD,4DAeC;AAmDD,oEA4CC;AAnLY,QAAA,aAAa,GAAG,CAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,CAAU,CAAC;AAGvE,qDAAqD;AACxC,QAAA,oBAAoB,GAAgB,IAAI,CAAC;AAEtD,SAAgB,aAAa,CAAC,CAAU;IACtC,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAK,qBAAmC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;AACnF,CAAC;AAED,0CAA0C;AAC1C;;;;;;;;;GASG;AACU,QAAA,YAAY,GAAG,CAAC,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,KAAK,CAAU,CAAC;AAQ9E,MAAM,IAAI,GAAG,mCAAmC,CAAC;AACjD,MAAM,MAAM,GAAG,qCAAqC,CAAC;AAErD,SAAgB,oBAAoB,CAAC,CAAU;IAC7C,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;QAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,2CAA2C,EAAE,CAAC;IACxI,MAAM,CAAC,GAAG,CAA4B,CAAC;IACvC,MAAM,IAAI,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC;IACvB,IAAI,OAAO,IAAI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C,MAAM,IAAI,GAAG,CAAC,CAAC,cAAc,CAAC,CAAC;IAC/B,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;QACxC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM,GAAG,YAAY;YAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,0CAA0C,YAAY,OAAO,EAAE,CAAC;QACrJ,YAAY,GAAG,EAAE,CAAC;QAClB,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC;YACpC,MAAM,CAAC,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAAC;YAC/B,IAAI,CAAC,CAAC,CAAC,EAAE;gBAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC;YAC7E,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC;IACD,OAAO;QACL,EAAE,EAAE,IAAI;QACR,MAAM,EAAE;YACN,KAAK,EAAE,KAA4B;YACnC,MAAM;YACN,IAAI;YACJ,cAAc,EAAE,GAAG;YACnB,IAAI;YACJ,IAAI;YACJ,SAAS;YACT,QAAQ;YACR,MAAM;YACN,GAAG,CAAC,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC;SACxD;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THE MACHINE FAILED, OR THE WORK DID — told apart once, here.
|
|
3
|
+
*
|
|
4
|
+
* Owner ruling, 2026-10-16: Looply finishes every ticket assigned to it, or ends on a genuine
|
|
5
|
+
* question about the work itself — never on a Looply fault. On 2026-10-15/16 four Tabsy tickets
|
|
6
|
+
* ended or burned their tries on faults that said nothing about the ticket:
|
|
7
|
+
*
|
|
8
|
+
* - TAB-B-61: every Start died on the sandbox's `realpath` EPERM (before 0.5.3), and the
|
|
9
|
+
* pursuit spent its three plans on gates that never ran;
|
|
10
|
+
* - TAB-B-45 / TAB-B-63: "cannot read config.yaml" in a fresh checkout (before 0.5.8), three
|
|
11
|
+
* tries, then `start_never_began`;
|
|
12
|
+
* - TAB-B-57: two Starts spent on "the compiler timed out".
|
|
13
|
+
*
|
|
14
|
+
* An ENVIRONMENT failure never consumes a try: the Start is voided, the goal is held with the plain
|
|
15
|
+
* reason, and it is tried again once the cause can have changed — a new Looply version, a changed
|
|
16
|
+
* config, or (for weather like a timeout or a usage limit) simply later. A WORK failure — a gate
|
|
17
|
+
* that ran and went red, a plan the code refuted — still counts, because trying the same thing
|
|
18
|
+
* again would fail the same way.
|
|
19
|
+
*
|
|
20
|
+
* ⚠️ CONSERVATIVE BY CONSTRUCTION. Only signatures that cannot be the change's own fault are
|
|
21
|
+
* environment: a sandbox denial, a missing executable, a full disk, a missing config, the AI tool's
|
|
22
|
+
* limit, a timeout of the planner. "Cannot find module './x'" is NOT here — a change can break an
|
|
23
|
+
* import — and anything unrecognised is the work's, as before.
|
|
24
|
+
*/
|
|
25
|
+
export declare const ENVIRONMENT_CODES: readonly ["sandbox_denied", "config_missing", "tool_missing", "disk_full", "provider_limit", "provider_unavailable", "planner_timeout", "gate_crashed", "spawn_failed", "checkout_failed"];
|
|
26
|
+
export type EnvironmentCode = (typeof ENVIRONMENT_CODES)[number];
|
|
27
|
+
export declare function isEnvironmentCode(x: unknown): x is EnvironmentCode;
|
|
28
|
+
/**
|
|
29
|
+
* Which environment failure a sentence or an output tail describes, or null when it is not
|
|
30
|
+
* recognisably one (then it is the work's, as it always was).
|
|
31
|
+
*/
|
|
32
|
+
export declare function classifyEnvironment(text: string | null | undefined): EnvironmentCode | null;
|
|
33
|
+
export declare function classifyGateCrash(output: string | null | undefined, exitCode?: number | null): EnvironmentCode | null;
|
|
34
|
+
/** What each code tells a person, first person plural removed: what is wrong, and that nothing is lost. */
|
|
35
|
+
export declare function describeEnvironment(code: EnvironmentCode): string;
|
|
36
|
+
/**
|
|
37
|
+
* Codes that are WEATHER: they clear by themselves, so the goal is retried after a short wait and
|
|
38
|
+
* needs no new version or config. The rest are held until something about the machine changes.
|
|
39
|
+
*/
|
|
40
|
+
export declare function isTransientEnvironment(code: EnvironmentCode): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* HOW LONG A GRANT'S CLOCK MAY STAND STILL, IN TOTAL.
|
|
43
|
+
*
|
|
44
|
+
* A goal that waits — for a goal it depends on, for a checkout slot, or out an environment hold —
|
|
45
|
+
* spends nothing, so its 24-hour grant should not run out while it waits (TAB-B-64 waited on B-63
|
|
46
|
+
* and would have lost its grant at 00:37Z without doing anything). The clock is paused, not the
|
|
47
|
+
* grant re-issued: `expiresAt` stays the immutable term the person granted, and the pause is a
|
|
48
|
+
* separate, monotonic, capped figure the machine reports and the server applies.
|
|
49
|
+
*
|
|
50
|
+
* Seven days, so a dependency chain or a broken machine is waited out without a person, and a
|
|
51
|
+
* goal nothing will ever unblock still ends eventually.
|
|
52
|
+
*/
|
|
53
|
+
export declare const MAX_GRANT_PAUSE_MS: number;
|
|
54
|
+
/** A grant's effective end: its stamped term plus the time its clock stood still (capped). */
|
|
55
|
+
export declare function effectiveExpiry(expiresAt: string | Date, pausedMs: number | null | undefined): number;
|
|
56
|
+
/** The longest a hold's reason may be on the wire. */
|
|
57
|
+
export declare const HOLD_REASON_MAX = 300;
|
|
58
|
+
/**
|
|
59
|
+
* WHY A GOAL IS HELD BEFORE ITS NEXT START, as the machine reports it to the server (and so to
|
|
60
|
+
* AutoRyn, which says "Can't start yet: <reason>"). Null clears it.
|
|
61
|
+
*/
|
|
62
|
+
export interface GoalHold {
|
|
63
|
+
readonly code: EnvironmentCode | 'dependency';
|
|
64
|
+
readonly reason: string;
|
|
65
|
+
}
|
|
66
|
+
export declare function validateGoalHold(x: unknown): {
|
|
67
|
+
ok: true;
|
|
68
|
+
hold: GoalHold | null;
|
|
69
|
+
} | {
|
|
70
|
+
ok: false;
|
|
71
|
+
because: string;
|
|
72
|
+
};
|
|
73
|
+
//# sourceMappingURL=environment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../src/environment.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,eAAO,MAAM,iBAAiB,4LAqBpB,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEjE,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,eAAe,CAElE;AAmBD;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,eAAe,GAAG,IAAI,CAI3F;AAcD,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,eAAe,GAAG,IAAI,CAKrH;AAED,2GAA2G;AAC3G,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,eAAe,GAAG,MAAM,CA2BjE;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAErE;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,kBAAkB,QAA0B,CAAC;AAE1D,8FAA8F;AAC9F,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAIrG;AAED,sDAAsD;AACtD,eAAO,MAAM,eAAe,MAAM,CAAC;AAEnC;;;GAGG;AACH,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,IAAI,EAAE,eAAe,GAAG,YAAY,CAAC;IAC9C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,OAAO,GAAG;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,QAAQ,GAAG,IAAI,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAYjH"}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* THE MACHINE FAILED, OR THE WORK DID — told apart once, here.
|
|
4
|
+
*
|
|
5
|
+
* Owner ruling, 2026-10-16: Looply finishes every ticket assigned to it, or ends on a genuine
|
|
6
|
+
* question about the work itself — never on a Looply fault. On 2026-10-15/16 four Tabsy tickets
|
|
7
|
+
* ended or burned their tries on faults that said nothing about the ticket:
|
|
8
|
+
*
|
|
9
|
+
* - TAB-B-61: every Start died on the sandbox's `realpath` EPERM (before 0.5.3), and the
|
|
10
|
+
* pursuit spent its three plans on gates that never ran;
|
|
11
|
+
* - TAB-B-45 / TAB-B-63: "cannot read config.yaml" in a fresh checkout (before 0.5.8), three
|
|
12
|
+
* tries, then `start_never_began`;
|
|
13
|
+
* - TAB-B-57: two Starts spent on "the compiler timed out".
|
|
14
|
+
*
|
|
15
|
+
* An ENVIRONMENT failure never consumes a try: the Start is voided, the goal is held with the plain
|
|
16
|
+
* reason, and it is tried again once the cause can have changed — a new Looply version, a changed
|
|
17
|
+
* config, or (for weather like a timeout or a usage limit) simply later. A WORK failure — a gate
|
|
18
|
+
* that ran and went red, a plan the code refuted — still counts, because trying the same thing
|
|
19
|
+
* again would fail the same way.
|
|
20
|
+
*
|
|
21
|
+
* ⚠️ CONSERVATIVE BY CONSTRUCTION. Only signatures that cannot be the change's own fault are
|
|
22
|
+
* environment: a sandbox denial, a missing executable, a full disk, a missing config, the AI tool's
|
|
23
|
+
* limit, a timeout of the planner. "Cannot find module './x'" is NOT here — a change can break an
|
|
24
|
+
* import — and anything unrecognised is the work's, as before.
|
|
25
|
+
*/
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
exports.HOLD_REASON_MAX = exports.MAX_GRANT_PAUSE_MS = exports.ENVIRONMENT_CODES = void 0;
|
|
28
|
+
exports.isEnvironmentCode = isEnvironmentCode;
|
|
29
|
+
exports.classifyEnvironment = classifyEnvironment;
|
|
30
|
+
exports.classifyGateCrash = classifyGateCrash;
|
|
31
|
+
exports.describeEnvironment = describeEnvironment;
|
|
32
|
+
exports.isTransientEnvironment = isTransientEnvironment;
|
|
33
|
+
exports.effectiveExpiry = effectiveExpiry;
|
|
34
|
+
exports.validateGoalHold = validateGoalHold;
|
|
35
|
+
exports.ENVIRONMENT_CODES = [
|
|
36
|
+
/** The sandbox (or the OS) denied an operation: EPERM / EACCES / "Access is denied". */
|
|
37
|
+
'sandbox_denied',
|
|
38
|
+
/** The project's `.looply/config.yaml` (or another required config) could not be read. */
|
|
39
|
+
'config_missing',
|
|
40
|
+
/** A gate's or the agent's executable is not installed / not on PATH. */
|
|
41
|
+
'tool_missing',
|
|
42
|
+
/** The disk is full, or below the machine's free-space floor. */
|
|
43
|
+
'disk_full',
|
|
44
|
+
/** The AI tool's usage limit or rate limit. */
|
|
45
|
+
'provider_limit',
|
|
46
|
+
/** The AI tool is not installed, not signed in, or not answering. */
|
|
47
|
+
'provider_unavailable',
|
|
48
|
+
/** Planning or checking took longer than its bound. */
|
|
49
|
+
'planner_timeout',
|
|
50
|
+
/** A gate step could not run to a verdict (crashed before testing anything). */
|
|
51
|
+
'gate_crashed',
|
|
52
|
+
/** The run process could not be started, or died before it began. */
|
|
53
|
+
'spawn_failed',
|
|
54
|
+
/** A machine-made checkout could not be prepared. */
|
|
55
|
+
'checkout_failed',
|
|
56
|
+
];
|
|
57
|
+
function isEnvironmentCode(x) {
|
|
58
|
+
return typeof x === 'string' && exports.ENVIRONMENT_CODES.includes(x);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* The signatures, in order: the FIRST that matches names the code. Order matters only where two
|
|
62
|
+
* could both match one text (a timeout reported as a spawn failure reads as the timeout).
|
|
63
|
+
*/
|
|
64
|
+
const SIGNATURES = [
|
|
65
|
+
['planner_timeout', /\b(compiler|planner|compilation|goal check|evaluator|evaluation|verify pass)\b[^.\n]{0,60}\btimed out\b|\btimed out\b[^.\n]{0,40}\b(compil|plan|evaluat)/i],
|
|
66
|
+
['provider_limit', /\b(usage limit|rate limit|rate-limited|429 Too Many Requests|limit will reset|overloaded_error)\b/i],
|
|
67
|
+
['provider_unavailable', /\b(claude code (is )?(not installed|not found|missing|outdated)|not (signed|logged) in|provider (is )?not ready|authentication_error|invalid api key)\b/i],
|
|
68
|
+
['config_missing', /\b(cannot|could not|can't|unable to) (read|find|open|load)\b[^.\n]{0,60}\bconfig(\.ya?ml)?\b|\bconfig\.ya?ml\b[^.\n]{0,40}\b(ENOENT|not found|missing|no such file)/i],
|
|
69
|
+
['disk_full', /\b(ENOSPC|no space left on device|not enough (free )?(disk )?space|disk is full|below the free[- ]space floor|minFreeGb)\b/i],
|
|
70
|
+
['sandbox_denied', /\b(EPERM|EACCES|operation not permitted|Access is denied|permission denied|AppContainer)\b/i],
|
|
71
|
+
['tool_missing', /\b(spawn \S+ ENOENT|is not recognized as an internal or external command|command not found|exited (with code )?(9009|127)\b|No such file or directory[^.\n]{0,40}\b(node|npm|npx|git|pnpm|yarn)\b)/i],
|
|
72
|
+
['gate_crashed', /\bcould not run (its|their) gate\b|\bgate blocked: step\b|\bthe environment is unavailable, not the change\b/i],
|
|
73
|
+
['checkout_failed', /\b(could not (make|prepare|provision|create) (a |the )?(checkout|workspace|worktree)|provision(ing)? failed|worktree add failed)\b/i],
|
|
74
|
+
['spawn_failed', /\b(failed to spawn|spawn(ed)? failed|could not (start|launch) the run|never began|EBUSY|EMFILE|ENFILE)\b/i],
|
|
75
|
+
];
|
|
76
|
+
/**
|
|
77
|
+
* Which environment failure a sentence or an output tail describes, or null when it is not
|
|
78
|
+
* recognisably one (then it is the work's, as it always was).
|
|
79
|
+
*/
|
|
80
|
+
function classifyEnvironment(text) {
|
|
81
|
+
if (typeof text !== 'string' || text.trim() === '')
|
|
82
|
+
return null;
|
|
83
|
+
for (const [code, re] of SIGNATURES)
|
|
84
|
+
if (re.test(text))
|
|
85
|
+
return code;
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* A GATE STEP THAT CRASHED BEFORE IT TESTED ANYTHING — narrower than `classifyEnvironment`, because
|
|
90
|
+
* a gate's output is the project's own test output, and a test may print "EACCES" about the code
|
|
91
|
+
* under test. Only the shapes a tool runner prints when IT could not run count: the sandbox denying
|
|
92
|
+
* a filesystem call on the runner's own path walk, the command not existing, the disk being full.
|
|
93
|
+
*/
|
|
94
|
+
const GATE_CRASH_SIGNATURES = [
|
|
95
|
+
['disk_full', /\b(ENOSPC|no space left on device)\b/i],
|
|
96
|
+
['sandbox_denied', /\b(EPERM|EACCES): (operation not permitted|permission denied), (lstat|realpath|scandir|stat|open|opendir|mkdir|uv_cwd|readlink)\b|Error: EPERM, Permission denied|AppContainer/i],
|
|
97
|
+
['tool_missing', /\bis not recognized as an internal or external command\b|\bspawn \S+ ENOENT\b|^\S+: (command )?not found$/im],
|
|
98
|
+
];
|
|
99
|
+
function classifyGateCrash(output, exitCode) {
|
|
100
|
+
if (exitCode === 9009 || exitCode === 127)
|
|
101
|
+
return 'tool_missing';
|
|
102
|
+
if (typeof output !== 'string' || output.trim() === '')
|
|
103
|
+
return null;
|
|
104
|
+
for (const [code, re] of GATE_CRASH_SIGNATURES)
|
|
105
|
+
if (re.test(output))
|
|
106
|
+
return code;
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
109
|
+
/** What each code tells a person, first person plural removed: what is wrong, and that nothing is lost. */
|
|
110
|
+
function describeEnvironment(code) {
|
|
111
|
+
switch (code) {
|
|
112
|
+
case 'sandbox_denied':
|
|
113
|
+
return "the machine's sandbox denied something a check needed";
|
|
114
|
+
case 'config_missing':
|
|
115
|
+
return "the project's Looply config could not be read in the checkout";
|
|
116
|
+
case 'tool_missing':
|
|
117
|
+
return 'a tool a check needs is not installed on the machine';
|
|
118
|
+
case 'disk_full':
|
|
119
|
+
return 'the machine is out of disk space';
|
|
120
|
+
case 'provider_limit':
|
|
121
|
+
return "the AI tool's usage limit was reached";
|
|
122
|
+
case 'provider_unavailable':
|
|
123
|
+
return 'the AI tool on the machine is not ready';
|
|
124
|
+
case 'planner_timeout':
|
|
125
|
+
return 'planning took longer than its time limit';
|
|
126
|
+
case 'gate_crashed':
|
|
127
|
+
return 'a check crashed before it could test anything';
|
|
128
|
+
case 'spawn_failed':
|
|
129
|
+
return 'the machine could not start the work';
|
|
130
|
+
case 'checkout_failed':
|
|
131
|
+
return 'the machine could not prepare a checkout';
|
|
132
|
+
default: {
|
|
133
|
+
const never = code;
|
|
134
|
+
return String(never);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Codes that are WEATHER: they clear by themselves, so the goal is retried after a short wait and
|
|
140
|
+
* needs no new version or config. The rest are held until something about the machine changes.
|
|
141
|
+
*/
|
|
142
|
+
function isTransientEnvironment(code) {
|
|
143
|
+
return code === 'planner_timeout' || code === 'provider_limit' || code === 'spawn_failed';
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* HOW LONG A GRANT'S CLOCK MAY STAND STILL, IN TOTAL.
|
|
147
|
+
*
|
|
148
|
+
* A goal that waits — for a goal it depends on, for a checkout slot, or out an environment hold —
|
|
149
|
+
* spends nothing, so its 24-hour grant should not run out while it waits (TAB-B-64 waited on B-63
|
|
150
|
+
* and would have lost its grant at 00:37Z without doing anything). The clock is paused, not the
|
|
151
|
+
* grant re-issued: `expiresAt` stays the immutable term the person granted, and the pause is a
|
|
152
|
+
* separate, monotonic, capped figure the machine reports and the server applies.
|
|
153
|
+
*
|
|
154
|
+
* Seven days, so a dependency chain or a broken machine is waited out without a person, and a
|
|
155
|
+
* goal nothing will ever unblock still ends eventually.
|
|
156
|
+
*/
|
|
157
|
+
exports.MAX_GRANT_PAUSE_MS = 7 * 24 * 60 * 60 * 1000;
|
|
158
|
+
/** A grant's effective end: its stamped term plus the time its clock stood still (capped). */
|
|
159
|
+
function effectiveExpiry(expiresAt, pausedMs) {
|
|
160
|
+
const base = typeof expiresAt === 'string' ? Date.parse(expiresAt) : expiresAt.getTime();
|
|
161
|
+
const paused = typeof pausedMs === 'number' && Number.isFinite(pausedMs) && pausedMs > 0 ? Math.min(pausedMs, exports.MAX_GRANT_PAUSE_MS) : 0;
|
|
162
|
+
return base + paused;
|
|
163
|
+
}
|
|
164
|
+
/** The longest a hold's reason may be on the wire. */
|
|
165
|
+
exports.HOLD_REASON_MAX = 300;
|
|
166
|
+
function validateGoalHold(x) {
|
|
167
|
+
if (x === null)
|
|
168
|
+
return { ok: true, hold: null };
|
|
169
|
+
if (typeof x !== 'object' || Array.isArray(x))
|
|
170
|
+
return { ok: false, because: 'hold must be an object or null' };
|
|
171
|
+
const o = x;
|
|
172
|
+
for (const k of Object.keys(o))
|
|
173
|
+
if (k !== 'code' && k !== 'reason')
|
|
174
|
+
return { ok: false, because: `${k} is not a hold field` };
|
|
175
|
+
const code = o['code'];
|
|
176
|
+
if (code !== 'dependency' && !isEnvironmentCode(code))
|
|
177
|
+
return { ok: false, because: 'code is not a hold code' };
|
|
178
|
+
const reason = o['reason'];
|
|
179
|
+
if (typeof reason !== 'string' || reason.trim() === '' || reason.length > exports.HOLD_REASON_MAX) {
|
|
180
|
+
return { ok: false, because: `reason must be a sentence of at most ${exports.HOLD_REASON_MAX} characters` };
|
|
181
|
+
}
|
|
182
|
+
return { ok: true, hold: { code, reason: reason.replace(/\s+/g, ' ').trim() } };
|
|
183
|
+
}
|
|
184
|
+
//# sourceMappingURL=environment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environment.js","sourceRoot":"","sources":["../src/environment.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;;AA2BH,8CAEC;AAuBD,kDAIC;AAcD,8CAKC;AAGD,kDA2BC;AAMD,wDAEC;AAiBD,0CAIC;AAcD,4CAYC;AA9JY,QAAA,iBAAiB,GAAG;IAC/B,wFAAwF;IACxF,gBAAgB;IAChB,0FAA0F;IAC1F,gBAAgB;IAChB,yEAAyE;IACzE,cAAc;IACd,iEAAiE;IACjE,WAAW;IACX,+CAA+C;IAC/C,gBAAgB;IAChB,qEAAqE;IACrE,sBAAsB;IACtB,uDAAuD;IACvD,iBAAiB;IACjB,gFAAgF;IAChF,cAAc;IACd,qEAAqE;IACrE,cAAc;IACd,qDAAqD;IACrD,iBAAiB;CACT,CAAC;AAIX,SAAgB,iBAAiB,CAAC,CAAU;IAC1C,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAK,yBAAuC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;AACvF,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,GAAsD;IACpE,CAAC,iBAAiB,EAAE,2JAA2J,CAAC;IAChL,CAAC,gBAAgB,EAAE,oGAAoG,CAAC;IACxH,CAAC,sBAAsB,EAAE,0JAA0J,CAAC;IACpL,CAAC,gBAAgB,EAAE,sKAAsK,CAAC;IAC1L,CAAC,WAAW,EAAE,6HAA6H,CAAC;IAC5I,CAAC,gBAAgB,EAAE,6FAA6F,CAAC;IACjH,CAAC,cAAc,EAAE,qMAAqM,CAAC;IACvN,CAAC,cAAc,EAAE,+GAA+G,CAAC;IACjI,CAAC,iBAAiB,EAAE,qIAAqI,CAAC;IAC1J,CAAC,cAAc,EAAE,2GAA2G,CAAC;CAC9H,CAAC;AAEF;;;GAGG;AACH,SAAgB,mBAAmB,CAAC,IAA+B;IACjE,IAAI,OAAO,IAAI,KAAK,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