uranusjr commented on code in PR #75184:
URL: https://github.com/apache/airflow/pull/75184#discussion_r4439636686


##########
java-sdk/sdk/build.gradle.kts:
##########
@@ -185,6 +193,20 @@ abstract class SyncSupervisorSchemaTask : DefaultTask() {
     fun sync() {
         val file = schemaFile.get().asFile
         val version = schemaVersion.get()
+        // The schema in this repository is the source of truth, and is 
compared by content: the
+        // remote only serves released versions, so an in-progress one is only 
ever found here, and
+        // a change that leaves api_version alone still has to reach the copy.
+        val source = sourceFile.asFile.orNull
+        if (source != null && apiVersionOf(source) == version) {
+            if (file.exists() && 
file.readBytes().contentEquals(source.readBytes())) {
+                logger.lifecycle("Supervisor Schema is up-to-date 
(api_version=$version).")
+                return
+            }
+            logger.lifecycle("Refreshing Supervisor Schema from $source")
+            file.parentFile.mkdirs()
+            Files.copy(source.toPath(), file.toPath(), 
StandardCopyOption.REPLACE_EXISTING)
+            return
+        }

Review Comment:
   When the in-repo source exists but the `api_version` doesn't match, this 
silently falls back to the download, while the prek hook fails. Should this 
fail too, so the two agree?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to