Skip to content

Bug: findNearestLogEventByTimestamp always returns largest index #344

@coderabbitai

Description

@coderabbitai

Description

This is a bug in clp-ffi-js. Open an issue here so we remember to retest the timestamp URL code once it's fixed.

The findNearestLogEventByTimestamp method in ClpIrDecoder.ts always returns the largest index instead of the correct nearest log event index. This appears to be an issue with the underlying clp-ffi-js library implementation.

Steps to Reproduce

  1. Change findNearestLogEventByTimestamp code in ClpIrDecoder.ts to:
findNearestLogEventByTimestamp (timestamp: number): Nullable<number> {
    console.log(timestamp)
    const ret = this.#streamReader.findNearestLogEventByTimestamp(BigInt(timestamp));
    console.log(ret)
    return ret;
}
  1. Test with different timestamps
  2. Observe that the method always returns the largest index regardless of the target timestamp

Expected Behavior

The method should return the index of the log event with the timestamp closest to (and not exceeding) the target timestamp.

Actual Behavior

The method always returns the largest index.

Context

This issue was identified during the implementation of timestamp-based log seeking in PR #152. The bug is in the clp-ffi-js library and cannot be addressed in the current PR.

Related

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions