What happened?
After the inspector overhaul (issue A1/A2), ArtifactMetadata fields framework, class_name, input_hint, and output_hint can be None when inspection partially failed. write_scaffold in writer.py formats them directly into the scaffold template without guarding for None.
None in comments is harmless but misleading. If any field is removed from ArtifactMetadata during the overhaul, the format call raises KeyError.
# current writer.py — crashes when fields are None or removed
source = _SCAFFOLD_TEMPLATE.format(
framework=meta.framework,
class_name=meta.class_name,
input_hint=meta.input_hint,
output_hint=meta.output_hint,
)
### Steps to reproduce
1. Deploy an artifact where inspection partially fails (e.g. xgboost not installed in inspection env)
2. Inspector sets `framework=None`
3. `write_scaffold` formats `None` into the template or raises `KeyError`
### Expected behavior
Coerce `None` fields to `"unknown"` before template formatting:
```python
def write_scaffold(meta, answers, artifact_path, ...):
unknown = "unknown"
source = _SCAFFOLD_TEMPLATE.format(
framework=meta.framework or unknown,
class_name=meta.class_name or unknown,
input_hint=meta.input_hint or unknown,
output_hint=meta.output_hint or unknown,
)
Environment
- Area:
app/cli/core/writer.py
- Phase: 8 — depends on inspector overhaul (A1, A2) landing first
- Priority: Medium
Relevant logs or error output
KeyError: 'framework'
# or silently: scaffold contains "# Framework: None"
What happened?
After the inspector overhaul (issue A1/A2),
ArtifactMetadatafieldsframework,class_name,input_hint, andoutput_hintcan beNonewhen inspection partially failed.write_scaffoldinwriter.pyformats them directly into the scaffold template without guarding forNone.Nonein comments is harmless but misleading. If any field is removed fromArtifactMetadataduring the overhaul, the format call raisesKeyError.Environment
app/cli/core/writer.pyRelevant logs or error output