audit: unify audit-of-audit sampling rule (gap 2)

Single sampling rule; track 3 (#244) is authoritative for WHO is
mandatory, track 5 (#238) for HOW the rest are drawn:

- Mandatory (1.0): golden-task records + rebuild / refreeze /
  escalation records + third-failure near-complete still-failed
  cases (mandatory_triggers, full list per case). Track 3's old
  deterministic every-10th ordinary rule is removed (it drew zero
  from batches under 10 ordinary records and was predictable);
  track 5's old narrow mandatory list is expanded with golden /
  refreeze / escalate. blocked_quota stays non-mandatory.
- Random tiers: normal 0.10, critical-path 0.50, seed required
  and recorded, ceil so a non-empty group is never rounded to
  zero. 0.10/0.50 are TEST DEFAULTS, not approved production
  values; production rates remain a user decision.
- One pass, no double counting: mandatory records leave the
  random pools before drawing; a multi-trigger record (e.g.
  golden + rebuild) is sampled once with all triggers listed,
  and its correction follows the (original, corrected) verdict
  pair, never the trigger list.
- cloud/audit_pushback.py::select_audit_sample is now only a
  record-shaped adapter over cloud/audit_sampling.py::select_sample
  (seed required, retired reason names critical_path-for-kinds
  and periodic_sample removed); AUDIT_SAMPLE_EVERY_NTH deleted.
- Correction: original never mutated, correction appended,
  corrector != signer enforced in audit_sampling when both names
  are supplied; gate effect pinned (correction to pass never
  unblocks by itself -- schedule/cancel-and-rerun, blocked until
  a new passing re-audit; correction to fail re-blocks at once).
  Track 3 / track 5 retrigger vocabularies documented as synonyms.
- Skill text (tightening 3 item 2 + correction paragraph)
  rewritten to the unified rule; new test file pins the
  boundaries (mandatory union, dedup, ceil incl. the 9-record
  case, seed reproducibility, golden-set construction under both
  sample vocabularies, adapter order/non-mutation, correction
  preservation on both tracks).
This commit is contained in:
host committed 2026-11-04 20:56:06 +00:00
1 parent f83bd79525
commit 6dcd965542
5 files changed
+546 -60

No files matched your search

+34 -6
View File
@@ -923,11 +923,29 @@ tests/ # QA 线程专属,含跨端一致性用例
- 审计兜底三件套,缺一不可,全部可测试或可核查:
① 独立重跑的确切产物测试,不是只看报告:复用三方哈希模式
(核心报告、产物清单、重算 hash 三方一致),产物不一致即停。
② 金任务集与关键路径的人工审定样本,定期抽查审计结论本身:
金任务集必须人工审定(每项有 `human_approved_by`),示例文件
不算金任务;抽查比例写死:金任务与推倒/重新冻结/升级记录
100% 抽查,普通记录每 10 条确定性抽 1 条(按序号、可复现,
不是随机抽);抽查结果处理:抽查发现判错即走纠错路径。
② 审计结论本身的抽查,唯一口径(第 2 项补缺口对齐后,
代码 `cloud/audit_sampling.py`、本段、测试三处一致,
不再有两套口径):必抽范围以第 3 轨为准、抽取机制以
第 5 轨为准。第 3 轨原文“普通记录每 10 条确定性抽 1 条
(不是随机抽)”已废止——不足 10 条的普通批次按它抽到
0 条,且序号抽取可被预测;第 5 轨原文必抽窄清单已
扩充——金任务、重新冻结、升级记录补进必抽。
必抽(比例 1.0,规则不是可调比例):金任务记录(任务在
人工审定金任务集内,不论该记录本身是何种结论)、推倒、
重新冻结、升级记录,以及第三次失败根因判为接近完成、
续轮仍 fail 的案例。金任务集必须人工审定(每项有
`human_approved_by`),且样本/示例一律排除(`is_example`
或 `sample=True` 或 id 以 `sample-` 开头,任一即排除)。
随机抽查(其余记录,须带 seed,seed 记入抽查计划,
同 seed 同批同结果、可事后复现):普通记录默认 0.10、
关键路径记录(`critical_path=True` 的非必抽记录)默认
0.50;每组 ceil 取整,非空组至少抽 1 条,绝不因四舍五入
抽到 0。0.10 / 0.50 只是测试默认值,不是已拍板的生产值,
生产抽查比例仍待用户拍板。单次抽取、不双重计入:必抽
记录先划出,不进随机池、不占随机名额;一记录多触发
(如既是金任务又是推倒)只抽一次、理由全列、纠错只记
一条;纠错动作按(原结论,纠正结论)对查表,与触发理由
无关。抽查发现判错即走纠错路径(见下)。
③ G6 用户验收这个最后人工关口不能被自动化绕过去:审计升级、
推回、推倒、抽查纠错都不能替用户勾验收,验收清单最后只能用户勾。
- 审计判错的纠错路径:事后抽查发现审计结论判错(该拦没拦、或
@@ -936,7 +954,17 @@ tests/ # QA 线程专属,含跨端一致性用例
原记录不动,追加一条纠错记录(引用原记录 hash、写清原结论、
纠正后结论、纠错人与原因);该拦没拦的纠正 → 重新触发推回并
恢复阻塞;不该拦拦了的纠正 → 安排重新审计(不是直接放行合并,
因为纠错本身只是复核、不是完整审计);纠错人必须与原签字人不同。
因为纠错本身只是复核、不是完整审计),门禁在新通过重审结论
出现前继续阻塞;纠错人必须与原签字人不同。动作名对照(同
一对动作、两轨词汇):错放行 → 第 3 轨
`retrigger_pushback_and_reblock` = 第 5 轨
`reopen_audit_and_pushback`;错拦截 → 第 3 轨
`schedule_reaudit` = 第 5 轨 `cancel_pushback_and_rerun_audit`
(其中 cancel 指取消并重审,绝不是取消即放行);错推倒 →
停推倒并从 git 历史恢复旧实现;原结论未知 → 升级人工。
已废止的理由名:`critical_path`(曾指必抽种类,现只指
0.50 随机档)、`periodic_sample`(曾指每 10 条抽取,已随
确定性抽取一并废止)。
## 诚实边界:原生客户端(v0.5 后置占位版)