Skip to content

feat(player): add opt-in removal of long recorded gaps - #2117

Open
timothyanderson096-ocdealcheck wants to merge 1 commit into
hardbyte:mainfrom
timothyanderson096-ocdealcheck:feat/1646-remove-recorded-gaps
Open

timothyanderson096-ocdealcheck wants to merge 1 commit into
hardbyte:mainfrom
timothyanderson096-ocdealcheck:feat/1646-remove-recorded-gaps

Conversation

@timothyanderson096-ocdealcheck

@timothyanderson096-ocdealcheck timothyanderson096-ocdealcheck commented Oct 27, 2026 •

Copy link
Copy Markdown

Summary of Changes

Add keyword-only MessageSync(skip_gaps=True) and player --remove-gaps to remove remaining recorded-timestamp waits greater than the existing skip threshold. Defaults continue capping the wait. skip=0 disables removal/capping, and fixed-gap playback is unchanged. Existing four positional arguments and the CLI --sk abbreviation remain valid. Add API/CLI documentation, deterministic regressions and a news fragment.

For recorded Message.timestamp values 0, .25, 5.25, 5.5 with skip=1, the idealized elapsed playback times measured from replay start are 0, .25, 1.25, 1.5 with the default cap and 0, .25, .25, .5 with opt-in removal. These are neither rewritten message timestamps nor offsets from the preceding frame. The original Message objects, their recorded timestamps and their iteration order are retained; can.player calls bus.send sequentially. The repeated .25 means no deliberate wait between those two send calls. Physical bus ordering and real-time scheduling precision are not guaranteed by this change. The threshold is applied to the remaining wait after consumer processing time; equal-threshold waits are retained and subsequent intervals follow the shortened timeline. CLI options go before the input filename, consistent with its existing configuration-remainder parsing.

Related Issues / Pull Requests

Related to #1646, reported by @yomannnn. @zariiii9003 described this as an enhancement and invited a PR; @hartkopp explained the distinction between capping and removing gaps. API/flag naming is proposed, not previously approved. This does not promise full compatibility with can-utils canplayer.

Current overlapping #1936 adds pcapng/compression readers in the same module without changing MessageSync. Merged #1374 supplies the existing perf-counter/consumer-time scheduling; retain that behavior and credit its author @zariiii9003.

Type of Change

  • New feature
  • Documentation update

Checklist

  • Contribution guide followed.
  • Tests and documentation updated.
  • News fragment added.
  • All checks and tests pass (tox).

Additional Notes

Validation recorded on 25 October 2026, CPython 3.13.16 / Linux:

  • Twenty new deterministic cases on original production modules: 10 opt-in contract failures and 10 default controls pass. These failures demonstrate the missing requested feature, not 10 existing bugs.
  • Candidate focused suite: 45 passed, including an independent 45-test run. Tests cover literal recorded schedules, exact threshold, multiple gaps, repeated/backward timestamps, skip zero, fixed gaps, consumer processing time, actual ASC LogReader/CLI delivery and repeated loops.
  • Configured tox lint and type checks passed. Strict docs initially failed because prose separated a command-output directive from its :shell: option. Review caught this; the final revision restores the option and passes strict HTML/doctest docs and the final 45-test focused run.
  • Full suite: 523 passed, 29 passing subtests, 98 skipped, 28 failed. Unchanged-base failures have exactly the same identities (multicast IPv4/IPv6 initialization, errno 19). The all-tests checkbox remains unchecked.
  • Full lint/type/test run used a1ed7aa; final fb3be02 changes only the RST option location. Python/tests/news and installed runtime module hashes match the final source. Final affected docs/focused gates were rerun.

On 27 October, public head c7850ea4a1d6594aa31c60eae2801af8b1193c38, full tree 102f5319975abf23f9885206b135fddba995319d, was recovered exactly from the tested clean final candidate fb3be02b05ccab2a568812aae981d64f74615e69 on unchanged main b4f82ab. Saved raw archive hash, original/final test XML, independent review, docs output and equal full-suite failure identities were checked. No tests were rerun during this publication refresh.

Review follow-up on 27 October for hartkopp's timing/order question: the unchanged public head passes the 45 focused tests again on CPython 3.12.14 / Linux. An additional private probe using the real VirtualBus send/receive queues preserves input/send/receive ID order and original recorded timestamps for both default capping and opt-in removal. The probe uses a simulated scheduler clock and does not establish physical CAN transmission order. No production or upstream test source changed for this clarification.

Hardware, real-time scheduling guarantees, other OS/interpreter matrix and direct can-utils comparison were not validated. Existing negative/nonfinite timing semantics are outside this feature.

Prepared with AI assistance and independently inspected during the original preparation.

Timothy Anderson — Spotted Ridge Engineering / OC Labs
Independent software verification · GDN (Global Decision Network)
timothyanderson096@gmail.com · Engineering evidence

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-28T00:28:16.740435Z
We couldn’t complete this review. Comment @codex review to try again.
c7850ea Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@hartkopp

Copy link
Copy Markdown
Collaborator

For recorded times 0, .25, 5.25, 5.5 with skip=1, default playback yields at 0, .25, 1.25, 1.5; opt-in removal yields at 0, .25, .25, .5.

Sorry, but this is likely not, what you want.
You need strictly monotonically increasing timestamps - otherwise you will see frame reordering.

The example 0, .25, 5.25, 5.5 contains absolute timestamps while 0, .25, .25, .5 seem to be offsets to the former frame, right?

Maybe I really didn't get behind the use-case - but this approach looks wrong to me.

Copy link
Copy Markdown
Author

Thanks — my example mixed recorded timestamps with elapsed playback time without making the distinction clear. The intended example is:

Frame Recorded Message.timestamp Elapsed playback, cap Elapsed playback, remove
A 0 0 0
B 0.25 0.25 0.25
C 5.25 1.25 0.25
D 5.5 1.5 0.5

The playback columns are idealized seconds from replay start, not rewritten Message.timestamp values or offsets from the preceding frame. The repeated 0.25 means no deliberate sleep between the B and C send calls.

MessageSync yields the original Message objects in input order, and can.player calls bus.send sequentially. The recorded timestamps remain 0, 0.25, 5.25 and 5.5. I rechecked the unchanged head: 45 focused tests pass, and a separate probe through the real VirtualBus queues preserves send/receive order and those timestamps with removal enabled and disabled.

That establishes application/VirtualBus ordering, not physical CAN transmission order or real-time precision. Removing waits can create bursts; the proposed option removes the wait requested in #1646 without adding a minimum inter-frame delay or a hardware ordering guarantee. I have clarified the PR description to make those boundaries explicit.

Timothy Anderson — Spotted Ridge Engineering / OC Labs · GDN (Global Decision Network)
timothyanderson096@gmail.com

@timothyanderson096-ocdealcheck

Copy link
Copy Markdown
Author

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

An unknown error occurred
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

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.

2 participants