Repository navigation
Conversation
…onger undoes with another pattern's data Kits treated the same paste or clear repeated on a pattern as an undo and wrote stock's shared undo buffer back, without knowing whether stock had refilled that buffer since. A stock pattern copy, paste or clear in between (or another stock edit with an undo) put another pattern's trigs and Part byte into the target (reproduced in ot_emu). Kits now keeps a CRC-32 of the undo buffer after its snapshot and the target as bank * 16 + pattern, and undoes only while both still match. A pattern copy forgets the pending undo, as stock's copy does, and a PTN+TRIG without FUNC forgets the PTN+FUNC+TRIG target. Emulator only; the owner tests the exact build on a unit. Owner waiver, 30 Nov 2026, in place of the author's OK. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The same bug is in octabam's own Kits (same lines in its current 🤖 Generated with Claude Code |
|
Checks on Next: the owner runs package Suggested approval record, if the owner chooses that route (not committed)
🤖 Generated with Claude Code |
|
@twwwy, a short question for you about Kits, also waiting in your Modwerk agent board inbox (thread ce1d433e-3bc4-4bf5-9887-3caf77c1b78c): Your board claim on octatrack/kits still names 0.1.1's Part Edit rows (SAVE KIT in the shared Part Edit menu), which shipped in #2066. Are you still working on something under that claim, or can it be released? This pull request (Kits 0.1.2, made on the owner's waiver) changes only the undo of a repeated PTN+FUNC+TRIG paste or clear, the pattern copy and the PTN+FUNC+TRIG target. Nothing in your Part Edit rows changes. A reply here or on the board is fine. |
What was broken: with Kits 0.1.1, repeating a PTN+FUNC+TRIG paste or clear on a pattern is an undo. If you did a stock pattern copy, paste or clear in between (or another stock edit that has an undo), that "undo" wrote another pattern's trigs and Part into the target. Musically: you meant to paste or get your pattern back, and the pattern silently became a different one. Reproduced in the emulator; a tester lost patterns with 0.1.1, not yet tied to this, and this may be related to #2439.
What works now: the same paste or clear repeated right away still undoes it. After anything else that refills the Octatrack's undo memory, the repeat simply pastes or clears again, and a new pattern copy means the next paste pastes, as on a stock Octatrack.
Tested where: emulator only (
ot_emu), before and after, on the same base twin. Not tested on a unit. This stays a draft until the owner has run this exact package (84f4c5c8…) on his unit.Who acts next: the owner (repeat98): a unit test of package
84f4c5c8…, then the version approval or hardware evidence thatmodule:doctorasks for (below). Author's OK: owner waiver, 30 Nov 2026 (in place of Ask the author first). Sam Banks' and Em's credit is unchanged.The fix, the code reading and the emulator results
Cause. Kits kept only the op and the pattern of its last PTN+FUNC+TRIG paste or clear and restored stock's undo buffer (
0x460bf218) through0x4002b9b0when they matched. In OS 1.40C about two dozen routines between0x40026768and0x4002c166fill that buffer and write stock's undo record (0x460c80f0/f4/f8); only the pattern paste and clear go through0x40026ef0(Kits'kits_psnapsite), and the pattern copy (0x40026eb0) clears the record without touching the buffer. So a reset inkits_psnapalone would have fixed the two reported cases and left the rest.Fix (
sdk/octatrack/modules/kits/kits.s):inactive_op(~1400-1438): after its snapshot Kits stores the CRC-32 of the undo buffer (its owncrc32) and the target as bank * 16 + pattern; a repeat undoes only when op, bank, pattern and CRC still match, otherwise it pastes or clears again. The bank in the target also closes a bank change between two ops (by reading; not run, see below).kits_pcopy(~1100): a pattern copy, stock's or Kits', forgets the pending undo.kits_ptrig(~1362): a pattern trig with PTN but without FUNC forgets PTN+FUNC+TRIG's target, so an old target is not reused.PUNDO_SUMadded afterPTGT/PUNDO_OP/PUNDO_T.A first attempt that called stock's own repeat-is-undo check (
0x4002ba2c) was dropped: Kits' clear (eight0x40039df4track clears) leaves stock's undo record zeroed, and the control case failed with it.Emulator,
ot_emu --frame(not hardware): base twin MAIN276500fc…(build_core.pybeta flags +--dev, source724dba4cc), TEMPLATE project, Kits installed alone (device try --accept), bank A patterns 1-8 with trigs, transport stopped; each check read bank A's patterns, Part bytes and Kits' state overpeek.c1cb63e584f4c5c8Package:
npm run module:dev -- kits --build-onlyandnpm run octatrack:module-packagesgive the same84f4c5c89a98dce4…(13,654 bytes; 11,340 of code and data, 38,968 of bss). TESTING.md has the full record.Upstream: octabam's current
modules/kits/kits.s(e7452f9b) has the same code at lines 1283 and 1321-1342. Following Kits' AGENTS.md, an issue text for sambanks/octabam is drafted for the owner to decide; nothing was filed.Edge cases
0x40026ef0Still red, owner's call:
module:doctorlistsevidence/performance.json(for 0.1.1) andsdk/approvals/kits-build-approval.json(covers 0.1.1), somodules:generatecannot regeneratesrc/catalog/module-documents.jsonyet; and the board claim on Kits held by twwwy (0.1.1's Part Edit rows, shipped in #2066), whom I asked on the board. I did not write an approval or new measurements.What the guides lacked, and where: no guide says that stock's undo buffer is shared by many snapshot routines, so a module keeping its own pending undo over it cannot rely on one detour. I recorded it in Kits' TESTING.md and as a board finding for the Octatrack; a guide line can follow in its own
Docs:PR. Also:device.mjs try … --socket <an emulator's share socket>waits in the real unit's queue unlessMODWERK_UNIT=emulatoris set;docs/UNIT_QUEUE.mdnames--emulatorand the variable but not this case. Not fixed here.docs/module-guides/, and TESTING.md lists what I did not test.Validation commands and results:
npm run module:doctor -- kits(red on the owner's items above);npm run pr:readyresult in a comment below.🤖 Generated with Claude Code