Skip to content

test(git): compare git log -5x's error with the git the test runs - #4491

Open
KuSh wants to merge 1 commit into
rtk-ai:developfrom
KuSh:fix/env-dependent-tests
Open

KuSh wants to merge 1 commit into
rtk-ai:developfrom
KuSh:fix/env-dependent-tests

Conversation

@KuSh

@KuSh KuSh commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • git_log_malformed_digit_run_propagates_real_git_error (tests/guard_integration_test.rs) asserted git's own wording, "not an integer". That message differs between git versions: git 2.43 prints fatal: '5x': not a non-negative integer, so the test failed there. It now asserts that rtk's stderr contains the stderr of the raw git log -5x the test already runs next to it, both under LC_ALL=C, per the "never assert on a third-party tool's wording" rule in .claude/rules/cli-testing.md.

Test-only change: no production code is touched.

Test plan

  • cargo fmt --all --check, cargo clippy --all-targets and cargo test --all --no-fail-fast: all green on the PR head, rebased on develop
  • Manual testing: not applicable (test-only change)

@CLAassistant

CLAassistant commented Oct 9, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@rtk-wshm-sync-bot

Copy link
Copy Markdown

wshm · Automated triage by AI

📊 Automated PR Analysis

🐛 Type bug-fix
🟢 Risk low

Summary

This PR fixes two tests that failed on machines where the environment differs from the original author's setup. One test assumed chmod 0555 makes a directory unwritable, which doesn't hold for root or CAP_DAC_OVERRIDE processes, so it now probes writability directly and skips with a note if the user can bypass permissions. The other test asserted a specific git error message wording that varies across git versions, so it now compares against the actual git invocation's stderr instead of a pinne…

Review Checklist

  • Tests present
  • Breaking change
  • Docs updated

Analyzed automatically by wshm · This is an automated analysis, not a human review.

git_log_malformed_digit_run_propagates_real_git_error pinned git's
"not an integer" wording, which differs across git versions (2.43 says
"not a non-negative integer"). Assert that rtk's stderr carries the
stderr of the raw git it runs next to instead.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@KuSh
KuSh force-pushed the fix/env-dependent-tests branch from bcf1165 to 4c0f7c0 Compare October 19, 2026 16:16
@KuSh KuSh changed the title test: make two environment-dependent tests machine independent test(git): compare git log -5x's error with the git the test runs Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants