fix: Handle missing TimeWindow enum in export endpoint
Error: NameError TimeWindow not defined Fix: Graceful degradation if old metadata enums not available Gap report now optional (empty if old system unavailable) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
645967a2ab
commit
81681f0de3
|
|
@ -358,13 +358,28 @@ def export_placeholder_values_extended(
|
||||||
metadata.missing_reason = "Placeholder not in resolver output"
|
metadata.missing_reason = "Placeholder not in resolver output"
|
||||||
|
|
||||||
# Generate gap report (collect unresolved fields)
|
# Generate gap report (collect unresolved fields)
|
||||||
|
# Note: TimeWindow, OutputType, PlaceholderType are from old metadata system
|
||||||
|
# Skip gap report for old metadata if not available
|
||||||
|
gaps = {}
|
||||||
|
try:
|
||||||
|
from placeholder_metadata_complete import TimeWindow, OutputType, PlaceholderType
|
||||||
gaps = {
|
gaps = {
|
||||||
'unknown_time_window': [k for k, m in all_metadata.items() if m.time_window == TimeWindow.UNKNOWN],
|
'unknown_time_window': [k for k, m in all_metadata.items() if hasattr(m, 'time_window') and m.time_window == TimeWindow.UNKNOWN],
|
||||||
'unknown_output_type': [k for k, m in all_metadata.items() if m.output_type == OutputType.UNKNOWN],
|
'unknown_output_type': [k for k, m in all_metadata.items() if hasattr(m, 'output_type') and m.output_type == OutputType.UNKNOWN],
|
||||||
'legacy_unknown_type': [k for k, m in all_metadata.items() if m.type == PlaceholderType.LEGACY_UNKNOWN],
|
'legacy_unknown_type': [k for k, m in all_metadata.items() if hasattr(m, 'type') and m.type == PlaceholderType.LEGACY_UNKNOWN],
|
||||||
'unresolved_fields': {k: m.unresolved_fields for k, m in all_metadata.items() if m.unresolved_fields},
|
'unresolved_fields': {k: m.unresolved_fields for k, m in all_metadata.items() if hasattr(m, 'unresolved_fields') and m.unresolved_fields},
|
||||||
'legacy_mismatches': [k for k, m in all_metadata.items() if m.legacy_contract_mismatch],
|
'legacy_mismatches': [k for k, m in all_metadata.items() if hasattr(m, 'legacy_contract_mismatch') and m.legacy_contract_mismatch],
|
||||||
'orphaned': [k for k, m in all_metadata.items() if m.orphaned_placeholder],
|
'orphaned': [k for k, m in all_metadata.items() if hasattr(m, 'orphaned_placeholder') and m.orphaned_placeholder],
|
||||||
|
}
|
||||||
|
except ImportError:
|
||||||
|
# Old metadata system not available, use empty gaps
|
||||||
|
gaps = {
|
||||||
|
'unknown_time_window': [],
|
||||||
|
'unknown_output_type': [],
|
||||||
|
'legacy_unknown_type': [],
|
||||||
|
'unresolved_fields': {},
|
||||||
|
'legacy_mismatches': [],
|
||||||
|
'orphaned': [],
|
||||||
}
|
}
|
||||||
|
|
||||||
# Validation
|
# Validation
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user