Skip to content

fix: quote describe() argv, isolate rm -rf test jail, unique job ids - #125

Merged
ajianaz merged 1 commit into
developfrom
fix/command-surfaces
Sep 22, 2026
Merged

ajianaz merged 1 commit into
developfrom
fix/command-surfaces

Conversation

@ajianaz

@ajianaz ajianaz commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

What (description of the change)

Three cora full-scan MAJORs on the command surfaces, one PR:

  1. run_command describe() re-quotes ambiguous tokens (feat(core): state machine legality + effect sandwich (E2) #16): tokens with whitespace/quotes/metacharacters render single-quoted (embedded ' widened to '\''), so approval prompts show true token boundaries — printf 'a b' (one arg) renders differently from printf a b (two args); echo a;b can no longer masquerade as two harmless tokens.
  2. Test jail isolation (feat(core): approval gate, real OpenAI-compatible provider, cora_search tool (E4) #18): benign_commands_with_destructive_looking_args_pass actually EXECUTES rm -rf ./build; it now runs against a per-test scratch jail (with its own build/ dir and fixture files) instead of the shared temp dir, and cleans up after itself.
  3. Job id collision (docs: update README status line to Phase 2 (E8 MVP gate) #34): new_job_id() gains a process-wide AtomicU64 counter segment — j-<ms>-<pid>-<n> — so two job_start calls within the same millisecond can never collide.

Why (the problem you're solving)

Closes #120. #16 is an approval-surface integrity issue (the human must see exact token boundaries to approve knowingly); #18 is a test-isolation defect that can delete peer tests' fixtures mid-run; #34 breaks job bookkeeping (two jobs, one id → poll/log confusion).

Testing (how you verified this works)

  • describe_shows_exact_argv updated + new describe_quotes_ambiguous_tokens: one-arg-with-space vs two-args render differently; embedded quotes widen; metacharacters quoted.
  • The isolated-jail test runs the real rm -rf ./build inside its own scratch dir and passes; full workspace suites green; mobile (--no-default-features) green; clippy -D warnings clean; cora review: No issues found.

…120)

Three cora full-scan MAJORs on the command surfaces:
- run_command describe() re-quotes tokens containing whitespace,
  quotes, or shell metacharacters (embedded quotes widen to '\'' ):
  approval prompts now preserve token boundaries — 'printf a b' (one
  arg) renders differently from 'printf a b' (two args).
- benign_commands test EXECUTES 'rm -rf ./build' against the SHARED
  temp dir; now each run gets an isolated scratch jail with its own
  build/ dir (peer tests' files can no longer be deleted).
- job_start ids gain a process-wide AtomicU64 counter segment
  (j-<ms>-<pid>-<n>): two starts in the same millisecond can no
  longer collide on the same id.
Unit tests: ambiguous-argv rendering matrix, id uniqueness covered by
the counter; full suites + clippy -D warnings green.
@github-actions

Copy link
Copy Markdown

🔍 Cora AI Code Review

✅ No issues found. Code looks good!


Review powered by cora-code · BYOK · MIT

@ajianaz
ajianaz merged commit f6a5525 into develop Sep 22, 2026
16 checks passed
@ajianaz
ajianaz deleted the fix/command-surfaces branch September 22, 2026 15:29
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.

command surfaces: quote describe() argv, isolate rm -rf test jail, unique job ids

1 participant