Commit Graph

62 Commits

Author SHA1 Message Date
Hermes Agent
43c1dbdf32 feat(llm): 内置 LLM 供应商配置与审核主链接入骨架
Some checks failed
CI / pytest (Python 3.10) (push) Has been cancelled
CI / pytest (Python 3.11) (push) Has been cancelled
CI / pytest (Python 3.12) (push) Has been cancelled
配置层:
- Settings 新增 llm_provider/api_key/base_url/model/timeout/max_tokens
- 生产 fail-closed: GAOKAO_LLM_PROVIDER=none 禁止, provider!=none 且 API key 为空禁止
- .env.docker.example / .env.payment.example 补 LLM 变量
- payment_readiness_doctor 将 LLM 配置纳入 readiness 检查

基础设施:
- 新增 data/llm/client.py: OpenAI-compatible LLMClient
- 新增 data/llm/prompts.py: audit/cwb/full_plan prompt 模板
- 新增 data/llm/tests/test_llm.py: 12 个单元测试

主链接入:
- ReviewResultContract 新增 llm_generated / llm_summary / llm_cwb_suggestions
- _start_review_result 优先尝试 LLM 生成审核结果, 失败时回退到原规则默认逻辑
- cwb 页面优先展示 LLM 生成的三档建议

测试适配:
- conftest / health / app / p2_4 tests 注入默认 LLM 测试配置,避免被新 fail-closed 提前拦截

验证:
- data/llm/tests 12 passed
- 核心 prod settings tests 62 passed
2026-06-28 12:11:43 +08:00
Hermes Agent
3acda15527 fix(frontend): 视觉验收发现的问题逐条修复
Some checks failed
CI / pytest (Python 3.10) (push) Has been cancelled
CI / pytest (Python 3.11) (push) Has been cancelled
CI / pytest (Python 3.12) (push) Has been cancelled
P0 致命修复:
- 首页表单中段灰色不可见文字: hero-note(#e8edf7) 改为显式 #475569 可读色
- 首页上传区域空白虚线框: 补图标+说明+格式支持+CTA文案
- 结账页顶部裸 HTML class="wrap">: 缺少 <main 标签导致

P0 CTA层级:
- 首页双CTA: "直接做完整规划"从 btn-primary 改为 btn-secondary 形成层级

P1 信任感:
- 结账页补退款政策+支付方式+支付安全三栏
- 结账页删除 3 张冗余 trust-strip 卡片(原 6 张→2 张 form-proof)
- 结账页补"考试省份"必填星号

P1 定价页统一:
- CTA 文案统一: "选择付费审核"/"支付并启动方案生成"/"选择深度辅导"
- 价格单位统一: /次 /单 → 全部 /份

P1 导航对比度:
- global-nav-link 从 #b8c8e4 提亮到 #d8e4f8 (WCAG AA 4.5:1)

验证: pytest 1303 passed, ruff All checks passed
2026-06-27 23:16:26 +08:00
Hermes Agent
34dd51fa31 fix(a11y): label[for]+id关联 + form aria-label + 省份下拉断言修正
Some checks failed
CI / pytest (Python 3.10) (push) Has been cancelled
CI / pytest (Python 3.11) (push) Has been cancelled
CI / pytest (Python 3.12) (push) Has been cancelled
a11y 审计修复:
- 首页复核表单: 4 个字段全部补 label[for]+id 关联(省份/分数/选科/目标)
- 表单补 aria-label='免费复核表单'
- 修复前 input_no_label=1, form_no_name=1
- 修复后 a11y 审计: all_clear=true(lang/viewport/h1/heading无跳级/input全有label/interactive全有文本/form有名称/focus-visible CSS)

测试修正:
- test_public_landing_page_served: '<select name>' → 'name=' (因为现在 select 有 id)

验证:
- pytest admin/tests/test_web_public.py 20 passed
- ruff All checks passed
- 浏览器 a11y 审计 all_clear=true
2026-06-27 17:11:09 +08:00
Hermes Agent
4202eba208 feat(frontend): 三阶段18项前端优化全部完成
Some checks failed
CI / pytest (Python 3.10) (push) Has been cancelled
CI / pytest (Python 3.11) (push) Has been cancelled
CI / pytest (Python 3.12) (push) Has been cancelled
第一阶段(致命缺陷修复):
- 复核结果页: 真分享(navigator.share+clipboard兜底)+保存草稿(localStorage), 删除假wxhelp外链
- 通用状态组件库: portal-ui.css新增state-loading/skeleton/empty/error/toast/sr-only
- my-orders/my-reports接入skeleton占位+state-empty

第二阶段(核心功能补齐):
- C方案鉴权: my-orders/my-reports/compare-reports删除find_by_phone手机号直查,
  改为portal token验证, 堵死P0-2越权漏洞
- 首页表单4字段即时校验(province/score/subjects/goal) + portal info 3字段校验
- cwb页面从固定文案升级为基于crowd_db的三档真实建议(冲刺+20/稳妥0/保底-20)

第三阶段(产品化提升):
- 新增/score-line-query分数线查询页(从crowd_db读本科线)
- 新增/rank-estimator位次估算页(基于benchmarks插值)
- /data-query扩展为4入口(分数线/位次/政策/同分段)
- 报告资产页补复制链接+系统分享
- 全局导航移除my-orders/my-reports(C方案)
- 从所有导航删除越权入口

验证: pytest 1306 passed, ruff All checks passed, 浏览器逐页验证通过
2026-06-27 13:23:08 +08:00
Hermes Agent
34134443ec frontend: 补齐报告列表页 + 交付后引导 + 导航栏完善
Some checks failed
CI / pytest (Python 3.10) (push) Has been cancelled
CI / pytest (Python 3.11) (push) Has been cancelled
CI / pytest (Python 3.12) (push) Has been cancelled
新增功能:
1. /my-reports 报告列表页:手机号查询已交付报告+查看入口+空状态+返回首页
2. 导航栏增加'我的报告'入口(现为5个:首页/套餐/我的订单/我的报告/客服)
3. Portal状态页交付后下一步引导:下载PDF/在线查看/继续规划三选项(仅report_ready/completed阶段显示)

测试: 60 passed
浏览器复验: /my-reports 和首页导航栏真实可用
2026-06-26 19:18:14 +08:00
Hermes Agent
465336802c frontend: 第二阶段 - 我的订单页 + 客服入口 + 导航栏完善
Some checks failed
CI / pytest (Python 3.10) (push) Has been cancelled
CI / pytest (Python 3.11) (push) Has been cancelled
CI / pytest (Python 3.12) (push) Has been cancelled
新增功能:
1. /my-orders 页面:用户输入手机号查看订单列表
   - 表格展示:订单号/套餐/状态/手机号/创建时间/查看详情
   - 空状态:暂无订单时友好提示
   - 查询结果可直接跳转 Portal 状态页
2. 全局导航栏增加我的订单和客服入口
3. 客服入口:mailto:lon22@qq.com

测试:
- test_my_orders_page_served: 页面存在且可访问
- test_my_orders_lookup_by_phone: 手机号查询返回订单列表
- 全量前端测试: 59 passed
- 浏览器复验: /my-orders 和首页导航栏真实可用
2026-06-26 18:02:10 +08:00
Hermes Agent
092f8cc907 frontend: 五轮首页与复核页结构减法,逼近高信任付费服务页标准
Some checks failed
CI / pytest (Python 3.10) (push) Has been cancelled
CI / pytest (Python 3.11) (push) Has been cancelled
CI / pytest (Python 3.12) (push) Has been cancelled
改版主线:
- /review/start: 从系统运营页改成用户结果页(不再暴露 JSON/go_step1)
- 首页:省份改下拉,表单压缩为 3 字段并移出 hero 核心区
- hero: 副文案压缩为一句,去掉三张说明卡与了解流程链接
- trust strip: 4→3,右侧判断块压缩为一句风险+上传能力
- browser_vision 复验确认:说明书感已显著下降,结构已从功能堆叠过渡到决策引导

测试基线同步:
- test_web_public.py: 首页副文案/流程编号/说明卡断言更新
- test_web_public_review_flow.py: 复核页断言改为用户视角文案

文档:
- docs/FRONTEND_PRODUCTION_REMEDIATION_PLAN_2026-06-26.md 记录整改真相源
2026-06-26 12:30:43 +08:00
Hermes Agent
adacb1224c feat(legal): 个人主体正式落盘 + consent_version 切到 v2026.06.25
Some checks failed
CI / pytest (Python 3.10) (push) Has been cancelled
CI / pytest (Python 3.11) (push) Has been cancelled
CI / pytest (Python 3.12) (push) Has been cancelled
按确认方案落地:
- 运营主体: 龙某某(个人开发者)
- 联系邮箱: lon22@qq.com
- 隐私政策版本: privacy-policy-v2026.06.25
- 服务条款版本: service-terms-v2026.06.25
- 生效日期: 2026-06-25

文档更新:
- PRIVACY_POLICY_DRAFT.md: 新增个人信息处理者信息, 联系邮箱, 版本号, 生效日期
- SERVICE_TERMS.md: 新增运营主体信息, 联系邮箱, 版本号, 生效日期
- LEGAL_PRIVACY_BASELINE.md: 同步法务基线状态, 收窄待补项到前台挂载/第三方实名披露
- 清理文档中残留的“待补运营主体/邮箱/版本号”占位文案

运行时更新:
- Settings 默认 GAOKAO_CONSENT_VERSION 改为 privacy-policy-v2026.06.25
- /privacy 和 /service-terms 页面头部渲染主体/邮箱/版本/生效日期
- admin create_order / portal intake 默认 consent_version 与文档版本对齐

测试:
- 38 个针对性测试全过
- 页面真实渲染包含 lon22@qq.com 与正式版本号
- dev-verify all checks passed
2026-06-25 15:04:29 +08:00
Hermes Agent
ed68e298eb feat(compliance): consent_version 改为从 Settings 读取(支持环境变量覆盖)
Some checks failed
CI / pytest (Python 3.10) (push) Has been cancelled
CI / pytest (Python 3.11) (push) Has been cancelled
CI / pytest (Python 3.12) (push) Has been cancelled
改造前: consent_version 硬编码 't12-web-mvp-v1' / consent_scope 硬编码
改造后: 从 Settings 读取,可通过环境变量覆盖
- GAOKAO_CONSENT_VERSION (默认 privacy-policy-v2026.06-draft)
- GAOKAO_CONSENT_SCOPE_PORTAL (默认 web-self-service-order-intake)
- GAOKAO_CONSENT_SCOPE_CHANNEL_PREFIX (默认 channel-intake)

实现:
- Settings 新增 consent_version / consent_scope_portal / consent_scope_channel_prefix
- web_public._render_info_page 改为从 settings 取默认值
- orders.create_order 改为从 settings 取默认值

升级隐私政策时:
- 更新 docs/PRIVACY_POLICY_DRAFT.md 版本号
- 设置环境变量 GAOKAO_CONSENT_VERSION=new-version
- 无需改代码,老订单保留历史版本

测试:
- test_create_order_uses_settings_consent_version 锁定新行为
- dev-verify: 1292 passed / coverage / ruff / mypy 全绿
2026-06-25 13:55:08 +08:00
Hermes Agent
d3d615a011 feat(legal): 前台 /privacy + /service-terms 渲染完整法务送审版
Some checks failed
CI / pytest (Python 3.10) (push) Has been cancelled
CI / pytest (Python 3.11) (push) Has been cancelled
CI / pytest (Python 3.12) (push) Has been cancelled
改造前: /privacy 和 /service-terms 只显示简版概要页
改造后: 优先读取 docs/PRIVACY_POLICY_DRAFT.md / docs/SERVICE_TERMS.md
        渲染为含表格/列表/引用的完整 HTML 页面
        找不到 docs 时 fallback 到原简版概要页(向后兼容)

实现:
- 新增 _find_legal_doc_path() 路径查找 (开发态 docs/ + 部署态 admin/legal/)
- 新增 _render_legal_doc_page() markdown→HTML 渲染
  - 支持 tables/fenced_code/sane_lists 扩展
  - 专门为法务文档设计 CSS(标题/表格/引用块/code)
- 路由改为优先用完整渲染, None fallback 到简版
- 加 markdown + types-Markdown 依赖

测试:
- test_privacy_page_renders_full_legal_doc_when_available
- test_service_terms_page_renders_full_legal_doc_when_available
- test_legal_doc_pages_fallback_when_doc_missing (fallback 路径锁定)
- 修复 test_traceability_display_flow: data_year 2025→2026

dev-verify: 1291 passed / coverage / ruff / mypy 全绿
2026-06-25 13:41:09 +08:00
Hermes Agent
65422b53b2 feat(admin): 后台 routes + tests 多项增量改进
- routes: cases/orders/stats/ui/web_public 同步字段扩展
- stats.py: 统计聚合逻辑增强
- 14 个测试文件同步更新断言

dev-verify 1279 passed / ruff / mypy 全绿
2026-06-25 09:27:06 +08:00
Hermes Agent
0a6d9a7e39 test(web_public): 新增 3 个 TestClient 真实页面回归测试
- test_web_public_content_pages.py: 公开页 (/, /pricing, /privacy, /service-terms) 真实回归
- test_web_public_portal_info.py: portal info 表单 5 步向导完整测试
- test_web_public_review_flow.py: review 表单 + 303 redirect 真实测试

主链路不再依赖 RouteClient 自证, 改用真实 TestClient + 真实协议 + 真实重定向
2026-06-25 09:26:54 +08:00
Hermes Agent
8815f85ec4 feat(crowd_db): 27省全量完成 usable/high 升级 + review 修复
Some checks failed
CI / pytest (Python 3.10) (push) Has been cancelled
CI / pytest (Python 3.11) (push) Has been cancelled
CI / pytest (Python 3.12) (push) Has been cancelled
- 27 省全部达到 usable 及以上(7 high + 20 usable + 0 skeleton)
- high 白名单: 湖南/广东/江苏/山东/河北/浙江/福建
- 可信来源元数据补齐: 湖南/四川 province_official URL 修复
- 共享测试同步: test_provenance_query.py 全部 27/27 断言
- 前端文案: boundary_note 改为数据质量白名单口径
- 真相源文档: CURRENT_STATE / NATIONALIZATION_SOURCE_OF_TRUTH / ACTIVE_REMEDIATION / ACTIVE_EXECUTION_BOARD 全部同步到 7/20/0
- 删除垃圾文件 =2.0.0(pip install 误输出)

验证: pytest data/crowd_db/tests/ admin/tests/test_web_public_content_pages.py → 57 passed
2026-06-25 00:17:20 +08:00
Hermes Agent
2e9d668d1e fix(tests): admin conftest RouteClient.post headers bug + intake candidate_province
- conftest.py: RouteClient.post() 在 mock webhook 分支引用未定义 headers 变量
- test_web_public_alipay_sim_e2e.py: submit payload 漏传 candidate_province(schema 升级后变必填)
- web_public.py: 删除未使用的 primary_action_label/href 变量(ruff F841)
- test_schema.py: 修正 import 位置(E402)+ 补充 IntakePayload import

根因: 之前改动留下的回归 bug,dev-verify 全绿后再次验证通过
2026-06-24 22:30:22 +08:00
hermes
6eafe1fc9b feat(ops 6/20 v2.1.3): 生产加固 + L-A 送审前修复 + crowd_db 质量契约
Some checks failed
CI / pytest (Python 3.10) (push) Has been cancelled
CI / pytest (Python 3.11) (push) Has been cancelled
CI / pytest (Python 3.12) (push) Has been cancelled
## 实现内容 (6 项改动)

1. **admin /health 端点增强** — 主键契约 status:ok 保持 + checks 子对象
   - db_writable: connect + CREATE TEMP TABLE + INSERT + SELECT + DROP
   - disk_writable: 在 ops_alert_log_path 目录创建临时文件 + 删除
   - settings_valid: 复用 is_jwt_secret_secure 判断
2. **_enforce_jwt_secret_policy** — prod env 使用 dev 默认 JWT / 长度<32 → fail-closed
3. **_enforce_default_admin_password_policy** — prod env 用 admin123 / 长度<10 / 字符类<3 → fail-closed
4. **L-A R7: admin UI footer** — dashboard.html (592 行) + ui.py 内联 admin/orders/new
   模板加 footer 隐私政策 + 数据删除 + 服务说明链接, 与 portal _render_footer_links() 同口径
5. **L-A R1+R4: LEGAL_PRIVACY_BASELINE 文档同步**
   - §6 移除孤儿 'admin' consent_channel 值 (代码侧从未实际产生)
   - §7 已具备/尚缺 重写, 显式归到 6/20 增量
6. **Q-A: tests/test_crowd_db_data_quality.py** — 8 个测试锁住
   - 27 省总数 + 仅湖南 high + 其它 26 省 ≤ usable
   - 高考生源大省 (广东/江苏/北京/上海/山东/河南/四川/湖北) 不在 high 集合
   - data_year=2025 (6/25 后需显式更新)

## 测试

- 4/4 RED → GREEN (admin/tests/test_health.py: JWT/admin password 拒绝 dev 默认值)
- 8/8 GREEN (data/crowd_db/tests/test_crowd_db_data_quality.py: 数据质量契约)
- 3 回归修复 (test_app.py + test_routes.py + test_health.py 适配新 /health checks 字段)
- 31/31 GREEN (admin/tests/test_app.py + test_routes.py + test_health.py)

## 报告

- reports/LA_LEGAL_PRIVACY_PRE_AUDIT_2026-06-20.md (363 行, 9 风险 0 阻塞)
- reports/QA_CROWD_DB_NON_HUNAN_DENSITY_AUDIT.md (45 行, CRITICAL 文档失真已规避)

## 文件

M CHANGELOG.md (v2.1.3)
M admin/config.py (2 个 _enforce_*_policy + load_settings post-load)
M admin/routes/health.py (3 个 _check_* + checks 子对象)
M admin/routes/ui.py (admin/orders/new 模板加 footer)
M admin/static/dashboard.html (footer 块)
M admin/tests/test_app.py (适配 checks 字段 + regex 兼容)
M admin/tests/test_health.py (4 个新测试)
M admin/tests/test_routes.py (适配 checks 字段)
M docs/CURRENT_STATE.md (0.3-0.5 增量段)
M docs/LEGAL_PRIVACY_BASELINE.md (§6 清理 + §7 重写)
+ data/crowd_db/tests/test_crowd_db_data_quality.py (8 tests)
+ reports/LA_LEGAL_PRIVACY_PRE_AUDIT_2026-06-20.md
+ reports/QA_CROWD_DB_NON_HUNAN_DENSITY_AUDIT.md
2026-06-20 18:36:23 +08:00
hermes
187b2ae634 fix(compliance): A-2 admin/外部渠道补录同意审计统一化
LEGAL_PRIVACY_BASELINE §4/§6 要求任何订单创建路径必须记录同意审计字段。
portal 路径已落 consent_channel=portal / consent_operator=guardian (见
web_public.py + intake_store.save), admin 路径 6/20 之前完全不入任何 consent
字段 (admin/routes/orders.py grep 'consent' 0 命中), 形成合规盲区。

落地:
- CreateOrderRequest 新增必填 consent: ConsentInfo
  - consent_method Literal: verbal_chat / phone_recording / screenshot /
    written_form / self_declared
  - consent_note Optional[str]
  - 缺失或非法 → HTTP 422
- Order 模型 + DAO _WRITABLE_COLUMNS 加 consent_method / consent_given_at
  (冗余落库避免每次列表 join order_intakes)
- schema 增量: ALTER TABLE orders ADD COLUMN consent_method / consent_given_at
  (幂等)
- create_order 同步写 order_intakes (独立 IntakeStore.for_db, 不复用 OrdersDAO
  conn — T12-D conn ownership 修复保驾)
  - consent_channel = payload.source (xianyu/wechat/school/web)
  - consent_operator 严格按基线白名单 self/guardian/admin_import:
    - web 渠道: 'guardian' (与 intake_store.save 默认值一致)
    - 其他渠道: 'admin_import' (后台代录, 同意来源是渠道商)
  - consent_method / consent_given_at / consent_note 落库

测试:
- test_create_order_rejects_missing_consent_block[xianyu|wechat|school|web] (4 个)
- test_create_order_writes_intake_record_with_consent_audit
- test_create_order_external_channel_marks_consent_operator_as_admin
- test_create_order_rejects_invalid_consent_method
- test_order_detail_returns_consent_method_and_given_at
- 更新 test_create_order_returns_masked_payload_with_history (加 consent)
- 更新 test_admin_orders_alias_list_and_detail (加 consent)

验证:
- 25/25 admin/tests/{test_routes_orders,test_admin_alias_routes} 通过
- ruff + mypy 通过
- 端到端 smoke: 4 笔订单 (2 terminal + 1 pending + 1 paid-in-window) 实测
  包含 consent 字段全部通过
- dev-verify: 1186 passed / 2 failed (失败的 2 个均为 worktree 环境限制:
  test_backup_restore_service_level 的 subprocess 路径假设 + 6/19 已知问题,
  与本改动无关; main 上单跑同样测试通过)
2026-06-20 15:29:06 +08:00
Hermes
2893a45d8b feat(6/19): 保留期门禁 + 支付失败持久化 + 文档校准
Some checks failed
CI / pytest (Python 3.10) (push) Has been cancelled
CI / pytest (Python 3.11) (push) Has been cancelled
CI / pytest (Python 3.12) (push) Has been cancelled
A1 删除/匿名化 180 天保留期门禁 (P0):
- admin/errors/codes.py + BIZ_ORDER_RETENTION_NOT_EXPIRED (E02002) -> HTTP 409
- admin/config.py + retention_days / GAOKAO_RETENTION_DAYS (默认 180)
- admin/routes/orders.py + _assert_retention_expired 守卫
- data/orders/deletion_service.py + RETENTION_GUARDED_STATUSES
- admin/tests/test_order_deletion.py + _expire_retention_window + 3 测试

B1 支付失败 webhook 持久化 (P1):
- data/payments/dao.py + failed_at/failure_reason/provider_trade_no/callback_payload
- data/payments/models.py + PaymentRecord 新字段
- data/payments/service.py handle_webhook 失败分支持久化
- data/payments/tests/test_webhook.py test_handle_webhook_persists_failed_status

A2 文档校准 (P1):
- README / PRD / ROADMAP / TECH_ARCHITECTURE 顶部对齐 6/19

B2 真相源分层 (P1):
- 6/13 整改板/执行板加历史快照前缀
- 新建 6/19 整改板/执行板
- CURRENT_STATE 顶部加 6/19 增量段 (在 6/13 真相源之上叠加)

dev-verify: 1175 passed (A1+B1+A2+B2) -> 1179 passed (+ T12-C),
coverage overall=85.05% / core=100%
2026-06-20 00:27:15 +08:00
Hermes
5a0b2a83ec feat(portal): T12-C 前台删除工单 + 保留期外可申请交互
落地 T12-C: 让用户在 portal 删除工单页/POST 中都能看到该订单
当前所处保留期阶段(pending/within/outside),并按阶段给出明确的
next_step 文案。

- DeletionRequestCreate.scope 锁定到白名单
  (order_only | order_and_attachments | full_account); 非法值 → 422
- _resolve_retention_status(order, settings) 复用
  RETENTION_GUARDED_STATUSES + settings.retention_days
- POST 端 next_step 三种文案:
    outside: 已超过 180 天保留期,可申请删除...
    within:  订单仍在 180 天保留期内...
    pending: 提交成功后将由人工核验后处理
- GET 端在表单上方插入'保留期状态'提示卡
- admin/tests/test_order_info_form.py 6 个新/增强测试 +
  _expire_retention_window helper

dev-verify: 1179 passed (was 1175, +4 net new),
coverage overall=85.05% / core=100%, ruff + mypy clean
2026-06-20 00:26:59 +08:00
Hermes Agent
6d0feeb090 build: prove pdf runtime and strict remediation gates
Some checks failed
CI / pytest (Python 3.10) (push) Has been cancelled
CI / pytest (Python 3.11) (push) Has been cancelled
CI / pytest (Python 3.12) (push) Has been cancelled
2026-06-18 17:40:12 +08:00
Hermes Agent
2d26d96eaa fix: reduce portal and share exposure surfaces 2026-06-18 16:12:22 +08:00
Hermes Agent
2da926bb5e fix: tighten audit exposure and consent data handling 2026-06-18 15:36:24 +08:00
Hermes Agent
a82c5b3cca fix: align retention cleanup across notifications logs and share telemetry 2026-06-18 15:20:16 +08:00
Hermes Agent
9a8ad91216 fix: stop exposing portal tokens across payment URLs and storage 2026-06-18 15:04:46 +08:00
Hermes Agent
c07c998204 fix: enforce admin role on backend order and audit routes 2026-06-18 14:36:38 +08:00
Hermes Agent
444fc8a530 fix: restrict portal report paths to trusted directories 2026-06-18 14:28:04 +08:00
Hermes Agent
246f21c7f2 feat(review): land unified remediation and rules evidence closure
Some checks failed
CI / pytest (Python 3.10) (push) Has been cancelled
CI / pytest (Python 3.11) (push) Has been cancelled
CI / pytest (Python 3.12) (push) Has been cancelled
2026-06-18 10:21:38 +08:00
Hermes Agent
f5e7098c50 fix(landing+pricing): A) consult form privacy note + B) pricing page copy sync
Some checks failed
CI / pytest (Python 3.10) (push) Has been cancelled
CI / pytest (Python 3.11) (push) Has been cancelled
CI / pytest (Python 3.12) (push) Has been cancelled
A) 首页咨询表单加隐私说明 (admin/routes/web_public.py):
  - 在表单标题下方加 .consult-privacy 框:
    '🔒 这些输入只用于判断要不要复核你的方案, 不会留底、不会用于生成方案、不会发邮件推销。
     如果你决定不进入付费方案, 提交的资料不会保存到我们的数据库。'
  - 在表单下方加 .consult-privacy-tail:
    '不会收到营销短信, 提交后你也可以随时要求删除已填资料。'
  - 新增 CSS: .consult-privacy (薄荷绿底+边框) / .consult-privacy-tail (灰色脚注)
  - 设计意图: 不抢眼但能看见, 用浅色背景与表单区分, 不影响主 CTA 视觉权重

B) 套餐页 /pricing 同步'复核免费 / 方案付费' 口径:
  - lead 文案加 <strong>复核现有方案本身免费</strong> (放在最前面)
  - consult-summary 内加 consult-reassure 框:
    '💡 如果你还没决定, 先做一次免费复核, 再决定要不要进入付费方案。'
  - summary 副卡加 summary-reassure:
    '🔒 还没下单前, 提交的基本情况仅用于判断是否需要复核, 不会留底。'
  - trust-proof 1 号卡: '先审计再决定' → '复核免费 / 方案付费'
  - trust-band 3 号卡: '合规入口可见' → '复核免费 / 方案付费' (新增回流入口)
  - 49元档 eyebrow: '快速校验' → '复核 / 风险' (强调只审不改)
  - 99元档 eyebrow: '完整规划' → '生成 / 完整' (强调生成动作)
  - 199元档 eyebrow: '深度辅导' → '生成 / 深度'
  - 49元档 desc: 加'不会重新生成志愿表 (生成需选 99 元)' 边界
  - 99元档 desc: 加'方案生成与详细报告在支付后启动' 边界
  - 199元档 desc: 加'在 99 元完整方案基础上提供多轮修订和深度解释'
  - 49元档 CTA: '先做快速审核' → '先做付费审核' (用'付费'反衬'免费复核')
  - 99元档 CTA: '立即开始完整规划' → '支付并启动方案生成'
  - 199元档 CTA: '了解深度辅导' (保持)
  - 49元档 features: 加'不重新生成志愿表(生成需选 99 元)' 边界
  - 199元档 features: 加'包含 99 元完整方案的所有交付'
  - FAQ 加 '复核是免费的吗?包含什么?' (明确边界: 复核免费/审核报告 49/完整方案 99起)
  - 99元 FAQ 加 '99 元是生成一份完整方案的价格, 不是查看价格' 避免误解
  - notice 提示: '先做一次免费复核' 引导 + 保留 49/99 路径建议

新增测试断言:
  - 首页: '不会留底' / '不会用于生成方案' / '不会发邮件推销' / '不会收到营销短信' (4 条)
  - 套餐页: '复核现有方案本身免费' / '复核免费 / 方案付费' / 'href="/#consult-box"' /
    '先做一次免费复核' / '先做付费审核' / '支付并启动方案生成' / '复核 / 风险' /
    '生成 / 完整' / '生成 / 深度' / '不会重新生成志愿表' / '支付后启动' /
    '复核是免费的吗?包含什么?' / '还没决定' (13 条)
  - 套餐页反向断言: '先做快速审核' / '立即开始完整规划' / '先审计再决定' / '快速校验' (4 条)

验证:
  - pytest 22 passed (test_web_public + test_order_status_page + test_web_public_alipay_sim_e2e)
  - ruff check: All checks passed
  - 真实 HTTP 端到端 17/17 断言 OK (A 6 条 + B 20 条旧移除+新命中)
  - Playwright vision 验证:
    A) 首页隐私说明: 上下双向布局, 浅色克制, 覆盖'用途/营销/删除'三要素 
    B) 套餐页: lead/eyebrow/CTA/FAQ 5 处引导回首页 全部对齐'复核免费/方案付费' 
2026-06-17 22:38:42 +08:00
Hermes Agent
81dbaddaea fix(landing): align copy to '复核免费 / 方案付费' (no 免费咨询 promise)
Some checks failed
CI / pytest (Python 3.10) (push) Has been cancelled
CI / pytest (Python 3.11) (push) Has been cancelled
CI / pytest (Python 3.12) (push) Has been cancelled
用户最新反馈: 首页不应承诺'免费咨询'; 复核现有方案是免费的, 完整方案
生成和深度辅导需在支付后启动。咨询入口只用于快速问询, 不是承诺
免费生成方案。

文案改动 (admin/routes/web_public.py):
- hero-note: '咨询本身免费' → '复核现有方案本身免费; 新方案生成与深度辅导在支付后启动'
- 咨询表单标题: '先告诉我们你的基本情况' → '告诉我们你的基本情况'
- 咨询表单副标题: '判断 + 适合路径' → '判断 + 说明后续可走步骤, 复核本身免费; 新方案生成与深度辅导在支付后启动'
- 当前目标 placeholder: '先审计现有方案' → '先复核现有方案'
- 补充说明 placeholder: '想先看风险' → '想先看有没有明显风险'
- 主按钮: '获取推荐路径' → '获取复核与推荐'
- 次按钮: '直接看套餐' → '直接看付费套餐'
- hero-trust 1 号卡: '先审计后规划' → '复核免费 / 方案付费'
- hero-points lead: '先做审核' → '先做免费复核'; '再决定是否进入完整规划' → '再决定是否进入付费的完整规划'
- 服务流程 01 步: '选择服务深度' → '先判断入口'  ('方案复核(免费) vs 完整方案/深度辅导(付费)')
- 服务流程 02 步: '避免在支付前被长表单劝退' → '选完整方案或深度辅导时, 先填最小信息后再支付'
- 服务流程导语: '比空泛地说智能系统已接入更重要' → '复核免费, 方案生成和深度辅导需付费'
- 底部 CTA 标题: '先看套餐, 再决定是否立即下单' → '已有方案? 先免费复核; 明确要做? 看付费套餐'
- 底部 CTA 副标题: '如果你已经明确要做完整方案, 可以直接进入 99 元方案页' → '如果已经拿到一版方案, 可先做一次免费复核; 明确要完整方案或深度辅导, 可直接进入套餐页'

测试更新 (admin/tests/test_web_public.py):
- 移除对'咨询本身免费' / '先审计后规划' / '先告诉我们你的基本情况' / '获取推荐路径' / '先看套餐' 的正向断言
- 改为反向断言 (确保旧文案已清除) + 新口径的正向断言
- 新增 9 条新口径断言: '复核现有方案本身免费' / '新方案生成与深度辅导在支付后启动' /
  '复核免费 / 方案付费' / '获取复核与推荐' / '直接看付费套餐' / '方案复核(免费)' /
  '深度辅导(付费)' / '已有方案? 先免费复核' / '告诉我们你的基本情况'

验证:
- pytest 22 passed (test_web_public + test_order_status_page + test_web_public_alipay_sim_e2e)
- 真实 HTTP 19/19 文案断言全部 OK (旧文案已清除, 新文案已上线)
- Playwright 截图 vision 验证: 5/5 触点对齐口径 (hero CTA / hero-note / 咨询表单 /
  hero-trust 1 号卡 / 服务流程 + 底部 CTA)
2026-06-17 22:11:31 +08:00
Hermes Agent
f420301571 fix(plan-b): align landing CTAs to 立即咨询/查看套餐 + fix mobile sticky bottom
Some checks failed
CI / pytest (Python 3.10) (push) Has been cancelled
CI / pytest (Python 3.11) (push) Has been cancelled
CI / pytest (Python 3.12) (push) Has been cancelled
A) 首页 hero CTAs 改成方案 B 原意:
  - 旧: 立即咨询 (secondary) + 先做快速审核 (primary)
  - 新: 立即咨询 (primary) + 查看套餐 (primary) — 两个并列主 CTA
  - hero-note 从'适合已经拿到一版方案' 改为'咨询本身免费, 不必先付款'

B) 资料页移动端关键操作按钮改为 fixed 底部:
  - 把 .wizard-actions 移出 <form>, 让它成为所有 step-panel 的同级元素
  - 移动端 (max-width: 980px) 用 position: fixed 而非 sticky
  - safe-area-inset-bottom 适配 iPhone 刘海/灵动岛
  - 主面板 padding-bottom: 168px 防止按钮遮挡最后内容
  - 桌面端 (desktop) 仍保留 sticky 行为, 不影响长内容阅读

测试覆盖:
  - test_public_landing_page_served: 更新断言验证两个主 CTA 均为 btn-primary,
    旧'先做快速审核' 已移除, 新'咨询本身免费' 文案已加入
  - test_info_page_wizard_actions_outside_form_for_sticky_bottom: 验证
    .wizard-actions 在 </form> 之后 (sibling 关系), 按钮文案齐全, safe-area 适配

Playwright 验证:
  - scroll=0/800/1500 时, wizard-actions 始终在 viewport y=622-844 (固定底部)
  - vision 验证: 顶部缺失项提示 + 底部 3 个主操作按钮 (上一步/下一步/保存草稿) 全部可见

测试结果: 22 passed (test_web_public + test_order_status_page + test_web_public_alipay_sim_e2e)
ruff: All checks passed
2026-06-17 21:50:06 +08:00
Hermes
38f74bd1f1 feat(portal): add payment-success intermediate page + status/info copy
Some checks failed
CI / pytest (Python 3.10) (push) Has been cancelled
CI / pytest (Python 3.11) (push) Has been cancelled
CI / pytest (Python 3.12) (push) Has been cancelled
After successful payment, the gateway now lands users on an
intermediate 'payment-success' page that explains next steps
(continue intake, or jump to status) before they continue into
the live status view. This is a product-experience improvement
over the old direct /status redirect and was already staged in
uncommitted web_public work; this commit lands the matching test
assertions and copies.

Changes:
- admin/routes/web_public.py
  * /portal/{token}/payment-success route + _render_payment_success_page
  * payment_return_page now redirects to /payment-success (303)
  * landing_page renders a 'consult' quick-intake card
- admin/tests/test_web_public.py
  * test_payment_return_redirects_to_payment_success_page
  * test_payment_success_page_served_after_paid_order
  * landing/pricing/info/status copy assertions
- admin/tests/test_order_info_form.py
  * assert the 'still need to fill' reminder renders
- admin/tests/test_order_status_page.py
  * test_info_required_status_page_emphasizes_continue_intake
  * assert '查看报告' / '查看当前进度' on delivered/processing status
- admin/tests/test_web_public_alipay_sim_e2e.py
  * accept the new /payment-success intermediate page
- tests/test_cli_doctor_phase3.py
  * drop unused pytest import (ruff F401)

Verification:
- focused alipay_sim E2E: 1 passed
- dev-verify full gate: all checks passed (ruff / mypy / pytest / coverage / benchmark)
2026-06-17 18:50:08 +08:00
Hermes Agent
25a84c426b feat(admin): add hidden dashboard seed-order tools
Some checks failed
CI / pytest (Python 3.10) (push) Has been cancelled
CI / pytest (Python 3.11) (push) Has been cancelled
CI / pytest (Python 3.12) (push) Has been cancelled
- add hidden dev-only seed endpoint /api/admin/orders/dev-seed
  - overdue_pending_once: create one 2-day-old pending order with draft intake
  - cleanup_demo_seed: delete demo-tagged seeded orders
- restrict hidden seed route to non-prod env
- avoid decrypting all orders during cleanup; query ids/tags directly from SQL
- dashboard hidden entry:
  - title id=dashboard-title
  - dev-seed-panel hidden by default
  - opens via 5 title clicks or ?seed-tools=1
  - buttons: 补 1 笔超时待办 / 清理演示造数
- dashboard JS:
  - postDevSeed()
  - panel show/hide
  - refresh dashboard after seed/cleanup
- tests:
  - route auth + create/cleanup flow
  - dashboard HTML/JS structure assertions
  - admin UI page exposes hidden entry markup
- verification:
  - pytest 69 passed
  - browser: ?seed-tools=1 展开面板, 补造后 pending=8 overdue=1 missing=8, 清理后恢复 pending=7 overdue hidden
2026-06-17 10:42:14 +08:00
Hermes Agent
fd7174a70e feat(stats+dashboard): expand pending_orders into 3 actionable dimensions
Some checks failed
CI / pytest (Python 3.10) (push) Has been cancelled
CI / pytest (Python 3.11) (push) Has been cancelled
CI / pytest (Python 3.12) (push) Has been cancelled
## 后端 admin/stats.py
- compute_summary 在单条聚合 SQL 中加两个新字段:
  - pending_overdue_24h: status='pending' AND created_at < (now - 24h)
    (超时未付,需主动催付)
  - pending_missing_intake: status='pending' AND
    (order_intakes 无记录 OR order_intakes.status='draft')
    (资料待补,需主动跟进)
- LEFT JOIN order_intakes AS i ON i.order_id = orders.id
- 关键 bug 修复: SQL ? 顺序与参数顺序必须匹配,
  (overdue_cutoff 在 IN 子句后) 之前误用 (overdue_cutoff, *_REVENUE_STATUSES)
  导致 overdue_cutoff datetime 字符串误入 IN 子句,
  'completed' 误入 created_at < ? 子句, 收入少算 30%。
  已修正为 (*_REVENUE_STATUSES, overdue_cutoff)
- 列名全部限定为 orders.status / orders.created_at,避免与 i.status 歧义

## 前端 admin/static/dashboard.html
- KPI 4 待处理订单卡加 .pending-breakdown 区域
- 两个 pill 标签: pending-tag-overdue(红色,超时) + pending-tag-missing(橙色,资料待补)
- 仅在对应字段 > 0 时才显示
- CSS .pending-tag[hidden] { display: none; } 确保 hidden 属性生效

## 前端 admin/static/dashboard.js
- renderSummary 新增 pending_overdue_24h / pending_missing_intake 渲染
- 至少一个非零才展开 breakdown 区域

## 测试
- conftest.py orders_db fixture 同时建 order_intakes 表,避免 LEFT JOIN 缺表
- test_routes_stats_dashboard.py:
  - test_dashboard_empty_db_shape 锁住 summary 必须含 12 字段
  - test_dashboard_summary_pending_orders 更新 revenue 期望 (paid + serving 计入)
  - 新增 test_dashboard_summary_pending_overdue_24h (2天前 vs 12h前)
  - 新增 test_dashboard_summary_pending_intake (submitted/draft/无 intake 4 种组合)
- test_app.py 加 pending-breakdown 结构断言
- pytest 52 passed

## 真实环境验证
- admin/test-pass-123 登录后:
  pending=7 overdue=0 missing_intake=7
- 视觉验证: KPI 4 显示 '7' 主值 + '资料待补 7' 橙色 pill
  '超时' pill 因 overdue=0 自动隐藏
- 数据一致性: by_status.pending=7 与 summary.pending_orders=7 一致
2026-06-16 21:48:18 +08:00
Hermes Agent
ca80d7ba0e feat(stats): add pending_orders to dashboard summary
Some checks failed
CI / pytest (Python 3.10) (push) Has been cancelled
CI / pytest (Python 3.11) (push) Has been cancelled
CI / pytest (Python 3.12) (push) Has been cancelled
- admin/stats.py compute_summary 在单条聚合 SQL 中加 pending_orders 字段
  (status = 'pending' 计数),与 total_orders / total_revenue_cents 共用一条 SQL
- 修复 dashboard '待处理订单' KPI 4 一直显示 0 的问题
- 前端 dashboard.js 已读 summary.pending_orders ?? 0,无需改动
- 测试:
  - test_routes_stats_dashboard.py 加 test_dashboard_summary_pending_orders
    (3 pending + 2 paid + 1 serving + 1 refunded 验证 pending=3、revenue=30000、
    by_status.pending=3 与 summary.pending_orders 一致)
  - test_routes_stats_dashboard.py test_dashboard_empty_db_shape 更新 key 集
  - test_app.py test_create_app_bootstraps_orders_schema summary 等式加 pending_orders: 0
- 真实环境验证:admin/test-pass-123 登录后 11 orders / 7 pending 与 by_status 一致
2026-06-16 21:16:39 +08:00
Hermes Agent
1111bec32a feat(frontend): overhaul /dashboard layout, status badge, and empty states
Some checks failed
CI / pytest (Python 3.10) (push) Has been cancelled
CI / pytest (Python 3.11) (push) Has been cancelled
CI / pytest (Python 3.12) (push) Has been cancelled
- /dashboard 顶部加 system-status 徽章:尚未连接 / 已连接 / 异常 三态,背景渐变 + 圆点 + 元数据
- 顶部右侧加 quick-refresh / quick-logout 两个语义化动作
- 头部把原 3 个内嵌链接改成 quick-links pill 行,更专业
- 登录区加 id=login-form 与 aria-label,登录成功后自动折叠
- KPI 4 卡:订单数/收入/后台可登录用户/待处理订单
  - 每张卡片有 pill 标签与 data-card 钩子
  - 订单/收入两张卡加 spark 骨架线,登录后变 loaded
  - 空状态文案统一为「登录后查看 · 」
- 趋势图与 3 个分布图统一加 chart-empty 组件,未加载/无数据时显示占位
- JS:
  - 加 setStatus / setChartEmpty / markCardsLoading / markCardsEmpty
  - 失败或登出时统一清空所有图表并重置为占位
  - renderBarChart 在 dataMap 全为 0 时自动走空状态
  - 保留 sessionStorage,保留 localStorage 黑名单
  - 修复 pending_orders 的算式 bug
- 测试:test_app.py 加 system-status / quick-links / data-card / chart-empty / spark 等新结构断言,锁住产品化文案
2026-06-16 20:33:06 +08:00
Hermes Agent
a957b39cc0 feat(frontend): harden home CTA, Portal, public, and admin pages
Some checks failed
CI / pytest (Python 3.10) (push) Has been cancelled
CI / pytest (Python 3.11) (push) Has been cancelled
CI / pytest (Python 3.12) (push) Has been cancelled
- Landing: 主 CTA “先做快速审核” 升级为主按钮,移除多余的次按钮,添加 hero-note 与 hero-divider 让首屏节奏更稳
- Landing: hero-points 收口为 3 个差异化卖点,第 1 个加 lead 背景,右侧风险卡降饱和、避免压过主 CTA
- Landing: 删去旧“志愿方案审计更聚焦/先下单后补资料/站内可追踪交付”重复卡片
- Public: /privacy /service-terms /deletion-policy 接 portal-ui.css 并改成双段 panel + 列表结构
- Portal: /portal/{token}/notifications /portal/{token}/deletion-request 接 portal-ui.css 与新的工具条 / 表单字段化
- Admin: /admin/orders/new 接 portal-ui.css,添加“人工补录更直接/与后台订单主链一致/字段业务语义化”信任块
- Admin: /admin/notifications /admin/ops-alerts 接 portal-ui.css,添加 meta-grid 摘要并把 “payload / details” 改名为“通知内容摘要 / 详细上下文”
- Tests: 锁住 shared CSS、关键产品化文案、Portal 与 admin 页结构断言
2026-06-16 20:12:58 +08:00
Hermes Agent
a86bd08281 feat(frontend): polish landing, pricing, and checkout conversion pages
Some checks failed
CI / pytest (Python 3.10) (push) Has been cancelled
CI / pytest (Python 3.11) (push) Has been cancelled
CI / pytest (Python 3.12) (push) Has been cancelled
2026-06-16 17:14:51 +08:00
Hermes Agent
40ee7f4dc0 feat(frontend): complete local UI remediation for web, portal, and dashboard
Some checks failed
CI / pytest (Python 3.10) (push) Has been cancelled
CI / pytest (Python 3.11) (push) Has been cancelled
CI / pytest (Python 3.12) (push) Has been cancelled
2026-06-16 15:02:01 +08:00
Hermes Agent
9d239fe2c3 feat(t12): harden public checkout and add admin manual order page
Some checks failed
CI / pytest (Python 3.10) (push) Has been cancelled
CI / pytest (Python 3.11) (push) Has been cancelled
CI / pytest (Python 3.12) (push) Has been cancelled
2026-06-16 12:16:45 +08:00
Hermes Agent
becb86e672 fix(admin): add admin alias routes and dashboard entry
Some checks failed
CI / pytest (Python 3.10) (push) Has been cancelled
CI / pytest (Python 3.11) (push) Has been cancelled
CI / pytest (Python 3.12) (push) Has been cancelled
2026-06-16 08:57:47 +08:00
Hermes Agent
c03ed7a4ba feat(web): tighten portal privacy and cleanup flows
Some checks failed
CI / pytest (Python 3.10) (push) Has been cancelled
CI / pytest (Python 3.11) (push) Has been cancelled
CI / pytest (Python 3.12) (push) Has been cancelled
2026-06-15 21:24:55 +08:00
Hermes Agent
deee5e538a feat(ops): wire SMTP/IM alert sinks and tighten intake validation
Some checks failed
CI / pytest (Python 3.10) (push) Has been cancelled
CI / pytest (Python 3.11) (push) Has been cancelled
CI / pytest (Python 3.12) (push) Has been cancelled
2026-06-15 19:36:47 +08:00
Hermes Agent
eb06990b82 feat(t12): add multi-file upload limits and ops alert monitoring surfaces
Some checks failed
CI / pytest (Python 3.10) (push) Has been cancelled
CI / pytest (Python 3.11) (push) Has been cancelled
CI / pytest (Python 3.12) (push) Has been cancelled
2026-06-15 19:01:21 +08:00
Hermes Agent
bf7cce90f9 feat(ops): add admin ops alert audit and watchdog alert sink
Some checks failed
CI / pytest (Python 3.10) (push) Has been cancelled
CI / pytest (Python 3.11) (push) Has been cancelled
CI / pytest (Python 3.12) (push) Has been cancelled
2026-06-15 18:17:30 +08:00
Hermes Agent
f4aacc1795 feat(t12): turn intake form into 5-step wizard
Some checks failed
CI / pytest (Python 3.10) (push) Has been cancelled
CI / pytest (Python 3.11) (push) Has been cancelled
CI / pytest (Python 3.12) (push) Has been cancelled
2026-06-15 17:39:42 +08:00
Hermes Agent
6e14a2fc17 feat(t12): add admin notification audit page for production operations
Some checks failed
CI / pytest (Python 3.10) (push) Has been cancelled
CI / pytest (Python 3.11) (push) Has been cancelled
CI / pytest (Python 3.12) (push) Has been cancelled
2026-06-15 17:31:51 +08:00
Hermes Agent
bfe6ad16a7 feat(t12): add portal notification audit page and richer intake summary
Some checks failed
CI / pytest (Python 3.10) (push) Has been cancelled
CI / pytest (Python 3.11) (push) Has been cancelled
CI / pytest (Python 3.12) (push) Has been cancelled
2026-06-15 17:20:00 +08:00
Hermes Agent
d24901b88e feat(t12): expand structured intake wizard and status summary
Some checks failed
CI / pytest (Python 3.10) (push) Has been cancelled
CI / pytest (Python 3.11) (push) Has been cancelled
CI / pytest (Python 3.12) (push) Has been cancelled
2026-06-15 17:08:25 +08:00
Hermes Agent
b965dc2863 feat(t12): add portal attachment upload for self-service intake
Some checks failed
CI / pytest (Python 3.10) (push) Has been cancelled
CI / pytest (Python 3.11) (push) Has been cancelled
CI / pytest (Python 3.12) (push) Has been cancelled
2026-06-15 16:26:26 +08:00
Hermes Agent
7fabc23715 fix(t12): close payment delivery and governance remediation
Some checks failed
CI / pytest (Python 3.10) (push) Has been cancelled
CI / pytest (Python 3.11) (push) Has been cancelled
CI / pytest (Python 3.12) (push) Has been cancelled
2026-06-15 11:39:31 +08:00
Hermes Agent
3158bb839c fix(payments): close refund domain loop on order side
Some checks failed
CI / pytest (Python 3.10) (push) Has been cancelled
CI / pytest (Python 3.11) (push) Has been cancelled
CI / pytest (Python 3.12) (push) Has been cancelled
2026-06-15 09:21:45 +08:00