Skip to content

chore(bottlecap): cross-platform test and code cleanups#1211

Merged
lucaspimentel merged 6 commits intomainfrom
lpimentel/bottlecap-cleanups
Apr 24, 2026
Merged

chore(bottlecap): cross-platform test and code cleanups#1211
lucaspimentel merged 6 commits intomainfrom
lpimentel/bottlecap-cleanups

Conversation

@lucaspimentel
Copy link
Copy Markdown
Member

@lucaspimentel lucaspimentel commented Apr 24, 2026

Overview

Portable test and code cleanups in bottlecap. No behavior change on Linux.

  • .gitattributes: force LF for *.sh / *.bash. Shell scripts now check out with LF on every platform, so a CRLF-prone checkout (e.g. Windows) still executes cleanly inside Linux Docker containers.
  • bottlecap/src/tags/lambda/tags.rs, the three tags::lambda::tags::tests::test_resolve_* tests:
    • Switch from a hard-coded /tmp/... path to std::env::temp_dir(). Removes a bootstrap race between tests that were implicitly sharing a filesystem side effect through the same path.
    • Render paths with to_string_lossy() so a non-UTF-8 temp dir does not panic the test.
    • test_resolve_runtime now cleans up the file it created.
  • bottlecap/src/metrics/enhanced/statfs.rs:
    • statfs_info is fn on both targets. It's an internal helper; pub was only present on the non-Windows branch.
    • The existing #[cfg(target_os = "windows")] stub now uses io::Error::other(..) (per clippy::io_other_error) and prefixes its unused path with _.

Origin: these commits were split out of #1193 after review feedback, so the portable cleanups can land independently of the broader Windows-build discussion.

Testing

  • cargo check on Linux: clean.
  • cargo test --lib tags::lambda::tags::: 8 passed, 0 failed.

"Turns out 'make the tests not race on Windows' is also 'make the tests not race on Linux'.", Claude 🤖

lucaspimentel and others added 6 commits April 24, 2026 11:07
Ensures *.sh and *.bash files are checked out with LF line endings on
Windows, so they execute correctly inside Linux Docker containers.
The three resolve_runtime / resolve_provided tests hard-coded a Linux
temp path that does not exist by default on Windows, causing them to
race on a fresh machine depending on which test triggered the directory
creation first. std::env::temp_dir returns a directory that always
exists on every supported platform, removing the bootstrap race.
- Prefix unused `path` parameter with `_` to silence unused_variables.
- Use `io::Error::other` per `clippy::io_other_error`.

Both changes apply to the existing `#[cfg(target_os = "windows")]`
stub in the file; no behavior change.
The function is only used internally; removing pub aligns visibility
across platforms.

🤖 Co-Authored-By: Claude Code <noreply@anthropic.com>
Avoids a potential panic when the temp directory path contains
non-UTF-8 characters.

🤖 Co-Authored-By: Claude Code <noreply@anthropic.com>
🤖 Co-Authored-By: Claude Code <noreply@anthropic.com>
@lucaspimentel lucaspimentel changed the title chore(bottlecap): cross-platform cleanups split out from #1193 chore(bottlecap): cross-platform test and code cleanups Apr 24, 2026
@lucaspimentel lucaspimentel marked this pull request as ready for review April 24, 2026 15:54
@lucaspimentel lucaspimentel requested a review from a team as a code owner April 24, 2026 15:54
@lucaspimentel lucaspimentel requested review from Copilot and duncanista and removed request for Copilot April 24, 2026 15:54
@lucaspimentel lucaspimentel merged commit 9f49e35 into main Apr 24, 2026
56 of 60 checks passed
@lucaspimentel lucaspimentel deleted the lpimentel/bottlecap-cleanups branch April 24, 2026 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants