Skip to content

test(parity): R2 shared fixtures — screens.json (both exit modes) + shapes.json (json-shape) - #115

Merged
myobie merged 2 commits into
mainfrom
parity/r2-shared-fixtures
Jul 21, 2026
Merged

test(parity): R2 shared fixtures — screens.json (both exit modes) + shapes.json (json-shape)#115
myobie merged 2 commits into
mainfrom
parity/r2-shared-fixtures

Conversation

@myobie

@myobie myobie commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

Parity R2 — shared, language-neutral fixtures both suites assert

Round 2 of the parity drive: a single canonical set of behavioral fixtures both
the node suite and the Rust port (pty-rust) load and assert, so the two
implementations cannot silently drift. Node owns these files; pty-rust vendors
a byte-identical mirror.
Rebased onto the post-#114 main.

screens.json — plain-screen bytes (exact) + both exit modes

Harness: tests/parity-fixtures.test.ts. Plain-screen output asserted EXACTLY
(trailing \n stripped, no full-trim). A per-fixture env overlay pins the
exit-time mode now that post-exit behavior is configurable (PTY_REAP_ON_EXIT,
#114):

  • idle-prompt-plain — live prompt, trailing cursor cell kept ("READY> ").
  • post-exit-final-screenpreserve (PTY_REAP_ON_EXIT=false): final
    viewport survives, idempotent peek, ls status=exited exitCode=7.
  • post-exit-reapedreap (default): session removes itself; peek fails +
    ls omits it.

shapes.json — machine-readable shapes (per-field policy)

Harness: tests/parity-shapes.test.ts. Runs a scenario via the real CLI, then
asserts field-by-field per policy ({exact} | {type} | {omitWhenUnset}),
not raw bytes:

  • ls-json-shapelist --json entry shape, running vs exited (preserve so
    the exited entry stays listed). status enum running|exited|vanished.
    Documents the pid distinction: ls pid = daemon pid (number running / null
    exited), vs stats.process.pid = child pid.
  • client-count-during-peek — after a transient peek, stats --json
    clients.attached === 0.

Verification

All fixture values captured empirically against the real dist. All parity
suites green (screens 4, shapes 3, parity-node-reference 7); typecheck clean.
pty-rust has confirmed the screens loader + json-shape encoding; it mirrors both
files. README.md documents the schema + assertion rules for the mirror.

myobie added 2 commits July 21, 2026 12:39
…modes) + node harness

Round-2 of the parity drive: a single language-neutral fixtures file both the
node suite and pty-rust assert against, so the two implementations cannot
silently drift. Node owns tests/fixtures/parity/screens.json; pty-rust vendors a
byte-identical mirror.

screens.json v2 covers the plain-screen seeds AND both exit-time modes now that
post-exit behavior is configurable (PTY_REAP_ON_EXIT, #114): a per-fixture env
overlay pins the mode. Seeds: idle-prompt-plain (live prompt, exact bytes),
post-exit-final-screen (PTY_REAP_ON_EXIT=false → preserved final screen,
idempotent peek, exit status), post-exit-reaped (default reap → session removes
itself, peek fails + ls omits). Harness (tests/parity-fixtures.test.ts) loads
the JSON, spawns with the fixture env, and asserts per kind. README documents
the schema + assertion rules.

JSON-shape seeds (ls-json-shape, client-count-during-peek) land next in a
sibling shapes.json.
…lient-count)

Companion to screens.json for the machine-readable surfaces both suites assert.
shapes.json fixtures run a scenario via the real pty CLI then assert output
FIELD-BY-FIELD per policy ({exact} | {type} | {omitWhenUnset}), not raw bytes.

- ls-json-shape: pty list --json entry shape, running vs exited (preserve mode
  so the exited entry stays listed). status enum running|exited|vanished. pid
  policy documents the daemon-pid-vs-child-pid distinction (ls pid = daemon:
  number running / null exited; stats.process.pid = child).
- client-count-during-peek: after a transient peek, stats --json
  clients.attached === 0 (peek/stats are not attached streaming clients).

Harness tests/parity-shapes.test.ts interprets the per-field policy. All values
captured empirically against the real dist. Node owns; rust mirrors.
@myobie
myobie merged commit b538be6 into main Jul 21, 2026
2 checks passed
@myobie
myobie deleted the parity/r2-shared-fixtures branch July 21, 2026 10:52
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