Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
6ab503e
Merge pull request #1934 from repeat98/base/analog-rytm-mkii-next
npp1993 Dec 1, 2026
38d4183
Workflow: npm run check names a base not built from this tree's sourc…
npp1993 Dec 1, 2026
288da46
Workflow: name every module without its test procedure record in one run
npp1993 Dec 1, 2026
40dacc6
Merge pull request #2510 from npp1993/workflow/runtime-base-sources
npp1993 Dec 2, 2026
9cc1ee5
Merge pull request #2512 from npp1993/workflow/procedure-records-at-once
npp1993 Dec 2, 2026
3bc8902
Docs: the Rytm's amp state stays in decay after a decay ends (#2500)
chevyone Dec 2, 2026
c991545
Docs: Rytm guide, inline-asm struct operands and the cost of a table …
chevyone Dec 2, 2026
5df9e84
Runtime loader and upload controller to GPL-2.0-or-later (rides Octat…
npp1993 Dec 2, 2026
776a968
Merge branch 'claude/runtime-gpl2' into claude/rytm-release-loader
npp1993 Dec 2, 2026
50576a6
Rytm base: release bases carry the runtime loader again, now that sdk…
npp1993 Dec 2, 2026
4410f6a
Rytm base: pin the release packages' import record to 50576a6dd
npp1993 Dec 2, 2026
93e0018
Rytm base: the last text that said release bases have no loader (LINK…
npp1993 Dec 2, 2026
f2c8d5e
Merge base/analog-rytm-mkii-next into claude/rytm-release-loader
npp1993 Dec 2, 2026
eee1129
Rytm base: pin the release packages' import record to f2c8d5eb8
npp1993 Dec 2, 2026
9e68b14
Merge base/analog-rytm-mkii-next into claude/rytm-release-loader
npp1993 Dec 2, 2026
63fb970
Rytm base: pin the release packages' import record to 9e68b1401
npp1993 Dec 2, 2026
5ada9d0
Rytm guide: the plain release base's size after the lock words joined…
npp1993 Dec 2, 2026
65892e5
Rytm base: the three release identities with the loader ran on a unit…
npp1993 Dec 3, 2026
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-01-base-sources-early.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npm run check names, in its first stage, a committed base that was not built from this tree's sources: an edit to a file the Octatrack base or an elemod base is built from (the shared `sdk/runtime` loader among them, a licence line included) is a new Octatrack base version or a new elemod identity, which the base tests found only at the end of the run.
1 change: 1 addition & 0 deletions changelog/2026-12-01-procedure-records-at-once.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
`npm run check` names every module whose TESTING.md lacks its test procedure record, or does not name its new version, in one run, instead of the first one only, so a branch that brings several new versions (a cumulative base draft marked ready) learns them all at once.
1 change: 1 addition & 0 deletions changelog/2026-12-01-runtime-loader-gpl2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Runtime loader and upload controller: their C sources (`sdk/runtime/loader`, `sdk/runtime/upload`) are now GPL-2.0-or-later, with their authors' agreement, so a base whose release set may hold GPL-2.0-only modules (the Analog Rytm MKII's) can carry the loader. Two small loader checks (an engine's price per voice, the machine's look at a rebuilt DSP image) were rewritten; they accept and refuse the same packages. The Octatrack base is built from these files, so it is rebuilt with base 0.8.6.
1 change: 1 addition & 0 deletions changelog/2026-12-01-rytm-amp-state-stays-decay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Docs: the Rytm guide says that stock's amp state stays in decay once a decay has ended, so an `ev_amp_record` entry estimates the end from the rate word instead.
1 change: 1 addition & 0 deletions changelog/2026-12-01-rytm-release-loader.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Analog Rytm MKII base: release bases carry the runtime loader again, in every variant (the release bases before them, last `442ca20c`, `b94a5ce2` and `7e4ca6c9`, left it out), now that `sdk/runtime` is GPL-2.0-or-later, so a musician's unit takes a module on trial over USB and keeps or undoes it without a reflash, as on the Octatrack. Release identities plain `a7456fa8`, voices `859c0626`, send-bus `064c4cbb`; the loader adds about 33 KB of `.run` and 108 KB of `.bss` (96 KB of it the pool and staging) in the 3.7 MiB mod area.
5 changes: 3 additions & 2 deletions docs/FRONTEND_MCP.md
Original file line number Diff line number Diff line change
Expand Up @@ -347,8 +347,9 @@ Model:Cycles; the Rytm's `cpu` is the audio block's share of its period, its
`playing` the looks the sequencer played. `device_review`, `device_trial`,
`device_keep` and `device_undo` load a runtime package on it as on the
Model:Cycles: the same link commands and runtime loader
([LINK.md](../sdk/machines/analog-rytm-mkii/LINK.md#loading-modules)); a release base
or one from before the loader refuses the review (`hello was not confirmed`). On a unit (25 November 2026, SR09 from RAM, a release build that still carried the loader): review, trial, Undo and Keep of `hello.mwrm`, the trial held by the pings
([LINK.md](../sdk/machines/analog-rytm-mkii/LINK.md#loading-modules)); a base from
before the loader, or a release base of 1 December 2026 (1d8190fa, b83aed26, 6230ee6a, then 8b2663e1, dacd67fe, b37be733 and 442ca20c, b94a5ce2, 7e4ca6c9, which left it out), refuses the review (`hello was not confirmed`). On a unit (25 November 2026, the release base
SR09 from RAM): review, trial, Undo and Keep of `hello.mwrm`, the trial held by the pings
([record](verification/2026-11-25-rytm-runtime-loader.md)). Tests run against a fake unit (`scripts/rytm-device.test.mjs`). On a unit (Nathaniel Pavel's MKII, 25
November 2026): on SR01 (a development base with the link change, RAM-booted) `device_status` gave the set identity
and named SR01's `.syx` in `--elektron-images`, `device_load` 58.5 %, `device_log` START and BASE, and
Expand Down
2 changes: 1 addition & 1 deletion docs/MACHINE_RECIPE.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Read this before you plan a core, a base or the first modules for any machine ot
| --- | --- | --- | --- | --- | --- |
| Octatrack | available | Modwerk base (beta) | done | `ot_emu` | the reference |
| Digitakt, Digitone | preview | Modwerk cores, interfaces 2.1 and 2.2 (in development, frozen) | not started | digiemu | grow the core into the base, then the loader glue (the Octatrack's ColdFire family) |
| Analog Rytm MKII | preview | Modwerk base with its own core (28 November 2026; core-ar2 0.7's interface): plain, voices with a digital voice machine (17 November 2026), or send-bus with a send effect (the site, 30 October 2026) | started: built by `npm run machine:base`, with the send bus and the FX list `mw_fx` (29 October 2026), and digital voices `mw_voices` with the hook `ev_sound_applied` (voices and send-bus variants); the plan was agreed on #878, with a SysEx link over USB MIDI: in every base since 25 November 2026 the identity with the set identity, the audio load and a diagnostics log in the Octatrack's layout (rytm-emu so far); development bases (`--dev`, since 14 November 2026) add flash, RAM boot, keys, pads and screen from [`rytm_link.py`](../sdk/machines/analog-rytm-mkii/LINK.md); every base's part ran on a unit, and the MCP's `device_status`, `device_load` and `device_log` read it; the machine page sends a build over USB (25 November 2026); development bases carry the runtime loader (release bases from when `sdk/runtime` is GPL-2.0-or-later): trial, Undo and Keep on a unit, through `rytm_link.py` and the MCP's trial tools (25 November 2026); its Status page (`#analog-rytm-mkii/unit`, beta) reads the base, the set identity, the live modules (on a development base) and the load over the link, and shares the unit's log with a member's diagnostics (25 November 2026); on a unit from the site: a release base flashed from the page with YES, its Status page and a shared log ([record](verification/2026-11-25-rytm-stack-from-the-site.md)) | rytm-emu | the base's release (base-next) |
| Analog Rytm MKII | preview | Modwerk base with its own core (28 November 2026; core-ar2 0.7's interface): plain, voices with a digital voice machine (17 November 2026), or send-bus with a send effect (the site, 30 October 2026) | started: built by `npm run machine:base`, with the send bus and the FX list `mw_fx` (29 October 2026), and digital voices `mw_voices` with the hook `ev_sound_applied` (voices and send-bus variants); the plan was agreed on #878, with a SysEx link over USB MIDI: in every base since 25 November 2026 the identity with the set identity, the audio load and a diagnostics log in the Octatrack's layout (rytm-emu so far); development bases (`--dev`, since 14 November 2026) add flash, RAM boot, keys, pads and screen from [`rytm_link.py`](../sdk/machines/analog-rytm-mkii/LINK.md); every base's part ran on a unit, and the MCP's `device_status`, `device_load` and `device_log` read it; the machine page sends a build over USB (25 November 2026); every base carries the runtime loader: trial, Undo and Keep on a unit, through `rytm_link.py` and the MCP's trial tools (25 November 2026); its Status page (`#analog-rytm-mkii/unit`, beta) reads the base, the set identity, the live modules and the load over the link, and shares the unit's log with a member's diagnostics (25 November 2026); on a unit from the site: a release base flashed from the page with YES, its Status page and a shared log ([record](verification/2026-11-25-rytm-stack-from-the-site.md)) | rytm-emu | the base's release (base-next) |
| Analog Rytm MKI | research | Modwerk base from the MKII's (its own core with the MKI's addresses and sites; sections, no send bus): its predecessor from core-ar2 0.7's source passed on a unit (8 November 2026) | started: `sdk/machines/analog-rytm-mki/elekloader/`; `npm run machine:base` needs the MKI device and ELE2, which the pinned Elekloader kit lacks | rytm-emu (MKI profile) | the MKI device and ELE2 in Modwerk's builder (`machine:base`, then `LINK_DEVICES` and the site's firmware flow) |
| Analog Four MKII | research | Modwerk beta base built from Elekloader core-a4 0.5 source | started: `npm run machine:base -- analog-four-mkii` uses the same build process as the Rytm MKII. The author reported that A4B1 worked on their unit | analog-emu | review the OS 1.56 base and its first module |
| Digitakt II | preview | Modwerk base from core-dt2 1.1's source (elekloader#221 at `0df8409`), with sequencer and project hooks | started: the site builds the [pinned base](../sdk/machines/digitakt-ii/elekloader/README.md) `8650bb8a` (`e88273ed`, which passed on one unit on 17 November 2026, with kit data ended before the project archive); downloads off. The native USB responder is not started; an [offline USB binding preflight](../sdk/machines/digitakt-ii/LINK.md) checks OS 1.17 and base patch overlap | digikit (emulator only) | the exact build on a second unit, then the USB link ([goal](../sdk/machines/digitakt-ii/GOAL.md)) |
Expand Down
2 changes: 1 addition & 1 deletion docs/verification/2026-12-01-rytm-base-next-own-core.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Main (Modwerk's own Rytm core, #2399, and its firmware builder, #2425) merged in

## Release bases without the runtime loader, later the same day

Release bases now leave the runtime loader out (`sdk/runtime` is GPL-3.0-or-later; development bases keep it): release identities plain `1d8190fa`, voices `b83aed26`, send-bus `6230ee6a`. A release image RAM-boots from the development base in flash, which hands over to it; the agent read it over the link a release base answers. Nobody pressed a key (a first attempt was refused while the unit reported a person at it; it booted once the user kept hands off).
Release bases then left the runtime loader out (`sdk/runtime` was GPL-3.0-or-later; development bases kept it; it came back to every release base with the GPL-2.0-or-later relicensing, `changelog/2026-12-01-rytm-release-loader.md`): release identities plain `1d8190fa`, voices `b83aed26`, send-bus `6230ee6a`. A release image RAM-boots from the development base in flash, which hands over to it; the agent read it over the link a release base answers. Nobody pressed a key (a first attempt was refused while the unit reported a person at it; it booted once the user kept hands off).

| Check | Build | Result |
|---|---|---|
Expand Down
65 changes: 65 additions & 0 deletions scripts/base-sources.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
// SPDX-License-Identifier: GPL-3.0-or-later
// Whether the committed bases were built from the sources in this tree. The Octatrack base records the SHA-256 of every
// file it is built from (src/engine/assets/octatrack-base-sources.json, the shared sdk/runtime folders among them), and
// each elemod base's package records its C sources (build.sources). An edit there, a licence line included, means a new
// base: for the Octatrack a new version, its base-bound packages relinked; for an elemod machine a new identity. The
// Octatrack base test finds it too, but late in the run; this names it in npm run check's first stage, beside the base
// size and the base-bound packages (scripts/base-size.mjs, scripts/base-bound.mjs).
//
// node scripts/base-sources.mjs Base sources: the Octatrack base and 4 elemod bases match this tree
import { createHash } from 'node:crypto'
import { existsSync, readFileSync, readdirSync } from 'node:fs'
import { basename, join } from 'node:path'
import { fileURLToPath } from 'node:url'

export const OCTATRACK = 'src/engine/assets/octatrack-base-sources.json'
const sha = path => createHash('sha256').update(readFileSync(path)).digest('hex')
const listed = (paths, most = 4) => paths.slice(0, most).join(', ') + (paths.length > most ? ` and ${paths.length - most} more` : '')
const OT_FIX = 'that is a new Octatrack base: raise sdk/machines/octatrack/elekloader/base-version.json, run npm run octatrack:base -- ' +
'--stock OS.bin --beta --write (it needs dsp_asm and dsp56kDisassemble: ELEKLOADER_DSP_ASM) and npm run base-size -- --write, then ' +
'relink its base-bound packages. A base release is the owner\'s work on base/octatrack-next (docs/DEVELOPER_WORKFLOW.md#change-a-base); ' +
'a change one machine needs can usually stay out of the shared files'

/** The Octatrack base's stale paths: a recorded file changed or gone, or a new file in a folder it scans (build_core.py's scan). */
export function octatrackStale(root) {
const file = join(root, OCTATRACK)
if (!existsSync(file)) return null
const { folders, sources } = JSON.parse(readFileSync(file, 'utf8'))
const scanned = folders.filter(folder => existsSync(join(root, folder))).flatMap(folder => readdirSync(join(root, folder), { withFileTypes: true })
.filter(entry => entry.isFile() && /\.(c|h|s|asm|py|json)$/.test(entry.name)).map(entry => folder + '/' + entry.name))
return [...Object.keys(sources).filter(path => !existsSync(join(root, path)) || sha(join(root, path)) !== sources[path]),
...scanned.filter(path => !(path in sources))]
}

/** Each elemod machine whose bound base package records a shared sdk/runtime C source this tree no longer has as built. */
export function elemodStale(root) {
const machines = join(root, 'sdk/machines')
if (!existsSync(machines)) return []
const out = []
for (const machine of readdirSync(machines)) {
const config = join(machines, machine, 'elekloader/base.json'), bindingFile = join(machines, machine, 'base-binding.json')
if (!existsSync(config) || !existsSync(bindingFile)) continue
const base = JSON.parse(readFileSync(config, 'utf8')), identity = JSON.parse(readFileSync(bindingFile, 'utf8')).identity ?? ''
const shared = ['common', 'add'].flatMap(part => Object.values(base[part]?.shared ?? {}).flat()).filter(path => path.endsWith('.c'))
const pkg = join(root, 'sdk/imports/packages', 'modwerk-base-' + machine, `modwerk-base-${machine}-${identity.slice(0, 8)}.elemod`)
if (!shared.length || !existsSync(pkg)) continue
const built = JSON.parse(readFileSync(pkg, 'utf8')).build?.sources ?? {}
const stale = shared.filter(path => basename(path) in built && (!existsSync(join(root, path)) || sha(join(root, path)) !== built[basename(path)]))
if (stale.length) out.push({ machine, identity, stale })
}
return out
}

/** npm run check: the line, or an error naming each base that is no longer built from this tree and what that takes. */
export function checkBaseSources(root) {
const ot = octatrackStale(root), elemod = elemodStale(root), problems = []
if (ot?.length) problems.push(`The committed Octatrack base was built from other sources than ${listed(ot)}: ${OT_FIX}.`)
for (const { machine, identity, stale } of elemod)
problems.push(`The committed ${machine} base ${identity.slice(0, 8)} was built from another ${listed(stale)}: npm run machine:base -- ${machine} --stock OS.syx --write rebuilds it as a new identity, then swap and pin its packages (the machine's elekloader/README.md).`)
if (problems.length) throw new Error(problems.join(' '))
return ot === null && !elemod.length ? 'Base sources: no base record in this tree' : 'Base sources: the committed bases match this tree'
}

if (process.argv[1] === fileURLToPath(import.meta.url)) {
try { console.log(checkBaseSources(fileURLToPath(new URL('..', import.meta.url)))) } catch (error) { console.error(error.message); process.exitCode = 1 }
}
44 changes: 44 additions & 0 deletions scripts/base-sources.test.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs'
import { createHash } from 'node:crypto'
import { tmpdir } from 'node:os'
import { join } from 'node:path'
import { afterEach, expect, it } from 'vitest'
import { checkBaseSources, elemodStale, octatrackStale } from './base-sources.mjs'

const sha = text => createHash('sha256').update(text).digest('hex')
let root
afterEach(() => rmSync(root, { recursive: true, force: true }))
/** A tree with a shared loader.c, the Octatrack's record of it, and one elemod machine's base package that compiled it. */
function tree(loader = 'int a;\n') {
root = mkdtempSync(join(tmpdir(), 'base-sources-'))
const write = (path, text) => { mkdirSync(join(root, path, '..'), { recursive: true }); writeFileSync(join(root, path), text) }
write('sdk/runtime/loader/loader.c', loader)
write('src/engine/assets/octatrack-base-sources.json', JSON.stringify({ folders: ['sdk/runtime/loader'], sources: { 'sdk/runtime/loader/loader.c': sha('int a;\n') } }))
write('sdk/machines/model-cycles/elekloader/base.json', JSON.stringify({ common: { shared: { base: ['sdk/runtime/loader/loader.c'] } }, dev: { shared: { base: [] } } }))
write('sdk/machines/model-cycles/base-binding.json', JSON.stringify({ identity: 'dda53ffd' + '0'.repeat(56) }))
write('sdk/imports/packages/modwerk-base-model-cycles/modwerk-base-model-cycles-dda53ffd.elemod', JSON.stringify({ build: { sources: { 'loader.c': sha('int a;\n') } } }))
return write
}

it('passes a tree the committed bases were built from', () => {
tree()
expect(checkBaseSources(root)).toBe('Base sources: the committed bases match this tree')
})

it('names the Octatrack base release and the elemod rebuild when a shared source changes, a licence line included', () => {
tree('// SPDX-License-Identifier: GPL-2.0-or-later\nint a;\n')
expect(octatrackStale(root)).toEqual(['sdk/runtime/loader/loader.c'])
expect(elemodStale(root)).toEqual([{ machine: 'model-cycles', identity: 'dda53ffd' + '0'.repeat(56), stale: ['sdk/runtime/loader/loader.c'] }])
expect(() => checkBaseSources(root)).toThrow(/new Octatrack base: raise .*base-version\.json.*owner's work.*model-cycles base dda53ffd/s)
})

it('names a new file in a folder the Octatrack base scans', () => {
const write = tree()
write('sdk/runtime/loader/extra.h', '')
expect(octatrackStale(root)).toEqual(['sdk/runtime/loader/extra.h'])
})

it('says so when the tree has no base record (a partial checkout)', () => {
root = mkdtempSync(join(tmpdir(), 'base-sources-'))
expect(checkBaseSources(root)).toBe('Base sources: no base record in this tree')
})
6 changes: 6 additions & 0 deletions scripts/check.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { performance } from 'node:perf_hooks'
import { fileURLToPath } from 'node:url'
import { stripVTControlCharacters } from 'node:util'
import { checkBaseBound } from './base-bound.mjs'
import { checkBaseSources } from './base-sources.mjs'
import { checkBaseSize } from './base-size.mjs'
import { readChangeScope } from './change-scope.mjs'
import { affectedTests, filesForShard, planPrChecks } from './pr-check-plan.mjs'
Expand Down Expand Up @@ -177,6 +178,11 @@ if (!buildOnly && !suiteOnly && !documentationOnly && passed && (!scope || scope
try { console.log(checkBaseSize(root)) } catch (error) { problem('Base size', 'Base size: ' + error.message); passed = false }
try { console.log(checkBaseBound(root)) } catch (error) { problem('Base bound', error.message); passed = false }
}
// Whether the committed bases were built from this tree's sources (scripts/base-sources.mjs): an edit to a file a base is built
// from, sdk/runtime's shared loader among them, is a new base for every machine that compiles it, which the tests find late.
if (!buildOnly && !suiteOnly && !documentationOnly && passed) {
try { console.log(checkBaseSources(root)) } catch (error) { problem('Base sources', error.message); passed = false }
}
// Finish generated notice/catalog/media writes before lint, tests, typecheck or bundling read them.
// The bundle imports the generated media too, so a frontend-only change needs the writes as much as a module change does.
if (passed && !documentationOnly && (plan.metadata || plan.bundle)) passed = await run('licenses:generate') && await run('machines:generate') && await run('modules:generate')
Expand Down
Loading
Loading