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
1 change: 1 addition & 0 deletions changelog/2026-12-02-trusted-authors.md
Original file line number Diff line number Diff line change
@@ -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, new hooks included. The owner is still told about every such release, and followers still hear about it 48 hours after it goes live.
10 changes: 7 additions & 3 deletions docs/MODULE_AUTHOR_UPDATES.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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/<machine>/modules/<id>/` and keep its original authors and licences. Include the fix's changelog update in your module’s `src/community/module-changelogs/<id>.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-<id>-<date>.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 <your-login>` 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:

Expand All @@ -75,14 +75,18 @@ 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.

Keep two-factor authentication on your GitHub account while you are in `.github/module-authors.json`. GitHub cannot show the owner whether it is on, so this is a condition of registration rather than a check.

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/<id>-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/<id>/`, 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

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.
Expand Down
11 changes: 7 additions & 4 deletions scripts/author-update-git.mjs
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -40,13 +40,16 @@ 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.
// 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.')
}
Expand Down
9 changes: 8 additions & 1 deletion scripts/author-update-git.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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) }
Expand All @@ -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)
Expand Down Expand Up @@ -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()
Expand Down
5 changes: 3 additions & 2 deletions scripts/module-cpu-price.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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 +
Expand All @@ -424,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 + ')' }
}
Expand Down
2 changes: 1 addition & 1 deletion scripts/module-cpu-price.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading
Loading