Conversation
Enable platform-specific variable overrides in both [globals] and target-level variables to support cross-platform commands. Syntax: - [globals.platform.windows] - Windows overrides for global vars - [globals.platform.linux] - Linux overrides - [globals.platform.macos] - macOS overrides - [command.*.variables.platform.*] - Same for target-level variables Features: - Reserved word: 'platform' cannot be used as a variable name - Unknown platforms cause deserialization errors - Backward compatible: existing configs work unchanged - Early resolution: platform overrides resolved during config parsing - Context only sees resolved HashMap<String, String> Example usage in pls.toml: [command.exec.local-install.variables] install_cmd = "sh -c 'install target/debug/pls ~/.local/bin/pls'" [command.exec.local-install.variables.platform.windows] install_cmd = "copy target\debug\pls.exe %USERPROFILE%\.local\bin\pls.exe" 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
14c8abe to
c6139d1
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #17 +/- ##
==========================================
- Coverage 79.13% 78.80% -0.33%
==========================================
Files 38 39 +1
Lines 6359 6742 +383
Branches 6359 6742 +383
==========================================
+ Hits 5032 5313 +281
- Misses 977 1069 +92
- Partials 350 360 +10
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This commit enhances the platform-specific variable overrides feature with better validation, improved test coverage, and complete CI coverage collection. ## Changes ### Validation improvements (src/validate.rs) - Allow empty string values in variables (both base and platform overrides) - Enables clearing variables on specific platforms (e.g., `tool_args = ""`) - Added 4 unit tests for validation edge cases: - Reserved word "platform" rejection - Empty key validation for all platform overrides - Empty value support verification ### Platform detection simplification (src/config.rs) - Simplified compile-time platform detection using direct cfg attributes - Causes compile error on unsupported platforms instead of silent fallback - Cleaner code with no intermediate string constants or match statements ### Test coverage improvements (tests/test_variables.rs) - Added 3 integration tests for validation error paths: - Empty key validation in global platform overrides - Empty value support in platform overrides - Empty key validation in target-level platform overrides - All tests verify actual runtime behavior, not just parsing ### CI coverage enhancements (.github/workflows/cargo.yml) - Enable Windows coverage collection (previously excluded) - All three platforms (Windows, Linux, macOS) now generate coverage - Added platform-specific flags to Codecov uploads for segmented reporting - Enables per-platform coverage analysis on Codecov dashboard ## Test Results - 186 tests pass on all platforms - validate.rs: 98.12% line coverage (+5.89%) - All CI checks pass (cargo test, clippy, fmt, check) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Code ReviewThis PR adds Windows support and platform-specific variable overrides. The implementation is solid with good test coverage. Here are my findings: Critical IssuesPlatform override bug in Recommendation: Add a catch-all case or explicitly handle unsupported platforms: #[cfg(not(any(target_os = "windows", target_os = "linux", target_os = "macos")))]
let platform_values = &None;Code Quality IssuesInconsistent error handling for reserved word (src/validate.rs:46-51) The problem is that Cloning overhead (multiple locations)
Consider using references or Test Coverage ConcernsThe codecov report shows 70% patch coverage with 24 lines missing. Key gaps:
Minor Issues
Positive Notes
Overall: Fix the platform selection bug before merging. Consider addressing the reserved word validation inconsistency. |
Summary
This PR adds platform-specific variable overrides to handle cross-platform differences in commands and configurations.
Feature
Enable platform-specific variable overrides in both
[globals]and target-levelvariablessections to support cross-platform commands.Syntax:
Key Features:
platformcannot be used as a variable nameExample usage:
See
pls.tomlfor a practical example with thelocal-installcommand that uses platform-specific installation commands.Implementation Details
Core Changes
PlatformOverridesandVariablesstructs insrc/config.rssrc/validate.rssrc/context.rs#[cfg(target_os = "...")]Validation
tool_args = "")Testing
CI Improvements
Windows,Linux,macOS)Checklist
🤖 Generated with Claude Code