feat(config): add [environment] and [defaults] config sections for auto metadata#692
Merged
Conversation
…to metadata Allows users to define metadata sources in .gitperfconfig: [environment] commit = "GITHUB_SHA" # single env var runner_id = ["RUNNER_NAME", "CI_RUNNER_ID"] # first-found wins [defaults] environment = "local" # static fallback Precedence (highest to lowest): CLI --key-value > [environment] > [defaults]. Adds --skip-env flag to measure, add, and import commands to bypass [environment] lookups. Sensitive variable names containing TOKEN or SECRET are blocked and logged as warnings. Closes #320 https://claude.ai/code/session_01A9QXKgBLkLZaeRxJt57bus
Contributor
Performance ReportAudit ResultsMeasurement Storage SizeCreated by git-perf |
Contributor
🧬 PR Mutation Testing ResultsStatus: ✅ All mutants caught - excellent test coverage! Mutation Testing Metrics (Changed Code Only)
Mutation Score: 100.0% (38/38 viable mutants caught) ✅ Great Job!All mutants in your changes were caught by the test suite. Your code is well-tested! Incremental mutation testing only tests code modified in this PR. 📦 Artifacts |
Escape [environment] in doc comments using backticks to prevent rustdoc from interpreting them as broken intra-doc links. Refactor resolve_key_values() to read and parse .gitperfconfig exactly once instead of twice (previously called read_raw_gitperfconfig() for both [defaults] and [environment], each spawning a git subprocess). Extract parse_environment_from_doc() and parse_defaults_from_doc() helpers that operate on an already-parsed DocumentMut. https://claude.ai/code/session_01A9QXKgBLkLZaeRxJt57bus
Update generated manpages and markdown docs to reflect the corrected `[environment]` formatting in the --skip-env argument description. https://claude.ai/code/session_01A9QXKgBLkLZaeRxJt57bus
kaihowl
commented
May 24, 2026
Single is just a special case of a one-valued list. Remove the enum and use Vec<String> directly as the value type for read_environment_config() and parse_environment_from_doc(). The apply_env_source helper now takes Vec<String> and handles both cases uniformly. https://claude.ai/code/session_01A9QXKgBLkLZaeRxJt57bus
Remove the incomplete TOKEN/SECRET blocklist from apply_env_source. The filter gave false confidence while missing most sensitive variable patterns (PASSWORD, KEY, CREDENTIAL, etc.). A security note is added to all relevant documentation instead, making the responsibility clear to users. Also add missing --skip-env bash integration tests for measure and import commands, and document the [environment] and [defaults] config sections in CLAUDE.md, README.md, docs/example_config.toml, and docs/importing-measurements.md. https://claude.ai/code/session_01EU3bMeB229LZVQpFFUBXNw
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #320
[environment]config section mapping metadata keys to environment variable names (single string or first-found array)[defaults]config section for static fallback values when env vars are unset--skip-envflag tomeasure,add, andimportcommands to bypass environment lookupsPrecedence (highest to lowest): CLI
--key-value/--metadata>[environment]>[defaults]Example config:
Test plan
config.rscovering all precedence layers, multi-source fallback, and empty-var guardtest/test_env_defaults_config.shwith 13 sections coveringadd,measure,import,--skip-envfor all three commands, and no-config baselinecargo nextest run -- --skip slow(all pass except pre-existingtest_removelibfaketime failure)git-perf-add,git-perf-measure,git-perf-importhttps://claude.ai/code/session_01EU3bMeB229LZVQpFFUBXNw