Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions .claude/agents/os-dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,9 @@ model: opus
- 范围按本地验证范围节圈定;`packages/cli` 的卡本地只欠 `unit` 层,`integration` 层声明给 CI。
- `packages/cli` 卡与 driver/kernel 启动路径的分层跑法住 pm-dispatch `references/dev-traps.md`,碰到才读。
- Draft PR 指向 `main`,正文首行 `Fixes #<n>`;合并不应关卡时用 `Part of #<n>`,并说明留下哪一半。
- 全量 dogfood 只在终 head 跑一次,仅当标题带 `!` 或 `Clause-②:` 带 `(narrowing)` 臂(yes/no 皆算)。
- 命令同 CI:按 ① 建闭包,锁下 `pnpm --filter @objectstack/dogfood test`;⛔ 无 `OS_TEST_SHARD`、无路径。
- 红 = 本改动的后果(陈旧 fixture)同 PR 修,余照报;⛔ 永不跳过或收窄;计数记 `dogfood_battery`。
- 全量 dogfood ⛔ 不在本地跑:标题带 `!` 或 `Clause-②:` 带 `(narrowing)` 臂(yes/no 皆算)⇒ 席位给 PR 挂 `needs:dogfood-battery`,CI 在其 head 跑三段。
- 落地门只读该 head 上 `Dogfood battery (opt-in)` 的 success,⛔ 不读报告;每次 push 换 head 即欠新一轮,dev 不自挂该标签。
- 红 = 本改动的后果(陈旧 fixture)同 PR 修,余照报;⛔ 该类 PR 不改 `.github/workflows/dogfood-optin.yml`:不能自证。
- 认领的 `Clause-②:`、`Metadata-protocol:` 两行照抄进 PR 正文行首;无则零写,⛔ 不自造。
- 两行同抄进 changeset 正文行首;`Check Changeset` 读 PR 正文:kind 即 `minor`,`none` 即 `patch`。
- 种类非 `none` 或带 `(narrowing)` ⇒ 按 diff 加写 `Skills-docs:` 行;拼法与分工住认领模板。
Expand Down Expand Up @@ -318,7 +318,6 @@ model: opus
"summary": "what was implemented, 2-4 sentences",
"tests": "commands run + pass/fail evidence (real output excerpts); ablation only where a tested behaviour changed: rebuild + on-disk mutation proof",
"gates": "local subset: each command + exit code captured before any pipe + --ran reconciliation; every family CI runs: the PR's check-runs (name + conclusion) cited, not re-run locally",
"dogfood_battery": "n/a — no `!` in the PR title and no (narrowing) arm | <head sha> · the lock's VERDICT line · Test Files N/N · Tests M/M · every failure named",
"mcp_calls": "<n> — MCP GitHub calls with tool names; a write tool in the list = this report is refused",
"api_writes": "<n> — REST proxy writes, each endpoint listed",
"classifier_refusals": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
- 门禁读数钉当前 head:run `head_sha` 或 dev 所抄短 sha 不符 `head.sha`、或没抄 ⇒ 双向不入账。
- ⛔ 非当前 head 上的 `cancelled` 零动作、永不重跑:新推送自带全套 run。
- 席位核对门禁证据 = check-runs(名+结论);本地并集只证本地子集,⛔ 不替缺席者。
- `!` 或 `(narrowing)`:入队前核 `dogfood_battery` 钉 head、全量、红已修/已报;缺或收窄 ⇒ REWORK。
- `!` 或 `(narrowing)`:入队前核 head 上 `Dogfood battery (opt-in)` success;缺则挂 `needs:dogfood-battery`。
- 把发送或写挪到应答之后的 PR:dogfood 门禁不跑于 PR、跑于队列,全绿 PR 照样被队列弹出。
- ⇒ 入队前 grep `packages/qa/dogfood/test` 里应答后紧读该副作用的用例,同一 PR 改为有界等待。

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
- 车道 PM 的权责三件:验收(L1 清单)、首次入队、确认 MERGED;落地执行在案判决,非自批。
- 首次入队:ACCEPT 后挂 6–9 分钟 flip 定点,到点核门禁 job 结论。
- 绿即落地评论与 `pr_ready`+`automerge_enable` 一笔中继:`label-write --land`;未绿按阶梯重挂定点。
`--land` 拒 `!`/`(narrowing)` PR,除非卡上最新受信 os-dev-report 的 dogfood 钉 head(`os-dev.md`)。
`--land` 拒 `!`/`(narrowing)` PR,除非 head 上 dogfood 泳道(`needs:dogfood-battery`)为 success。
- 写节流拒(exit 10) ⇒ 待 `node scripts/pm/write-pace.mjs --status` 现空槽再重试。
- CI success webhook 不可靠:⛔ 不坐等,也 ⛔ 不忙轮询;定点文本照定时器写法纪律。
- undraft 429 ⇒ 卡记 `resets at`,到点一次重试裸 op(`rest-channel.md`),⛔ 不重发评论、不报阻塞。
Expand Down
13 changes: 13 additions & 0 deletions scripts/pm/ensure-pm-labels.sh
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,19 @@ gh label create needs:pack-smoke -R objectstack-ai/objectstack -c 006b75 -d "Opt
# belongs to: an opt-in pre-merge check.
gh label create needs:upgrade-harness -R objectstack-ai/objectstack -c 006b75 -d "Opt-in pre-merge 18.x upgrade harness: an 18.0 database boots on this PR's merge preview (#24522)" 2>/dev/null || true

# needs:dogfood-battery — the opt-in pre-merge dogfood battery (#38688, maintainer
# ruling 7269391948, letter D, 「云端流水线代跑」). Its first consumer is the job
# guard in `.github/workflows/dogfood-optin.yml`, which runs the three queue
# shards on the PR's merge preview only while this label is on the PR. Unlike
# its two siblings above it has a second consumer in scripts/pm/: the landing
# door (`label-write.mjs --land`, through `land-dogfood-lane.mjs`) refuses a
# breaking or narrowing PR until that lane's `Dogfood battery (opt-in)` check
# run concludes `success` on the PR's head, and its refusal tells the seat to
# add this label. The owning seat hangs it by hand on the head it means to
# land; nothing auto-applies it, and every later push to a labelled PR is
# another full run. Same colour as its family: an opt-in pre-merge check.
gh label create needs:dogfood-battery -R objectstack-ai/objectstack -c 006b75 -d "Opt-in pre-merge dogfood battery: the three queue shards on a breaking PR head (ruling D, #38688)" 2>/dev/null || true

# needs:contract-review — a MARKER, never a gate; rules in
# .claude/skills/pm-dispatch/references/contract-review.md 〈等 L2 标记〉. The
# dispatching seat hangs it on the PR at ACCEPT when either clause-② limb hits
Expand Down
54 changes: 44 additions & 10 deletions scripts/pm/l1-face.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* The L1 checklist asks every seat to re-read the same mechanical facts by hand on every dev report: the PR's shape,
* the card relation its first line declares, whether a closing keyword sits next to another OPEN card, the release
* path, a changeset per published package, the declaration lines, the two floor checks at the head, every other check,
* whether the dogfood battery is owed, and the `+0/-0` NUL suspects. This file is that reading, one line per item with
* whether the dogfood battery is proven on the head, and the `+0/-0` NUL suspects. This file is that reading, one line per item with
* its verdict — `ok`, `flag` or `not measured` — and the evidence. ⛔ It writes nothing, and it is a READER, not a
* gate: no exit code here is a merge condition.
*
Expand All @@ -31,8 +31,13 @@
* with `check-changeset-no-major.mjs`' `entriesIn` (⛔ no fifth copy of the entry regex);
* 5. `/git/blobs/SHA` for every `+0/-0` file: NUL bytes and lines, the blob's own answer.
*
* The `Clause-②:` and `Metadata-protocol:` lines are read by `clause2-line.mjs`, and the dogfood markers by
* `label-write.mjs`' `landDogfoodMarkers` — the readers the gates use.
* The `Clause-②:` and `Metadata-protocol:` lines are read by `clause2-line.mjs`, the dogfood markers by
* `label-write.mjs`' `landDogfoodMarkers`, and the lane's check run and the lane's workflow in the file list by
* `land-dogfood-lane.mjs`' two verdicts — the readers the gates use. A marked PR is JUDGED on what the landing door
* will read: the opt-in lane's `success` on this head (reading 1's check-runs) and a file list that leaves the lane
* alone (reading 2). ⛔ Nothing typed in a report is read. One difference from the door is named, not hidden: reading
* 1 asks `filter=latest`, the door `filter=all`, so a success a later red re-run of the SAME workflow run superseded
* reads `flag` here and passes there.
*
* ## What it does NOT read — named in the footer of every run
*
Expand Down Expand Up @@ -66,6 +71,7 @@ import { closingKeywordTargets, DECISION_INBOX_LABEL, DEFAULT_SWEEP_REPO, h7Part
import { readClause2Line, readMetadataProtocolLine } from './clause2-line.mjs';
import { ghApi, readAllPages } from './gh-pages.mjs';
import { landDogfoodMarkers } from './label-write.mjs';
import { DOGFOOD_LANE_CHECK, DOGFOOD_LANE_LABEL, DOGFOOD_LANE_WORKFLOW, dogfoodLaneCheckVerdict, dogfoodLaneFilesVerdict } from './land-dogfood-lane.mjs';
import { fixtureReaders, gitLsRemote, readPrState } from './pr-state.mjs';

const REPO_ROOT = fileURLToPath(new URL('../../', import.meta.url));
Expand Down Expand Up @@ -107,7 +113,7 @@ export const RULE_FILES = Object.freeze({
'亲核 Lint & Repo Gates 与 TypeScript Type Check 皆 `success`',
'入队另要求全 check 绿',
'门禁读数钉当前 head',
'`!` 或 `(narrowing)`:入队前核 `dogfood_battery`',
'`!` 或 `(narrowing)`:入队前核 head 上 `Dogfood battery (opt-in)` success',
'`+0/-0` 先疑 NUL,以 blob 定论',
'要求源侧写转义序列',
'`l1-face.mjs --pr N`',
Expand All @@ -129,7 +135,7 @@ export const UNREAD_ITEMS = Object.freeze([
'a PR that moves a send or a write after the response: grep `packages/qa/dogfood/test` for a case that reads the side effect right after the response, made a bounded wait in the same PR',
'adjacent in-place fixes (the four conditions), one-shot codegen in the diff, move/split growth past a pure move',
'test evidence: real commands and output, positive controls, `.d.ts` byte-identity readings, git-answerable API reads',
"gate readings in the report pinned to this head, and the report's `dogfood_battery` against it",
'gate readings in the report pinned to this head',
'assertions and benefit (the envelope `code`/`status`, sweep direction and build order), premise, stop conditions and deletions',
"`mergeable_state`, the queue and reviews — read with `pr-state.mjs` (its line is printed above)",
]);
Expand Down Expand Up @@ -344,7 +350,20 @@ export function readFace({ repo, number, get = ghApi, lsRemote = gitLsRemote, sl
{
const m = landDogfoodMarkers({ title: pr.title, body });
if (m.unreadable) item('dogfood', NOT_MEASURED, m.unreadable);
else if (m.markers.length) item('dogfood', FLAG, `owed — ${m.markers.join(' and ')}: the full battery on ${short(head)}, recorded under \`dogfood_battery\` (flagged, not judged)`);
else if (m.markers.length) {
// What the landing door will read (`label-write.mjs --land`): the lane's success ON THIS HEAD, and a file list
// that leaves the lane alone. Judged with the door's own two verdicts, never a second spelling of either.
const owed = `owed — ${m.markers.join(' and ')}`;
const lane = dogfoodLaneCheckVerdict(tap.runs, head);
const edits = files ? dogfoodLaneFilesVerdict(files) : null;
const waiting = tap.runs.some((r) => r?.name === DOGFOOD_LANE_CHECK && r.status !== 'completed');
if (!files) item('dogfood', NOT_MEASURED, `${owed}: ${filesGap}, so whether this PR changes \`${DOGFOOD_LANE_WORKFLOW}\` is unread`);
else if (edits.touched) item('dogfood', FLAG, `${owed}: this PR changes \`${DOGFOOD_LANE_WORKFLOW}\`, so it may not certify itself with that lane — the lane change lands on its own`);
else if (!checks) item('dogfood', NOT_MEASURED, `${owed}: the head's check-runs did not read`);
else if (lane.success) item('dogfood', OK, `${owed}: \`${DOGFOOD_LANE_CHECK}\` concluded success at ${short(head)} (check run ${lane.success.id ?? 'id not read'})`);
else if (waiting) item('dogfood', NOT_MEASURED, `${owed}: \`${DOGFOOD_LANE_CHECK}\` is still running at ${short(head)}`);
else item('dogfood', FLAG, `${owed}: no success of \`${DOGFOOD_LANE_CHECK}\` at ${short(head)} (${lane.seen === 0 ? 'no run of that name' : lane.tally}) — add \`${DOGFOOD_LANE_LABEL}\` and wait for the run`);
}
else item('dogfood', OK, 'not owed (no `!` before the title\'s colon, no `(narrowing)` arm)');
}

Expand Down Expand Up @@ -588,7 +607,8 @@ const SELF_TEST_BATTERIES = Object.freeze({
'PR shape and the card relation: the first line, the shared parser, other open cards': 12,
'scope and changeset: the release path, published packages, empty changesets': 10,
'declarations: Clause-②, Metadata-protocol and the Skills-docs line they owe': 6,
'gate evidence at the head: the floor checks, every other check via pr-state, dogfood owed': 7,
// Raised 7 → 13 with the lane: a marked PR is judged on the lane's check run at the head and on its own file list.
'gate evidence at the head: the floor checks, every other check via pr-state, dogfood owed': 13,
'+0/-0: the blob decides': 5,
'the face and the CLI: the unread footer, exits and usage': 8,
});
Expand Down Expand Up @@ -631,7 +651,7 @@ export function selfTest() {
const REQ = '_Requested by **Sales** · [project thread](https://claude.ai/code/project/x?thread=y)_';
const bodyOf = (...lines) => [ATTR, REQ, ...lines].join('\n');
const BODY = bodyOf('Part of #500', 'Clause-②: no', 'Metadata-protocol: none', '', 'What changes.');
const run = (name, conclusion = 'success', status = 'completed') => ({ name, status, conclusion: status === 'completed' ? conclusion : null, check_suite: { id: 1 } });
const run = (name, conclusion = 'success', status = 'completed') => ({ name, status, conclusion: status === 'completed' ? conclusion : null, check_suite: { id: 1 }, head_sha: HEAD, app: { slug: 'github-actions' } });
const file = (filename, over = {}) => ({ filename, status: 'modified', additions: 3, deletions: 1, sha: sha('b'), ...over });
const row = (over = {}) => ({ number: 7, state: 'open', draft: true, merged_at: null, mergeable_state: 'clean', head: { sha: HEAD }, base: { ref: 'main' }, auto_merge: null, title: 'feat(pm): x', body: BODY, labels: [{ name: SKIP_CHANGESET_LABEL }], changed_files: 2, ...over });
const fixture = (over = {}) => ({
Expand Down Expand Up @@ -726,8 +746,22 @@ export function selfTest() {
const skip = read(fixture(runs(run('Lint & Repo Gates'), run('TypeScript Type Check'), run('Build Docs', 'skipped'), run('Lint UI', 'skipped'))));
t('⭐ every other check is pr-state\'s judgement: an expected skip passes, an unexpected one flags', [v(skip, 'all-checks'), at(skip, 'all-checks').evidence.includes('1 unexpected skip (Lint UI)')], [FLAG, true]);
t('a pending check leaves all-checks not measured', v(read(fixture(runs(run('Lint & Repo Gates'), run('TypeScript Type Check'), run('Test Core', null, 'queued')))), 'all-checks'), NOT_MEASURED);
t('⭐ `!` before the title\'s colon owes the dogfood battery — flagged, not judged', [v(read(fixture({ row: { title: 'feat(pm)!: x' } })), 'dogfood'), v(read(fixture({ row: { body: bodyOf('Part of #500', 'Clause-②: yes (narrowing)', 'Metadata-protocol: narrowed', 'Skills-docs: none — internal') } })), 'dogfood')], [FLAG, FLAG]);
t('unreadable check-runs leave both check items not measured', [v(read(fixture({ check_runs: { [HEAD]: null } })), 'floor-checks'), v(read(fixture({ check_runs: { [HEAD]: null } })), 'all-checks')], [NOT_MEASURED, NOT_MEASURED]);
const BANG = { title: 'feat(pm)!: x' };
const NARROWING = { body: bodyOf('Part of #500', 'Clause-②: yes (narrowing)', 'Metadata-protocol: narrowed', 'Skills-docs: none — internal') };
const FLOOR = [run('Lint & Repo Gates'), run('TypeScript Type Check')];
const LANE = (conclusion = 'success', status = 'completed') => run(DOGFOOD_LANE_CHECK, conclusion, status);
const marked = (laneRuns, over = {}) => read(fixture({ row: BANG, check_runs: { [HEAD]: [...FLOOR, ...laneRuns] }, ...over }));
const noLane = read(fixture({ row: BANG }));
t('⭐ FLIPPED by ruling D (was: "`!` before the title\'s colon owes the dogfood battery — flagged, not judged"): a marked PR is now JUDGED on the lane — a `!` title or a `(narrowing)` arm with no lane run at the head flags, naming the label to add', [v(noLane, 'dogfood'), v(read(fixture({ row: NARROWING })), 'dogfood'), at(noLane, 'dogfood').evidence.includes(`no run of that name) — add \`${DOGFOOD_LANE_LABEL}\` and wait for the run`)], [FLAG, FLAG, true], at(noLane, 'dogfood').evidence);
const proven = marked([LANE('skipped'), LANE('skipped'), LANE()]);
t('⭐ a marked PR whose head carries the lane\'s success reads ok — beside two `skipped` runs of the same name: any success on the head, never the newest', [v(proven, 'dogfood'), at(proven, 'dogfood').evidence.includes(`\`${DOGFOOD_LANE_CHECK}\` concluded success at`)], [OK, true], at(proven, 'dogfood').evidence);
t('⭐ only `skipped` runs, or a failure, flag — with their tally', [v(marked([LANE('skipped'), LANE('skipped')]), 'dogfood'), at(marked([LANE('skipped'), LANE('skipped')]), 'dogfood').evidence.includes('(skipped ×2)'), v(marked([LANE('failure')]), 'dogfood')], [FLAG, true, FLAG]);
t('a lane run still in progress is not measured, never ok and never a flag', v(marked([LANE(null, 'in_progress')]), 'dogfood'), NOT_MEASURED);
t('⛔ a success under a SHARD\'s name is not the lane\'s aggregate: flags', v(marked([run('Dogfood battery shard (1/3, opt-in)')]), 'dogfood'), FLAG);
const selfCert = marked([LANE()], { files: { 7: [file(DOGFOOD_LANE_WORKFLOW), file('.claude/skills/a.md')] } });
t('⭐ a marked PR whose file list changes the lane\'s workflow flags EVEN WITH a success on its head: it may not certify itself', [v(selfCert, 'dogfood'), at(selfCert, 'dogfood').evidence.includes('the lane change lands on its own')], [FLAG, true], at(selfCert, 'dogfood').evidence);
t('…and an UNMARKED PR is not owed, whatever it edits and with no lane run', [v(read(fixture()), 'dogfood'), v(read(fixture({ files: { 7: [file(DOGFOOD_LANE_WORKFLOW), file('.claude/skills/a.md')] } })), 'dogfood')], [OK, OK]);
t('unreadable check-runs leave both check items not measured, and a marked PR\'s dogfood item with them', [v(read(fixture({ check_runs: { [HEAD]: null } })), 'floor-checks'), v(read(fixture({ check_runs: { [HEAD]: null } })), 'all-checks'), v(read(fixture({ row: BANG, check_runs: { [HEAD]: null } })), 'dogfood')], [NOT_MEASURED, NOT_MEASURED, NOT_MEASURED]);
}

battery('+0/-0: the blob decides');
Expand Down
Loading
Loading