Skip to content

feat(test): PTY-based interactive CLI snapshot tests#2052

Merged
graphite-app[bot] merged 1 commit into
mainfrom
rfc/interactive-snapshot-tests
Jul 6, 2026
Merged

feat(test): PTY-based interactive CLI snapshot tests#2052
graphite-app[bot] merged 1 commit into
mainfrom
rfc/interactive-snapshot-tests

Conversation

@fengmk2

@fengmk2 fengmk2 commented Jul 5, 2026

Copy link
Copy Markdown
Member

Implements the RFC included in this PR as rfcs/interactive-snapshot-tests.md.

  • crates/vite_cli_snapshots: PTY-based CLI snapshot suite (libtest-mimic). Every step runs in a real pseudo-terminal with vt100 grid capture; interactive steps script keystrokes synchronized on OSC 8 milestones; snapshots are Markdown with real pass/fail semantics (UPDATE_SNAPSHOTS=1 to accept, .md.new plus unified diff on mismatch). Built on the pty_terminal/snapshot_test crates from vite-task at the already-pinned rev.
  • One fixture tree replaces the local/global split: each case declares vp = "local" | "global" | ["local", "global"]; the parity matrix already caught real drift between the two help outputs. Per-case VP_HOME/HOME/npm-prefix isolation removes serial and the bootstrap byte-match requirement; seed-runtime symlinks a provisioned managed runtime; failure flow is shell-like with line boundaries (continue-on-failure).
  • vpt test multitool (vtt-aligned subcommands plus json-edit, chmod, probe) so fixtures run without a shell and behave identically on every platform.
  • tool migrate-snap-tests <dir> --vp <flavor> [filter]: one-click migration of old steps.json cases with a report; TODO-free conversions auto-remove the legacy dir. Migrated so far: the four check-pass* cases, cli-helper-message (local + global merged into one fixture), and build-vite-env.
  • packages/prompts: milestone emission for select/confirm/text, gated on VP_EMIT_MILESTONES=1, byte-identical to the vite-task protocol; render output unchanged when disabled.
  • CI: dedicated CLI snapshot test jobs for Linux, macOS, and Windows (Windows runs a cross-compiled nextest archive, no Rust toolchain on the runner); snapshot-baseline-only changes still trigger CI despite the markdown filters.
  • Entry points: just snapshot-test [filter], just snapshot-test-global (no JS build needed), pnpm snapshot-test. Contributor docs: crates/vite_cli_snapshots/tests/cli_snapshots/README.md.

Validation: 14 snapshot trials plus redaction/migrator/prompt unit suites pass in compare mode on all three CI platforms.

Follow-ups per the RFC phasing: local-registry case support, remaining prompt components (multiselect, password, spinner), migration batches, legacy runner removal.

@netlify

netlify Bot commented Jul 5, 2026

Copy link
Copy Markdown

Deploy Preview for viteplus-preview ready!

Name Link
🔨 Latest commit 603140d
🔍 Latest deploy log https://app.netlify.com/projects/viteplus-preview/deploys/6a4ba93bd3d35000088d97c9
😎 Deploy Preview https://deploy-preview-2052--viteplus-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

fengmk2 commented Jul 5, 2026

Copy link
Copy Markdown
Member Author

How to use the Graphite Merge Queue

Add the label auto-merge to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@socket-security

socket-security Bot commented Jul 5, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedcargo/​nix@​0.28.0801009310070
Addedcargo/​winreg@​0.10.18210093100100
Addedcargo/​cp_r@​0.5.210010093100100
Addedcargo/​toml@​1.1.2%2Bspec-1.1.010010093100100
Addedcargo/​libtest-mimic@​0.8.210010099100100

View full report

Comment thread rfcs/interactive-snapshot-tests.md Outdated
@fengmk2 fengmk2 self-assigned this Jul 5, 2026
@fengmk2 fengmk2 force-pushed the rfc/interactive-snapshot-tests branch from fefbe9d to e6ed290 Compare July 5, 2026 06:10

fengmk2 commented Jul 5, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e9b7db0e78

ℹ️ 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".

Comment thread packages/tools/src/migrate-snap-tests.ts Outdated
Comment thread packages/tools/src/migrate-snap-tests.ts Outdated
Comment thread crates/vite_cli_snapshots/src/bin/vpt/touch_file.rs Outdated
Comment thread crates/vite_cli_snapshots/tests/cli_snapshots/redact.rs
Comment thread packages/tools/src/migrate-snap-tests.ts Outdated
Comment thread crates/vite_cli_snapshots/src/bin/vpt/pipe_stdin.rs Outdated
Comment thread packages/tools/src/migrate-snap-tests.ts Outdated
Comment thread crates/vite_cli_snapshots/tests/cli_snapshots/main.rs
Comment thread packages/tools/src/migrate-snap-tests.ts Outdated
Comment thread packages/tools/src/migrate-snap-tests.ts
@fengmk2

fengmk2 commented Jul 5, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1d9bd36a53

ℹ️ 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".

Comment thread packages/tools/src/migrate-snap-tests.ts
Comment thread crates/vite_cli_snapshots/src/bin/vpt/rm.rs
Comment thread packages/tools/src/migrate-snap-tests.ts Outdated
Comment thread crates/vite_cli_snapshots/tests/cli_snapshots/main.rs Outdated
Comment thread packages/tools/src/migrate-snap-tests.ts Outdated
Comment thread packages/tools/src/migrate-snap-tests.ts Outdated
@fengmk2

fengmk2 commented Jul 5, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5b1294289f

ℹ️ 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".

Comment thread crates/vite_cli_snapshots/tests/cli_snapshots/main.rs Outdated
Comment thread crates/vite_cli_snapshots/tests/cli_snapshots/redact.rs
Comment thread crates/vite_cli_snapshots/tests/cli_snapshots/main.rs
@fengmk2

fengmk2 commented Jul 5, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7ce35c142f

ℹ️ 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".

Comment thread crates/vite_cli_snapshots/tests/cli_snapshots/redact.rs Outdated
Comment thread justfile
Comment thread crates/vite_cli_snapshots/tests/cli_snapshots/flavor.rs Outdated
Comment thread crates/vite_cli_snapshots/tests/cli_snapshots/redact.rs
@fengmk2

fengmk2 commented Jul 5, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 23a5d0b7f2

ℹ️ 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".

Comment thread packages/tools/src/migrate-snap-tests.ts
Comment thread crates/vite_cli_snapshots/tests/cli_snapshots/flavor.rs Outdated
Comment thread packages/tools/src/migrate-snap-tests.ts Outdated
@fengmk2

fengmk2 commented Jul 5, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f046797698

ℹ️ 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".

Comment thread crates/vite_cli_snapshots/tests/cli_snapshots/main.rs Outdated
Comment thread crates/vite_cli_snapshots/src/bin/vpt/cp.rs Outdated
Comment thread crates/vite_cli_snapshots/tests/cli_snapshots/main.rs Outdated
Comment thread .github/workflows/ci.yml
Comment thread crates/vite_cli_snapshots/tests/cli_snapshots/main.rs Outdated
@fengmk2

fengmk2 commented Jul 5, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bfad895b80

ℹ️ 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".

Comment thread .github/workflows/ci.yml
Comment thread crates/vite_cli_snapshots/src/bin/vpt/list_dir.rs Outdated
Comment thread crates/vite_cli_snapshots/tests/cli_snapshots/flavor.rs Outdated
Comment thread packages/tools/src/migrate-snap-tests.ts
Comment thread crates/vite_cli_snapshots/tests/cli_snapshots/redact.rs
@fengmk2

fengmk2 commented Jul 5, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7660d0533f

ℹ️ 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".

Comment thread justfile
@fengmk2

fengmk2 commented Jul 5, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: df5abf79ad

ℹ️ 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".

@fengmk2

fengmk2 commented Jul 6, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: df5abf79ad

ℹ️ 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".

Comment thread crates/vite_cli_snapshots/tests/cli_snapshots/flavor.rs Outdated
Comment thread packages/tools/src/migrate-snap-tests.ts
Comment thread packages/tools/src/migrate-snap-tests.ts
@fengmk2

fengmk2 commented Jul 6, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b750991666

ℹ️ 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".

Comment thread crates/vite_cli_snapshots/src/bin/vpt/cp.rs Outdated
Comment thread crates/vite_cli_snapshots/tests/cli_snapshots/main.rs
Comment thread crates/vite_cli_snapshots/tests/cli_snapshots/flavor.rs Outdated
Comment thread crates/vite_cli_snapshots/tests/cli_snapshots/main.rs Outdated
Comment thread crates/vite_cli_snapshots/src/bin/vpt/touch_file.rs Outdated
@fengmk2 fengmk2 changed the title feat(test): PTY-based interactive CLI snapshot harness feat(test): PTY-based interactive CLI snapshot tests Jul 6, 2026
@fengmk2

fengmk2 commented Jul 6, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ab99aad510

ℹ️ 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".

Comment thread packages/tools/src/migrate-snap-tests.ts Outdated
Comment thread crates/vite_cli_snapshots/tests/cli_snapshots/main.rs Outdated
Comment thread crates/vite_cli_snapshots/src/bin/vpt/chmod.rs
@fengmk2

fengmk2 commented Jul 6, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 222abdcc73

ℹ️ 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".

Comment thread crates/vite_cli_snapshots/src/bin/vpt/grep_file.rs Outdated
Comment thread crates/vite_cli_snapshots/tests/cli_snapshots/flavor.rs
Comment thread crates/vite_cli_snapshots/src/bin/vpt/print_file.rs
@fengmk2

fengmk2 commented Jul 6, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c060a5d7e1

ℹ️ 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".

Comment thread crates/vite_cli_snapshots/tests/cli_snapshots/flavor.rs Outdated
Comment thread packages/tools/src/migrate-snap-tests.ts Outdated
Comment thread crates/vite_cli_snapshots/tests/cli_snapshots/main.rs
Comment thread crates/vite_cli_snapshots/tests/cli_snapshots/flavor.rs
Comment thread packages/tools/src/migrate-snap-tests.ts Outdated
@fengmk2

fengmk2 commented Jul 6, 2026

Copy link
Copy Markdown
Member Author

@codex review

@fengmk2 fengmk2 requested a review from wan9chi July 6, 2026 03:25
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: 37803835e7

ℹ️ 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".

@fengmk2 fengmk2 force-pushed the rfc/interactive-snapshot-tests branch from 3780383 to 4f8f1d5 Compare July 6, 2026 03:58
@fengmk2 fengmk2 marked this pull request as ready for review July 6, 2026 04:36
@fengmk2 fengmk2 added test: e2e Auto run e2e tests test: install-e2e run vite install e2e test test: create-e2e Run `vp create` e2e tests preview-build Publish this PR's commits to the registry bridge as preview builds test: sfw labels Jul 6, 2026
@fengmk2 fengmk2 force-pushed the rfc/interactive-snapshot-tests branch from 94a3433 to b62a903 Compare July 6, 2026 06:06
@graphite-app

graphite-app Bot commented Jul 6, 2026

Copy link
Copy Markdown

Merge activity

Implements the RFC included in this PR as `rfcs/interactive-snapshot-tests.md`.

- `crates/vite_cli_snapshots`: PTY-based CLI snapshot suite (libtest-mimic). Every step runs in a real pseudo-terminal with vt100 grid capture; interactive steps script keystrokes synchronized on OSC 8 milestones; snapshots are Markdown with real pass/fail semantics (`UPDATE_SNAPSHOTS=1` to accept, `.md.new` plus unified diff on mismatch). Built on the pty_terminal/snapshot_test crates from vite-task at the already-pinned rev.
- One fixture tree replaces the local/global split: each case declares `vp = "local" | "global" | ["local", "global"]`; the parity matrix already caught real drift between the two help outputs. Per-case `VP_HOME`/`HOME`/npm-prefix isolation removes `serial` and the bootstrap byte-match requirement; `seed-runtime` symlinks a provisioned managed runtime; failure flow is shell-like with line boundaries (`continue-on-failure`).
- `vpt` test multitool (vtt-aligned subcommands plus `json-edit`, `chmod`, `probe`) so fixtures run without a shell and behave identically on every platform.
- `tool migrate-snap-tests <dir> --vp <flavor> [filter]`: one-click migration of old `steps.json` cases with a report; TODO-free conversions auto-remove the legacy dir. Migrated so far: the four `check-pass*` cases, `cli-helper-message` (local + global merged into one fixture), and `build-vite-env`.
- `packages/prompts`: milestone emission for `select`/`confirm`/`text`, gated on `VP_EMIT_MILESTONES=1`, byte-identical to the vite-task protocol; render output unchanged when disabled.
- CI: dedicated `CLI snapshot test` jobs for Linux, macOS, and Windows (Windows runs a cross-compiled nextest archive, no Rust toolchain on the runner); snapshot-baseline-only changes still trigger CI despite the markdown filters.
- Entry points: `just snapshot-test [filter]`, `just snapshot-test-global` (no JS build needed), `pnpm snapshot-test`. Contributor docs: `crates/vite_cli_snapshots/tests/cli_snapshots/README.md`.

Validation: 14 snapshot trials plus redaction/migrator/prompt unit suites pass in compare mode on all three CI platforms.

Follow-ups per the RFC phasing: `local-registry` case support, remaining prompt components (multiselect, password, spinner), migration batches, legacy runner removal.
@graphite-app graphite-app Bot force-pushed the rfc/interactive-snapshot-tests branch from b62a903 to 603140d Compare July 6, 2026 13:10
@graphite-app graphite-app Bot merged commit 603140d into main Jul 6, 2026
101 of 102 checks passed
@graphite-app graphite-app Bot deleted the rfc/interactive-snapshot-tests branch July 6, 2026 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

preview-build Publish this PR's commits to the registry bridge as preview builds test: create-e2e Run `vp create` e2e tests test: e2e Auto run e2e tests test: install-e2e run vite install e2e test test: sfw

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants