refactor(qa): share live credential source inference · openclaw/openclaw@a824df2
vincentkoc
·
2026-06-20
·
via Recent Commits to openclaw:main
File tree
extensions/qa-lab/src/live-transports
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +export type QaInferredCredentialSource = "convex" | "env"; |
| 2 | + |
| 3 | +export function inferQaCredentialSource( |
| 4 | +value: string | undefined, |
| 5 | +env: NodeJS.ProcessEnv = process.env, |
| 6 | +): QaInferredCredentialSource { |
| 7 | +const normalized = |
| 8 | +value?.trim().toLowerCase() || env.OPENCLAW_QA_CREDENTIAL_SOURCE?.trim().toLowerCase(); |
| 9 | +return normalized === "convex" ? "convex" : "env"; |
| 10 | +} |
| Original file line number | Diff line number | Diff line change |
|---|
@@ -31,6 +31,7 @@ import {
|
31 | 31 | appendQaLiveLaneIssue as appendLiveLaneIssue, |
32 | 32 | buildQaLiveLaneArtifactsError as buildLiveLaneArtifactsError, |
33 | 33 | } from "../shared/live-artifacts.js"; |
| 34 | +import { inferQaCredentialSource as inferSlackCredentialSource } from "../shared/live-credential-source.js"; |
34 | 35 | import { startQaLiveLaneGateway } from "../shared/live-gateway.runtime.js"; |
35 | 36 | import { |
36 | 37 | collectLiveTransportStandardScenarioCoverage, |
@@ -510,15 +511,6 @@ function resolveEnvValue(env: NodeJS.ProcessEnv, key: (typeof SLACK_QA_ENV_KEYS)
|
510 | 511 | return value; |
511 | 512 | } |
512 | 513 | |
513 | | -function inferSlackCredentialSource( |
514 | | -value: string | undefined, |
515 | | -env: NodeJS.ProcessEnv = process.env, |
516 | | -): "convex" | "env" { |
517 | | -const normalized = |
518 | | -value?.trim().toLowerCase() || env.OPENCLAW_QA_CREDENTIAL_SOURCE?.trim().toLowerCase(); |
519 | | -return normalized === "convex" ? "convex" : "env"; |
520 | | -} |
521 | | - |
522 | 514 | function normalizeSlackId(value: string, label: string) { |
523 | 515 | const normalized = value.trim(); |
524 | 516 | if (!/^[A-Z][A-Z0-9]+$/.test(normalized)) { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -39,6 +39,7 @@ import {
|
39 | 39 | appendQaLiveLaneIssue as appendLiveLaneIssue, |
40 | 40 | redactQaLiveLaneDetails, |
41 | 41 | } from "../shared/live-artifacts.js"; |
| 42 | +import { inferQaCredentialSource as inferWhatsAppCredentialSource } from "../shared/live-credential-source.js"; |
42 | 43 | import { startQaLiveLaneGateway } from "../shared/live-gateway.runtime.js"; |
43 | 44 | import { |
44 | 45 | collectLiveTransportStandardScenarioCoverage, |
@@ -1401,15 +1402,6 @@ function resolveEnvValue(env: NodeJS.ProcessEnv, key: (typeof WHATSAPP_QA_ENV_KE
|
1401 | 1402 | return value; |
1402 | 1403 | } |
1403 | 1404 | |
1404 | | -function inferWhatsAppCredentialSource( |
1405 | | -value: string | undefined, |
1406 | | -env: NodeJS.ProcessEnv = process.env, |
1407 | | -): "convex" | "env" { |
1408 | | -const normalized = |
1409 | | -value?.trim().toLowerCase() || env.OPENCLAW_QA_CREDENTIAL_SOURCE?.trim().toLowerCase(); |
1410 | | -return normalized === "convex" ? "convex" : "env"; |
1411 | | -} |
1412 | | - |
1413 | 1405 | function resolveWhatsAppMetadataRedaction(env: NodeJS.ProcessEnv = process.env) { |
1414 | 1406 | const raw = env[QA_REDACT_PUBLIC_METADATA_ENV]; |
1415 | 1407 | return raw === undefined ? true : isTruthyOptIn(raw); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。