imbajin commented on code in PR #496:
URL: https://github.com/apache/hugegraph-doc/pull/496#discussion_r4090193815


##########
scripts/update_oink.py:
##########
@@ -0,0 +1,141 @@
+#!/usr/bin/env python3
+#
+# 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.
+
+"""Explicit, review-gated OINK upgrades using the existing site validators."""
+import argparse
+import hashlib
+import json
+import os
+from pathlib import Path
+import subprocess
+import sys
+import tempfile
+
+from oink_module import MODULE, VERSION, command, download_locked, 
locked_version
+
+ROOT = Path(__file__).resolve().parents[1]
+BASELINE = ROOT / "scripts/oink-overrides.json"
+WATCH = ("assets/js/sidebar-state.js", "assets/js/sidebar-nav.js",
+         "assets/js/docs-shell.js", "assets/js/search.js", 
"assets/js/search-engine.js",
+         "assets/js/surface-coordinator.js", "assets/js/command-palette.js")
+
+
+def run(args, *, cwd=ROOT, env=None):
+    print("+ " + " ".join(map(str, args)), flush=True)
+    subprocess.run(list(map(str, args)), cwd=cwd, env=env, check=True)
+
+
+def snapshot(root, upstream):
+    paths = set(WATCH)
+    # Project SCSS depends on upstream selectors even without a same-name 
override.
+    paths.update(str(p.relative_to(upstream)) for p in (upstream / 
"assets/scss").rglob("*.scss"))
+    for folder in ("layouts", "assets", "i18n"):

Review Comment:
   ⚠️ The upgrade SOP lists local `data/` customizations, but this inventory 
scans only `layouts`, `assets`, and `i18n`. If OINK later adds or changes a 
file matching one of the site's `data/` paths, `snapshot()` will omit it and 
the review gate will not require that change to be examined. Please include 
`data` in the inventory and add a test for a matching local/upstream data file.



##########
assets/js/kapa-adapter.js:
##########
@@ -133,13 +134,23 @@
       }
     }
 
+    function settle(error) {
+      if (!operation) return;
+      var current = operation;
+      operation = null;
+      current.signal.removeEventListener('abort', current.abort);
+      if (error) current.reject(error);
+      else current.resolve();
+    }
+
     function openWidget(query, submit) {
       invokeKapa(windowObject, 'setSourceGroupIDs', [config.sourceGroupId]);
       invokeKapa(windowObject, 'open', {
         mode: 'ai',
         query: query,
         submit: submit,
       });
+      settle();

Review Comment:
   ⚠️ If either `invokeKapa()` call in `openWidget()` throws, execution exits 
before `settle()`. `ready()` has already cleared the timeout, so the returned 
operation promise remains pending and OINK keeps the activation open. Please 
catch this failure, render the adapter error state, and reject or otherwise 
settle the operation.



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to