Skip to content

Keep the timeline events in the observability golden fixture - #947

Merged
chrisgleissner merged 4 commits into
GideonZ:masterfrom
chrisgleissner:fix/observability-timeline-fixture
Oct 2, 2026
Merged

chrisgleissner merged 4 commits into
GideonZ:masterfrom
chrisgleissner:fix/observability-timeline-fixture

Conversation

@chrisgleissner

@chrisgleissner chrisgleissner commented Oct 1, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

The observability golden fixture tests/lib/fixtures/e2e-run.expected.md stores the Timeline section of the gate report as a single line count. Any change to runner output edits that number, so two branches that both change runner output conflict on it, or merge cleanly with a wrong count. The fixture now stores the timeline's events as sorted lines. The clock is replaced by a fixed value, and device-request lines are left out, because their wording depends on scheduling.

This removes the conflict on the PR #705 sync that motivated the change. In a simulation of parallel branches, the fixture merges cleanly and correctly in 92% of cases, against 0% for the count. The canonical timeline does not change when every process's timestamps are skewed by up to 5 s, so it cannot vary between machines. The golden test also catches changes to event wording that the count missed.

Previous behaviour

canonicalize_document() in tests/lib/observability/support.py replaced the whole Timeline section with N line(s), order not compared here.

Problem

Every change that adds or removes a runner event changes N. Two branches that each add events both edit that line. They conflict, or, when both add the same number of lines, they merge cleanly with a count that matches neither. The last sync of #705 with master hit the conflict: master's IEC-bus teardown changed the count from 212 to 225, and #705's cartridge-preference message changed it from 212 to 215.

The count also passed any change to event wording that kept the number of lines.

Change

_timeline_events() canonicalises the Timeline section:

  • It keeps every event line except device requests. Each kept line gets the fixed prefix 00:00:00 +00:00, and the lines are sorted.
  • A device-request line is a request as describe_action writes it (<source> GET|PUT|POST|... /path), or a run of requests collapsed into N device requests (...). These lines are left out.
  • The clock pattern also accepts the - offset that tools/e2e_report.py writes when it has no start time.
  • One new substitution replaces the syslog collector's ephemeral port in the warning that names it. That warning appeared only inside the counted section before this change. The substitution is anchored on the collects on …, so none of it will arrive; set '…' to '…:PORT' sentence, so the device's real port in the collects at message is left alone.
  • The fixed prefix matches the clock pattern again, so a second canonicalisation changes nothing. The golden comparison relies on this, because it canonicalises the checked-in file again.
  • The "Where the time went" section is still reduced to its length.

The sort and the dropped request lines are needed for stability. The timeline merges records from the runner, each suite process and syslog, and each source carries its own clock. timeline_section() sorts them by time, so their interleaving follows how the machine scheduled the processes. Request lines also change their wording with that order. A run of requests is collapsed into a count, or listed in full when it is near a failure, depending on the events beside it.

The first revision of this PR kept the full order. It passed on every local build and failed on the CI runner (run 36932619462). Every other event line is written regardless of order, so these lines, sorted, are what every build reproduces. Order and requests are still checked against a live document by the_timeline_is_the_whole_run_in_order, which checks wall-clock order, the presence of GET /v1/machine:menu_screen, and the repeat limit.

Verification

  • Timing independence. I rendered the fixture after shifting all timestamps in each record file by a random offset. Each file keeps its own order; this models another machine scheduling the processes differently.
    • With the full-order form of the first revision, the timeline changed in 9 of 20 renders at a skew of up to 10 ms. That matches the CI failure.
    • With this change, the timeline was identical in all 100 renders, at skews from 10 ms to 5 s.
  • CI environment. make observability_test in my_docker_image (Python 3.10, the CI command) passed 3 of 3 times. The golden tier passed in 8 of 8 containers limited to a quarter of a CPU each. Locally, observability_test.py reports 180 cases OK and 2 skipped, and lint_test is OK.
  • Merge replay. I recorded the fixture with this change on the merge base (2c60bd8fc), on the Machine code monitor debugger #705 head (893877ce1), on master (1e17efcba) and on the actual merge commit (31d27b3f1).
    • The count format gives 1 conflict on this merge, and this change gives 0.
    • The file produced by git merge-file is byte-identical to the recording made on the merge commit.
  • Merge simulation. Over 1000 trials, two branches each add one new kind of event, written for 1 to 4 random sources of the real timeline.
    • The count format conflicts in 741 trials and merges the other 259 with a wrong count.
    • This change conflicts in 78 trials. Every other merge is correct.
    • With 1 to 13 random single lines per branch instead, the figures are 947 against 319.
  • Coverage. In tools/e2e_report.py:2004 I changed the suite event <key> started to <key> begun.
    • With master's support.py and fixture, tier 4 passes.
    • With this change, the document is byte identical to the expected one fails.
    • The edit was then reverted.
  • New test. The pure-tier case the_canonical_timeline_is_its_events_sorted checks that the clock and request lines are removed and the rest sorted. It checks that the same events in reverse order give the same result, and that a second pass changes nothing. Its inputs include a - offset and an event whose text begins with a clock. It also checks that only the collector's port is replaced.

Remaining limitations

  • A branch that changes runner output still has to re-record the fixture. This change makes most of those re-records merge cleanly; it does not remove the need for them.
  • Two branches whose new events sort next to each other still conflict. Both sides are then real event lines, and the resolution is to keep both.
  • The fixture no longer records the request lines of the timeline. Their content is timing-dependent, so the count did not pin them down reliably either.
  • Under the same skew model, the rest of the document changes once the skew reaches 100 ms; for example, the runner's check table reorders. That behaviour is on master and is unchanged here. The observability step has not failed on any of the last 60 CI runs apart from this PR's first revision.

@chrisgleissner
chrisgleissner merged commit a1e453b into GideonZ:master Oct 2, 2026
1 check passed
@chrisgleissner
chrisgleissner deleted the fix/observability-timeline-fixture branch October 7, 2026 07:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant