{"record":{"id":"74a853e939d30881","repo":"Humanizr/Humanizer","slug":"productive-evidence-direction-requires-at-leas","errorCode":null,"errorMessage":"Productive evidence '{direction}' requires at least 100 attempts and 99% correctness.","messagePattern":"Productive evidence '(.+?)' requires at least 100 attempts and 99% correctness\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Humanizer.SourceGenerators/Generators/ProfileCatalogs/InflectionCatalogValidation.cs","lineNumber":89,"sourceCode":"            }\n\n            if (irregular == 0 && eligible == 0)\n            {\n                throw new InvalidOperationException(\n                    $\"Inflection evidence '{direction}' N/A coverage requires a positive eligible census.\");\n            }\n\n            if (!hasProductiveRules)\n            {\n                return;\n            }\n\n            var attempted = GetRequiredInt(values, \"attempted\", $\"Productive evidence '{direction}' must define attempted\");\n            var correct = GetRequiredInt(values, \"correct\", $\"Productive evidence '{direction}' must define correct\");\n            if (attempted < 100 || correct < 0 || correct > attempted ||\n                correct * 100L < attempted * 99L)\n            {\n                throw new InvalidOperationException(\n                    $\"Productive evidence '{direction}' requires at least 100 attempts and 99% correctness.\");\n            }\n        }\n\n        static void ValidateSources(\n            SimpleYamlMapping mapping,\n            ImmutableHashSet<string> sourceIds,\n            string subject)\n        {\n            foreach (var source in GetRequiredStrings(mapping, \"sources\", $\"{subject} must define sources\"))\n            {\n                if (!sourceIds.Contains(source))\n                {\n                    throw new InvalidOperationException($\"{subject} references unknown source '{source}'.\");\n                }\n            }\n        }\n","sourceCodeStart":71,"sourceCodeEnd":107,"githubUrl":"https://github.com/Humanizr/Humanizer/blob/ffc2b77c0f30d2fb176875841424379319d0ae9b/src/Humanizer.SourceGenerators/Generators/ProfileCatalogs/InflectionCatalogValidation.cs#L71-L107","documentation":"During source generation, the inflection catalog validator checks that every direction (pluralize/singularize) with productive rules reports statistically significant evidence. The 'attempted' count must be >= 100 and the correctness ratio (correct/attempted) must be >= 99%. This is a build-time guard ensuring productive inflection rules are backed by sufficient empirical test data before shipping.","triggerScenarios":"An inflection owner's YAML evidence block for 'pluralize' or 'singularize' has 'attempted' < 100, or 'correct' * 100 < 'attempted' * 99. Only fires when hasProductiveRules is true (i.e., the bundle defines at least one forward/reverse rule).","commonSituations":"Adding a new locale with productive inflection rules but underestimating the evidence corpus. Raising the attempted count for testing without also raising correct. Typo in the YAML making 'attempted' or 'correct' parse as a small number.","solutions":["Increase the 'attempted' value in the locale's evidence block to at least 100 and ensure 'correct' is at least 99% of 'attempted'.","If the rule set is not yet empirically validated, remove the productive rules from the bundle so hasProductiveRules becomes false and this check is skipped.","Verify the YAML evidence numbers reflect real test corpus runs — re-run the inflection evidence harness and copy actual figures."],"exampleFix":"# before (in <locale>.yml inflection evidence)\nevidence:\n  pluralize:\n    attempted: 50\n    correct: 49\n# after\nevidence:\n  pluralize:\n    attempted: 200\n    correct: 198","handlingStrategy":"validation","validationCode":"# Before building, verify evidence numbers in locale YAML meet the threshold.\n# Run a YAML lint check or pre-build script:\npython3 -c \"\nimport yaml, sys\nfor f in sys.argv[1:]:\n    d = yaml.safe_load(open(f))\n    ev = d.get('inflection',{}).get('evidence',{})\n    for direction in ('pluralize','singularize'):\n        blk = ev.get(direction,{})\n        attempted = blk.get('attempted',0)\n        correct = blk.get('correct',0)\n        if attempted > 0 and (attempted < 100 or correct * 100 < attempted * 99):\n            print(f'{f}: {direction} evidence below threshold (attempted={attempted}, correct={correct})')\n\" src/Humanizer/Locales/*.yml","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run the inflection evidence test harness before editing locale YAML to capture real attempted/correct figures.","Add a CI YAML schema check that enforces attempted >= 100 and correct/attempted >= 0.99 for any direction with productive rules.","When adding productive rules to a locale, immediately update the evidence block with fresh corpus numbers."],"tags":["inflection","source-generator","evidence","yaml","build-time"],"backgroundTag":null,"analyzedSha":"ffc2b77c0f30d2fb176875841424379319d0ae9b","analyzedAt":"2026-08-13T21:42:34.584Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}