{"record":{"id":"1eac75975d3db89e","repo":"Hmbown/CodeWhale","slug":"crates-config-src-provider-kind-rs-missing-providerkind-all","errorCode":null,"errorMessage":"crates/config/src/provider_kind.rs: missing ProviderKind::ALL","messagePattern":"crates/config/src/provider_kind\\.rs: missing ProviderKind::ALL","errorType":"console","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"scripts/check-provider-registry.py","lineNumber":216,"sourceCode":"            raise ValueError(\n                f\"expected a hand-written `impl Provider for {variant_name}` \"\n                f\"with id {id_literal!r}; the guard's floor is stale\"\n            )\n    if not ids:\n        raise ValueError(\"provider!() invocations returned no providers\")\n    return ids\n\n\ndef provider_kind_catalog_ids(\n    provider_kind_rs: str, variant_to_id: dict[str, str]\n) -> set[str]:\n    catalog = re.search(\n        r\"pub const ALL:\\s*\\[Self;\\s*\\d+\\]\\s*=\\s*\\[(.*?)\\];\",\n        provider_kind_rs,\n        flags=re.DOTALL,\n    )\n    if catalog is None:\n        raise ValueError(\"crates/config/src/provider_kind.rs: missing ProviderKind::ALL\")\n    variants = set(re.findall(r\"Self::(\\w+)\", catalog.group(1)))\n    catalog_variant_to_id = {**variant_to_id, \"Custom\": \"custom\"}\n    missing = variants - set(catalog_variant_to_id)\n    if missing:\n        raise ValueError(f\"ProviderKind::ALL uses unknown variants: {sorted(missing)}\")\n    return {catalog_variant_to_id[variant] for variant in variants}\n\n\ndef api_provider_ids(tui_config_rs: str) -> dict[str, str]:\n    # ApiProvider ids derive from ProviderKind ids (via delegation to .kind().as_str())\n    # plus the legacy \"deepseek-cn\" variant that exists only in ApiProvider.\n    variant_to_id = provider_kind_ids(\"\")\n    # ApiProvider::SiliconflowCn maps to ProviderKind::SiliconflowCN\n    if \"SiliconflowCN\" in variant_to_id:\n        variant_to_id[\"SiliconflowCn\"] = variant_to_id[\"SiliconflowCN\"]\n    variant_to_id[\"DeepseekCN\"] = \"deepseek-cn\"\n    return variant_to_id\n","sourceCodeStart":198,"sourceCodeEnd":234,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/433685b2024e7bc4c99e1e2e326bcad39b4d9d65/scripts/check-provider-registry.py#L198-L234","documentation":"check-provider-registry.py parses crates/config/src/provider_kind.rs with a regex expecting a `pub const ALL: [Self; N] = [Self::A, Self::B, ...];` array. If the regex finds no match it raises this ValueError, so the docs/registry consistency check cannot proceed. It fires when ProviderKind::ALL was renamed, reformatted, moved to another file, or typed in a way the regex does not recognize.","triggerScenarios":"Running the script when provider_kind.rs has no `pub const ALL: [Self; <int>] = [...];` declaration matching the regex `pub const ALL:\\s*\\[Self;\\s*\\d+\\]\\s*=\\s*\\[(.*?)\\];` — e.g. the constant was renamed, changed to a slice/Vec, split across lines with an unexpected type, or the file was moved from crates/config/src/provider_kind.rs.","commonSituations":"A refactor changed ALL from a fixed-size array to `&[ProviderKind]` or a function; the module split (lib.rs -> provider_kind.rs) was done but ALL still lives in lib.rs; a formatter or hand edit changed whitespace/type spelling so the regex no longer matches.","solutions":["Open crates/config/src/provider_kind.rs and confirm a `pub const ALL: [ProviderKind; N]` (written as `[Self; N]`) array exists; restore or add it if the refactor removed or renamed it.","If ALL was intentionally changed to another shape (slice, function), update the regex in scripts/check-provider-registry.py:216 (provider_kind_catalog_ids) to match the new declaration.","If the constant moved to another file, update PROVIDER_KIND_RS at the top of the script to point at the new path."],"exampleFix":"// before\npub const ALL: &[ProviderKind] = &[Self::Anthropic, Self::OpenAI];\n// after\npub const ALL: [Self; 2] = [Self::Anthropic, Self::OpenAI];","handlingStrategy":"validation","validationCode":"import re\nsrc = open(\"crates/config/src/provider_kind.rs\").read()\nassert re.search(r\"pub const ALL:\\s*\\[Self;\\s*\\d+\\]\\s*=\\s*\\[(.*?)\\];\", src, re.DOTALL), \"ProviderKind::ALL missing or in unexpected form\"","typeGuard":"def has_all_catalog(src: str) -> bool:\n    return re.search(r\"pub const ALL:\\s*\\[Self;\\s*\\d+\\]\\s*=\\s*\\[(.*?)\\];\", src, re.DOTALL) is not None","tryCatchPattern":"try:\n    ids = provider_kind_catalog_ids(read(PROVIDER_KIND_RS))\nexcept ValueError as e:\n    print(f\"check skipped: {e}\"); sys.exit(1)","preventionTips":["Keep ProviderKind::ALL declared exactly as `pub const ALL: [Self; N] = [...]` and note the constraint in a comment near it.","Run the registry check script locally before committing enum changes.","When changing ALL's type, grep scripts/ for its consumers in the same commit."],"tags":["python","regex-parse","rust","ci-check"],"backgroundTag":"internal-invariant-violation","analyzedSha":"433685b2024e7bc4c99e1e2e326bcad39b4d9d65","analyzedAt":"2026-09-15T12:24:24.634Z","contentChangedAt":"2026-09-15T12:24:24.634Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}