Repository navigation
fix: honor Cargo target dir in dev stories - #796
Conversation
Signed-off-by: Danny Ward <[email protected]>
vladimirrott
left a comment
There was a problem hiding this comment.
Reviewed at 546de92. I'm asking for one test change before this lands; the fix itself looks right to me.
You moved the target lookup into scripts/dev-stories-target.sh and gave it a guard that fails when command -v sysknife resolves to anything other than the binary you just built. That turns "a stale sysknife from an earlier install answered the stories" from a silent wrong result into an error naming both paths. Staging the fixture under cargo target (with a space) and putting a stale CLI ahead of it on PATH was a good choice too.
I ran both scripts in a container with no network, streaming the tree in from this head. The image had no jq, so I put a three-line Python stand-in for jq -er .target_directory on PATH; nothing else was stubbed beyond what your tests stub.
[pristine] dev-stories-target-dir.test.sh rc=0
[pristine] story-runner-verdicts.test.sh rc=0
[M1 guard -> if false] dev-stories-target-dir.test.sh rc=1 missing built CLI unexpectedly passed the PATH guard
[M2 no PATH prefix] dev-stories-target-dir.test.sh rc=1 ERROR: expected built sysknife at .../custom target/release/sysknife, found .../earlier/sysknife
[M2 no PATH prefix] story-runner-verdicts.test.sh rc=1 2 story-runner verdict failure(s).
[M3 runner reverted] dev-stories-target-dir.test.sh rc=0
[M3 runner reverted] story-runner-verdicts.test.sh rc=0
[M4 no metadata call] story-runner-verdicts.test.sh rc=1 2 story-runner verdict failure(s).
[pristine again] both rc=0
M3 replaces the one new line in tests/e2e/dev-stories.sh, dev_stories_configure_paths "$TARGET_DIR", with the two lines it removed (DAEMON_BIN="$REPO_ROOT/target/release/sysknife-daemon" and the $REPO_ROOT/target/release PATH export). Both tests stay green.
Blocking: please make a test fail when dev-stories.sh stops calling the helper. The helper test covers the helper, and the verdict test reaches the runner, but the dev cases there find a sysknife in $fake_bin whichever directory the runner prefixes, so they pass either way. One way: give the dev cases a fixture story that prints command -v sysknife, and assert the output names $dev_target/release/sysknife. Under M3 that assertion should see the $fake_bin copy and fail. Any test that goes red under M3 works for me.
This PR also adds a step to .github/workflows/ci.yml. The step looks fine. I read every workflow change by hand before it merges, so the merge waits on that read as well as on the test above; that is how I treat all of them, yours included.
Signed-off-by: Danny Ward <[email protected]>
|
Thanks for the focused review. Commit Focused checks passed: |
Signed-off-by: Danny Ward <[email protected]>
|
Update: I synced the branch with current main in DCO-signed merge 6b36ca7 and reran the focused regression, Cargo target-dir test, and ShellCheck; all passed. Hosted CI and CodeQL are rerunning on the updated head. I have re-requested the code-owner review. |
vladimirrott
left a comment
There was a problem hiding this comment.
Reviewed at 6b36ca7 (your merge of main on top of 4bf8bd4).
The fixture story in 4bf8bd4 closes the gap I raised. It prints command -v sysknife into a file, and the case compares that path with $dev_target/release/sysknife. A revert of the runner wiring now turns a test red.
I re-ran my four mutations in a container with no network (python:3.12, with a three-line stand-in for jq -er .target_directory because that image has no jq):
[pristine] dev-stories-target-dir.test.sh rc=0
[pristine] story-runner-verdicts.test.sh rc=0
[M1 guard -> if false] dev-stories-target-dir.test.sh rc=1 missing built CLI unexpectedly passed the PATH guard
[M2 no PATH prefix] dev-stories-target-dir.test.sh rc=1 ERROR: expected built sysknife at .../custom target/release/sysknife, found .../earlier/sysknife
[M2 no PATH prefix] story-runner-verdicts.test.sh rc=1 ERROR: expected built sysknife at .../dev/cargo target/release/sysknife, found .../bin/sysknife
[M3 runner reverted] story-runner-verdicts.test.sh rc=1 FAIL: dev-stories story resolved .../bin/sysknife, expected .../dev/cargo target/release/sysknife
[M4 no metadata call] story-runner-verdicts.test.sh rc=1 ERROR: expected built sysknife at .../dev/target/release/sysknife, found .../bin/sysknife
[pristine again] both rc=0
M3 is the one I asked about. It puts the two old lines back in tests/e2e/dev-stories.sh (the fixed target/release daemon path and PATH prefix), and the verdict test now exits 1 with the failure above. Last time both tests stayed green under it.
The gate receipt is recorded at this head: maintainer-merge verify 796 6b36ca79... tests/release/dev-stories-target-dir.test.sh printed receipt recorded for #796 at 6b36ca79 (observed: clean pass, mutated fail), mutating the found_cli/built_cli guard in scripts/dev-stories-target.sh. The shell suite image carries no jq, so I ran the gate in the same image with jq added.
I read the one workflow change by hand: a step named "Check dev stories use Cargo's target directory" that runs bash tests/release/dev-stories-target-dir.test.sh after the install-paths check. It does what its name says, and every check on this head is green.
Approving. Thank you for the fast fix on both rounds.
Summary
Make the developer story runner follow Cargo's configured target directory. It now resolves the directory from
cargo metadata, uses it for the daemon, puts its CLI ahead of any stale executable onPATH, and fails clearly if the built CLI is not selected.Assisted by Codex (GPT-6).
Related Issue
Closes #659
Validation
git commit -s, see CONTRIBUTING.md)Notes for Reviewers
The regression covers a target directory containing spaces and a stale earlier
sysknifeonPATH. The existing story-runner verdict test also stages the helper and exercises a custom Cargo target directory.