{"record":{"id":"9ad5202ea24c2781","repo":"HKUDS/Vibe-Trading","slug":"intended-use-is-required-and-must-be-non-empty","errorCode":null,"errorMessage":"intended_use is required and must be non-empty","messagePattern":"intended_use is required and must be non-empty","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"agent/src/strategy_store/models.py","lineNumber":254,"sourceCode":"        )\n\n\ndef validate_model_registration(artifact: Artifact) -> None:\n    \"\"\"Validate that *artifact* carries the minimum model-registration fields.\n\n    A model registration without a stated intended use or a stated\n    limitation is, for governance purposes, not actually registered — so\n    both fields are required and must be non-blank.\n\n    Args:\n        artifact: The artifact/model record to validate.\n\n    Raises:\n        ValueError: if ``intended_use`` or ``limitations`` is missing or\n            consists only of whitespace.\n    \"\"\"\n    if not artifact.intended_use or not artifact.intended_use.strip():\n        raise ValueError(\"intended_use is required and must be non-empty\")\n    if not artifact.limitations or not artifact.limitations.strip():\n        raise ValueError(\"limitations is required and must be non-empty\")\n","sourceCodeStart":236,"sourceCodeEnd":257,"githubUrl":"https://github.com/HKUDS/Vibe-Trading/blob/80ffdda44c5c4db0dd84d70e051cca591cea67df/agent/src/strategy_store/models.py#L236-L257","documentation":"validate_model_registration requires every registered model artifact to declare its intended use. ValueError is raised when intended_use is None/empty or whitespace-only. This is a governance requirement so no model enters the registry without a stated purpose.","triggerScenarios":"register_artifact with intended_use='' or '   ' or omitted (defaults empty); programmatic bulk-registration where the field was never populated in source configs.","commonSituations":"Migrating legacy artifacts whose metadata lacked the field; YAML/JSON registration files missing the key; fixtures that only set limitations.","solutions":["Populate intended_use with a concrete description (e.g. 'daily intraday signal ranking') in the artifact before registering","For bulk imports, validate/fill metadata upstream and fail rows that lack it"],"exampleFix":"# before\nArtifact(name='m1', universe='u1', intended_use='  ', limitations='...')\n# after\nArtifact(name='m1', universe='u1', intended_use='daily signal ranking for US equities', limitations='...')","handlingStrategy":"type-guard","validationCode":"if not (artifact.intended_use or '').strip():\n    artifact.intended_use = source_config.get('purpose') or 'unspecified (legacy import)'","typeGuard":"def has_intended_use(a) -> bool:\n    return bool(a.intended_use and a.intended_use.strip())","tryCatchPattern":"try:\n    store.register_artifact(artifact)\nexcept ValueError as e:\n    if 'intended_use' in str(e): fill the field from metadata and retry once\n    else: raise","preventionTips":["Make intended_use a required key in registration YAML schemas","Validate metadata completeness before batch imports","Add CI checks on registration configs"],"tags":["python","model-registry","required-field"],"backgroundTag":"missing-required-field","analyzedSha":"80ffdda44c5c4db0dd84d70e051cca591cea67df","analyzedAt":"2026-08-28T12:46:38.989Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}