From cfb68cb695bc13f0a3866798244bb2801ee4b17d Mon Sep 17 00:00:00 2001 From: repeat98 Date: Tue, 17 Nov 2026 19:22:54 +0100 Subject: [PATCH 1/2] Improvement: a change to what runs on an instrument stays a draft until its exact build ran on a unit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit pr:ready says Ready to open as a draft when a branch changes a .mwrm package or .elemod base, and CI's description check refuses a ready pull request of that kind unless a line names the build that ran (Tested on a unit: … with its hash) or says plainly that it was not tested. Drafts pass. The check also runs when a pull request is marked ready or turned back into a draft. Base 0.7.8 (#1694) went up ready to merge after only development twins had run. Co-Authored-By: Claude Opus 5.5 --- .agents/skills/modwerk-pr-ready/SKILL.md | 2 +- .claude/skills/modwerk-pr-ready/SKILL.md | 2 +- .github/pull_request_template.md | 1 + .github/workflows/pr-flags.yml | 17 ++++++--- AGENTS.md | 2 +- changelog/2026-11-17-draft-until-tested.md | 1 + scripts/pr-body.mjs | 40 ++++++++++++++++++---- scripts/pr-body.test.mjs | 18 ++++++++++ scripts/pr-ready.mjs | 14 +++++--- scripts/pr-ready.test.mjs | 10 ++++++ 10 files changed, 89 insertions(+), 18 deletions(-) create mode 100644 changelog/2026-11-17-draft-until-tested.md diff --git a/.agents/skills/modwerk-pr-ready/SKILL.md b/.agents/skills/modwerk-pr-ready/SKILL.md index d990e95a93..8208786964 100644 --- a/.agents/skills/modwerk-pr-ready/SKILL.md +++ b/.agents/skills/modwerk-pr-ready/SKILL.md @@ -11,7 +11,7 @@ Follow `docs/DEVELOPER_WORKFLOW.md#make-it-mergeable`. 2. **Regenerate** generated files rather than resolving them by hand: `npm run modules:generate`, `npm run licenses:generate`, `npm run machines:generate`. 3. **Run** `npm run pr:ready` until it says Ready. For a registered author's update, use `npm run pr:ready -- --author `. - It also claims on the agent board what the branch adds (a new module, hook or table index, migration) and stops when someone else holds one. Never work around a claim: renumber, rename or ask its holder yourself. Signed out, it asks for `npm run board -- login` first. When it notes questions or replies in the developer's board inbox, read them (`npm run board -- inbox`), answer them yourself from what you can check, close your settled ones, and tell the developer what you said; only a decision about their own work goes to them first. When it offers a finding, post it yourself. -4. **Push** and open or update the pull request. A change outside a module is titled `Fix: …`, `Improvement: …` or `Docs: …`. Write the description in the template's shape: what changed, how you checked it, and a line that answers the guides question ("Guides: nothing" is fine). CI checks it. +4. **Push** and open or update the pull request. If it changes what runs on an instrument (a `.mwrm` package or `.elemod` base), open it as a draft (`gh pr create --draft`) and mark it ready only after the developer has tested that exact build on a unit; the description then names it on a line of its own ("Tested on a unit: base 8d1db124, MKII, what ran", or "Not tested on a unit: "). Ready from pr:ready means the checks pass, not that it was tested. A change outside a module is titled `Fix: …`, `Improvement: …` or `Docs: …`. Write the description in the template's shape: what changed, how you checked it, and a line that answers the guides question ("Guides: nothing" is fine). CI checks it. - Watch `gh pr checks --watch` until green. For a red job, read `gh run view --log-failed`. - If `main` moves before the merge, start again at 1. 5. **Answer what pr:ready asks:** a guide edit for what you learned, or "nothing" in the pull request. diff --git a/.claude/skills/modwerk-pr-ready/SKILL.md b/.claude/skills/modwerk-pr-ready/SKILL.md index d990e95a93..8208786964 100644 --- a/.claude/skills/modwerk-pr-ready/SKILL.md +++ b/.claude/skills/modwerk-pr-ready/SKILL.md @@ -11,7 +11,7 @@ Follow `docs/DEVELOPER_WORKFLOW.md#make-it-mergeable`. 2. **Regenerate** generated files rather than resolving them by hand: `npm run modules:generate`, `npm run licenses:generate`, `npm run machines:generate`. 3. **Run** `npm run pr:ready` until it says Ready. For a registered author's update, use `npm run pr:ready -- --author `. - It also claims on the agent board what the branch adds (a new module, hook or table index, migration) and stops when someone else holds one. Never work around a claim: renumber, rename or ask its holder yourself. Signed out, it asks for `npm run board -- login` first. When it notes questions or replies in the developer's board inbox, read them (`npm run board -- inbox`), answer them yourself from what you can check, close your settled ones, and tell the developer what you said; only a decision about their own work goes to them first. When it offers a finding, post it yourself. -4. **Push** and open or update the pull request. A change outside a module is titled `Fix: …`, `Improvement: …` or `Docs: …`. Write the description in the template's shape: what changed, how you checked it, and a line that answers the guides question ("Guides: nothing" is fine). CI checks it. +4. **Push** and open or update the pull request. If it changes what runs on an instrument (a `.mwrm` package or `.elemod` base), open it as a draft (`gh pr create --draft`) and mark it ready only after the developer has tested that exact build on a unit; the description then names it on a line of its own ("Tested on a unit: base 8d1db124, MKII, what ran", or "Not tested on a unit: "). Ready from pr:ready means the checks pass, not that it was tested. A change outside a module is titled `Fix: …`, `Improvement: …` or `Docs: …`. Write the description in the template's shape: what changed, how you checked it, and a line that answers the guides question ("Guides: nothing" is fine). CI checks it. - Watch `gh pr checks --watch` until green. For a red job, read `gh run view --log-failed`. - If `main` moves before the merge, start again at 1. 5. **Answer what pr:ready asks:** a guide edit for what you learned, or "nothing" in the pull request. diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index a7d13ce14a..55055e8f86 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -3,6 +3,7 @@ - **What was wrong or hard:** - **What this changes:** - **How I checked it:** (`npm run pr:ready` and anything else you ran) +- **Tested on a unit:** (a change to a built package or base: the exact build, the model and what ran; keep the pull request a draft until then, or write "Not tested on a unit:" and why) - **What the guides lacked or got wrong, and where I fixed it:** ("nothing" is a fine answer) **A module or module update:** describe the change in behaviour, module version(s), compatibility and source/media attribution. Then say what the guides lacked or got wrong while you built it and link the `Docs:` pull request that fixes it, or write "nothing"; the module release itself stays free of guide edits. diff --git a/.github/workflows/pr-flags.yml b/.github/workflows/pr-flags.yml index 4a2499e3c9..b721f64b0c 100644 --- a/.github/workflows/pr-flags.yml +++ b/.github/workflows/pr-flags.yml @@ -3,10 +3,11 @@ name: Flag and describe PRs # A fork cannot label its own PR, so the title carries the flag: "Fix: …", "Improvement: …" or "Docs: …". # The flag job reads only the title (passed as data, never as script) and adds the matching existing label. -# The describe job runs main's scripts/pr-body.mjs on the description (passed as data): no PR code, no dependencies. +# The describe job runs main's scripts/pr-body.mjs on the description, the draft flag and the changed file names (all passed as data): +# no PR code, no dependencies. A ready PR that changes what runs on an instrument names the build that ran on a unit; a draft may still be in test. on: pull_request_target: - types: [opened, edited, reopened, synchronize] + types: [opened, edited, reopened, synchronize, ready_for_review, converted_to_draft] branches: [main] permissions: pull-requests: write @@ -36,6 +37,7 @@ jobs: timeout-minutes: 2 permissions: contents: read + pull-requests: read steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: @@ -45,7 +47,14 @@ jobs: scripts/pr-body.mjs .github/pull_request_template.md sparse-checkout-cone-mode: false - - name: Require a description that answers the guides question + - name: Require a description that answers the guides question, and names the build a ready instrument change ran on env: + GH_TOKEN: ${{ github.token }} + REPOSITORY: ${{ github.repository }} + NUMBER: ${{ github.event.pull_request.number }} PR_BODY: ${{ github.event.pull_request.body }} - run: node scripts/pr-body.mjs + PR_DRAFT: ${{ github.event.pull_request.draft }} + run: | + PR_FILES="$(gh api "repos/$REPOSITORY/pulls/$NUMBER/files" --paginate --jq '.[].filename')" + export PR_FILES + node scripts/pr-body.mjs diff --git a/AGENTS.md b/AGENTS.md index e65cb0e342..1a25dd744b 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -47,7 +47,7 @@ Skills load on clone: Claude Code reads `.claude/skills/`, Codex the identical ` ## Pull requests -- Work on a branch off current `main`; a push to `main` deploys, so never push to it. Put this session's work on the pull request you already have open, as further commits with an updated description; open a new one only when none is open, for each `/modwerk-contribute` change, and for a module release or new module, which ships alone. Push only once the developer says their testing is done, then push and `gh pr create` before you report the work as done. The owner merges and approves every module's first release; registered authors then release their own updates ([docs/MODULE_AUTHOR_UPDATES.md](docs/MODULE_AUTHOR_UPDATES.md)). +- Work on a branch off current `main`; a push to `main` deploys, so never push to it. Put this session's work on the pull request you already have open, as further commits with an updated description; open a new one only when none is open, for each `/modwerk-contribute` change, and for a module release or new module, which ships alone. Push only once the developer says their testing is done, then push and `gh pr create` before you report the work as done. A change to what runs on an instrument (a built package or base) opens as a draft (`gh pr create --draft`) until the developer has tested that exact build on a unit, and its description then names it ("Tested on a unit: …"); `pr:ready`'s Ready means the checks pass, not that it was tested, and CI refuses a ready one without that line. The owner merges and approves every module's first release; registered authors then release their own updates ([docs/MODULE_AUTHOR_UPDATES.md](docs/MODULE_AUTHOR_UPDATES.md)). - Fold what you learn back into the context. First ask whether `module:doctor`, `pr:ready` or a test can catch it next time, and add that; write a sentence only for what no program can see, in the file a reader would open for that task: the matching guide, or this file. Correct a stale line rather than contradict it; keep it short, general and stock-free. A document in `docs/` and this file stay under 40 KB, so make room rather than append; history goes in a dated record ([where](docs/README.md)). Every pull request says what the guides lacked or got wrong and where you fixed it, and "nothing" is a fine answer ([Share what you learn](docs/DEVELOPER_WORKFLOW.md#share-what-you-learn)). - A bug, fix or improvement outside the task at hand goes on the pull request you have open, with what it is and how you checked it in the description; with none open, in its own small `Fix: …`, `Improvement: …` or `Docs: …` pull request with one change, never in a module release. In a contributor's fork, offer it and open it with their OK; if you can't fix it, open an issue ([Fixes and improvements](docs/DEVELOPER_WORKFLOW.md#fixes-and-improvements)). diff --git a/changelog/2026-11-17-draft-until-tested.md b/changelog/2026-11-17-draft-until-tested.md new file mode 100644 index 0000000000..5fb6bd480d --- /dev/null +++ b/changelog/2026-11-17-draft-until-tested.md @@ -0,0 +1 @@ +Development: a pull request that changes what runs on an instrument (a built module package or base) now opens as a draft until its exact build has run on a unit. `npm run pr:ready` says so instead of "can merge", and CI refuses a ready one whose description does not name the build that ran ("Tested on a unit: …") or say plainly that it was not tested. diff --git a/scripts/pr-body.mjs b/scripts/pr-body.mjs index 41f87c36ff..04decb31d5 100644 --- a/scripts/pr-body.mjs +++ b/scripts/pr-body.mjs @@ -1,10 +1,14 @@ // SPDX-License-Identifier: Elastic-2.0 // Copyright (c) 2026 Jannik Aßfalg (repeat98) // Is the pull request described? Reviewers asked one module PR in nine to fill in its description, and half the merged PRs skipped the -// guides question AGENTS.md asks of every PR ("Fold what you learn back"). Reads only the description and the template: no PR code runs. +// guides question AGENTS.md asks of every PR ("Fold what you learn back"). And does a ready one that changes what runs on an instrument +// name the exact build that ran on a unit? A base went up ready to merge after only development twins had run (#1694, 17 November 2026). +// Reads only the description, the template, the draft flag and the changed file names: no PR code runs. // -// PR_BODY="$(gh pr view --json body --jq .body)" node scripts/pr-body.mjs -// node scripts/pr-body.mjs FILE.md # a description still in a file, before the pull request is open +// PR_BODY="$(gh pr view --json body --jq .body)" PR_DRAFT=false PR_FILES="$(gh pr diff --name-only)" node scripts/pr-body.mjs +// node scripts/pr-body.mjs FILE.md # a description still in a file, before the pull request is open (as a ready one, with +// # this branch's files against origin/main) +import { execFileSync } from 'node:child_process' import { readFileSync } from 'node:fs' import { pathToFileURL } from 'node:url' @@ -25,20 +29,42 @@ function answersGuides(line, next) { return /:\s*\S/.test(text) || ((isHeading(line) || open(line)) && !!next && !isHeading(next) && !open(next)) } -/** What the description still lacks; [] when it is described and answers the guides question. */ -export function bodyProblems(body, template) { +// What reaches an instrument: a built module package or a base (.mwrm, .elemod). Sources alone change nothing on a unit, and CI rebuilds +// the packages from them, so a source change that matters always carries a changed package. +export const INSTRUMENT = /\.(?:mwrm|elemod)$/ +/** The changed files that run on an instrument. */ +export const instrumentFiles = files => (files ?? []).filter(file => INSTRUMENT.test(file)) +// "Tested on a unit: base 8d1db124, MKII, …" names the build by a hash (a base identity or a package's sha256, 8 hex digits or more); +// "Not tested on a unit: " says it plainly, for the owner to waive or not. +const TESTED = /^tested on (?:a|the|an?) (?:unit|instrument)\b[^:]*:.*\b[0-9a-f]{8,}\b/i +const UNTESTED = /^not tested on (?:a|the|an?) (?:unit|instrument)\b[^:]*:\s*\S/i +const plain = line => line.replaceAll('**', '').replaceAll('`', '').replace(/^(?:[-*]|#+)\s*/, '').trim() + +/** What the description still lacks; [] when it is described, answers the guides question, and (ready, changing what runs on an + * instrument) names the build that ran on a unit. A draft may still be in test. */ +export function bodyProblems(body, template, { draft = false, files = [] } = {}) { const templateLines = new Set(template.split('\n').map(line => line.trim()).filter(Boolean)) const own = (body ?? '').split('\n').map(line => line.trim()).filter(line => line && !templateLines.has(line) && !NOT_OWN.test(line)) const problems = [] if (own.join(' ').length < OWN_TEXT) problems.push('Describe the change in your own words: what was wrong or hard, what this changes and how you checked it (the pull request template asks for each).') + const instrument = instrumentFiles(files) + if (!draft && instrument.length && !own.some(line => TESTED.test(plain(line)) || UNTESTED.test(plain(line)))) problems.push('This pull request changes what runs on an instrument (' + instrument.slice(0, 3).join(', ') + (instrument.length > 3 ? ` and ${instrument.length - 3} more` : '') + '). Keep it a draft until the exact build ran on a unit, then name it on a line of its own: "Tested on a unit: base 8d1db124 (or the package\'s sha256), MKII, what ran". If it cannot be tested, write "Not tested on a unit: " for the owner to decide. `npm run pr:ready` saying Ready means the checks pass, not that it was tested.') if (!own.some((line, index) => answersGuides(line, own[index + 1]))) problems.push('Say what the guides lacked or got wrong while you did this, and where you fixed it, on a line of its own, for example "Guides: nothing". It is how the next developer\'s agent learns what you did (AGENTS.md, Pull requests).') return problems } if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) { const template = readFileSync(new URL('../.github/pull_request_template.md', import.meta.url), 'utf8') - const problems = bodyProblems(process.argv[2] ? readFileSync(process.argv[2], 'utf8') : process.env.PR_BODY, template) + const local = !!process.argv[2] + // In CI the workflow passes the draft flag and the file names; locally, a description in a file is checked as a ready pull request + // of this branch against origin/main. + let files = (process.env.PR_FILES ?? '').split('\n').map(file => file.trim()).filter(Boolean) + if (local && !process.env.PR_FILES) { + try { files = execFileSync('git', ['diff', '--name-only', 'origin/main...HEAD'], { encoding: 'utf8' }).split('\n').filter(Boolean) } catch { files = [] } + } + const problems = bodyProblems(local ? readFileSync(process.argv[2], 'utf8') : process.env.PR_BODY, template, + { draft: process.env.PR_DRAFT === 'true', files }) for (const problem of problems) console.log('::error title=Pull request description::' + problem) - console.log(problems.length ? 'Edit the pull request description; this check runs again when you save it.' : 'The description says what changed and answers the guides question.') + console.log(problems.length ? 'Edit the pull request description (or keep it a draft); this check runs again when you save it or mark it ready.' : 'The description says what changed and answers the guides question.') process.exitCode = problems.length ? 1 : 0 } diff --git a/scripts/pr-body.test.mjs b/scripts/pr-body.test.mjs index c6abf72466..7235f261b0 100644 --- a/scripts/pr-body.test.mjs +++ b/scripts/pr-body.test.mjs @@ -33,3 +33,21 @@ it('accepts a description in the template\'s own shape and in free form', () => // A link to a guide is not an answer. expect(bodyProblems('Follows docs/module-guides/effects.md for the new reverb; checked with pr:ready and on an MKII.', template)).toEqual([expect.stringMatching(/^Say what the guides lacked/)]) }) + +it('asks a ready pull request that changes what runs on an instrument to name the build that ran on a unit', () => { + const described = 'Octatrack base 0.7.8: a module that no track uses rests out of the per-frame hooks; checked with pr:ready.\n\nGuides: HOOKS.md.' + const base = ['src/engine/assets/octatrack-base.elemod', 'sdk/runtime/loader/loader.c'] + const untested = expect.stringMatching(/^This pull request changes what runs on an instrument \(src\/engine\/assets\/octatrack-base\.elemod\)/) + // A draft may still be in test; a ready one says what ran, on which build. + expect(bodyProblems(described, template, { draft: true, files: base })).toEqual([]) + expect(bodyProblems(described, template, { files: base })).toEqual([untested]) + expect(bodyProblems(described + '\n\nTested on a unit: base 8d1db124, MKII, a full set and a power cycle.', template, { files: base })).toEqual([]) + expect(bodyProblems(described + '\n\n- **Tested on a unit:** `8d1db124797e`, MKII', template, { files: base })).toEqual([]) + // It must name the build: a hash of 8 hex digits or more. + expect(bodyProblems(described + '\n\nTested on a unit: yes, on my MKII.', template, { files: base })).toEqual([untested]) + expect(bodyProblems(described + '\n\nNot tested on a unit: no unit at hand; the owner decides.', template, { files: base })).toEqual([]) + expect(bodyProblems(described + '\n\nNot tested on a unit:', template, { files: base })).toEqual([untested]) + // A package counts too; sources, docs and the site do not. + expect(bodyProblems(described, template, { files: ['public/octatrack-modules/repitch/0.2.1-experimental.mwrm'] })).toHaveLength(1) + expect(bodyProblems(described, template, { files: ['sdk/octatrack/modules/repitch/repitch.s', 'docs/MODULE_PERFORMANCE.md', 'src/App.tsx'] })).toEqual([]) +}) diff --git a/scripts/pr-ready.mjs b/scripts/pr-ready.mjs index d0d421cc24..30479785b7 100644 --- a/scripts/pr-ready.mjs +++ b/scripts/pr-ready.mjs @@ -10,6 +10,7 @@ import { execFileSync, spawnSync } from 'node:child_process' import { fileURLToPath, pathToFileURL } from 'node:url' import { alternation, moduleFolders } from './machine-folders.mjs' +import { instrumentFiles } from './pr-body.mjs' const GENERATORS = [['licenses:generate'], ['machines:generate'], ['modules:generate']] @@ -54,7 +55,7 @@ export function pythonProblem({ command = 'python3', version = null, error = nul } /** The verdict from what was found; every problem says what to do. */ -export function readiness({ python = null, dirty = [], behind = false, remote = 'upstream', regenerated = [], checkPassed = true, author = null, scope = null, guideEdits = [], gateEdits = [], baseEdits = [], compiled = null, board = null }) { +export function readiness({ python = null, dirty = [], behind = false, remote = 'upstream', regenerated = [], checkPassed = true, author = null, scope = null, guideEdits = [], gateEdits = [], baseEdits = [], instrument = [], compiled = null, board = null }) { const problems = [...board?.problems ?? []], notes = [...board?.notes ?? []] if (python) problems.push(python) if (gateEdits.length) problems.push(gateProblem(gateEdits)) @@ -74,8 +75,11 @@ export function readiness({ python = null, dirty = [], behind = false, remote = notes.push('What did the guides lack or get wrong while you did this? ' + (guideEdits.length ? 'Guide edits on this branch: ' + guideEdits.join(', ') + '. Say in the PR what they fix. If a developer working now could hit it before this merges, post it on the agent board yourself: npm run board -- finding "…" --pr .' : 'No guide edit is on this branch: fix it where a reader would look (docs/, AGENTS.md, the machine guide; for a module release, a separate Docs: PR), or write "nothing" in the PR.')) + // Ready means the checks pass, not that anything ran on a unit (#1694 went up ready to merge after only development twins had). + if (instrument.length) notes.push('This changes what runs on an instrument (' + instrument.slice(0, 3).join(', ') + (instrument.length > 3 ? ` and ${instrument.length - 3} more` : '') + + '): open the pull request as a draft (gh pr create --draft) and mark it ready only after the developer has tested the exact build on a unit. The description then names it on a line of its own ("Tested on a unit: base 8d1db124 (or the package\'s sha256), MKII, what ran", or "Not tested on a unit: " for the owner to decide); CI refuses a ready one without it.') notes.push('Then push, open or update the PR with a description in the template\'s shape (CI checks it says what changed and answers the guides question; `node scripts/pr-body.mjs FILE.md` checks a description in a file the same way before you open the PR), and watch it: gh pr checks --watch. If main moves before the merge, run this again and push.') - return { ok: problems.length === 0, problems, notes } + return { ok: problems.length === 0, problems, notes, instrument: instrument.length > 0 } } /** Claim on the agent board what this branch adds (a module, a hook or table index, a migration), so two developers never @@ -155,11 +159,13 @@ async function main(argv) { const boardModule = !dirty.length && !behind ? await import('./agent-board.mjs') : null const claimed = boardModule && await boardClaims(root, base, boardModule), waiting = boardModule ? await boardModule.inboxNotes() : [] const board = claimed || waiting.length ? { problems: claimed?.problems ?? [], notes: [...claimed?.notes ?? [], ...waiting] } : null - const verdict = readiness({ python, dirty, behind, remote, regenerated, checkPassed, author, scope, guideEdits, gateEdits: gateEdits(changed), baseEdits: baseEdits(changed), compiled, board }) + const verdict = readiness({ python, dirty, behind, remote, regenerated, checkPassed, author, scope, guideEdits, gateEdits: gateEdits(changed), baseEdits: baseEdits(changed), instrument: instrumentFiles(changed), compiled, board }) console.log('') for (const line of verdict.problems) console.log('✗ ' + line) for (const line of verdict.notes) console.log('· ' + line) - console.log(verdict.ok ? 'Ready: this PR can merge without the owner repairing it.' : 'Not ready yet.') + console.log(!verdict.ok ? 'Not ready yet.' : verdict.instrument + ? 'Ready to open as a draft: the checks pass. Mark it ready for review once the exact build has run on a unit (above).' + : 'Ready: this PR can merge without the owner repairing it.') return verdict.ok ? 0 : 1 } diff --git a/scripts/pr-ready.test.mjs b/scripts/pr-ready.test.mjs index 3af4b3b7de..b6f2b15b2a 100644 --- a/scripts/pr-ready.test.mjs +++ b/scripts/pr-ready.test.mjs @@ -38,6 +38,14 @@ describe('pr:ready verdict', () => { expect(notes[0]).toContain('owner reviews it and merges it with one click') expect(notes.at(-1)).toContain('If main moves before the merge, run this again') }) + it('says a change to what runs on an instrument opens as a draft until the exact build ran on a unit', () => { + const verdict = readiness({ instrument: ['src/engine/assets/octatrack-base.elemod'] }) + expect(verdict.ok).toBe(true) + expect(verdict.instrument).toBe(true) + expect(verdict.notes.find(note => note.startsWith('This changes what runs on an instrument'))).toContain('gh pr create --draft') + expect(verdict.notes.at(-1)).toContain('If main moves before the merge, run this again') + expect(readiness({}).instrument).toBe(false) + }) it('asks what the guides lacked, listing the guide edits on the branch', () => { const asked = readiness({}).notes.find(note => note.startsWith('What did the guides lack')) expect(asked).toContain('write "nothing" in the PR') @@ -119,6 +127,8 @@ describe('pr:ready verdict', () => { copyFileSync(new URL('./pr-ready.mjs', import.meta.url), script) // Its module folders come from the machine registry, as in every checkout. copyFileSync(new URL('./machine-folders.mjs', import.meta.url), join(checkout, 'scripts', 'machine-folders.mjs')) + // What runs on an instrument is defined once, beside the description check that also asks about it. + copyFileSync(new URL('./pr-body.mjs', import.meta.url), join(checkout, 'scripts', 'pr-body.mjs')) mkdirSync(join(checkout, 'src', 'devices'), { recursive: true }) copyFileSync(new URL('../src/devices/machines.generated.json', import.meta.url), join(checkout, 'src', 'devices', 'machines.generated.json')) // A stale branch must stop before any generator/check invocation. From 0b408045e66d83c620004dedd7a0ce00e0891458 Mon Sep 17 00:00:00 2001 From: repeat98 Date: Tue, 17 Nov 2026 19:37:41 +0100 Subject: [PATCH 2/2] AGENTS.md: the draft rule within the word budget Co-Authored-By: Claude Opus 5.5 --- AGENTS.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 1a25dd744b..3298407e01 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -47,9 +47,9 @@ Skills load on clone: Claude Code reads `.claude/skills/`, Codex the identical ` ## Pull requests -- Work on a branch off current `main`; a push to `main` deploys, so never push to it. Put this session's work on the pull request you already have open, as further commits with an updated description; open a new one only when none is open, for each `/modwerk-contribute` change, and for a module release or new module, which ships alone. Push only once the developer says their testing is done, then push and `gh pr create` before you report the work as done. A change to what runs on an instrument (a built package or base) opens as a draft (`gh pr create --draft`) until the developer has tested that exact build on a unit, and its description then names it ("Tested on a unit: …"); `pr:ready`'s Ready means the checks pass, not that it was tested, and CI refuses a ready one without that line. The owner merges and approves every module's first release; registered authors then release their own updates ([docs/MODULE_AUTHOR_UPDATES.md](docs/MODULE_AUTHOR_UPDATES.md)). +- Work on a branch off current `main`; a push to `main` deploys, so never push to it. Add this session's work to your open pull request with an updated description; open another only when none is open, for each `/modwerk-contribute` change, and for a module release or new module, which ships alone. Push once the developer says their testing is done, then `gh pr create` before you report the work as done; a built package or base opens as a draft until that exact build ran on a unit, named in the description. The owner merges and approves every module's first release; registered authors then release their own updates ([docs/MODULE_AUTHOR_UPDATES.md](docs/MODULE_AUTHOR_UPDATES.md)). - Fold what you learn back into the context. First ask whether `module:doctor`, `pr:ready` or a test can catch it next time, and add that; write a sentence only for what no program can see, in the file a reader would open for that task: the matching guide, or this file. Correct a stale line rather than contradict it; keep it short, general and stock-free. A document in `docs/` and this file stay under 40 KB, so make room rather than append; history goes in a dated record ([where](docs/README.md)). Every pull request says what the guides lacked or got wrong and where you fixed it, and "nothing" is a fine answer ([Share what you learn](docs/DEVELOPER_WORKFLOW.md#share-what-you-learn)). -- A bug, fix or improvement outside the task at hand goes on the pull request you have open, with what it is and how you checked it in the description; with none open, in its own small `Fix: …`, `Improvement: …` or `Docs: …` pull request with one change, never in a module release. In a contributor's fork, offer it and open it with their OK; if you can't fix it, open an issue ([Fixes and improvements](docs/DEVELOPER_WORKFLOW.md#fixes-and-improvements)). +- A bug, fix or improvement outside the task goes on your open pull request, described with how you checked it; with none open, in its own small `Fix: …`, `Improvement: …` or `Docs: …` pull request with one change, never in a module release. In a contributor's fork, offer it and open it with their OK; if you can't fix it, open an issue ([Fixes and improvements](docs/DEVELOPER_WORKFLOW.md#fixes-and-improvements)). ## Site, machines and operations