Skip to content

feat(config): make analyzer and pipeline constants configurable#17

Merged
dmytrogajewski merged 2 commits into
mainfrom
feature/configuration
Mar 13, 2026
Merged

feat(config): make analyzer and pipeline constants configurable#17
dmytrogajewski merged 2 commits into
mainfrom
feature/configuration

Conversation

@dmytrogajewski
Copy link
Copy Markdown
Contributor

@dmytrogajewski dmytrogajewski commented Mar 13, 2026

Summary

  • Expose ~60 hardcoded thresholds, limits, and tuning knobs (across 7 analyzers and the pipeline framework) as user-configurable settings via the existing Viper config system (YAML, env vars)
  • Current hardcoded values preserved as defaults — zero behavioral change without config overrides
  • Add config structs, validation, facts bridging, and documentation for all new settings

Test plan

  • make test passes (all existing tests unchanged, no regressions)
  • make lint passes (0 issues, deadcode clean)
  • Manual: run codefang run with custom .codefang.yaml overriding new settings, verify changed behavior in output
  • Manual: set env var overrides (e.g. CODEFANG_HISTORY_DEVS_BUS_FACTOR_THRESHOLD=0.7), verify they take effect

…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.
@dmytrogajewski dmytrogajewski merged commit ffc4fba into main Mar 13, 2026
5 checks passed
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