{"record":{"id":"f4a1add1d6092126","repo":"Hmbown/CodeWhale","slug":"no-default-provider-model-base-url-constants-found","errorCode":null,"errorMessage":"no default provider model/base URL constants found","messagePattern":"no default provider model/base URL constants found","errorType":"console","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"scripts/check-provider-registry.py","lineNumber":550,"sourceCode":"    return {variant_to_id[variant] for variant in variants}\n\n\ndef default_strings(tui_config_rs: str) -> set[str]:\n    # Model/base-URL constants now live in config/models.rs (#3311); scan it\n    # alongside config.rs so the check follows the leaf split.\n    sources = tui_config_rs + \"\\n\" + read(TUI_CONFIG_MODELS_RS)\n    defaults = set()\n    for name, value in re.findall(\n        r'const\\s+(DEFAULT_[A-Z0-9_]+(?:MODEL|BASE_URL)):\\s*&str\\s*=\\s*\"([^\"]+)\"',\n        sources,\n    ):\n        if name == \"DEFAULT_DEEPSEEKCN_BASE_URL\" or name.startswith(\n            \"DEFAULT_ANTIGRAVITY_\"\n        ):\n            continue\n        defaults.add(value)\n    if not defaults:\n        raise ValueError(\"no default provider model/base URL constants found\")\n    return defaults\n\n\ndef missing_default_strings(providers_md: str, defaults: set[str]) -> list[str]:\n    # Inline-code validation should not let fenced TOML/bash examples pair a\n    # stray backtick with later prose; strip fenced blocks before scanning.\n    inline_source = re.sub(r\"```.*?```\", \"\", providers_md, flags=re.DOTALL)\n    code_spans = set(re.findall(r\"`([^`]+)`\", inline_source))\n    return sorted(defaults - code_spans)\n\n\ndef report_set(label: str, expected: set[str], actual: set[str]) -> list[str]:\n    errors = []\n    missing = sorted(expected - actual)\n    extra = sorted(actual - expected)\n    if missing:\n        errors.append(f\"{label} missing: {', '.join(missing)}\")\n    if extra:","sourceCodeStart":532,"sourceCodeEnd":568,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/433685b2024e7bc4c99e1e2e326bcad39b4d9d65/scripts/check-provider-registry.py#L532-L568","documentation":"default_strings scans the default provider model/base-URL constants (now in crates/tui/src/config/models.rs plus config.rs), skipping known non-provider constants (DEFAULT_DEEPSEEKCN_BASE_URL, DEFAULT_ANTIGRAVITY_*). If no constants survive the filters it raises this ValueError — an empty result means the source layout or naming convention changed and the check would compare nothing.","triggerScenarios":"Running the check when no `pub const DEFAULT_*` string constants matching the script's expected pattern exist in crates/tui/src/config/models.rs or config.rs — constants renamed, moved to another module, or the skip-filter consumed everything.","commonSituations":"The constants module was moved again (e.g. into a provider-specific module) after the #3311 leaf split; constants renamed away from the DEFAULT_ prefix; the models.rs file was emptied during refactoring.","solutions":["Confirm default model/base-URL constants still exist in crates/tui/src/config/models.rs (or config.rs) with the DEFAULT_ naming the script scans.","If they moved, update TUI_CONFIG_MODELS_RS / the default_strings file list in scripts/check-provider-registry.py.","If the naming convention changed, update the constant-extraction regex in default_strings.","Check that the skip-filter (DEFAULT_DEEPSEEKCN_BASE_URL / DEFAULT_ANTIGRAVITY_ prefixes) is not excluding newly renamed constants unexpectedly."],"exampleFix":"// before (config.rs)\npub const OPENAI_BASE: &str = \"...\";\n// after (config/models.rs)\npub const DEFAULT_OPENAI_BASE_URL: &str = \"...\";","handlingStrategy":"validation","validationCode":"import re\nsrcs = [open(p).read() for p in (\"crates/tui/src/config/models.rs\", \"crates/tui/src/config.rs\")]\ndefaults = re.findall(r\"pub const (DEFAULT_[A-Z0-9_]+)\\s*:\\s*&str\\s*=\\s*\\\"([^\\\"]+)\\\"\", \"\\n\".join(srcs))\nassert defaults, \"no DEFAULT_* provider constants found\"","typeGuard":"def default_constants_present(models_rs: str, config_rs: str) -> bool:\n    text = models_rs + config_rs\n    return bool(re.search(r\"pub const DEFAULT_[A-Z0-9_]+\\s*:\\s*&str\", text))","tryCatchPattern":"try:\n    defaults = default_strings(models_src + config_src)\nexcept ValueError as e:\n    print(f\"check aborted: {e}\"); sys.exit(1)","preventionTips":["Keep the DEFAULT_<PROVIDER>_MODEL / DEFAULT_<PROVIDER>_BASE_URL naming convention for provider constants.","When moving constants between modules, update the script's file list (TUI_CONFIG_MODELS_RS) in the same commit.","Run the provider docs drift check after any reorganization of tui config code."],"tags":["python","regex-parse","rust","config"],"backgroundTag":"empty-result-set","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"}