@reventlessdev/reventless-aws 3.0.0-alpha.341 → 3.0.0-alpha.343
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/CHANGELOG.md +14 -0
- package/package.json +9 -9
- package/src/Platform.res +8 -0
- package/src/Platform.res.mjs +14 -6
- package/src/adapter/Api/Platform_ComponentDefinitions_Lambda_Ops.res +5 -0
- package/src/adapter/Api/Platform_ComponentDefinitions_Lambda_Ops.res.mjs +2 -1
- package/src/plugin/runtime/PluginRuntime_Builder.res +6 -7
- package/src/plugin/runtime/PluginRuntime_Builder.res.mjs +2 -2
- package/src/util/Util_Lambda.res +13 -0
- package/src/util/Util_Lambda.res.mjs +7 -1
- package/tests/EventCollectorConnectLambdaPreviewTest.res +1 -0
- package/tests/EventCollectorConnectLambdaPreviewTest.res.mjs +2 -1
- package/tests/EventCollectorReadyGateTest.res +46 -32
- package/tests/EventCollectorReadyGateTest.res.mjs +19 -13
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,20 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# 3.0.0-alpha.343 (2026-09-08)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **aws:** the collector gate waits on the one property an update changes ([2c48193](https://github.com/ReventlessDev/reventless-core/commit/2c481934d58c64b8e637d0df1b051b03cf59a35c))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
# 3.0.0-alpha.342 (2026-09-08)
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* **aws:** the boot files a deploy rewrites in place carry no-cache ([01a4d21](https://github.com/ReventlessDev/reventless-core/commit/01a4d21a50a7890fcbd541f8a336b1333100148a))
|
|
18
|
+
|
|
19
|
+
|
|
6
20
|
# 3.0.0-alpha.341 (2026-09-08)
|
|
7
21
|
|
|
8
22
|
### Bug Fixes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reventlessdev/reventless-aws",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.343",
|
|
4
4
|
"description": "AWS adapters for Reventless",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"bin": {
|
|
@@ -15,18 +15,18 @@
|
|
|
15
15
|
"@aws-sdk/s3-request-presigner": "3.970.0",
|
|
16
16
|
"sury": "11.0.0-rc.2",
|
|
17
17
|
"uuid": "^13.0.0",
|
|
18
|
-
"@reventlessdev/rescript-aws-sdk": "3.0.0-alpha.
|
|
19
|
-
"@reventlessdev/rescript-jest": "1.0.0-alpha.10",
|
|
20
|
-
"@reventlessdev/rescript-node": "2.0.0-alpha.9",
|
|
18
|
+
"@reventlessdev/rescript-aws-sdk": "3.0.0-alpha.16",
|
|
21
19
|
"@reventlessdev/rescript-effect": "0.1.0-alpha.32",
|
|
22
|
-
"@reventlessdev/rescript-
|
|
20
|
+
"@reventlessdev/rescript-jest": "1.0.0-alpha.10",
|
|
21
|
+
"@reventlessdev/rescript-node": "2.0.0-alpha.10",
|
|
22
|
+
"@reventlessdev/rescript-pulumi-aws": "3.0.0-alpha.11",
|
|
23
23
|
"@reventlessdev/rescript-pulumi-pulumi": "2.3.0-alpha.19",
|
|
24
24
|
"@reventlessdev/rescript-uuid": "2.0.0-alpha.0",
|
|
25
|
-
"@reventlessdev/reventless-
|
|
26
|
-
"@reventlessdev/reventless-infra": "3.0.0-alpha.160",
|
|
25
|
+
"@reventlessdev/reventless-infra": "3.0.0-alpha.161",
|
|
27
26
|
"@reventlessdev/reventless-interop": "3.0.0-alpha.35",
|
|
28
|
-
"@reventlessdev/reventless-postgres": "3.0.0-alpha.
|
|
29
|
-
"@reventlessdev/reventless-spec": "3.0.0-alpha.
|
|
27
|
+
"@reventlessdev/reventless-postgres": "3.0.0-alpha.124",
|
|
28
|
+
"@reventlessdev/reventless-spec": "3.0.0-alpha.133",
|
|
29
|
+
"@reventlessdev/reventless-core": "3.0.0-alpha.260"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"rescript": "12.3.0",
|
package/src/Platform.res
CHANGED
|
@@ -2321,6 +2321,11 @@ module MakeWithConfig = (
|
|
|
2321
2321
|
->JSON.stringify
|
|
2322
2322
|
})
|
|
2323
2323
|
|
|
2324
|
+
// `Plugin_Stack.cacheControlFor`'s rule, for this file and the two below:
|
|
2325
|
+
// the content changes across deploys while the URL does not, so without it
|
|
2326
|
+
// CloudFront and the browser serve the previous deploy's answer.
|
|
2327
|
+
let bootFileCacheControl = Pulumi.Input.make("no-cache")
|
|
2328
|
+
|
|
2324
2329
|
let _ = PulumiAws.S3.BucketObject.make(
|
|
2325
2330
|
~name="host-ui-config-json",
|
|
2326
2331
|
~args={
|
|
@@ -2328,6 +2333,7 @@ module MakeWithConfig = (
|
|
|
2328
2333
|
key: Pulumi.Input.make("config.json"),
|
|
2329
2334
|
content: configJsonContent->Pulumi.Output.asInput,
|
|
2330
2335
|
contentType: Pulumi.Input.make("application/json"),
|
|
2336
|
+
cacheControl: bootFileCacheControl,
|
|
2331
2337
|
},
|
|
2332
2338
|
)
|
|
2333
2339
|
|
|
@@ -2350,6 +2356,7 @@ module MakeWithConfig = (
|
|
|
2350
2356
|
key: Pulumi.Input.make("ui-hints.json"),
|
|
2351
2357
|
content: Pulumi.Input.make(hintsContent),
|
|
2352
2358
|
contentType: Pulumi.Input.make("application/json"),
|
|
2359
|
+
cacheControl: bootFileCacheControl,
|
|
2353
2360
|
},
|
|
2354
2361
|
)
|
|
2355
2362
|
}
|
|
@@ -2386,6 +2393,7 @@ module MakeWithConfig = (
|
|
|
2386
2393
|
key: Pulumi.Input.make(ReventlessCore.Platform_UiSlots.fileName),
|
|
2387
2394
|
content: Pulumi.Input.make(slotsContent),
|
|
2388
2395
|
contentType: Pulumi.Input.make("application/javascript; charset=utf-8"),
|
|
2396
|
+
cacheControl: bootFileCacheControl,
|
|
2389
2397
|
},
|
|
2390
2398
|
)
|
|
2391
2399
|
}
|
package/src/Platform.res.mjs
CHANGED
|
@@ -1251,11 +1251,13 @@ function MakeWithConfig(Config) {
|
|
|
1251
1251
|
]) : computed;
|
|
1252
1252
|
return JSON.stringify(Util_ShellConfig$ReventlessAws.fields(withEvents, hostUiBundle.viewModes, hostUiBundle.bakedManifest, hostUiBundle.uiSlotsFile, hostUiBundle.shellConfig));
|
|
1253
1253
|
});
|
|
1254
|
+
let bootFileCacheControl = "no-cache";
|
|
1254
1255
|
new (Aws.s3.BucketObject)("host-ui-config-json", {
|
|
1255
1256
|
bucket: bucketName,
|
|
1256
1257
|
key: "config.json",
|
|
1257
1258
|
content: configJsonContent,
|
|
1258
|
-
contentType: "application/json"
|
|
1259
|
+
contentType: "application/json",
|
|
1260
|
+
cacheControl: bootFileCacheControl
|
|
1259
1261
|
});
|
|
1260
1262
|
let hintsPath = hostUiBundle.uiHintsFile;
|
|
1261
1263
|
if (hintsPath !== undefined) {
|
|
@@ -1264,7 +1266,8 @@ function MakeWithConfig(Config) {
|
|
|
1264
1266
|
bucket: bucketName,
|
|
1265
1267
|
key: "ui-hints.json",
|
|
1266
1268
|
content: hintsContent,
|
|
1267
|
-
contentType: "application/json"
|
|
1269
|
+
contentType: "application/json",
|
|
1270
|
+
cacheControl: bootFileCacheControl
|
|
1268
1271
|
});
|
|
1269
1272
|
}
|
|
1270
1273
|
let slotsPath = hostUiBundle.uiSlotsFile;
|
|
@@ -1274,7 +1277,8 @@ function MakeWithConfig(Config) {
|
|
|
1274
1277
|
bucket: bucketName,
|
|
1275
1278
|
key: Platform_UiSlots$ReventlessCore.fileName,
|
|
1276
1279
|
content: slotsContent,
|
|
1277
|
-
contentType: "application/javascript; charset=utf-8"
|
|
1280
|
+
contentType: "application/javascript; charset=utf-8",
|
|
1281
|
+
cacheControl: bootFileCacheControl
|
|
1278
1282
|
});
|
|
1279
1283
|
}
|
|
1280
1284
|
let match$9 = hostUiBundle.bakedManifest;
|
|
@@ -2623,11 +2627,13 @@ function Make($star) {
|
|
|
2623
2627
|
]) : computed;
|
|
2624
2628
|
return JSON.stringify(Util_ShellConfig$ReventlessAws.fields(withEvents, hostUiBundle.viewModes, hostUiBundle.bakedManifest, hostUiBundle.uiSlotsFile, hostUiBundle.shellConfig));
|
|
2625
2629
|
});
|
|
2630
|
+
let bootFileCacheControl = "no-cache";
|
|
2626
2631
|
new (Aws.s3.BucketObject)("host-ui-config-json", {
|
|
2627
2632
|
bucket: bucketName,
|
|
2628
2633
|
key: "config.json",
|
|
2629
2634
|
content: configJsonContent,
|
|
2630
|
-
contentType: "application/json"
|
|
2635
|
+
contentType: "application/json",
|
|
2636
|
+
cacheControl: bootFileCacheControl
|
|
2631
2637
|
});
|
|
2632
2638
|
let hintsPath = hostUiBundle.uiHintsFile;
|
|
2633
2639
|
if (hintsPath !== undefined) {
|
|
@@ -2636,7 +2642,8 @@ function Make($star) {
|
|
|
2636
2642
|
bucket: bucketName,
|
|
2637
2643
|
key: "ui-hints.json",
|
|
2638
2644
|
content: hintsContent,
|
|
2639
|
-
contentType: "application/json"
|
|
2645
|
+
contentType: "application/json",
|
|
2646
|
+
cacheControl: bootFileCacheControl
|
|
2640
2647
|
});
|
|
2641
2648
|
}
|
|
2642
2649
|
let slotsPath = hostUiBundle.uiSlotsFile;
|
|
@@ -2646,7 +2653,8 @@ function Make($star) {
|
|
|
2646
2653
|
bucket: bucketName,
|
|
2647
2654
|
key: Platform_UiSlots$ReventlessCore.fileName,
|
|
2648
2655
|
content: slotsContent,
|
|
2649
|
-
contentType: "application/javascript; charset=utf-8"
|
|
2656
|
+
contentType: "application/javascript; charset=utf-8",
|
|
2657
|
+
cacheControl: bootFileCacheControl
|
|
2650
2658
|
});
|
|
2651
2659
|
}
|
|
2652
2660
|
let match$9 = hostUiBundle.bakedManifest;
|
|
@@ -645,6 +645,11 @@ let runBake = async (
|
|
|
645
645
|
key,
|
|
646
646
|
body: AwsSdk.S3.PutObjectCommand.bodyFromString(body),
|
|
647
647
|
contentType: "application/json",
|
|
648
|
+
// Stable-named, rewritten in place every deploy — `Plugin_Stack.cacheControlFor`'s
|
|
649
|
+
// rule. This file needs it most: it is written AFTER the deploy's `/*`
|
|
650
|
+
// invalidation, so nothing else dislodges a stale copy, and a shell
|
|
651
|
+
// holding one queries fields the API no longer has.
|
|
652
|
+
cacheControl: "no-cache",
|
|
648
653
|
})->AwsSdk.S3.PutObjectCommand.send
|
|
649
654
|
let report = Dict.fromArray([
|
|
650
655
|
("baked", JSON.Encode.bool(true)),
|
|
@@ -550,7 +550,8 @@ async function runBake(target, structures) {
|
|
|
550
550
|
Bucket: target.bucket,
|
|
551
551
|
Key: key,
|
|
552
552
|
Body: body,
|
|
553
|
-
ContentType: "application/json"
|
|
553
|
+
ContentType: "application/json",
|
|
554
|
+
CacheControl: "no-cache"
|
|
554
555
|
}));
|
|
555
556
|
let report = Object.fromEntries([
|
|
556
557
|
[
|
|
@@ -677,13 +677,12 @@ module Make = (
|
|
|
677
677
|
~opts,
|
|
678
678
|
)
|
|
679
679
|
|
|
680
|
-
//
|
|
681
|
-
//
|
|
682
|
-
//
|
|
683
|
-
//
|
|
684
|
-
//
|
|
685
|
-
eventCollectorReadyRef :=
|
|
686
|
-
runtime.parts.lambda->Pulumi.Output.flatMap(fn => fn.arn)->Pulumi.Output.apply(_ => ())
|
|
680
|
+
// Not the resource, and not one of its identifiers: both are known before the
|
|
681
|
+
// update lands, so either opens the gate while the collector is still serving
|
|
682
|
+
// the previous bundle — and the re-detect that follows is answered with the
|
|
683
|
+
// previous definition. `updateLanded` depends on the one property that cannot
|
|
684
|
+
// be known early.
|
|
685
|
+
eventCollectorReadyRef := runtime.parts.lambda->Util_Lambda.updateLanded
|
|
687
686
|
|
|
688
687
|
// Admin-only cross-plugin SNS subscription permissions. The admin EC
|
|
689
688
|
// Lambda's manageSubscriptions hook (Phase 3 Step 1) creates SNS
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import * as Aws from "@pulumi/aws";
|
|
4
4
|
import * as Stdlib_Array from "@rescript/runtime/lib/es6/Stdlib_Array.js";
|
|
5
|
-
import * as Output$Pulumi from "@reventlessdev/rescript-pulumi-pulumi/src/Output.res.mjs";
|
|
6
5
|
import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
7
6
|
import * as Pulumi from "@pulumi/pulumi";
|
|
8
7
|
import * as Primitive_string from "@rescript/runtime/lib/es6/Primitive_string.js";
|
|
@@ -15,6 +14,7 @@ import * as Heartbeat$ReventlessCore from "@reventlessdev/reventless-core/src/co
|
|
|
15
14
|
import * as PolicyDocument$PulumiAws from "@reventlessdev/rescript-pulumi-aws/src/IAM/PolicyDocument.res.mjs";
|
|
16
15
|
import * as PluginSpec$ReventlessCore from "@reventlessdev/reventless-core/src/plugin/lifecycle/PluginSpec.res.mjs";
|
|
17
16
|
import * as Util_Bundle$ReventlessAws from "../../util/Util_Bundle.res.mjs";
|
|
17
|
+
import * as Util_Lambda$ReventlessAws from "../../util/Util_Lambda.res.mjs";
|
|
18
18
|
import * as ComponentType$ReventlessCore from "@reventlessdev/reventless-core/src/ComponentType.res.mjs";
|
|
19
19
|
import * as EventCollector$ReventlessCore from "@reventlessdev/reventless-core/src/components/EventCollector/EventCollector.res.mjs";
|
|
20
20
|
import * as EventLogBackend$ReventlessAws from "../../adapter/EventLog/EventLogBackend.res.mjs";
|
|
@@ -414,7 +414,7 @@ function Make(EventCollectorChannel) {
|
|
|
414
414
|
eventTopics: eventTopics,
|
|
415
415
|
resources: resources
|
|
416
416
|
}], runtime, opts);
|
|
417
|
-
eventCollectorReadyRef.contents =
|
|
417
|
+
eventCollectorReadyRef.contents = Util_Lambda$ReventlessAws.updateLanded(runtime.parts.lambda);
|
|
418
418
|
let isAdminEventCollector = Stdlib_Option.isNone(Plugin_Helpers$ReventlessCore.eventCollectorContextRef.contents[name]);
|
|
419
419
|
if (isAdminEventCollector) {
|
|
420
420
|
new (Aws.iam.RolePolicy)(name + `-snsManageSubs`, {
|
package/src/util/Util_Lambda.res
CHANGED
|
@@ -26,8 +26,21 @@ let fromOutput = (output: Pulumi.Output.t<PulumiAws.Lambda.Function.t>) => {
|
|
|
26
26
|
id: output->Pulumi.Output.flatMap(({id}) => id),
|
|
27
27
|
name: output->Pulumi.Output.flatMap(({name}) => name),
|
|
28
28
|
invokeArn: output->Pulumi.Output.flatMap(({invokeArn}) => invokeArn),
|
|
29
|
+
lastModified: output->Pulumi.Output.flatMap(({lastModified}) => lastModified),
|
|
29
30
|
}
|
|
30
31
|
|
|
32
|
+
/** Resolves once the function's update has actually landed — the barrier a
|
|
33
|
+
deploy-time handshake needs before it may publish to that function.
|
|
34
|
+
|
|
35
|
+
It must depend on `lastModified`. The identifiers (`arn`, `id`, `name`,
|
|
36
|
+
`invokeArn`) are equal before and after a code update, so the engine resolves
|
|
37
|
+
them from existing state and a gate built on one of them opens while the
|
|
38
|
+
update is still in flight — measurably, about a second before it even starts.
|
|
39
|
+
`sourceCodeHash` is no better: it is also an input, so it can be known in
|
|
40
|
+
advance for the same reason. */
|
|
41
|
+
let updateLanded = (lambda: Pulumi.Output.t<PulumiAws.Lambda.Function.t>): Pulumi.Output.t<unit> =>
|
|
42
|
+
lambda->Pulumi.Output.flatMap(({lastModified}) => lastModified)->Pulumi.Output.apply(_ => ())
|
|
43
|
+
|
|
31
44
|
let functionToResource = (~tags=?, {id, name, arn}: PulumiAws.Lambda.Function.t): ReventlessInfra.Adapter.resource =>
|
|
32
45
|
ReventlessInfra.Adapter.make(
|
|
33
46
|
~name,
|
|
@@ -26,10 +26,15 @@ function fromOutput(output) {
|
|
|
26
26
|
arn: Output$Pulumi.flatMap(output, param => param.arn),
|
|
27
27
|
id: Output$Pulumi.flatMap(output, param => param.id),
|
|
28
28
|
name: Output$Pulumi.flatMap(output, param => param.name),
|
|
29
|
-
invokeArn: Output$Pulumi.flatMap(output, param => param.invokeArn)
|
|
29
|
+
invokeArn: Output$Pulumi.flatMap(output, param => param.invokeArn),
|
|
30
|
+
lastModified: Output$Pulumi.flatMap(output, param => param.lastModified)
|
|
30
31
|
};
|
|
31
32
|
}
|
|
32
33
|
|
|
34
|
+
function updateLanded(lambda) {
|
|
35
|
+
return Output$Pulumi.flatMap(lambda, param => param.lastModified).apply(param => {});
|
|
36
|
+
}
|
|
37
|
+
|
|
33
38
|
function functionToResource(tags, param) {
|
|
34
39
|
let name = param.name;
|
|
35
40
|
return Adapter$ReventlessInfra.make(name, param.id, param.arn, name.apply(param => AWS$ReventlessAws.Lambda.service), undefined, undefined, undefined, Pulumi.output("aws:lambda:Function"), undefined, tags);
|
|
@@ -40,6 +45,7 @@ export {
|
|
|
40
45
|
toResource,
|
|
41
46
|
fromResource,
|
|
42
47
|
fromOutput,
|
|
48
|
+
updateLanded,
|
|
43
49
|
functionToResource,
|
|
44
50
|
}
|
|
45
51
|
/* @pulumi/aws Not a pure module */
|
|
@@ -110,6 +110,7 @@ let lambda: Pulumi.Output.t<PulumiAws.Lambda.Function.t> = Pulumi.Output.make({
|
|
|
110
110
|
id: "AllStateViewSlices"->Pulumi.Output.make,
|
|
111
111
|
name: "AllStateViewSlices"->Pulumi.Output.make,
|
|
112
112
|
invokeArn: "arn:aws:apigateway:invoke"->Pulumi.Output.make,
|
|
113
|
+
lastModified: "2026-01-01T00:00:00.000+0000"->Pulumi.Output.make,
|
|
113
114
|
})
|
|
114
115
|
|
|
115
116
|
// ── Tests ────────────────────────────────────────────────────────────────────
|
|
@@ -66,7 +66,8 @@ let lambda = Pulumi.output({
|
|
|
66
66
|
arn: Pulumi.output("arn:aws:lambda:eu-west-1:123456789012:function:AllStateViewSlices"),
|
|
67
67
|
id: Pulumi.output("AllStateViewSlices"),
|
|
68
68
|
name: Pulumi.output("AllStateViewSlices"),
|
|
69
|
-
invokeArn: Pulumi.output("arn:aws:apigateway:invoke")
|
|
69
|
+
invokeArn: Pulumi.output("arn:aws:apigateway:invoke"),
|
|
70
|
+
lastModified: Pulumi.output("2026-01-01T00:00:00.000+0000")
|
|
70
71
|
});
|
|
71
72
|
|
|
72
73
|
globalThis.describe("EventCollectorChannel_Helpers.connectLambda under an unknown view table", () => {
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
open JestGlobals
|
|
2
2
|
|
|
3
|
-
// Guards what `
|
|
3
|
+
// Guards what `Util_Lambda.updateLanded` waits for — the barrier the deploy
|
|
4
|
+
// publishes its synthetic re-detect behind.
|
|
4
5
|
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
// registration keeps the old structure — with no second re-detect coming.
|
|
6
|
+
// That collector Lambda is what ANSWERS the handshake: reached while it is still
|
|
7
|
+
// serving the previous bundle, it replies with the previous definition, Connect
|
|
8
|
+
// sees a definition it already holds and emits nothing, and the registration
|
|
9
|
+
// keeps the old structure — with no second re-detect coming.
|
|
10
10
|
//
|
|
11
|
-
// The
|
|
12
|
-
//
|
|
13
|
-
//
|
|
14
|
-
//
|
|
15
|
-
//
|
|
16
|
-
//
|
|
11
|
+
// The first attempt at this gate depended on `arn`, and failed in production
|
|
12
|
+
// exactly as it had before: the re-detect went out ~1.2s BEFORE the Lambda update
|
|
13
|
+
// even started. A Lambda's identifiers are equal on both sides of a code update,
|
|
14
|
+
// so the engine resolves them from existing state without waiting for it. The
|
|
15
|
+
// mechanism (`flatMap` awaiting the Output it returns) was never in doubt — the
|
|
16
|
+
// property was.
|
|
17
17
|
//
|
|
18
|
-
// So
|
|
19
|
-
//
|
|
18
|
+
// So these pin the property, not the mechanism. The middle test is the one that
|
|
19
|
+
// fails for an identifier-based gate.
|
|
20
20
|
|
|
21
21
|
// The engine's Output constructor, so a field can be left genuinely pending
|
|
22
|
-
// rather than faked. A resolved promise
|
|
23
|
-
//
|
|
22
|
+
// rather than faked. A resolved promise settles on the next tick either way,
|
|
23
|
+
// which is the difference under test.
|
|
24
24
|
@module("@pulumi/pulumi") @new
|
|
25
25
|
external makeOutput: (
|
|
26
26
|
Set.t<unit>,
|
|
@@ -34,7 +34,13 @@ let pending = (value: 'a): (Pulumi.Output.t<'a>, unit => unit) => {
|
|
|
34
34
|
let settle = ref(() => ())
|
|
35
35
|
let p = Promise.make((resolve, _) => settle := () => resolve(value))
|
|
36
36
|
(
|
|
37
|
-
makeOutput(
|
|
37
|
+
makeOutput(
|
|
38
|
+
Set.make(),
|
|
39
|
+
p,
|
|
40
|
+
Promise.resolve(true),
|
|
41
|
+
Promise.resolve(false),
|
|
42
|
+
Promise.resolve(Set.make()),
|
|
43
|
+
),
|
|
38
44
|
settle.contents,
|
|
39
45
|
)
|
|
40
46
|
}
|
|
@@ -43,14 +49,17 @@ let ticks = async () => await Promise.make((resolve, _) => {
|
|
|
43
49
|
let _ = setTimeout(() => resolve(), 50)
|
|
44
50
|
})
|
|
45
51
|
|
|
46
|
-
|
|
52
|
+
/** A collector mid-update, the way the engine presents one: the identifiers are
|
|
53
|
+
already known — they do not change across a code update — and only
|
|
54
|
+
`lastModified` is still pending. `complete` is AWS answering. */
|
|
47
55
|
let deploying = (): (Pulumi.Output.t<PulumiAws.Lambda.Function.t>, unit => unit) => {
|
|
48
|
-
let (
|
|
56
|
+
let (lastModified, complete) = pending("2026-09-08T12:13:41.891+0000")
|
|
49
57
|
let fn: PulumiAws.Lambda.Function.t = {
|
|
50
|
-
arn,
|
|
51
|
-
id: "
|
|
52
|
-
name: "
|
|
58
|
+
arn: "arn:aws:lambda:eu-west-1:123456789012:function:OrderingPluginEventColl"->Pulumi.Output.make,
|
|
59
|
+
id: "OrderingPluginEventColl"->Pulumi.Output.make,
|
|
60
|
+
name: "OrderingPluginEventColl"->Pulumi.Output.make,
|
|
53
61
|
invokeArn: "arn:aws:apigateway:invoke"->Pulumi.Output.make,
|
|
62
|
+
lastModified,
|
|
54
63
|
}
|
|
55
64
|
// `apply` preserves the nested Outputs, which is how the real resource arrives.
|
|
56
65
|
(()->Pulumi.Output.make->Pulumi.Output.apply(_ => fn), complete)
|
|
@@ -62,28 +71,33 @@ let observe = (gate: Pulumi.Output.t<unit>): ref<bool> => {
|
|
|
62
71
|
settled
|
|
63
72
|
}
|
|
64
73
|
|
|
65
|
-
describe("
|
|
66
|
-
|
|
74
|
+
describe("Util_Lambda.updateLanded", () => {
|
|
75
|
+
// The regression. Every identifier on the record is already resolved here, so a
|
|
76
|
+
// gate reading any of them opens immediately — which is the production failure,
|
|
77
|
+
// reproduced.
|
|
78
|
+
testAsync("does not open while only the identifiers are known", async () => {
|
|
67
79
|
let (lambda, _complete) = deploying()
|
|
68
|
-
let settled = lambda->
|
|
80
|
+
let settled = lambda->Util_Lambda.updateLanded->observe
|
|
69
81
|
await ticks()
|
|
70
82
|
expect(settled.contents)->toBe(false)
|
|
71
83
|
})
|
|
72
84
|
|
|
73
|
-
testAsync("
|
|
85
|
+
testAsync("opens once AWS reports the update", async () => {
|
|
74
86
|
let (lambda, complete) = deploying()
|
|
75
|
-
let settled = lambda->
|
|
87
|
+
let settled = lambda->Util_Lambda.updateLanded->observe
|
|
76
88
|
complete()
|
|
77
89
|
await ticks()
|
|
78
90
|
expect(settled.contents)->toBe(true)
|
|
79
91
|
})
|
|
80
92
|
|
|
81
|
-
//
|
|
82
|
-
//
|
|
83
|
-
testAsync("
|
|
93
|
+
// Kept as the reason the gate is written the way it is: both shapes that were
|
|
94
|
+
// tried before open against a collector still serving the previous bundle.
|
|
95
|
+
testAsync("the shapes that shipped before open too early", async () => {
|
|
84
96
|
let (lambda, _complete) = deploying()
|
|
85
|
-
let
|
|
97
|
+
let onResource = lambda->Pulumi.Output.apply(_ => ())->observe
|
|
98
|
+
let onArn = lambda->Pulumi.Output.flatMap(fn => fn.arn)->Pulumi.Output.apply(_ => ())->observe
|
|
86
99
|
await ticks()
|
|
87
|
-
expect(
|
|
100
|
+
expect(onResource.contents)->toBe(true)
|
|
101
|
+
expect(onArn.contents)->toBe(true)
|
|
88
102
|
})
|
|
89
103
|
})
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import * as Output$Pulumi from "@reventlessdev/rescript-pulumi-pulumi/src/Output.res.mjs";
|
|
4
4
|
import * as Pulumi from "@pulumi/pulumi";
|
|
5
|
+
import * as Util_Lambda$ReventlessAws from "../src/util/Util_Lambda.res.mjs";
|
|
5
6
|
|
|
6
7
|
function pending(value) {
|
|
7
8
|
let settle = {
|
|
@@ -23,16 +24,18 @@ async function ticks() {
|
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
function deploying() {
|
|
26
|
-
let match = pending("
|
|
27
|
-
let fn_arn =
|
|
28
|
-
let fn_id = Pulumi.output("
|
|
29
|
-
let fn_name = Pulumi.output("
|
|
27
|
+
let match = pending("2026-09-08T12:13:41.891+0000");
|
|
28
|
+
let fn_arn = Pulumi.output("arn:aws:lambda:eu-west-1:123456789012:function:OrderingPluginEventColl");
|
|
29
|
+
let fn_id = Pulumi.output("OrderingPluginEventColl");
|
|
30
|
+
let fn_name = Pulumi.output("OrderingPluginEventColl");
|
|
30
31
|
let fn_invokeArn = Pulumi.output("arn:aws:apigateway:invoke");
|
|
32
|
+
let fn_lastModified = match[0];
|
|
31
33
|
let fn = {
|
|
32
34
|
arn: fn_arn,
|
|
33
35
|
id: fn_id,
|
|
34
36
|
name: fn_name,
|
|
35
|
-
invokeArn: fn_invokeArn
|
|
37
|
+
invokeArn: fn_invokeArn,
|
|
38
|
+
lastModified: fn_lastModified
|
|
36
39
|
};
|
|
37
40
|
return [
|
|
38
41
|
Pulumi.output().apply(() => fn),
|
|
@@ -50,25 +53,28 @@ function observe(gate) {
|
|
|
50
53
|
return settled;
|
|
51
54
|
}
|
|
52
55
|
|
|
53
|
-
globalThis.describe("
|
|
54
|
-
globalThis.test("does not
|
|
56
|
+
globalThis.describe("Util_Lambda.updateLanded", () => {
|
|
57
|
+
globalThis.test("does not open while only the identifiers are known", async () => {
|
|
55
58
|
let match = deploying();
|
|
56
|
-
let settled = observe(
|
|
59
|
+
let settled = observe(Util_Lambda$ReventlessAws.updateLanded(match[0]));
|
|
57
60
|
await ticks();
|
|
58
61
|
globalThis.expect(settled.contents).toBe(false);
|
|
59
62
|
});
|
|
60
|
-
globalThis.test("
|
|
63
|
+
globalThis.test("opens once AWS reports the update", async () => {
|
|
61
64
|
let match = deploying();
|
|
62
|
-
let settled = observe(
|
|
65
|
+
let settled = observe(Util_Lambda$ReventlessAws.updateLanded(match[0]));
|
|
63
66
|
match[1]();
|
|
64
67
|
await ticks();
|
|
65
68
|
globalThis.expect(settled.contents).toBe(true);
|
|
66
69
|
});
|
|
67
|
-
globalThis.test("
|
|
70
|
+
globalThis.test("the shapes that shipped before open too early", async () => {
|
|
68
71
|
let match = deploying();
|
|
69
|
-
let
|
|
72
|
+
let lambda = match[0];
|
|
73
|
+
let onResource = observe(lambda.apply(param => {}));
|
|
74
|
+
let onArn = observe(Output$Pulumi.flatMap(lambda, fn => fn.arn).apply(param => {}));
|
|
70
75
|
await ticks();
|
|
71
|
-
globalThis.expect(
|
|
76
|
+
globalThis.expect(onResource.contents).toBe(true);
|
|
77
|
+
globalThis.expect(onArn.contents).toBe(true);
|
|
72
78
|
});
|
|
73
79
|
});
|
|
74
80
|
|