Skip to content

fix(workbench): restore module calibration on runtime 0.17 - #989

Open
m-dwyer wants to merge 5 commits into
mainfrom
fix/module-calibration-route
Open

m-dwyer wants to merge 5 commits into
mainfrom
fix/module-calibration-route

Conversation

@m-dwyer

@m-dwyer m-dwyer commented Dec 6, 2026 •

Copy link
Copy Markdown
Collaborator

Symptoms, causes, fixes

All four trace to one cause: wb profile calibrate run (and so module:cost) installed modules from the desktop app's out/modules/<device>/, which only the desktop app writes, and it ran with no declared prerequisites.

  • ASCEND -48 (E_CONTRACT). out/modules/dt2/digikit/ascend.dkm was packed on 9 Nov (header runtime 0.13, no header table). The 0.17 loader refuses a file with no table (runtime/core/abi/src/keys.rs:206); introduced by the table/format work behind 6db16dd (runtime 0.17). Fix: calibrate packs the modules it installs, and the debug module, with patchkit pack into <out>/library and installs from there (tools/devtools/wb_calibrate.mjs).
  • services/fx.dks deleted as unused. Not a bug in the sweep: removeUnusedServices (install.ts) deletes services no .dkm on the card hard-needs. The stale ASCEND file read as a module with no needs (readNeeds gives [] without a table), so nothing needed fx. Fix: resolveServices now refuses such a module with kind no-table (tableProblem in services.ts, text in transfer-core.ts) instead of installing it with no needs. Applies to every install path.
  • Pluck unknown-hash for machines. NodeHost reads services from dist/modules/<device>/*.dks, which services:pack fills; module:cost did not depend on it (transfer does), so a fresh lane had no machines.dks. Fix: module:cost depends on services:pack, wasm:patchkit, wasm:dkprof (mise-tasks.toml).
  • ASCEND had no calibration.toml. Added (modules/fx/digikit/ascend/calibration.toml, step play-module-effect). Its effect case needs no prepared project: it only checks the running route and dispatch row.

Not done: setting a module machine parameter from a case

Left open on purpose. MIDI CC/NRPN are ignored for added parameters (MODULE-AUTHORING 5.7); the debug module has no write path (parameter-observer.c only reads, SETUP sets track types). A write needs a new firmware-facing setter in the runtime platform (per device, 1.17 and 1.12) and a new debug command: a design and ports decision, not a calibration-tool change. Until then the existing key and turn steps (remote module) move a knob relatively on both emulator and device.

Tests

  • services.test.ts: a module with no readable header table is refused (no-table), the others still resolve.
  • calibration-profile.test.ts: no pin of the case or profile names (repo data against itself); every file still parses and resolves.
  • dkaddrmap the_dsp_lengths_sit_after_the_offsets_of_the_providers_too: a load table in the 0.17 shape gives the module its dsp_base.

Review findings fixed

  1. wb_calibrate.mjs packs only ids that are repository modules (modules/*/<id>/module.toml), once per run (packedIds); firmware, platform and remote modules are skipped as before.
  2. The install checks the patchkit binary up front (patchkitBinary() names nx run patchkit:cli); the not-packed message names the packer builds again (the wasm was already read before).
  3. calibration-profile.test.ts: dropped the pinned case and profile name lists.

Credit cause

DKRT_DSP holds mod_off[REC_MAX] then mod_len[REC_MAX], REC_MAX = module slots + provider slots (8 + 12). decode_loads read the lengths at 4 * modules + slot, so a module read a provider's offset as its length: Pluck got length 0 (no dsp_base, so its pcs were not placed), debug got a bogus one. Fixed at the owner (packages/dkaddrmap/src/snapshot.rs): reads and decode use modules + providers records. The load-table timing and owner-name leads were not the cause.

module:cost, DT2, daemon with sharc-profile (after the fix)

digikit/pluck on dt2, one voice
SHARC rig, case limits/all-default/note0, 3 blocks: 905.0 instructions per block
Emulator, calibration case pluck, 3 captures
  DSP row 0 (machine): 793.4 instructions per block, 5,899 calls
  credited by address (load table and map): 611.6 per block over 7631 blocks   (was 0.0)

Gate

  • mise run test:changed: unit and static tasks passed (27); two load timeouts (web-transfer ready-cache, desktop-host about-board, 5 s on a host at load 160) passed on rerun of those files; rig preflight 17 halves, 0 problems.
  • Device proof printed by test:changed, run once: pnpm nx:pilot run-many -t test-conformance -p digikit/ascend: pass (76 tasks, 382 s).
  • After the fixes: test:changed unit and static tasks passed (38), rig preflight 0 problems; device proof run-many -t smoke,pins,test-conformance -p gate-smoke,gate-pins,digikit/ascend: pass (80 tasks, 321 s).
  • test:all is not run; the merge gate selection is left to the queue.

🤖 Generated with Claude Code

m-dwyer and others added 5 commits December 6, 2026 19:58
Calibration read its modules from the app's out/modules, which only the
desktop app writes: a file there from an older packer (ASCEND, runtime
0.13, no header table) read as a module with no needs, so the install
resolved no services, deleted services/fx.dks as unused and the loader
refused the file with E_CONTRACT (-48).

- wb profile calibrate run packs the modules it installs (the debug module
  included) with patchkit into <out>/library and installs from there.
- install refuses a module whose header table cannot be read (no-table)
  instead of treating it as a module with no needs.
- module:cost depends on the service pack and the two wasm files, like
  transfer does for the services.
- add the calibration case of digikit/ascend.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…_DSP

Runtime 0.17 sizes the DSP placement table by every record (module and
provider slots), so the lengths of the module slots sit after the offsets of
the provider slots. The decoder read them 8 words in: a module got no
dsp_base (Pluck) or a provider's range (debug), and module:cost credited
~0 instructions by address.

- reads and decode use modules + providers records
- test of the 0.17 table shape

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ker first

- calibration packs the ids that are modules of this repository, once per
  run; a firmware, platform or remote module is left as it is
- the install checks the patchkit binary up front (the error names its
  build command)
- calibration-profile test: drop the pins of the case and profile names

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant