Skip to content

test(cli): exercise interactive selector routes - #2777

Merged
Sinity merged 2 commits into
masterfrom
feature/fanout/test-harness
Jul 12, 2026
Merged

Sinity merged 2 commits into
masterfrom
feature/fanout/test-harness

Conversation

@Sinity

@Sinity Sinity commented Jul 12, 2026 •

Copy link
Copy Markdown
Owner

Summary

Add a real PTY test boundary for the interactive CLI: Click shell completion, fzf selection, and terminal-size propagation.

Problem

Existing terminal tests captured output but did not attach a controlling terminal, invoke the real external picker, or execute Click shell completion through its installed process protocol. Those gaps could let interactive-only regressions pass.

Solution

The PTY harness now applies its requested window size and gives the child process a controlling terminal. Three process-route tests use an isolated archive and deterministic fzf stand-in to prove completion output, ranked picker selection, and picker-visible terminal dimensions. The child-width change also refreshes the affected terminal snapshots; that full fixture refresh records pre-existing annotations-command inventory drift at each tested width.

Verification

  • env POLYLOGUE_PYTEST_BASETEMP_ROOT=/realm/tmp/polylogue-pytest POLYLOGUE_PYTEST_WORKERS=1 nix develop --command devtools test tests/unit/cli/test_terminal_snapshots.py tests/unit/cli/test_interactive_cli.py
    • 12 passed in 35.64s
  • Pre-push quick verification passed before each pushed commit.

Acceptance criteria

Ref polylogue-th0

  • Deferred to polylogue-th0: the five-plus golden-flow serial CI lane is not implemented in this PR.
  • Deferred to polylogue-th0: this PR does not add the required registry-generated completion contract; the existing manually curated completion matrix does not satisfy that AC.
  • Deferred to polylogue-th0: the first-row fzf test makes candidate-order regression observable, but this branch has no retained deliberate mutation-demonstration commit as required by the bead.

Anti-vacuity

  • test_click_bash_completion_protocol_runs_in_a_real_pty executes the CLI entrypoint and Click shell-complete dispatch. Removing root --origin completion or changing the bash completion records makes it fail.
  • test_select_uses_fzf_first_ranked_candidate_in_a_real_pty executes query routing, selection, and the external fzf process. Skipping fzf, ignoring its result, or reordering candidates makes it fail.
  • test_select_propagates_requested_pty_size_to_fzf executes the same selector route and reads its controlling terminal from fzf. Removing PTY size or controlling-terminal setup makes it fail.

Adversarial review notes

  • Iteration 1: refreshed terminal snapshots after the real PTY width became visible to the CLI, in 0ec19eb. Strengthened the completion oracle from a rendered substring to the exact Click bash protocol records in the same commit.
  • Iteration 2: corrected the remaining fzf acceptance claim. The test is a real route and exposes reordering, but the deliberate mutation demonstration is not present in this branch and remains deferred to polylogue-th0.
  • Iteration 3: no legitimate gaps found. The PR body and review-thread state accurately distinguish this shipped test slice from the open bead requirements.
  • The five-flow serial lane and registry-generated completion matrix remain deferred to open bead polylogue-th0.

Problem
PTY snapshots covered terminal rendering but did not establish a controlling
terminal or drive the CLI through its external fzf path. Completion protocol
coverage also stayed in-process.

What changed
Configure the PTY child with the requested window size and controlling
terminal. Add real-process contracts for the Click bash-completion protocol,
fzf's ranked-row selection route, and picker-visible terminal dimensions.

Compatibility/migration
Test infrastructure only; no production behavior changes.

Co-Authored-By: Codex <[email protected]>
@coderabbitai

coderabbitai Bot commented Jul 12, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

@Sinity, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 51 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 3fc07d75-9dae-4c69-b59d-b0612c121def

📥 Commits

Reviewing files that changed from the base of the PR and between 901825e and 0ec19eb.

📒 Files selected for processing (3)
  • tests/infra/pty_cli.py
  • tests/unit/cli/__snapshots__/test_terminal_snapshots.ambr
  • tests/unit/cli/test_interactive_cli.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/fanout/test-harness

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Sinity
Sinity marked this pull request as ready for review July 12, 2026 21:27

@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: 8c639b087c

ℹ️ 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 tests/infra/pty_cli.py Resolved
Problem
The interactive harness now applies the requested terminal size to the child
process, so the renderer-only terminal snapshots no longer describe the CLI's
actual width-sensitive output. The completion process test also accepted any
rendered output that happened to mention one root option.

What changed
Regenerate the affected help snapshots and assert the exact Click bash
completion records emitted for the origin prefix.

Compatibility/migration
Test fixtures only; no production behavior changes.

Co-Authored-By: Codex <[email protected]>
@Sinity

Sinity commented Jul 12, 2026

Copy link
Copy Markdown
Owner Author

Adversarial self-review iteration 1

Findings:

  • Real: applying real PTY dimensions invalidated three stored terminal snapshots. Fixed in 0ec19eb by regenerating the affected snapshot fixture.
  • Real: the PR had overstated the existing completion matrix as registry-generated coverage. The PR body now states that this AC remains deferred to open bead polylogue-th0.
  • Borderline strengthened: the Click completion route test now asserts the exact bash completion records, not a rendered substring.
  • Open scope retained honestly: the five-plus-flow serial CI lane and the registry-generated completion contract remain deferred to polylogue-th0.

Verification: env POLYLOGUE_PYTEST_BASETEMP_ROOT=/realm/tmp/polylogue-pytest POLYLOGUE_PYTEST_WORKERS=1 nix develop --command devtools test tests/unit/cli/test_terminal_snapshots.py tests/unit/cli/test_interactive_cli.py passed 12 tests.

What survived scrutiny: the fzf route is a real CLI to external-process path; its deterministic first-row chooser still fails if candidate order or the selected result changes.

@Sinity

Sinity commented Jul 12, 2026

Copy link
Copy Markdown
Owner Author

Adversarial self-review iteration 2

Findings:

  • Real: the bead requires a deliberate candidate-reordering demonstration commit. This branch has a real fzf route test that would fail on reordered input, but no retained mutation demonstration, so the PR now defers this AC to polylogue-th0 instead of calling it satisfied.
  • Borderline documented: snapshot regeneration also captured pre-existing annotations-command inventory drift at each tested width; no production behavior changed.

The existing inline snapshot review thread is resolved with the 12-test focused verification evidence. No code changed in this iteration, so no additional commit was appropriate.

What survived scrutiny: the fzf selection and terminal-size paths remain real subprocess/TTY routes, and the completion assertion now checks Clicks exact bash protocol records.

@Sinity

Sinity commented Jul 12, 2026

Copy link
Copy Markdown
Owner Author

Adversarial self-review iteration 3

No new legitimate gaps found. The full branch diff, bead notes and ACs, PR conversation, and thread-aware review state were rechecked. The only substantive inline review is resolved; CodeRabbit remains rate-limited, and the known all-jobs-at-init CI failure pattern was not treated as a branch finding.

What survived scrutiny: the completion, fzf selection, and terminal-size tests exercise real child processes and a controlling TTY. The three larger bead requirements remain accurately deferred rather than implied complete.

@Sinity

Sinity commented Jul 12, 2026

Copy link
Copy Markdown
Owner Author

Final acceptance-criteria matrix for polylogue-th0

Acceptance criterion Status Evidence / disposition
5+ PTY golden flows in a serial CI lane Deferred to bead This PR ships three real-route exemplars only; the serial CI lane and remaining flows stay in open bead polylogue-th0.
Registry-generated completion contracts that reject missing metadata Deferred to bead The existing matrix is manually curated; this PR does not claim otherwise. The registry-generated contract remains open scope in polylogue-th0.
Deliberate candidate-reordering regression caught in a demonstration commit Deferred to bead The first-row fzf test makes reordering observable, but this branch has no retained mutation-demonstration commit.

No criterion is marked satisfied in full. This PRs delivered slice is the PTY substrate, three non-vacuous real-process exemplars, exact bash-completion protocol coverage, and refreshed terminal-width snapshots.

@Sinity
Sinity merged commit 3e6f969 into master Jul 12, 2026
3 of 15 checks passed
@Sinity
Sinity deleted the feature/fanout/test-harness branch July 12, 2026 23:07
Sinity added a commit that referenced this pull request Jul 12, 2026
…789,2792,2797

d3xj, w8et, w379 (cost-honesty, PR #2776), fs1.3 (hermes-wedge, PR #2789), and
f2qv.5 (usage-convergence, PR #2797) fully satisfied — closed. cuxz
(temporal-provenance, PR #2786), th0 (test-harness, PR #2777), and fs1.11/
fs1.12 (hermes-wedge cluster, PR #2792) partially satisfied — noted with
disposition, left open per closure-discipline (no closing on partial ACs).

Co-Authored-By: Claude <[email protected]>
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