任务:缺陷转用例(能力 5)
起草型工作流任务包:模型从一个缺陷(现象、修复说明)起草回归用例,Hub 核对命令和参数存在、期望结果有原文依据、结构合格、不与已索引的用例重复。
- 包目录(只改这里):
packs/workflow/defect-to-case/** - 先读:
AGENTS.md、docs/hub-r4-architecture.md(第 2、5、6、6a、6b 节)、docs/hub-r4-handoff.md、contracts/src/pack.ts、contracts/src/views.ts、packs/workflow/case-review(要求项、核对表、检查函数、来源绑定的写法;这个包照它的格式做)、packs/system/plm/README.md(plm:bug:<id>的内容)。 - 依赖:知识包已能提供
knowledge:index视图和命令目录(已提交);产品包的用例索引(packs/product/famx的cases生产器)由另一个任务完成,这个包的测试用手搭的视图和假的知识读取器,真实读取器上的端到端测试等用例索引提交后再补。 - 复核重点(自己做完再对照一遍):Does every check refuse what it must on a hand-built draft (a command that is not in the build, a parameter out of range, an expected result that is not a verbatim quotation of the defect text or the manual, a draft with the wrong shape, a copy of an indexed case) and accept the good draft? Is a negative draft that cites an out-of-range parameter on purpose accepted when it says so, and refused when it does not? Is an expected result with no quotation never accepted? Does an incomplete index make “not a duplicate” an unknown instead of a pass? Does the pack publish through the real registry and run a full repair round (rejected, then fixed, then accepted)?
规格
PACKAGE defect-to-case - capability 5, a draft workflow pack: the model drafts, the Hub checks; the model’s judgments are never the proof of a check.
Read first: packs/workflow/case-review (requirements.json, checks.json, tables, functions/checks.ts and subjects.ts, SKILL.md), contracts/src/pack.ts, hub/runs/packs (publish check), the catalog@1, quote@1 and structure@1 interpreters (hub/rules), packs/system/plm, brief sections 6, 6a and 6b.
Semantics (write them first as tests): one required input slot defects (role subject, accepts the external type plm:bug, one or more, at most 20), bound by the caller to ids like plm:bug:
- cases (judgment, item, bookkeeping): the slot cases = a list of drafts, each {title, priority (a number), negative (boolean), expects_refutation (boolean, default false), preconditions [text], steps [{command, note}], expected [{text, quote: {reference, text}}], tags}. At least one draft per defect, at most max_cases (parameter, default 6). A defect the model cannot draft from (the fix description gives nothing checkable) is declared skipped with a reason, which is honest and not a failure.
- shape (fact, function check, blocking): the drafts match the team’s case structure: a non-empty title (at most 200 characters), at least one step with a command line, at least one expected result, a priority in the range the case-review pack accepts, tags from the team’s template categories, no draft twice in the same submission (normalised title and steps), negative drafts have negative true.
- commands (fact, interpreter catalog@1 with a subject function that takes the command lines of the steps): every command resolves in the locked build’s catalog and its parameters are in range (type, range, enumeration); core.catalog.* codes, blocking. A draft with expects_refutation true and negative true is the opposite case: it must be REFUTED by the catalog (the out-of-range parameter is the point of the case), and a negative draft that the catalog accepts is a violation (the case would not test what it says); a draft with expects_refutation false that the catalog refutes is a violation.
- grounded (fact, interpreter quote@1, blocking): every expected result carries a quotation that is verbatim (white space aside) in the source its reference names: the fix description of the defect (src: or rec: reference into the plm:bug record) or a manual passage of the locked root (tree: or src: reference); a reference that does not resolve is a violation (REFERENCE_UNRESOLVED), an expected result without a quotation is a violation, a quotation that does not match is QUOTE_MISMATCH. The text of the expected result may be a shortened reading of the quotation but must not contain a number, a command or an on/off state that the quotation does not contain (a function check, advisory first, blocking when the tests of the owner agree).
- not_duplicate (fact, function check): the slot indexed_cases = knowledge:index:
: ?kind=case&key=commands (served by the Hub's reader, required); a draft duplicates an indexed case when both exercise the same set of normalised command names, have the same negative flag and the normalised titles are equal or the normalised expected texts are equal; a duplicate is an advisory violation naming the existing case (document, node, title) and its tree reference; no duplicate found is a pass when the view states no skipped source and an unknown outcome (reason: the index lacks that many listed documents) when it does. Deterministic: the order of drafts and of index entries never changes the outcomes. Parameters: max_cases, priority (default 2). Deliver under packs/workflow/defect-to-case the same file set as case-review (workflow.json, requirements.json, checks.json, slots.schema.json, tables, functions, SKILL.md, samples positive and negative for every check, examples, README). SKILL.md tells the model the procedure: read the defect with get_nodes (the plm:bug reference), find the commands in the catalog and the passages in the manual with get_nodes and resolve_reference (to get the exact references for quotations), draft only what the text supports, cite every expected result, never invent a parameter, submit all defects at once, repair per receipt, declare skips with a reason. Tests: hand-built defects and drafts (a good draft, an unknown command, a parameter out of range, a non-verbatim quotation, an expected result with no quotation, a quotation of the wrong source, a wrong shape, a negative draft with and without expects_refutation, a duplicate of an indexed case, an incomplete index, an empty submission for a defect, a skipped defect), order independence, the publish check through the real registry, and an end-to-end run with a scripted model through the real engine and a fake knowledge reader: first submission rejected with fixes, second accepted, the partition and the unknown outcomes as expected. Acceptance against the 6b criterion (the drafts of defects that already have a regression document compared with that document) is a script under scripts/real by the integrator, not part of this task.