A bit of additional background information. There should be no difference between editing RAW files and JPEGs, and whether you are using iCloud Photos or not,as long as your camera model is on the list of supported camera models for your system version (Digital camera RAW formats supported by iOS 16, iPadOS 16, and macOS Ventura - Apple Support) and as long as you are having enough free storage on your Mac to download the originals from iCloud.
- iCloud Photos is automatically keeping the photos on your mac in sync with iCloud. The central storage of the Photos Library will be in iCloud, but the library is mirrored on your mac. All edits you apply on your Mac will be synced to iCloud Photos and from there to your other devices. If all is well, we should not even notice the syncing with iCloud.
- Photos is supporting the lossless workflow. We can always revert all adjustments individually and revert to the original version of a photo. The original image file will never be modified, whether it is a RAW or JPEG or HEIC or any other format. When we edit a photo, the original will remain unchanged and Photos is just storing the sequence of adjustments that needs to be applied. When we add several adjustments, Photos will always start to render the adjustments starting from the original, so rounding errors do not accumulate. When we finish editing, Photos will create a new thumbnail for browsing and a preview for the media browser. The edited version will live in limbo and not be rendered, until we need the photo for Sharing or exporting. When we export the photo, we can specify the size, the quality , and the format we want. The exported version will be rendered by applying the adjustments to the original, for the best quality. Until we export or share an edited photos it does not have any format - it could be any supported format. This will be decided when we export it.
Only, if we use external editors, the edited version will be returned from the external editor as an image in a fixed format, mostly as a TIFF, because this is a lossless format. But it will depend on the external editor. But this image does not replace the original RAW file, it will be saved as an additional version of the image.