Repository navigation
test: add 31 new regression tests - #305
Conversation
|
@strandly-the-agent Please review this change |
strandly-the-agent
left a comment
There was a problem hiding this comment.
Approve, with two should-fixes. All the expectations I checked match bash and GNU date, and the full suite passes. But one test pins a known bug as correct, and the MCP exit-code check doesn't run against #268's description.
- 🟡
tests/lookup_and_env.rs:49expectscommand -V echoto saybuiltinafterecho() {...}. Bash saysecho is a functionand runs the function. #174 already lists this as a bug, so whoever fixes it will see this test fail as if they'd caused a regression. - 🟡
tests/mcp_integration.rs:157only checks the exit code when the description mentionsmetadata.exit_code. #268's description doesn't, so on #268 nothing checks thatexit 3comes back as 3.
Details and suggested fixes are inline.
What I verified
- Tests: ran on
f2ec042.cargo test --workspace --all-targetspasses. The five new or touched targets pass on their own:command_registry5,date_fixed_clock5,lookup_and_env10,mcp_integration41, anddifferential1 test (92 cases passed, 0 failed, 20 known differences). - Recorded output: I ran all 9 new
.shcases underenv -i PATH=/usr/bin:/bin LC_ALL=C bash(5.2.15) in an empty directory, the same wayrecord()does. All 9 match their.expectedbyte for byte. I also ranexport_attributes.shseparately and got the same stdout, exit 0, and the readonly errors on stderr. - Known differences: each of the 5 markers really does differ on main when run through
strands-shell -c. For example,local_without_valuegivesv=[global] z=[1], andfind_missing_startexits 0/0. None of them depends on the environment. - Dates: all 11 instants and the 12-hour format line match GNU
date -u -d @N. Nothing depends on the host TZ. - Source parsers in
command_registry.rs: the parsed lists are compared as sets against the native registry, so a parse that finds nothing fails. Formats the parser can't read, like"a" \| "b" =>arms or a reworded anchor comment, also fail loudly. Thecurlandsleepomissions are real.
I ran only the correctness pass. There's no public API or src/ change, so I skipped API review, and I skipped the adversarial pass because the PR's own mutation table already covers that ground.
Non-blocking (1)
- Known-difference cases (
local_without_value,command_v_unset_path,find_missing_start, etc.) only notice when main starts matching bash. They don't pin what main does today, so a refactor that changes one wrong output into a different wrong output passes. That's how the harness is built, so it's fine here, but it's worth keeping in mind when reading the "Caught" column.
…t code on every description
|
@strandly-the-agent Please review this change |
strandly-the-agent
left a comment
There was a problem hiding this comment.
Still approving. Both earlier findings are fixed in e7f4268. The new differential case has one problem of its own (inline).
- ✅
lookup_and_env.rs: the integration test no longer pins the #174 bug. - ✅
mcp_integration.rs: it passes on top of #268, and it fails when #268 reports the wrong exit code. - 🟡
function_shadows_builtin.sh: this marker won't flip when #174 is fixed, becausecommand -Vprints functions differently from bash.
I can't resolve review threads with my permissions, so the two old ones need resolving by hand.
What I verified
- On e7f4268 these pass:
differential(92 passed, 0 failed, 21 known differences),lookup_and_env(10), andmcp_integration(41). - I put e7f4268's
tests/mcp_integration.rson top of #268 and the test passes. When I changed #268's third block toexit code: {exit_code + 1}, it failed atmcp_integration.rs:161withleft: "exit code: 1" right: "exit code: 0". - strands-shell prints
f is a shell functionforcommand -V f, the same as dash. Bash printsf is a functionfollowed by the function body.
|
@strandly-the-agent Please review this change |
strandly-the-agent
left a comment
There was a problem hiding this comment.
Approved on 673071d. All three findings are fixed, and I have nothing new.
function_shadows_builtin now checks only whether the function runs, so fixing #174 will flip its marker. strands-shell already supports builtin echo, so the function body will work once the function is actually called. I can't resolve review threads, so the last one needs resolving by hand.
What I verified
- The re-recorded
.expectedmatches bash 5.2.15 run withenv -i PATH=/usr/bin:/bin LC_ALL=Cin an empty directory: stdoutfn, exit 0. - On main, strands-shell prints
hi, so the known difference is real. cargo test --test differentialon 673071d: 92 passed, 0 failed, 21 known differences.
strands-agents#305 added this differential case with a known-difference marker noting that every variable reached child commands, "fixed by strands-agents#285". This PR is that fix: env and other child commands now see only exported variables, so the case matches bash and the harness fails until the marker goes.
Description
About 30 open PRs refactor or extend code that main barely tests: the command lists, export and env handling,
command -v, the find walk, the date math, and the MCP shell tool result. I broke that code on purpose in about 20 ways, and 16 of 21 of them still passed the existing tests. As those PRs get rebased and merged, a bad conflict resolution or a refactor slip would go unnoticed.This adds tests that pin what main does today, so each of those PRs can be checked against them. Test-only change, nothing under
src/changes. Most of it is new differential cases recorded from bash 5.2.15 (coreutils 8.32, jq 1.8.1), plus a few integration tests for things the differential suite can't express.What's covered:
How I checked it:
/binlistlist-commandsoutput unsortedlocal xwith no value does nothingreadonly xwith no value sets it to emptyexport xwith no value clears itunsetkeeps the valuex=1 cmdprefix not appliedcommand -vskips the hash tablecommand -V-emptytrue for a directory with one entryRelated Issues
Part of #207
Documentation PR
N/A
Type of Change
Other (please describe): test-only change
Testing
How have you tested the change? Verify that the changes do not break functionality or introduce new warnings.
cargo test --workspace --all-targets,pytest tests/python,npm test)cargo fmtandcargo clippyChecklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.