This is an automated email from the ASF dual-hosted git repository.

pierrejeambrun pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 8d37613cba5 Guard the Dag Code tab's Monaco grammar exports against 
drift (#74246)
8d37613cba5 is described below

commit 8d37613cba56966dc60b6ad5e6deb7861646ebd8
Author: Pierre Jeambrun <[email protected]>
AuthorDate: Tue Oct 6 11:07:35 2026 +0200

    Guard the Dag Code tab's Monaco grammar exports against drift (#74246)
    
    * Guard the Dag Code tab's Monaco grammar exports against drift
    
    The register-time shape guard in configureMonaco only runs in the browser
    when the Code tab mounts, so a Monaco upgrade that moved a grammar module
    or dropped its conf/language export would pass CI and only surface as
    silently-unhighlighted TypeScript, Java or Go source in production. A unit
    import of each module turns that drift into a CI failure instead.
    
    * Small adjustments
---
 .../MonacoEditor/configureMonaco.test.ts           | 44 ++++++++++++++++++++++
 1 file changed, 44 insertions(+)

diff --git 
a/airflow-core/src/airflow/ui/src/components/MonacoEditor/configureMonaco.test.ts
 
b/airflow-core/src/airflow/ui/src/components/MonacoEditor/configureMonaco.test.ts
new file mode 100644
index 00000000000..4cadda79749
--- /dev/null
+++ 
b/airflow-core/src/airflow/ui/src/components/MonacoEditor/configureMonaco.test.ts
@@ -0,0 +1,44 @@
+/*!
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import { describe, expect, it } from "vitest";
+
+// A Monaco upgrade that moved a module or dropped an export
+// would slip through CI and only surface as silently-unhighlighted code in 
production.
+// Importing the modules here fails the build loudly instead: a missing module 
breaks resolution,
+// a dropped export fails the assertion.
+const grammars = [
+  { id: "go", load: () => import("monaco-editor/languages/definitions/go/go") 
},
+  { id: "java", load: () => 
import("monaco-editor/languages/definitions/java/java") },
+  { id: "python", load: () => 
import("monaco-editor/languages/definitions/python/python") },
+  { id: "typescript", load: () => 
import("monaco-editor/languages/definitions/typescript/typescript") },
+] as const;
+
+describe("Monaco Dag-code grammars", () => {
+  it.each(grammars)(
+    "$id exposes the { conf, language } Monarch shape configureMonaco 
registers",
+    async ({ load }) => {
+      const { conf, language } = await load();
+
+      expect(conf).toBeDefined();
+      expect(language).toBeDefined();
+      expect(language.tokenizer).toBeDefined();
+    },
+    30_000,
+  );
+});

Reply via email to