You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@phoenix.apache.org by "apurtell (via GitHub)" <gi...@apache.org> on 2026/08/05 00:14:21 UTC

[PR] PHOENIX-7981 Site build improvements [phoenix-site]

apurtell opened a new pull request, #38:
URL: https://github.com/apache/phoenix-site/pull/38

   (no comment)


-- 
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: dev-unsubscribe@phoenix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] PHOENIX-7981 Site build improvements [phoenix-site]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #38:
URL: https://github.com/apache/phoenix-site/pull/38#discussion_r3717063912


##########
unit-tests/setup.ts:
##########
@@ -20,6 +20,25 @@ import "@testing-library/jest-dom";
 import { cleanup } from "@testing-library/react";
 import { afterEach } from "vitest";
 
+if (!globalThis.localStorage) {
+  const values = new Map<string, string>();
+  const localStorage: Storage = {
+    get length() {
+      return values.size;
+    },
+    clear: () => values.clear(),
+    getItem: (key) => values.get(key) ?? null,
+    key: (index) => [...values.keys()][index] ?? null,
+    removeItem: (key) => values.delete(key),
+    setItem: (key, value) => values.set(key, String(value))
+  };

Review Comment:
   The localStorage polyfill methods currently return Map/boolean values (from Map.clear/delete/set). Real `Storage` methods return `void`; returning values can cause behavior differences if any code accidentally relies on the return value.



##########
build.sh:
##########
@@ -31,10 +31,16 @@ install_node() {
 if ! command -v node > /dev/null 2>&1 || ! command -v npm > /dev/null 2>&1; then
   echo "node/npm not found — bootstrapping via nvm..."
   install_node
-elif [ -f "$NVM_DIR/nvm.sh" ]; then
+else
+  NODE_MAJOR="$(node --version | cut -d. -f1 | tr -d v)"
+  if [ "$NODE_MAJOR" -ne "$REQUIRED_NODE_MAJOR" ]; then
+    echo "Node.js ${REQUIRED_NODE_MAJOR} is required (found $(node --version)) — bootstrapping via nvm..."
+    install_node
+  elif [ -f "$NVM_DIR/nvm.sh" ]; then

Review Comment:
   `[ "$NODE_MAJOR" -ne "$REQUIRED_NODE_MAJOR" ]` does a numeric comparison and will error (and abort due to `set -e`) if `$NODE_MAJOR` is ever non-numeric. A string comparison is sufficient here and avoids that failure mode; also indent the nvm comment block consistently under the `elif`.



##########
unit-tests/setup.ts:
##########
@@ -20,6 +20,25 @@ import "@testing-library/jest-dom";
 import { cleanup } from "@testing-library/react";
 import { afterEach } from "vitest";
 
+if (!globalThis.localStorage) {
+  const values = new Map<string, string>();
+  const localStorage: Storage = {
+    get length() {
+      return values.size;
+    },
+    clear: () => values.clear(),
+    getItem: (key) => values.get(key) ?? null,
+    key: (index) => [...values.keys()][index] ?? null,
+    removeItem: (key) => values.delete(key),
+    setItem: (key, value) => values.set(key, String(value))
+  };
+
+  Object.defineProperty(globalThis, "localStorage", {
+    configurable: true,
+    value: localStorage
+  });
+}
+
 afterEach(() => {
   cleanup();
 });

Review Comment:
   The in-memory Map backing the localStorage polyfill persists across tests because it is created once in setup. Clearing localStorage in `afterEach` prevents state leakage between tests and improves test isolation.



-- 
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: dev-unsubscribe@phoenix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] PHOENIX-7981 Site build improvements [phoenix-site]

Posted by "apurtell (via GitHub)" <gi...@apache.org>.
apurtell merged PR #38:
URL: https://github.com/apache/phoenix-site/pull/38


-- 
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: dev-unsubscribe@phoenix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org