The record is the text of the repair. The Results table is the last run of the row.
DAPHistoryTest>>testMessagesShouldReturnInReverseChronologicalOrder
("Got 7 instead of 8").DAPHistory>>messages sorts the messages by their
time stamp (DateAndTime now) with the block [ tA >= tB ]. Messages
that arrive in one tick of the clock have the same time stamp, and the
sort then gives them in any order. Measured: of 2000 time stamps taken
in a loop, 655 are distinct on stock Cog and 912 on our VM.fixes/pharo-xp-tools-sindarin-dap.st): addRequest:,
addEvent: and addResponse: give each message an arrival number, and
messages sorts by the time stamp and then by the arrival number. The
test is not changed.Load the package into a Pharo 14 image (build 791) with the load expression of the test run, file in the fixes file of the row if there is one, and run the test classes of the package.
"row 145" Metacello new baseline: 'PharoDAPClient'; repository: 'github://Pharo-XP-Tools/Sindarin-DAP:main'; onConflict: [:e | e useIncoming]; load.
Last result of the package run (stock Cog and iospharo on the same image).
| Row | Label | Load | Stock Cog | iospharo VM |
|---|---|---|---|---|
| 145 | pharo-xp-tools-sindarin-dap | ok | tests=18 P=18 F=0 E=0 S=0 T=0 X=0 | tests=18 P=18 F=0 E=0 S=0 T=0 X=0 |
"Sindarin-DAP (Pharo-XP-Tools/Sindarin-DAP): DAPHistoryTest>> testMessagesShouldReturnInReverseChronologicalOrder fails on stock Cog with 'Got 7 instead of 8'. Cause, in the package: DAPHistory>>messages sorts requests, events and responses by the time stamp that addRequest:, addEvent: and addResponse: write (DateAndTime now) with the sort block [ tA >= tB ]. Two messages that are added in the same clock tick have equal time stamps. The sort block then answers true for both orders, and the order of the two messages is left to the sort algorithm. The result depends on the resolution of the clock and on the speed of the VM: a VM that adds messages in a different tick from each other passes by accident, a VM that adds two messages in one tick can fail. It is not a defect of a primitive. The repair: addRequest:, addEvent: and addResponse: also store the arrival number of the message (how many messages the history holds before the add), and messages sorts by time stamp and, for equal time stamps, by arrival number, so the newest message is first on every clock." fix value: #DAPHistory value: #addEvent: value: [ :source | (source includesSubstring: 'arrival') not ] value: 'addEvent: eventAsDict eventAsDict at: #arrival put: requests size + events size + responses size. eventAsDict at: #timestamp put: DateAndTime now. events add: eventAsDict. self notifyObserversEvent: eventAsDict'. fix value: #DAPHistory value: #addRequest: value: [ :source | (source includesSubstring: 'arrival') not ] value: 'addRequest: requestAsDict requestAsDict at: #arrival put: requests size + events size + responses size. requestAsDict at: #timestamp put: DateAndTime now. requests add: requestAsDict. self notifyObserversRequest: requestAsDict'. fix value: #DAPHistory value: #addResponse: value: [ :source | (source includesSubstring: 'arrival') not ] value: 'addResponse: responseAsDict responseAsDict at: #arrival put: requests size + events size + responses size. responseAsDict at: #timestamp put: DateAndTime now. responses add: responseAsDict. self notifyObserversResponse: responseAsDict'. fix value: #DAPHistory value: #messages value: [ :source | (source includesSubstring: 'arrival') not ] value: 'messages | all | all := requests , events , responses. "Newest first. Equal time stamps (same clock tick) are ordered by arrival number." ^ all sort: [ :a :b | | tA tB | tA := a at: #timestamp ifAbsent: [ DateAndTime now ]. tB := b at: #timestamp ifAbsent: [ DateAndTime now ]. tA = tB ifTrue: [ (a at: #arrival ifAbsent: [ 0 ]) >= (b at: #arrival ifAbsent: [ 0 ]) ] ifFalse: [ tA > tB ] ]'.
State of 2026-11-20. Made from the test records of the iospharo project (a second Pharo VM). The fixes are proposals for review.