From e443de9f4c426fcd8b76549334740f42263a5564 Mon Sep 17 00:00:00 2001 From: repeat98 Date: Wed, 2 Dec 2026 10:20:00 +0100 Subject: [PATCH 1/4] Improvement: the owner can trust a module author to approve and publish their own updates sdk/approvals/trusted-authors.json lists authors by numeric id with the owner's statement. A listed author signs their own Octatrack module's build approval with their own login, and the author workflow merges it together with the module's .mwrm package and its own rows in octatrack-module-packages.json and frame-costs.json. The address check, the owner notice and the 48-hour follower hold stay. First entry: AForceTrulyEvil (Grain). Co-Authored-By: Claude Opus 5.5 --- changelog/2026-12-02-trusted-authors.md | 1 + docs/MODULE_AUTHOR_UPDATES.md | 8 +++- scripts/author-update-git.mjs | 5 +- scripts/module-cpu-price.mjs | 3 +- scripts/module-doctor.mjs | 9 ++-- scripts/module-qualification.mjs | 5 +- scripts/perf-audit-analysis.mjs | 8 ++-- sdk/approvals/trusted-authors.json | 13 +++++ src/catalog/module-qualification.test.ts | 6 +++ src/release/author-updates.test.ts | 29 ++++++++++- src/release/author-updates.ts | 61 ++++++++++++++++++++++-- 11 files changed, 128 insertions(+), 20 deletions(-) create mode 100644 changelog/2026-12-02-trusted-authors.md create mode 100644 sdk/approvals/trusted-authors.json diff --git a/changelog/2026-12-02-trusted-authors.md b/changelog/2026-12-02-trusted-authors.md new file mode 100644 index 0000000000..7da93a5466 --- /dev/null +++ b/changelog/2026-12-02-trusted-authors.md @@ -0,0 +1 @@ +Improvement: the owner can trust a module author to approve and publish their own updates. A trusted author, listed in `sdk/approvals/trusted-authors.json`, signs their own Octatrack module's approval record, and the release bot merges it together with the module's package. The owner is still told about every such release, and followers still hear about it 48 hours after it goes live. diff --git a/docs/MODULE_AUTHOR_UPDATES.md b/docs/MODULE_AUTHOR_UPDATES.md index 1d9cd6c906..a91a61e1b1 100644 --- a/docs/MODULE_AUTHOR_UPDATES.md +++ b/docs/MODULE_AUTHOR_UPDATES.md @@ -1,6 +1,6 @@ # Publishing updates as a module author -A device reviewer or repository maintainer can review and merge a module's first release and register the submitting modder ([first releases](DEVELOPER_WORKFLOW.md#who-reviews-a-first-release)). After that, its registered author can request automatic merge and publication of their own updates. Open a pull request against `repeat98/modwerk` `main`; pushing to a personal upstream repository does not submit an update to Modwerk. Ownership changes, shared SDK/compiler changes and release exceptions still need owner review. +A device reviewer or repository maintainer can review and merge a module's first release and register the submitting modder ([first releases](DEVELOPER_WORKFLOW.md#who-reviews-a-first-release)). After that, its registered author can request automatic merge and publication of their own updates. Open a pull request against `repeat98/modwerk` `main`; pushing to a personal upstream repository does not submit an update to Modwerk. Ownership changes, shared SDK/compiler changes and release exceptions still need owner review, unless the owner made you a [trusted author](#trusted-authors). ## Merge a first release @@ -58,7 +58,7 @@ Existing followers and eligible prior downloaders receive the normal per-version ## Prepare the release 1. Merge current `main` into your branch; never rebase, since catalogue rows pin the pull request's own commit ([Make it mergeable](DEVELOPER_WORKFLOW.md#make-it-mergeable)). Edit your module under `sdk//modules//` and keep its original authors and licences. Include the fix's changelog update in your module’s `src/community/module-changelogs/.json` in this PR. For automatic publication, increase its semantic version and update its catalog entry and matching changelog entry, including for documentation-only updates. Ordinary documentation/media-only fixes add a clearly marked note to the current version unless publishing a new version; see [release notes](ADD_A_MODULE.md#release-notes-required-for-every-fix-and-module-version). To rename a published module, change its name and keep its id: the folder, symbols, import records, packages and changelog file name stay as they are. The site ties followers, likes, download counts, Ko-fi links, saved backups and configuration links to the id, and a new id is announced as a new module; Improved SMPL is still `sample-rate` and FM Synth still `synth`. -2. Follow [the module workflow](ADD_A_MODULE.md) and [qualification requirements](MODULE_QUALIFICATION.md). Runtime changes need current source/build evidence and native/browser parity. Exercise multiple instances with different settings across tracks, FX slots and DSP cores where supported; check instance isolation, Part save/reload, project save/load/reload, and a restart retaining only battery RAM and the saved card. Record physical reboot reports separately from emulator evidence. An explicit project load after fresh boot does not prove reboot survival. Failed or untested required acceptance checks need owner review and cannot use automatic publication. Editorial updates may retain approved evidence through the existing checked path. +2. Follow [the module workflow](ADD_A_MODULE.md) and [qualification requirements](MODULE_QUALIFICATION.md). Runtime changes need current source/build evidence and native/browser parity. Exercise multiple instances with different settings across tracks, FX slots and DSP cores where supported; check instance isolation, Part save/reload, project save/load/reload, and a restart retaining only battery RAM and the saved card. Record physical reboot reports separately from emulator evidence. An explicit project load after fresh boot does not prove reboot survival. Failed or untested required acceptance checks need owner review and cannot use automatic publication, except where a [trusted author](#trusted-authors) waives them in their own approval record. Editorial updates may retain approved evidence through the existing checked path. 3. Regenerate the catalog, rebuild changed Octatrack packages with the reviewed isolated toolchain, and commit the source, documentation, evidence, media and packages together. For Digitakt/Digitone runtime updates, include each approved OS variant of your own `vendor/elekloader/catalog/*.elemod`, and update its pins in your module's own record, `sdk/imports/elekloader--.json`, to the new version. The lock and other modules' records stay unchanged. Pin each package to the exact module source commit in the already approved GitHub repository (no floating release tag), retain its stock target, author and licence, and verify source/native/browser parity for that released package. Kit code, cores, dependencies and other modules stay fixed. Source or version changes without matching shipped packages cannot publish automatically. Keep firmware, projects/cards and raw dumps local. Run `npm run pr:ready -- --author ` until it says Ready: it brings in current `main`, regenerates the catalog, runs the checks CI runs and says whether the bot can merge your update ([Make it mergeable](DEVELOPER_WORKFLOW.md#make-it-mergeable)). Keep the PR to your module: a guide edit or a finding for other developers goes in its own docs-only PR ([Share what you learn](DEVELOPER_WORKFLOW.md#share-what-you-learn)), because anything outside your module's folder ends automatic publication. 4. Open your PR and check both boxes below only after personally reviewing the actual evidence. You may check them after CI passes: editing an open PR invokes the trusted release verifier against the current source checks, without rebuilding. Editing a closed PR does not rerun source CI or request another release: @@ -83,6 +83,10 @@ Keep two-factor authentication on your GitHub account while you are in `.github/ Because `GITHUB_TOKEN` merges do not trigger push workflows, the author workflow explicitly dispatches both site and community API publication. Dispatch failure is visible in the author workflow; rerun the site's and Worker's normal workflows on main to retry publication. Successful merge alone is not confirmation that deployment finished. +## Trusted authors + +The owner can trust a registered author to approve their own updates, as he would. He lists them by numeric GitHub id, with his statement, in `sdk/approvals/trusted-authors.json`; only he changes that file. For an Octatrack module whose manifest names them as author or maintainer, a trusted author writes the module's `sdk/approvals/-build-approval.json` themselves, with their own login as `approvedBy`. Its rules are the owner's: it binds the exact version and native source, never claims verified hardware, and waives only what it lists (current-build hardware, worst-case cycles, complete memory bounds, release documentation, the medium-pattern `release-cost`). The bot then merges it with the module's package: `public/octatrack-modules//`, and the module's own rows in `src/engine/assets/octatrack-module-packages.json` and `sdk/machines/octatrack/frame-costs.json`. Everything else in the scope above, the new-address check, the owner notice and the 48-hour follower hold still apply. To withdraw the trust, the owner removes the entry. + ## Repository setup This implementation needs no new personal access token, repository-wide collaborator invitation or secret. Keep `MODULE_APPROVER_GITHUB_ID` configured for ordinary owner-reviewed releases. The author workflow uses its job-scoped `GITHUB_TOKEN` with contents, pull requests and Actions write permissions. Enable repository Actions permissions if organization policy disables them; forks may still need GitHub's first-contributor workflow approval. diff --git a/scripts/author-update-git.mjs b/scripts/author-update-git.mjs index 59ebf549c6..f2d9d29be6 100644 --- a/scripts/author-update-git.mjs +++ b/scripts/author-update-git.mjs @@ -1,6 +1,6 @@ // Read PR Git objects as data. Never check out or execute the PR in the privileged workflow. import { execFileSync } from 'node:child_process' -import { authorizeAuthorUpdate, parseAuthorRegistry } from '../src/release/author-updates.ts' +import { TRUSTED_AUTHORS_FILE, authorizeAuthorUpdate, parseAuthorRegistry, parseTrustedAuthors } from '../src/release/author-updates.ts' import { readChangeScope } from './change-scope.mjs' import { alternation, moduleFolders } from './machine-folders.mjs' import { UPSTREAM_CATALOG, assembleCatalog } from './elekloader-vendor.ts' @@ -40,7 +40,8 @@ export function inspectAuthorUpdate(root, base, head, author) { const artifacts = Object.fromEntries(catalog.mods.filter(row => modules.some(module => module.document.id === row.id && module.document.machine + '-mk1' === row.device)).map(row => [row.file, JSON.parse(text(base, 'vendor/elekloader/catalog/' + row.file))])) vendor = { catalog, next, lock: JSON.parse(text(base, 'vendor/elekloader/elekloader.lock.json')), artifacts } } - const authorization = authorizeAuthorUpdate(registry, author, modules, changes, vendor) + const trusted = oldTree.has(TRUSTED_AUTHORS_FILE) ? parseTrustedAuthors(JSON.parse(text(base, TRUSTED_AUTHORS_FILE))) : new Map() + const authorization = authorizeAuthorUpdate(registry, author, modules, changes, vendor, trusted) // An update that names a 32-bit address its published source never named (a new hook, stock routine, // register or flash location) needs owner review. shortcut: a tripwire, not a sandbox; an address built // at run time passes, so the follower hold and the owner notice stay the safety net. diff --git a/scripts/module-cpu-price.mjs b/scripts/module-cpu-price.mjs index 44a9a93fda..fde7176ff4 100644 --- a/scripts/module-cpu-price.mjs +++ b/scripts/module-cpu-price.mjs @@ -8,6 +8,7 @@ import { spawnSync } from 'node:child_process' import { existsSync, readFileSync, readdirSync } from 'node:fs' import { join, resolve } from 'node:path' +import { mayApprove, readTrustedAuthors } from '../src/release/author-updates.ts' export const CPU_PRICE_PENDING_PATH = 'sdk/module-cpu-prices-pending.json' // Only a module first listed before this day can wait on the list; one listed from it names its price before it is listed. @@ -400,7 +401,7 @@ export function curveProblem(record) { export function releaseCostWaived({ root, document }) { if (document.tests?.qualification || document.tests?.releaseWaiver) return false const approval = readJson(resolve(root, 'sdk/approvals', document.id + '-build-approval.json')) - return approval?.kind === 'owner-approved-update' && approval.approvedBy === 'repeat98' && approval.id === document.id && + return approval?.kind === 'owner-approved-update' && mayApprove(approval.approvedBy, document, readTrustedAuthors(root)) && approval.id === document.id && approval.version === document.version && Array.isArray(approval.waived) && approval.waived.includes('release-cost') } export const frameCostHowTo = id => 'measure it on a unit with npm run device:price -- --write --curve T1,T3,T6,T7 --base ID --scene TEXT ' + id + diff --git a/scripts/module-doctor.mjs b/scripts/module-doctor.mjs index b5302e2122..1854876317 100644 --- a/scripts/module-doctor.mjs +++ b/scripts/module-doctor.mjs @@ -17,6 +17,7 @@ import { fileURLToPath } from 'node:url' import { availableModules, PAUSED_MODULE_IDS, isBetaModule } from '../src/catalog/availability.ts' import { MODULE_V3_CATEGORIES } from '../src/catalog/module-contract-v3.ts' import { parseModuleDocument } from '../src/catalog/module-contract.ts' +import { mayApprove, readTrustedAuthors } from '../src/release/author-updates.ts' import { isDocumentationPath, moduleSourceFingerprint } from './module-source.mjs' import { ANALOG_BD_DSP_COMPANIONS } from '../src/engine/analog-bd-layout.ts' import { crlfModuleFiles, moduleEarlierPerformanceSourceSha256, moduleNativeSourceSha256, modulePerformanceSourceSha256 } from './module-qualification.mjs' @@ -159,7 +160,7 @@ function octatrack(id) { // Cycles, a benchmark against stock and a stress run. Required for a module listed from PERFORMANCE_REQUIRED_FROM; older modules are told. const approvalPath = 'sdk/approvals/' + id + '-build-approval.json' - const hardwareApproval = exists(approvalPath) ? json(approvalPath) : null + const hardwareApproval = exists(approvalPath) ? json(approvalPath) : null, signer = by => mayApprove(by, document, readTrustedAuthors(root)) // A release from RELEASE_COST_FROM carries the record whatever day its module was first listed (owner, 23 November 2026: // every module goes through the whole cost procedure before a release; Tape Echo, listed 1 October, had none for 0.1.9). const released = releaseDate({ root, document }), releaseInProgress = existsSync(resolve(root, 'src/community/module-changelogs', id + '.json')) && (!released || released >= RELEASE_COST_FROM) @@ -172,13 +173,13 @@ function octatrack(id) { if (record.stress?.harness === 'ot_emu' && document.compatibility?.effectId != null) fail('performance', 'stress: an ot_emu run is for code reached only through stock hooks; an effect with id ' + document.compatibility.effectId + ' renders under dsp_host -guard -dirty', 'python3 tools/harness/stress_project.py, then tools/harness/pressure.py render') if (record.module !== id || record.version !== document.version) fail('performance', 'evidence/performance.json is for ' + record.module + '@' + record.version + ', not ' + id + '@' + document.version, 'measure again for this version, then npm run perf:audit -- check ' + folder + '/evidence/performance.json') else for (const row of rows.filter(item => item.state === 'fail')) { - if (ownerWaivedPerformanceRow(record, row, hardwareApproval, nativeHashes.get(id))) info('performance exception', row.name + ' evidence is missing and explicitly owner-waived at this exact version/source; limits are in TESTING.md') + if (ownerWaivedPerformanceRow(record, row, hardwareApproval, nativeHashes.get(id), signer)) info('performance exception', row.name + ' evidence is missing and explicitly owner-waived at this exact version/source; limits are in TESTING.md') else fail('performance', row.name + ': ' + row.detail, row.fix ?? 'npm run perf:audit -- check ' + folder + '/evidence/performance.json') } - if (!lines.some(line => line.name === 'performance')) ok('performance', rows.filter(item => item.name !== 'record' && !ownerWaivedPerformanceRow(record, item, hardwareApproval, nativeHashes.get(id))).map(item => item.name + ' ' + item.state).join(', ') + ' (npm run perf:audit)') + if (!lines.some(line => line.name === 'performance')) ok('performance', rows.filter(item => item.name !== 'record' && !ownerWaivedPerformanceRow(record, item, hardwareApproval, nativeHashes.get(id), signer)).map(item => item.name + ' ' + item.state).join(', ') + ' (npm run perf:audit)') // Were these numbers taken on this code? The stamp names the source they were measured on. const stamped = stampVerdict(record, performanceHashes.get(id), draft || !entry || (entry.addedAt ?? '').slice(0, 10) >= PERFORMANCE_STAMP_REQUIRED_FROM, (draft ? 'sdk/drafts/' + id : folder) + '/evidence/performance.json', earlierPerformanceHashes.get(id)) - if (stamped.state === 'fail' && !record.sourceSha256 && approvalCoversSource(hardwareApproval, id, document.version, nativeHashes.get(id))) + if (stamped.state === 'fail' && !record.sourceSha256 && approvalCoversSource(hardwareApproval, id, document.version, nativeHashes.get(id), signer)) info('performance stamp', 'not stamped: the owner\'s approval binds this exact source, record included (' + approvalPath + ')') else if (stamped.state === 'fail') fail('performance stamp', stamped.detail, stamped.fix) else if (stamped.state === 'note') info('performance stamp', stamped.detail) diff --git a/scripts/module-qualification.mjs b/scripts/module-qualification.mjs index 8132fdd74f..dd672976d3 100644 --- a/scripts/module-qualification.mjs +++ b/scripts/module-qualification.mjs @@ -9,6 +9,7 @@ import { requireSynthRelease } from './synth-release.mjs' import { requireRetainedEvidence } from './retained-evidence.mjs' import { requireModuleQualificationForPublication, requireModuleUiForPublication } from '../src/catalog/module-contract.ts' import { compareModuleVersions } from '../src/catalog/versions.ts' +import { mayApprove, readTrustedAuthors } from '../src/release/author-updates.ts' import { requireModuleDocumentation } from './module-documentation.mjs' import { CPU_PRICE_RECORD, manifestWithoutPrice } from './module-cpu-price.mjs' @@ -97,7 +98,7 @@ export async function moduleEarlierPerformanceSourceSha256(folder, document) { return fingerprint(folder,(await nativePaths(folder,document)).filter(path=>!path.startsWith('evidence/'))) } // An owner-approved update publishes a new version without fresh evidence for -// what the owner names in `waived`. The approval lives in sdk/, outside the +// what the owner names in `waived`; an author the owner trusts may sign it for their own module. The approval lives in sdk/, outside the // module folder, so a folder cannot grant it to itself, and binds this exact // version and native source. Hardware is never claimed verified; anything not // waived is still required. @@ -110,7 +111,7 @@ async function requireOwnerApprovedUpdate(root, folder, document) { const keys=Object.keys(approval).filter(key=>key!=='retainedUiVersion').sort().join(',') if(keys!=='approvedBy,approvedOn,id,kind,ownerStatement,reason,sourceSha256,version,waived') fail('record has unexpected or missing fields') if(approval.id!==document.id||approval.version!==document.version) fail('does not cover this module version') - if(approval.approvedBy!=='repeat98'||!/^\d{4}-\d{2}-\d{2}$/.test(approval.approvedOn)) fail('needs the owner and an approval date') + if(!mayApprove(approval.approvedBy,document,readTrustedAuthors(root))||!/^\d{4}-\d{2}-\d{2}$/.test(approval.approvedOn)) fail('needs the owner, or the module\'s own author the owner trusts (sdk/approvals/trusted-authors.json), and an approval date') if(![approval.ownerStatement,approval.reason].every(value=>typeof value==='string'&&value.trim())) fail('needs the owner statement and a reason') if(!Array.isArray(approval.waived)||!approval.waived.length||new Set(approval.waived).size!==approval.waived.length||approval.waived.some(item=>!UPDATE_WAIVABLE.includes(item))) fail('waives only '+UPDATE_WAIVABLE.join(', ')) if(approval.sourceSha256!==await moduleNativeSourceSha256(folder,document)) fail('does not cover this exact native source') diff --git a/scripts/perf-audit-analysis.mjs b/scripts/perf-audit-analysis.mjs index 402a58a253..1c67fae5a4 100644 --- a/scripts/perf-audit-analysis.mjs +++ b/scripts/perf-audit-analysis.mjs @@ -175,8 +175,8 @@ export function priceLimits(document) { /** Whether the owner's approval binds this exact module version and native source. That hash covers the module's whole folder, * its performance record included, so a record it covers needs no stamp of its own. */ -export function approvalCoversSource(approval, id, version, sourceSha256) { - return approval?.kind === 'owner-approved-update' && approval.approvedBy === 'repeat98' && approval.id === id && approval.version === version && +export function approvalCoversSource(approval, id, version, sourceSha256, signer = by => by === 'repeat98') { + return approval?.kind === 'owner-approved-update' && signer(approval.approvedBy) && approval.id === id && approval.version === version && HEX64.test(sourceSha256 ?? '') && approval.sourceSha256 === sourceSha256 } @@ -184,8 +184,8 @@ export function approvalCoversSource(approval, id, version, sourceSha256) { * The publication validator separately validates the complete approval and documentation. * A cycles row may also be excused when only the static bound is missing and a measurement with its budget is given (code whose cost * lies in stock routines nothing here bounds); a measurement over its budget, or without one, is never excused. Measured failures and ordinary audit verdicts remain failures. */ -export function ownerWaivedPerformanceRow(record, row, approval, sourceSha256) { - if (row.state !== 'fail' || !approvalCoversSource(approval, record.module, record.version, sourceSha256) || !Array.isArray(approval.waived)) return false +export function ownerWaivedPerformanceRow(record, row, approval, sourceSha256, signer) { + if (row.state !== 'fail' || !approvalCoversSource(approval, record.module, record.version, sourceSha256, signer) || !Array.isArray(approval.waived)) return false if (row.name === 'cycles') return approval.waived.includes('chip-worst-case-cycles') && record.kind === 'coldfire' && record.cycles?.unit === 'cycles/event' && record.cycles.static === null && (['measured', 'budget'].every(key => record.cycles[key] === null) || (['measured', 'budget'].every(key => positive(record.cycles[key])) && record.cycles.measured <= record.cycles.budget)) && text(record.cycles.method, 10) if (!approval.waived.includes('current-build-hardware') || record.kind !== 'coldfire') return false if (row.name === 'stock benchmark') return ['stockLongestUs', 'moduleLongestUs', 'stockIdlePercent', 'moduleIdlePercent'].every(key => record.load?.[key] === null) && text(record.load?.method, 10) diff --git a/sdk/approvals/trusted-authors.json b/sdk/approvals/trusted-authors.json new file mode 100644 index 0000000000..8bb78f8167 --- /dev/null +++ b/sdk/approvals/trusted-authors.json @@ -0,0 +1,13 @@ +{ + "schemaVersion": 1, + "about": "Module authors the owner trusts to approve and publish their own modules' updates (src/release/author-updates.ts; docs/MODULE_AUTHOR_UPDATES.md#trusted-authors). Matched by immutable user id; each must also be in .github/module-authors.json. A listed author may sign sdk/approvals/-build-approval.json with their own login for an Octatrack module whose manifest names them as author or maintainer, and the author workflow merges it with the module's package. Only the owner changes this file: an author update that touches it goes to owner review, and a maintainer's merge of it is not approved.", + "authors": [ + { + "login": "AForceTrulyEvil", + "id": 322515174, + "approvedBy": "repeat98", + "approvedOn": "2026-12-02", + "ownerStatement": "On 2 December 2026, repeat98 asked to give some module authors his consent to push and merge their own updates, starting with AForceTrulyEvil, Grain's author, whom he had told on 1 December 2026 that they would get that permission." + } + ] +} diff --git a/src/catalog/module-qualification.test.ts b/src/catalog/module-qualification.test.ts index c49f4b3ac4..e2f92d5678 100644 --- a/src/catalog/module-qualification.test.ts +++ b/src/catalog/module-qualification.test.ts @@ -109,6 +109,12 @@ describe('module qualification hard gates',()=>{ await expect(check({...document,tests:{...document.tests,hardwareStatus:'verified'}})).rejects.toThrow('verified hardware') write({...approval,waived:['everything']}); await expect(check()).rejects.toThrow('waives only') write({...approval,approvedBy:'someone'}); await expect(check()).rejects.toThrow('owner') + // An author the owner trusts signs their own module's approval; not another module's. + const own=String(document.author.github), trusted=(login:string)=>writeFileSync(resolve(root,'sdk','approvals','trusted-authors.json'),JSON.stringify({schemaVersion:1,authors:[{login,id:1,approvedBy:'repeat98',approvedOn:'2026-12-02',ownerStatement:'Trusted.'}]})) + write({...approval,approvedBy:own}); await expect(check()).rejects.toThrow('owner') + trusted(own); expect(await check()).toBe('owner-approved-update') + trusted('someone'); write({...approval,approvedBy:'someone'}); await expect(check()).rejects.toThrow('owner') + rmSync(resolve(root,'sdk','approvals','trusted-authors.json')) write(approval); writeFileSync(resolve(folder,'manifest.py'),'changed\n'); await expect(check()).rejects.toThrow('exact native source') write({...approval,kind:'other'}); await expect(check()).rejects.toThrow('worst-case cycles') } finally { rmSync(root,{recursive:true,force:true}) } diff --git a/src/release/author-updates.test.ts b/src/release/author-updates.test.ts index 240a44e760..5c4fb50667 100644 --- a/src/release/author-updates.test.ts +++ b/src/release/author-updates.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest' -import { ACTIONS_BOT_ID, AUTHOR_RELEASE_REQUEST, AUTHOR_RELEASE_EVIDENCE, authorizeAuthorUpdate, authorReleaseEvent, authorRequestedRelease, parseAuthorRegistry, requireAuthorChecks, type AuthorChange, type AuthorModule } from './author-updates' +import { ACTIONS_BOT_ID, AUTHOR_RELEASE_REQUEST, AUTHOR_RELEASE_EVIDENCE, authorizeAuthorUpdate, authorReleaseEvent, authorRequestedRelease, mayApprove, parseAuthorRegistry, parseTrustedAuthors, requireAuthorChecks, type AuthorChange, type AuthorModule } from './author-updates' const registry = { schemaVersion: 1 as const, accounts: { devilfish707: 86663946, irpina: 264014615 } } const author = { login: 'devilfish707', id: 86663946, type: 'User' }, base = 'b'.repeat(40), head = 'a'.repeat(40) @@ -70,6 +70,33 @@ describe('module author release authority', () => { for (const extra of [{ root: 'sdk/octabam/modules/tapehead', files: [{ path: '../quantizer/a.s' }] }, { root: 'sdk/octabam/modules/quantizer', files: [{ path: 'a.s' }] }, { root: 'sdk/drafts/tapehead', files: [{ path: 'a.s' }] }, { root: 'sdk/octabam/modules/tapehead', files: [{ path: 'modules/tapehead/../../../../x' }] }]) expect(() => authorizeAuthorUpdate(registry, author, modules, [...update(), record(extra)])).toThrow('Import records') }) + it('lets only an author the owner trusts sign their own approval and ship their own Octatrack package', () => { + const trusted = parseTrustedAuthors({ schemaVersion: 1, authors: [{ login: 'Devilfish707', id: author.id, approvedBy: 'repeat98', approvedOn: '2026-12-02', ownerStatement: 'Trusted.' }] }) + const version = '0.1.3-experimental', signed = { kind: 'owner-approved-update', id: 'tapehead', version, approvedBy: 'devilfish707' } + const packages = { packages: [{ id: 'tapehead', version: document.version, path: 'octatrack-modules/tapehead/' + document.version + '.mwrm' }, { id: 'quantizer', version: '1.0.0', path: 'octatrack-modules/quantizer/1.0.0.mwrm' }], usbAudio: {} } + const shipped = { ...packages, packages: [{ id: 'tapehead', version, path: 'octatrack-modules/tapehead/' + version + '.mwrm' }, packages.packages[1]] } + const costs = { about: 'generated', stock: {}, costs: { tapehead: { first: 3 }, quantizer: { first: 1 } } } + const release = [...update(), change('sdk/approvals/tapehead-build-approval.json', { ...signed, approvedBy: 'repeat98', version: document.version }, signed), change('public/octatrack-modules/tapehead/' + version + '.mwrm', null, 'bytes'), + change('src/engine/assets/octatrack-module-packages.json', packages, shipped), change('sdk/machines/octatrack/frame-costs.json', costs, { ...costs, costs: { ...costs.costs, tapehead: { first: 2 } } })] + expect(authorizeAuthorUpdate(registry, author, modules, release, undefined, trusted)).toMatchObject({ modules: ['tapehead'], packages: true }) + // Without the owner's trust, or with another account's id under the same login, each of those files needs the owner. + for (const list of [new Map(), new Map([['devilfish707', 1]])]) expect(() => authorizeAuthorUpdate(registry, author, modules, release, undefined, list)).toThrow('Owner review') + const bad: [AuthorChange, string][] = [ + [change('sdk/approvals/tapehead-build-approval.json', null, { ...signed, approvedBy: 'repeat98' }), 'own login'], + [change('sdk/approvals/tapehead-build-approval.json', null, { ...signed, id: 'quantizer' }), 'own login'], + [change('sdk/approvals/quantizer-build-approval.json', null, { ...signed, id: 'quantizer' }), 'Owner review'], + [change('sdk/approvals/trusted-authors.json', {}, {}), 'Owner review'], + [change('public/octatrack-modules/quantizer/9.mwrm', null, 'bytes'), 'Owner review'], + [change('src/engine/assets/octatrack-module-packages.json', packages, { ...shipped, packages: [shipped.packages[0], { ...packages.packages[1], version: '9' }] }), 'other modules'], + [change('src/engine/assets/octatrack-module-packages.json', packages, { ...shipped, packages: [{ ...shipped.packages[0], path: 'octatrack-modules/quantizer/1.0.0.mwrm' }, packages.packages[1]] }), 'Stale'], + [change('sdk/machines/octatrack/frame-costs.json', costs, { ...costs, stock: { changed: true } }), 'other modules'], + ] + for (const [edit, message] of bad) expect(() => authorizeAuthorUpdate(registry, author, modules, [...update(), edit], undefined, trusted)).toThrow(message) + expect(mayApprove('Devilfish707', document, trusted)).toBe(true) + expect(mayApprove('repeat98', document, new Map())).toBe(true) + for (const [signer, doc] of [['devilfish707', modules[1].document], ['irpina', modules[1].document], [undefined, document]] as const) expect(mayApprove(signer, doc, trusted)).toBe(false) + expect(() => parseTrustedAuthors({ schemaVersion: 1, authors: [{ login: 'devilfish707', id: author.id, approvedBy: 'devilfish707', approvedOn: '2026-12-02', ownerStatement: 'Self.' }] })).toThrow('Invalid') + }) }) const run = { repository: { full_name: 'repeat98/modwerk' }, workflow_id: 12, path: '.github/workflows/module-pr.yml', event: 'pull_request', head_sha: head, status: 'completed', conclusion: 'success' } diff --git a/src/release/author-updates.ts b/src/release/author-updates.ts index 5350204fec..c058e560c9 100644 --- a/src/release/author-updates.ts +++ b/src/release/author-updates.ts @@ -1,4 +1,5 @@ -import { posix } from 'node:path' +import { readFileSync } from 'node:fs' +import { join, posix } from 'node:path' import { compareModuleVersions } from '../catalog/versions.ts' export const AUTHOR_RELEASE_REQUEST = 'Automatically merge and publish my module update after checks pass.' @@ -23,6 +24,33 @@ export function parseAuthorRegistry(value: unknown): AuthorRegistry { for (const [login, id] of Object.entries(accounts)) if (!/^[a-z0-9-]{1,39}$/.test(login) || !Number.isSafeInteger(id) || Number(id) < 1) throw new Error('Pin each module author to an immutable GitHub account ID.') return registry as AuthorRegistry } +// Authors the owner trusts to approve and release their own modules' updates (owner, 2 December 2026). The file sits under +// sdk/approvals/, so neither an author update nor a maintainer's merge can change it (release-approval.mjs GATE_PATHS). +export const TRUSTED_AUTHORS_FILE = 'sdk/approvals/trusted-authors.json' +/** The owner's trusted authors: lowercased login -> immutable account id. */ +export function parseTrustedAuthors(value: unknown) { + const file = object(value), result = new Map() + if (file.schemaVersion !== 1 || !Array.isArray(file.authors)) throw new Error('Invalid ' + TRUSTED_AUTHORS_FILE + '.') + for (const item of file.authors) { + const entry = object(item) + if (typeof entry.login !== 'string' || !/^[A-Za-z0-9-]{1,39}$/.test(entry.login) || !Number.isSafeInteger(entry.id) || Number(entry.id) < 1 || entry.approvedBy !== 'repeat98' || + !/^\d{4}-\d{2}-\d{2}$/.test(String(entry.approvedOn)) || typeof entry.ownerStatement !== 'string' || !entry.ownerStatement.trim()) throw new Error('Invalid author in ' + TRUSTED_AUTHORS_FILE + '.') + result.set(entry.login.toLowerCase(), Number(entry.id)) + } + return result +} +export function readTrustedAuthors(root: string) { + try { return parseTrustedAuthors(JSON.parse(readFileSync(join(root, TRUSTED_AUTHORS_FILE), 'utf8'))) } + catch (error) { if ((error as { code?: string }).code === 'ENOENT') return new Map(); throw error } +} +const moduleHandles = (document: Record) => [object(document.author).github, ...(Array.isArray(document.maintainers) ? document.maintainers : [])] + .filter((handle): handle is string => typeof handle === 'string').map(handle => handle.toLowerCase()) +/** Who may sign sdk/approvals/-build-approval.json: the owner, or a trusted author the module names as author or maintainer. */ +export function mayApprove(approvedBy: unknown, document: Record, trusted: ReadonlyMap) { + if (approvedBy === 'repeat98') return true + const login = typeof approvedBy === 'string' ? approvedBy.toLowerCase() : '' + return trusted.has(login) && moduleHandles(document).includes(login) +} function checked(body: unknown, text: string) { return typeof body === 'string' && body.split(/\r?\n/).some(line => /^\s*- \[[xX]\] /.test(line) && line.replace(/^\s*- \[[xX]\] /, '').trim() === text) } @@ -104,17 +132,17 @@ function authorizeVendor(vendor: AuthorVendor | undefined, changes: readonly Aut } /** Base-branch documents and registry are the authority. PR metadata never grants access. */ -export function authorizeAuthorUpdate(registry: AuthorRegistry, author: unknown, modules: readonly AuthorModule[], changes: readonly AuthorChange[], vendor?: AuthorVendor) { +export function authorizeAuthorUpdate(registry: AuthorRegistry, author: unknown, modules: readonly AuthorModule[], changes: readonly AuthorChange[], vendor?: AuthorVendor, trustedAuthors: ReadonlyMap = new Map()) { parseAuthorRegistry(registry) const account = object(author), login = typeof account.login === 'string' ? account.login.toLowerCase() : '' // An unregistered login maps to undefined, so a missing id must not match it. if (!Number.isSafeInteger(account.id) || registry.accounts[login] !== account.id || account.type !== 'User') throw new Error('This GitHub account is not a registered module author.') + const trusted = trustedAuthors.get(login) === account.id const touched = modules.filter(module => changes.some(change => change.path.startsWith(module.folder + '/'))) if (!touched.length) throw new Error('An author release must update an existing published module.') const next = new Map>() for (const module of touched) { - const handles = [object(module.document.author).github, ...(Array.isArray(module.document.maintainers) ? module.document.maintainers : [])] - if (!handles.some(handle => typeof handle === 'string' && handle.toLowerCase() === login)) throw new Error('Another author owns ' + moduleReleaseId(module) + '.') + if (!moduleHandles(module.document).includes(login)) throw new Error('Another author owns ' + moduleReleaseId(module) + '.') const manifest = changes.find(change => change.path === manifestPath(module.folder)) if (!manifest?.after || !manifest.before) throw new Error('Update the manifest and semantic version for ' + moduleReleaseId(module) + '.') const document = object(JSON.parse(manifest.after)) @@ -188,6 +216,31 @@ export function authorizeAuthorUpdate(registry: AuthorRegistry, author: unknown, packages = true continue } + // A trusted author signs their own Octatrack module's approval and ships its package, the rows of the other modules unchanged. + // shortcut: CI does not rebuild a .mwrm from source, so this rests on the owner's trust; open it to every author once it does. + const octatrackIds = new Set(touched.filter(module => module.folder.startsWith('sdk/octatrack/')).map(module => String(module.document.id))) + const signed = change.path.match(/^sdk\/approvals\/([a-z0-9-]+)-build-approval\.json$/) + if (trusted && signed && octatrackIds.has(signed[1])) { + const record = change.after === null ? null : object(JSON.parse(change.after)) + if (record && (record.kind !== 'owner-approved-update' || record.id !== signed[1] || typeof record.approvedBy !== 'string' || record.approvedBy.toLowerCase() !== login)) throw new Error('A trusted author signs only their own module\'s approval, with their own login.') + continue + } + const binary = change.path.match(/^public\/octatrack-modules\/([a-z0-9-]+)\/[^/]+\.mwrm$/) + if (trusted && binary && octatrackIds.has(binary[1])) { packages = true; continue } + const rows: Record) => Record]> = { + 'src/engine/assets/octatrack-module-packages.json': ['packages', value => ({ ...value, packages: (value.packages as unknown[]).filter(row => !octatrackIds.has(String(object(row).id))) })], + 'sdk/machines/octatrack/frame-costs.json': ['costs', value => ({ ...value, costs: Object.fromEntries(Object.entries(object(value.costs)).filter(([id]) => !octatrackIds.has(id))) })], + } + if (trusted && rows[change.path] && change.before && change.after) { + const [field, others] = rows[change.path], before = object(JSON.parse(change.before)), after = object(JSON.parse(change.after)) + if (field === 'packages' && ![before, after].every(value => Array.isArray(value.packages))) throw new Error('Invalid ' + change.path + '.') + if (!same(others(before), others(after))) throw new Error('Packages and costs of other modules require owner review.') + if (field === 'packages') for (const row of (after.packages as unknown[]).map(object).filter(row => octatrackIds.has(String(row.id)))) { + if (row.version !== next.get(String(row.id))?.version || row.path !== 'octatrack-modules/' + row.id + '/' + row.version + '.mwrm') throw new Error('Stale author module package for ' + row.id + '.') + } + packages = true + continue + } throw new Error('Owner review required for ' + change.path + '.') } return { modules: [...ids].sort(), octatrack, packages, elemod: touched.some(module => !module.folder.startsWith('sdk/octatrack/')), vendorPackages: vendorPaths.size > 0 } From 32e9c88a6e366b665c1061eef162ebbaa04eccb7 Mon Sep 17 00:00:00 2001 From: repeat98 Date: Wed, 2 Dec 2026 10:21:11 +0100 Subject: [PATCH 2/4] Improvement: the release-cost note no longer says the owner waived what a trusted author signed Co-Authored-By: Claude Opus 5.5 --- scripts/module-cpu-price.mjs | 2 +- scripts/module-cpu-price.test.mjs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/module-cpu-price.mjs b/scripts/module-cpu-price.mjs index fde7176ff4..90bc4d1e01 100644 --- a/scripts/module-cpu-price.mjs +++ b/scripts/module-cpu-price.mjs @@ -425,7 +425,7 @@ export function frameCostStatus({ root, document, glue = null }) { const problem = curveProblem(record) if (!problem) return { state: 'ok', detail: detail + '; admitted alone on the empty and the medium pattern, nothing dropped' } const strict = logged && (!date || date >= RELEASE_COST_FROM) - if (strict && releaseCostWaived({ root, document })) return { state: 'ok', detail: detail + '; ' + problem + ' (waived by the owner for this version: sdk/approvals/' + id + '-build-approval.json)' } + if (strict && releaseCostWaived({ root, document })) return { state: 'ok', detail: detail + '; ' + problem + ' (waived for this version by its approval, sdk/approvals/' + id + '-build-approval.json)' } return strict ? { state: 'fail', detail: problem, fix: frameCostHowTo(id) } : { state: 'ok', detail: detail + '; ' + problem + ' (reported, not refused, for a release dated before ' + RELEASE_COST_FROM + ')' } } diff --git a/scripts/module-cpu-price.test.mjs b/scripts/module-cpu-price.test.mjs index f13d32ebc9..39255be037 100644 --- a/scripts/module-cpu-price.test.mjs +++ b/scripts/module-cpu-price.test.mjs @@ -297,7 +297,7 @@ describe('a release of an effect or a machine carries its instance curve', () => const approval = (more = {}) => ({ 'sdk/approvals/echo-build-approval.json': { kind: 'owner-approved-update', id: 'echo', version: '0.2.0', approvedBy: 'repeat98', waived: ['current-build-hardware', 'release-cost'], ...more } }) const record = version => ({ ['sdk/octatrack/modules/echo/' + FRAME_COST_RECORD]: { module: 'echo', version, base: 'twin', measuredAt: '2026-11-24T10:00:00Z', first: 33.3, each: 33.3, points: [60, 93.3], admission: refused } }) const status = (files, document = effect('echo', '0.2.0')) => frameCostStatus({ root: fixture({ ...record('0.2.0'), ...dated('echo', '0.2.0', RELEASE_COST_FROM), ...files }), document, glue: {} }) - expect(status(approval())).toMatchObject({ state: 'ok', detail: expect.stringContaining('waived by the owner for this version') }) + expect(status(approval())).toMatchObject({ state: 'ok', detail: expect.stringContaining('waived for this version by its approval') }) expect(status({}).state).toBe('fail') expect(status(approval({ waived: ['current-build-hardware'] })).state).toBe('fail') expect(status(approval({ version: '0.1.3' })).state).toBe('fail') // an approval of another version From d690bf4ac0f36231026601b680963ef4218b0cce Mon Sep 17 00:00:00 2001 From: repeat98 Date: Wed, 2 Dec 2026 10:41:53 +0100 Subject: [PATCH 3/4] Improvement: the publication test copies the trusted-author rule modules:check now reads Co-Authored-By: Claude Opus 5.5 --- src/catalog/module-publication.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/catalog/module-publication.test.ts b/src/catalog/module-publication.test.ts index 27c30a25f9..13e3056e82 100644 --- a/src/catalog/module-publication.test.ts +++ b/src/catalog/module-publication.test.ts @@ -27,7 +27,7 @@ it('checks real PR publication changes without executing module source', async ( const failure=()=>{const result=run('--base','HEAD','--write');expect(result.status).not.toBe(0);return result.stderr} const git=(...args:string[])=>execFileSync('git',args,{cwd:root,encoding:'utf8'}) try { - for(const path of ['scripts/modules.mjs','scripts/module-cpu-price.mjs','scripts/dsp-source-gates.py','sdk/octabam/tools/build/norep.py','sdk/octabam/tools/build/nolabelprefix.py','scripts/machine-modules.mjs','src/config/usb-audio.ts','scripts/conflict-ids.mjs','scripts/zdl-binaries.mjs','src/engine/zoom/zoom-protocol.ts','src/catalog/zoom-effect-ids.ts','scripts/elemod-dependencies.mjs','scripts/change-scope.mjs','scripts/base-size.mjs','scripts/machine-folders.mjs','src/devices/machines.generated.json','scripts/module-source.mjs','scripts/synth-release.mjs','scripts/module-qualification.mjs','scripts/retained-evidence.mjs','scripts/engine-asset.mjs','scripts/module-documentation.mjs','src/catalog/module-contract.ts','src/catalog/module-contract-v3.ts','src/catalog/module-authors.ts','src/devices/machine-contract.ts','src/catalog/versions.ts','src/catalog/module-folder.ts','src/catalog/resource-impact.ts','src/devices/retired-digi-modules.ts','sdk/approvals/module-release-waivers.json']){ + for(const path of ['scripts/modules.mjs','scripts/module-cpu-price.mjs','scripts/dsp-source-gates.py','sdk/octabam/tools/build/norep.py','sdk/octabam/tools/build/nolabelprefix.py','scripts/machine-modules.mjs','src/config/usb-audio.ts','scripts/conflict-ids.mjs','scripts/zdl-binaries.mjs','src/engine/zoom/zoom-protocol.ts','src/catalog/zoom-effect-ids.ts','scripts/elemod-dependencies.mjs','scripts/change-scope.mjs','scripts/base-size.mjs','scripts/machine-folders.mjs','src/devices/machines.generated.json','scripts/module-source.mjs','scripts/synth-release.mjs','scripts/module-qualification.mjs','scripts/retained-evidence.mjs','scripts/engine-asset.mjs','scripts/module-documentation.mjs','src/catalog/module-contract.ts','src/catalog/module-contract-v3.ts','src/catalog/module-authors.ts','src/devices/machine-contract.ts','src/catalog/versions.ts','src/release/author-updates.ts','src/catalog/module-folder.ts','src/catalog/resource-impact.ts','src/devices/retired-digi-modules.ts','sdk/approvals/module-release-waivers.json']){ mkdirSync(dirname(resolve(root,path)),{recursive:true}) copyFileSync(resolve(path),resolve(root,path)) } From bf8194d76919399f040e727897cf5edc20e8df31 Mon Sep 17 00:00:00 2001 From: repeat98 Date: Wed, 2 Dec 2026 11:11:33 +0100 Subject: [PATCH 4/4] Improvement: a trusted author's update may reach new addresses without the owner Co-Authored-By: Claude Opus 5.5 --- changelog/2026-12-02-trusted-authors.md | 2 +- docs/MODULE_AUTHOR_UPDATES.md | 4 ++-- scripts/author-update-git.mjs | 6 ++++-- scripts/author-update-git.test.mjs | 9 ++++++++- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/changelog/2026-12-02-trusted-authors.md b/changelog/2026-12-02-trusted-authors.md index 7da93a5466..a9aa98db0e 100644 --- a/changelog/2026-12-02-trusted-authors.md +++ b/changelog/2026-12-02-trusted-authors.md @@ -1 +1 @@ -Improvement: the owner can trust a module author to approve and publish their own updates. A trusted author, listed in `sdk/approvals/trusted-authors.json`, signs their own Octatrack module's approval record, and the release bot merges it together with the module's package. The owner is still told about every such release, and followers still hear about it 48 hours after it goes live. +Improvement: the owner can trust a module author to approve and publish their own updates. A trusted author, listed in `sdk/approvals/trusted-authors.json`, signs their own Octatrack module's approval record, and the release bot merges it together with the module's package, new hooks included. The owner is still told about every such release, and followers still hear about it 48 hours after it goes live. diff --git a/docs/MODULE_AUTHOR_UPDATES.md b/docs/MODULE_AUTHOR_UPDATES.md index a91a61e1b1..6dfcc847bb 100644 --- a/docs/MODULE_AUTHOR_UPDATES.md +++ b/docs/MODULE_AUTHOR_UPDATES.md @@ -75,7 +75,7 @@ The publisher independently checks the bot's merge event, both merge parents, th Three safeguards cover a stolen account or a bad update, because an automatic release reaches instruments without the owner reading it first: -- **New addresses go to owner review.** If your update's source names a 32-bit address (`0x` and eight hex digits) that the published version's source never named, such as a new hook, stock routine, register or flash location, the bot does not merge it and says why on the PR. Bug fixes and tuning inside the code you already have stay automatic; about one in four past updates added hooks and would have waited for the owner. It is a tripwire, not a sandbox: an address computed at run time passes it. +- **New addresses go to owner review.** If your update's source names a 32-bit address (`0x` and eight hex digits) that the published version's source never named, such as a new hook, stock routine, register or flash location, the bot does not merge it and says why on the PR. Bug fixes and tuning inside the code you already have stay automatic; about one in four past updates added hooks and would have waited for the owner. It is a tripwire, not a sandbox: an address computed at run time passes it. A [trusted author](#trusted-authors) skips it. - **The owner is told about every automatic release.** After the merge the bot comments on the PR, mentioning the owner, with a link to the exact changes. - **Followers hear about it 48 hours after it goes live.** The site marks the release, and the community API stores a hold the first time it sees it; the hourly check queues the follower updates once the hold ends, and the daily digest timing still applies. A newer version published during the hold replaces the held one, so followers are only told about the replacement. `/modwerk resolve` works during the hold and reports no queued updates yet. @@ -85,7 +85,7 @@ Because `GITHUB_TOKEN` merges do not trigger push workflows, the author workflow ## Trusted authors -The owner can trust a registered author to approve their own updates, as he would. He lists them by numeric GitHub id, with his statement, in `sdk/approvals/trusted-authors.json`; only he changes that file. For an Octatrack module whose manifest names them as author or maintainer, a trusted author writes the module's `sdk/approvals/-build-approval.json` themselves, with their own login as `approvedBy`. Its rules are the owner's: it binds the exact version and native source, never claims verified hardware, and waives only what it lists (current-build hardware, worst-case cycles, complete memory bounds, release documentation, the medium-pattern `release-cost`). The bot then merges it with the module's package: `public/octatrack-modules//`, and the module's own rows in `src/engine/assets/octatrack-module-packages.json` and `sdk/machines/octatrack/frame-costs.json`. Everything else in the scope above, the new-address check, the owner notice and the 48-hour follower hold still apply. To withdraw the trust, the owner removes the entry. +The owner can trust a registered author to approve their own updates, as he would. He lists them by numeric GitHub id, with his statement, in `sdk/approvals/trusted-authors.json`; only he changes that file. For an Octatrack module whose manifest names them as author or maintainer, a trusted author writes the module's `sdk/approvals/-build-approval.json` themselves, with their own login as `approvedBy`. Its rules are the owner's: it binds the exact version and native source, never claims verified hardware, and waives only what it lists (current-build hardware, worst-case cycles, complete memory bounds, release documentation, the medium-pattern `release-cost`). The bot then merges it with the module's package: `public/octatrack-modules//`, and the module's own rows in `src/engine/assets/octatrack-module-packages.json` and `sdk/machines/octatrack/frame-costs.json`. A trusted author's update may also reach new addresses (a new hook or stock site) without the owner. Everything else in the scope above, the owner notice and the 48-hour follower hold still apply. To withdraw the trust, the owner removes the entry. ## Repository setup diff --git a/scripts/author-update-git.mjs b/scripts/author-update-git.mjs index f2d9d29be6..77ccbfda50 100644 --- a/scripts/author-update-git.mjs +++ b/scripts/author-update-git.mjs @@ -44,10 +44,12 @@ export function inspectAuthorUpdate(root, base, head, author) { const authorization = authorizeAuthorUpdate(registry, author, modules, changes, vendor, trusted) // An update that names a 32-bit address its published source never named (a new hook, stock routine, // register or flash location) needs owner review. shortcut: a tripwire, not a sandbox; an address built - // at run time passes, so the follower hold and the owner notice stay the safety net. + // at run time passes, so the follower hold and the owner notice stay the safety net. An author the owner trusts + // skips it (owner, 2 December 2026): their new hooks are theirs to approve. + const trustedAuthor = trusted.get(String(author?.login ?? '').toLowerCase()) === author?.id const addresses = (ref, entries, folder) => new Set([...entries.keys()].filter(path => path.startsWith(folder + '/') && /\.(c|h|s|asm|inc|cpp|py)$/i.test(path)) .flatMap(path => (text(ref, path).match(/\b0x[0-9a-f]{8}\b/gi) ?? []).map(value => value.toLowerCase()))) - for (const module of modules.filter(module => changes.some(change => change.path.startsWith(module.folder + '/')))) { + if (!trustedAuthor) for (const module of modules.filter(module => changes.some(change => change.path.startsWith(module.folder + '/')))) { const known = addresses(base, oldTree, module.folder), added = [...addresses(head, newTree, module.folder)].filter(value => !known.has(value)) if (added.length) throw new Error('New addresses in ' + module.folder + ' (' + added.slice(0, 5).join(', ') + '): reaching firmware or hardware the published version did not touch needs owner review.') } diff --git a/scripts/author-update-git.test.mjs b/scripts/author-update-git.test.mjs index d5107ce773..641397a932 100644 --- a/scripts/author-update-git.test.mjs +++ b/scripts/author-update-git.test.mjs @@ -9,7 +9,7 @@ import { ACTIONS_BOT_ID, AUTHOR_RELEASE_EVIDENCE, AUTHOR_RELEASE_REQUEST } from const roots = [], ownerId = 67785539, author = { login: 'devilfish707', id: 86663946, type: 'User' }, repository = 'repeat98/modwerk' afterEach(() => { for (const root of roots.splice(0)) rmSync(root, { recursive: true, force: true }); vi.unstubAllGlobals() }) -function fixture({ foreign = false, symlink = false, registryChange = false, source = 'fixed code\n', files = {} } = {}) { +function fixture({ foreign = false, symlink = false, registryChange = false, trusted = 0, source = 'fixed code\n', files = {} } = {}) { const root = mkdtempSync(join(tmpdir(), 'modwerk-author-policy-')); roots.push(root) const git = (...args) => execFileSync('git', args, { cwd: root, encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'] }).trim() const write = (path, data) => { mkdirSync(dirname(join(root, path)), { recursive: true }); writeFileSync(join(root, path), typeof data === 'object' ? JSON.stringify(data) + '\n' : data) } @@ -20,6 +20,7 @@ function fixture({ foreign = false, symlink = false, registryChange = false, sou write('sdk/octatrack/modules/playmodes/octamod.module.json', doc) write('sdk/octatrack/modules/playmodes/source.c', 'original code jsr 0x4000D562\n') write('sdk/octatrack/modules/playmodes/media/location.png', 'fixture only') + if (trusted) write('sdk/approvals/trusted-authors.json', { schemaVersion: 1, authors: [{ login: 'devilfish707', id: trusted, approvedBy: 'repeat98', approvedOn: '2026-12-02', ownerStatement: 'Trusted.' }] }) git('add', '.'); git('commit', '-qm', 'trusted base'); const base = git('rev-parse', 'HEAD') write('sdk/octatrack/modules/playmodes/octamod.module.json', { ...doc, version: '0.1.1-experimental' }) write('sdk/octatrack/modules/playmodes/source.c', source) @@ -62,6 +63,12 @@ describe('trusted Git object inspection', () => { const f = fixture({ source: 'fixed code jsr 0x4000d562\nmove.l d0,0xF0001234\n' }) expect(() => inspectAuthorUpdate(f.root, f.base, f.head, author)).toThrow('New addresses in sdk/octatrack/modules/playmodes (0xf0001234)') }) + it('lets an author the owner trusts reach a new address, and only that author', () => { + const source = 'fixed code jsr 0x4000d562\nmove.l d0,0xF0001234\n', check = f => inspectAuthorUpdate(f.root, f.base, f.head, author) + expect(check(fixture({ trusted: author.id, source }))).toMatchObject({ modules: ['playmodes'] }) + // The list pins the account id: the same login under another account is not trusted. + expect(() => check(fixture({ trusted: 1, source }))).toThrow('New addresses') + }) it.each([{ foreign: true }, { symlink: true }, { registryChange: true }])('rejects unsafe Git trees: %j', options => { const f = fixture(options) expect(() => inspectAuthorUpdate(f.root, f.base, f.head, author)).toThrow()