Skip to content

Shared test vectors for logic implemented in both TypeScript and Python #478

Closed

Description

@vishnuv688

Part of #278.

Some pure logic has to exist in both languages, because Python cannot import core. Each Python module says which core module it mirrors, but nothing checks that the two still agree, and in practice they drift. Two drifts were found only by review: the row id counter fixed against cross-process collisions in core (#473) and later in Python (#474), and assertion target resolution, where Python's stricter rule exposed a bug in core (#476).

Proposal

A JSON file of cases in packages/shared (input, expected output), one section per mirrored function, run by a vitest suite against the TypeScript implementation and by a pytest suite against the Python one. Adding a case proves both at once; changing one implementation without the other fails the other language's run.

Candidates, each with its TS and Python home:

  • Assertion target resolution: core/read-value-locators.ts and read_value_locators.py / assertions.py
  • Native-session detection: shared/device.ts and device.py
  • Run id resolution and its env var: core/run-id.ts and run_id.py
  • Output directory resolution: core/output-dir.ts and output_dir.py
  • Command row id range: core/session-capturer.ts and capturer.py
  • Wait poll keys and nested-wait identity: selenium-devtools/src/wait-tracking.ts and wait_tracking.py
  • Performance payload shaping: core/performance-capture.ts applyPerformanceData and performance.py
  • Screencast buffer thinning, where both implement a cap

Pick the ones with a deterministic input/output shape; leave out anything that needs a driver.

Acceptance

  • The vectors file and both runners, wired into pnpm test and the Python CI job.
  • Each listed function either has vectors or a stated reason it cannot.
  • A deliberate one-sided change to any covered function fails CI.

Activity

  1. self-assigned this
    on Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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