test: 补齐跨模板发布回归
This commit is contained in:
1 parent
0c5ff79b42
commit
34b872a84c
6 files changed
+231
-9
No files matched your search
@@ -0,0 +1,17 @@
|
||||
# 执行记录
|
||||
|
||||
## 恢复信息
|
||||
|
||||
- 任务:验证餐饮与门窗模板的发布 readiness 由模板声明驱动且品牌隔离。
|
||||
- 形态:single-full
|
||||
- 进度:0/4
|
||||
- 当前:补齐林境 required 信任内容回归。
|
||||
- 文件:`.codex-tasks/trust-readiness-cross-template/TODO.csv`
|
||||
- 下一步:扩展 API 集成测试并运行验证。
|
||||
|
||||
## 结果
|
||||
|
||||
- 林境 `process`、`credential` 均验证了取消发布或内容为空时 readiness 失败;恢复有效内容后 `process` 重新通过。
|
||||
- readiness 检查键按模板声明隔离:餐饮出现 `schedule/coverage/process`,门窗出现 `process/credential`,互不要求对方行业类型。
|
||||
- 两个模板 JSON 仅做 Prettier 格式化,语义和声明未改动。
|
||||
- 验证:API integration 37/37、`pnpm format:check`、typecheck、lint、Admin production build、template validation、`git diff --check` 通过。
|
||||
@@ -0,0 +1,16 @@
|
||||
# 跨模板发布 readiness 回归
|
||||
|
||||
## 目标
|
||||
|
||||
验证发布 readiness 按视觉模板 package 的 `trustContentTypes` 声明工作,餐饮和门窗品牌的必需信任类型互不串用;同时清理现有模板 JSON 的格式门禁告警。
|
||||
|
||||
## 范围
|
||||
|
||||
- API 集成测试覆盖林境门窗模板的 `process`、`credential` 必需类型。
|
||||
- 验证林境必需内容在未发布、标题为空、正文为空时均不能发布,恢复后可以发布。
|
||||
- 验证餐饮和门窗 readiness 只检查各自模板声明的 required 类型。
|
||||
- 格式化当前已有的两个模板 JSON 文件,并确认全仓格式检查通过。
|
||||
|
||||
## 非目标
|
||||
|
||||
- 不新增行业类型,不改变模板声明,不把模板示例内容写入数据库。
|
||||
@@ -0,0 +1,5 @@
|
||||
id,task,status,acceptance_criteria,validation_command,completed_at,retry_count,notes
|
||||
1,补齐林境 required 信任内容回归,DONE,林境 process 和 credential 在缺失或内容为空时 readiness 失败且恢复后通过,pnpm --filter @personal-brand/api test:integration,2026-09-27,0,覆盖 process 的取消发布/空标题/空正文和 credential 的取消发布/空正文
|
||||
2,验证品牌间 required 类型隔离,DONE,餐饮检查 schedule/coverage/process 且不要求门窗专属 credential,门窗检查 process/credential 且不要求餐饮专属 schedule,pnpm --filter @personal-brand/api test:integration,2026-09-27,0,断言 readiness 检查键由模板声明隔离
|
||||
3,清理模板 JSON 格式告警,DONE,pnpm format:check 通过且不改变模板语义,pnpm format:check,2026-09-27,0,仅格式化两个已有模板 JSON
|
||||
4,完成交付门禁并记录,DONE,typecheck、lint、Admin build、template validation、git diff --check 通过,pnpm typecheck && pnpm lint,2026-09-27,0,API integration 37/37;其余门禁均通过
|
||||
|
@@ -74,6 +74,145 @@ test("admin release lifecycle is authorized, brand-scoped, and versioned", async
|
||||
JSON.parse(doorsReadiness.body).checks.find((check) => check.key === "forms")?.passed,
|
||||
true,
|
||||
);
|
||||
const doorsReadinessBody = JSON.parse(doorsReadiness.body);
|
||||
assert.equal(
|
||||
doorsReadinessBody.checks.find((check) => check.key === "trust:process")?.passed,
|
||||
true,
|
||||
);
|
||||
assert.equal(
|
||||
doorsReadinessBody.checks.find((check) => check.key === "trust:credential")?.passed,
|
||||
true,
|
||||
);
|
||||
assert.equal(
|
||||
doorsReadinessBody.checks.some((check) => check.key === "trust:schedule"),
|
||||
false,
|
||||
);
|
||||
const doorsProcessTrust = await prisma.trustContent.findFirstOrThrow({
|
||||
where: { brandId: "00000000-0000-0000-0000-000000000002", type: "process", isPublished: true },
|
||||
});
|
||||
const originalDoorsProcessTrust = {
|
||||
isPublished: doorsProcessTrust.isPublished,
|
||||
title: doorsProcessTrust.title,
|
||||
content: doorsProcessTrust.content,
|
||||
};
|
||||
try {
|
||||
await prisma.trustContent.update({
|
||||
where: { id: doorsProcessTrust.id },
|
||||
data: { isPublished: false },
|
||||
});
|
||||
const unpublishedDoors = JSON.parse(
|
||||
(
|
||||
await request("/admin/releases/readiness", {
|
||||
headers: { authorization: `Bearer ${doorsAdminToken}` },
|
||||
})
|
||||
).body,
|
||||
);
|
||||
assert.equal(unpublishedDoors.ready, false);
|
||||
assert.equal(
|
||||
unpublishedDoors.checks.find((check) => check.key === "trust:process")?.passed,
|
||||
false,
|
||||
);
|
||||
await prisma.trustContent.update({
|
||||
where: { id: doorsProcessTrust.id },
|
||||
data: { isPublished: true, title: " " },
|
||||
});
|
||||
const blankDoorsTitle = JSON.parse(
|
||||
(
|
||||
await request("/admin/releases/readiness", {
|
||||
headers: { authorization: `Bearer ${doorsAdminToken}` },
|
||||
})
|
||||
).body,
|
||||
);
|
||||
assert.equal(blankDoorsTitle.ready, false);
|
||||
assert.equal(
|
||||
blankDoorsTitle.checks.find((check) => check.key === "trust:process")?.passed,
|
||||
false,
|
||||
);
|
||||
await prisma.trustContent.update({
|
||||
where: { id: doorsProcessTrust.id },
|
||||
data: { title: originalDoorsProcessTrust.title, content: " \n " },
|
||||
});
|
||||
const blankDoorsContent = JSON.parse(
|
||||
(
|
||||
await request("/admin/releases/readiness", {
|
||||
headers: { authorization: `Bearer ${doorsAdminToken}` },
|
||||
})
|
||||
).body,
|
||||
);
|
||||
assert.equal(blankDoorsContent.ready, false);
|
||||
assert.equal(
|
||||
blankDoorsContent.checks.find((check) => check.key === "trust:process")?.passed,
|
||||
false,
|
||||
);
|
||||
await prisma.trustContent.update({
|
||||
where: { id: doorsProcessTrust.id },
|
||||
data: originalDoorsProcessTrust,
|
||||
});
|
||||
const restoredDoors = JSON.parse(
|
||||
(
|
||||
await request("/admin/releases/readiness", {
|
||||
headers: { authorization: `Bearer ${doorsAdminToken}` },
|
||||
})
|
||||
).body,
|
||||
);
|
||||
assert.equal(restoredDoors.checks.find((check) => check.key === "trust:process")?.passed, true);
|
||||
} finally {
|
||||
await prisma.trustContent.update({
|
||||
where: { id: doorsProcessTrust.id },
|
||||
data: originalDoorsProcessTrust,
|
||||
});
|
||||
}
|
||||
const doorsCredentialTrust = await prisma.trustContent.findFirstOrThrow({
|
||||
where: {
|
||||
brandId: "00000000-0000-0000-0000-000000000002",
|
||||
type: "credential",
|
||||
isPublished: true,
|
||||
},
|
||||
});
|
||||
const originalDoorsCredentialTrust = {
|
||||
isPublished: doorsCredentialTrust.isPublished,
|
||||
title: doorsCredentialTrust.title,
|
||||
content: doorsCredentialTrust.content,
|
||||
};
|
||||
try {
|
||||
await prisma.trustContent.update({
|
||||
where: { id: doorsCredentialTrust.id },
|
||||
data: { isPublished: false },
|
||||
});
|
||||
const missingDoorsCredential = JSON.parse(
|
||||
(
|
||||
await request("/admin/releases/readiness", {
|
||||
headers: { authorization: `Bearer ${doorsAdminToken}` },
|
||||
})
|
||||
).body,
|
||||
);
|
||||
assert.equal(missingDoorsCredential.ready, false);
|
||||
assert.equal(
|
||||
missingDoorsCredential.checks.find((check) => check.key === "trust:credential")?.passed,
|
||||
false,
|
||||
);
|
||||
await prisma.trustContent.update({
|
||||
where: { id: doorsCredentialTrust.id },
|
||||
data: { isPublished: true, content: " \n " },
|
||||
});
|
||||
const blankDoorsCredential = JSON.parse(
|
||||
(
|
||||
await request("/admin/releases/readiness", {
|
||||
headers: { authorization: `Bearer ${doorsAdminToken}` },
|
||||
})
|
||||
).body,
|
||||
);
|
||||
assert.equal(blankDoorsCredential.ready, false);
|
||||
assert.equal(
|
||||
blankDoorsCredential.checks.find((check) => check.key === "trust:credential")?.passed,
|
||||
false,
|
||||
);
|
||||
} finally {
|
||||
await prisma.trustContent.update({
|
||||
where: { id: doorsCredentialTrust.id },
|
||||
data: originalDoorsCredentialTrust,
|
||||
});
|
||||
}
|
||||
const enabledForms = await prisma.inquiryForm.findMany({
|
||||
where: { brandId, isEnabled: true },
|
||||
select: { id: true },
|
||||
|
||||
@@ -282,10 +282,32 @@
|
||||
]
|
||||
},
|
||||
"trustContentTypes": [
|
||||
{ "type": "schedule", "label": "出摊与营业安排", "help": "说明固定出摊时间、临时营业安排或接受预订的时段。", "placeholder": "例如:周一至周五 17:00 - 22:30", "required": true },
|
||||
{ "type": "coverage", "label": "取餐与配送范围", "help": "说明服务地点、取餐方式和可配送范围。", "placeholder": "例如:支持校内宿舍楼下配送", "required": true },
|
||||
{ "type": "process", "label": "定制餐品流程", "help": "每行写一步,从提出需求到完成交付。", "placeholder": "例如:提交需求\n确认菜单\n制作交付", "required": true },
|
||||
{ "type": "credential", "label": "食品安全与制作标准", "help": "填写让顾客放心的资质、卫生或制作标准。" },
|
||||
{
|
||||
"type": "schedule",
|
||||
"label": "出摊与营业安排",
|
||||
"help": "说明固定出摊时间、临时营业安排或接受预订的时段。",
|
||||
"placeholder": "例如:周一至周五 17:00 - 22:30",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "coverage",
|
||||
"label": "取餐与配送范围",
|
||||
"help": "说明服务地点、取餐方式和可配送范围。",
|
||||
"placeholder": "例如:支持校内宿舍楼下配送",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "process",
|
||||
"label": "定制餐品流程",
|
||||
"help": "每行写一步,从提出需求到完成交付。",
|
||||
"placeholder": "例如:提交需求\n确认菜单\n制作交付",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "credential",
|
||||
"label": "食品安全与制作标准",
|
||||
"help": "填写让顾客放心的资质、卫生或制作标准。"
|
||||
},
|
||||
{ "type": "case", "label": "客户案例与反馈", "help": "填写代表性订单、活动案例或客户评价。" },
|
||||
{ "type": "promise", "label": "回复与服务承诺", "help": "说明回复时间、退改规则或服务承诺。" }
|
||||
],
|
||||
|
||||
@@ -270,12 +270,35 @@
|
||||
]
|
||||
},
|
||||
"trustContentTypes": [
|
||||
{ "type": "schedule", "label": "服务与合作安排", "help": "说明可预约时间、服务周期或项目排期。" },
|
||||
{ "type": "coverage", "label": "服务范围与适用对象", "help": "说明服务地区、项目类型或合作边界。" },
|
||||
{ "type": "process", "label": "合作流程", "help": "每行写一步,从初次沟通到交付完成。", "placeholder": "例如:需求沟通\n方案确认\n落地交付", "required": true },
|
||||
{ "type": "credential", "label": "专业资历与方法", "help": "填写经验、资质、专业标准或工作方法。", "required": true },
|
||||
{
|
||||
"type": "schedule",
|
||||
"label": "服务与合作安排",
|
||||
"help": "说明可预约时间、服务周期或项目排期。"
|
||||
},
|
||||
{
|
||||
"type": "coverage",
|
||||
"label": "服务范围与适用对象",
|
||||
"help": "说明服务地区、项目类型或合作边界。"
|
||||
},
|
||||
{
|
||||
"type": "process",
|
||||
"label": "合作流程",
|
||||
"help": "每行写一步,从初次沟通到交付完成。",
|
||||
"placeholder": "例如:需求沟通\n方案确认\n落地交付",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "credential",
|
||||
"label": "专业资历与方法",
|
||||
"help": "填写经验、资质、专业标准或工作方法。",
|
||||
"required": true
|
||||
},
|
||||
{ "type": "case", "label": "项目案例与客户反馈", "help": "填写代表性项目、成果或客户评价。" },
|
||||
{ "type": "promise", "label": "合作预期与响应承诺", "help": "说明回复时间、合作边界和后续跟进方式。" }
|
||||
{
|
||||
"type": "promise",
|
||||
"label": "合作预期与响应承诺",
|
||||
"help": "说明回复时间、合作边界和后续跟进方式。"
|
||||
}
|
||||
],
|
||||
"sampleContent": {
|
||||
"doors": {
|
||||
|
||||
Reference in new issue
Block a user