test(parity): R2 shared fixtures — screens.json (both exit modes) + shapes.json (json-shape) - #115
Merged
Merged
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 modesHarness:
tests/parity-fixtures.test.ts. Plain-screen output asserted EXACTLY(trailing
\nstripped, no full-trim). A per-fixtureenvoverlay pins theexit-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-screen— preserve (PTY_REAP_ON_EXIT=false): finalviewport survives, idempotent peek,
lsstatus=exited exitCode=7.post-exit-reaped— reap (default): session removes itself; peek fails +lsomits it.shapes.json— machine-readable shapes (per-field policy)Harness:
tests/parity-shapes.test.ts. Runs a scenario via the real CLI, thenasserts field-by-field per policy (
{exact}|{type}|{omitWhenUnset}),not raw bytes:
ls-json-shape—list --jsonentry shape, running vs exited (preserve sothe exited entry stays listed). status enum
running|exited|vanished.Documents the pid distinction: ls
pid= daemon pid (number running / nullexited), vs
stats.process.pid= child pid.client-count-during-peek— after a transient peek,stats --jsonclients.attached === 0.Verification
All fixture values captured empirically against the real
dist. All paritysuites 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.mddocuments the schema + assertion rules for the mirror.