Skip to content

Commit 51e27c9

Browse files
committed
fix: scope reconcile operation labels to correct pipeline stages
Move error handlers from the shared outer catchTags into per-operation inner catchTags so that failures from makeCloudLinkProof are labeled 'generate_link_proof' and failures from applyCloudRelayConfig are labeled 'persist_relay_configuration', matching their standalone handler counterparts. The outer catchTags now only catches errors from setCliDesiredCloudLink ('persist_desired_link_state') and relay/credential operations.
1 parent 2b5e1cf commit 51e27c9

1 file changed

Lines changed: 23 additions & 11 deletions

File tree

apps/server/src/cloud/http.ts

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -723,6 +723,17 @@ const reconcileDesiredCloudLinkWith = Effect.fn("environment.cloud.reconcileDesi
723723
},
724724
},
725725
localOrigin,
726+
).pipe(
727+
Effect.catchTags({
728+
ServerAuthCloudLinkJwtSigningError: (error) =>
729+
failEnvironmentCloudInternalError("sign_cloud_link_jwt")(error),
730+
SecretStoreReadError: failEnvironmentCloudInternalError("generate_link_proof"),
731+
SecretStoreDecodeError: failEnvironmentCloudInternalError("generate_link_proof"),
732+
SecretStoreEncodeError: failEnvironmentCloudInternalError("generate_link_proof"),
733+
SecretStorePersistError: failEnvironmentCloudInternalError("generate_link_proof"),
734+
SecretStoreConcurrentReadError: failEnvironmentCloudInternalError("generate_link_proof"),
735+
PlatformError: failEnvironmentCloudInternalError("generate_link_proof"),
736+
}),
726737
);
727738
const link = yield* relayClientRequest(dependencies, {
728739
operation: "create-environment-link",
@@ -744,24 +755,25 @@ const reconcileDesiredCloudLinkWith = Effect.fn("environment.cloud.reconcileDesi
744755
environmentCredential: link.environmentCredential,
745756
cloudMintPublicKey: link.cloudMintPublicKey,
746757
endpointRuntime: link.endpointRuntime,
747-
});
758+
}).pipe(
759+
Effect.catchTags({
760+
ServerAuthLinkedCloudAccountVerificationError: (error) =>
761+
failEnvironmentCloudInternalError("verify_linked_cloud_account")(error),
762+
SecretStoreTemporaryPathGenerationError: failEnvironmentCloudInternalError(
763+
"persist_relay_configuration",
764+
),
765+
SecretStorePersistError: failEnvironmentCloudInternalError("persist_relay_configuration"),
766+
SecretStoreRemoveError: failEnvironmentCloudInternalError("persist_relay_configuration"),
767+
SchemaError: failEnvironmentCloudInternalError("persist_relay_configuration"),
768+
}),
769+
);
748770
},
749771
Effect.catchTags({
750-
ServerAuthLinkedCloudAccountVerificationError: (error) =>
751-
failEnvironmentCloudInternalError("verify_linked_cloud_account")(error),
752-
ServerAuthCloudLinkJwtSigningError: (error) =>
753-
failEnvironmentCloudInternalError("sign_cloud_link_jwt")(error),
754-
SecretStoreReadError: failEnvironmentCloudInternalError("persist_desired_link_state"),
755772
SecretStoreTemporaryPathGenerationError: failEnvironmentCloudInternalError(
756773
"persist_desired_link_state",
757774
),
758775
SecretStorePersistError: failEnvironmentCloudInternalError("persist_desired_link_state"),
759776
SecretStoreRemoveError: failEnvironmentCloudInternalError("persist_desired_link_state"),
760-
SecretStoreDecodeError: failEnvironmentCloudInternalError("persist_desired_link_state"),
761-
SecretStoreEncodeError: failEnvironmentCloudInternalError("persist_desired_link_state"),
762-
SecretStoreConcurrentReadError: failEnvironmentCloudInternalError("persist_desired_link_state"),
763-
SchemaError: failEnvironmentCloudInternalError("persist_desired_link_state"),
764-
PlatformError: failEnvironmentCloudInternalError("persist_desired_link_state"),
765777
CloudRelayConfigurationError: (error) =>
766778
failEnvironmentCloudInternalError("read_relay_url_configuration")(error),
767779
CloudRelayRequestError: (error) =>

0 commit comments

Comments
 (0)