@fluidgrids/cli 2026.1028.1 → 2026.1028.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +52 -0
- package/dist/code-first/api.d.ts +187 -0
- package/dist/code-first/api.d.ts.map +1 -1
- package/dist/code-first/api.js +122 -0
- package/dist/code-first/api.js.map +1 -1
- package/dist/code-first/code-upload.d.ts +52 -0
- package/dist/code-first/code-upload.d.ts.map +1 -0
- package/dist/code-first/code-upload.js +161 -0
- package/dist/code-first/code-upload.js.map +1 -0
- package/dist/code-first/commands/hotfix.d.ts +54 -0
- package/dist/code-first/commands/hotfix.d.ts.map +1 -0
- package/dist/code-first/commands/hotfix.js +225 -0
- package/dist/code-first/commands/hotfix.js.map +1 -0
- package/dist/code-first/commands/push.d.ts +47 -1
- package/dist/code-first/commands/push.d.ts.map +1 -1
- package/dist/code-first/commands/push.js +115 -19
- package/dist/code-first/commands/push.js.map +1 -1
- package/dist/code-first/commands/replay.d.ts +44 -0
- package/dist/code-first/commands/replay.d.ts.map +1 -0
- package/dist/code-first/commands/replay.js +238 -0
- package/dist/code-first/commands/replay.js.map +1 -0
- package/dist/code-first/commands/runs.d.ts +94 -0
- package/dist/code-first/commands/runs.d.ts.map +1 -0
- package/dist/code-first/commands/runs.js +304 -0
- package/dist/code-first/commands/runs.js.map +1 -0
- package/dist/code-first/commands/validate.d.ts +4 -0
- package/dist/code-first/commands/validate.d.ts.map +1 -1
- package/dist/code-first/commands/validate.js +31 -6
- package/dist/code-first/commands/validate.js.map +1 -1
- package/dist/code-first/commands/versions.d.ts +14 -0
- package/dist/code-first/commands/versions.d.ts.map +1 -0
- package/dist/code-first/commands/versions.js +30 -0
- package/dist/code-first/commands/versions.js.map +1 -0
- package/dist/code-first/durable-operations.d.ts +42 -0
- package/dist/code-first/durable-operations.d.ts.map +1 -0
- package/dist/code-first/durable-operations.js +136 -0
- package/dist/code-first/durable-operations.js.map +1 -0
- package/dist/code-first/history.d.ts +30 -0
- package/dist/code-first/history.d.ts.map +1 -0
- package/dist/code-first/history.js +139 -0
- package/dist/code-first/history.js.map +1 -0
- package/dist/code-first/imports.d.ts +22 -0
- package/dist/code-first/imports.d.ts.map +1 -0
- package/dist/code-first/imports.js +67 -0
- package/dist/code-first/imports.js.map +1 -0
- package/dist/code-first/index.d.ts +4 -1
- package/dist/code-first/index.d.ts.map +1 -1
- package/dist/code-first/index.js +6 -2
- package/dist/code-first/index.js.map +1 -1
- package/dist/code-first/lowering.d.ts +40 -1
- package/dist/code-first/lowering.d.ts.map +1 -1
- package/dist/code-first/lowering.js +103 -6
- package/dist/code-first/lowering.js.map +1 -1
- package/dist/code-first/presigned.d.ts +21 -0
- package/dist/code-first/presigned.d.ts.map +1 -0
- package/dist/code-first/presigned.js +85 -0
- package/dist/code-first/presigned.js.map +1 -0
- package/dist/code-first/project.d.ts +9 -0
- package/dist/code-first/project.d.ts.map +1 -1
- package/dist/code-first/project.js +22 -0
- package/dist/code-first/project.js.map +1 -1
- package/dist/code-first/python.d.ts +11 -0
- package/dist/code-first/python.d.ts.map +1 -1
- package/dist/code-first/python.js +31 -1
- package/dist/code-first/python.js.map +1 -1
- package/dist/code-first/register.d.ts +6 -0
- package/dist/code-first/register.d.ts.map +1 -1
- package/dist/code-first/register.js +146 -2
- package/dist/code-first/register.js.map +1 -1
- package/dist/code-first/remote.d.ts.map +1 -1
- package/dist/code-first/remote.js +6 -0
- package/dist/code-first/remote.js.map +1 -1
- package/dist/code-first/replay.d.ts +36 -0
- package/dist/code-first/replay.d.ts.map +1 -0
- package/dist/code-first/replay.js +52 -0
- package/dist/code-first/replay.js.map +1 -0
- package/dist/code-first/shared.d.ts +12 -0
- package/dist/code-first/shared.d.ts.map +1 -1
- package/dist/code-first/shared.js +36 -0
- package/dist/code-first/shared.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Uploading a code bundle (durable functions, Phase B; C-S3, DB11, DB12):
|
|
3
|
+
*
|
|
4
|
+
* 1. The bundle `lower()` built is one ES module whose `buildId` is
|
|
5
|
+
* `sha256:<hex>` of its bytes. The source archive is `packSources` of the
|
|
6
|
+
* files it was built from, the project's lockfile and the vendored pure-ESM
|
|
7
|
+
* packages, so the service can rebuild the same bytes.
|
|
8
|
+
* 2. `prepareWorkflowCodeUpload` checks the caps and the
|
|
9
|
+
* `fluidgrids.code-bundles.bytes` quota and returns presigned PUTs: the
|
|
10
|
+
* bundle to its content-addressed key (skipped when `alreadyStored`), the
|
|
11
|
+
* source to an upload staging key.
|
|
12
|
+
* 3. The version is created with `codeBundle: { uploadId, … }`; the service
|
|
13
|
+
* verifies the checksum, scans the source for secrets and links the bundle.
|
|
14
|
+
*
|
|
15
|
+
* One bundle serves every workflow version of a push. Each version needs its
|
|
16
|
+
* own upload ticket (the ticket binds a workflow key and is consumed by the
|
|
17
|
+
* version), but only the first PUT of the bundle transfers it.
|
|
18
|
+
*/
|
|
19
|
+
import { CliUserError } from '@burdenoff/cli-sdk/core';
|
|
20
|
+
import { SDK_VERSION } from '@fluidgrids/workflows';
|
|
21
|
+
import { packSources } from '@fluidgrids/workflows/roundtrip';
|
|
22
|
+
import { existsSync, readFileSync } from 'fs';
|
|
23
|
+
import { join } from 'path';
|
|
24
|
+
import { MAX_BUNDLE_BYTES } from './lowering.js';
|
|
25
|
+
import { presignedUrl, readCapped, storageErrorSummary } from './presigned.js';
|
|
26
|
+
import { describeError } from './shared.js';
|
|
27
|
+
/** Largest source archive the service accepts, as uploaded (spec 01 §5). */
|
|
28
|
+
export const MAX_SOURCE_ARCHIVE_BYTES = 32 * 1024 * 1024;
|
|
29
|
+
/** Most of an upload error body read to find its error code. */
|
|
30
|
+
const ERROR_BODY_BYTES = 64 * 1024;
|
|
31
|
+
/** Lockfiles recorded in the source archive, first match wins. */
|
|
32
|
+
export const LOCKFILES = [
|
|
33
|
+
'bun.lock',
|
|
34
|
+
'package-lock.json',
|
|
35
|
+
'pnpm-lock.yaml',
|
|
36
|
+
'yarn.lock',
|
|
37
|
+
];
|
|
38
|
+
/**
|
|
39
|
+
* Headers the HTTP client computes itself. The presigned URL signs
|
|
40
|
+
* `content-length`; the client sends the same value because it sends exactly
|
|
41
|
+
* the body the length was declared for.
|
|
42
|
+
*/
|
|
43
|
+
const CLIENT_HEADERS = new Set(['content-length', 'host']);
|
|
44
|
+
function lockText(root) {
|
|
45
|
+
for (const name of LOCKFILES) {
|
|
46
|
+
const path = join(root, name);
|
|
47
|
+
if (existsSync(path))
|
|
48
|
+
return readFileSync(path, 'utf8');
|
|
49
|
+
}
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
/** The bundle and source archive of a lowered TypeScript project, size-checked. */
|
|
53
|
+
export function prepareBundle(project, lowered) {
|
|
54
|
+
if (!lowered.bundle || !lowered.buildId || !lowered.sourceHash || !lowered.sourceFiles) {
|
|
55
|
+
throw new CliUserError('This project has no code bundle to upload.', {
|
|
56
|
+
hint: 'Durable functions are TypeScript `workflow()` exports (Python ones arrive in Phase C).',
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
const bundle = new TextEncoder().encode(lowered.bundle);
|
|
60
|
+
if (bundle.byteLength > MAX_BUNDLE_BYTES) {
|
|
61
|
+
throw new CliUserError(`The code bundle is ${bundle.byteLength} bytes; the limit is ${MAX_BUNDLE_BYTES}.`);
|
|
62
|
+
}
|
|
63
|
+
const archiveInput = { files: lowered.sourceFiles };
|
|
64
|
+
const lock = lockText(project.root);
|
|
65
|
+
if (lock !== undefined)
|
|
66
|
+
archiveInput.lock = lock;
|
|
67
|
+
if (lowered.vendored) {
|
|
68
|
+
archiveInput.vendored = Object.fromEntries(Object.entries(lowered.vendored).map(([name, pkg]) => [
|
|
69
|
+
name,
|
|
70
|
+
{ version: pkg.version, files: { ...pkg.files } },
|
|
71
|
+
]));
|
|
72
|
+
}
|
|
73
|
+
const archive = packSources(archiveInput);
|
|
74
|
+
if (archive.byteLength > MAX_SOURCE_ARCHIVE_BYTES) {
|
|
75
|
+
throw new CliUserError(`The source archive is ${archive.byteLength} bytes; the limit is ${MAX_SOURCE_ARCHIVE_BYTES}.`, { hint: 'Vendored dependencies count toward it; drop unused `dependencies`.' });
|
|
76
|
+
}
|
|
77
|
+
return {
|
|
78
|
+
buildId: lowered.buildId,
|
|
79
|
+
sourceHash: lowered.sourceHash,
|
|
80
|
+
sdkVersion: SDK_VERSION,
|
|
81
|
+
bundle,
|
|
82
|
+
archive,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
async function put(env, target, body, what) {
|
|
86
|
+
if (target.method.toUpperCase() !== 'PUT') {
|
|
87
|
+
throw new CliUserError(`The service asked for a ${target.method} ${what} upload; expected PUT.`);
|
|
88
|
+
}
|
|
89
|
+
presignedUrl(target.url, `${what} upload`);
|
|
90
|
+
const headers = Object.fromEntries(Object.entries(target.headers).filter(([name]) => !CLIENT_HEADERS.has(name.toLowerCase())));
|
|
91
|
+
let response;
|
|
92
|
+
try {
|
|
93
|
+
response = await env.fetch(target.url, { method: 'PUT', headers, body });
|
|
94
|
+
}
|
|
95
|
+
catch (error) {
|
|
96
|
+
// The URL carries a signature; it is never printed.
|
|
97
|
+
throw new CliUserError(`Uploading the ${what} failed: ${describeError(error)}`);
|
|
98
|
+
}
|
|
99
|
+
if (!response.ok) {
|
|
100
|
+
// Only the error code and message: an S3 error body echoes the access key
|
|
101
|
+
// id, the string to sign and the signature of the presigned request.
|
|
102
|
+
const body = await readCapped(response, ERROR_BODY_BYTES, () => new Error('too large'))
|
|
103
|
+
.then((bytes) => new TextDecoder().decode(bytes))
|
|
104
|
+
.catch(() => '');
|
|
105
|
+
const summary = storageErrorSummary(body);
|
|
106
|
+
throw new CliUserError(`Uploading the ${what} failed with HTTP ${response.status}${summary ? ` (${summary})` : ''}.`);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
/** Get an upload ticket for `workflowKey` and send what the service does not have yet. */
|
|
110
|
+
export async function uploadBundle(env, prepared, workflowKey) {
|
|
111
|
+
const ticket = await env.api.prepareCodeUpload({
|
|
112
|
+
workflowKey,
|
|
113
|
+
buildId: prepared.buildId,
|
|
114
|
+
bundleBytes: prepared.bundle.byteLength,
|
|
115
|
+
sourceHash: prepared.sourceHash,
|
|
116
|
+
sourceBytes: prepared.archive.byteLength,
|
|
117
|
+
});
|
|
118
|
+
let bundleSent = false;
|
|
119
|
+
if (!ticket.bundle.alreadyStored) {
|
|
120
|
+
await put(env, ticket.bundle, prepared.bundle, 'code bundle');
|
|
121
|
+
bundleSent = true;
|
|
122
|
+
}
|
|
123
|
+
let sourceSent = false;
|
|
124
|
+
if (ticket.source && !ticket.source.alreadyStored) {
|
|
125
|
+
await put(env, ticket.source, prepared.archive, 'source archive');
|
|
126
|
+
sourceSent = true;
|
|
127
|
+
}
|
|
128
|
+
return { uploadId: ticket.uploadId, bundleSent, sourceSent };
|
|
129
|
+
}
|
|
130
|
+
function isRecord(value) {
|
|
131
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* The `code` block of a workflow that the prepared bundle serves. Refuses a
|
|
135
|
+
* workflow that runs no code or records another build; `push` calls it for
|
|
136
|
+
* every version it will write before it writes the first one.
|
|
137
|
+
*/
|
|
138
|
+
export function bundleCodeBlock(workflow, prepared) {
|
|
139
|
+
const code = workflow.definition['code'];
|
|
140
|
+
if (!isRecord(code)) {
|
|
141
|
+
throw new CliUserError(`${workflow.key} does not run code; it needs no bundle.`);
|
|
142
|
+
}
|
|
143
|
+
if (code['buildId'] !== prepared.buildId) {
|
|
144
|
+
throw new CliUserError(`${workflow.key} records buildId ${String(code['buildId'])}, but the bundle is ${prepared.buildId}.`);
|
|
145
|
+
}
|
|
146
|
+
return code;
|
|
147
|
+
}
|
|
148
|
+
/** `CodeBundleInput` for one workflow's version, from its definition's `code` block. */
|
|
149
|
+
export function codeBundleInput(uploadId, workflow, prepared) {
|
|
150
|
+
const code = bundleCodeBlock(workflow, prepared);
|
|
151
|
+
return {
|
|
152
|
+
uploadId,
|
|
153
|
+
buildId: prepared.buildId,
|
|
154
|
+
language: typeof code['language'] === 'string' ? code['language'] : 'typescript',
|
|
155
|
+
sdkVersion: prepared.sdkVersion,
|
|
156
|
+
entry: workflow.path,
|
|
157
|
+
exports: code['exports'] ?? { workflows: {} },
|
|
158
|
+
determinism: typeof code['determinism'] === 'string' ? code['determinism'] : 'isolate',
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
//# sourceMappingURL=code-upload.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-upload.js","sourceRoot":"","sources":["../../src/code-first/code-upload.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAsB,MAAM,iCAAiC,CAAC;AAClF,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAI5B,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAE/E,OAAO,EAAE,aAAa,EAAmB,MAAM,aAAa,CAAC;AAE7D,4EAA4E;AAC5E,MAAM,CAAC,MAAM,wBAAwB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAEzD,gEAAgE;AAChE,MAAM,gBAAgB,GAAG,EAAE,GAAG,IAAI,CAAC;AAEnC,kEAAkE;AAClE,MAAM,CAAC,MAAM,SAAS,GAAsB;IAC1C,UAAU;IACV,mBAAmB;IACnB,gBAAgB;IAChB,WAAW;CACZ,CAAC;AAEF;;;;GAIG;AACH,MAA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,CAAC,GAAG,oBAAoB,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,uBAAuB,QAAQ,CAAC,OAAO,GAAG,CACrG,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,wFAAwF;AACxF,MAAM,UAAU,eAAe,CAC7B,QAAgB,EAChB,QAAuB,EACvB,QAAwB;IAExB,MAAM,IAAI,GAAG,eAAe,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IACjD,OAAO;QACL,QAAQ;QACR,OAAO,EAAE,QAAQ,CAAC,OAAO;QACzB,QAAQ,EAAE,OAAO,IAAI,CAAC,UAAU,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,YAAY;QAChF,UAAU,EAAE,QAAQ,CAAC,UAAU;QAC/B,KAAK,EAAE,QAAQ,CAAC,IAAI;QACpB,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE;QAC7C,WAAW,EAAE,OAAO,IAAI,CAAC,aAAa,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,SAAS;KACvF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `fluidgrids push --hotfix <version> [key]`: replace the code bundle of an
|
|
3
|
+
* existing version (spec 06 §2, decision DB10) instead of creating a version.
|
|
4
|
+
*
|
|
5
|
+
* 1. The local lowering of the workflow must equal the stored version except
|
|
6
|
+
* for its code: a hotfix fixes code, it never changes the graph, the
|
|
7
|
+
* exported functions or their interfaces.
|
|
8
|
+
* 2. `--replay-sample N` first replays the N most recent durable runs of that
|
|
9
|
+
* version locally in the QuickJS isolate, and refuses on a violation. It
|
|
10
|
+
* scans the newest runs of the key up to a bound, warns when it found fewer
|
|
11
|
+
* than N and refuses when it found none.
|
|
12
|
+
* 3. The bundle is uploaded as for a push, `replaceWorkflowVersionCode` starts
|
|
13
|
+
* the service's job, and the CLI polls `workflowCodeReplace` until the job
|
|
14
|
+
* ends REPLACED or REJECTED (the service replays up to 50 open and 50
|
|
15
|
+
* completed runs; `--no-verify-replay` skips that and is audited). The
|
|
16
|
+
* result is emitted before a REJECTED job or a timeout exits non-zero.
|
|
17
|
+
*/
|
|
18
|
+
import type { CodeReplaceResult } from '../api.js';
|
|
19
|
+
import { type ReplayOutcome } from '../replay.js';
|
|
20
|
+
import { type CommandEnv } from '../shared.js';
|
|
21
|
+
import { type PushOptions } from './push.js';
|
|
22
|
+
/** Poll interval of the replacement job. */
|
|
23
|
+
export declare const HOTFIX_POLL_MS = 2000;
|
|
24
|
+
/** Default wait for the replacement job (the service replays up to 100 runs). */
|
|
25
|
+
export declare const HOTFIX_DEFAULT_TIMEOUT_MS: number;
|
|
26
|
+
export interface HotfixResult {
|
|
27
|
+
key: string;
|
|
28
|
+
version: string;
|
|
29
|
+
buildId: string;
|
|
30
|
+
previousBuildId: string;
|
|
31
|
+
status: CodeReplaceResult['status'];
|
|
32
|
+
/** True when `--timeout` passed before the job ended; `status` is its last state. */
|
|
33
|
+
timedOut: boolean;
|
|
34
|
+
jobId: string;
|
|
35
|
+
verifiedRuns: number;
|
|
36
|
+
bundleUploaded: boolean;
|
|
37
|
+
verifyReplay: boolean;
|
|
38
|
+
/** What `--replay-sample` found and replayed; null without it. */
|
|
39
|
+
replaySample: ReplaySample | null;
|
|
40
|
+
localReplays: Array<Omit<ReplayOutcome, 'result'>>;
|
|
41
|
+
violations: CodeReplaceResult['violations'];
|
|
42
|
+
}
|
|
43
|
+
/** Runs of the key scanned for a `--replay-sample` (newest first). */
|
|
44
|
+
export declare const HOTFIX_SAMPLE_SCAN_LIMIT = 500;
|
|
45
|
+
/** What `--replay-sample` replayed. */
|
|
46
|
+
export interface ReplaySample {
|
|
47
|
+
requested: number;
|
|
48
|
+
/** Durable runs of the version found among the newest runs of the key. */
|
|
49
|
+
found: number;
|
|
50
|
+
/** Runs of the key that were scanned. */
|
|
51
|
+
scanned: number;
|
|
52
|
+
}
|
|
53
|
+
export declare function runHotfix(env: CommandEnv, keys: readonly string[], options: PushOptions): Promise<HotfixResult>;
|
|
54
|
+
//# sourceMappingURL=hotfix.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hotfix.d.ts","sourceRoot":"","sources":["../../../src/code-first/commands/hotfix.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAKH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAMnD,OAAO,EAAmC,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AACnF,OAAO,EAA0B,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AACvE,OAAO,EAAkB,KAAK,WAAW,EAAE,MAAM,WAAW,CAAC;AAE7D,4CAA4C;AAC5C,eAAO,MAAM,cAAc,OAAQ,CAAC;AACpC,iFAAiF;AACjF,eAAO,MAAM,yBAAyB,QAAc,CAAC;AAErD,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IACpC,qFAAqF;IACrF,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,OAAO,CAAC;IACxB,YAAY,EAAE,OAAO,CAAC;IACtB,kEAAkE;IAClE,YAAY,EAAE,YAAY,GAAG,IAAI,CAAC;IAClC,YAAY,EAAE,KAAK,CAAC,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC,CAAC;IACnD,UAAU,EAAE,iBAAiB,CAAC,YAAY,CAAC,CAAC;CAC7C;AAuDD,sEAAsE;AACtE,eAAO,MAAM,wBAAwB,MAAM,CAAC;AAE5C,uCAAuC;AACvC,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,0EAA0E;IAC1E,KAAK,EAAE,MAAM,CAAC;IACd,yCAAyC;IACzC,OAAO,EAAE,MAAM,CAAC;CACjB;AAoDD,wBAAsB,SAAS,CAC7B,GAAG,EAAE,UAAU,EACf,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,OAAO,EAAE,WAAW,GACnB,OAAO,CAAC,YAAY,CAAC,CAgBvB"}
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `fluidgrids push --hotfix <version> [key]`: replace the code bundle of an
|
|
3
|
+
* existing version (spec 06 §2, decision DB10) instead of creating a version.
|
|
4
|
+
*
|
|
5
|
+
* 1. The local lowering of the workflow must equal the stored version except
|
|
6
|
+
* for its code: a hotfix fixes code, it never changes the graph, the
|
|
7
|
+
* exported functions or their interfaces.
|
|
8
|
+
* 2. `--replay-sample N` first replays the N most recent durable runs of that
|
|
9
|
+
* version locally in the QuickJS isolate, and refuses on a violation. It
|
|
10
|
+
* scans the newest runs of the key up to a bound, warns when it found fewer
|
|
11
|
+
* than N and refuses when it found none.
|
|
12
|
+
* 3. The bundle is uploaded as for a push, `replaceWorkflowVersionCode` starts
|
|
13
|
+
* the service's job, and the CLI polls `workflowCodeReplace` until the job
|
|
14
|
+
* ends REPLACED or REJECTED (the service replays up to 50 open and 50
|
|
15
|
+
* completed runs; `--no-verify-replay` skips that and is audited). The
|
|
16
|
+
* result is emitted before a REJECTED job or a timeout exits non-zero.
|
|
17
|
+
*/
|
|
18
|
+
import { CliUserError } from '@burdenoff/cli-sdk/core';
|
|
19
|
+
import { canonicalJson } from '@fluidgrids/workflows/ir';
|
|
20
|
+
import { bundleCodeBlock, codeBundleInput, prepareBundle, uploadBundle } from '../code-upload.js';
|
|
21
|
+
import { fetchHistory } from '../history.js';
|
|
22
|
+
import { writeLock } from '../project.js';
|
|
23
|
+
import { comparableRemote, outgoingDefinition, sameContent } from '../remote.js';
|
|
24
|
+
import { createReplayer, describeOutcome } from '../replay.js';
|
|
25
|
+
import { emit, parsePositiveInt } from '../shared.js';
|
|
26
|
+
import { loadPushInputs } from './push.js';
|
|
27
|
+
/** Poll interval of the replacement job. */
|
|
28
|
+
export const HOTFIX_POLL_MS = 2_000;
|
|
29
|
+
/** Default wait for the replacement job (the service replays up to 100 runs). */
|
|
30
|
+
export const HOTFIX_DEFAULT_TIMEOUT_MS = 10 * 60_000;
|
|
31
|
+
function isRecord(value) {
|
|
32
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
33
|
+
}
|
|
34
|
+
/** The definition without the parts a hotfix may change (`code.buildId`, provenance). */
|
|
35
|
+
function withoutCode(definition) {
|
|
36
|
+
const copy = { ...definition };
|
|
37
|
+
delete copy['code'];
|
|
38
|
+
delete copy['authoring'];
|
|
39
|
+
return copy;
|
|
40
|
+
}
|
|
41
|
+
function exportsOf(definition) {
|
|
42
|
+
const code = definition['code'];
|
|
43
|
+
return canonicalJson(isRecord(code) ? (code['exports'] ?? null) : null);
|
|
44
|
+
}
|
|
45
|
+
function pickWorkflow(selected, keys) {
|
|
46
|
+
const durable = selected.filter((workflow) => workflow.durable);
|
|
47
|
+
if (keys.length > 1) {
|
|
48
|
+
throw new CliUserError('`--hotfix` replaces the code of one version; name one workflow key.');
|
|
49
|
+
}
|
|
50
|
+
const [only, ...rest] = keys.length === 1 ? selected : durable;
|
|
51
|
+
if (!only || rest.length > 0) {
|
|
52
|
+
throw new CliUserError(durable.length === 0
|
|
53
|
+
? 'The project defines no durable-function workflow to hotfix.'
|
|
54
|
+
: '`--hotfix` replaces the code of one version; name the workflow key.', durable.length > 1
|
|
55
|
+
? { hint: `Durable workflows: ${durable.map((w) => w.key).join(', ')}` }
|
|
56
|
+
: undefined);
|
|
57
|
+
}
|
|
58
|
+
if (!only.durable) {
|
|
59
|
+
throw new CliUserError(`${only.key} does not run code; there is no bundle to hotfix.`);
|
|
60
|
+
}
|
|
61
|
+
return only;
|
|
62
|
+
}
|
|
63
|
+
/** An outcome without the raw task result, for output. */
|
|
64
|
+
function summarize(outcome) {
|
|
65
|
+
return {
|
|
66
|
+
name: outcome.name,
|
|
67
|
+
workflowFn: outcome.workflowFn,
|
|
68
|
+
events: outcome.events,
|
|
69
|
+
engine: outcome.engine,
|
|
70
|
+
ok: outcome.ok,
|
|
71
|
+
cause: outcome.cause,
|
|
72
|
+
message: outcome.message,
|
|
73
|
+
seq: outcome.seq,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
/** Runs of the key scanned for a `--replay-sample` (newest first). */
|
|
77
|
+
export const HOTFIX_SAMPLE_SCAN_LIMIT = 500;
|
|
78
|
+
async function localReplays(env, key, version, sample, bundle, buildId) {
|
|
79
|
+
// Newest first. The list has no version or kind filter, so it is scanned up
|
|
80
|
+
// to a bound: other versions and canvas runs of the same key are skipped.
|
|
81
|
+
const scanned = await env.api.listRuns(key, Math.max(HOTFIX_SAMPLE_SCAN_LIMIT, sample));
|
|
82
|
+
const runs = scanned
|
|
83
|
+
.filter((run) => run.version === version && run.executionKind === 'DURABLE_FN')
|
|
84
|
+
.slice(0, sample);
|
|
85
|
+
const found = { requested: sample, found: runs.length, scanned: scanned.length };
|
|
86
|
+
if (runs.length === 0) {
|
|
87
|
+
throw new CliUserError(`--replay-sample ${sample} found no durable runs of ${key} ${version} among the newest ${scanned.length} runs; nothing was replaced.`, { hint: "Drop --replay-sample to rely on the service's replay verification alone." });
|
|
88
|
+
}
|
|
89
|
+
const replayer = await createReplayer(bundle, buildId, 'quickjs');
|
|
90
|
+
try {
|
|
91
|
+
const outcomes = [];
|
|
92
|
+
for (const run of runs) {
|
|
93
|
+
const { file } = await fetchHistory(env, run.id);
|
|
94
|
+
outcomes.push(await replayer.replay(file, run.id));
|
|
95
|
+
}
|
|
96
|
+
return { outcomes, sample: found };
|
|
97
|
+
}
|
|
98
|
+
finally {
|
|
99
|
+
await replayer.close();
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
/** The job once it ended, or its last state when the wait timed out. */
|
|
103
|
+
async function waitForJob(env, started, timeoutMs) {
|
|
104
|
+
const deadline = Date.now() + timeoutMs;
|
|
105
|
+
let job = started;
|
|
106
|
+
while (job.status === 'PENDING' || job.status === 'VERIFYING') {
|
|
107
|
+
if (Date.now() > deadline)
|
|
108
|
+
return { job, timedOut: true };
|
|
109
|
+
await env.sleep(HOTFIX_POLL_MS);
|
|
110
|
+
job = await env.api.codeReplace(job.id);
|
|
111
|
+
}
|
|
112
|
+
return { job, timedOut: false };
|
|
113
|
+
}
|
|
114
|
+
export async function runHotfix(env, keys, options) {
|
|
115
|
+
const version = options.hotfix;
|
|
116
|
+
if (version === undefined || version.trim() === '') {
|
|
117
|
+
throw new CliUserError('`--hotfix` needs the version to replace, for example `--hotfix v3`.');
|
|
118
|
+
}
|
|
119
|
+
if (options.dryRun)
|
|
120
|
+
throw new CliUserError('`--hotfix` and `--dry-run` cannot be combined.');
|
|
121
|
+
const sample = parsePositiveInt(options.replaySample, '--replay-sample') ?? 0;
|
|
122
|
+
const timeoutMs = parsePositiveInt(options.timeout, '--timeout') ?? HOTFIX_DEFAULT_TIMEOUT_MS;
|
|
123
|
+
const inputs = await loadPushInputs(env, keys, options);
|
|
124
|
+
return hotfixWorkflow(env, inputs.project, inputs.lowered, pickWorkflow(inputs.selected, keys), {
|
|
125
|
+
version,
|
|
126
|
+
sample,
|
|
127
|
+
timeoutMs,
|
|
128
|
+
verifyReplay: options.verifyReplay !== false,
|
|
129
|
+
format: options.format,
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
async function hotfixWorkflow(env, project, lowered, workflow, settings) {
|
|
133
|
+
const { version } = settings;
|
|
134
|
+
// The local refusals (no bundle, size caps, a buildId mismatch) come first.
|
|
135
|
+
const prepared = prepareBundle(project, lowered);
|
|
136
|
+
bundleCodeBlock(workflow, prepared);
|
|
137
|
+
const stored = await env.api.exportWorkflow(workflow.key, version);
|
|
138
|
+
const storedDefinition = comparableRemote(stored.definitionJson, workflow.key);
|
|
139
|
+
if (!isRecord(storedDefinition['code'])) {
|
|
140
|
+
throw new CliUserError(`${workflow.key} ${version} has no code bundle; push a new version.`);
|
|
141
|
+
}
|
|
142
|
+
// Aligned the way push compares, so data pinned on the canvas is no change.
|
|
143
|
+
const outgoing = outgoingDefinition(workflow.definition, storedDefinition);
|
|
144
|
+
if (!sameContent(withoutCode(outgoing), withoutCode(storedDefinition))) {
|
|
145
|
+
throw new CliUserError(`The workflow graph of ${workflow.key} differs from ${version}; a hotfix replaces only code.`, { hint: 'Push a new version instead (`fluidgrids push`).' });
|
|
146
|
+
}
|
|
147
|
+
if (exportsOf(workflow.definition) !== exportsOf(storedDefinition)) {
|
|
148
|
+
throw new CliUserError(`The exported functions or interfaces of ${workflow.key} differ from ${version}; a hotfix replaces only code.`, { hint: 'Push a new version instead (`fluidgrids push`).' });
|
|
149
|
+
}
|
|
150
|
+
const previous = storedDefinition['code']['buildId'];
|
|
151
|
+
if (previous === prepared.buildId) {
|
|
152
|
+
throw new CliUserError(`${workflow.key} ${version} already runs ${prepared.buildId}.`);
|
|
153
|
+
}
|
|
154
|
+
const sampled = settings.sample > 0
|
|
155
|
+
? await localReplays(env, workflow.key, version, settings.sample, lowered.bundle ?? '', prepared.buildId)
|
|
156
|
+
: undefined;
|
|
157
|
+
const outcomes = sampled?.outcomes ?? [];
|
|
158
|
+
const failed = outcomes.filter((outcome) => !outcome.ok);
|
|
159
|
+
if (failed.length > 0) {
|
|
160
|
+
throw new CliUserError(`The new code fails to replay ${failed.length} of ${outcomes.length} sampled runs; nothing was replaced.`, { hint: failed.map(describeOutcome).join('\n') });
|
|
161
|
+
}
|
|
162
|
+
const upload = await uploadBundle(env, prepared, workflow.key);
|
|
163
|
+
const started = await env.api.replaceVersionCode(workflow.key, version, codeBundleInput(upload.uploadId, workflow, prepared), settings.verifyReplay);
|
|
164
|
+
const { job, timedOut } = await waitForJob(env, started, settings.timeoutMs);
|
|
165
|
+
const result = {
|
|
166
|
+
key: workflow.key,
|
|
167
|
+
version,
|
|
168
|
+
buildId: job.buildId,
|
|
169
|
+
previousBuildId: job.previousBuildId,
|
|
170
|
+
status: job.status,
|
|
171
|
+
timedOut,
|
|
172
|
+
jobId: job.id,
|
|
173
|
+
verifiedRuns: job.verifiedRuns,
|
|
174
|
+
bundleUploaded: upload.bundleSent,
|
|
175
|
+
verifyReplay: settings.verifyReplay,
|
|
176
|
+
replaySample: sampled?.sample ?? null,
|
|
177
|
+
localReplays: outcomes.map(summarize),
|
|
178
|
+
violations: job.violations,
|
|
179
|
+
};
|
|
180
|
+
const replaced = job.status === 'REPLACED';
|
|
181
|
+
if (replaced) {
|
|
182
|
+
const tracked = project.lock.workflows[workflow.key];
|
|
183
|
+
if (tracked && tracked.version === version) {
|
|
184
|
+
project.lock.workflows[workflow.key] = { ...tracked, buildId: prepared.buildId };
|
|
185
|
+
}
|
|
186
|
+
project.lock.bundle = {
|
|
187
|
+
buildId: prepared.buildId,
|
|
188
|
+
sourceHash: prepared.sourceHash,
|
|
189
|
+
sdkVersion: prepared.sdkVersion,
|
|
190
|
+
};
|
|
191
|
+
writeLock(project);
|
|
192
|
+
}
|
|
193
|
+
const details = [
|
|
194
|
+
`${workflow.key} ${version}: ${result.previousBuildId} -> ${result.buildId}`,
|
|
195
|
+
...outcomes.map(describeOutcome),
|
|
196
|
+
];
|
|
197
|
+
const sample = sampled?.sample;
|
|
198
|
+
if (sample && sample.found < sample.requested) {
|
|
199
|
+
const warning = `--replay-sample ${sample.requested}: only ${sample.found} durable run(s) of ${version} among the newest ${sample.scanned} runs were replayed locally.`;
|
|
200
|
+
// stderr, so a `--format json` caller's stdout stays one document.
|
|
201
|
+
env.ctx.output.printWarning(warning);
|
|
202
|
+
}
|
|
203
|
+
if (!settings.verifyReplay)
|
|
204
|
+
details.push('Replay verification was skipped (audited).');
|
|
205
|
+
// The result goes out first, so `--format json` gets the job even when it failed.
|
|
206
|
+
emit(env, { ...(settings.format !== undefined ? { format: settings.format } : {}) }, result, {
|
|
207
|
+
headers: ['Workflow', 'Version', 'Status', 'Verified runs', 'Build'],
|
|
208
|
+
rows: [[result.key, version, result.status, String(result.verifiedRuns), result.buildId]],
|
|
209
|
+
}, details);
|
|
210
|
+
if (timedOut) {
|
|
211
|
+
throw new CliUserError(`The code replacement ${job.id} is still ${job.status} after ${settings.timeoutMs} ms.`, { hint: 'It keeps running on the service; check it again with `fluidgrids versions list`.' });
|
|
212
|
+
}
|
|
213
|
+
if (job.status === 'REJECTED') {
|
|
214
|
+
throw new CliUserError(`The service rejected the new code for ${workflow.key} ${version}: ${job.violations.length} replay violation(s).`, {
|
|
215
|
+
hint: job.violations
|
|
216
|
+
.map((v) => `run ${v.runId}${v.seq !== null ? ` event ${v.seq}` : ''}: ${v.message}`)
|
|
217
|
+
.join('\n'),
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
if (!replaced) {
|
|
221
|
+
throw new CliUserError(`The code replacement ${job.id} ended ${job.status}; the version keeps its code.`);
|
|
222
|
+
}
|
|
223
|
+
return result;
|
|
224
|
+
}
|
|
225
|
+
//# sourceMappingURL=hotfix.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hotfix.js","sourceRoot":"","sources":["../../../src/code-first/commands/hotfix.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAGzD,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAClG,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,OAAO,EAAE,SAAS,EAAgB,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,gBA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,36 @@
|
|
|
15
15
|
* records (changed on the canvas or pushed from elsewhere since the pull) is
|
|
16
16
|
* refused, unless `--force` is given, so a push never silently reverts it.
|
|
17
17
|
*
|
|
18
|
-
*
|
|
18
|
+
* Durable functions (Phase B, BOFF-9905):
|
|
19
|
+
* - A workflow whose definition carries a `code` block (tier-2 `workflow()`
|
|
20
|
+
* functions, or a tier-1 graph with `wf.codeWorkflow`) gets its version with
|
|
21
|
+
* `codeBundle`: the bundle is uploaded through `prepareWorkflowCodeUpload`
|
|
22
|
+
* (see `code-upload.ts`). One bundle serves every version of the push.
|
|
23
|
+
* - Findings in the sources (`durable.phaseC`, `durable.activityTypeNotAllowed`)
|
|
24
|
+
* refuse the push before anything is written. Python durable functions are
|
|
25
|
+
* Phase C.
|
|
26
|
+
* - `--hotfix <version>` replaces the bundle of an existing version instead
|
|
27
|
+
* (see `hotfix.ts`).
|
|
28
|
+
* - `lock.json` records `{buildId, sourceHash, sdkVersion}` of the bundle and
|
|
29
|
+
* the `buildId` of each version that references it.
|
|
19
30
|
*/
|
|
31
|
+
import { type DurableIssue, type LocalWorkflow, type LoweredProject } from '../lowering.js';
|
|
32
|
+
import { type Project } from '../project.js';
|
|
33
|
+
import { RemoteWorkflows } from '../remote.js';
|
|
20
34
|
import { type CommandEnv, type ProjectOptions } from '../shared.js';
|
|
21
35
|
export interface PushOptions extends ProjectOptions {
|
|
22
36
|
dryRun?: boolean;
|
|
23
37
|
message?: string;
|
|
24
38
|
/** Push even over versions created in the workspace after the project pulled the workflow. */
|
|
25
39
|
force?: boolean;
|
|
40
|
+
/** Replace the code bundle of this existing version instead of creating a version. */
|
|
41
|
+
hotfix?: string;
|
|
42
|
+
/** With `--hotfix`: replay this many recent runs of the version locally first. */
|
|
43
|
+
replaySample?: string;
|
|
44
|
+
/** With `--hotfix`: false skips the service's replay verification (audited). */
|
|
45
|
+
verifyReplay?: boolean;
|
|
46
|
+
/** With `--hotfix`: how long to wait for the replacement job, in milliseconds. */
|
|
47
|
+
timeout?: string;
|
|
26
48
|
}
|
|
27
49
|
export type PushAction = 'created' | 'versioned' | 'unchanged' | 'would-create' | 'would-version';
|
|
28
50
|
export interface PushItem {
|
|
@@ -40,6 +62,11 @@ export interface PushItem {
|
|
|
40
62
|
}>;
|
|
41
63
|
truncated: boolean;
|
|
42
64
|
warnings: string[];
|
|
65
|
+
/** The code bundle the version references; null for a graph-only workflow. */
|
|
66
|
+
bundle: {
|
|
67
|
+
buildId: string;
|
|
68
|
+
uploaded: boolean;
|
|
69
|
+
} | null;
|
|
43
70
|
}
|
|
44
71
|
export interface PushResult {
|
|
45
72
|
dryRun: boolean;
|
|
@@ -47,5 +74,24 @@ export interface PushResult {
|
|
|
47
74
|
sourceHash: string | null;
|
|
48
75
|
workflows: PushItem[];
|
|
49
76
|
}
|
|
77
|
+
/** The sentence `push` and `validate` give for durable-function findings. */
|
|
78
|
+
export declare function durableSummary(issues: readonly DurableIssue[]): string;
|
|
79
|
+
/** Refuse a project with durable-function findings, before anything is written. */
|
|
80
|
+
export declare function assertNoDurableIssues(issues: readonly DurableIssue[]): void;
|
|
81
|
+
/** The `buildId` a definition's `code` block records. */
|
|
82
|
+
export declare function codeBuildId(workflow: LocalWorkflow): string | undefined;
|
|
83
|
+
/** What a push works from: the project, its lowering and the selected workflows. */
|
|
84
|
+
export interface PushInputs {
|
|
85
|
+
project: Project;
|
|
86
|
+
lowered: LoweredProject;
|
|
87
|
+
selected: LocalWorkflow[];
|
|
88
|
+
remote: RemoteWorkflows;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Load, lower and validate the project for a push (and a hotfix): connection
|
|
92
|
+
* names resolve in the workspace, the named keys must exist, every selected
|
|
93
|
+
* workflow must validate, and durable-function findings refuse the push.
|
|
94
|
+
*/
|
|
95
|
+
export declare function loadPushInputs(env: CommandEnv, keys: readonly string[], options: PushOptions): Promise<PushInputs>;
|
|
50
96
|
export declare function runPush(env: CommandEnv, keys: readonly string[], options: PushOptions): Promise<PushResult>;
|
|
51
97
|
//# sourceMappingURL=push.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"push.d.ts","sourceRoot":"","sources":["../../../src/code-first/commands/push.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"push.d.ts","sourceRoot":"","sources":["../../../src/code-first/commands/push.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAcH,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,cAAc,EACpB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAKL,KAAK,OAAO,EACb,MAAM,eAAe,CAAC;AACvB,OAAO,EAIL,eAAe,EAEhB,MAAM,cAAc,CAAC;AACtB,OAAO,EAA0B,KAAK,UAAU,EAAE,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAE5F,MAAM,WAAW,WAAY,SAAQ,cAAc;IACjD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,8FAA8F;IAC9F,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,sFAAsF;IACtF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kFAAkF;IAClF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gFAAgF;IAChF,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,kFAAkF;IAClF,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,WAAW,GAAG,WAAW,GAAG,cAAc,GAAG,eAAe,CAAC;AAElG,MAAM,WAAW,QAAQ;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,UAAU,CAAC;IACnB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,+EAA+E;IAC/E,OAA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