test: warn on PNVS template placeholder drift

This commit is contained in:
Codex
2026-07-03 23:02:36 +08:00
parent 435b9e3aa3
commit 8f69838007
2 changed files with 61 additions and 0 deletions

View File

@@ -204,6 +204,12 @@ function missingPublicKeyGroups(configPublic, groups) {
.map(group => group.label);
}
function pnvsTemplateParamHasCodePlaceholder(configPublic) {
const value = configPublic?.templateParam;
if (!value || typeof value !== 'object' || Array.isArray(value)) return true;
return Object.values(value).some(item => String(item) === '##code##');
}
function blockMissingPublicConfig(row, missing) {
if (missing.length === 0) return;
block(
@@ -258,6 +264,13 @@ function validateAuthProviderPublicConfig(row) {
if (!publicString(configPublic, ['regionId'])) {
warn(`db.auth.${safeProviderName(row.provider)}.region`, 'Aliyun PNVS regionId is not set; default cn-hangzhou will be used', details);
}
if (!pnvsTemplateParamHasCodePlaceholder(configPublic)) {
warn(
`db.auth.${safeProviderName(row.provider)}.template_param`,
'Aliyun PNVS templateParam should include ##code##; backend will add code placeholder automatically',
details,
);
}
return;
}