Enamel tile patterns lose cells when a transfer write accepts only part of a block
Level 2 · node · Reliability · Partial-write return count disagrees with transfer progress offset
Scenario
A fictional enamel tile studio represents each pattern row as an array of color numbers and writes the rows in order to an in-memory transfer device. The device can accept only part of a request and returns the number of cells actually written. The pattern is correct on devices accepting entire requests, but cells disappear in the middle when a device can accept fewer cells at a time. Review the transfer service and the device's write contract together.
Requirements
transfer(rows, capacity) transfers row arrays of color numbers into one array in input order. capacity is a positive integer and the maximum number of cells the device accepts per call. Each request contains at most four cells; write(block) returns how many cells it actually accepted from the start of the block. Write every remaining cell, preserving order and duplicates. Empty rows and empty input add no cells. Keep the original arrays and the public interface unchanged.
Acceptance criteria
- Transfer multiple rows in input order when the device accepts each entire request.
- Transfer every remaining cell even when a device accepts only part of a request.
- Preserve duplicate color numbers and row order even with a device capacity of one.
- Handle empty rows and empty input without mutating the original row arrays.