修复生产运维门禁格式误报
生产运维门禁对备份安全片段启用空白与尾逗号容错匹配 补充开发运维文档中的门禁匹配规则说明
This commit is contained in:
@@ -973,12 +973,14 @@ const checks = [
|
||||
{
|
||||
file: 'scripts/database-backup-to-oss.mjs',
|
||||
includes: 'assertSufficientWorkDirSpace({dataDir, workDir, args, env})',
|
||||
normalizeWhitespace: true,
|
||||
reason: '生产冷备份必须先做工作目录剩余空间预检,避免停库后写满磁盘。',
|
||||
},
|
||||
{
|
||||
file: 'scripts/database-backup-to-oss.mjs',
|
||||
includes:
|
||||
'restoreServicesAfterBackup({stopService, serviceStopped, restartServicesAfter, stopMarkerPath})',
|
||||
normalizeWhitespace: true,
|
||||
reason: '生产冷备份打包失败时也必须恢复 SpacetimeDB 及依赖服务。',
|
||||
},
|
||||
{
|
||||
@@ -7504,9 +7506,23 @@ const databaseTargetSourceStashes = [
|
||||
|
||||
let failed = false;
|
||||
|
||||
function includesGuardrail(content, check) {
|
||||
if (!check.includes) {
|
||||
return true;
|
||||
}
|
||||
if (!check.normalizeWhitespace) {
|
||||
return content.includes(check.includes);
|
||||
}
|
||||
const normalizeSourceFragment = (value) =>
|
||||
value.replace(/\s+/gu, '').replace(/,([})])/gu, '$1');
|
||||
const normalizedContent = normalizeSourceFragment(content);
|
||||
const normalizedExpected = normalizeSourceFragment(check.includes);
|
||||
return normalizedContent.includes(normalizedExpected);
|
||||
}
|
||||
|
||||
for (const check of checks) {
|
||||
const content = readFileSync(check.file, 'utf8');
|
||||
if (check.includes && !content.includes(check.includes)) {
|
||||
if (!includesGuardrail(content, check)) {
|
||||
failed = true;
|
||||
console.error(
|
||||
`[check:production-ops] ${check.file} 缺少 ${check.includes}。${check.reason}`,
|
||||
|
||||
Reference in New Issue
Block a user