Make trace command logging truncation configurable via PREK_LOG_TRUNCATE_LIMIT#1679
Make trace command logging truncation configurable via PREK_LOG_TRUNCATE_LIMIT#1679
PREK_LOG_TRUNCATE_LIMIT#1679Conversation
Co-authored-by: j178 <[email protected]>
Co-authored-by: j178 <[email protected]>
|
@copilot Make the env var name more concise, for example, drop the COMMAND part, try better. Cache the result in a LazyLock. |
Co-authored-by: j178 <[email protected]>
Updated in |
PREK_LOG_TRUNCATE_LIMIT
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1679 +/- ##
=======================================
Coverage 91.64% 91.64%
=======================================
Files 96 96
Lines 18662 18669 +7
=======================================
+ Hits 17102 17109 +7
Misses 1560 1560 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Adds a user-configurable truncation limit for trace-level command logging (Executing ...) via a new environment variable, improving debuggability for long command lines (e.g., container entrypoints/args) while keeping the existing default behavior.
Changes:
- Introduces
PREK_LOG_TRUNCATE_LIMITinprek-constsenv var definitions. - Updates
Cmddisplay formatting to use an env-configurable truncate threshold (cached viaLazyLock). - Documents the new env var in
docs/configuration.md.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| docs/configuration.md | Documents PREK_LOG_TRUNCATE_LIMIT in the environment variables list. |
| crates/prek/src/process.rs | Reads and caches truncate limit from PREK_LOG_TRUNCATE_LIMIT and applies it when formatting Executing ... trace lines. |
| crates/prek-consts/src/env_vars.rs | Adds the new PREK_LOG_TRUNCATE_LIMIT constant to EnvVars. |
Trace-level
Executing ...lines currently truncate command arguments at a hardcoded 120 characters, which hides critical details when debugging hooks (notablydocker_imageentrypoint/args). This change introduces a configurable truncate limit while preserving existing default behavior.Config surface: new env var
PREK_LOG_TRUNCATE_LIMITtoprek-consts(EnvVars).Runtime behavior in command logging
Cmddisplay formatting incrates/prek/src/process.rsto read truncation limit fromPREK_LOG_TRUNCATE_LIMIT.LazyLockso env parsing happens once.120when unset/invalid.0as invalid and fallback to default to avoid degenerate output.Documentation
PREK_LOG_TRUNCATE_LIMITtodocs/configuration.mdunder environment variables, including default and intent.Focused unit coverage
LazyLock,Original prompt
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.