Skip to content

fix: honor Cargo target dir in dev stories - #796

Merged
vladimirrott merged 3 commits into
lacs-project:mainfrom
dannyward630:fix/659-cargo-target-dir
Nov 17, 2026
Merged

vladimirrott merged 3 commits into
lacs-project:mainfrom
dannyward630:fix/659-cargo-target-dir

Conversation

@dannyward630

Copy link
Copy Markdown
Contributor

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 on PATH, and fails clearly if the built CLI is not selected.

Assisted by Codex (GPT-6).

Related Issue

Closes #659

Validation

  • Tests added or updated
  • Documentation considered (no user-facing documentation change was needed)
  • Security impact considered
  • Trust boundary preserved (the daemon remains the only privileged executor)
  • CI passes — the full Rust workspace suite passed (2,128 passed, 8 skipped); focused regressions, clippy, rustdoc, formatting, and shellcheck passed. The local CI script was stopped during its repository-wide Markdown link scan; hosted CI is pending.
  • Every commit is signed off (git commit -s, see CONTRIBUTING.md)

Notes for Reviewers

The regression covers a target directory containing spaces and a stale earlier sysknife on PATH. The existing story-runner verdict test also stages the helper and exercises a custom Cargo target directory.

@vladimirrott vladimirrott left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@dannyward630

Copy link
Copy Markdown
Contributor Author

Thanks for the focused review. Commit 4bf8bd4 adds a dev-story fixture that records command -v sysknife and asserts it resolves to $dev_target/release/sysknife. The runner fixture keeps $fake_bin ahead of the system PATH, so reverting to the fixed $REPO_ROOT/target/release prefix makes the assertion see $fake_bin/sysknife and fail.

Focused checks passed: bash tests/e2e/story-runner-verdicts.test.sh, bash tests/release/dev-stories-target-dir.test.sh, shellcheck --severity=warning on both scripts, Bash syntax checks, and git diff --check. scripts/ci-local.sh could not start locally because Cargo, cargo-nextest, cargo-audit, and yamllint are unavailable; hosted workflows are running on the new head.

@dannyward630

Copy link
Copy Markdown
Contributor Author

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 vladimirrott left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@vladimirrott
vladimirrott merged commit ac9e521 into lacs-project:main Nov 17, 2026
14 checks passed
vladimirrott added a commit that referenced this pull request Nov 17, 2026
…790 (#805)

Eight merged pull requests had no Unreleased entry.

Signed-off-by: Vladimir Rotariu <[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.

dev-stories.sh runs the stories against the sysknife on PATH, not the binary it builds

2 participants