You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hugegraph.apache.org by ji...@apache.org on 2026/09/24 16:56:05 UTC

(hugegraph-doc) branch staging/kapa-ai-acceptance created (now c1b5e27df)

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

imbajin pushed a change to branch staging/kapa-ai-acceptance
in repository https://gitbox.apache.org/repos/asf/hugegraph-doc.git


      at c1b5e27df chore: prepare Kapa staging acceptance

This branch includes the following new commits:

     new c1b5e27df chore: prepare Kapa staging acceptance

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(hugegraph-doc) 01/01: chore: prepare Kapa staging acceptance

Posted by ji...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

imbajin pushed a commit to branch staging/kapa-ai-acceptance
in repository https://gitbox.apache.org/repos/asf/hugegraph-doc.git

commit c1b5e27dfef4839c0a8aa558b87b53d34f482420
Author: imbajin <ji...@apache.org>
AuthorDate: Fri Sep 25 00:55:57 2026 +0800

    chore: prepare Kapa staging acceptance
    
    - enable the existing Kapa integration only on this staging candidate
    - preserve ASF CSP defaults and reuse the deployed Kapa host subset
    - validate generated Apache directives and pre-consent behavior
    - retain pending real-service and domain-approval evidence gates
---
 .htaccess                  |  5 +++++
 hugo.yaml                  |  6 +++---
 scripts/test_versioning.py |  5 +++--
 scripts/versioning.py      |  4 +++-
 tests/e2e/platform.spec.js | 16 +++++++++++++---
 5 files changed, 27 insertions(+), 9 deletions(-)

diff --git a/.htaccess b/.htaccess
index 295223cc2..29219bc8e 100644
--- a/.htaccess
+++ b/.htaccess
@@ -1,2 +1,7 @@
 RedirectMatch 404 "(?i)(?:^|/)\.git(?:/|$)"
 ErrorDocument 404 /404.html
+# Staging migration of the existing HugeGraph Kapa/hCaptcha integration, PR #459.
+# Source: https://github.com/apache/hugegraph-doc/commit/7662b8afb64265ed7412f6d704b8adfa9a836fff
+# Preserve ASF default CSP; no Google CAPTCHA or optional metrics domains.
+# Existing deployment evidence is not a separate VP Privacy approval record.
+SetEnv CSP_PROJECT_DOMAINS "https://widget.kapa.ai https://proxy.kapa.ai https://kapa-widget-proxy-la7dkmplpq-uc.a.run.app https://hcaptcha.com https://*.hcaptcha.com"
diff --git a/hugo.yaml b/hugo.yaml
index 6ff0d3976..c808b4a70 100644
--- a/hugo.yaml
+++ b/hugo.yaml
@@ -105,10 +105,10 @@ params:
   offline_search_index: summary
   offline_search_summary_length: 70
   offline_search_max_results: 10
-  # Optional enhancement: keep disabled until both reviewed latest-only Kapa
-  # source groups and the staging CSP/corpus acceptance gates pass.
+  # Staging-only acceptance candidate: never merge this enabled configuration
+  # into production. Production remains disabled on oink-1.1 and master.
   ai_search:
-    enabled: false
+    enabled: true
     provider: kapa
     website_id: 0b277570-4740-451e-96fa-1e4ac1ac5e88
     source_groups:
diff --git a/scripts/test_versioning.py b/scripts/test_versioning.py
index 5c28d9466..99cb51380 100644
--- a/scripts/test_versioning.py
+++ b/scripts/test_versioning.py
@@ -686,9 +686,10 @@ class VersionUrlTest(unittest.TestCase):
             seen: set[str] = set()
             self.assertEqual(versioning.write_error_documents(output, seen), 4)
             self.assertEqual(
-                (output / ".htaccess").read_text(encoding="utf-8"),
+                "\n".join(line for line in (output / ".htaccess").read_text(encoding="utf-8").splitlines() if not line.startswith("#")) + "\n",
                 'RedirectMatch 404 "(?i)(?:^|/)\\.git(?:/|$)"\n'
-                "ErrorDocument 404 /404.html\n",
+                "ErrorDocument 404 /404.html\n"
+                'SetEnv CSP_PROJECT_DOMAINS "https://widget.kapa.ai https://proxy.kapa.ai https://kapa-widget-proxy-la7dkmplpq-uc.a.run.app https://hcaptcha.com https://*.hcaptcha.com"\n',
             )
             self.assertEqual(
                 (output / "cn/.htaccess").read_text(encoding="utf-8"),
diff --git a/scripts/versioning.py b/scripts/versioning.py
index 987f740d6..9cdb92beb 100644
--- a/scripts/versioning.py
+++ b/scripts/versioning.py
@@ -4254,8 +4254,10 @@ def copy_without_collision(
 def write_error_documents(output: pathlib.Path, seen: set[str]) -> int:
     """Install localized Apache error documents beside every generated 404 page."""
     template = (ROOT / ".htaccess").read_text(encoding="utf-8")
-    if template != (
+    directives = "\n".join(line for line in template.splitlines() if not line.startswith("#")) + "\n"
+    if directives != (
         'RedirectMatch 404 "(?i)(?:^|/)\\.git(?:/|$)"\nErrorDocument 404 /404.html\n'
+        'SetEnv CSP_PROJECT_DOMAINS "https://widget.kapa.ai https://proxy.kapa.ai https://kapa-widget-proxy-la7dkmplpq-uc.a.run.app https://hcaptcha.com https://*.hcaptcha.com"\n'
     ):
         fail("unexpected root .htaccess contract")
     root_page = output / "404.html"
diff --git a/tests/e2e/platform.spec.js b/tests/e2e/platform.spec.js
index dfa338a6d..22de512b9 100644
--- a/tests/e2e/platform.spec.js
+++ b/tests/e2e/platform.spec.js
@@ -86,17 +86,27 @@ for (const locale of ["en", "cn"]) {
   });
 }
 
-test("disabled AI emits no UI or Kapa request", async ({ page }) => {
+test("enabled staging AI makes no third-party request before consent", async ({ page }) => {
   const kapaRequests = [];
   page.on("request", (request) => {
-    if (request.url().includes("kapa.ai")) kapaRequests.push(request.url());
+    if (/kapa\.ai|hcaptcha\.com|kapa-widget-proxy/.test(request.url())) {
+      kapaRequests.push(request.url());
+    }
   });
   await page.goto("/docs/");
   await page.locator("[data-td-shell-search-open]").first().click();
   await page.locator(".td-shell-search__input").fill("server");
   await expect(page.locator('[role="option"]').first()).toBeVisible();
   expect(kapaRequests).toEqual([]);
-  await expect(page.locator("[data-hg-ask-ai]")).toHaveCount(0);
+  await page.locator(".td-shell-search__input").press("Escape");
+  const launcher = page.locator("[data-hg-ask-ai]").first();
+  await expect(launcher).toBeVisible();
+  await launcher.click();
+  await expect(page.locator("[data-hg-ai-consent]")).toBeVisible();
+  await page.locator("[data-hg-ai-cancel]").click();
+  await expect(page.locator("[data-hg-ai-consent]")).not.toBeVisible();
+  await expect(launcher).toBeFocused();
+  expect(kapaRequests).toEqual([]);
 });
 
 test("search index failure keeps one stable, focusable retry control", async ({