Systems and records
Nested conversation export ordering: keep the sequence, not the clock
By SourceX Editorial · Updated
9 sections
Short answer
Nested conversation export ordering survives conversion only when the file carries a source sequence number and every parent link, and the buyer reruns the checks on the converted format. In 74,963 annotated Ubuntu IRC messages, a one-parent tree export drops 2,188 reply links, half of timed replies share their parent's minute, and 35 of 173 logs step back on the clock, so timestamps alone cannot restore order.
System export
Nested conversation export
Key takeaways
- Accept a converted conversation only when sorting by its declared key reproduces the source sequence and every source link resolves in the delivered file.
- In the annotated IRC corpus, 2,003 of 74,963 messages (2.67 percent) answer two or more earlier messages, so a one-parent tree drops 2,188 of 59,051 reply links.
- 29,767 of 58,921 timed reply links (50.52 percent) share their parent's minute, so a sort with unspecified tie order can put the reply first in every one of them.
- Time-of-day stamps step backward in 35 of 173 logs, 23 at midnight and 12 at a 12-hour clock reset, which a date-free sort turns into reordering.
- Ship a versioned manifest naming the sequence key, tie rule, link cardinality, clock precision and drop rules, with counts the buyer can recompute.
What does nested conversation export ordering have to prove?
It has to prove that the converted file can rebuild the source conversation exactly: the same messages, in the same sequence, with every reply attached to each message it answered. A file that loads, validates against its schema and matches its checksum proves none of that, because each of those checks reads the converted file on its own.
Nesting is where order goes missing. Source systems mostly store conversations as a flat stream with pointers: an IRC log is lines in arrival order, a help desk ticket is a list of comments with created times, and a Matrix room holds events that point at a thread root and, separately, at the message being answered. Buyers often want something else, such as one JSON document per conversation with replies nested under their parents, or chat-style training examples with a single message list. Each of those conversions makes ordering choices the source never had to make.
The decision here is narrow: accept the converted file, send it back for repair, or ask for a re-export under different rules. What settles it is a set of counts computed on both sides of the conversion. Which fields to ask for in the first place is the job of a transcript delivery schema; this page asks whether the conversion kept those fields true.
Three ways a conversion reorders a conversation
Order is lost in three places: when a message with several parents is forced into a tree, when a clock is asked to do the work of a sequence number, and when conversations are regrouped so that their interleaving disappears.
A tree gives each node one parent, and real conversations do not always cooperate. The irc-disentanglement data notes that a message can be linked to several earlier messages. The Matrix specification gives a threaded message two different pointers: an m.thread relation that always references the thread root, and an m.in_reply_to reference to the specific message being answered. A converter that keeps one parent field keeps one of those facts and quietly discards the other.
Timestamps are coarser, emptier and more ambiguous than export code tends to assume. System events may carry no time at all, logs may record the time of day with no date, and many messages can share one stamp. Sorting does not repair that. PostgreSQL's documentation says that rows come back in an unspecified order unless a sort is chosen, and that later sort expressions only order rows that are equal on the earlier ones. Python's sorting HOWTO documents that its sorts are stable, so tied items keep their input order, which helps only if the input order was right to begin with.
Regrouping removes the timeline between conversations. Splitting a channel into one document per thread keeps each thread's internal order and loses which thread moved first. JSON adds a trap of its own: RFC 8259 notes that parsers differ in whether they expose the order of object members, so a conversation stored as an object keyed by message ID has no order a buyer can rely on. Only arrays carry order.
What happened when 74,963 annotated chat messages were converted three ways
On a public chat corpus, the clock could order only about half of the replies, and a one-parent tree lost 2,188 links. The data is the Ubuntu channel portion of the irc-disentanglement corpus (the train, dev and test folders at commit 82ed04f, licensed CC BY 4.0), in which researchers recorded which earlier message each line responds to, from line 1,000 of each log onward. It is not business data. It does have what business exports usually lack: a known source sequence and a hand-annotated reply graph to measure a conversion against.
We simulated three conversions with a short script that reads only the data files. A stable sort on the minute stamp has to drop the 8,670 annotated messages (11.57 percent) that carry no timestamp, all of them system notices such as joins, nick changes and departures, and 130 reply links go with them. The same sort with ties broken in the worst possible order puts the reply ahead of its parent in 29,798 of 58,921 timed links: the 29,767 links (50.52 percent) whose two ends share a minute, plus the 31 that cross a clock step back. In all, 97.07 percent of timed messages share their minute with at least one other annotated message in the same log. A one-parent nested tree, flattened depth first, keeps every surviving link pointing forward but drops 2,188 of 59,051 reply links, since 2,003 messages (2.67 percent) answer two to seven earlier messages. It also leaves 10.77 percent of message pairs out of source order, because 5,464 of 18,722 conversations (29.18 percent) were interleaved with another.
Two clock findings reach beyond IRC. Time-of-day stamps step backward once in 35 of the 173 logs: 23 times at midnight on a 24-hour clock, and 12 times where an older log resets from 11 or 12 to 00 or 01 with no AM or PM marker. In 31 reply links the reply is stamped earlier than its parent. A converter that attaches the log's date to every line would date those replies before the messages they answer.
The test matrix below gives each conversion's result on the three measures a buyer should recompute:
| Conversion simulated | Reply links reversed | Reply links lost | Message pairs out of source order |
|---|---|---|---|
| Source sequence kept as a line number (baseline) | 0 | 0 | 0 |
| Stable sort on minute stamp, untimed lines dropped | 31 | 130 | 0.93% of 14,686,829 timed pairs |
| Minute-stamp sort, ties in worst-case order | 29,798 (50.57% of 58,921 timed links) | 130 | 2.64% of 14,686,829 timed pairs |
| One-parent nested tree, flattened depth first | 0 among the links kept | 2,188 (3.71% of 59,051) | 10.77% of 18,913,361 pairs |
The versioned delivery manifest for a conversation export
The manifest's job is to state every ordering rule the converter applied, so the buyer can recompute the counts instead of trusting them. Version it with the file: a new converter release, a changed tie rule or a different drop rule is a new manifest version, even when the messages themselves are unchanged.
Each field below names a rule and the check that reads it; the values in the third column are illustrative, not drawn from any delivery:
| Manifest field | What it states | Illustrative value | Check that reads it |
|---|---|---|---|
| Export and converter version | Manifest version, converter release and source extract date | v3, converter 2.4.1, extract dated 2026-09-30 | Every count below belongs to this version |
| Sequence key | The field, its scope and how it was assigned | seq, a gapless integer per channel taken from source arrival order | Sequence reproduces |
| Parent links | Link fields, relation types and the most parents any message has | parent_ids array with relations thread_root and reply_to, maximum declared | Links resolve; several parents survive |
| Clock | Precision, offset or time zone, and whether a date is present | Minute precision, UTC offset stated, full date on every row | Clock runs forward |
| Tie rule | How rows with equal timestamps are ordered | Ties broken by seq, ascending | Sequence reproduces |
| Drop and merge rules | What the converter removed, split or merged, with counts | System notices kept as typed rows; links dropped: 0 | Source count equals delivered plus dropped |
| Grouping | How conversations became documents, and the key that restores the shared timeline | One document per conversation, seq kept on every message | Round trip holds |
Five checks to rerun on the file in the buyer's format
Run the checks on the converted file itself, in the format the buyer will load, and compare each count with the source count the manifest declares. A conversion that passes in the supplier's working format can still fail at the last step, such as a JSON Lines export or a chat-template rendering, so the final artifact is the one that has to pass.
At a glance
Five checks to rerun on the file in the buyer's format
A check passes only when its count matches exactly, and the list below says what each one computes:
- Links resolve: every parent ID points to a message in the same file version, and the number of links by relation type equals the source count.
- Several parents survive: messages with two or more parents keep all of them, or the manifest declares the drop rule and the number of links it removed.
- Sequence reproduces: sorting by the declared key and then the tie rule returns the source sequence with zero differences.
- Clock runs forward: once date and offset are applied, no reply is stamped earlier than its parent, and every exception is listed by message ID.
- Round trip holds: flattening the nested file and nesting it again yields the same messages, links and order as the delivered version.
Can a file that loads and verifies still be out of order?
Yes, and the corpus shows how. The tree export above loads, nests cleanly and keeps every surviving reply after its parent, so a checker that only tests whether parents precede children passes it while 2,188 links are gone. The worst-case time sort produces well-formed timestamps in non-decreasing order, so a monotonic-time test passes it too, with half the timed replies placed ahead of what they answer. A checksum would then confirm that the buyer received exactly those bytes.
The strongest alternative explanation is that order does not matter for the buyer's task. For classifying single messages, or for retrieval over whole threads, it may not. That belongs in the manifest as a decision rather than an assumption: state that order was not preserved, drop the sequence checks, and keep the link checks, because a reply cut off from the message it answered changes meaning whatever the task.
The opposite mistake is throwing timestamps away. They still measure response latency and gaps between turns; the point is to carry them beside the sequence key, not to let them stand in for it.
Accept, repair or re-export: the decision rule
Accept when all five checks pass, or when every failure is declared in the manifest with a count the buyer has agreed to. Repair when the failures are mechanical and the source sequence exists: a missing tie rule or an untyped system notice can be fixed from the source without a new extraction. Re-export when the sequence key was never captured, because no timestamp logic can recover an order that only the source system held.
Record the decision in the manifest's version history together with the counts that triggered it. A buyer who receives version four should be able to see that version three failed the multi-parent check by a stated number of links, and what changed in the converter to fix it.
Methods note: how the IRC counts were produced
Data: every .annotation.txt file in data/train, data/dev and data/test of jkkummerfeld/irc-disentanglement at commit 82ed04f (173 logs), each paired with its .ascii.txt file, read as UTF-8 with undecodable bytes replaced and any byte-order mark stripped (none was found); every .raw.txt file had the same line count as its .ascii.txt file. A message is a line, numbered from 0. Annotated messages are lines 1,000 and later, because the data README says links are given from message 1,000; every one of the 74,963 annotated lines appears in at least one link. An annotation line's first two integers form a link; equal integers mark a conversation start (18,138), and otherwise the lower number is the parent and the higher the child (59,051 reply links, 831 of them to a parent before line 1,000). No duplicate, malformed or out-of-range line was found.
A timestamp is a line beginning with [HH:MM] where HH is at most 23 and MM at most 59; none was impossible. All 8,670 untimed annotated lines begin with ===, the log's marker for system notices. Same-minute links have equal minute-of-day values at both ends. A step back is a timed line whose minute of day is lower than the previous timed line's, classed as a midnight wrap when the earlier hour is 23 and as a 12-hour reset when it is 11 or 12. The stable sort keeps tied lines in line order and drops untimed lines; the worst-case sort breaks ties by descending line number; the tree keeps each child's latest earlier parent, including context lines before 1,000, which are placed but not counted in pairs; it places roots and children in line order and flattens depth first. Pairs out of order are inversions against line order within each file, divided by all pairs of timed annotated messages (sorts) or of annotated messages (tree). A conversation is a connected group of linked lines; it counts as interleaved when a line of another conversation falls strictly between its first and last annotated line. Percentages are computed on exact fractions and rounded half up to two decimals.
Limits: IRC chat is not a business system, the clock has minute precision, and the reply graph is a research annotation rather than system metadata. The 2019 paper's 77,563-message total also includes the separately annotated Channel Two data, which this count leaves out. The conversions are simulations of common choices, not tests of any vendor's tool. The script, bin/irc_export_order.py, reads only the data files, and its output is saved as bin/irc_out.txt in the analysis folder.
Putting ordering rules into a data request
SourceX sources datasets on request rather than holding them in stock, and its request form asks buyers for scope, volume, language, format, timing and licensing needs. The format and additional-specifications fields are where ordering requirements belong: name the sequence key you need, the link relations to keep, the clock rule, and the checks your acceptance test will run, so a supplier can say early whether its source systems hold that evidence.
Order survives only where the source recorded it. On the supply side, a company signs off on what is included, and on the terms, before a single record is handed over, so naming the sequence key at the request stage costs nothing and can spare everyone a re-export later.
Frequently asked questions
Why not sort a conversation export by timestamp?
Because clocks tie and go missing. In the annotated Ubuntu IRC corpus, 50.52 percent of timed reply links share their parent's minute and 11.57 percent of messages carry no timestamp at all. Keep timestamps for latency, but order by a sequence key with a stated tie rule.
What is a sequence key in a conversation dataset?
It is a field that records the source system's own order, such as a gapless integer assigned per channel or ticket from arrival order at extraction. Message IDs are often random or reused across systems, so they cannot serve as one. The manifest should name the key, its scope and how it was assigned.
Can a nested JSON format hold a message with more than one parent?
Only if each message also stores its parent IDs as a list, or its relations by type, alongside the nesting. A strict tree keeps one parent per message. In the IRC corpus that meant dropping 2,188 of 59,051 reply links, and Matrix threads give each threaded message two separate pointers.
Does a valid checksum prove a conversation export is in the right order?
No. A checksum shows that the bytes did not change after it was computed. Ordering damage happens earlier, inside the conversion, so the checksum faithfully protects a file that may already be out of order.
How should system events such as joins or transfers be handled?
Keep them in the stream as typed rows with their own sequence numbers, and declare any you drop. In the IRC corpus such notices were 11.57 percent of annotated lines and had no timestamp, so a time sort removed them along with 130 reply links.
Sources
- The irc-disentanglement data README describes the annotation format: messages counted from 0, links given from message 1,000, a message may link to several messages, self-links mark conversation starts and system messages are counted and annotated. Source
- The repository README says the 2019 paper introduced disentanglement for 77,563 IRC messages and that the annotated data covers Ubuntu, Channel Two and four newer channels. Source
- The corpus data is licensed under Creative Commons Attribution 4.0 International. Source
- The Matrix specification's threading module says events in a thread reference the thread root rather than the most recent message, that threads cannot be nested, and that a reply within a thread uses an m.in_reply_to reference. Source
- PostgreSQL's documentation says rows are returned in an unspecified order unless sorting is chosen, and that later sort expressions order rows equal on earlier ones. Source
- Python's sorting HOWTO documents that sorts are stable, so records with the same key keep their original order. Source
- RFC 8259 notes that JSON parsing libraries differ in whether they make the ordering of object members visible, and that implementations which do not depend on member ordering are interoperable. Source
- SourceX's request page asks buyers for scope, volume, language, format, timing and licensing, has format and additional-specifications fields, and says datasets are sourced on request, not held in stock. Source
Tell us what data you need
Share scope, volume, format, timing and licensing needs. Datasets are sourced on request.