feat(config): make analyzer and pipeline constants configurable#17
Merged
Conversation
…able via Viper Expose ~60 hardcoded thresholds, limits, and tuning knobs as user-configurable settings through the existing Viper config system (YAML file, env vars). Current hardcoded values are preserved as defaults so behavior is unchanged without config. Config infrastructure: - Add default constants and config structs for couples, devs, file_history, sentiment, clones, imports analyzers and extended pipeline tuning - Add validation rules (non-negative thresholds, bounded ratios, HLL precision) - Bridge new config fields through facts system to analyzers - Thread pipeline tuning params through ConfigParams → CoordinatorConfig Analyzer changes: - Each analyzer reads configurable thresholds via Configure(facts) with zero-means-default fallback pattern - Add WithOptions/WithPrecision metric variants for configurable computation - Remove test-only convenience wrappers; tests call With* variants directly Framework changes: - Thread all pipeline constants (UAST spill, memory budget, worker ratios, trim intervals, sampler config) through CoordinatorConfig - Extract pipeline factory helpers from NewCoordinator to reduce complexity - Split large functions to satisfy linter complexity limits Documentation: - Add commented examples for all new settings in .codefang.yaml - Add reference tables in site/guide/configuration.md
…atedStateSize Add mutex to Aggregator to protect concurrent map access. ProcessReport writes to metrics/counts maps while EstimatedStateSize reads map length from parallel worker pool goroutines during progress reporting.
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
Test plan
make testpasses (all existing tests unchanged, no regressions)make lintpasses (0 issues, deadcode clean)codefang runwith custom.codefang.yamloverriding new settings, verify changed behavior in outputCODEFANG_HISTORY_DEVS_BUS_FACTOR_THRESHOLD=0.7), verify they take effect