@runeditrun/rer 0.2.99 → 0.2.100
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/cli/README.md +88 -2
- package/cli/business/bounded-waves.d.mts +23 -0
- package/cli/business/bounded-waves.mjs +57 -0
- package/cli/business/catchup-task.mjs +9 -2
- package/cli/business/command.mjs +8 -3
- package/cli/business/export-inputs.mjs +12 -2
- package/cli/business/export-task.mjs +9 -2
- package/cli/business/legacy-package.mjs +117 -0
- package/cli/business/local-commands.mjs +10 -1
- package/cli/business/package-transfer.mjs +127 -0
- package/cli/business/state.mjs +3 -3
- package/cli/business/vendor-door.mjs +83 -11
- package/cli/business/vendors/README.md +41 -2
- package/cli/business/vendors/common.mjs +81 -0
- package/cli/business/vendors/index.mjs +12 -2
- package/cli/business/vendors/zendesk-attachments.mjs +57 -0
- package/cli/business/vendors/zendesk-encode.mjs +133 -0
- package/cli/business/vendors/zendesk-guide.mjs +34 -0
- package/cli/business/vendors/zendesk-package.mjs +28 -0
- package/cli/business/vendors/zendesk-pages.mjs +61 -0
- package/cli/business/vendors/zendesk-people.mjs +7 -0
- package/cli/business/vendors/zendesk-store.mjs +154 -0
- package/cli/business/vendors/zendesk-tickets.mjs +21 -0
- package/cli/business/vendors/zendesk-token.mjs +31 -0
- package/cli/business/vendors/zendesk-transport.mjs +48 -0
- package/cli/business/vendors/zendesk.mjs +61 -0
- package/cli/deploy-command.mjs +5 -4
- package/cli/deploy-inputs.mjs +1 -1
- package/cli/deploy.mjs +6 -4
- package/cli/production-auth.mjs +16 -3
- package/cli/production-mail.mjs +18 -1
- package/cli/site.mjs +1 -1
- package/global/CHANGELOG.md +21 -0
- package/modules/deploy-kit/README.md +10 -0
- package/modules/deploy-kit/provider.mjs +18 -2
- package/modules/import-kit/src/d1/jobs.ts +3 -1
- package/modules/import-kit/src/d1/retirement-scope.ts +2 -2
- package/modules/import-kit/src/d1/retirement-tally.ts +1 -0
- package/modules/import-kit/src/d1/retirement.ts +15 -5
- package/modules/import-kit/src/d1/types.ts +3 -0
- package/modules/import-kit/src/d1/wave-boundary.ts +33 -0
- package/modules/import-kit/src/d1/wave-retirement.ts +47 -0
- package/modules/import-kit/src/door/ADOPTING.md +37 -0
- package/modules/import-kit/src/door/README.md +66 -0
- package/modules/import-kit/src/door/admission.ts +13 -3
- package/modules/import-kit/src/door/authority.ts +1 -0
- package/modules/import-kit/src/door/failures.ts +1 -1
- package/modules/import-kit/src/door/grants.ts +19 -5
- package/modules/import-kit/src/door/handler.ts +12 -1
- package/modules/import-kit/src/door/index.ts +6 -0
- package/modules/import-kit/src/door/package.ts +121 -0
- package/modules/import-kit/src/door/planning.ts +44 -19
- package/modules/import-kit/src/door/protocol.ts +4 -2
- package/modules/import-kit/src/door/schema.ts +2 -0
- package/modules/import-kit/src/door/store.ts +2 -2
- package/modules/import-kit/src/door/types.ts +24 -1
- package/modules/import-kit/src/door/waves/README.md +158 -0
- package/modules/import-kit/src/door/waves/digests.ts +38 -0
- package/modules/import-kit/src/door/waves/inventory.ts +84 -0
- package/modules/import-kit/src/door/waves/journal.ts +19 -0
- package/modules/import-kit/src/door/waves/lifecycle.ts +242 -0
- package/modules/import-kit/src/door/waves/preparation.ts +190 -0
- package/modules/import-kit/src/door/waves/schema.ts +73 -0
- package/modules/import-kit/src/door/waves/store.ts +112 -0
- package/modules/import-kit/src/door/waves/types.ts +76 -0
- package/onboarding/adapter.mjs +7 -1
- package/onboarding/operator-installer.mjs +3 -1
- package/package.json +1 -1
- package/scripts/publish-check/README.md +20 -0
- package/scripts/publish-check/diagnostics.mjs +73 -0
- package/scripts/publish-check/slots.py +37 -7
- package/scripts/publish-check.mjs +64 -37
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { spawn } from 'node:child_process';
|
|
3
|
-
import { mkdtempSync,
|
|
3
|
+
import { mkdtempSync, openSync, closeSync, rmSync } from 'node:fs';
|
|
4
4
|
import { tmpdir } from 'node:os';
|
|
5
5
|
import { join } from 'node:path';
|
|
6
6
|
import { runningVersion } from '../cli/version.mjs';
|
|
7
7
|
import { parseTimeoutSeconds, timeoutBounds } from './publish-check/timeout.mjs';
|
|
8
|
+
import { controlReader, diagnosticLimit, incompleteReport, osFailure, processFact, readReport, workerFact } from './publish-check/diagnostics.mjs';
|
|
8
9
|
|
|
9
10
|
const args = process.argv.slice(2);
|
|
10
11
|
let seconds = timeoutBounds.default;
|
|
@@ -14,10 +15,9 @@ for (let i = 0; i < args.length; i++) {
|
|
|
14
15
|
try { seconds = parseTimeoutSeconds(raw); } catch { /* Python reports invalid arguments. */ }
|
|
15
16
|
}
|
|
16
17
|
}
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
let child, reason, timer;
|
|
18
|
+
let scratch, fd, child, reason, timer;
|
|
19
|
+
const diagnostics = [];
|
|
20
|
+
const record = fact => { if (fact && diagnostics.length < diagnosticLimit) diagnostics.push(fact); };
|
|
21
21
|
const stop = value => {
|
|
22
22
|
reason ??= value;
|
|
23
23
|
// The child remains unreaped until its close handler; descendants (native
|
|
@@ -29,52 +29,79 @@ const stop = value => {
|
|
|
29
29
|
const interrupt = () => stop('scan.interrupted');
|
|
30
30
|
process.on('SIGINT', interrupt);
|
|
31
31
|
process.on('SIGTERM', interrupt);
|
|
32
|
-
let report, code = 2;
|
|
32
|
+
let report, code = 2, stage = 'scratch';
|
|
33
33
|
try {
|
|
34
|
+
scratch = mkdtempSync(join(tmpdir(), 'publish-check-'));
|
|
35
|
+
const output = join(scratch, 'report.json');
|
|
36
|
+
fd = openSync(output, 'wx', 0o600);
|
|
37
|
+
stage = 'slot';
|
|
34
38
|
child = spawn('python3', ['-B', new URL('./publish-check/slots.py', import.meta.url).pathname, ...args], {
|
|
35
|
-
|
|
39
|
+
// Neither holder tracebacks nor worker stderr are safe public diagnostics.
|
|
40
|
+
detached: true, stdio: ['pipe', fd, 'ignore', 'pipe'], env: { ...process.env, TMPDIR: scratch },
|
|
36
41
|
});
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
messages += data;
|
|
42
|
-
for (let at; (at = messages.indexOf('\n')) !== -1;) {
|
|
43
|
-
const message = messages.slice(0, at);
|
|
44
|
-
messages = messages.slice(at + 1);
|
|
45
|
-
if (message === 'acquired' && !timer) timer = setTimeout(() => stop('scan.deadline-exceeded'), seconds * 1000);
|
|
46
|
-
else if (message.startsWith('scan.')) reason ??= message;
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
const result = await new Promise(resolve => {
|
|
50
|
-
child.once('error', () => resolve(null));
|
|
51
|
-
child.once('close', value => resolve(value));
|
|
42
|
+
const finished = new Promise(resolve => {
|
|
43
|
+
let error;
|
|
44
|
+
child.once('error', value => { error = value; });
|
|
45
|
+
child.once('close', (exitCode, signal) => resolve({ error, exitCode, signal }));
|
|
52
46
|
});
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
47
|
+
closeSync(fd);
|
|
48
|
+
fd = undefined;
|
|
49
|
+
child.stdio[3]?.setEncoding('utf8');
|
|
50
|
+
child.stdio[3]?.on('data', controlReader(message => {
|
|
51
|
+
if (message === 'acquired' && !timer) timer = setTimeout(() => stop('scan.deadline-exceeded'), seconds * 1000);
|
|
52
|
+
else if (message === 'waiting') process.stderr.write('waiting for a scan slot\n');
|
|
53
|
+
else if (['scan.slot-timeout', 'scan.slot-configuration'].includes(message)) reason ??= message;
|
|
54
|
+
else record(workerFact(message));
|
|
55
|
+
}));
|
|
56
|
+
const result = await finished;
|
|
57
|
+
const parsed = readReport(output);
|
|
58
|
+
// Report errors are secondary facts even when the process failed first.
|
|
59
|
+
if (reason || result.error || result.signal || ![0, 1, 2].includes(result.exitCode) || parsed.diagnostic) {
|
|
60
|
+
reason ??= 'scan.worker-incomplete';
|
|
61
|
+
record(processFact('slot', result));
|
|
62
|
+
record(parsed.diagnostic);
|
|
63
|
+
} else {
|
|
64
|
+
report = parsed.report;
|
|
65
|
+
code = result.exitCode;
|
|
66
|
+
}
|
|
67
|
+
} catch (error) {
|
|
68
|
+
reason ??= 'scan.worker-incomplete';
|
|
69
|
+
record(osFailure(stage, 'io.error', error));
|
|
70
|
+
} finally {
|
|
59
71
|
clearTimeout(timer);
|
|
60
72
|
process.removeListener('SIGINT', interrupt);
|
|
61
73
|
process.removeListener('SIGTERM', interrupt);
|
|
62
|
-
|
|
74
|
+
if (fd !== undefined) {
|
|
75
|
+
try { closeSync(fd); }
|
|
76
|
+
catch (error) { record(osFailure('cleanup', 'cleanup.close-error', error)); }
|
|
77
|
+
}
|
|
78
|
+
if (scratch) {
|
|
79
|
+
try { rmSync(scratch, { recursive: true, force: true }); }
|
|
80
|
+
catch (error) {
|
|
81
|
+
record(osFailure('cleanup', 'cleanup.remove-error', error));
|
|
82
|
+
// Retain existing failures, and never publish PASS after failed cleanup.
|
|
83
|
+
if (code === 0) { reason ??= 'scan.worker-incomplete'; code = 2; }
|
|
84
|
+
}
|
|
85
|
+
}
|
|
63
86
|
}
|
|
64
|
-
if (reason) report =
|
|
65
|
-
|
|
66
|
-
findings: [{ rule: reason, path: '.', commit: null, scope: 'newly-public' }],
|
|
67
|
-
preExisting: [], warnings: [], fixtures: [], reviewed: [], info: [], thirdPartyNotices: [],
|
|
68
|
-
history: { commits: 0, trees: 0, blobs: 0 },
|
|
69
|
-
guarantees: { historyScanned: false, visualRecognition: false, environmentChecked: false },
|
|
70
|
-
};
|
|
87
|
+
if (reason) report = incompleteReport(reason);
|
|
88
|
+
if (reason || diagnostics.some(fact => fact.stage === 'cleanup')) report.diagnostics = diagnostics;
|
|
71
89
|
if (report.help) process.stdout.write(report.help);
|
|
72
90
|
else {
|
|
73
91
|
for (const finding of report.findings) {
|
|
74
92
|
if (finding.rule === 'scan.usage') process.stderr.write(`publish-check: ${finding.message}; see --help\n`);
|
|
75
93
|
}
|
|
76
94
|
report.implementation ??= {};
|
|
77
|
-
report.implementation.version = runningVersion();
|
|
95
|
+
try { report.implementation.version = runningVersion(); }
|
|
96
|
+
catch (error) {
|
|
97
|
+
record(osFailure('implementation', 'version.error', error));
|
|
98
|
+
if (code === 0) {
|
|
99
|
+
reason ??= 'scan.worker-incomplete';
|
|
100
|
+
report = incompleteReport(reason);
|
|
101
|
+
code = 2;
|
|
102
|
+
}
|
|
103
|
+
report.diagnostics = diagnostics;
|
|
104
|
+
}
|
|
78
105
|
process.stdout.write(JSON.stringify(report) + '\n');
|
|
79
106
|
}
|
|
80
107
|
process.exitCode = code;
|