fix: 收口依赖兼容与会话撤销

为 miniprogram-ci 和 Jimp 依赖增加兼容 patch 与 smoke test;修复平台模板管理员路由漏配;收紧模板契约校验;为 admin/customer 增加 token 撤销和集中会话存储;同步品牌切换角色、doctor source hash、多屏宽截图证据和 CI 构建门禁。
This commit is contained in:
que01 committed 2026-10-18 23:43:25 +08:00
1 parent 4f0b50c7f1
commit 3017e3eb49
65 files changed
+1623 -975

No files matched your search

+23
View File
@@ -9,6 +9,7 @@ import {
applyCompletionEvidence,
applyManualReview,
diagnoseTemplate,
sourceTreeHash,
} from "../lib/template-doctor.mjs";
test("真实模板自动发现并读取完整声明,生成可追溯区域报告", () => {
@@ -91,6 +92,7 @@ test("完成证据登记必须覆盖全部要求并校验产物哈希", () => {
const evidence = (items) => ({
schemaVersion: 1,
scope: "模板完成证据登记,保留命令、日志与产物哈希",
sourceTreeHash: sourceTreeHash(root),
templates: {
fixture: Object.fromEntries(
report.requiredEvidence.map((key) => [
@@ -98,6 +100,7 @@ test("完成证据登记必须覆盖全部要求并校验产物哈希", () => {
items.includes(key)
? {
status: "passed",
exitCode: 0,
commands: ["pnpm test"],
artifacts: [{ path: "integration.log", sha256 }],
}
@@ -129,6 +132,26 @@ test("完成证据登记必须覆盖全部要求并校验产物哈希", () => {
const checksumMismatch = applyCompletionEvidence([structuredClone(report)], invalid, root);
assert.equal(checksumMismatch.completionStatus, "incomplete");
assert.match(checksumMismatch.reports[0].completionIssues.join("\n"), /checksum mismatch/);
const staleSource = evidence(report.requiredEvidence);
staleSource.sourceTreeHash = "0".repeat(64);
const sourceMismatch = applyCompletionEvidence([structuredClone(report)], staleSource, root);
assert.equal(sourceMismatch.completionStatus, "incomplete");
assert.match(sourceMismatch.reports[0].completionIssues.join("\n"), /source tree hash/);
const failedCommand = evidence(report.requiredEvidence);
failedCommand.templates.fixture["visual-reference"].exitCode = 1;
const failed = applyCompletionEvidence([structuredClone(report)], failedCommand, root);
assert.equal(failed.completionStatus, "incomplete");
const placeholderCommand = evidence(report.requiredEvidence);
placeholderCommand.templates.fixture["visual-reference"].commands = ["pnpm test --out <dir>"];
const placeholder = applyCompletionEvidence(
[structuredClone(report)],
placeholderCommand,
root,
);
assert.equal(placeholder.completionStatus, "incomplete");
} finally {
fs.rmSync(root, { recursive: true, force: true });
}