test: the report-question database test compares privileges on psql's t/f alphabet (BUG-2085)
Independent Staging Quality Gate / validate-frontend (push) Successful in 5m59s
Independent Staging Quality Gate / validate-python (push) Successful in 7m18s
Independent Staging Quality Gate / publish (push) Successful in 3m47s

Gate 8187 failed with 'f' !== 'false': the fixture's psql normalises a lone
false to f, so the two refused-privilege assertions never matched. The
migration is unchanged.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DbBXoyn7Hj3LCW3BUs5bZ8
This commit is contained in:
2026-11-20 17:15:20 +08:00
co-authored by Claude Fable 5.2
parent 3c5d133e8b
commit 6d0f4dcdc8
2 changed files with 8 additions and 4 deletions
+2
View File
@@ -28145,6 +28145,8 @@
- 验证与防复发:`frontend/tests/annual-questions-2085.test.tsx`(16 条):可提问的节、材料与封顶、圈选核对、日期核对、措辞检查、一轮回答的各条路径(通过、固定句、重写、删句、改写、整份报告、圈选)、说明文字、处理函数与路由的分流、请求形状、对话的创建、迁移文本、侧栏 / 点数记录 / 列表的去向、页面入口与可圈选段落。`frontend/tests/database-report-question-sessions-2085.test.ts`(需要数据库,本机跳过,由 CI 验证):列与索引与权限、别人的 / 没写完的报告和非 consultation 类型被拒、一份报告一段对话、绑定不能换、预扣加追加提问加付费结算、免费结算退回一点、删除报告后对话解绑仍可读。原有测试按原值 / 新值 / 原因更新六处(会话列名三处、读取次数、列表请求计数、迁移顺序)。
- 关联记录:BUG-2073、BUG-2081、BUG-2084、BUG-2057(对话表只用登录用户身份读)、BUG-1935。
- 修复版本:`claude/report-questions-2084`。
- 补充(2026-11-20,门禁 8187):数据库测试 `frontend/tests/database-report-question-sessions-2085.test.ts` 第一次在 CI 里运行即失败,报 `'f' !== 'false'`。原因在测试自身:夹具的 psql 会把单独一行的 `false` 归一成 `f`,两处「没有权限」的断言期望写成了 `false`。四处权限断言改为按 psql 的 `t` / `f` 比较;迁移没有改动。本机没有数据库,这条测试只能由 CI 证实。
## BUG-2090 | 生时纠正页的选中态仍是陶土色底(BUG-2087 规则之外留给生时纠正窗口的部分)
- 状态:fixed-pending-verify(待 staging 真机)。
@@ -52,10 +52,12 @@ test("a conversation is bound to an owned, finished annual report once; the sett
select indexdef like '%UNIQUE%' and indexdef like '%(user_id, report_id)%' and indexdef like '%report_id IS NOT NULL%'
from pg_indexes where schemaname = 'public' and indexname = 'chat_sessions_report_question_idx'
`), "t");
assert.equal(fixture.psql(`select has_column_privilege('authenticated', 'public.chat_sessions', 'report_id', 'INSERT')::text`), "true");
assert.equal(fixture.psql(`select has_column_privilege('authenticated', 'public.chat_sessions', 'report_id', 'UPDATE')::text`), "false");
assert.equal(fixture.psql(`select has_column_privilege('authenticated', 'public.chat_sessions', 'report_id', 'SELECT')::text`), "true");
assert.equal(fixture.psql(`select has_function_privilege('authenticated', 'public.chat_sessions_guard_report_question()', 'EXECUTE')::text`), "false");
// 原值:两处拒绝的权限期望 "false";新值:"f";原因:测试夹具的 psql 会把单独一行的 "false" 归一成 "f"
// (helpers/postgres-fixture.ts,"true" 不变),门禁 8187 因此报 'f' !== 'false'。四处一律不转 text,按 psql 的 t / f 比较。
assert.equal(fixture.psql(`select has_column_privilege('authenticated', 'public.chat_sessions', 'report_id', 'INSERT')`), "t");
assert.equal(fixture.psql(`select has_column_privilege('authenticated', 'public.chat_sessions', 'report_id', 'UPDATE')`), "f");
assert.equal(fixture.psql(`select has_column_privilege('authenticated', 'public.chat_sessions', 'report_id', 'SELECT')`), "t");
assert.equal(fixture.psql(`select has_function_privilege('authenticated', 'public.chat_sessions_guard_report_question()', 'EXECUTE')`), "f");
fixture.psql(`
insert into identity.users (id, name, email, email_verified, email_verified_at)