Repository navigation
chore(forge): check compares the recorded git command line #303
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -267,6 +267,10 @@ def cmp_exchange(exp, act, bij, extra_volatile=(), status_override=None, skip_he | |
| if exp["kind"] == "git": | ||
| if exp["name"] != act["name"]: | ||
| return [("fail", f"git step {exp['name']} expected, got {act['name']}")] | ||
| # the command line too: a scenario that keeps its step name but changes the arguments (or the | ||
| # credentials form) must not keep matching its fixture; placeholders keep shas and hosts by identity | ||
| if exp.get("cmd") is not None and not eq_str(exp["cmd"], act["cmd"], bij, [], ""): | ||
| return [("fail", f"git command {exp['cmd']!r} expected, got {act['cmd']!r}")] | ||
|
Comment on lines
+272
to
+273
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When a git exchange has a departure (for example, the scenario S entries in Useful? React with 👍 / 👎.
Comment on lines
+272
to
+273
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When Useful? React with 👍 / 👎. |
||
| if exp["ok"] != act["ok"]: | ||
| d.append(("fail", f"git ok={exp['ok']} expected, got {act['ok']}: {act['output'][:200]!r}")) | ||
| elif not exp["ok"]: | ||
|
|
@@ -1161,6 +1165,11 @@ def cmd_selftest(a): | |
| n = len(obj["exchanges"]) | ||
| assert text.count("\n") == (n + 2 if n else 3), "header line, one line per exchange, closing line" | ||
| assert all("\n" not in J.dumps(e) for e in obj["exchanges"]) | ||
| # git steps compare the command line too, by placeholder identity | ||
| step = {"kind": "git", "name": "clone", "cmd": "git clone http://<creds>@<host>/acme/a.git <tmp>/w", "ok": True, "output": ""} | ||
| assert not cmp_exchange(step, dict(step), Bij()), "an identical git step matches" | ||
| other = dict(step, cmd="git clone --depth=1 http://<creds>@<host>/acme/a.git <tmp>/w") | ||
| assert any("git command" in t for _, t in cmp_exchange(step, other, Bij())), "changed arguments must fail" | ||
| bad = [] | ||
| for d in sorted(os.listdir(a.fixtures_root)): | ||
| full = os.path.join(a.fixtures_root, d) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: git-agentic/src-control
Length of output: 288
🏁 Script executed:
Repository: git-agentic/src-control
Length of output: 15974
Handle a missing
cmdon the actual side of the git comparison.The git branch guards only the expected record. If the actual record lacks
cmd,act["cmd"]raisesKeyError. This can happen in the offlinerun.py diffpath when one fixture directory has a git exchange withoutcmd. The traceback stops the diff instead of listing the mismatch. The recording path is not affected, becausegit()always recordscmd.🐛 Suggested fix
🤖 Prompt for AI Agents