{"record":{"id":"ded5583a0f95daf0","repo":"Hmbown/CodeWhale","slug":"legacy-is-deprecated-rename-it-to-name","errorCode":null,"errorMessage":"${legacy} is deprecated; rename it to ${name}.","messagePattern":"(.+?) is deprecated; rename it to (.+?)\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"integrations/weixin-bridge/src/index.mjs","lineNumber":101,"sourceCode":"  if (!value) {\n    console.error(`Missing required env: one of ${names.join(\", \")}`);\n    process.exit(1);\n  }\n  return value;\n}\n\n// WEIXIN_* is the canonical spelling; the historical WEXIN_* typo names are\n// still honored as deprecated aliases (each warns once per process).\nconst warnedEnvAliases = new Set();\n\nfunction weixinEnv(name) {\n  const legacy = `WEXIN_${name.slice(\"WEIXIN_\".length)}`;\n  const primary = envFirst(process.env, name);\n  if (primary) return primary;\n  const fallback = envFirst(process.env, legacy);\n  if (fallback && !warnedEnvAliases.has(legacy)) {\n    warnedEnvAliases.add(legacy);\n    console.warn(`${legacy} is deprecated; rename it to ${name}.`);\n  }\n  return fallback;\n}\n\nconst config = {\n  runtimeUrl: (\n    envFirst(process.env, \"CODEWHALE_RUNTIME_URL\", \"DEEPSEEK_RUNTIME_URL\") ||\n    \"http://127.0.0.1:7878\"\n  ).replace(/\\/+$/, \"\"),\n  runtimeToken: requiredEnvFirst(\n    \"CODEWHALE_RUNTIME_TOKEN\",\n    \"DEEPSEEK_RUNTIME_TOKEN\"\n  ),\n  workspace:\n    envFirst(process.env, \"CODEWHALE_WORKSPACE\", \"DEEPSEEK_WORKSPACE\") ||\n    process.cwd(),\n  model:\n    envFirst(process.env, \"CODEWHALE_MODEL\", \"DEEPSEEK_MODEL\") || \"auto\",","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/433685b2024e7bc4c99e1e2e326bcad39b4d9d65/integrations/weixin-bridge/src/index.mjs#L83-L119","documentation":"The WeChat bridge reads WEIXIN_* environment variables but also accepts legacy WEXIN_* (typo: missing 'TE') spellings as a fallback. When only the legacy variable is set, the bridge uses its value and prints this one-time deprecation warning per variable name; it is a warning, not a failure.","triggerScenarios":"weixinEnv(name) finds no WEIXIN_* variable but finds the corresponding WEXIN_* spelling in the environment; the warning is emitted once per legacy name via warnedEnvAliases.","commonSituations":"Environment files or CI secrets created with the old typo'd names; shell profiles exporting WEXIN_APPID etc. from an older release; copy-pasted deployment scripts predating the rename.","solutions":["Rename the variable: WEXIN_X -> WEIXIN_X in your .env, shell profile, or CI secret store","Grep your environment (env | grep WEXIN) for all legacy spellings and fix each","Restart the bridge after renaming so it picks up the new names and the warning stops"],"exampleFix":"# before (.env)\nWEXIN_APPID=wx123\nWEXIN_SECRET=abc\n\n# after (.env)\nWEIXIN_APPID=wx123\nWEIXIN_SECRET=abc","handlingStrategy":"validation","validationCode":"for (const k of Object.keys(process.env)) {\n  if (k.startsWith('WEXIN_')) console.warn(`${k} is deprecated; rename it to WEIXIN_${k.slice('WEXIN_'.length)}`);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Grep .env files and CI secret stores for the WEXIN_ typo and rename to WEIXIN_","Update deployment templates and shell profiles after renames","Treat deprecation warnings as failing checks in CI logs","Use a single source of truth for env var names (shared config module)"],"tags":["env","deprecation","weixin"],"backgroundTag":"deprecated-api-usage","analyzedSha":"433685b2024e7bc4c99e1e2e326bcad39b4d9d65","analyzedAt":"2026-09-15T12:24:24.634Z","contentChangedAt":"2026-09-15T12:24:24.634Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}