refactor: remove hardcoded CATEGORY_NAMES and move consumer utilities out of generic client #3
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
The client hardcodes 170 Kindred-specific category codes in
CATEGORY_NAMES(lines 76-232 ofsilo_client/__init__.py). This violates the server's core philosophy of schemas as configuration, not code (SPECIFICATION.md §1.1).Categories are defined in YAML on the server and served dynamically via:
GET /api/schemas-- list all schemasGET /api/schemas/{name}-- get schema with all segments and enum valuesPOST/PUT/DELETEon/api/schemas/{name}/segments/{segment}/values/{code}-- CRUD enum values at runtimeConsequences
simplesequential schema) get wrong categoriesCCC-NNNNformat, breaking for other schema formatsProposed Changes
CATEGORY_NAMESdict entirely fromsilo_client/__init__.pysanitize_filename()-- filesystem concern, not API concernparse_part_number()-- assumesCCC-NNNNformat specific tokindred-rdschemaget_category_folder_name()-- filesystem path constructionlist_schemas()method so consumers can fetch categories from the server dynamically (see schema endpoints issue)Rationale
The README describes this as a shared Python HTTP client for the Silo REST API. A generic HTTP client should not embed domain-specific part numbering knowledge. Consumers that need category names should fetch them from the server via the schema API.