#2252 — External AI: product-name categories¶
Why¶
The data manager replaced the AI factor/entry CSVs with product-name provider categories. Resolution already accepted both spellings since #2091; this change makes the new spellings the only ones (no backward-compatibility paths), coordinated with a DB drop + re-upload agreed in the issue.
What shipped¶
backend/app/modules/external_cloud_and_ai/emissions.py—_AI_USE_MAPkeeps only the canonical tokens of the seven shipped categories.Copilot (Microsoft)maps toprovider_microsoft(notprovider_cohereas the issue snippet suggested — that snippet predates #2091, which added dedicated microsoft/github leaves).backend/app/modules/emissions/taxonomy.py—provider_cohere(110205) deleted; other values unchanged.registry.pyandutils/it_breakdown.pyupdated accordingly;frontend/src/types/emission-taxonomy.gen.tsregenerated.frontend/src/i18n/results.ts— chart subcategory labels renamed to the product names (en + fr); cohere label and itscharts.tsmapping removed.- Random dev seeders (
seed_factors.py,seed_data_entries.py) emit the new spellings;seed_factorsderives the emission type viaresolve_ai. - Integration rematch test seeds
ChatGPT (OpenAI)instead ofopenai. - Integration test
tests/integration/modules/external_cloud_and_ai/test_emission_type_resolution.pypins that each of the seven categories (and each cloud service_type) resolves to its own leaf through the realFactorResolver → resolve_emission_types → prepare_createpipeline. - Bug found by that test:
external_aisat in the staticDATA_ENTRY_TO_EMISSION_TYPESmap, whichresolve_emission_typesconsults before_RUNTIME_RESOLVERS— so an AI entry produced one emission row per provider leaf (7 rows, same kg, ~7× total) instead of routing throughresolve_ai. The static entry is removed (clouds already worked this way); the random seeder getsexternal_ai: external__aiin_SEED_EMISSION_ROOTSto keep seeding valid leaves.
The form/table provider dropdown needs no code change: its options derive from factor classification via the taxonomy tree, so the re-uploaded factor CSV renames it.
Deploy coupling¶
Must deploy together with the DB drop/re-upload: rows persisted with emission_type_id 110205 or old-slug providers fail hard (by design, #2091) once this code runs.