Skip to content

Commit 828204e

Browse files
pm-dispatch: contract-review states the session-evidence limit; the record templates carry the SQL push-down check (#34029)
<!-- claude-projects-attribution: {"github_login":"os-steve"} --> _Requested by **Steve** · [project thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi9FE2ETZnEBiEUWZaRytnhdF)_ Fixes #33716 Clause-②: no Metadata-protocol: none ## 维护者速读 - **改了什么**:契约复核细则写明「本会话转录作达档证据」的限制:卡线程或席内复核的会话只要起过别的 agent、给别的线程发过消息或调过技能,`verify-review-tier.mjs` 就拒收,改在子代理里重跑;复核简报和记录模板的 ③ 加上 SQL 下推检查(SQL 能下推处新增 id 物化或应用内 join 而无理由即记发现),模板还写明无复核面的 PR 由席位自读、发现记在席位的 ACCEPT 评论里。 - **为什么改**:规则文字落后于工具:校验器早已这样拒收,而 SQL 下推检查只写进了规则,只拿简报干活的复核子代理看不到。 - **风险与回滚**:只改内部规则文字和模板打印文字,不碰产品代码;`contract-review.md` 仍是 63/63 行,上限没抬;回滚即 revert 本 PR。 - **先看**:`contract-review.md` 第 36–38 行;`scripts/pm/record-recognisers.mjs` 的 `PUSH_DOWN_CHECK` 常量与 `--template` 的 ③ 图例。 - **两分钟验证**:`node scripts/pm/record-recognisers.mjs --brief-template | grep -A2 '③ Boundary'`,预期 ③ 下面多出两行 SQL push-down 检查;`--self-test` 403 例全绿。 - **需要你做的**:无,席位落地(Tier S,等达档复核 PASS)。 ## What changes 1. **`.claude/skills/pm-dispatch/references/contract-review.md`**, the `Served-tier:` evidence bullet (lines 35–38). The session route now carries the limit `verify-review-tier.mjs` enforces: a card thread or an in-seat review passes its own session transcript only when that session started no other agent, sent no message and called no Skill; otherwise the review re-runs in a sub-agent and passes that sub-agent's output file. The refusal sentence now says where to re-run (拒即子代理重跑). Paid in place: 63 → 63 lines, no ceiling moved. 2. **`scripts/pm/record-recognisers.mjs`**, template and brief regions only: - `PUSH_DOWN_CHECK`: the ③ SQL push-down check in one wording, the English PR #33693 gave its ③ line (a new id materialisation or in-app join where SQL could push down is a finding unless a reason is given), pointing at AGENTS.md Prime Directive 5. - `--brief-template`: the ③ line gains the check, on every face, the declaration face included (the rule says 恒查, so it is face-neutral). - `--template` legend: a new ③ entry (dev flags and `open_questions` answered or escalated, plus the push-down check), and the carrier on a PR no face touches: no record is owed there, so the seat's self-read runs the same check and the finding goes in `FACELESS_FINDING_CARRIER`, the seat's ACCEPT comment on the PR. - Self-test: three new pins, battery floors raised template 30 → 32 and brief 23 → 24. ## Tests - `node scripts/pm/record-recognisers.mjs --self-test`: exit 0, 403 cases across the declared batteries. - New pins: the ③ legend carries `PUSH_DOWN_CHECK` between the ③ and ④ entries on every face (bare, schema, rules, narrowing, declaration); the legend names the faceless-PR carrier; every face's brief carries the check inside the copyable region. - Mutation legs on fd9a7fa through `scripts/ablation-replace.mjs`, each restored to the HEAD blob with `git diff HEAD` empty: - brief lines deleted: exit 1, the brief pin red; - legend lines deleted: exit 1, the legend pin red; - carrier sentence rewritten: exit 1, the carrier pin red. - No forced test edits. ## Acceptance notes - **What the verifier refuses, measured on bc6b7ff** (`handsWorkToAnotherAgent`): true for `Agent`, `Task`, `Workflow`, `SendMessage`, `Skill`, and connector tools such as `message_thread`, `message_coordinator`, `send_message`, `start_remote_control`, `create_trigger`; false for `post_message`, `update_progress_checklist`, `Read`, `Bash`. So a card thread that has told its seat its branch, or loaded a skill, already fails the session route; in practice its evidence is a review sub-agent's output file. The bullet says this in place of the old unconditional "card thread or in-seat review gives this session". - **Line payment.** Lines 36–38 are re-flowed inside the same three lines (no line bought): `贴:` moves up one line, "(调用显式传该档 model)" becomes "(显式传该档 model)" and "给其输出文件" becomes "给输出文件" (same meaning). Byte lengths 118/118/119/118, all within 120. - **Faceless-PR carrier lives in the `--template` legend only.** The ③ line in `contract-review.md` sits at exactly 120 bytes, so naming the carrier there costs a line paid by a cut elsewhere; and the brief is written only for a reviewer, which a faceless PR never has. Raised in the report as an open question. - **Concurrency.** The diff stays in the template, brief and self-test regions of `record-recognisers.mjs` (two constants defined just above `contractReviewTemplateLines`, two battery-roster rows, two batteries); the mailbox `readMailboxComment` region is untouched. - No issue numbers in the operative skill text (`check:pm-skill-id-lint` green). ## Verification - Governed tier: `check-governed-merges --branch HEAD` → Tier S (`.claude/**` ×1; `scripts/pm/record-recognisers.mjs` not on the register); 51 changed lines, under 3000. Stays draft until a `CONTRACT_REVIEW_TIER` PASS record names the head. - `dispatch-gates --tier`: no path-derived mandate. <details><summary>Derived gates on fd9a7fa: 38 derived, 38 run, all exit 0</summary> `node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack`, each exit captured before any pipe; `--ran` reconciliation: "38 derived famil(ies) accounted for — 38 run, 0 NOT-MEASURED (a DERIVED zero)". Before the gates: `turbo run build --filter=@objectstack/formula... --filter=@objectstack/lint...` under the verify lock, VERDICT command-exit 0, for `check:doc-formula-expressions`. ```text node scripts/check-closing-keyword-parity.mjs :: exit 0 node scripts/check-closing-keyword-parity.mjs --self-test :: exit 0 node scripts/check-comment-mask-corpus.mjs :: exit 0 node scripts/check-declaration-mirrors.mjs :: exit 0 node scripts/check-declaration-mirrors.mjs --self-test :: exit 0 node scripts/check-self-test-wired.mjs :: exit 0 node scripts/check-self-test-wired.mjs --self-test :: exit 0 node scripts/check-self-test-workflow-commands.mjs :: exit 0 node scripts/check-self-test-workflow-commands.mjs --self-test :: exit 0 node scripts/check-whole-set-label-write.mjs :: exit 0 node scripts/check-whole-set-label-write.mjs --self-test :: exit 0 node scripts/ci/plan-test-core-shards.mjs --self-test :: exit 0 node scripts/pm/bare-root-worklist.mjs --self-test :: exit 0 node scripts/pm/check-harness-current.mjs --self-test :: exit 0 pnpm --filter @objectstack/lint run check:doc-formula-expressions :: exit 0 pnpm check:agent-test-spelling :: exit 0 pnpm check:bash32-floor :: exit 0 pnpm check:ci-filter-parity :: exit 0 pnpm check:cli-command-ids :: exit 0 pnpm check:cross-package-test-inputs :: exit 0 pnpm check:doc-authoring :: exit 0 pnpm check:driver-memory-census :: exit 0 pnpm check:entry-guard :: exit 0 pnpm check:gitlink-declared :: exit 0 pnpm check:nul-bytes :: exit 0 pnpm check:parse-guard :: exit 0 pnpm check:pm-dispatch-gates :: exit 0 pnpm check:pm-governed-merges :: exit 0 pnpm check:pm-record-recognisers :: exit 0 pnpm check:pm-skill-id-lint :: exit 0 pnpm check:pm-skill-ratchet :: exit 0 pnpm check:pnpm-filter-targets :: exit 0 pnpm check:pnpm-flag-spellings :: exit 0 pnpm check:ratchet-remedy-authority :: exit 0 pnpm check:refd-timer-probe :: exit 0 pnpm check:scripts-symbol-anchors :: exit 0 pnpm check:skill-frame-sync :: exit 0 pnpm check:watch-hint-literal :: exit 0 ``` </details> - Every family CI runs beyond the derived list: read off this PR's check-runs. --- _Generated by [Claude Code](https://claude.ai/code/session_01ADHkmSZHK7Um3TifRRbuLE)_ Co-authored-by: Claude <noreply@anthropic.com>
1 parent ee90935 commit 828204e

2 files changed

Lines changed: 46 additions & 5 deletions

File tree

‎.claude/skills/pm-dispatch/references/contract-review.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@
3333
- 复核记录 = 一条评论落 PR 或卡,席内与各子代理同形;散文、dev 自评、`os-dev-report` 不算。
3434
- 同形 = `## Contract review` 题头之下 `Head-sha:` 行独占码段、①②③逐项、独立性对、PASS/FAIL。
3535
- 同形含首行 `Served-tier:`:值为该面所定档常量名 `CONTRACT_REVIEW_TIER` 或 `TIER_DEFAULT`;无此行不
36-
成裁决;模板 `node scripts/pm/record-recognisers.mjs --template`;前者只经写工具带 `--tier-evidence=`
37-
贴:子代理(调用显式传该档 model)给其输出文件,卡线程或席内复核给本会话
38-
`~/.claude/projects/*/<id>.jsonl`;`verify-review-tier.mjs` 拒即重跑 ⛔ 不改档名。
36+
成裁决;模板 `node scripts/pm/record-recognisers.mjs --template`;前者只经写工具带 `--tier-evidence=`贴:
37+
子代理(显式传该档 model)给输出文件;卡线程或席内复核未起他 agent、未发消息、未调 Skill
38+
才给本会话 `~/.claude/projects/*/<id>.jsonl`;`verify-review-tier.mjs` 拒即子代理重跑 ⛔ 不改档名。
3939
- ④ 设计判断欠 schema、governed 规则文本、收窄三面:逐 `hits` 文件判改动对所引代码与
4040
验收场景是否成立,ADR 另判首个消费者与执行计划;①–④ 合称完整复核,余面同形无 ④。
4141
- 实质 head 各欠一轮完整复核,发现逐条定 must-fix/should-fix/nit(无碍正确与契约);有前两级才由

‎scripts/pm/record-recognisers.mjs‎

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1976,6 +1976,33 @@ export function deliveredCardNumber(pr) {
19761976
return { card: strongest[0].card, evidence: strongest[0].evidence };
19771977
}
19781978

1979+
/**
1980+
* ③'s SQL push-down check, the one wording both printed shapes carry (the brief's ③ line and the
1981+
* `--template` legend's ③ entry), read from `references/contract-review.md`'s ③ line and AGENTS.md
1982+
* Prime Directive 5 (SQL first, ruling record 6888468549). It is face-neutral: an engine or driver PR
1983+
* that touches no schema or governed path meets it too, so every face's brief and record carry it.
1984+
*/
1985+
export const PUSH_DOWN_CHECK =
1986+
'a new id materialisation or in-app join where SQL could push down is a finding unless a reason is given'
1987+
+ ' (AGENTS.md, Prime Directive 5: SQL first).';
1988+
1989+
/**
1990+
* Where the finding goes on a PR no contract-review face touches: no record is owed there
1991+
* (`references/contract-review.md`: CI plus the seat's self-read, no second agent), so the seat's own
1992+
* ACCEPT comment on the PR is the only carrier the check has.
1993+
*/
1994+
export const FACELESS_FINDING_CARRIER = "the seat's ACCEPT comment on the PR";
1995+
1996+
const TEMPLATE_PUSH_DOWN_LINES = Object.freeze([
1997+
' a new id materialisation or in-app join where SQL could push down is a',
1998+
' finding unless a reason is given (AGENTS.md, Prime Directive 5: SQL first).',
1999+
]);
2000+
2001+
const BRIEF_PUSH_DOWN_LINES = Object.freeze([
2002+
' On every face, SQL push-down: a new id materialisation or in-app join where SQL could push down is a',
2003+
' finding unless a reason is given (AGENTS.md, Prime Directive 5: SQL first).',
2004+
]);
2005+
19792006
/**
19802007
* What `--template` prints: the record, fenced, with the calibration around it.
19812008
*
@@ -2034,6 +2061,11 @@ export function contractReviewTemplateLines(values = {}) {
20342061
' named there; Tier H approval and the queue guard stay whole-PR. On the narrowing',
20352062
' face the floor is every path of the diff outside the prose faces: no path is a remainder,',
20362063
' and `+` names every file those hunks make a claim about, read in the cited code.',
2064+
' · ③ Boundary flags every dev flag and every `open_questions` entry answered, or escalated; and on',
2065+
' every face the SQL push-down check:',
2066+
...TEMPLATE_PUSH_DOWN_LINES,
2067+
' A PR no face touches has no record: the seat\'s self-read runs the same check,',
2068+
` and the finding goes in ${FACELESS_FINDING_CARRIER}.`,
20372069
' · ④ Design judgment on the schema, rules and narrowing faces — the published spec, and the governed register,',
20382070
' which holds the skills and ADR surfaces the full-review order names among its rows, and a',
20392071
' declared narrowing; the declaration face alone carries no ④. For each `hits` file: does the',
@@ -2257,6 +2289,7 @@ export function contractReviewBriefLines(values = {}) {
22572289
' ① Derived judgments — every accept-set and public-surface change the diff implies, each named right or wrong.',
22582290
' ② Semver level — the changeset (or `skip-changeset`) matches what the diff publishes, and the `Clause-②:` line.',
22592291
' ③ Boundary flags — every dev flag and every `open_questions` entry answered, or escalated.',
2292+
...BRIEF_PUSH_DOWN_LINES,
22602293
...(designJudgment && face?.id === 'narrowing' ? [
22612294
' ④ Design judgment — the narrowing itself, read against the published spec on `main`: does it take a',
22622295
" declared capability away at the consumer, or make the spec's own refusal real? A capability declared",
@@ -2425,12 +2458,14 @@ const SELF_TEST_BATTERIES = Object.freeze({
24252458
'#18141 · #27979: the head sha sits in a span of ITS OWN on the `Head-sha:` line — the key-in-span spelling and a span in the prose name no head': 14,
24262459
'the `Served-tier:` reading — the tier that SERVED the record (#17915 · #18060 · #18174)': 27,
24272460
'⭐ the 2026-09-20 ruling: a pure-regeneration head move KEEPS the record, decided on the COMMITTED trees': 22,
2428-
'#18042: the copyable record TEMPLATE — the one machine-read artefact with nothing to copy': 30,
2461+
// Raised 30 → 32 with ③'s SQL push-down check in the legend on every face, and its faceless-PR carrier: two pins.
2462+
'#18042: the copyable record TEMPLATE — the one machine-read artefact with nothing to copy': 32,
24292463
// Raised 17 → 19 by #33541: the template record's one `VERDICT:` line read PASS by the guard, and the same record
24302464
// posted by an untrusted author not read — two pins, two cases.
24312465
'#18701: ONE thread set -- what the template STATES is what the queue guard READS': 19,
24322466
'the `Local-runs:` reading — `none` or ONE named probe, judged when present; an absent line is not re-judged': 12,
2433-
'the reviewer BRIEF template — the read-only shape a hand-written brief dropped, built in and printed': 23,
2467+
// Raised 23 → 24 with ③'s SQL push-down check on every face's brief: one pin.
2468+
'the reviewer BRIEF template — the read-only shape a hand-written brief dropped, built in and printed': 24,
24342469
'⭐ B′ with C: the review tier FOLLOWS THE FACE that made it owed — exact, never a floor': 23,
24352470
'⭐ B′ with C: a PROSE-ONLY head move keeps the record, decided on the COMMITTED trees like a regeneration': 6,
24362471
'⭐ letter C: the at-tier review of a mixed diff is SCOPED — `hits` plus what they claim, on the `Scope:` line': 22,
@@ -3259,6 +3294,11 @@ export async function selfTest() {
32593294
// quietly print something else. ⛔ Not derived from the constant: a pin
32603295
// written from the thing it pins asserts nothing.
32613296
t('⭐ the printed placeholder is EXACTLY the branch form, assembled or not', says(TPL_RECORD, 'Implemented-by: `claude/issue-NNNN-slug`') && RECORD_TEMPLATE_PLACEHOLDERS.implementedBy === 'claude/issue-NNNN-slug');
3297+
// -- ③'s SQL push-down check: face-neutral, so every face's legend carries it in the ONE wording --
3298+
const unwrapped = (text) => text.replace(/\s+/g, ' ');
3299+
const EVERY_FACE = [{}, ...REVIEW_FACES.map((f) => ({ face: f.id }))];
3300+
t('⭐ the ③ legend carries the SQL push-down check on EVERY face, declaration included, in the one wording', EVERY_FACE.length === REVIEW_FACES.length + 1 && EVERY_FACE.every((v) => { const text = unwrapped(contractReviewTemplateLines(v).join('\n')); return says(text, '· ③ Boundary flags') && says(text, PUSH_DOWN_CHECK) && text.indexOf('· ③ Boundary flags') < text.indexOf(PUSH_DOWN_CHECK) && text.indexOf(PUSH_DOWN_CHECK) < text.indexOf('· ④ Design judgment'); }));
3301+
t('…and names where the finding goes on a PR no face touches: the seat\'s self-read, in its ACCEPT comment on the PR', says(unwrapped(TPL_TEXT), "A PR no face touches has no record: the seat's self-read runs the same check, and the finding goes in the seat's ACCEPT comment on the PR.") && FACELESS_FINDING_CARRIER === "the seat's ACCEPT comment on the PR");
32623302
// The CLI: `--template` prints exactly these lines, from a bare terminal.
32633303
const cli = (args) => spawnSync(process.execPath, [fileURLToPath(import.meta.url), ...args], { encoding: 'utf8', timeout: 60_000 });
32643304
const printed = cli(['--template']);
@@ -3302,6 +3342,7 @@ export async function selfTest() {
33023342
t('⭐ the brief tells a card thread to post the filled brief beside the record, for the seat to read before adopting', says(BRIEF_TEXT, 'posts the filled brief beside the record') && !says(BRIEF_BODY, 'posts the filled brief'));
33033343
t('…and the `hits` faces keep the per-file ④ shape, never the narrowing\'s', ['schema', 'rules'].every((id) => { const b = contractReviewBriefLines({ face: id }).join('\n'); return says(b, 'for EVERY `hits` file') && !says(b, 'the narrowing itself'); }) && !says(BRIEF_BODY, 'the narrowing itself'));
33043344
t('⛔ nor the declaration brief, below tier', !contractReviewBriefLines({ face: 'declaration' }).join('\n').includes('④'));
3345+
t('⭐ ③ carries the SQL push-down check in EVERY face\'s brief, declaration included, inside the copyable region and in the one wording', [{}, ...REVIEW_FACES.map((f) => ({ face: f.id }))].every((v) => { const b = contractReviewBriefLines(v).join('\n'); const body = b.slice(b.indexOf(BRIEF_TEMPLATE_FENCE_START), b.indexOf(BRIEF_TEMPLATE_FENCE_END)).replace(/\s+/g, ' '); return body.includes(`③ Boundary flags — every dev flag and every \`open_questions\` entry answered, or escalated. On every face, SQL push-down: ${PUSH_DOWN_CHECK}`); }));
33053346
t('⛔ the ④ text keeps the brief free of angle brackets, model identifiers and digit-shaped card numbers', !BRIEF_TEXT.includes('<') && !BRIEF_TEXT.includes('>') && !isModelIdentifierToken(BRIEF_TEXT) && !/#\d/.test(BRIEF_BODY));
33063347

33073348
// -- #18701: ONE thread set -- what the template STATES, the guard READS -----

0 commit comments

Comments
 (0)