refactor: simplify rewrite config and rename risk tolerance levels#92
Merged
lipikaramaswamy merged 1 commit intoApr 3, 2026
Merged
Conversation
437ce5d to
1dc4795
Compare
Flatten EvaluationCriteria into Rewrite: risk_tolerance and max_repair_iterations are now top-level fields on Rewrite instead of nested inside EvaluationCriteria. EvaluationCriteria is preserved as an internal class via Rewrite.evaluation property. Rename RiskTolerance enum values to read naturally as tolerance levels: strict → minimal, conservative → low, moderate (unchanged), permissive → high No behavioral changes — all thresholds and logic are identical. Made-with: Cursor
1dc4795 to
6238c24
Compare
asteier2026
approved these changes
Apr 3, 2026
lipikaramaswamy
added a commit
that referenced
this pull request
Apr 6, 2026
Resolve conflicts with #92 (flattened Rewrite config): - risk_tolerance/max_repair_iterations now top-level on Rewrite - RiskTolerance enum: strict->minimal, conservative->low, permissive->high - Drop EvaluationCriteria import from CLI - Re-remove skip_low_sensitivity_pii (came back from main) Made-with: Cursor
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
Simplify the user-facing rewrite config and rename risk tolerance levels for clarity.
Config simplification
risk_toleranceandmax_repair_iterationsare now top-level fields onRewriteinstead of nested insideEvaluationCriteria:Risk tolerance rename
Enum values renamed to read naturally as tolerance levels:
strictminimalconservativelow(default)moderatemoderatepermissivehighWhat changed per file
src/anonymizer/config/rewrite.pystrict→minimal,conservative→low,permissive→high)RISK_TOLERANCE_THRESHOLDSdict andDOMAIN_RISK_TOLERANCEdict with_RiskToleranceBundledataclass bundling all thresholds per preset_RISK_TOLERANCE_BUNDLESmappingEvaluationCriteria: removeauto_repair_privacy,auto_adjust_by_domain,max_leakage_mass,flag_leakage_mass_above,get_effective_threshold(). Add derived properties (repair_threshold,repair_any_high_leak,flag_utility_below,flag_leakage_above) from bundleconservativetolow(same numeric thresholds)src/anonymizer/config/anonymizer_config.pyRewrite: replaceevaluation: EvaluationCriteriafield with top-levelrisk_toleranceandmax_repair_iterationsfieldsRewrite.evaluationproperty that constructsEvaluationCriteriainternallyRiskTolerancesrc/anonymizer/__init__.pyRiskTolerancefrom top-level packagesrc/anonymizer/engine/rewrite/evaluate.pyauto_repair_privacyfromRepairNeedsParamsanddetermine_repair_needs()domainparam fromEvaluateWorkflow.columns()evaluation.repair_thresholddirectly instead ofget_effective_threshold(domain)src/anonymizer/engine/rewrite/final_judge.pyflag_leakage_mass_above→flag_leakage_aboveinHumanReviewParamsand usagesrc/anonymizer/engine/rewrite/rewrite_workflow.py_extract_domain()helper anddomainplumbing through the evaluate-repair loopevaluation.repair_thresholddirectlyTests: updated to match new enum values and removed params
Test plan