matcher icon indicating copy to clipboard operation
matcher copied to clipboard

Question: Tracebook adapter and public FIFO observation surface

Open Taz33m opened this issue 4 months ago • 1 comments

Hi, I maintain Tracebook, a matching-engine conformance and failure-reduction toolkit. I am evaluating matcher as the next independently maintained native adapter and wanted to confirm the public semantic boundary before writing code.

This is not a performance-benchmark pitch or a bug report. Flash's matching-engine-benchmark adapter already reports that matcher is consensus-conforming as shipped. Tracebook's narrower contribution is deterministic lifecycle campaigns, complete queue-state comparison after every event, semantic coverage, JSON/JUnit evidence, and automatic reduction of a long divergent trace to a small CI regression.

I reviewed current main at b8d48356c8a2677e0d8a1965d754e3c4884bb947 and ran cargo test --all-targets from a clean clone: 59 unit tests, 3 integration tests, all examples, and all benchmark targets passed.

Proposed bounded integration

The first adapter would target only Tracebook's documented fifo-limit-v1 profile:

  • one OrderBook per symbol for isolated source-ID domains;
  • native submit_events and cancel_events outcomes and trades;
  • quantity reduction through amend(id, None, Some(new_remaining)), preserving FIFO priority;
  • priority-losing replacement through cancel followed by fresh limit submission under the same source OrderId;
  • clear by replacing only the selected symbol's book;
  • authoritative resting order IDs, quantities, prices, and FIFO order after every event.

The initial profile intentionally excludes IOC, FOK, iceberg, post-only, STP, and performance claims. Those should not be mixed into the first adoption proof even though matcher supports several of them.

Contract questions

  1. snapshot() documents FIFO emission and round-trip priority preservation. Is snapshot record order intended to be a stable public observation surface for external conformance tooling, or would you prefer a typed read-only resting-order iterator/accessor instead of consumers decoding the versioned bytes?

  2. Tracebook replacement is validated cancel-and-new: it may increase quantity or cross, and it always loses queue priority. Since native amend deliberately rejects quantity increases and crossing reprices, is cancel_events(id, ts) followed by submit_events with the same OrderId the intended public representation of that broader replacement operation?

  3. If those mappings are sound, would you be open to a small optional adapter example and GitHub Actions conformance job that installs the public tracebook-sim package? I can also keep the adapter entirely in Tracebook and send only a focused typed-observation accessor here if that is a better ownership boundary.

For a concrete example of the output, this case study shows an externally discovered FIFO defect localized at event 173, reduced to four events, replayed exactly, and stored as a fixed-engine regression.

I will hold off on an adapter PR until you confirm the intended observation and replacement surfaces.

Taz33m avatar Jul 15 '26 07:07 Taz33m

Small follow-up, mainly to lower the review burden rather than add another request.

Tracebook now has a structured engine qualification report for both successful and blocked attempts. It records time to evidence, adapter size, failed attempts, protocol questions, profile-boundary disagreements, and whether the result belongs in the candidate repository's CI.

If the snapshot and replacement assumptions in the original issue are acceptable, I can open a draft PR limited to:

  • the adapter example;
  • one CI job installing the public PyPI package; and
  • JSON/JUnit qualification artifacts.

It would make no matcher-core changes, and a passing profile would be described as scoped evidence rather than certification. A short yes/no on the original questions is enough; "not interested in an upstream CI job" is useful evidence too.

Taz33m avatar Jul 18 '26 01:07 Taz33m