R123/A1-A6 收敛移动发票反馈并补部署检查

这个提交包含在:
2026-05-08 12:32:30 +08:00
父节点 135be878f5
当前提交 052413f407
共修改 8 个文件,包含 427 行新增和 57 行删除
+30 -1
查看文件
@@ -15,6 +15,12 @@ const scanRoots = [
];
const sourceExtensions = new Set([".js", ".jsx", ".ts", ".tsx"]);
const forbiddenCopy = ["先处理", "清爽"];
const userFacingBusinessTermFiles = new Set([
"client/src/pages/MobileReimbursementDetailPage.tsx",
"client/src/pages/ReimbursementDetailPage.tsx",
"client/src/components/travel/TravelPaymentTrackCard.tsx",
]);
const forbiddenUserFacingBusinessTerms = ["绑定整单", "不绑定明细", "发票池", "OCR"];
const findings = [];
function toPosix(value) {
@@ -104,7 +110,7 @@ function scanNativeFileInputs(file, source) {
const fileInputPattern = /<input\b[^>]*\btype=["']file["'][^>]*>/g;
let match = fileInputPattern.exec(source);
while (match) {
if (/\bhidden\b/.test(match[0])) {
if (/\bhidden\b/.test(match[0]) || /\bsr-only\b/.test(match[0])) {
match = fileInputPattern.exec(source);
continue;
}
@@ -121,6 +127,28 @@ function scanNativeFileInputs(file, source) {
}
}
function scanUserFacingBusinessTerms(file, source) {
const normalized = toPosix(path.relative(rootDir, file));
if (!userFacingBusinessTermFiles.has(normalized)) {
return;
}
for (const term of forbiddenUserFacingBusinessTerms) {
let start = source.indexOf(term);
while (start !== -1) {
addFinding({
rule: "business.no_internal_invoice_terms",
severity: "error",
file,
line: lineNumber(source, start),
message: `普通用户主流程不应暴露内部发票术语:${term}`,
evidence: term,
});
start = source.indexOf(term, start + term.length);
}
}
}
function scanRawBusinessIdentifiers(file, source) {
const normalized = toPosix(file);
if (!/Reimbursement|Invoice|Leave|Purchase|Travel/.test(path.basename(normalized))) {
@@ -195,6 +223,7 @@ function scanNavigationTitleCoverage(file, source) {
function scanFile(file) {
const source = readFileSync(file, "utf8");
scanForbiddenCopy(file, source);
scanUserFacingBusinessTerms(file, source);
scanMobileDarkControls(file, source);
scanNativeFileInputs(file, source);
scanRawBusinessIdentifiers(file, source);