docs(release): 第二次发布记录与发布链修复的端到端验证

- 新 BUILD_ID HCvsEIztksM1GCWBJBrRP 上线;步骤 1.5 生成的镜像使 verify_remote
  的六项资源级断言在真实部署中全 200 —— 破站路径已由脚本自身堵住,不再靠人工复核
- 线上首页引用的 chunk 逐个回查本地产物确认同源;Playwright 三页 0 失败资源、0 控制台错误
- 证据补 deploy-2.txt 与可复跑的 probe.mjs
This commit was merged in pull request #29.
This commit is contained in:
zhangxiang committed 2026-10-08 18:05:10 +08:00
1 parent 2917416ff5
commit 104ec7db07
3 files changed
+4920

No files matched your search

File diff suppressed because it is too large. Load diff
@@ -0,0 +1,44 @@
import { chromium } from 'playwright-core';
const targets = ['https://novalon.cn/', 'https://novalon.cn/products/erp', 'https://novalon.cn/contact'];
const browser = await chromium.launch();
const ctx = await browser.newContext({ viewport: { width: 1280, height: 900 } });
let bad = 0;
for (const url of targets) {
const page = await ctx.newPage();
const failed = [];
const consoleErrs = [];
page.on('response', (r) => {
if (r.status() >= 400 && r.request().method() === 'GET') failed.push(`${r.status()} ${r.url()}`);
});
page.on('console', (m) => { if (m.type() === 'error') consoleErrs.push(m.text().slice(0, 120)); });
await page.goto(url, { waitUntil: 'networkidle', timeout: 60000 });
const probe = await page.evaluate(() => {
const h1 = document.querySelector('h1');
const cs = h1 ? getComputedStyle(h1) : null;
const brand = [...document.querySelectorAll('*')].find((e) => {
const c = getComputedStyle(e).color;
return c === 'rgb(196, 30, 58)';
});
return {
sheets: document.styleSheets.length,
h1: h1 ? h1.textContent.trim().slice(0, 24) : null,
h1Font: cs ? cs.fontFamily.slice(0, 24) : null,
h1Size: cs ? cs.fontSize : null,
brandRedNodes: !!brand,
hydrated: !!document.querySelector('[data-reactroot], [data-reactid]') || !!window.nextVersion || typeof window.__next_f !== 'undefined',
};
});
const uniqFailed = [...new Set(failed)];
console.log(`\n### ${url}`);
console.log(` stylesheets=${probe.sheets} h1="${probe.h1}" font=${probe.h1Font}/${probe.h1Size} brandRed=${probe.brandRedNodes} nextData=${probe.hydrated}`);
console.log(` 4xx/5xx GET = ${uniqFailed.length}`);
uniqFailed.slice(0, 6).forEach((f) => console.log(` ${f}`));
console.log(` console errors = ${consoleErrs.length}`);
[...new Set(consoleErrs)].slice(0, 4).forEach((e) => console.log(` ${e}`));
bad += uniqFailed.filter((f) => !/\/(api\/)?healthz/.test(f)).length;
await page.close();
}
await browser.close();
console.log(`\nTOTAL_FAILED_GETS=${bad}`);
+16
View File
@@ -477,3 +477,19 @@ S-3(about/contact/erp-upgrade 无 revalidate + revalidateTag no-op,涉渲染
**未合并,且刻意不合并**:`origin/main` 落后 46 笔(main tip `7df2dde`),而 `Jenkinsfile:407-429` 在 `branch 'main'` 上挂有「🚀 部署到生产环境」阶段 ⇒ 任何把这条链推上 `main` 的动作都会触发**无人值守的二次发布**。合并本 PR(→dev)不触发该阶段,但仍应由人决定;dev→main 另开 PR。
**证据目录**:`docs/acceptance/2026-10-08-release/` —— `build.txt`、`deploy.txt`(含步骤 1.5 与资源断言)、`type-check.txt`、`lint.txt`、`seed-rehearsal.txt`(副本演练)、`seed-diff.mjs` / `seed-diff.txt`(逐表差异,可复跑)、以及本节的线上核验读数(Playwright 三页 `TOTAL_FAILED_GETS=0`)。
### 10.8 第二次发布(2026-10-08 18:0x,`npm run build && ./scripts/deploy.sh deploy`)
**目的**:① 让线上产物对应已提交的树;② **端到端验证 §10.3 的发布链修复**(第一次部署时镜像是手工补的,修复本身还没在真实部署里跑过)。
| 检查 | 结果 |
|---|---|
| 构建 + 步骤 1.5 | `CHAIN_EXIT=0`;本地生成镜像 `dist/_next/static` 存在,新 BUILD_ID `HCvsEIztksM1GCWBJBrRP` |
| **资源级断言(新门禁首次实战)** | `verify_remote` 取样 6 件(5 个 `/_next/static/chunks/*.js` + `/favicon.ico`)**全 200** ⇒ 破站路径已被脚本自身堵住,不再依赖人工复核 |
| 产物同源 | 线上首页引用的 chunk 逐个回查本地 `dist/_next/static/**` ⇒ **同源命中**(chunk 名未变属预期:本轮只改文档,客户端代码无变化;BUILD_ID 已变证明是新构建) |
| 容器 | 重建后就绪轮询通过;Playwright 三页 `stylesheets=2`、品牌红命中、`4xx/5xx GET=0`、`console errors=0`,`TOTAL_FAILED_GETS=0` |
| 回滚锚点 | 本次部署前脚本自动产出新的 `dist_backup_*`(保留最近 3 份),DB 侧另有 `prod.db.bak.20261008_174734-preseed` |
证据:`docs/acceptance/2026-10-08-release/deploy-2.txt`(含步骤 1.5 与六项资源断言的原始输出)、`probe.mjs`(线上体检脚本,可复跑)、`build.txt`/`deploy.txt`/`seed-*`/`type-check.txt`/`lint.txt`。
**K 项已撤销**(见 §10.5 与 §10.6 的就地更正):`navigation`/`site-config` 无授予是 `prisma/seed.ts:241-242` 明示、`src/lib/seed-permissions.test.ts:18-19,50` 门禁钉住的**刻意站点级独占**,不是缺口。我上一笔据「矩阵里没有」就下结论,重犯了本仓 `docs/lessons-learned.md` §5.32 已立过的规则。