Skip to content

Studio: tests fake programs with one Rust fake from test-support (#805) #813

Done

Description

@danielrispler

Parent

#805

What to build

Tests fake programs with one Rust fake from test-support, not shell scripts. A test asks for a fake of a name (claude, agy, git, …) in a folder with a behaviour: what it prints on stdout and stderr, its exit code, an optional wait before exiting, and whether to record the call. It gets back the fake's path, and can rewrite the behaviour between calls. The fake is the test's own executable started under another name, so it needs no shell, Python or Node and runs the same on macOS, Linux and Windows. workbench/tests/run.rs's fake moves to it, and AGENTS.md "Tests" stops new shell fakes. The research note docs/studio/research/windows.md lands in this ticket's PR, the spec's first.

The design is settled in #805, "Implementation Decisions" ("The Rust fake") and "Made without Daniel" Q4–Q5.

This ticket runs as its own non-draft PR before /implement-spec takes #805's other tickets (docs/agents/ticket-authoring.md, "Checks that need CI"): current_exe through a hard link and the copy fallback behave per platform, and only the ubuntu job, which skips drafts, runs Linux.

Acceptance criteria

  • test-support places a hard link to the running test binary at <folder>/<name> (<name>.exe on Windows), or a copy where a hard link cannot be made, never a symbolic link, and writes the behaviour file beside it.
  • Code run before the test harness's main, through the ctor crate (a dependency of test-support only), checks for a behaviour file beside std::env::current_exe(); when one is there it acts out the behaviour and exits without starting the harness.
  • Each recorded call appends one entry to a JSON record beside the fake: the arguments, the working folder, stdin and the environment.
  • test-support's own tests check that a fake prints what it was told, exits with its code, records arguments, folder, stdin and environment, waits when told, and acts out the second behaviour after a rewrite.
  • workbench/tests/run.rs's fake is the Rust fake, and its tests check the same facts as before, read from the record instead of printed lines.
  • AGENTS.md "Tests" gains one rule: a test that needs a fake program uses test-support's fake, never a #!/bin/sh script, and no code or test starts sh or bash by bare name (on Windows a bare bash from Rust is WSL's launcher: windows.md, "CI spike results").
  • docs/studio/research/windows.md is committed, copied from the main checkout's untracked file at /Users/danielrispler/work/plotkeeper/docs/studio/research/windows.md (the worker leaves that file alone). Before the merge's git pull --ff-only in the main checkout, the merger deletes that untracked copy once cmp shows it equal to the merged file, or the pull refuses to overwrite it (docs/agents/issue-tracker.md, the merge procedure, step 6).
  • npm run check passes locally, and the PR's ubuntu job is green.

Reading

Touches

  • Files: test-support/src/lib.rs, new test-support/src/fake.rs, test-support/Cargo.toml, new test-support/tests/fake.rs, workbench/tests/run.rs, Cargo.lock, AGENTS.md, new docs/studio/research/windows.md
  • Session: auto mode
  • Route: medium · effort medium — a new module whose design the spec settles, with its own tests; no persistence, stored type, queue or UI

Activity

  1. added
    ready-for-agent
    on Nov 28, 2026
  2. danielrispler commented on Nov 28, 2026

    @danielrispler
    OwnerAuthor

    Implemented in PR #816 (its own PR against main; ubuntu job green).

    Route outcome: medium·medium claude/sonnet → pass,pass | 14m; 13m

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

ready-for-agent

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions