Repository navigation
fix(acquisition): 归一化上游 bad case 类型与标题 (#600) - #606
Merged
Shadow-Azure merged 6 commits intoNov 25, 2026
Merged
Conversation
Shadow-Azure
force-pushed
the
agent/develop-issue-600-bad-case-sync-type-title
branch
from
November 25, 2026 06:05
f3ca7d3 to
bd348fe
Compare
Shadow-Azure
pushed a commit
that referenced
this pull request
Nov 25, 2026
Shadow-Azure
pushed a commit
that referenced
this pull request
Nov 25, 2026
Owner
Author
检视意见处理结果(D1–D5 拍板结论已落
|
Shadow-Azure
pushed a commit
that referenced
this pull request
Nov 25, 2026
Shadow-Azure
force-pushed
the
agent/develop-issue-600-bad-case-sync-type-title
branch
from
November 25, 2026 07:14
83bfb28 to
9fb1559
Compare
Shadow-Azure
pushed a commit
that referenced
this pull request
Nov 25, 2026
Shadow-Azure
pushed a commit
that referenced
this pull request
Nov 25, 2026
Shadow-Azure
force-pushed
the
agent/develop-issue-600-bad-case-sync-type-title
branch
from
November 25, 2026 08:30
928225a to
5d17fb4
Compare
Shadow-Azure
pushed a commit
that referenced
this pull request
Nov 25, 2026
Shadow-Azure
pushed a commit
that referenced
this pull request
Nov 25, 2026
Shadow-Azure
force-pushed
the
agent/develop-issue-600-bad-case-sync-type-title
branch
from
November 25, 2026 08:42
5d17fb4 to
15e016c
Compare
Shadow-Azure
pushed a commit
that referenced
this pull request
Nov 25, 2026
Shadow-Azure
force-pushed
the
agent/develop-issue-600-bad-case-sync-type-title
branch
from
November 25, 2026 08:59
15e016c to
4604f70
Compare
Shadow-Azure
deleted the
agent/develop-issue-600-bad-case-sync-type-title
branch
November 25, 2026 09:32
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
由自动化 agent 提交,非人工手写。
Summary
上游 bad case 数据里已经出现
bad_case_type为 null 和title超长的条目:前者违反BadCaseItem的必填字符串约束,后者在同步链路里没有 200 字符截断(传输模型与bad_cases.title列宽都是 255,超过 255 才整页失败)。页级原子校验让单条脏数据成为 poison pill:同步游标停在坏页之前,下一轮定时任务反复重试同一页,后续所有 bad case 都同步不进来,同步浮层只显示稳定的BAD_CASE_QUERY_INVALID_RESPONSE。本 PR 沿用 m6-17 的「传输放宽、写入归一」分层补齐这两个字段的归一化:传输模型接受上游真实形状(可空 type、超长 title),写入映射
_row统一落库——null/缺失 type 落self、title 截前 200 字符(与归因侧短标题预算对齐),归一化发生时记一条含badCaseId与命中字段名的结构化 info 日志,用于区分上游漂移与本地逻辑错误。不改表结构、不加迁移、不回填存量行、不改页级事务与游标语义、不改读路径与前端。关联 issue:#600(不自动关闭;合入后按流程单独提交闭环 PR)。
设计依据
bad_case_type/bad_case_title归一化规则与字段处理表。.agents/notes/implemented/bug-fix/2026-11-25-bad-case-sync-type-title-normalization.md(为何归一化放写入映射、title 截断为何有损但可接受、列宽为何仍 255)。What changed
传输模型(apps/api/app/third_party_api/bad_case_query/models.py)
BadCaseItem.bad_case_type改为str | None(default=None,非空时保留 1–16 长度校验):显式 null 与字段缺失都放行到写入层。BadCaseItem.title去掉max_length=255,保留min_length=1。extra="forbid"、populate_by_name、时间戳时区校验、BadCasePage的排序/唯一/limit/total 回显校验全部未动。写入映射(apps/api/app/service/acquisition/bad_case_catalog_sync.py)
_row:bad_case_type=item.bad_case_type or "self";title=item.title[:200];其余字段映射与空值降级不变。logger.info("upstream bad case normalized", extra={"badCaseId": ..., "fields": "bad_case_type,title"}),命中才记,不新增状态列。测试(apps/api/tests/m6-16-bad-case-catalog-sync/)
bad_case_type is None);300 字符 title 传输层保真(len == 300);空 session_id、超长 session_id、超长 type、空 type 字符串、空 title 五种非法形状仍整页BAD_CASE_QUERY_INVALID_RESPONSE。self;200 字符原样、201/300 截前 200;显式self/discovery与短标题不被覆盖;caplog 断言归一化日志含badCaseId与命中字段名(三形状参数化);无归一化时无日志。文档
plans/fullstack-design/12-bad-case-catalog-sync.md§3.2 字段映射表新增bad_case_type行与bad_case_title截断规则,§3.3 新增「仅有的两处放宽」条款。pnpm record:i18n重录。流程修复(chore)
bugfix-explicit-skill-conclusion.md的id: bugfix-56与本 issue 撞号(改为bugfix-58),且其status与 GitHub 修复归因 Skill 将外部根因标记为当前对象缺陷 #588 CLOSED 不一致(改为done);本 issue scope 同步登记该文件与检视文档plans/2026-11-25-pr606-review.md。不修复则verify-flow(id 重复)与flow-online(本地 in-progress vs CLOSED)会挡住所有 PR。Verification
pnpm test:api -- tests/m6-16-bad-case-catalog-syncpnpm test:dbpnpm lint:apipnpm verify:flowpnpm lint:docspnpm typecheck:apipnpm contract:checkapi-static/db-sqlite/mysql/e2e/docs-flow/flow-online/web-static/unit-tests-web/build-lane/deploy-contractCI 说明:
unit-tests-api为 main 既有红(非本 PR 引入)本轮
unit-tests-api的 4 条失败与 main 最近一次 CI(run 45559951023)逐条相同:tests/attribution/test_case_tools.py::test_only_platform_writer_chooses_paths_and_case_identity(ValueError: platform writer rejected the report)tests/m5-05-launch-wizard/test_launch_api.py::test_startup_claims_existing_binding_with_shared_provider(AssertionError 1 vs 0)tests/m5-05-launch-wizard/test_launch_api.py::test_local_attribution_from_wizard_to_cluster[bubblewrap-bound-bubblewrap](TimeoutError)tests/m5-05-launch-wizard/test_launch_api.py::test_local_attribution_from_wizard_to_cluster[case-tools-other-case-tools](TimeoutError)本 PR 只触及 bad case 同步的两个源文件、两个测试文件与文档/流程文件,未触及 attribution/launch-wizard。已按集合逐条对比确认无新增失败;本地 Windows 同样复现这 3 条 m5-05 超时,说明是既有环境/时序问题。
集成冒烟(Issue #600 专项)
在真实 API + Web 栈上用变体 mock 上游复现线上漂移形状(
bad_case_type=null+ 300 字符 title 的同一页),走完整同步链路:badCaseCatalogSync.synced=3、status=idle、lastBadCaseId=3;不再整页BAD_CASE_QUERY_INVALID_RESPONSEself/ title 长度 200;case2 保持self/「Normal problem 2」;case3 保持discovery/「Discovery problem 3」INVALID_RESPONSEplans/ui-prototype-v2/harness-evolution.html,登录后打开.tn-sync浮层与原型对比结论
git diff --name-status origin/main...HEAD无apps/web/**),不构成原型偏离。smoke-pr606/screenshots/*.png、smoke-pr606/smoke-report.html),未提交进代码仓;本 PR 描述引用其结论。UI 一致性说明
本 PR 为纯后端同步归一化修复:无任何
apps/web/**、packages/contracts产物或plans/ui-prototype-v2/**文件被改动,issue 非目标第 5 条「不改前端展示与同步浮层统计」未越界。UI 与 UI 原型的一致性不受本 PR 影响。检视与复核
plans/2026-11-25-pr606-review.md(§0–§9、5 个讨论点 D1–D5)。bad_case_type=""传输拒绝回归(commit 16ea805,68 passed);D2/D3/D4/D5 结论已落笔检视文档 §6/§7(commit 83bfb28);PR 评论 #issuecomment-7155142108 记录逐条处理结论。