Skip to content

Feat/2.5.0 sg - #2832

Merged
likaiaki merged 17 commits into
feat/2.5.0-sg-mainfrom
feat/2.5.0-sg
Dec 3, 2026
Merged

likaiaki merged 17 commits into
feat/2.5.0-sg-mainfrom
feat/2.5.0-sg

Conversation

@likaiaki

@likaiaki likaiaki commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator

What

简要描述做了什么改动。

Why

为什么需要这个改动?

How

实现方式、设计决策(如有)。

Test

  • 本地测试通过
  • 114 测试服务器验证通过

Related

  • Issue/ticket:

Liwenru88 and others added 17 commits November 27, 2026 13:47
…r published files

- Trigger similarity refresh and background drain after document projection settle and shared migration projection completion

- Include unversioned ordinary files in space similarity queries and allow pairing between single-version undistributed managers and distributed managers

- Support linking single-version undistributed managers into canonical managers and normalize approval publish target document identity

- Add unit tests for projection batch refresh, published entry similarity, and canonical version linking
- backfill_qa_success_fact.py: backfill successful smart/document QA
  questions from MySQL into mid_realtime_qa_question_fact (dry-run by
  default; snapshot + backfill_batch marker for safe rollback)
- rollback_qa_success_backfill.py: delete backfilled records by marker
  and restore from snapshot
- diagnose_portal_qa_dashboard_gap.py: read-only diagnostic comparing
  MySQL question counts vs the ES fact table vs source telemetry events
Knowledge-space checks can treat Chinese place names and English tokens as whole words, while other callers stay on strict substring matching.

Co-authored-by: Cursor <cursoragent@cursor.com>
Keep the requirement, option B design, tests, and selection notes with the boundary-matching change.

Co-authored-by: Cursor <cursoragent@cursor.com>
…external backup

The 2.5 hop stopped at f058, and every later hop required our own freeze. Ask once at backup time, keep answer_abnormal when copying sessions, and refuse rollback when there is no freeze id.

Co-authored-by: Cursor <cursoragent@cursor.com>
Ruff RUF002 rejects the fullwidth commas added in the module docstring.

Co-authored-by: Cursor <cursoragent@cursor.com>
…external backup (#2826)

## Summary
- 2.5 升级跟当前 backend 镜像的 alembic head 走,不再停在 `f058`。库已经过 `f011` 时,不会再退回去跑
`alembic upgrade f011`。
- 会话从 B 拷到 A 时带上 `message_session.answer_abnormal`。源库没有这一列时写成 0。
- `p2/01-freeze-and-backup.sh`
先问要不要在本机备份。选「否」后,后面的升级命令不用再加参数。没有冻结编号时,`p2/90-rollback.sh` 直接停。

## Test plan
- [ ] 对改过的 hop 脚本做 `bash -n`
- [ ] `LOCAL_BACKUP=yes/no` 和 `logs/p2/skip-pack-freeze.txt` 的门禁取值
- [ ] `test_session_sql.py` 里 `answer_abnormal` 为 1、以及缺字段时写成 0
- [ ] 未在真实 MySQL / Docker 上跑升级


Made with [Cursor](https://cursor.com)
Operators no longer choose a match mode. Builtin terms stay substring matches, and custom terms count only when they align to one whole word.

Co-authored-by: Cursor <cursoragent@cursor.com>
Record failed attempts and search-assistant questions on the same fact index so totals, homepage QA count, and office export match actual questions.

Co-authored-by: Cursor <cursoragent@cursor.com>
## Summary
- 实时问答事实增加失败记录和搜索助手类型。总数、提问人数和首页「次问答」统计全部记录;成功数只统计成功,以及还没有结果字段的旧记录。
- 科室指标导出改为智能问答总数、专家问答数、文档内AI对话总数、搜索助手总数。同一批人员、不按日期筛选时,四列之和等于总问答数。
- 不预置成功率,不回补上线前的失败。需先于门户发布。

## Test plan
- [x] `test/test_realtime_dashboard.py`
- [x] `test/test_knowledge_space_chat_service.py`
- [x] `test/scripts/test_export_office_metrics.py`
- [ ] 真实 Elasticsearch、已发布看板和浏览器留给独立验收


Made with [Cursor](https://cursor.com)
The online check passed. The reply field stays off the page, and the two ingest checks are recorded.

Co-authored-by: Cursor <cursoragent@cursor.com>
Show the specific reason and the one-business-day deletion notice in the audit abnormal-file preview dialog for encrypted, damaged, unsupported and violating files. Normalize deterministic parse failures (10958 + reason, 10914 for parser 415) and skip content violations in every space reparse entry, including the platform audit page and the portal space detail.

The deletion sentence is display-only in this iteration; no cleanup task is added. Tests: backend 60 passed, platform vitest 67 passed, client helper and portal retry entry passed. Feature artifacts under features/v2.5.0-sg/087-audit-unparseable-file-notice.
## What

F087 审计异常文件提示与违规重试禁用:

- 平台「审计管理 →
异常文件」点击文件名后,预览弹窗明确展示该文件不可解析/不可使用的原因,以及“平台将于1个工作日后自动删除文件,请上传合规文档”的说明。
- 后端对空间源文件解析失败做保守结构分类:加密/结构损坏写 `10958 + data.reason`;解析服务 HTTP 415 写
`10914`;超时、服务异常、未知异常、内容违规不被覆盖。
-
内容违规文件在全部既有重试入口不可重新解析:平台审计页单条/批量、门户空间详情单条/批量/文件夹批量/带配置重试;服务端统一拒绝或跳过,不派发任务、不改状态、不清空原因。
- 新增三语言文案;违规列表原因建议语由“请修改后重试”改为“请上传合规文档”。

## Why

审计人员目前只能看到笼统“预览失败”或内部异常文本,无法判断是否值得重试或如何回复上传人;违规文件在两处入口都可以反复触发无效解析。

需求、设计与用例见 `features/v2.5.0-sg/087-audit-unparseable-file-notice/`。

## How

- 解析失败后、临时文件清理前,对空间源文件原始结构做保守归类;仅明确加密/损坏时抛 10958,既有业务错误和内容违规不覆盖。
- 前端从既有 `remark.status_code` / `data.reason`
派生终态类别,不新增接口字段;预览弹窗只在当前记录上展示提示。
- 审计单条重试对违规返回新错误码 18057;空间批量、带配置重试和平台通用空间重试过滤违规;门户 helper 排除违规。

## Test

- [x] 本地测试通过
- [ ] 114 测试服务器验证通过

本地执行:

- 后端:`pytest test/knowledge/test_parse_failure_classification.py
test/knowledge/test_abnormal_upload_retry_batch.py
test/knowledge/test_space_violation_retry.py
test/knowledge/test_source_file_validation.py
test/knowledge/test_unreadable_sync_file_cleanup.py
test/knowledge/test_etl_failure_remark.py` → **60 passed**
- 平台前端:`vitest run test/abnormalTerminalNotice.test.tsx
test/abnormalPreviewLifecycle.test.ts test/abnormalFilePreview.test.ts
test/abnormalUploadAccess.test.ts` → **67 passed**
- 客户端:`jest knowledgeUtils.retryable.test.ts` → **4
passed**;门户“重新解析入口”定向用例 → **1 passed**
- `ruff check` / `format --check`、`git diff --check`、`arch-guard.sh` 通过

**未验证:**
真实加密/损坏文件上传后的页面提示、真实权限、对象存储、浏览器渲染;`test_abnormal_upload_flow.py` /
`filter_flow` 本机缺少 `config.yaml` 与真实 MySQL 未执行。

## Known gap

> “平台将于1个工作日后自动删除文件”本期是**展示文案**,未实现自动删除任务(需求
D-02)。测试验收时请勿期待文件自动删除;该缺口已记录在交接与审核材料中。

## Related

- Feature:`F087-audit-unparseable-file-notice`
- Issue/ticket:无

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Restore the automotive sheet config panel and its recent-runs table. Token sync-records still lists the same run log.

Co-authored-by: Cursor <cursoragent@cursor.com>
…embership retries

Business users should see the saved failure in plain language, and a newer membership generation must not be overwritten by reparsing the same record.

Co-authored-by: Cursor <cursoragent@cursor.com>
…ar file

Default the publish dialog to the recommended similar document, and allow that merge when the target's only extra record is its own publish chain.

Co-authored-by: Cursor <cursoragent@cursor.com>
## What

- 发布弹窗的版本管理默认选中目标库里推荐的可关联相似文件。推荐还在加载时不能提交,手动改过的选择不会被推荐盖掉。
- 目标文件如果只是以前发布进来的,源库留着它自己的发布卡片,允许把新文件并进去成为新版本。已经分享到别的库的文件仍然不能合并。

## Why

选择推荐相似文件并提交后,审批人自己管理目标库时审批会直接通过,但执行合并失败,审批进入异常列表。失败原因是 `target document
is not eligible for merge`:相似文件此前已经发布进目标库,旧规则把这份文件自己的发布卡片当成不能再合并。

## How


合并校验放行完整的发布链,新发布记录接在旧卡片后面,不替换撤回用的链头。源库已经有一张可见的发布卡片时,这次审批产生的新卡片记为无效,源库仍只显示原来那一条。同一条审批再重试时,文件已经在目标库则按已成功返回。

## Test

- [x] 本地测试通过
- `UV_PYTHON=3.10 uv run --python 3.10
pytest`:已有发布链的合并、普通合并、拒绝分享目标、拒绝重复内容,5 passed
- `npx jest
src/pages/knowledge/SpaceDetail/FilePublishDialog.test.tsx`:29 passed
  - `scripts/arch-guard.sh` 通过
- [ ] 114 测试服务器验证通过

部署后需要在审批异常里重试原来失败的那条(异常 96,实例 484),线上当前仍是旧服务。

## Related

- Issue/ticket:


Made with [Cursor](https://cursor.com)
@likaiaki
likaiaki merged commit f98f074 into feat/2.5.0-sg-main Dec 3, 2026
0 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants