任务:追溯矩阵(能力 6a)

只读事实型任务包,开始运行时由 Hub 直接算出并存下结果(不需要模型提交)。

  • 包目录(只改这里):packs/workflow/traceability/**
  • 先读:AGENTS.md、docs/hub-r4-architecture.md(第 2、5、6a、6b 节)、docs/hub-r4-handoff.md、contracts/src/pack.ts、contracts/src/views.ts、一个已有的只读事实型包(packs/workflow/template-gap 或 packs/workflow/case-location)。
  • 依赖:知识包已能提供 knowledge:impact|facets|index 视图(已提交),产品包的用例索引(packs/product/famx 的 cases 生产器)由另一个任务完成;这个包的测试用手搭的视图和一个假的知识读取器,真实读取器上的端到端测试等用例索引提交后再补。
  • 复核重点(自己做完再对照一遍):Is the matrix exact against an independent join on a hand-built pair of views: a defect fixed in the build is covered when at least one case carries its id, and an uncovered defect is an unknown (the index cannot prove absence), never a failure? Are ids compared as exact strings after the pack normalisation, with the normalisation tested? Does the result list the cases per defect, sorted, and does the pack publish and run as a production run?

规格

PACKAGE traceability - capability 6a (defect to case traceability matrix), a production-run workflow pack: fact producers only. Read first: contracts/src/pack.ts and views.ts (index-view@1), packs/workflow/template-gap and case-location, packs/product/famx/functions/release-notes.ts and ids.ts (the defect entries of release notes and the id extraction), brief sections 6a and 6b. Semantics (write them first as tests): two input slots, both external ids served by the Hub’s knowledge reader and both required: defects = knowledge:index::?kind=defect&key=bug (the defects the release notes of the build list, one entry each, data.bug the id, data.status fixed or known) and cases = knowledge:index::?kind=case&key=defects (the case entries by the defect ids their documents' titles and folders carry). Items are the DEFECTS of the build (id = the bug id, label = the defect summary from the entry statement, summary at most 200 characters: status, number of cases). Requirement traced (fact, item, static, bookkeeping): support when at least one case entry carries the id (data lists the case ids, titles and documents, sorted; grounds are the tree references of the defect entry and of the case entries); otherwise an UNKNOWN outcome with the reason that no indexed case names the defect (the index is incomplete by construction: absence is not proof; when the case view states skipped sources the reason says that many listed documents were not read). Status: known (not fixed) defects are items too, marked in their fields. Run-level claims: the counts (defects, traced, untraced) as facts. Parameters: statuses (default fixed and known). Ids compare as exact strings after normalisation of the digits (write the normalisation and test it: leading zeros, a bug and a story with the same number are different keys because the case entry's defects field only holds bug ids). Deterministic and order independent; a matrix of 5,000 defects and 60,000 cases computes in a few seconds. Deliver under packs/workflow/traceability the same file set as regression-scope, with SKILL.md telling the model to relay the matrix unchanged and how to page. Tests: hand-built index views (a defect with one case, with many, with none; a case carrying two defects; a known defect; an id with leading zeros; a story id that equals a bug id), metamorphic order independence, an independent join written separately in the test (a plain double loop) compared with the pack on a random corpus of 2,000 defects, the publish check, a production run end to end with a fake knowledge reader.