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-procedure-retest-unreleased-listed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Development: `npm run test:procedure` can re-test a listed module whose code changed after its qualification, before it is published (same version, an earlier source in its record). Step 1 now runs `module:doctor -- --procedure` for it, as for an update, and the record is rewritten from the run with `module:qualify -- <id> --procedure DIR --write`. Before, the module had to be moved back to `sdk/drafts/` and listed again. The plain `module:doctor` still fails a stale record.
2 changes: 1 addition & 1 deletion docs/TEST_PROCEDURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Each step proves only what it ran. Steps 1 to 5 prove the code paths they exerci

- **1-2.** The doctor runs the module's host tests, the contract, the performance record and the compatibility lines. A draft is judged beside every other module by the doctor itself.
- **1, a base.** Run it with the m68k-elf toolchain on PATH and the Elekloader checkout `npm run upstream:tools` keeps: without them `sdk:check` skips every package rebuild, as CI's SDK job does, so a stale reviewed recipe goes unseen. A failure there is the change's to fix, not the computer's (20 November 2026: Tape Echo's and Euclid's standalone recipes had gone stale on main).
- **A first release runs this as a draft.** Listed, a module's step 1 is the release doctor, which wants the price and curve this run measures; `module:qualify` writes them in (Midiverb, 25 November 2026). An update of a listed module runs step 1 as `module:doctor -- --procedure <id>`: its qualification record still names the version before it, which `module:qualify -- <id> --procedure DIR --write` replaces from this run (Midiverb 0.2.0, 27 November 2026). Its price and curve wait for the run too: step 9 measures them and `module:qualify` records them (Loopbox 0.1.1, 3 December 2026).
- **A first release runs this as a draft.** Listed, a module's step 1 is the release doctor, which wants the price and curve this run measures; `module:qualify` writes them in (Midiverb, 25 November 2026). An update of a listed module runs step 1 as `module:doctor -- --procedure <id>`: its qualification record still names the version before it, which `module:qualify -- <id> --procedure DIR --write` replaces from this run (Midiverb 0.2.0, 27 November 2026). So does a listed first release whose code changed after its qualification, before it was published: its record names an earlier source of the same version (Glitchbox, 2 December 2026). Their price and curve wait for the run too: step 9 measures them and `module:qualify` records them (Loopbox 0.1.1, 3 December 2026).
- **3. A rebuild starts again at step 1.** The record names the source revision (and says when the tree had uncommitted changes) and the package's SHA-256. Every later result is about this build only. A draft DSP module with no published figures is built with the builder's placeholders (600 modeled cycles, buffer 0), which the loader refuses at verify with refusal 6, `RUNTIME_CYCLES` (Ghost Cut, 21 November 2026), and the runner takes no figures. Build it yourself with the measured ones and hand it over: `npm run module:dev -- <id> --build-only --cycles N --cycles-kind modeled --state N --buffer N --out PKG`, then `--package PKG`. `--buffer` is the Y words of the slot buffer the effect reads.
- **4.** The check fails a cycle-scan record whose module source changed since its scan. After changing a module's DSP code, scan it again on a computer with the scan's tools: `node scripts/cycle-scan.mjs record <id>` ([sdk/cycle-scan](../sdk/cycle-scan/README.md), [MODULE_PERFORMANCE.md](MODULE_PERFORMANCE.md)).
- **5.** The runner starts `ot_emu` on a development twin of the base and a session on it ([below](#one-set-of-cases-two-targets)), runs the commands of steps 6, 7 and 10 there, and stops both, so a fault shows before any unit time. It needs [the adapted `ot_emu`](../scripts/octatrack-emulator/README.md) (the plain port refused the trial with loader refusal 5, 20 November 2026) and a twin's build folder, both outside Git: set `MODWERK_OT_EMU` and `MODWERK_OT_TWIN` once in your shell profile, or pass `--emulator` and `--twin`. Without them the step is not run and says which is missing. A failure there stops the procedure before the unit (`--no-emulator` skips the step); a session that does not start leaves it not run. A package with DSP code, and a base, run with `--dsp`; a ColdFire module without, about ten times faster. What passes here can still fail on the unit: read [what `ot_emu` does not show](OCTATRACK_HARDWARE_TRAPS.md#the-emulator-and-the-tools). It does not show a pick the unit refuses for load (CPU FULL), since the emulator measures none ([below](#one-set-of-cases-two-targets)): Mackity's refusal on a busy eight-track pattern (25 November 2026) showed only on the unit. Build the twin with `build_core.py --dev` and the beta flags; on main it links only with `--resident-stock-hooks --resident-on-demand` among them, and without them stops at "Core has unexpected unresolved imports" (the arena, bss and run symbols and the `ev_` hooks). This set linked on 21 November 2026: `--dsp-loader --dev --usb-midi --packaged-usb-audio --site-events --table-owners sdk/machines/octatrack/module-adapters/table-owners.json --resident-stock-hooks --resident-on-demand --cached-modules --module-sets --sample-editor --module-ui-roots --part-menu`, with `ELEKLOADER_DSP_ASM` naming `dsp_asm` in the `dsp56300` build tree and `dsp56kDisassemble` built beside it.
Expand Down
8 changes: 5 additions & 3 deletions scripts/module-doctor.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -259,13 +259,15 @@ function octatrack(id) {
// The release record against the source it was tested on, and drafted words nobody has read yet (npm run module:qualify).
const qualified = qualifyChecks.get(id) ?? []
// In the test procedure an update's record still names the version before it: the run's own evidence replaces it (Midiverb 0.2.0, 27 November 2026).
const recordWaits = procedure && document.tests.qualification?.moduleVersion !== document.version
// So does a first release whose code changed after its qualification, before it was published: same version, an earlier source.
const update = document.tests.qualification?.moduleVersion !== document.version, sourceOnly = qualified.length > 0 && qualified.every(problem => problem.stale)
const recordWaits = procedure && (update || sourceOnly)
const waits = 'waits for this run: npm run module:qualify -- ' + id + ' --procedure DIR --base TEXT --write'
if (qualified.length && recordWaits) info('qualification', 'the record is ' + document.tests.qualification?.moduleVersion + '\'s, ' + waits)
if (qualified.length && recordWaits) info('qualification', (update ? 'the record is ' + document.tests.qualification?.moduleVersion + '\'s, ' : 'the record names an earlier source of this version, ') + waits)
else if (qualified.length) fail('qualification', qualified.map(problem => problem.detail).join('; '), qualified[0].fix)
else if (document.tests.qualification) ok('qualification', 'bound to this source, nothing left drafted (npm run module:qualify -- ' + id + ' --check)')

if (rulesProblem && recordWaits && rulesProblem.startsWith(id + '.tests.qualification.moduleVersion:')) info('module rules', 'npm run modules:check stops at this record, which ' + waits)
if (rulesProblem && recordWaits && (rulesProblem.startsWith(id + '.tests.qualification.moduleVersion:') || (!update && rulesProblem.startsWith(id + ': qualification source SHA-256 differs')))) info('module rules', 'npm run modules:check stops at this record, which ' + waits)
else if (rulesProblem) fail('module rules', 'npm run modules:check fails: ' + rulesProblem.slice(0, 220), 'fix what it names, then run npm run modules:check -- --base origin/main')
else ok('module rules', 'versions, documentation, tutorial, screenshots, qualification, resource gauges (npm run modules:check)')

Expand Down
2 changes: 1 addition & 1 deletion scripts/module-qualify.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ export async function qualifyProblems({ root, folder, document, nativeSha, evide
const now = nativeSha ?? await moduleNativeSourceSha256(folder, document)
if (now !== q.sourceSha256) {
const since = q.hardware?.sourceRevision && changedSince(root, folder, q.hardware.sourceRevision)
problems.push({ detail: 'tests.qualification.sourceSha256 is ' + short(q.sourceSha256) + ', the source now hashes to ' + short(now) +
problems.push({ stale: true, detail: 'tests.qualification.sourceSha256 is ' + short(q.sourceSha256) + ', the source now hashes to ' + short(now) +
(since ? '; changed since the tested commit ' + short(q.hardware.sourceRevision) + ': ' + ([...since.changed, ...since.removed.map(path => path + ' (removed)')].join(', ') || 'nothing but the manifest') : ''),
fix: 'if only evidence, presentation or other files that are not code changed: npm run module:qualify -- ' + id + ' --rehash --write; if code changed, run the test procedure again and npm run module:qualify -- ' + id + ' --procedure DIR --write' })
}
Expand Down
8 changes: 7 additions & 1 deletion scripts/test-procedure.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import { pathToFileURL } from 'node:url'
import { emulatorArgs, sessionEnv, sessionSockets, startSession } from './octatrack-emulator/session.mjs'
import { bankPrograms } from './octatrack-part-state.mjs'
import { hasInstances } from './octatrack-price.mjs'
import { moduleNativeSourceSha256 } from './module-qualification.mjs'

export const ROOT = resolve(import.meta.dirname, '..')

Expand Down Expand Up @@ -187,7 +188,9 @@ function machinePlan(step, ctx) {
return { skip: (GAP[step.id] ?? GAP.unit)(name) }
}

const updateOf = ctx => !!ctx.manifest?.tests?.qualification && ctx.manifest.tests.qualification.moduleVersion !== ctx.manifest.version
// A listed module whose record the run replaces: an update (the record names the version before it), or a first release
// whose code changed after its qualification, before it was published (recordStale: the record names an earlier source).
const updateOf = ctx => !!ctx.manifest?.tests?.qualification && (ctx.manifest.tests.qualification.moduleVersion !== ctx.manifest.version || !!ctx.recordStale)

/** The commands each step runs for this target, or why it is not run. Pure: everything it reads is in ctx. */
export function plan(step, ctx) {
Expand Down Expand Up @@ -685,6 +688,9 @@ async function main() {
}
let ctx
try { ctx = context(ROOT, values, positionals) } catch (error) { console.error(error.message); process.exit(2) }
// A listed module's record covers an earlier source of this version (a first release changed after its qualification).
const tested = ctx.kind === 'module' && !ctx.draft && ctx.machine === 'octatrack' && ctx.manifest?.tests?.qualification, listedFolder = tested && join(ROOT, 'sdk/octatrack/modules', ctx.id)
if (tested && existsSync(listedFolder)) ctx.recordStale = (await moduleNativeSourceSha256(listedFolder, ctx.manifest)) !== tested.sourceSha256
const deps = realDeps(ROOT)
if (values['unit-phase']) {
// One turn of the unit queue: only the unit steps, their results for the run that started it.
Expand Down
6 changes: 6 additions & 0 deletions scripts/test-procedure.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,12 @@ describe('every machine', () => {
expect(plan(STEPS[0], moduleCtx({ draft: true, manifest: manifest('0.2.0', '0.1.0') })).commands).toEqual([['npm', 'run', 'module:doctor', '--', '--draft', 'vibrato']])
})

it('runs step 1 with --procedure for a listed first release whose code changed after its qualification', () => {
const manifest = { version: '0.1.0-experimental', tests: { qualification: { moduleVersion: '0.1.0-experimental' } } }
expect(plan(STEPS[0], moduleCtx({ manifest, recordStale: true })).commands).toEqual([['npm', 'run', 'module:doctor', '--', '--procedure', 'vibrato']])
expect(plan(STEPS[0], moduleCtx({ manifest, recordStale: false })).commands).toEqual([['npm', 'run', 'module:doctor', '--', 'vibrato']])
})

it('names what a machine still lacks for each step it has no tool for, and what to pass for the build', () => {
const ctx = moduleCtx({ id: 'track-names', machine: 'digitakt-ii', machineName: 'Digitakt II', platform: 'elemod', cases: [] })
expect(plan(STEPS[0], ctx).commands).toEqual([['npm', 'run', 'module:doctor', '--', 'track-names']])
Expand Down
Loading