fix(report): keep the public table allowlist in sync with the longform appendix

The staging quality gate failed because database-local-business still listed the old pg_tables set after 20260905010000.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Jesse_Chen
2026-09-05 11:32:17 +08:00
parent bab0718700
commit 52a4570ca1
3 changed files with 33 additions and 4 deletions
+16
View File
@@ -8454,3 +8454,19 @@
- 复发自:BUG-546
- 修复版本:`cd704a92`
## BUG-548 | 全量附录表未写入 public 表白名单,staging 质量门失败
- 状态:resolved
- 首次发现:2026-09-05
- 最近更新:2026-09-05
- 影响面:Gitea `Independent Staging Quality Gate` / `validate``frontend/tests/database-local-business.test.ts`
- 用户现象:`bab07187` 推 staging 后质量门失败,镜像未发布。用户看不到新的全量数据附录入口。
- 触发条件:新增 `public.personal_report_longform_appendices` 后跑 `npm test --prefix frontend`
- 根因:`database-local-business``pg_tables` 的 public 表名单锁死。附录迁移已应用,名单仍缺 `personal_report_longform_appendices`,唯一失败项是 `not ok 949`。附录定向库测本身通过。
- 修复:把该表按字母序写入白名单;断言 `20260905010000_personal_report_longform_appendices.sql` 已应用且未双写冻结的 `frontend/db/migrations`
- 验证:Gitea run 2416 日志仅此 1 fail;本机重跑 `database-local-business`
- 防复发:新增 `public` 表必须同步改这条 `string_agg(tablename)` 白名单,并写原值/新值/原因。`npm test` 会跑 `tests/*.test.ts`,含这条库测。
- 相关记录:无
- 复发自:无
- 修复版本:本提交
@@ -73,9 +73,13 @@
- `./node_modules/.bin/tsc --noEmit`0
- 定向前端:`professional-report-reference-route` + `personal-report-longform-appendix` + entry/view 相关:**通过**
- `tests/database-personal-report-longform-appendices.test.ts`**1 pass**owner 可读、他人 0 行、authenticated 不能 insert、appendix `unavailable``personal_reports.status``ready`
- 未改 `.gitea/workflows/**`;未跑全量 `npm test` / 未提升 main
- 未改 `.gitea/workflows/**`;未跑全量 `npm test` / 未提升 main`bab07187` 的 staging 质量门因此在 `database-local-business` 表白名单上失败(BUG-548
- 任务 6 部署后真实用户附录未做
## 门禁修复(BUG-548
Gitea run 2416 / job 5696 `validate``npm test` 唯一失败是 `local PostgreSQL applies the reviewed business schema...`。实际名单多了 `personal_report_longform_appendices`。附录定向库测 `ok 951`。未改 workflow。
## 让步
- 未 vendor `professional_parity_closure.py`。五系统表走本地模块状态;辅助大运明细表仍可能缺 master-pack 周期行。
@@ -87,4 +91,4 @@
## BUG_HISTORY
无新增产品 Bug。BUG-535 保持 resolved,本轮未重开
BUG-548staging 质量门因 public 表白名单未含附录表失败;产品行为未改。BUG-535 保持 resolved。
+11 -2
View File
@@ -92,11 +92,17 @@ test("local PostgreSQL applies the reviewed business schema and serves authentic
assert.match(migration.stdout, /applied 20260831020000_feature_pricing_admin_runtime_read_policy\.sql/);
assert.match(migration.stdout, /applied 20260901010000_append_consultation_question\.sql/);
assert.match(migration.stdout, /applied 20260901020000_chat_session_pin_archive\.sql/);
assert.match(migration.stdout, /applied 20260905010000_personal_report_longform_appendices\.sql/);
assert.equal(
existsSync(fileURLToPath(new URL("../db/migrations/20260901020000_chat_session_pin_archive.sql", import.meta.url))),
false,
"business migration must not be copied into frontend/db/migrations (BUG-127/BUG-144)",
);
assert.equal(
existsSync(fileURLToPath(new URL("../db/migrations/20260905010000_personal_report_longform_appendices.sql", import.meta.url))),
false,
"business migration must not be copied into frontend/db/migrations (BUG-127/BUG-144)",
);
fixture.psql(pinArchiveMigration);
assert.equal(
fixture.psql(`
@@ -178,8 +184,10 @@ test("local PostgreSQL applies the reviewed business schema and serves authentic
"rectification:standard:3:draft",
);
// Existing assertion updated for the requested durable per-section table.
// Original value omitted personal_report_sections because the table did not exist.
// Public table allowlist. Last change (BUG-548):
// original: omitted personal_report_longform_appendices
// new: insert it between personal_report_jobs and personal_report_sections
// reason: 20260905010000 added the appendix cache table; this list must match live pg_tables
assert.equal(
fixture.psql(`
select string_agg(tablename, ',' order by tablename)
@@ -254,6 +262,7 @@ test("local PostgreSQL applies the reviewed business schema and serves authentic
"payment_orders",
"payment_packages",
"personal_report_jobs",
"personal_report_longform_appendices",
"personal_report_sections",
"personal_reports",
"pricing_experiment_events",