bug: test_parse_attachments_size_limit_accumulates fails with path validation error

Open Beginner friendly
#593 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
64/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
rust
Domain
testing

Research direction

Start with src/helpers/gmail/mod.rs and run helpers::gmail::tests::test_parse_attachments_size_limit_accumulates to reproduce the intermittent path validation error. Read validate_safe_file_path and the test's temporary-file setup, then make the test pass reliably while preserving the assertion that the attachment size limit is exceeded.

Written by the indexing model from the issue text.

Description

area: core type: bug

Description

The test helpers::gmail::tests::test_parse_attachments_size_limit_accumulates intermittently fails with a path validation error:

thread 'helpers::gmail::tests::test_parse_attachments_size_limit_accumulates' panicked at src/helpers/gmail/mod.rs:2670:9:
error should mention exceeding limit: --attach '/path/to/.tmpmkVJJo/big1.bin' resolves to '/path/to/.tmpmkVJJo/big1.bin' which is outside the current directory

Root Cause

The test creates temporary files using a relative path with a hidden directory prefix (.tmp*), but the path validation logic (validate_safe_file_path) rejects the resolved canonical path as "outside the current directory" due to how symlink/canonical resolution interacts with temporary directories.

Impact

  • Blocks git push when the pre-push hook runs the full test suite
  • Not related to any specific code change — reproducible on main

Expected Behavior

The test should either:

  1. Create temp files in a way that passes path validation, or
  2. Use std::env::temp_dir() with an appropriate test-only bypass for path validation
Dominant language
Rust
Stars
31.1k
Forks
1.8k
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from googleworkspace/cli

All issues in googleworkspace/cli

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.