fix: address PR review comments

- turnstile-signup demo: flatten the env fallback chains to single || chains so
  an empty placeholder pair can't shadow the later candidates; reference the
  canonical var name in the error message.
- spacetime-publish: mention the canonical HEXCLAVE_MCP_LOG_TOKEN name in the
  prod-publish error message.
- internal-feedback-emails test: also exercise the legacy STACK_ fallback path
  (legacy-only and empty-canonical cases).
This commit is contained in:
Bilal Godil 2026-06-11 17:38:47 -07:00
parent f87c9c92c1
commit d86b36565a
3 changed files with 22 additions and 7 deletions

View File

@ -153,6 +153,17 @@ import.meta.vitest?.test("getInternalFeedbackRecipients()", ({ expect }) => {
// eslint-disable-next-line no-restricted-syntax
process.env.HEXCLAVE_INTERNAL_FEEDBACK_RECIPIENTS = ", ";
expect(() => getInternalFeedbackRecipients()).toThrow("empty recipient");
// legacy STACK_ name still resolves when the canonical name is unset or empty
// eslint-disable-next-line no-restricted-syntax
delete process.env.HEXCLAVE_INTERNAL_FEEDBACK_RECIPIENTS;
// eslint-disable-next-line no-restricted-syntax
process.env.STACK_INTERNAL_FEEDBACK_RECIPIENTS = "legacy@example.com";
expect(getInternalFeedbackRecipients()).toEqual(["legacy@example.com"]);
// eslint-disable-next-line no-restricted-syntax
process.env.HEXCLAVE_INTERNAL_FEEDBACK_RECIPIENTS = "";
expect(getInternalFeedbackRecipients()).toEqual(["legacy@example.com"]);
} finally {
if (previousValue === undefined) {
// eslint-disable-next-line no-restricted-syntax

View File

@ -37,7 +37,7 @@ if (!args) {
}
if (target === "prod" && !(process.env.HEXCLAVE_MCP_LOG_TOKEN || process.env.STACK_MCP_LOG_TOKEN)) {
console.error("Error: STACK_MCP_LOG_TOKEN must be set for prod publish");
console.error("Error: HEXCLAVE_MCP_LOG_TOKEN (or legacy STACK_MCP_LOG_TOKEN) must be set for prod publish");
process.exit(1);
}

View File

@ -66,11 +66,13 @@ function getDebugInternals(app: ReturnType<typeof useStackApp>): {
}
function getDemoApiUrl(): string {
const baseUrl = (process.env.NEXT_PUBLIC_HEXCLAVE_API_URL || process.env.NEXT_PUBLIC_STACK_API_URL)
?? (process.env.NEXT_PUBLIC_HEXCLAVE_URL || process.env.NEXT_PUBLIC_STACK_URL);
const baseUrl = process.env.NEXT_PUBLIC_HEXCLAVE_API_URL
|| process.env.NEXT_PUBLIC_STACK_API_URL
|| process.env.NEXT_PUBLIC_HEXCLAVE_URL
|| process.env.NEXT_PUBLIC_STACK_URL;
if (typeof baseUrl !== "string" || baseUrl.length === 0) {
throw new Error("Expected NEXT_PUBLIC_STACK_API_URL to be configured for Turnstile OAuth debug flows");
throw new Error("Expected NEXT_PUBLIC_HEXCLAVE_API_URL to be configured for Turnstile OAuth debug flows");
}
return `${baseUrl.replace(/\/$/, "")}/api/v1`;
@ -301,9 +303,11 @@ export default function TurnstileSignupPageClient() {
const signInWithTokens = internals.signInWithTokens;
const apiUrl = getDemoApiUrl();
const oauthClientSecret = app[hexclaveAppInternalsSymbol].toClientJson().publishableClientKey
?? (process.env.NEXT_PUBLIC_HEXCLAVE_PUBLISHABLE_CLIENT_KEY || process.env.NEXT_PUBLIC_STACK_PUBLISHABLE_CLIENT_KEY)
?? (process.env.HEXCLAVE_PUBLISHABLE_CLIENT_KEY || process.env.STACK_PUBLISHABLE_CLIENT_KEY)
?? publishableClientKeyNotNecessarySentinel;
|| process.env.NEXT_PUBLIC_HEXCLAVE_PUBLISHABLE_CLIENT_KEY
|| process.env.NEXT_PUBLIC_STACK_PUBLISHABLE_CLIENT_KEY
|| process.env.HEXCLAVE_PUBLISHABLE_CLIENT_KEY
|| process.env.STACK_PUBLISHABLE_CLIENT_KEY
|| publishableClientKeyNotNecessarySentinel;
useEffect(() => {
const redirectSource = window.sessionStorage.getItem(authReturnStorageKey);