Repository navigation
feat(cli): stepfork run — a tri-state verdict and a runner-owned receipt - #20
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #14, implementing the part you asked for in your last comment: the tri-state verdict, the runner-owned receipt, and
stepfork run --receipt.Why the receipt has to belong to the runner
stepfork exportwrites a pytest file. Run that file with pytest directly and its exit status cannot tell these cases apart. Measured on pytest 9.1.1 against the file the export actually produces:failurefailurefailureerrorerrorThe first two rows are identical in both the status and the kind, so a pipeline keying on either one reports a missing artifact as a caught regression — the case a reader hits the first time they copy the test somewhere without the bundle, which is exactly the path
docs/pytest-export.mdsends them down.What this adds
src/stepfork/export/receipt.py— the runner:could_not_executeand no failure is manufactured for it;--junit-xmland derives the verdict from the counts, not from the exit status alone;passedfailedcould_not_executereasonis set whenever the verdict iscould_not_executeand names the way it failed:bundle_missing,bundle_unreadable,test_unreadable,check_error,no_tests_collected,report_missing,pytest_unavailable.The receipt records the verdict, the raw
exit_status, the JUnit counts, thebundle_digest, thetest_sha256, the command, the duration, the stepfork version andcreated_at.bundle_digesthashes the bundle's file contents in sorted relative-path order rather than the directory's metadata, so copying a bundle between machines leaves the digest unchanged and editing any file in it changes it.src/stepfork/cli/run.pydocs/cli.md— therunsection, the measured table above, and the exit-code convention updated to say that2also covers a check that could not execute.What it does not catch
failure, still indistinguishable from a real verdict. ResolvingENTRYPOINTbefore the launch the same way the bundle is resolved would close that; it is deliberately not in this PR.failed— correctly, because it really did fail to replay. This PR makes the un-run case visible, not the unpassable one.Tests
tests/unit/test_cli_run.py, 9 tests: each verdict path (missing bundle, pass, fail, collection error, empty file), the receipt naming the test and the bundle it rests on, the digest changing with the bundle's content,--json, and an explicit--bundle.Full suite in a fresh venv: 550 passed, 4 failed — all four fail on
maintoo, onModuleNotFoundError: No module named 'langchain_core'(the optional dependency is not installed in this venv), and none of them touch the new code.