Skip to content

Add copy-pasteable shell line to review-log header#88

Merged
vm-mishchenko merged 3 commits into
mainfrom
260515-spec-reviewer-cmd-log
May 15, 2026
Merged

Add copy-pasteable shell line to review-log header#88
vm-mishchenko merged 3 commits into
mainfrom
260515-spec-reviewer-cmd-log

Conversation

@vm-mishchenko
Copy link
Copy Markdown
Owner

Summary

Adds a _shell_repro_line helper function that constructs a reproducible POSIX shell command from cwd, environment variables, and argv. Modified _invoke_script to compute and log this line as a trailing line in the review-log header, allowing users to copy-paste the command to reproduce a review run without manual quoting or env var stitching.

The shell line format is $ cd <cwd> && [DRAFT_X=v ...] argv, where DRAFT_* env vars are sorted alphabetically for determinism and diff-friendliness, and all shell-special characters are properly quoted with shlex.quote and shlex.join. The existing four-line header (=== review @, argv:, CWD:, DRAFT env:) remains unchanged, and the new line is appended in a single atomic write.

Test plan

  • Unit tests for _shell_repro_line cover: empty env, env vars with spaces, special characters, cwd with spaces, argv with spaces, and determinism across multiple calls
  • Integration test verifies _invoke_script writes the shell line correctly to the log file, with proper ordering after the DRAFT env line
  • All existing tests continue to pass; no regression in reviewer flow

Add _shell_repro_line helper function that constructs a reproducible
POSIX shell command from cwd, environment variables, and argv. Modify
_invoke_script to compute and log this line alongside the existing
header, with DRAFT_* env vars sorted alphabetically. Add unit tests
for the helper and integration test verifying the log output.
- Replace shlex.split round-trip with real bash -c subprocess execution —
  missing shell round-trip test — shlex.split does not exercise shell
  expansion/assignment semantics; actual bash execution catches quoting
  regressions the weaker parser check would miss
- Assert exact ordered header lines by index instead of broad any()
  membership checks — integration test under-checks header wiring —
  spec requires the shell repro line immediately follows DRAFT env: in
  a single write; positional assertions guard that ordering guarantee
…env mismatch

- Remove `tmp_path` fixture and subprocess round-trip from
  `test_env_value_special_chars_quoted`; assert directly on
  `shlex.quote` output — spec Step 3 forbids fixtures/mocks in
  unit tests
- Switch integration test `test_invoke_script_writes_shell_repro_line`
  to `env={}` and update regex/assertion to match empty-env form —
  spec Step 4 requires an empty env and the `^\$ cd .+ && /bin/true$`
  pattern
@vm-mishchenko vm-mishchenko marked this pull request as ready for review May 15, 2026 01:05
@vm-mishchenko vm-mishchenko merged commit 033b716 into main May 15, 2026
1 check passed
@vm-mishchenko vm-mishchenko deleted the 260515-spec-reviewer-cmd-log branch May 15, 2026 01:06
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